glom r1671 - in trunk: . glom/mode_design/print_layouts glom/utility_widgets icons/16x16 po
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1671 - in trunk: . glom/mode_design/print_layouts glom/utility_widgets icons/16x16 po
- Date: Wed, 27 Aug 2008 13:36:35 +0000 (UTC)
Author: murrayc
Date: Wed Aug 27 13:36:35 2008
New Revision: 1671
URL: http://svn.gnome.org/viewvc/glom?rev=1671&view=rev
Log:
2008-08-27 Murray Cumming <murrayc murrayc com>
* glom/mode_design/print_layouts/action_layout_item.cc:
* glom/mode_design/print_layouts/action_layout_item.h: Removed this.
* glom/mode_design/print_layouts/Makefile.am:
* glom/mode_design/print_layouts/print_layout_toolbar.cc:
* glom/mode_design/print_layouts/print_layout_toolbar.h:
* glom/mode_design/print_layouts/print_layout_toolbar_button.cc:
* glom/mode_design/print_layouts/print_layout_toolbar_button.h:
* glom/mode_design/print_layouts/window_print_layout_edit.cc:
* glom/mode_design/print_layouts/window_print_layout_edit.h: Use a toolbar like
the details layout toolbar, which use EggToolPallette.
* glom/utility_widgets/layouttoolbar.cc:
* glom/utility_widgets/layouttoolbarbutton.cc:
* glom/utility_widgets/layouttoolbarbutton.h: Use std::string for filenames
and parts of filenames.
* icons/16x16/Makefile.am: Added placeholder images for extra items used on
print layouts.
Added:
trunk/icons/16x16/glom-line-horizontal.png
- copied unchanged from r1668, /trunk/icons/16x16/glom.png
trunk/icons/16x16/glom-line-vertical.png
- copied unchanged from r1668, /trunk/icons/16x16/glom.png
trunk/icons/16x16/glom-related-records.png
- copied unchanged from r1668, /trunk/icons/16x16/glom.png
Removed:
trunk/glom/mode_design/print_layouts/action_layout_item.cc
trunk/glom/mode_design/print_layouts/action_layout_item.h
Modified:
trunk/ChangeLog
trunk/glom/mode_design/print_layouts/Makefile.am
trunk/glom/mode_design/print_layouts/print_layout_toolbar.cc
trunk/glom/mode_design/print_layouts/print_layout_toolbar.h
trunk/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
trunk/glom/mode_design/print_layouts/print_layout_toolbar_button.h
trunk/glom/mode_design/print_layouts/window_print_layout_edit.cc
trunk/glom/mode_design/print_layouts/window_print_layout_edit.h
trunk/glom/utility_widgets/flowtable_dnd.cc
trunk/glom/utility_widgets/flowtable_dnd.h
trunk/glom/utility_widgets/layouttoolbar.cc
trunk/glom/utility_widgets/layouttoolbarbutton.cc
trunk/glom/utility_widgets/layouttoolbarbutton.h
trunk/icons/16x16/Makefile.am
trunk/po/Makefile.in.in
Modified: trunk/glom/mode_design/print_layouts/Makefile.am
==============================================================================
--- trunk/glom/mode_design/print_layouts/Makefile.am (original)
+++ trunk/glom/mode_design/print_layouts/Makefile.am Wed Aug 27 13:36:35 2008
@@ -1,16 +1,20 @@
SUBDIRS =
gladedir = $(datadir)/glom/glade/
+glom_icon_dir = $(datadir)/glom/pixmaps
# We define GLOM_GLADEDIR so that we can get the installed .glade file at runtime.
# We define PREFIX, SYSCONFDIR, LIBDIR, and DATADIR for the GNOME_PROGRAM_STANDARD_PROPERTIES macro.
AM_CPPFLAGS = -I top_srcdir@/ $(GLOM_CFLAGS) $(PYTHON_INCLUDES) \
- -DGLOM_GLADEDIR=\""$(gladedir)/"\"
+ -DGLOM_GLADEDIR=\""$(gladedir)/"\" \
+ -DGLOM_ICON_DIR=\""$(glom_icon_dir)"\"
noinst_LIBRARIES = libmode_design_print_layouts.a
-libmode_design_print_layouts_a_SOURCES = action_layout_item.h action_layout_item.cc \
- box_print_layouts.h box_print_layouts.cc \
+libmode_design_print_layouts_a_SOURCES = box_print_layouts.h box_print_layouts.cc \
window_print_layout_edit.h window_print_layout_edit.cc \
canvas_layout_item.h canvas_layout_item.cc \
canvas_print_layout.h canvas_print_layout.cc \
- dialog_text_formatting.h dialog_text_formatting.cc
+ dialog_text_formatting.h dialog_text_formatting.cc \
+ print_layout_toolbar.h print_layout_toolbar.cc \
+ print_layout_toolbar_button.h print_layout_toolbar_button.cc
+
Modified: trunk/glom/mode_design/print_layouts/print_layout_toolbar.cc
==============================================================================
--- trunk/glom/mode_design/print_layouts/print_layout_toolbar.cc (original)
+++ trunk/glom/mode_design/print_layouts/print_layout_toolbar.cc Wed Aug 27 13:36:35 2008
@@ -1,6 +1,6 @@
/* Glom
*
- * Copyright (C) 2007 Johannes Schmid <johannes schmid openismus com>
+ * Copyright (C) 2007, 2008 Openismus GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -18,26 +18,72 @@
* Boston, MA 02111-1307, USA.
*/
-#ifndef GLOM_UTILITY_WIDGETS_DRAGBAR_H
-#define GLOM_UTILITY_WIDGETS_DRAGBAR_H
+#include "print_layout_toolbar.h"
+#include "print_layout_toolbar_button.h"
+#include <gtkmm/stock.h>
+#include <glibmm/i18n.h>
+#include "config.h"
-#include <gtkmm/window.h>
-#include <gtkmm/handlebox.h>
-#include <gtkmm/box.h>
-
-#include "sidebar.h"
+//#include "layoutwidgetbase.h"
+#include <glom/utility_widgets/egg/toolpalette/eggtoolitemgroup.h>
namespace Glom
{
-class DragBar : public SideBar
+PrintLayoutToolbar::PrintLayoutToolbar()
{
-public:
- DragBar();
- ~DragBar();
+ // Looks ugly otherwise:
+ set_size_request(100, 200);
+
+ PrintLayoutToolbarButton* drag_field =
+ Gtk::manage(new PrintLayoutToolbarButton("glom-field.png", PrintLayoutToolbarButton::ITEM_FIELD,
+ _("Database Field"), _("Drag this to the layout to add a new database field.")));
+ PrintLayoutToolbarButton* drag_text =
+ Gtk::manage(new PrintLayoutToolbarButton("glom-text.png", PrintLayoutToolbarButton::ITEM_TEXT,
+ _("Text"), _("Drag this to the layout to add a new static text box.")));
+ PrintLayoutToolbarButton* drag_image =
+ Gtk::manage(new PrintLayoutToolbarButton("glom-image.png", PrintLayoutToolbarButton::ITEM_IMAGE,
+ _("Image"), _("Drag this to the layout to add a new static image.")));
+
+ PrintLayoutToolbarButton* drag_line_horizontal =
+ Gtk::manage(new PrintLayoutToolbarButton("glom-line-horizontal.png", PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL,
+ _("Horizontal Line"), _("Drag this to the layout to add a new horizontal line.")));
+ PrintLayoutToolbarButton* drag_line_vertical =
+ Gtk::manage(new PrintLayoutToolbarButton("glom-line-vertical.png", PrintLayoutToolbarButton::ITEM_LINE_VERTICAL,
+ _("Vertical Line"), _("Drag this to the layout to add a new vertical line.")));
+
+ PrintLayoutToolbarButton* drag_related_records =
+ Gtk::manage(new PrintLayoutToolbarButton("glom-related-records.png", PrintLayoutToolbarButton::ITEM_PORTAL,
+ _("Related Records"), _("Drag this to the layout to add a new related records portal.")));
+
+ //Note for translators: These are layout items, like widgets in GTK+.
+ GtkContainer* items_group = GTK_CONTAINER(egg_tool_item_group_new(_("Items")));
+ gtk_container_add(items_group, GTK_WIDGET(drag_field->gobj()));
+ gtk_container_add(items_group, GTK_WIDGET(drag_text->gobj()));
+ gtk_container_add(items_group, GTK_WIDGET(drag_image->gobj()));
+
+ //Note for translators: These are layout items, like widgets in GTK+.
+ GtkContainer* lines_group = GTK_CONTAINER(egg_tool_item_group_new(_("Lines")));
+ gtk_container_add(lines_group, GTK_WIDGET(drag_line_horizontal->gobj()));
+ gtk_container_add(lines_group, GTK_WIDGET(drag_line_vertical->gobj()));
+
+ //Note for translators: These are layout items, like widgets in GTK+.
+ GtkContainer* related_group = GTK_CONTAINER(egg_tool_item_group_new(_("Records")));
+ gtk_container_add(related_group, GTK_WIDGET(drag_related_records->gobj()));
+
+ add_group(EGG_TOOL_ITEM_GROUP(items_group));
+ add_group(EGG_TOOL_ITEM_GROUP(lines_group));
+ add_group(EGG_TOOL_ITEM_GROUP(related_group));
+
+ set_drag_source();
+
+ show_all_children();
+}
-};
+PrintLayoutToolbar::~PrintLayoutToolbar()
+{
+
+}
-} //namespace Glom
+} // namespace Glom
-#endif // GLOM_UTILITY_WIDGETS_DRAGBAR_H
Modified: trunk/glom/mode_design/print_layouts/print_layout_toolbar.h
==============================================================================
--- trunk/glom/mode_design/print_layouts/print_layout_toolbar.h (original)
+++ trunk/glom/mode_design/print_layouts/print_layout_toolbar.h Wed Aug 27 13:36:35 2008
@@ -25,16 +25,16 @@
#include <gtkmm/handlebox.h>
#include <gtkmm/box.h>
-#include "sidebar.h"
+#include <glom/utility_widgets/sidebar.h>
namespace Glom
{
-class DragBar : public SideBar
+class PrintLayoutToolbar : public SideBar
{
public:
- DragBar();
- ~DragBar();
+ PrintLayoutToolbar();
+ virtual ~PrintLayoutToolbar();
};
Modified: trunk/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
==============================================================================
--- trunk/glom/mode_design/print_layouts/print_layout_toolbar_button.cc (original)
+++ trunk/glom/mode_design/print_layouts/print_layout_toolbar_button.cc Wed Aug 27 13:36:35 2008
@@ -0,0 +1,78 @@
+/* Glom
+ *
+ * Copyright (C) 2007, 2008 Openismus GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "print_layout_toolbar_button.h"
+#include <iostream>
+
+namespace
+{
+
+std::string get_icon_path(const std::string& filename)
+{
+#ifdef G_OS_WIN32
+ gchar* basepath = g_win32_get_package_installation_subdirectory(NULL, NULL, "share/glom/pixmaps");
+ const std::string result = Glib::build_filename(basepath, filename);
+ g_free(basepath);
+ return result;
+#else
+ return Glib::build_filename(GLOM_ICON_DIR, filename);
+#endif
+}
+
+} //anonymous namespace
+
+
+namespace Glom
+{
+
+PrintLayoutToolbarButton::PrintLayoutToolbarButton(const std::string& icon_name, enumItems type,
+ const Glib::ustring& title, const Glib::ustring& tooltip)
+: Gtk::ToolButton( *(Gtk::manage (new Gtk::Image(get_icon_path(icon_name)))) )
+{
+ m_type = type;
+ g_object_set_data(G_OBJECT(gobj()), "glom-type", GINT_TO_POINTER(type));
+
+ std::list<Gtk::TargetEntry> targetentries;
+ targetentries.push_back(Gtk::TargetEntry(get_target()));
+
+ drag_source_set(targetentries, Gdk::MODIFIER_MASK,
+ Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
+ set_tooltip_text(tooltip);
+ set_label(title);
+}
+
+PrintLayoutToolbarButton::~PrintLayoutToolbarButton()
+{
+
+}
+
+void PrintLayoutToolbarButton::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
+ Gtk::SelectionData& selection_data, guint, guint)
+{
+ selection_data.set(8, (guint8*)(&m_type), 4);
+}
+
+void PrintLayoutToolbarButton::on_drag_begin(const Glib::RefPtr<Gdk::DragContext>& drag_context)
+{
+ drag_context->set_icon(dynamic_cast<Gtk::Image*>(get_icon_widget())->get_pixbuf(), 0, 0);
+}
+
+} // namespace Glom
+
Modified: trunk/glom/mode_design/print_layouts/print_layout_toolbar_button.h
==============================================================================
--- trunk/glom/mode_design/print_layouts/print_layout_toolbar_button.h (original)
+++ trunk/glom/mode_design/print_layouts/print_layout_toolbar_button.h Wed Aug 27 13:36:35 2008
@@ -0,0 +1,71 @@
+/* Glom
+ *
+ * Copyright (C) 2007, 2008 Openismus GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef GLOM_PRINT_LAYOUT_TOOLBAR_BUTTON_H
+#define GLOM_PRINT_LAYOUT_TOOLBAR_BUTTON_H
+
+#include <gtkmm/toolbutton.h>
+#include <gtkmm/image.h>
+#include <string>
+
+//#include "layoutwidgetbase.h"
+
+namespace Glom
+{
+
+class PrintLayoutToolbarButton : public Gtk::ToolButton
+{
+public:
+
+ //TODO: Use LayoutWidgetBase::enumType m_type instead (and just use LayoutToolbarButton?)
+ enum enumItems
+ {
+ ITEM_INVALID,
+ ITEM_FIELD,
+ ITEM_TEXT,
+ ITEM_IMAGE,
+ ITEM_PORTAL,
+ ITEM_LINE_HORIZONTAL,
+ ITEM_LINE_VERTICAL
+ };
+
+ PrintLayoutToolbarButton(const std::string& icon_name, enumItems type, const Glib::ustring& title, const Glib::ustring& tooltip);
+ virtual ~PrintLayoutToolbarButton();
+
+protected:
+
+ //TODO: What is this for? murrayc.
+ // We need an unique identifier for drag & drop! jhs
+ static const gchar* get_target()
+ {
+ return "flowtable";
+ };
+
+ virtual void on_drag_begin(const Glib::RefPtr<Gdk::DragContext>& drag_context);
+ virtual void on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& selection_data, guint, guint);
+
+private:
+ enumItems m_type;
+};
+
+}
+#endif //GLOM_PRINT_LAYOUT_TOOLBAR_BUTTON_H
+
Modified: trunk/glom/mode_design/print_layouts/window_print_layout_edit.cc
==============================================================================
--- trunk/glom/mode_design/print_layouts/window_print_layout_edit.cc (original)
+++ trunk/glom/mode_design/print_layouts/window_print_layout_edit.cc Wed Aug 27 13:36:35 2008
@@ -22,7 +22,6 @@
#include "window_print_layout_edit.h"
#include <glom/box_db_table.h>
#include "canvas_layout_item.h"
-#include "action_layout_item.h"
#include <glom/libglom/data_structure/layout/layoutitem_line.h>
#include <glom/libglom/data_structure/layout/layoutitem_portal.h>
//#include <libgnome/gnome-i18n.h>
@@ -48,7 +47,6 @@
m_drag_preview_requested(false),
m_vruler(0),
m_hruler(0),
- m_toolbar(0),
m_context_menu(0)
{
set_default_size(640, 480);
@@ -84,7 +82,9 @@
m_canvas.show();
//Make the canvas a drag-and-drop destination:
- m_drag_targets.push_back( Gtk::TargetEntry("glom_palette", Gtk::TARGET_SAME_APP) );
+ const GtkTargetEntry* target_entry = egg_tool_palette_get_drag_target_item();
+ Gtk::TargetEntry toolbar_target(*target_entry);
+ m_drag_targets.push_back(toolbar_target);
//Note that we don't use Gtk::DEST_DEFAULT_DEFAULTS because that would prevent our signal handlers from being used:
m_canvas.drag_dest_set(m_drag_targets, Gtk::DEST_DEFAULT_HIGHLIGHT, Gdk::ACTION_COPY);
@@ -98,7 +98,9 @@
sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_canvas_drag_leave) );
init_menu();
- init_toolbar();
+
+ m_palette_handle_box->add(m_toolbar);
+ m_toolbar.show();
m_scrolled_window.get_hadjustment()->signal_changed().connect(
sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_scroll_value_changed) );
@@ -221,72 +223,6 @@
add_accel_group(m_uimanager->get_accel_group());
}
-void Window_PrintLayout_Edit::init_toolbar()
-{
- m_toolbar_action_group = Gtk::ActionGroup::create();
-
- m_toolbar_action_group->add(Gtk::Action::create("Menu_Insert", Gtk::Stock::ADD, _("_Insert")));
- Glib::RefPtr<Action_LayoutItem> action = Action_LayoutItem::create("Action_Toolbar_Field", Gtk::Stock::ADD,_("Field"));
- action->set_layout_item_type(Action_LayoutItem::ITEM_FIELD);
- m_toolbar_action_group->add(action,
- sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_insert_field) );
- action = Action_LayoutItem::create("Action_Toolbar_Text", Gtk::Stock::ADD,_("Text"));
- action->set_layout_item_type(Action_LayoutItem::ITEM_TEXT);
- m_toolbar_action_group->add(action,
- sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_insert_text) );
- action = Action_LayoutItem::create("Action_Toolbar_Image", Gtk::Stock::ADD,_("Image"));
- action->set_layout_item_type(Action_LayoutItem::ITEM_IMAGE);
- m_toolbar_action_group->add(action,
- sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_insert_image) );
- action = Action_LayoutItem::create("Action_Toolbar_RelatedRecords", Gtk::Stock::ADD,_("Related Records"));
- action->set_layout_item_type(Action_LayoutItem::ITEM_PORTAL);
- m_toolbar_action_group->add(action,
- sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_insert_relatedrecords) );
- action = Action_LayoutItem::create("Action_Toolbar_LineHorizontal", Gtk::Stock::ADD,_("Horizontal Line"));
- action->set_layout_item_type(Action_LayoutItem::ITEM_LINE_HORIZONTAL);
- m_toolbar_action_group->add(action,
- sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_insert_line_horizontal) );
- action = Action_LayoutItem::create("Action_Toolbar_LineVertical", Gtk::Stock::ADD, _("Vertical Line"));
- action->set_layout_item_type(Action_LayoutItem::ITEM_LINE_VERTICAL);
- m_toolbar_action_group->add(action,
- sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_insert_line_vertical) );
-
- //Build part of the menu structure, to be merged in by using the "PH" placeholders:
- static const Glib::ustring ui_description =
- "<ui>"
- " <toolbar name='Toolbar'>"
- " <toolitem action='Action_Toolbar_Field' />"
- " <toolitem action='Action_Toolbar_Text' />"
- " <toolitem action='Action_Toolbar_Image' />"
- " <separator />"
- " <toolitem action='Action_Toolbar_LineHorizontal' />"
- " <toolitem action='Action_Toolbar_LineVertical' />"
- " <separator />"
- " <toolitem action='Action_Toolbar_RelatedRecords' />"
- " </toolbar>"
- "</ui>";
-
- m_toolbar_uimanager = Gtk::UIManager::create();
- m_toolbar_uimanager->insert_action_group(m_toolbar_action_group);
- m_toolbar_uimanager->add_ui_from_string(ui_description);
-
- //Toolbar:
- if(m_toolbar)
- delete m_toolbar;
-
- m_toolbar = static_cast<Gtk::Toolbar*>(m_toolbar_uimanager->get_widget("/Toolbar"));
- if(m_toolbar)
- {
- m_toolbar->set_orientation(Gtk::ORIENTATION_VERTICAL);
- m_palette_handle_box->add(*m_toolbar);
- m_toolbar->show();
- }
-
- add_accel_group(m_toolbar_uimanager->get_accel_group());
-
- make_toolbar_items_draggable();
-}
-
Glib::RefPtr<Gdk::Pixbuf> Window_PrintLayout_Edit::get_icon_for_toolbar_item(Gtk::ToolItem& item)
{
Glib::RefPtr<Gdk::Pixbuf> result;
@@ -334,7 +270,7 @@
return result;
}
-
+/*
void Window_PrintLayout_Edit::make_toolbar_items_draggable()
{
const int count = m_toolbar->get_n_items();
@@ -365,6 +301,7 @@
sigc::bind( sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_toolbar_item_drag_data_get), action) );
}
}
+*/
/*
void Window_PrintLayout_Edit::on_toolbar_item_drag_begin(const Glib::RefPtr<Gdk::DragContext>& drag_context)
@@ -378,12 +315,22 @@
}
*/
-void Window_PrintLayout_Edit::on_toolbar_item_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::SelectionData& selection_data, guint info, guint time, const Glib::RefPtr<Gtk::Action>& action)
+void Window_PrintLayout_Edit::on_toolbar_item_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::SelectionData& selection_data, guint info, guint time)
{
- //std::cout << "Window_PrintLayout_Edit::on_toolbar_item_drag_data_get" << std::endl;
+ //Put this code in the toolbar class:
+ Gtk::Widget* palette = drag_get_source_widget(drag_context);
+ while(palette && !EGG_IS_TOOL_PALETTE (palette->gobj()))
+ palette = palette->get_parent();
- Glib::RefPtr<Action_LayoutItem> action_derived = Glib::RefPtr<Action_LayoutItem>::cast_dynamic(action);
- Action_LayoutItem::enumItems type = action_derived ? action_derived->get_layout_item_type() : Action_LayoutItem::ITEM_INVALID;
+ if(!palette)
+ return;
+
+ GtkWidget* tool_item = egg_tool_palette_get_drag_item(EGG_TOOL_PALETTE (palette->gobj()), selection_data.gobj());
+ if(!tool_item)
+ return;
+
+ PrintLayoutToolbarButton::enumItems type =
+ static_cast<PrintLayoutToolbarButton::enumItems>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tool_item), "glom-type")));
selection_data.set(selection_data.get_target(), DRAG_DATA_FORMAT,
(const guchar*)&type,
@@ -393,7 +340,7 @@
bool Window_PrintLayout_Edit::on_canvas_drag_drop(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, guint timestamp)
{
- Glib::ustring target = m_canvas.drag_dest_find_target(drag_context);
+ const Glib::ustring target = m_canvas.drag_dest_find_target(drag_context);
if(target.empty())
return false;
@@ -405,14 +352,14 @@
return true; //Allow the drop.
}
-static Action_LayoutItem::enumItems get_item_type_from_selection_data(const Gtk::SelectionData& selection_data)
+static PrintLayoutToolbarButton::enumItems get_item_type_from_selection_data(const Gtk::SelectionData& selection_data)
{
- Action_LayoutItem::enumItems item_type = Action_LayoutItem::ITEM_INVALID;
+ PrintLayoutToolbarButton::enumItems item_type = PrintLayoutToolbarButton::ITEM_INVALID;
if((selection_data.get_length() >= 0) && (selection_data.get_format() == DRAG_DATA_FORMAT))
{
const guint8* data = selection_data.get_data();
if(data)
- item_type = (Action_LayoutItem::enumItems)(data[0]);
+ item_type = (PrintLayoutToolbarButton::enumItems)(data[0]);
}
return item_type;
@@ -420,7 +367,7 @@
bool Window_PrintLayout_Edit::on_canvas_drag_motion(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, guint timestamp)
{
- Glib::ustring target = m_canvas.drag_dest_find_target(drag_context);
+ const Glib::ustring target = m_canvas.drag_dest_find_target(drag_context);
if(target.empty())
return false;
@@ -449,16 +396,16 @@
return true; //Allow the drop.
}
-sharedptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(Action_LayoutItem::enumItems item_type)
+sharedptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayoutToolbarButton::enumItems item_type)
{
sharedptr<LayoutItem> layout_item;
- if(item_type == Action_LayoutItem::ITEM_FIELD)
+ if(item_type == PrintLayoutToolbarButton::ITEM_FIELD)
{
layout_item = sharedptr<LayoutItem_Field>::create();
layout_item->set_print_layout_position(0, 0, 50, 10);
}
- else if(item_type == Action_LayoutItem::ITEM_TEXT)
+ else if(item_type == PrintLayoutToolbarButton::ITEM_TEXT)
{
sharedptr<LayoutItem_Text> layout_item_derived = sharedptr<LayoutItem_Text>::create();
@@ -467,24 +414,24 @@
layout_item = layout_item_derived;
layout_item->set_print_layout_position(0, 0, 50, 10);
}
- else if(item_type == Action_LayoutItem::ITEM_IMAGE)
+ else if(item_type == PrintLayoutToolbarButton::ITEM_IMAGE)
{
layout_item = sharedptr<LayoutItem_Image>::create();
layout_item->set_print_layout_position(0, 0, 50, 50);
}
- else if(item_type == Action_LayoutItem::ITEM_LINE_HORIZONTAL)
+ else if(item_type == PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL)
{
sharedptr<LayoutItem_Line> layout_item_derived = sharedptr<LayoutItem_Line>::create();
layout_item_derived->set_coordinates(0, 0, 100, 0);
layout_item = layout_item_derived;
}
- else if(item_type == Action_LayoutItem::ITEM_LINE_VERTICAL)
+ else if(item_type == PrintLayoutToolbarButton::ITEM_LINE_VERTICAL)
{
sharedptr<LayoutItem_Line> layout_item_derived = sharedptr<LayoutItem_Line>::create();
layout_item_derived->set_coordinates(0, 0, 0, 100);
layout_item = layout_item_derived;
}
- else if(item_type == Action_LayoutItem::ITEM_PORTAL)
+ else if(item_type == PrintLayoutToolbarButton::ITEM_PORTAL)
{
layout_item = sharedptr<LayoutItem_Portal>::create();
layout_item->set_print_layout_position(0, 0, 100, 50);
@@ -499,7 +446,7 @@
//or after our drag_motion handler has called drag_get_data()):
//Discover what toolbar item was dropped:
- const Action_LayoutItem::enumItems item_type = get_item_type_from_selection_data(selection_data);
+ const PrintLayoutToolbarButton::enumItems item_type = get_item_type_from_selection_data(selection_data);
if(m_drag_preview_requested)
{
@@ -775,7 +722,7 @@
void Window_PrintLayout_Edit::on_menu_insert_field()
{
- sharedptr<LayoutItem> layout_item = create_empty_item(Action_LayoutItem::ITEM_FIELD);
+ sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_FIELD);
// Note to translators: This is the default contents of a text item on a print layout:
set_default_position(layout_item);
@@ -786,7 +733,7 @@
void Window_PrintLayout_Edit::on_menu_insert_text()
{
- sharedptr<LayoutItem> layout_item = create_empty_item(Action_LayoutItem::ITEM_TEXT);
+ sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_TEXT);
set_default_position(layout_item);
Glib::RefPtr<CanvasLayoutItem> item = CanvasLayoutItem::create(layout_item);
@@ -795,7 +742,7 @@
void Window_PrintLayout_Edit::on_menu_insert_image()
{
- sharedptr<LayoutItem> layout_item = create_empty_item(Action_LayoutItem::ITEM_IMAGE);
+ sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_IMAGE);
// Note to translators: This is the default contents of a text item on a print layout:
//layout_item->set_text(_("text"));
set_default_position(layout_item);
@@ -806,7 +753,7 @@
void Window_PrintLayout_Edit::on_menu_insert_relatedrecords()
{
- sharedptr<LayoutItem> layout_item = create_empty_item(Action_LayoutItem::ITEM_PORTAL);
+ sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_PORTAL);
set_default_position(layout_item);
Glib::RefPtr<CanvasLayoutItem> item = CanvasLayoutItem::create(layout_item);
@@ -815,7 +762,7 @@
void Window_PrintLayout_Edit::on_menu_insert_line_horizontal()
{
- sharedptr<LayoutItem> layout_item = create_empty_item(Action_LayoutItem::ITEM_LINE_HORIZONTAL);
+ sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL);
/*
double item_x = m_drop_x;
@@ -833,7 +780,7 @@
void Window_PrintLayout_Edit::on_menu_insert_line_vertical()
{
- sharedptr<LayoutItem> layout_item = create_empty_item(Action_LayoutItem::ITEM_LINE_VERTICAL);
+ sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_LINE_VERTICAL);
/*
double item_x = m_drop_x;
Modified: trunk/glom/mode_design/print_layouts/window_print_layout_edit.h
==============================================================================
--- trunk/glom/mode_design/print_layouts/window_print_layout_edit.h (original)
+++ trunk/glom/mode_design/print_layouts/window_print_layout_edit.h Wed Aug 27 13:36:35 2008
@@ -23,14 +23,15 @@
#include <glom/libglom/data_structure/print_layout.h>
#include <glom/mode_design/print_layouts/canvas_print_layout.h>
-#include <glom/mode_design/print_layouts/action_layout_item.h>
+#include <glom/mode_design/print_layouts/print_layout_toolbar.h>
+#include <glom/mode_design/print_layouts/print_layout_toolbar_button.h>
#include <glom/libglom/document/document_glom.h>
#include <gtkmm/window.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <gtkmm/box.h>
#include <gtkmm/uimanager.h>
-#include <gtkmm/toggleaction.h>
+//#include <gtkmm/toggleaction.h>
#include <gtkmm/ruler.h>
#include <libglademm/xml.h>
@@ -55,8 +56,8 @@
void enable_buttons();
void init_menu();
- void init_toolbar();
- void make_toolbar_items_draggable();
+
+ sharedptr<LayoutItem> create_empty_item(PrintLayoutToolbarButton::enumItems item_type);
void on_menu_file_page_setup();
void on_menu_insert_field();
@@ -77,11 +78,9 @@
void on_scroll_value_changed();
void on_button_close();
- sharedptr<LayoutItem> create_empty_item(Action_LayoutItem::enumItems item_type);
-
//void on_toolbar_item_drag_begin(const Glib::RefPtr<Gdk::DragContext>& drag_context);
//void on_toolbar_item_drag_end(const Glib::RefPtr<Gdk::DragContext>& drag_context);
- void on_toolbar_item_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::SelectionData& selection_data, guint info, guint time, const Glib::RefPtr<Gtk::Action>& action);
+ void on_toolbar_item_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::SelectionData& selection_data, guint info, guint time);
bool on_canvas_drag_drop(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, guint timestamp);
bool on_canvas_drag_motion(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, guint timestamp);
void on_canvas_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, const Gtk::SelectionData& selection_data, guint info, guint timestamp);
@@ -132,11 +131,9 @@
Glib::RefPtr<Gtk::ToggleAction> m_action_zoom_fit_page_width;
//Toolbar:
- Gtk::Toolbar* m_toolbar;
- Glib::RefPtr<Gtk::ActionGroup> m_toolbar_action_group;
- Glib::RefPtr<Gtk::UIManager> m_toolbar_uimanager;
- Gtk::HandleBox* m_palette_handle_box;
+ Gtk::HandleBox* m_palette_handle_box; //TODO: The toolbar is already a HandleBox.
std::list<Gtk::TargetEntry> m_drag_targets;
+ PrintLayoutToolbar m_toolbar;
//Context menu for clicking on empty space on the canvas:
Gtk::Menu* m_context_menu;
Modified: trunk/glom/utility_widgets/flowtable_dnd.cc
==============================================================================
--- trunk/glom/utility_widgets/flowtable_dnd.cc (original)
+++ trunk/glom/utility_widgets/flowtable_dnd.cc Wed Aug 27 13:36:35 2008
@@ -69,7 +69,7 @@
typedef Glib::ListHandle<Gtk::Widget*>::const_iterator CI;
Glib::ListHandle<Gtk::Widget*> children = container->get_children();
for(CI cur_child = children.begin(); cur_child != children.end();
- ++cur_child)
+ ++cur_child)
{
start_dnd(*(*cur_child));
}
@@ -81,7 +81,7 @@
child.drag_source_set(source_targets, Gdk::ModifierType(GDK_BUTTON1_MASK | GDK_BUTTON3_MASK),
Gdk::DragAction(GDK_ACTION_COPY | GDK_ACTION_MOVE));
child.signal_drag_begin().connect (sigc::bind<Gtk::Widget*>(sigc::mem_fun (*this, &FlowTableDnd::on_child_drag_begin), &child), false);
- child.signal_drag_end().connect (sigc::bind<Gtk::Widget*>(sigc::mem_fun (*this, &FlowTableDnd::on_child_drag_end), &child), false);
+ child.signal_drag_end().connect(sigc::bind<Gtk::Widget*>(sigc::mem_fun (*this, &FlowTableDnd::on_child_drag_end), &child), false);
child.signal_drag_data_get().connect (sigc::bind<Gtk::Widget*>(sigc::mem_fun (*this, &FlowTableDnd::on_child_drag_data_get), &child), false);
child.signal_drag_data_delete().connect (sigc::bind<Gtk::Widget*>(sigc::mem_fun (*this, &FlowTableDnd::on_child_drag_data_delete), &child), false);
@@ -89,28 +89,30 @@
{
std::list<Gtk::TargetEntry> drag_targets;
const GtkTargetEntry* target_entry = egg_tool_palette_get_drag_target_item();
- Gtk::TargetEntry toolbar_target (*target_entry);
+ Gtk::TargetEntry toolbar_target(*target_entry);
Gtk::TargetEntry move_target(MOVE_TARGET);
drag_targets.push_back(toolbar_target);
drag_targets.push_back(move_target);
- Glib::RefPtr<Gtk::TargetList> targets =
- child.drag_dest_get_target_list ();
- // The widget has already a default drag destination - add more targets
+ Glib::RefPtr<Gtk::TargetList> targets = child.drag_dest_get_target_list();
+
+ // The widget has already a default drag destination - add more targets:
if(targets)
{
targets->add (drag_targets);
child.drag_dest_set_target_list (targets);
}
else
+ {
child.drag_dest_set(drag_targets, Gtk::DEST_DEFAULT_ALL,
Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
-
+ }
+
// It's important to connect this one BEFORE
child.signal_drag_motion().connect(sigc::bind<Gtk::Widget*>(sigc::mem_fun (*this, &FlowTableDnd::on_child_drag_motion), &child),
- false);
+ false);
child.signal_drag_data_received().connect(sigc::bind<Gtk::Widget*>(sigc::mem_fun (*this, &FlowTableDnd::on_child_drag_data_received), &child));
- child.signal_drag_leave().connect(sigc::mem_fun (*this, &FlowTableDnd::on_child_drag_leave));
+ child.signal_drag_leave().connect(sigc::mem_fun(*this, &FlowTableDnd::on_child_drag_leave));
}
}
@@ -120,7 +122,7 @@
dynamic_cast<FlowTableDnd*>(&child))
return;
- // Call this method recursive for all (real) children
+ // Call this method recursively for all (real) children:
Gtk::Container* container = dynamic_cast<Gtk::Container*>(&child);
if(container)
{
@@ -132,6 +134,7 @@
stop_dnd (*(*cur_child));
}
}
+
child.drag_source_unset();
}
Modified: trunk/glom/utility_widgets/flowtable_dnd.h
==============================================================================
--- trunk/glom/utility_widgets/flowtable_dnd.h (original)
+++ trunk/glom/utility_widgets/flowtable_dnd.h Wed Aug 27 13:36:35 2008
@@ -52,8 +52,8 @@
void on_child_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& drag_context,
Gtk::SelectionData& selection_data, guint, guint time, Gtk::Widget* child);
void on_child_drag_data_delete(const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::Widget* child);
- void on_child_drag_begin (const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::Widget* child);
- void on_child_drag_end (const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::Widget* child);
+ void on_child_drag_begin(const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::Widget* child);
+ void on_child_drag_end(const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::Widget* child);
void start_dnd(Gtk::Widget& child);
void stop_dnd(Gtk::Widget& child);
@@ -62,13 +62,13 @@
// Methods for the different layout object,
// to be implemented in the derived class.
- virtual void on_dnd_add_layout_item_field (LayoutWidgetBase* above) = 0;
+ virtual void on_dnd_add_layout_item_field(LayoutWidgetBase* above) = 0;
virtual void on_dnd_add_layout_group(LayoutWidgetBase* above) = 0;
- virtual void on_dnd_add_layout_item_button (LayoutWidgetBase* above) = 0;
- virtual void on_dnd_add_layout_item_text (LayoutWidgetBase* above) = 0;
- virtual void on_dnd_add_layout_item_image (LayoutWidgetBase* above) = 0;
- virtual void on_dnd_add_layout_notebook (LayoutWidgetBase* above) = 0;
- virtual void on_dnd_add_layout_item (LayoutWidgetBase* above,
+ virtual void on_dnd_add_layout_item_button(LayoutWidgetBase* above) = 0;
+ virtual void on_dnd_add_layout_item_text(LayoutWidgetBase* above) = 0;
+ virtual void on_dnd_add_layout_item_image(LayoutWidgetBase* above) = 0;
+ virtual void on_dnd_add_layout_notebook(LayoutWidgetBase* above) = 0;
+ virtual void on_dnd_add_layout_item(LayoutWidgetBase* above,
sharedptr<LayoutItem>& item) = 0;
virtual void on_dnd_add_placeholder(LayoutWidgetBase* above) = 0;
Modified: trunk/glom/utility_widgets/layouttoolbar.cc
==============================================================================
--- trunk/glom/utility_widgets/layouttoolbar.cc (original)
+++ trunk/glom/utility_widgets/layouttoolbar.cc Wed Aug 27 13:36:35 2008
@@ -64,13 +64,15 @@
_("Database Field"), _("Drag this to the layout to add a new database field.")));
LayoutToolbarButton* drag_button =
Gtk::manage(new LayoutToolbarButton("glom-button.png", LayoutWidgetBase::TYPE_BUTTON,
- _("Button"), _("Drag this to the layout to cadd a new button.")));
+ _("Button"), _("Drag this to the layout to add a new button.")));
LayoutToolbarButton* drag_text =
- Gtk::manage(new LayoutToolbarButton("glom-group.png", LayoutWidgetBase::TYPE_TEXT,
+ Gtk::manage(new LayoutToolbarButton("glom-text.png", LayoutWidgetBase::TYPE_TEXT,
_("Group"), _("Drag this to the layout to add a new static text box.")));
LayoutToolbarButton* drag_image =
Gtk::manage(new LayoutToolbarButton("glom-image.png", LayoutWidgetBase::TYPE_IMAGE,
_("Image"), _("Drag this to the layout to add a new static image.")));
+
+ //TODO: Add a drag item for the related records item.
//Note for translators: These are container layout items, containing child layout items, like container widgets in GTK+.
GtkContainer* container_group = GTK_CONTAINER(egg_tool_item_group_new(_("Containers")));
Modified: trunk/glom/utility_widgets/layouttoolbarbutton.cc
==============================================================================
--- trunk/glom/utility_widgets/layouttoolbarbutton.cc (original)
+++ trunk/glom/utility_widgets/layouttoolbarbutton.cc Wed Aug 27 13:36:35 2008
@@ -23,11 +23,11 @@
namespace
{
-Glib::ustring get_icon_path(const Glib::ustring& filename)
+std::string get_icon_path(const std::string& filename)
{
#ifdef G_OS_WIN32
gchar* basepath = g_win32_get_package_installation_subdirectory(NULL, NULL, "share/glom/pixmaps");
- Glib::ustring result = Glib::build_filename(basepath, filename);
+ const std::string result = Glib::build_filename(basepath, filename);
g_free(basepath);
return result;
#else
@@ -41,7 +41,7 @@
namespace Glom
{
-LayoutToolbarButton::LayoutToolbarButton(const Glib::ustring& icon_name, LayoutWidgetBase::enumType type,
+LayoutToolbarButton::LayoutToolbarButton(const std::string& icon_name, LayoutWidgetBase::enumType type,
const Glib::ustring& title, const Glib::ustring& tooltip)
: Gtk::ToolButton( *(Gtk::manage (new Gtk::Image(get_icon_path(icon_name)))) )
{
Modified: trunk/glom/utility_widgets/layouttoolbarbutton.h
==============================================================================
--- trunk/glom/utility_widgets/layouttoolbarbutton.h (original)
+++ trunk/glom/utility_widgets/layouttoolbarbutton.h Wed Aug 27 13:36:35 2008
@@ -34,7 +34,7 @@
class LayoutToolbarButton : public Gtk::ToolButton
{
public:
- LayoutToolbarButton(const Glib::ustring& icon_name, LayoutWidgetBase::enumType type, const Glib::ustring& title, const Glib::ustring& tooltip);
+ LayoutToolbarButton(const std::string& icon_name, LayoutWidgetBase::enumType type, const Glib::ustring& title, const Glib::ustring& tooltip);
virtual ~LayoutToolbarButton();
protected:
@@ -43,7 +43,7 @@
// We need an unique identifier for drag & drop! jhs
static const gchar* get_target()
{
- return "flowtable";
+ return "glom_print_layout_palette";
};
virtual void on_drag_begin(const Glib::RefPtr<Gdk::DragContext>& drag_context);
Modified: trunk/icons/16x16/Makefile.am
==============================================================================
--- trunk/icons/16x16/Makefile.am (original)
+++ trunk/icons/16x16/Makefile.am Wed Aug 27 13:36:35 2008
@@ -7,6 +7,9 @@
glom-button.png \
glom-text.png \
glom-image.png \
- glom-notebook.png
+ glom-notebook.png \
+ glom-line-horizontal.png \
+ glom-line-vertical.png \
+ glom-related-records.png
EXTRA_DIST = $(icon_DATA) $(pixmaps_DATA) glom.svg
Modified: trunk/po/Makefile.in.in
==============================================================================
--- trunk/po/Makefile.in.in (original)
+++ trunk/po/Makefile.in.in Wed Aug 27 13:36:35 2008
@@ -56,9 +56,9 @@
PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi)
-USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi)
+USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep ^$$lang$$`"; then printf "$$lang "; fi; done; fi)
-USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
+USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
@@ -101,7 +101,6 @@
install-data: install-data- USE_NLS@
install-data-no: all
install-data-yes: all
- $(mkdir_p) $(DESTDIR)$(itlocaledir)
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]