[glom] Print Layout: Add Select All and Unselect All menu items.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Print Layout: Add Select All and Unselect All menu items.
- Date: Mon, 8 Aug 2011 18:51:15 +0000 (UTC)
commit 4f9c8d2f76adee3b65478e055784c56bd1ac273b
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Aug 8 20:51:02 2011 +0200
Print Layout: Add Select All and Unselect All menu items.
* glom/print_layout/canvas_print_layout.[h|cc]: Added select_all(bool)
* glom/mode_design/print_layouts/window_print_layout_edit.[h|cc]:
init_menus(): Edit menu: Add Select All and Unselect All menu items,
which call that method.
ChangeLog | 9 ++++++++
.../print_layouts/window_print_layout_edit.cc | 20 ++++++++++++++++++
.../print_layouts/window_print_layout_edit.h | 2 +
glom/print_layout/canvas_print_layout.cc | 22 ++++++++++++++++++++
glom/print_layout/canvas_print_layout.h | 5 ++++
5 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e77a788..9eb113b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2011-08-08 Murray Cumming <murrayc murrayc com>
+ Print Layout: Add Select All and Unselect All menu items.
+
+ * glom/print_layout/canvas_print_layout.[h|cc]: Added select_all(bool)
+ * glom/mode_design/print_layouts/window_print_layout_edit.[h|cc]:
+ init_menus(): Edit menu: Add Select All and Unselect All menu items,
+ which call that method.
+
+2011-08-08 Murray Cumming <murrayc murrayc com>
+
Print Layout: Add a Show Outlines menu item
* glom/mode_design/print_layouts/window_print_layout_edit.[h|cc]
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 195dd67..e403423 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -181,6 +181,13 @@ void Window_PrintLayout_Edit::init_menu()
m_action_group->add(m_action_edit_delete,
sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_delete) );
+ m_action_group->add(
+ Gtk::Action::create("Action_Menu_Edit_SelectAll", Gtk::Stock::SELECT_ALL),
+ sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_selectall) );
+ m_action_group->add(
+ Gtk::Action::create("Action_Menu_Edit_UnselectAll", _("Unselect All")), //TODO: Propose a new stock item for GTK+.
+ sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_edit_unselectall) );
+
m_action_group->add(Gtk::Action::create("Menu_Insert", _("_Insert")));
m_action_group->add(Gtk::Action::create("Action_Menu_Insert_Field", _("Insert _Field")),
sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_menu_insert_field) );
@@ -237,6 +244,9 @@ void Window_PrintLayout_Edit::init_menu()
" <menuitem action='Action_Menu_Edit_Copy' />"
" <menuitem action='Action_Menu_Edit_Paste' />"
" <menuitem action='Action_Menu_Edit_Delete' />"
+ " <separator />"
+ " <menuitem action='Action_Menu_Edit_SelectAll' />"
+ " <menuitem action='Action_Menu_Edit_UnselectAll' />"
" </menu>"
" <menu action='Menu_Insert'>"
" <menuitem action='Action_Menu_Insert_Field' />"
@@ -981,6 +991,16 @@ void Window_PrintLayout_Edit::on_menu_edit_delete()
m_layout_items_selected.clear();
}
+void Window_PrintLayout_Edit::on_menu_edit_selectall()
+{
+ m_canvas.select_all();
+}
+
+void Window_PrintLayout_Edit::on_menu_edit_unselectall()
+{
+ m_canvas.select_all(false);
+}
+
static void spinbutton_set_max(Gtk::SpinButton& spinbutton, double max)
{
spinbutton.set_range(0, max);
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.h b/glom/mode_design/print_layouts/window_print_layout_edit.h
index 895a786..717b7e1 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.h
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.h
@@ -79,6 +79,8 @@ private:
void on_menu_edit_copy();
void on_menu_edit_paste();
void on_menu_edit_delete();
+ void on_menu_edit_selectall();
+ void on_menu_edit_unselectall();
void on_canvas_show_context_menu(guint button, guint32 activate_time);
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index c12bcc5..f702f2e 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -908,4 +908,26 @@ void Canvas_PrintLayout::set_outlines_visibility(bool visible)
}
}
+void Canvas_PrintLayout::select_all(bool selected)
+{
+ Glib::RefPtr<Goocanvas::Item> root = m_items_group;
+ if(!root)
+ return;
+
+ const int count = root->get_n_children();
+ for(int i = 0; i < count; ++i)
+ {
+ Glib::RefPtr<Goocanvas::Item> child = root->get_child(i);
+ Glib::RefPtr<CanvasLayoutItem> derived =
+ Glib::RefPtr<CanvasLayoutItem>::cast_dynamic(child);
+ if(!derived)
+ continue;
+
+ derived->set_selected(selected);
+ }
+
+ signal_selection_changed().emit();
+}
+
+
} //namespace Glom
diff --git a/glom/print_layout/canvas_print_layout.h b/glom/print_layout/canvas_print_layout.h
index 6723b60..3a86790 100644
--- a/glom/print_layout/canvas_print_layout.h
+++ b/glom/print_layout/canvas_print_layout.h
@@ -70,6 +70,11 @@ public:
/** Get any items that have get_selected()==true.
*/
virtual type_vec_items get_selected_items();
+
+ /** Set all items as selected or unselected.
+ * @param selected Use false to unselect all.
+ */
+ void select_all(bool selected = true);
private:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]