[gimp/gtk3-port: 350/454] selection-to-path: kill GtkTable
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 350/454] selection-to-path: kill GtkTable
- Date: Wed, 16 May 2018 21:50:08 +0000 (UTC)
commit e7ded2bd3cdd4063dc7653bf1d74e7008c11bb73
Author: Simon Budig <simon budig de>
Date: Sat May 5 16:32:17 2018 +0200
selection-to-path: kill GtkTable
.../selection-to-path/selection-to-path-dialog.c | 327 ++++++++++----------
1 files changed, 163 insertions(+), 164 deletions(-)
---
diff --git a/plug-ins/selection-to-path/selection-to-path-dialog.c
b/plug-ins/selection-to-path/selection-to-path-dialog.c
index 93739d0..c3c380c 100644
--- a/plug-ins/selection-to-path/selection-to-path-dialog.c
+++ b/plug-ins/selection-to-path/selection-to-path-dialog.c
@@ -84,65 +84,65 @@ def_val (gdouble default_value)
GtkWidget *
dialog_create_selection_area (SELVALS *sels)
{
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *check;
GtkAdjustment *adj;
gint row;
- table = gtk_table_new (20, 3, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 6);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
row = 0;
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Align Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->align_threshold,
- 0.2, 2.0, 0.1, 0.1, 2,
- TRUE, 0, 0,
- _("If two endpoints are closer than this, "
- "they are made to be equal."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Align Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->align_threshold,
+ 0.2, 2.0, 0.1, 0.1, 2,
+ TRUE, 0, 0,
+ _("If two endpoints are closer than this, "
+ "they are made to be equal."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->align_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (0.5));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Corner Always Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->corner_always_threshold,
- 30, 180, 1, 1, 2,
- TRUE, 0, 0,
- _("If the angle defined by a point and its predecessors "
- "and successors is smaller than this, it's a corner, "
- "even if it's within `corner_surround' pixels of a "
- "point with a smaller angle."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Corner Always Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->corner_always_threshold,
+ 30, 180, 1, 1, 2,
+ TRUE, 0, 0,
+ _("If the angle defined by a point and its predecessors "
+ "and successors is smaller than this, it's a corner, "
+ "even if it's within `corner_surround' pixels of a "
+ "point with a smaller angle."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->corner_always_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (60.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Corner Surround:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->corner_surround,
- 3, 8, 1, 1, 0,
- TRUE, 0, 0,
- _("Number of points to consider when determining if a "
- "point is a corner or not."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Corner Surround:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->corner_surround,
+ 3, 8, 1, 1, 0,
+ TRUE, 0, 0,
+ _("Number of points to consider when determining if a "
+ "point is a corner or not."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->corner_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (4.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Corner Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->corner_threshold,
- 0, 180, 1, 1, 2,
- TRUE, 0, 0,
- _("If a point, its predecessors, and its successors "
- "define an angle smaller than this, it's a corner."),
- NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Corner Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->corner_threshold,
+ 0, 180, 1, 1, 2,
+ TRUE, 0, 0,
+ _("If a point, its predecessors, and its successors "
+ "define an angle smaller than this, it's a corner."),
+ NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->corner_threshold);
@@ -150,28 +150,28 @@ dialog_create_selection_area (SELVALS *sels)
g_object_set_data (G_OBJECT (adj), "default_value", def_val (100.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Error Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->error_threshold,
- 0.2, 10, 0.1, 0.1, 2,
- TRUE, 0, 0,
- _("Amount of error at which a fitted spline is "
- "unacceptable. If any pixel is further away "
- "than this from the fitted curve, we try again."),
- NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Error Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->error_threshold,
+ 0.2, 10, 0.1, 0.1, 2,
+ TRUE, 0, 0,
+ _("Amount of error at which a fitted spline is "
+ "unacceptable. If any pixel is further away "
+ "than this from the fitted curve, we try again."),
+ NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->error_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (0.40));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Filter Alternative Surround:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->filter_alternative_surround,
- 1, 10, 1, 1, 0,
- TRUE, 0, 0,
- _("A second number of adjacent points to consider "
- "when filtering."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Filter Alternative Surround:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->filter_alternative_surround,
+ 1, 10, 1, 1, 0,
+ TRUE, 0, 0,
+ _("A second number of adjacent points to consider "
+ "when filtering."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->filter_alternative_surround);
@@ -179,71 +179,71 @@ dialog_create_selection_area (SELVALS *sels)
g_object_set_data (G_OBJECT (adj), "default_value", def_val (1.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Filter Epsilon:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->filter_epsilon,
- 5, 40, 1, 1, 2,
- TRUE, 0, 0,
- _("If the angles between the vectors produced by "
- "filter_surround and filter_alternative_surround "
- "points differ by more than this, use the one from "
- "filter_alternative_surround."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Filter Epsilon:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->filter_epsilon,
+ 5, 40, 1, 1, 2,
+ TRUE, 0, 0,
+ _("If the angles between the vectors produced by "
+ "filter_surround and filter_alternative_surround "
+ "points differ by more than this, use the one from "
+ "filter_alternative_surround."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->filter_epsilon);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (10.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Filter Iteration Count:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->filter_iteration_count,
- 4, 70, 1, 1, 0,
- TRUE, 0, 0,
- _("Number of times to smooth original data points. "
- "Increasing this number dramatically --- to 50 or "
- "so --- can produce vastly better results. But if "
- "any points that ``should'' be corners aren't found, "
- "the curve goes to hell around that point."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Filter Iteration Count:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->filter_iteration_count,
+ 4, 70, 1, 1, 0,
+ TRUE, 0, 0,
+ _("Number of times to smooth original data points. "
+ "Increasing this number dramatically --- to 50 or "
+ "so --- can produce vastly better results. But if "
+ "any points that ``should'' be corners aren't found, "
+ "the curve goes to hell around that point."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->filter_iteration_count);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (4.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Filter Percent:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->filter_percent,
- 0, 1, 0.05, 0.01, 2,
- TRUE, 0, 0,
- _("To produce the new point, use the old point plus "
- "this times the neighbors."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Filter Percent:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->filter_percent,
+ 0, 1, 0.05, 0.01, 2,
+ TRUE, 0, 0,
+ _("To produce the new point, use the old point plus "
+ "this times the neighbors."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->filter_percent);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (0.33));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Filter Secondary Surround:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->filter_secondary_surround,
- 3, 10, 1, 1, 0,
- TRUE, 0, 0,
- _("Number of adjacent points to consider if "
- "`filter_surround' points defines a straight line."),
- NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Filter Secondary Surround:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->filter_secondary_surround,
+ 3, 10, 1, 1, 0,
+ TRUE, 0, 0,
+ _("Number of adjacent points to consider if "
+ "`filter_surround' points defines a straight line."),
+ NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->filter_secondary_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (3.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Filter Surround:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->filter_surround,
- 2, 10, 1, 1, 0,
- TRUE, 0, 0,
- _("Number of adjacent points to consider when filtering."),
- NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Filter Surround:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->filter_surround,
+ 2, 10, 1, 1, 0,
+ TRUE, 0, 0,
+ _("Number of adjacent points to consider when filtering."),
+ NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->filter_surround);
@@ -252,11 +252,10 @@ dialog_create_selection_area (SELVALS *sels)
check = gtk_check_button_new_with_label (_("Keep Knees"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), sels->keep_knees);
- gtk_table_attach (GTK_TABLE (table), check, 1, 3, row, row + 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), check, 1, row, 2, 1);
gimp_help_set_help_data (GTK_WIDGET (check),
_("Says whether or not to remove ``knee'' "
- "points after finding the outline."), NULL);
+ "points after finding the outline."), NULL);
g_signal_connect (check, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&sels->keep_knees);
@@ -265,121 +264,121 @@ dialog_create_selection_area (SELVALS *sels)
g_object_set_data (G_OBJECT (check), "default_value", def_val ((gdouble)FALSE));
row++;
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Line Reversion Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->line_reversion_threshold,
- 0.01, 0.2, 0.01, 0.01, 3,
- TRUE, 0, 0,
- _("If a spline is closer to a straight line than this, "
- "it remains a straight line, even if it would otherwise "
- "be changed back to a curve. This is weighted by the "
- "square of the curve length, to make shorter curves "
- "more likely to be reverted."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Line Reversion Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->line_reversion_threshold,
+ 0.01, 0.2, 0.01, 0.01, 3,
+ TRUE, 0, 0,
+ _("If a spline is closer to a straight line than this, "
+ "it remains a straight line, even if it would otherwise "
+ "be changed back to a curve. This is weighted by the "
+ "square of the curve length, to make shorter curves "
+ "more likely to be reverted."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->line_reversion_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (0.01));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Line Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->line_threshold,
- 0.2, 4, 0.1, 0.01, 2,
- TRUE, 0, 0,
- _("How many pixels (on the average) a spline can "
- "diverge from the line determined by its endpoints "
- "before it is changed to a straight line."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Line Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->line_threshold,
+ 0.2, 4, 0.1, 0.01, 2,
+ TRUE, 0, 0,
+ _("How many pixels (on the average) a spline can "
+ "diverge from the line determined by its endpoints "
+ "before it is changed to a straight line."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->line_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (0.5));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Reparametrize Improvement:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->reparameterize_improvement,
- 0, 1, 0.05, 0.01, 2,
- TRUE, 0, 0,
- _("If reparameterization doesn't improve the fit by this "
- "much percent, stop doing it. ""Amount of error at which "
- "it is pointless to reparameterize."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Reparametrize Improvement:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->reparameterize_improvement,
+ 0, 1, 0.05, 0.01, 2,
+ TRUE, 0, 0,
+ _("If reparameterization doesn't improve the fit by this "
+ "much percent, stop doing it. ""Amount of error at which "
+ "it is pointless to reparameterize."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->reparameterize_improvement);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (0.01));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Reparametrize Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->reparameterize_threshold,
- 1, 50, 0.5, 0.5, 2,
- TRUE, 0, 0,
- _("Amount of error at which it is pointless to reparameterize. "
- "This happens, for example, when we are trying to fit the "
- "outline of the outside of an `O' with a single spline. "
- "The initial fit is not good enough for the Newton-Raphson "
- "iteration to improve it. It may be that it would be better "
- "to detect the cases where we didn't find any corners."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Reparametrize Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->reparameterize_threshold,
+ 1, 50, 0.5, 0.5, 2,
+ TRUE, 0, 0,
+ _("Amount of error at which it is pointless to reparameterize. "
+ "This happens, for example, when we are trying to fit the "
+ "outline of the outside of an `O' with a single spline. "
+ "The initial fit is not good enough for the Newton-Raphson "
+ "iteration to improve it. It may be that it would be better "
+ "to detect the cases where we didn't find any corners."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->reparameterize_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (1.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Subdivide Search:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->subdivide_search,
- 0.05, 1, 0.05, 0.01, 2,
- TRUE, 0, 0,
- _("Percentage of the curve away from the worst point "
- "to look for a better place to subdivide."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Subdivide Search:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->subdivide_search,
+ 0.05, 1, 0.05, 0.01, 2,
+ TRUE, 0, 0,
+ _("Percentage of the curve away from the worst point "
+ "to look for a better place to subdivide."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->subdivide_search);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (0.1));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Subdivide Surround:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->subdivide_surround,
- 2, 10, 1, 1, 0,
- TRUE, 0, 0,
- _("Number of points to consider when deciding whether "
- "a given point is a better place to subdivide."),
- NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Subdivide Surround:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->subdivide_surround,
+ 2, 10, 1, 1, 0,
+ TRUE, 0, 0,
+ _("Number of points to consider when deciding whether "
+ "a given point is a better place to subdivide."),
+ NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->subdivide_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (4.0));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Subdivide Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->subdivide_threshold,
- 0.01, 1, 0.01, 0.01, 2,
- TRUE, 0, 0,
- _("How many pixels a point can diverge from a straight "
- "line and still be considered a better place to "
- "subdivide."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Subdivide Threshold:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->subdivide_threshold,
+ 0.01, 1, 0.01, 0.01, 2,
+ TRUE, 0, 0,
+ _("How many pixels a point can diverge from a straight "
+ "line and still be considered a better place to "
+ "subdivide."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->subdivide_threshold);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (0.03));
- adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
- _("Tangent Surround:"), SCALE_WIDTH, SCALE_DIGITS,
- sels->tangent_surround,
- 2, 10, 1, 1, 0,
- TRUE, 0, 0,
- _("Number of points to look at on either side of a "
- "point when computing the approximation to the "
- "tangent at that point."), NULL);
+ adj = gimp_scale_entry_new_grid (GTK_GRID (grid), 0, row++,
+ _("Tangent Surround:"), SCALE_WIDTH, SCALE_DIGITS,
+ sels->tangent_surround,
+ 2, 10, 1, 1, 0,
+ TRUE, 0, 0,
+ _("Number of points to look at on either side of a "
+ "point when computing the approximation to the "
+ "tangent at that point."), NULL);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&sels->tangent_surround);
adjust_widgets = g_slist_append (adjust_widgets, adj);
g_object_set_data (G_OBJECT (adj), "default_value", def_val (3.0));
- return table;
+ return grid;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]