diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2012-12-25 18:27:15 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@googlemail.com> | 2012-12-25 18:27:15 +0000 |
| commit | bdfa35f01e14b6f63c5f13022ce0c46289d5f1d8 (patch) | |
| tree | 47f03d5c010e49ce906a7ad66160b0b3a2b012d8 /src | |
| parent | desktop-widget: Use GtkStyleContext for GTK+ 3 widget rendering (diff) | |
| download | inkscape-bdfa35f01e14b6f63c5f13022ce0c46289d5f1d8.tar.gz inkscape-bdfa35f01e14b6f63c5f13022ce0c46289d5f1d8.zip | |
Stop using UNUSED_PIXELS hack in ruler. This was only required because of the padding used in the desktop widget
(bzr r11985)
Diffstat (limited to 'src')
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 29 | ||||
| -rw-r--r-- | src/widgets/ruler.cpp | 11 |
2 files changed, 12 insertions, 28 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 97b226d74..beca03c19 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -321,8 +321,6 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) new (&dtw->modified_connection) sigc::connection(); - GtkWidget *widget = GTK_WIDGET (dtw); - dtw->window = 0; dtw->desktop = NULL; dtw->_interaction_disabled_counter = 0; @@ -386,26 +384,19 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) g_signal_connect (G_OBJECT (eventbox), "motion_notify_event", G_CALLBACK (sp_dt_hruler_event), dtw); #if GTK_CHECK_VERSION(3,0,0) - GtkBorder border; - GtkStyleContext *context = gtk_widget_get_style_context(widget); - gtk_style_context_get_border(context, static_cast<GtkStateFlags>(0), &border); - GtkWidget *tbl = gtk_grid_new(); GtkWidget *canvas_tbl = gtk_grid_new(); - gtk_widget_set_margin_left(eventbox, border.left); - gtk_widget_set_margin_right(eventbox, border.right); gtk_grid_attach(GTK_GRID(canvas_tbl), eventbox, 1, 0, 1, 1); #else - guint xthickness = gtk_widget_get_style(widget)->xthickness; - guint ythickness = gtk_widget_get_style(widget)->ythickness; - GtkWidget *tbl = gtk_table_new(2, 3, FALSE); GtkWidget *canvas_tbl = gtk_table_new(3, 3, FALSE); - gtk_table_attach(GTK_TABLE (canvas_tbl), eventbox, 1, 2, 0, 1, - GTK_FILL, GTK_FILL, - xthickness, 0); + gtk_table_attach(GTK_TABLE(canvas_tbl), + eventbox, + 1, 2, 0, 1, + GTK_FILL, GTK_FILL, + 0, 0); #endif gtk_box_pack_start( GTK_BOX(dtw->hbox), tbl, TRUE, TRUE, 1 ); @@ -419,13 +410,13 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) gtk_container_add (GTK_CONTAINER (eventbox), GTK_WIDGET (dtw->vruler)); #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_top(eventbox, border.top); - gtk_widget_set_margin_bottom(eventbox, border.bottom); gtk_grid_attach(GTK_GRID(canvas_tbl), eventbox, 0, 1, 1, 1); #else - gtk_table_attach(GTK_TABLE (canvas_tbl), eventbox, 0, 1, 1, 2, - GTK_FILL, GTK_FILL, - 0, ythickness); + gtk_table_attach(GTK_TABLE (canvas_tbl), + eventbox, + 0, 1, 1, 2, + GTK_FILL, GTK_FILL, + 0, 0); #endif g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (sp_dt_vruler_event), dtw); diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 60bbb4b14..e26b13fa7 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -797,13 +797,6 @@ sp_ruler_draw_pos (SPRuler *ruler) } } -// FIXME: Figure out why this is different in Gtk+ 2 and Gtk+ 3 -#if GTK_CHECK_VERSION(3,0,0) -# define UNUSED_PIXELS 0 -#else -# define UNUSED_PIXELS 2 // There appear to be two pixels that are not being used at each end of the ruler -#endif - /** * sp_ruler_new: * @orientation: the ruler's orientation @@ -1032,7 +1025,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) if ((upper - lower) == 0) goto out; - increment = (gdouble) (width + 2*UNUSED_PIXELS) / (upper - lower); // screen pixels per ruler unit + increment = (gdouble) width / (upper - lower); /* determine the scale * Use the maximum extents of the ruler to determine the largest @@ -1091,7 +1084,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) // be e.g. 641.50000000000; rounding behaviour is not defined in such a case (see round.h) // and jitter will be apparent (upon redrawing some of the lines on the ruler might jump a // by a pixel, and jump back on the next redraw). This is suppressed by adding 1e-9 (that's only one nanopixel ;-)) - pos = gint(Inkscape::round((cur - lower) * increment + 1e-12)) - UNUSED_PIXELS; + pos = gint(Inkscape::round((cur - lower) * increment + 1e-12)); #if GTK_CHECK_VERSION(3,0,0) if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) |
