[glom] Print Layout: Make ruler markers follow the cursor.



commit bdd839aafd12a6b1afec098a752dab42c1b713d7
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Aug 9 17:34:17 2011 +0200

    Print Layout: Make ruler markers follow the cursor.
    
    * glom/mode_design/print_layouts/window_print_layout_edit.[h|cc]:
    Handle motion-notify-event so the rules track the cursor position.
    This is not very useful, but it feels nice, and is what other apps do.

 ChangeLog                                          |    8 ++++++++
 .../print_layouts/window_print_layout_edit.cc      |   13 +++++++++++++
 .../print_layouts/window_print_layout_edit.h       |    2 +-
 3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6a5c2c8..62911ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-08-09  Murray Cumming  <murrayc murrayc com>
 
+	Print Layout: Make ruler markers follow the cursor.
+
+	* glom/mode_design/print_layouts/window_print_layout_edit.[h|cc]:
+	Handle motion-notify-event so the rules track the cursor position.
+	This is not very useful, but it feels nice, and is what other apps do.
+
+2011-08-09  Murray Cumming  <murrayc murrayc com>
+
 	Application: Remove unused member variable.
 
 	* glom/application.[h|cc]: Remove m_pBoxSidebar.
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 8a1c710..b45dee9 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -146,6 +146,8 @@ Window_PrintLayout_Edit::Window_PrintLayout_Edit(BaseObjectType* cobject, const
   setup_context_menu();
   m_canvas.signal_show_context().connect(sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_canvas_show_context_menu));
 
+  m_canvas.signal_motion_notify_event().connect(sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_canvas_motion_notify_event));
+
   m_canvas.signal_selection_changed().connect(
     sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_canvas_selection_changed));
   on_canvas_selection_changed(); //Disable relevant widgets or actions by default.
@@ -726,6 +728,17 @@ void Window_PrintLayout_Edit::setup_context_menu()
   m_context_menu = dynamic_cast<Gtk::Menu*>( m_context_menu_uimanager->get_widget("/ContextMenu") ); 
 }
 
+bool Window_PrintLayout_Edit::on_canvas_motion_notify_event(GdkEventMotion* event)
+{
+  double x = event->x;
+  double y = event->y;
+  canvas_convert_from_drag_pixels(x, y);
+
+  gimp_ruler_set_position(m_hruler, x);
+  gimp_ruler_set_position(m_vruler, y);
+
+  return false;
+}
 
 void Window_PrintLayout_Edit::on_canvas_show_context_menu(guint button, guint32 activate_time)
 {
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 717b7e1..325b9b6 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.h
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.h
@@ -82,7 +82,7 @@ private:
   void on_menu_edit_selectall();
   void on_menu_edit_unselectall();
 
-
+  bool on_canvas_motion_notify_event(GdkEventMotion* event);
   void on_canvas_show_context_menu(guint button, guint32 activate_time);
   void on_context_menu_insert_field();
   void on_context_menu_insert_text();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]