[glom] Print Layout: Snap to grid when dragging items from the toolbar.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Print Layout: Snap to grid when dragging items from the toolbar.
- Date: Mon, 8 Aug 2011 10:29:28 +0000 (UTC)
commit 5a18ae92226f4d50072f9de51c067e6cc4aa9fc2
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Aug 8 00:04:23 2011 +0200
Print Layout: Snap to grid when dragging items from the toolbar.
* glom/utility_widgets/canvas/canvas_group_resizable.h:
snap_position(): Make this public.
* glom/mode_design/print_layouts/window_print_layout_edit.cc:
on_canvas_drag_motion(), on_canvas_drag_data_received():
Snap the position to the grid (or rules), like we do when dragging
an existing item.
ChangeLog | 11 +++++++++++
.../print_layouts/window_print_layout_edit.cc | 3 +++
.../canvas/canvas_group_resizable.h | 3 +--
3 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0ec9a01..0fa7d0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-08-08 Murray Cumming <murrayc murrayc com>
+
+ Print Layout: Snap to grid when dragging items from the toolbar.
+
+ * glom/utility_widgets/canvas/canvas_group_resizable.h:
+ snap_position(): Make this public.
+ * glom/mode_design/print_layouts/window_print_layout_edit.cc:
+ on_canvas_drag_motion(), on_canvas_drag_data_received():
+ Snap the position to the grid (or rules), like we do when dragging
+ an existing item.
+
2011-08-07 Murray Cumming <murrayc murrayc com>
Print Layout: Improve the grid appearance.
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 3ab074f..e8f05a0 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -413,6 +413,7 @@ bool Window_PrintLayout_Edit::on_canvas_drag_motion(const Glib::RefPtr<Gdk::Drag
double item_x = x;
double item_y = y;
canvas_convert_from_drag_pixels(item_x, item_y);
+ m_layout_item_dropping->snap_position(item_x, item_y);
m_layout_item_dropping->set_xy(item_x, item_y);
@@ -507,6 +508,7 @@ void Window_PrintLayout_Edit::on_canvas_drag_data_received(const Glib::RefPtr<Gd
double item_x = x;
double item_y = y;
canvas_convert_from_drag_pixels(item_x, item_y);
+ m_layout_item_dropping->snap_position(item_x, item_y);
m_layout_item_dropping->set_xy(item_x, item_y);
}
}
@@ -527,6 +529,7 @@ void Window_PrintLayout_Edit::on_canvas_drag_data_received(const Glib::RefPtr<Gd
double item_x = x;
double item_y = y;
canvas_convert_from_drag_pixels(item_x, item_y);
+ item->snap_position(item_x, item_y);
item->set_xy(item_x, item_y);
if(m_layout_item_dropping)
diff --git a/glom/utility_widgets/canvas/canvas_group_resizable.h b/glom/utility_widgets/canvas/canvas_group_resizable.h
index 11d3843..422bd8b 100644
--- a/glom/utility_widgets/canvas/canvas_group_resizable.h
+++ b/glom/utility_widgets/canvas/canvas_group_resizable.h
@@ -61,6 +61,7 @@ public:
virtual void set_width_height(double width, double height);
virtual void set_grid(const Glib::RefPtr<const CanvasGroupGrid>& grid);
+ virtual void snap_position(double& x, double& y) const;
typedef sigc::signal<void> type_signal_resized;
@@ -71,8 +72,6 @@ private:
virtual void show_selected();
virtual Goocanvas::Canvas* get_parent_canvas_widget();
- virtual void snap_position(double& x, double& y) const;
-
enum Corners
{
CORNER_TOP_LEFT,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]