Commit d60faca9 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

libgimpwidgets/gimppropwidgets.[ch] added gimp_prop_hscale_new().

2005-08-06  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimppropwidgets.[ch]
	* libgimpwidgets/gimpwidgets.def: added gimp_prop_hscale_new().

	* app/tools/gimpforegroundselectoptions.c: added a control for the
	stroke width.

	* app/tools/gimpforegroundselecttool.c: cancel the tool if the
	active drawable or the image size changes.

	* app/widgets/gimpcontrollerlist.c: fixed signedness warning.
parent 769acb57
2005-08-06 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimppropwidgets.[ch]
* libgimpwidgets/gimpwidgets.def: added gimp_prop_hscale_new().
* app/tools/gimpforegroundselectoptions.c: added a control for the
stroke width.
* app/tools/gimpforegroundselecttool.c: cancel the tool if the
active drawable or the image size changes.
* app/widgets/gimpcontrollerlist.c: fixed signedness warning.
2005-08-06 Sven Neumann <sven@gimp.org>
* app/display/gimpcanvas.c (gimp_canvas_set_custom_gc) do not
......
......@@ -94,8 +94,9 @@ gimp_foreground_select_options_class_init (GimpForegroundSelectOptionsClass *kla
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_STROKE_WIDTH,
"stroke-width", NULL,
1, 100, 6,
"stroke-width",
_("Size of the brush used for refinements"),
1, 32, 12,
0);
}
......@@ -147,10 +148,13 @@ GtkWidget *
gimp_foreground_select_options_gui (GimpToolOptions *tool_options)
{
GtkWidget *vbox = gimp_selection_options_gui (tool_options);
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *scale;
GtkWidget *label;
frame = gimp_prop_boolean_radio_frame_new ( G_OBJECT (tool_options),
"background",
frame = gimp_prop_boolean_radio_frame_new (G_OBJECT (tool_options),
"background",
_("Interactive refinement"),
_("Mark background"),
_("Mark foreground"));
......@@ -158,5 +162,24 @@ gimp_foreground_select_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
scale = gimp_prop_hscale_new (G_OBJECT (tool_options), "stroke-width",
1.0, 5.0, 0);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_box_pack_start (GTK_BOX (GTK_BIN (frame)->child), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);
hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (GTK_BIN (frame)->child), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new (_("Small"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
label = gtk_label_new (_("Large"));
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
return vbox;
}
......@@ -198,6 +198,8 @@ gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
GimpTool *tool = GIMP_TOOL (fg_select);
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_tool_control_set_dirty_mask (tool->control, GIMP_DIRTY_IMAGE_SIZE);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FREE_SELECT);
......@@ -378,9 +380,7 @@ gimp_foreground_select_tool_button_press (GimpTool *tool,
gimp_draw_tool_pause (draw_tool);
if (gimp_draw_tool_is_active (draw_tool) && draw_tool->gdisp != gdisp)
{
gimp_draw_tool_stop (draw_tool);
}
gimp_draw_tool_stop (draw_tool);
gimp_tool_control_activate (tool->control);
......
......@@ -182,7 +182,7 @@ gimp_controller_list_init (GimpControllerList *list)
gint icon_width;
gint icon_height;
GType *controller_types;
gint n_controller_types;
guint n_controller_types;
gint i;
list->gimp = NULL;
......
......@@ -793,6 +793,7 @@ gimp_prop_check_button_new
gimp_prop_boolean_combo_box_new
gimp_prop_boolean_radio_frame_new
gimp_prop_expander_new
gimp_prop_hscale_new
gimp_prop_int_combo_box_new
gimp_prop_enum_combo_box_new
gimp_prop_enum_check_button_new
......
......@@ -64,6 +64,19 @@ GimpPropWidgets
@Returns:
<!-- ##### FUNCTION gimp_prop_hscale_new ##### -->
<para>
</para>
@config:
@property_name:
@step_increment:
@page_increment:
@digits:
@Returns:
<!-- ##### FUNCTION gimp_prop_int_combo_box_new ##### -->
<para>
......
......@@ -1093,6 +1093,67 @@ gimp_prop_spin_button_new (GObject *config,
return spinbutton;
}
/**
* gimp_prop_hscale_new:
* @config: Object to which property is attached.
* @property_name: Name of integer or double property controlled by the scale.
* @step_increment: Step size.
* @page_increment: Page size.
* @digits: Number of digits after decimal point to display.
*
* Creates a horizontal scale to control the value of the specified
* integer or double property.
*
* Return value: A new #GtkScale.
*
* Since GIMP 2.4
*/
GtkWidget *
gimp_prop_hscale_new (GObject *config,
const gchar *property_name,
gdouble step_increment,
gdouble page_increment,
gint digits)
{
GParamSpec *param_spec;
GtkWidget *scale;
GtkObject *adjustment;
gdouble value;
gdouble lower;
gdouble upper;
param_spec = find_param_spec (config, property_name, G_STRFUNC);
if (! param_spec)
return NULL;
if (! get_numeric_values (config,
param_spec, &value, &lower, &upper, G_STRFUNC))
return NULL;
if (! G_IS_PARAM_SPEC_DOUBLE (param_spec))
digits = 0;
adjustment = gtk_adjustment_new (value, lower, upper,
step_increment, page_increment, 0.0);
scale = g_object_new (GTK_TYPE_HSCALE,
"adjustment", adjustment,
"digits", digits,
NULL);
set_param_spec (G_OBJECT (adjustment), scale, param_spec);
g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gimp_prop_adjustment_callback),
config);
connect_notify (config, property_name,
G_CALLBACK (gimp_prop_adjustment_notify),
adjustment);
return scale;
}
/**
* gimp_prop_scale_entry_new:
* @config: Object to which property is attached.
......
......@@ -91,6 +91,12 @@ GtkWidget * gimp_prop_spin_button_new (GObject *config,
gdouble page_increment,
gint digits);
GtkWidget * gimp_prop_hscale_new (GObject *config,
const gchar *property_name,
gdouble step_increment,
gdouble page_increment,
gint digits);
GtkObject * gimp_prop_scale_entry_new (GObject *config,
const gchar *property_name,
GtkTable *table,
......
......@@ -236,6 +236,7 @@ EXPORTS
gimp_prop_expander_new
gimp_prop_file_chooser_button_new
gimp_prop_file_entry_new
gimp_prop_hscale_new
gimp_prop_int_combo_box_new
gimp_prop_label_new
gimp_prop_memsize_entry_new
......
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