diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2012-12-02 18:53:59 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2012-12-02 18:53:59 +0000 |
| commit | b04301b979000497c3e4d7b799044b6964ad9a66 (patch) | |
| tree | 244d3abb8d20211d9ada33127bec84b7adc73e26 /src | |
| parent | Fix permissive casting in sp-color-wheel-selector (diff) | |
| download | inkscape-b04301b979000497c3e4d7b799044b6964ad9a66.tar.gz inkscape-b04301b979000497c3e4d7b799044b6964ad9a66.zip | |
Migrate sp-color-scales to GtkGrid and fix alignment in sp-color-wheel-selector
(bzr r11922)
Diffstat (limited to 'src')
| -rw-r--r-- | src/widgets/sp-color-scales.cpp | 40 | ||||
| -rw-r--r-- | src/widgets/sp-color-wheel-selector.cpp | 2 |
2 files changed, 39 insertions, 3 deletions
diff --git a/src/widgets/sp-color-scales.cpp b/src/widgets/sp-color-scales.cpp index 159fc96e5..95c6d341d 100644 --- a/src/widgets/sp-color-scales.cpp +++ b/src/widgets/sp-color-scales.cpp @@ -133,13 +133,16 @@ void sp_color_scales_init (SPColorScales *cs) void ColorScales::init() { - GtkWidget *t; gint i; _updating = FALSE; _dragging = FALSE; - t = gtk_table_new (5, 3, FALSE); +#if GTK_CHECK_VERSION(3,0,0) + GtkWidget *t = gtk_grid_new(); +#else + GtkWidget *t = gtk_table_new (5, 3, FALSE); +#endif gtk_widget_show (t); gtk_box_pack_start (GTK_BOX (_csel), t, TRUE, TRUE, 4); @@ -149,20 +152,51 @@ void ColorScales::init() _l[i] = gtk_label_new(""); gtk_misc_set_alignment (GTK_MISC (_l[i]), 1.0, 0.5); gtk_widget_show (_l[i]); + +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_margin_left(_l[i], XPAD); + gtk_widget_set_margin_right(_l[i], XPAD); + gtk_widget_set_margin_top(_l[i], YPAD); + gtk_widget_set_margin_bottom(_l[i], YPAD); + gtk_grid_attach(GTK_GRID(t), _l[i], 0, i, 1, 1); +#else gtk_table_attach (GTK_TABLE (t), _l[i], 0, 1, i, i + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); +#endif + /* Adjustment */ _a[i] = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, _rangeLimit, 1.0, 10.0, 10.0); /* Slider */ _s[i] = sp_color_slider_new (_a[i]); gtk_widget_show (_s[i]); - gtk_table_attach (GTK_TABLE (t), _s[i], 1, 2, i, i + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)GTK_FILL, XPAD, YPAD); + +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_margin_left(_s[i], XPAD); + gtk_widget_set_margin_right(_s[i], XPAD); + gtk_widget_set_margin_top(_s[i], YPAD); + gtk_widget_set_margin_bottom(_s[i], YPAD); + gtk_widget_set_hexpand(_s[i], TRUE); + gtk_grid_attach(GTK_GRID(t), _s[i], 1, i, 1, 1); +#else + gtk_table_attach (GTK_TABLE (t), _s[i], 1, 2, i, i + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, XPAD, YPAD); +#endif /* Spinbutton */ _b[i] = gtk_spin_button_new (GTK_ADJUSTMENT (_a[i]), 1.0, 0); sp_dialog_defocus_on_enter (_b[i]); gtk_label_set_mnemonic_widget (GTK_LABEL(_l[i]), _b[i]); gtk_widget_show (_b[i]); + +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_margin_left(_b[i], XPAD); + gtk_widget_set_margin_right(_b[i], XPAD); + gtk_widget_set_margin_top(_b[i], YPAD); + gtk_widget_set_margin_bottom(_b[i], YPAD); + gtk_widget_set_halign(_b[i], GTK_ALIGN_CENTER); + gtk_widget_set_valign(_b[i], GTK_ALIGN_CENTER); + gtk_grid_attach(GTK_GRID(t), _b[i], 2, i, 1, 1); +#else gtk_table_attach (GTK_TABLE (t), _b[i], 2, 3, i, i + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); +#endif /* Attach channel value to adjustment */ g_object_set_data (G_OBJECT (_a[i]), "channel", GINT_TO_POINTER (i)); diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 57ce86ff6..a979a168a 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -235,6 +235,8 @@ void ColorWheelSelector::init() gtk_widget_set_margin_right(_sbtn, XPAD); gtk_widget_set_margin_top(_sbtn, YPAD); gtk_widget_set_margin_bottom(_sbtn, YPAD); + gtk_widget_set_halign(_sbtn, GTK_ALIGN_CENTER); + gtk_widget_set_valign(_sbtn, GTK_ALIGN_CENTER); gtk_grid_attach(GTK_GRID(t), _sbtn, 2, row, 1, 1); #else gtk_table_attach (GTK_TABLE (t), _sbtn, 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); |
