Commit d8a5ca6c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added new function gimp_toggle_button_set_visible() which can be used as

2004-11-23  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpwidgets-utils.[ch]: added new function
	gimp_toggle_button_set_visible() which can be used as "toggled"
	callback on a GtkToggleButton and sets a widget (in)visible
	according to the toggle's "active" state.

	* app/tools/gimpblendoptions.c
	* app/tools/gimppaintoptions-gui.c
	* app/tools/gimpselectionoptions.c: use it to hide (rather than
	just insensitize) the seldomly used "Feather edges", "Autoshrink
	selection", "Adaptive supersampling", "Fade out" and "Use color
	from gradient" widgets when their enabling toggle is unchecked.
	Makes the affected tool options much less crowded and noisy in
	their default appearance. Fixes bug #159008.
parent 518ab86b
2004-11-23 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpwidgets-utils.[ch]: added new function
gimp_toggle_button_set_visible() which can be used as "toggled"
callback on a GtkToggleButton and sets a widget (in)visible
according to the toggle's "active" state.
* app/tools/gimpblendoptions.c
* app/tools/gimppaintoptions-gui.c
* app/tools/gimpselectionoptions.c: use it to hide (rather than
just insensitize) the seldomly used "Feather edges", "Autoshrink
selection", "Adaptive supersampling", "Fade out" and "Use color
from gradient" widgets when their enabling toggle is unchecked.
Makes the affected tool options much less crowded and noisy in
their default appearance. Fixes bug #159008.
2004-11-23 Michael Natterer <mitch@gimp.org>
 
* app/menus/plug-in-menus.c (plug_in_menus_add_proc): create
......
......@@ -32,6 +32,7 @@
#include "widgets/gimpenumcombobox.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpblendoptions.h"
#include "gimppaintoptions-gui.h"
......@@ -44,7 +45,7 @@ enum
PROP_0,
PROP_OFFSET,
PROP_GRADIENT_TYPE,
PROP_GRADIENT_REPEAT, /* overrides an GimpPaintOptions property */
PROP_GRADIENT_REPEAT, /* overrides a GimpPaintOptions property */
PROP_SUPERSAMPLE,
PROP_SUPERSAMPLE_DEPTH,
PROP_SUPERSAMPLE_THRESHOLD,
......@@ -269,26 +270,26 @@ gimp_blend_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
/* frame for supersampling options */
/* supersampling options */
frame = gimp_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
/* table for supersampling options */
table = gtk_table_new (2, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
/* supersampling toggle */
button = gimp_prop_check_button_new (config, "supersample",
_("Adaptive supersampling"));
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
gtk_widget_show (button);
gtk_widget_set_sensitive (table, GIMP_BLEND_OPTIONS (config)->supersample);
g_object_set_data (G_OBJECT (button), "set_sensitive", table);
table = gtk_table_new (2, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
gtk_container_add (GTK_CONTAINER (frame), table);
if (GIMP_BLEND_OPTIONS (config)->supersample)
gtk_widget_show (table);
g_signal_connect_object (button, "toggled",
G_CALLBACK (gimp_toggle_button_set_visible),
table, 0);
/* max depth scale */
gimp_prop_scale_entry_new (config, "supersample-depth",
......
......@@ -34,6 +34,7 @@
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gtkhwrapbox.h"
#include "gimpairbrushtool.h"
......@@ -308,18 +309,20 @@ fade_options_gui (GimpFadeOptions *fade,
{
frame = gimp_frame_new (NULL);
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
button = gimp_prop_check_button_new (config, "use-fade",
_("Fade out"));
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
gtk_widget_show (button);
gtk_widget_set_sensitive (table, fade->use_fade);
g_object_set_data (G_OBJECT (button), "set_sensitive", table);
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (frame), table);
if (fade->use_fade)
gtk_widget_show (table);
g_signal_connect_object (button, "toggled",
G_CALLBACK (gimp_toggle_button_set_visible),
table, 0);
/* the fade-out sizeentry */
spinbutton = gimp_prop_spin_button_new (config, "fade-length",
......@@ -360,19 +363,23 @@ gradient_options_gui (GimpGradientOptions *gradient,
{
frame = gimp_frame_new (NULL);
button = gimp_prop_check_button_new (config, "use-gradient",
_("Use color from gradient"));
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
gtk_widget_show (button);
table = gtk_table_new (3, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
if (gradient->use_gradient)
gtk_widget_show (table);
button = gimp_prop_check_button_new (config, "use-gradient",
_("Use color from gradient"));
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
gtk_widget_show (button);
g_signal_connect_object (button, "toggled",
G_CALLBACK (gimp_toggle_button_set_visible),
table, 0);
gtk_widget_set_sensitive (table, gradient->use_gradient);
g_object_set_data (G_OBJECT (button), "set_sensitive", table);
gtk_widget_set_sensitive (incremental_toggle, ! gradient->use_gradient);
g_object_set_data (G_OBJECT (button), "inverse_sensitive",
incremental_toggle);
......@@ -405,8 +412,6 @@ gradient_options_gui (GimpGradientOptions *gradient,
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Repeat:"), 0.0, 0.5,
combo, 2, FALSE);
gtk_widget_show (table);
}
return frame;
......
......@@ -32,6 +32,7 @@
#include "core/gimptoolinfo.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpbycolorselecttool.h"
#include "gimpellipseselecttool.h"
......@@ -394,18 +395,20 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
button = gimp_prop_check_button_new (config, "feather",
_("Feather edges"));
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
gtk_widget_show (button);
gtk_widget_set_sensitive (table, options->feather);
g_object_set_data (G_OBJECT (button), "set_sensitive", table);
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (frame), table);
if (options->feather)
gtk_widget_show (table);
g_signal_connect_object (button, "toggled",
G_CALLBACK (gimp_toggle_button_set_visible),
table, 0);
/* the feather radius scale */
gimp_prop_scale_entry_new (config, "feather-radius",
......@@ -481,17 +484,19 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
button = gimp_prop_check_button_new (config, "auto-shrink",
_("Auto shrink selection"));
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
gtk_widget_show (button);
gtk_widget_set_sensitive (vbox2, options->auto_shrink);
g_object_set_data (G_OBJECT (button), "set_sensitive", vbox2);
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
if (options->auto_shrink)
gtk_widget_show (vbox2);
g_signal_connect_object (button, "toggled",
G_CALLBACK (gimp_toggle_button_set_visible),
vbox2, 0);
button = gimp_prop_check_button_new (config, "shrink-merged",
_("Sample merged"));
......
......@@ -857,3 +857,17 @@ gimp_text_buffer_save (GtkTextBuffer *buffer,
return TRUE;
}
void
gimp_toggle_button_set_visible (GtkToggleButton *toggle,
GtkWidget *widget)
{
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));
g_return_if_fail (GTK_IS_WIDGET (widget));
if (gtk_toggle_button_get_active (toggle))
gtk_widget_show (widget);
else
gtk_widget_hide (widget);
}
......@@ -80,5 +80,8 @@ gboolean gimp_text_buffer_save (GtkTextBuffer *buffer,
gboolean selection_only,
GError **error);
void gimp_toggle_button_set_visible (GtkToggleButton *toggle,
GtkWidget *widget);
#endif /* __GIMP_WIDGETS_UTILS_H__ */
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