[glade/margins: 3/8] Made margins edit mode snap bu 8px while holding ALT
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/margins: 3/8] Made margins edit mode snap bu 8px while holding ALT
- Date: Fri, 20 May 2011 20:36:19 +0000 (UTC)
commit a503fad23e981a7a2632f423d89e9f6048e7ba55
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Tue Apr 26 17:13:53 2011 -0300
Made margins edit mode snap bu 8px while holding ALT
gladeui/glade-design-layout.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c
index 894bea7..dff5756 100644
--- a/gladeui/glade-design-layout.c
+++ b/gladeui/glade-design-layout.c
@@ -42,6 +42,8 @@
#define OUTLINE_WIDTH 4
#define PADDING 10
+#define MARGIN_STEP 8
+
typedef enum
{
ACTIVITY_NONE,
@@ -276,18 +278,21 @@ glade_design_layout_motion_notify_event (GtkWidget *widget, GdkEventMotion *ev)
case ACTIVITY_MARGINS:
{
gboolean shift = ev->state & GDK_SHIFT_MASK;
+ gboolean snap = ev->state & GDK_MOD1_MASK;
GtkWidget *selection = priv->selection;
Margins margin = priv->margin;
if (margin & MARGIN_TOP)
{
gint val = MAX (0, priv->m_dy - y);
+ if (snap) val = (val/MARGIN_STEP)*MARGIN_STEP;
gtk_widget_set_margin_top (selection, val);
if (shift) gtk_widget_set_margin_bottom (selection, val);
}
else if (margin & MARGIN_BOTTOM)
{
gint val = MAX (0, y - priv->m_dy);
+ if (snap) val = (val/MARGIN_STEP)*MARGIN_STEP;
gtk_widget_set_margin_bottom (selection, val);
if (shift) gtk_widget_set_margin_top (selection, val);
}
@@ -295,12 +300,14 @@ glade_design_layout_motion_notify_event (GtkWidget *widget, GdkEventMotion *ev)
if (margin & MARGIN_LEFT)
{
gint val = MAX (0, priv->m_dx - x);
+ if (snap) val = (val/MARGIN_STEP)*MARGIN_STEP;
gtk_widget_set_margin_left (selection, val);
if (shift) gtk_widget_set_margin_right (selection, val);
}
else if (margin & MARGIN_RIGHT)
{
gint val = MAX (0, x - priv->m_dx);
+ if (snap) val = (val/MARGIN_STEP)*MARGIN_STEP;
gtk_widget_set_margin_right (selection, val);
if (shift) gtk_widget_set_margin_left (selection, val);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]