GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 72e63887 authored by Simon Budig's avatar Simon Budig Committed by Michael Natterer

libgimpwidgets: convert GimpSizeEntry to a GtkGrid.

parent 509813c1
......@@ -271,13 +271,10 @@ layer_options_dialog_new (GimpImage *image,
private->size_se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a",
TRUE, TRUE, FALSE, 10,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (private->size_se), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (private->size_se), 0, 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (private->size_se), spinbutton,
1, 2, 0, 1);
gtk_grid_attach (GTK_GRID (private->size_se), spinbutton, 1, 0, 1, 1);
gtk_widget_show (spinbutton);
gtk_table_attach (GTK_TABLE (table), private->size_se, 1, 2, row, row + 2,
......@@ -335,13 +332,10 @@ layer_options_dialog_new (GimpImage *image,
private->offset_se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a",
TRUE, TRUE, FALSE, 10,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (private->offset_se), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (private->offset_se), 0, 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->offset_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (private->offset_se), spinbutton,
1, 2, 0, 1);
gtk_grid_attach (GTK_GRID (private->offset_se), spinbutton, 1, 0, 1, 1);
gtk_widget_show (spinbutton);
gtk_table_attach (GTK_TABLE (table), private->offset_se, 1, 2, row, row + 2,
......
......@@ -178,14 +178,9 @@ offset_dialog_new (GimpDrawable *drawable,
TRUE, TRUE, FALSE, 10,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (private->off_se), 0, 4);
gtk_table_set_col_spacing (GTK_TABLE (private->off_se), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (private->off_se), 0, 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->off_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (private->off_se), spinbutton,
1, 2, 0, 1);
gtk_grid_attach (GTK_GRID (private->off_se), spinbutton, 1, 0, 1, 1);
gtk_widget_show (spinbutton);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (private->off_se),
......
......@@ -2570,8 +2570,8 @@ prefs_dialog_new (Gimp *gimp,
g_free (pixels_per_unit);
}
gtk_table_set_col_spacings (GTK_TABLE (entry), 2);
gtk_table_set_row_spacings (GTK_TABLE (entry), 2);
gtk_grid_set_column_spacing (GTK_GRID (entry), 2);
gtk_grid_set_row_spacing (GTK_GRID (entry), 2);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry),
_("Horizontal"), 0, 1, 0.0);
......
......@@ -190,20 +190,17 @@ print_size_dialog_new (GimpImage *image,
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 0, 2);
gtk_widget_show (hbox);
gtk_table_set_row_spacing (GTK_TABLE (entry), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (entry), 1, 6);
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_widget_show (entry);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
GTK_SPIN_BUTTON (height), NULL);
gtk_table_attach_defaults (GTK_TABLE (entry), height, 0, 1, 1, 2);
gtk_grid_attach (GTK_GRID (entry), height, 0, 1, 1, 1);
gtk_widget_show (height);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
GTK_SPIN_BUTTON (width), NULL);
gtk_table_attach_defaults (GTK_TABLE (entry), width, 0, 1, 0, 1);
gtk_grid_attach (GTK_GRID (entry), width, 0, 0, 1, 1);
gtk_widget_show (width);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0,
......@@ -256,21 +253,17 @@ print_size_dialog_new (GimpImage *image,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
private->resolution_entry = GIMP_SIZE_ENTRY (entry);
gtk_table_set_row_spacing (GTK_TABLE (entry), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (entry), 1, 2);
gtk_table_set_col_spacing (GTK_TABLE (entry), 2, 2);
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_widget_show (entry);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
GTK_SPIN_BUTTON (height), NULL);
gtk_table_attach_defaults (GTK_TABLE (entry), height, 0, 1, 1, 2);
gtk_grid_attach (GTK_GRID (entry), height, 0, 1, 1, 1);
gtk_widget_show (height);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
GTK_SPIN_BUTTON (width), NULL);
gtk_table_attach_defaults (GTK_TABLE (entry), width, 0, 1, 0, 1);
gtk_grid_attach (GTK_GRID (entry), width, 0, 0, 1, 1);
gtk_widget_show (width);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (entry), 0,
......@@ -286,7 +279,7 @@ print_size_dialog_new (GimpImage *image,
chain = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
if (ABS (private->xres - private->yres) < GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain), TRUE);
gtk_table_attach_defaults (GTK_TABLE (entry), chain, 1, 2, 0, 2);
gtk_grid_attach (GTK_GRID (entry), chain, 1, 0, 1, 2);
gtk_widget_show (chain);
private->chain = GIMP_CHAIN_BUTTON (chain);
......
......@@ -244,15 +244,9 @@ resize_dialog_new (GimpViewable *viewable,
private->offset = entry = gimp_size_entry_new (1, unit, "%p",
TRUE, FALSE, FALSE, SB_WIDTH,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (entry), 0, 6);
gtk_table_set_col_spacing (GTK_TABLE (entry), 1, 6);
gtk_table_set_col_spacing (GTK_TABLE (entry), 3, 12);
gtk_table_set_row_spacing (GTK_TABLE (entry), 0, 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (entry), spinbutton,
1, 2, 0, 1);
gtk_grid_attach (GTK_GRID (entry), spinbutton, 1, 0, 1, 1);
gtk_widget_show (spinbutton);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry),
......@@ -275,7 +269,7 @@ resize_dialog_new (GimpViewable *viewable,
private);
button = gtk_button_new_with_mnemonic (_("C_enter"));
gtk_table_attach_defaults (GTK_TABLE (entry), button, 4, 5, 1, 2);
gtk_grid_attach (GTK_GRID (entry), button, 4, 1, 1, 1);
gtk_widget_show (button);
g_signal_connect (button, "clicked",
......
......@@ -824,7 +824,7 @@ gimp_rectangle_options_prop_dimension_frame_new (GObject *config,
*entry = gimp_size_entry_new (1, unit_value, "%a", TRUE, TRUE, FALSE,
SB_WIDTH, GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacings (GTK_TABLE (*entry), 0);
gtk_grid_set_column_spacing (GTK_GRID (*entry), 0);
gimp_size_entry_show_unit_menu (GIMP_SIZE_ENTRY (*entry), FALSE);
gtk_box_pack_end (GTK_BOX (hbox), *entry, TRUE, TRUE, 0);
gtk_widget_show (*entry);
......
......@@ -188,8 +188,8 @@ gimp_grid_editor_constructed (GObject *object)
editor->yresolution,
TRUE);
gtk_table_set_col_spacings (GTK_TABLE (sizeentry), 2);
gtk_table_set_row_spacings (GTK_TABLE (sizeentry), 2);
gtk_grid_set_column_spacing (GTK_GRID (sizeentry), 2);
gtk_grid_set_row_spacing (GTK_GRID (sizeentry), 2);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
_("Horizontal"), 0, 1, 0.0);
......@@ -223,8 +223,8 @@ gimp_grid_editor_constructed (GObject *object)
editor->yresolution,
TRUE);
gtk_table_set_col_spacings (GTK_TABLE (sizeentry), 2);
gtk_table_set_row_spacings (GTK_TABLE (sizeentry), 2);
gtk_grid_set_column_spacing (GTK_GRID (sizeentry), 2);
gtk_grid_set_row_spacing (GTK_GRID (sizeentry), 2);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
_("Horizontal"), 0, 1, 0.0);
......
......@@ -229,7 +229,7 @@ gimp_size_box_constructed (GObject *object)
g_list_free (children);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_table_attach_defaults (GTK_TABLE (entry), vbox, 1, 3, 2, 3);
gtk_grid_attach (GTK_GRID (entry), vbox, 1, 2, 2, 1);
gtk_widget_show (vbox);
label = gtk_label_new (NULL);
......
......@@ -220,20 +220,17 @@ gimp_template_editor_constructed (GObject *object)
TRUE, FALSE, FALSE, SB_WIDTH,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_row_spacing (GTK_TABLE (private->size_se), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (private->size_se), 1, 6);
gtk_box_pack_start (GTK_BOX (hbox), private->size_se, FALSE, FALSE, 0);
gtk_widget_show (private->size_se);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
GTK_SPIN_BUTTON (height), NULL);
gtk_table_attach_defaults (GTK_TABLE (private->size_se), height, 0, 1, 1, 2);
gtk_grid_attach (GTK_GRID (private->size_se), height, 0, 1, 1, 1);
gtk_widget_show (height);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
GTK_SPIN_BUTTON (width), NULL);
gtk_table_attach_defaults (GTK_TABLE (private->size_se), width, 0, 1, 0, 1);
gtk_grid_attach (GTK_GRID (private->size_se), width, 0, 0, 1, 1);
gtk_widget_show (width);
gimp_prop_coordinates_connect (G_OBJECT (template),
......@@ -350,23 +347,17 @@ gimp_template_editor_constructed (GObject *object)
FALSE, FALSE, FALSE, SB_WIDTH,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gtk_table_set_row_spacing (GTK_TABLE (private->resolution_se), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (private->resolution_se), 1, 2);
gtk_table_set_col_spacing (GTK_TABLE (private->resolution_se), 2, 2);
gtk_box_pack_start (GTK_BOX (hbox), private->resolution_se, FALSE, FALSE, 0);
gtk_widget_show (private->resolution_se);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->resolution_se),
GTK_SPIN_BUTTON (yres), NULL);
gtk_table_attach_defaults (GTK_TABLE (private->resolution_se), yres,
0, 1, 1, 2);
gtk_grid_attach (GTK_GRID (private->resolution_se), yres, 0, 1, 1, 1);
gtk_widget_show (yres);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->resolution_se),
GTK_SPIN_BUTTON (xres), NULL);
gtk_table_attach_defaults (GTK_TABLE (private->resolution_se), xres,
0, 1, 0, 1);
gtk_grid_attach (GTK_GRID (private->resolution_se), xres, 0, 0, 1, 1);
gtk_widget_show (xres);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
......@@ -378,8 +369,7 @@ gimp_template_editor_constructed (GObject *object)
/* the resolution chainbutton */
private->chain_button = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
gtk_table_attach_defaults (GTK_TABLE (private->resolution_se),
private->chain_button, 1, 2, 0, 2);
gtk_grid_attach (GTK_GRID (private->resolution_se), private->chain_button, 1, 0, 1, 2);
gtk_widget_show (private->chain_button);
gimp_prop_coordinates_connect (G_OBJECT (template),
......
......@@ -209,7 +209,6 @@ gimp_text_style_editor_init (GimpTextStyleEditor *editor)
editor->size_entry =
gimp_size_entry_new (1, 0, "%a", TRUE, FALSE, FALSE, 10,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (editor->size_entry), 1, 0);
gtk_box_pack_start (GTK_BOX (editor->upper_hbox), editor->size_entry,
FALSE, FALSE, 0);
gtk_widget_show (editor->size_entry);
......
......@@ -2861,7 +2861,6 @@ gimp_prop_size_entry_new (GObject *config,
gimp_prop_size_entry_num_chars (lower, upper) + 1 +
gimp_unit_get_scaled_digits (unit_value, resolution),
update_policy);
gtk_table_set_col_spacing (GTK_TABLE (entry), 1, 2);
set_param_spec (NULL,
gimp_size_entry_get_help_widget (GIMP_SIZE_ENTRY (entry), 0),
......@@ -3132,7 +3131,7 @@ gimp_prop_coordinates_new (GObject *config,
if (has_chainbutton)
{
chainbutton = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
gtk_table_attach_defaults (GTK_TABLE (entry), chainbutton, 1, 3, 3, 4);
gtk_grid_attach (GTK_GRID (entry), chainbutton, 1, 3, 2, 1);
gtk_widget_show (chainbutton);
}
......
......@@ -126,7 +126,7 @@ static gboolean gimp_size_entry_eevl_unit_resolver (const gchar *ident,
gpointer data);
G_DEFINE_TYPE (GimpSizeEntry, gimp_size_entry, GTK_TYPE_TABLE)
G_DEFINE_TYPE (GimpSizeEntry, gimp_size_entry, GTK_TYPE_GRID)
#define parent_class gimp_size_entry_parent_class
......@@ -243,7 +243,7 @@ gimp_size_entry_finalize (GObject *object)
*
* 7. gimp_size_entry_set_refval() (or gimp_size_entry_set_value())
*
* The #GimpSizeEntry is derived from #GtkTable and will have
* The #GimpSizeEntry is derived from #GtkGrid and will have
* an empty border of one cell width on each side plus an empty column left
* of the #GimpUnitComboBox to allow the caller to add labels or a
* #GimpChainButton.
......@@ -274,10 +274,6 @@ gimp_size_entry_new (gint number_of_fields,
gse->show_refval = show_refval;
gse->update_policy = update_policy;
gtk_table_resize (GTK_TABLE (gse),
1 + gse->show_refval + 2,
number_of_fields + 1 + 3);
/* show the 'pixels' menu entry only if we are a 'size' sizeentry and
* don't have the reference value spinbutton
*/
......@@ -343,9 +339,8 @@ gimp_size_entry_new (gint number_of_fields,
spinbutton_width, -1);
}
gtk_table_attach_defaults (GTK_TABLE (gse), gsef->value_spinbutton,
i+1, i+2,
gse->show_refval+1, gse->show_refval+2);
gtk_grid_attach (GTK_GRID (gse), gsef->value_spinbutton,
i+1, gse->show_refval+1, 1, 1);
g_signal_connect (gsef->value_adjustment, "value-changed",
G_CALLBACK (gimp_size_entry_value_callback),
gsef);
......@@ -366,8 +361,8 @@ gimp_size_entry_new (gint number_of_fields,
gtk_widget_set_size_request (gsef->refval_spinbutton,
spinbutton_width, -1);
gtk_table_attach_defaults (GTK_TABLE (gse), gsef->refval_spinbutton,
i + 1, i + 2, 1, 2);
gtk_grid_attach (GTK_GRID (gse), gsef->refval_spinbutton,
i + 1, 1, 1, 1);
g_signal_connect (gsef->refval_adjustment,
"value-changed",
G_CALLBACK (gimp_size_entry_refval_callback),
......@@ -412,10 +407,8 @@ gimp_size_entry_new (gint number_of_fields,
gimp_unit_combo_box_set_active (GIMP_UNIT_COMBO_BOX (gse->unitmenu), unit);
gtk_table_attach (GTK_TABLE (gse), gse->unitmenu,
i+2, i+3,
gse->show_refval+1, gse->show_refval+2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (gse), gse->unitmenu,
i+2, gse->show_refval+1, 1, 1);
g_signal_connect (gse->unitmenu, "changed",
G_CALLBACK (gimp_size_entry_unit_callback),
gse);
......@@ -514,7 +507,7 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
* @column: The column where the label will be attached.
* @alignment: The horizontal alignment of the label.
*
* Attaches a #GtkLabel to the #GimpSizeEntry (which is a #GtkTable).
* Attaches a #GtkLabel to the #GimpSizeEntry (which is a #GtkGrid).
*
* Returns: A pointer to the new #GtkLabel widget.
**/
......@@ -562,8 +555,7 @@ gimp_size_entry_attach_label (GimpSizeEntry *gse,
gtk_label_set_xalign (GTK_LABEL (label), alignment);
gtk_table_attach (GTK_TABLE (gse), label, column, column+1, row, row+1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (gse), label, column, row, 1, 1);
gtk_widget_show (label);
return label;
......@@ -1509,7 +1501,7 @@ gimp_size_entry_set_pixel_digits (GimpSizeEntry *gse,
* @gse: The sizeentry you want to grab the keyboard focus.
*
* This function is rather ugly and just a workaround for the fact that
* it's impossible to implement gtk_widget_grab_focus() for a #GtkTable.
* it's impossible to implement gtk_widget_grab_focus() for a #GtkGrid (is this actually true after the Table->Grid conversion?).
**/
void
gimp_size_entry_grab_focus (GimpSizeEntry *gse)
......
......@@ -46,7 +46,7 @@ typedef struct _GimpSizeEntryField GimpSizeEntryField;
struct _GimpSizeEntry
{
GtkTable parent_instance;
GtkGrid parent_instance;
GSList *fields;
gint number_of_fields;
......@@ -62,7 +62,7 @@ struct _GimpSizeEntry
struct _GimpSizeEntryClass
{
GtkTableClass parent_class;
GtkGridClass parent_class;
void (* value_changed) (GimpSizeEntry *gse);
void (* refval_changed) (GimpSizeEntry *gse);
......
......@@ -757,11 +757,9 @@ gimp_coordinates_new (GimpUnit unit,
FALSE,
spinbutton_width,
update_policy);
gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 0, 4);
gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 2, 4);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (sizeentry), spinbutton, 1, 2, 0, 1);
gtk_grid_attach (GTK_GRID (sizeentry), spinbutton, 1, 0, 1, 1);
gtk_widget_show (spinbutton);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
......@@ -797,8 +795,7 @@ gimp_coordinates_new (GimpUnit unit,
if (chainbutton_active)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE);
gtk_table_attach (GTK_TABLE (sizeentry), chainbutton, 2, 3, 0, 2,
GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_grid_attach (GTK_GRID (sizeentry), chainbutton, 2, 0, 1, 2);
gtk_widget_show (chainbutton);
data = g_slice_new (GimpCoordinatesData);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment