mirror of https://github.com/GNOME/gimp.git
app/display/gimpdisplayshell-selection.[ch] app/tools/gimpblendtool.c
2003-02-04 Sven Neumann <sven@gimp.org> * app/display/gimpdisplayshell-selection.[ch] * app/tools/gimpblendtool.c * app/tools/gimpcolorpickertool.c * app/tools/gimplevelstool.c * app/tools/gimpthresholdtool.c * app/tools/gimptransformtool.c: misc trivial changes and cleanup. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_unit_menu_new() and removed the scale widget again. * app/tools/gimptexttool.c: replaced the size scale entry with a spinbutton and made the unit menu working. * app/text/gimptext.c: increased the upper boundary for the font size again now that we don't use a scale any longer.
This commit is contained in:
parent
bec52119ce
commit
2c708acab4
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
||||||
|
2003-02-04 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/display/gimpdisplayshell-selection.[ch]
|
||||||
|
* app/tools/gimpblendtool.c
|
||||||
|
* app/tools/gimpcolorpickertool.c
|
||||||
|
* app/tools/gimplevelstool.c
|
||||||
|
* app/tools/gimpthresholdtool.c
|
||||||
|
* app/tools/gimptransformtool.c: misc trivial changes and cleanup.
|
||||||
|
|
||||||
|
* app/widgets/gimppropwidgets.[ch]: added gimp_prop_unit_menu_new()
|
||||||
|
and removed the scale widget again.
|
||||||
|
|
||||||
|
* app/tools/gimptexttool.c: replaced the size scale entry with a
|
||||||
|
spinbutton and made the unit menu working.
|
||||||
|
|
||||||
|
* app/text/gimptext.c: increased the upper boundary for the font
|
||||||
|
size again now that we don't use a scale any longer.
|
||||||
|
|
||||||
2003-02-03 Sven Neumann <sven@gimp.org>
|
2003-02-03 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpfontselection-dialog.c: changed the text used in
|
* app/widgets/gimpfontselection-dialog.c: changed the text used in
|
||||||
|
|
|
@ -83,6 +83,7 @@ gimp_display_shell_selection_create (GdkWindow *win,
|
||||||
gint size,
|
gint size,
|
||||||
gint width)
|
gint width)
|
||||||
{
|
{
|
||||||
|
GimpImage *gimage;
|
||||||
GdkColor fg, bg;
|
GdkColor fg, bg;
|
||||||
Selection *new;
|
Selection *new;
|
||||||
gint base_type;
|
gint base_type;
|
||||||
|
@ -91,9 +92,11 @@ gimp_display_shell_selection_create (GdkWindow *win,
|
||||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
||||||
|
|
||||||
new = g_new0 (Selection, 1);
|
new = g_new0 (Selection, 1);
|
||||||
base_type = gimp_image_base_type (shell->gdisp->gimage);
|
|
||||||
|
|
||||||
if (GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config)->colormap_cycling)
|
gimage = shell->gdisp->gimage;
|
||||||
|
base_type = gimp_image_base_type (gimage);
|
||||||
|
|
||||||
|
if (GIMP_DISPLAY_CONFIG (gimage->gimp->config)->colormap_cycling)
|
||||||
{
|
{
|
||||||
new->cycle = TRUE;
|
new->cycle = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ struct _Selection
|
||||||
GdkWindow *win; /* Window to draw to */
|
GdkWindow *win; /* Window to draw to */
|
||||||
GimpDisplayShell *shell; /* GimpDisplay that owns the selection */
|
GimpDisplayShell *shell; /* GimpDisplay that owns the selection */
|
||||||
GdkGC *gc_in; /* GC for drawing selection outline */
|
GdkGC *gc_in; /* GC for drawing selection outline */
|
||||||
GdkGC *gc_out; /* GC for selected regions outside
|
GdkGC *gc_out; /* GC for selected regions outside *
|
||||||
* current layer */
|
* current layer */
|
||||||
GdkGC *gc_layer; /* GC for current layer outline */
|
GdkGC *gc_layer; /* GC for current layer outline */
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ gimp_text_class_init (GimpTextClass *klass)
|
||||||
0);
|
0);
|
||||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FONT_SIZE,
|
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FONT_SIZE,
|
||||||
"font-size", NULL,
|
"font-size", NULL,
|
||||||
0.0, 1024.0, 18.0,
|
0.0, 8192.0, 18.0,
|
||||||
0);
|
0);
|
||||||
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_FONT_SIZE_UNIT,
|
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_FONT_SIZE_UNIT,
|
||||||
"font-size-unit", NULL,
|
"font-size-unit", NULL,
|
||||||
|
|
|
@ -225,11 +225,14 @@ gimp_blend_tool_button_press (GimpTool *tool,
|
||||||
GimpDisplay *gdisp)
|
GimpDisplay *gdisp)
|
||||||
{
|
{
|
||||||
GimpBlendTool *blend_tool;
|
GimpBlendTool *blend_tool;
|
||||||
|
GimpDrawable *drawable;
|
||||||
gint off_x, off_y;
|
gint off_x, off_y;
|
||||||
|
|
||||||
blend_tool = GIMP_BLEND_TOOL (tool);
|
blend_tool = GIMP_BLEND_TOOL (tool);
|
||||||
|
|
||||||
switch (gimp_drawable_type (gimp_image_active_drawable (gdisp->gimage)))
|
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||||
|
|
||||||
|
switch (gimp_drawable_type (drawable))
|
||||||
{
|
{
|
||||||
case GIMP_INDEXED_IMAGE: case GIMP_INDEXEDA_IMAGE:
|
case GIMP_INDEXED_IMAGE: case GIMP_INDEXEDA_IMAGE:
|
||||||
g_message (_("Blend: Invalid for indexed images."));
|
g_message (_("Blend: Invalid for indexed images."));
|
||||||
|
@ -240,8 +243,7 @@ gimp_blend_tool_button_press (GimpTool *tool,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
|
gimp_drawable_offsets (drawable, &off_x, &off_y);
|
||||||
&off_x, &off_y);
|
|
||||||
|
|
||||||
blend_tool->endx = blend_tool->startx = coords->x - off_x;
|
blend_tool->endx = blend_tool->startx = coords->x - off_x;
|
||||||
blend_tool->endy = blend_tool->starty = coords->y - off_y;
|
blend_tool->endy = blend_tool->starty = coords->y - off_y;
|
||||||
|
|
|
@ -361,8 +361,7 @@ gimp_color_picker_tool_motion (GimpTool *tool,
|
||||||
|
|
||||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||||
|
|
||||||
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
|
gimp_drawable_offsets (tool->drawable, &off_x, &off_y);
|
||||||
&off_x, &off_y);
|
|
||||||
|
|
||||||
cp_tool->centerx = coords->x - off_x;
|
cp_tool->centerx = coords->x - off_x;
|
||||||
cp_tool->centery = coords->y - off_y;
|
cp_tool->centery = coords->y - off_y;
|
||||||
|
|
|
@ -274,7 +274,9 @@ gimp_levels_tool_initialize (GimpTool *tool,
|
||||||
|
|
||||||
l_tool = GIMP_LEVELS_TOOL (tool);
|
l_tool = GIMP_LEVELS_TOOL (tool);
|
||||||
|
|
||||||
if (gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
|
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||||
|
|
||||||
|
if (gimp_drawable_is_indexed (drawable))
|
||||||
{
|
{
|
||||||
g_message (_("Levels for indexed drawables cannot be adjusted."));
|
g_message (_("Levels for indexed drawables cannot be adjusted."));
|
||||||
return;
|
return;
|
||||||
|
@ -287,8 +289,6 @@ gimp_levels_tool_initialize (GimpTool *tool,
|
||||||
l_tool->hist = gimp_histogram_new (GIMP_BASE_CONFIG (gimp->config));
|
l_tool->hist = gimp_histogram_new (GIMP_BASE_CONFIG (gimp->config));
|
||||||
}
|
}
|
||||||
|
|
||||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
|
||||||
|
|
||||||
levels_init (l_tool->levels);
|
levels_init (l_tool->levels);
|
||||||
|
|
||||||
l_tool->channel = GIMP_HISTOGRAM_VALUE;
|
l_tool->channel = GIMP_HISTOGRAM_VALUE;
|
||||||
|
|
|
@ -370,7 +370,8 @@ text_tool_options_new (GimpToolInfo *tool_info)
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *unit_menu;
|
GtkWidget *unit_menu;
|
||||||
GtkWidget *font_selection;
|
GtkWidget *font_selection;
|
||||||
GtkWidget *spin_button;
|
GtkWidget *spinbutton;
|
||||||
|
gint digits;
|
||||||
|
|
||||||
options = g_new0 (TextOptions, 1);
|
options = g_new0 (TextOptions, 1);
|
||||||
|
|
||||||
|
@ -387,7 +388,7 @@ text_tool_options_new (GimpToolInfo *tool_info)
|
||||||
/* the main vbox */
|
/* the main vbox */
|
||||||
vbox = options->tool_options.main_vbox;
|
vbox = options->tool_options.main_vbox;
|
||||||
|
|
||||||
table = gtk_table_new (4, 5, FALSE);
|
table = gtk_table_new (4, 4, FALSE);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_table_set_row_spacing (GTK_TABLE (table), 3, 12);
|
gtk_table_set_row_spacing (GTK_TABLE (table), 3, 12);
|
||||||
|
@ -399,40 +400,33 @@ text_tool_options_new (GimpToolInfo *tool_info)
|
||||||
_("Font:"), 1.0, 0.5,
|
_("Font:"), 1.0, 0.5,
|
||||||
font_selection, 2, FALSE);
|
font_selection, 2, FALSE);
|
||||||
|
|
||||||
gimp_prop_scale_entry_new (text, "font-size",
|
digits = gimp_unit_get_digits (GIMP_TEXT (text)->font_size_unit);
|
||||||
GTK_TABLE (table), 0, 1,
|
spinbutton = gimp_prop_spin_button_new (text, "font-size",
|
||||||
_("_Size:"), 1.0, 50.0, 1);
|
1.0, 10.0, digits);
|
||||||
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||||
|
_("Size:"), 1.0, 0.5,
|
||||||
|
spinbutton, 1, FALSE);
|
||||||
|
|
||||||
unit_menu = gimp_unit_menu_new ("%a", GIMP_TEXT (text)->font_size_unit,
|
unit_menu = gimp_prop_unit_menu_new (text, "font-size-unit", "%a");
|
||||||
TRUE, FALSE, TRUE);
|
g_object_set_data (G_OBJECT (unit_menu), "set_digits", spinbutton);
|
||||||
|
gtk_table_attach (GTK_TABLE (table), unit_menu, 2, 3, 1, 2,
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||||
_("Unit:"), 1.0, 0.5, unit_menu, 2, TRUE);
|
gtk_widget_show (unit_menu);
|
||||||
gtk_widget_set_sensitive (unit_menu, FALSE);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
g_object_set_data (G_OBJECT (unit_menu), "set_digits",
|
|
||||||
size_spinbutton);
|
|
||||||
|
|
||||||
g_signal_connect (options->unit_w, "unit_changed",
|
|
||||||
G_CALLBACK (gimp_unit_menu_update),
|
|
||||||
&unit);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
button = gimp_prop_color_button_new (text, "color", _("Text Color"),
|
button = gimp_prop_color_button_new (text, "color", _("Text Color"),
|
||||||
48, 24, GIMP_COLOR_AREA_FLAT);
|
48, 24, GIMP_COLOR_AREA_FLAT);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
||||||
_("Color:"), 1.0, 0.5, button, 2, TRUE);
|
_("Color:"), 1.0, 0.5, button, 2, TRUE);
|
||||||
|
|
||||||
spin_button = gimp_prop_spin_button_new (text, "letter-spacing", 0.1, 1.0, 2);
|
spinbutton = gimp_prop_spin_button_new (text, "letter-spacing", 0.1, 1.0, 2);
|
||||||
gtk_entry_set_width_chars (GTK_ENTRY (spin_button), 5);
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
|
||||||
gimp_table_attach_stock (GTK_TABLE (table), 0, 4,
|
gimp_table_attach_stock (GTK_TABLE (table), 0, 3,
|
||||||
GIMP_STOCK_LETTER_SPACING, spin_button);
|
GIMP_STOCK_LETTER_SPACING, spinbutton);
|
||||||
|
|
||||||
spin_button = gimp_prop_spin_button_new (text, "line-spacing", 0.1, 1.0, 2);
|
spinbutton = gimp_prop_spin_button_new (text, "line-spacing", 0.1, 1.0, 2);
|
||||||
gtk_entry_set_width_chars (GTK_ENTRY (spin_button), 5);
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
|
||||||
gimp_table_attach_stock (GTK_TABLE (table), 0, 5,
|
gimp_table_attach_stock (GTK_TABLE (table), 0, 4,
|
||||||
GIMP_STOCK_LINE_SPACING, spin_button);
|
GIMP_STOCK_LINE_SPACING, spinbutton);
|
||||||
|
|
||||||
return (GimpToolOptions *) options;
|
return (GimpToolOptions *) options;
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,9 @@ gimp_threshold_tool_initialize (GimpTool *tool,
|
||||||
|
|
||||||
t_tool = GIMP_THRESHOLD_TOOL (tool);
|
t_tool = GIMP_THRESHOLD_TOOL (tool);
|
||||||
|
|
||||||
if (gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
|
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||||
|
|
||||||
|
if (gimp_drawable_is_indexed (drawable))
|
||||||
{
|
{
|
||||||
g_message (_("Threshold does not operate on indexed drawables."));
|
g_message (_("Threshold does not operate on indexed drawables."));
|
||||||
return;
|
return;
|
||||||
|
@ -207,8 +209,6 @@ gimp_threshold_tool_initialize (GimpTool *tool,
|
||||||
t_tool->hist = gimp_histogram_new (GIMP_BASE_CONFIG (gimp->config));
|
t_tool->hist = gimp_histogram_new (GIMP_BASE_CONFIG (gimp->config));
|
||||||
}
|
}
|
||||||
|
|
||||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
|
||||||
|
|
||||||
t_tool->threshold->color = gimp_drawable_is_rgb (drawable);
|
t_tool->threshold->color = gimp_drawable_is_rgb (drawable);
|
||||||
t_tool->threshold->low_threshold = 127;
|
t_tool->threshold->low_threshold = 127;
|
||||||
t_tool->threshold->high_threshold = 255;
|
t_tool->threshold->high_threshold = 255;
|
||||||
|
|
|
@ -736,6 +736,7 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
|
||||||
GimpDisplay *gdisp)
|
GimpDisplay *gdisp)
|
||||||
{
|
{
|
||||||
GimpTool *tool;
|
GimpTool *tool;
|
||||||
|
GimpDrawable *drawable;
|
||||||
TransformOptions *options;
|
TransformOptions *options;
|
||||||
GimpProgress *progress;
|
GimpProgress *progress;
|
||||||
TileManager *ret;
|
TileManager *ret;
|
||||||
|
@ -750,7 +751,9 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
|
||||||
progress = gimp_progress_start (gdisp, tr_tool->progress_text, FALSE,
|
progress = gimp_progress_start (gdisp, tr_tool->progress_text, FALSE,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
ret = gimp_drawable_transform_tiles_affine (gimp_image_active_drawable (tool->gdisp->gimage),
|
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||||
|
|
||||||
|
ret = gimp_drawable_transform_tiles_affine (drawable,
|
||||||
tr_tool->original,
|
tr_tool->original,
|
||||||
options->interpolation,
|
options->interpolation,
|
||||||
options->clip,
|
options->clip,
|
||||||
|
|
|
@ -383,53 +383,6 @@ gimp_prop_spin_button_new (GObject *config,
|
||||||
return spinbutton;
|
return spinbutton;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gimp_prop_scale_entry_new (GObject *config,
|
|
||||||
const gchar *property_name,
|
|
||||||
GtkTable *table,
|
|
||||||
gint column,
|
|
||||||
gint row,
|
|
||||||
const gchar *text,
|
|
||||||
gdouble step_increment,
|
|
||||||
gdouble page_increment,
|
|
||||||
gint digits)
|
|
||||||
{
|
|
||||||
GtkWidget *label;
|
|
||||||
GtkWidget *scale;
|
|
||||||
GtkWidget *spinbutton;
|
|
||||||
GtkAdjustment *adj;
|
|
||||||
|
|
||||||
label = gtk_label_new_with_mnemonic (text);
|
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
||||||
gtk_table_attach (GTK_TABLE (table), label,
|
|
||||||
column, column + 1, row, row + 1,
|
|
||||||
GTK_FILL, GTK_FILL, 0, 0);
|
|
||||||
gtk_widget_show (label);
|
|
||||||
|
|
||||||
spinbutton = gimp_prop_spin_button_new (config, property_name,
|
|
||||||
step_increment, page_increment,
|
|
||||||
digits);
|
|
||||||
|
|
||||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 4 + digits);
|
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), spinbutton,
|
|
||||||
column + 2, column + 3, row, row + 1,
|
|
||||||
GTK_SHRINK, GTK_SHRINK, 0, 0);
|
|
||||||
gtk_widget_show (spinbutton);
|
|
||||||
|
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
|
||||||
|
|
||||||
adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton));
|
|
||||||
scale = gtk_hscale_new (adj);
|
|
||||||
|
|
||||||
gtk_scale_set_digits (GTK_SCALE (scale), digits);
|
|
||||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
|
||||||
gtk_table_attach (GTK_TABLE (table), scale,
|
|
||||||
column + 1, column + 2, row, row + 1,
|
|
||||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
|
||||||
gtk_widget_show (scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_prop_adjustment_callback (GtkAdjustment *adjustment,
|
gimp_prop_adjustment_callback (GtkAdjustment *adjustment,
|
||||||
GObject *config)
|
GObject *config)
|
||||||
|
@ -1658,6 +1611,108 @@ gimp_prop_color_button_notify (GObject *config,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************/
|
||||||
|
/* unit menu */
|
||||||
|
/***************/
|
||||||
|
|
||||||
|
static void gimp_prop_unit_menu_callback (GtkWidget *menu,
|
||||||
|
GObject *config);
|
||||||
|
static void gimp_prop_unit_menu_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkWidget *menu);
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gimp_prop_unit_menu_new (GObject *config,
|
||||||
|
const gchar *property_name,
|
||||||
|
const gchar *unit_format)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
GtkWidget *menu;
|
||||||
|
GimpUnit unit;
|
||||||
|
GValue value = { 0, };
|
||||||
|
gboolean show_pixels;
|
||||||
|
|
||||||
|
param_spec = check_param_spec (config, property_name,
|
||||||
|
GIMP_TYPE_PARAM_UNIT, G_STRLOC);
|
||||||
|
if (! param_spec)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
g_value_init (&value, param_spec->value_type);
|
||||||
|
g_value_set_int (&value, GIMP_UNIT_PIXEL);
|
||||||
|
|
||||||
|
show_pixels = (g_param_value_validate (param_spec, &value) == FALSE);
|
||||||
|
|
||||||
|
g_value_unset (&value);
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
property_name, &unit,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
menu = gimp_unit_menu_new (unit_format, unit, show_pixels, FALSE, TRUE);
|
||||||
|
|
||||||
|
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
||||||
|
|
||||||
|
g_signal_connect (menu, "unit_changed",
|
||||||
|
G_CALLBACK (gimp_prop_unit_menu_callback),
|
||||||
|
config);
|
||||||
|
|
||||||
|
connect_notify (config, property_name,
|
||||||
|
G_CALLBACK (gimp_prop_unit_menu_notify),
|
||||||
|
menu);
|
||||||
|
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prop_unit_menu_callback (GtkWidget *menu,
|
||||||
|
GObject *config)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
GimpUnit unit;
|
||||||
|
|
||||||
|
param_spec = get_param_spec (G_OBJECT (menu));
|
||||||
|
if (! param_spec)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gimp_unit_menu_update (menu, &unit);
|
||||||
|
|
||||||
|
g_signal_handlers_block_by_func (config,
|
||||||
|
gimp_prop_unit_menu_notify,
|
||||||
|
menu);
|
||||||
|
|
||||||
|
g_object_set (config,
|
||||||
|
param_spec->name, unit,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_signal_handlers_unblock_by_func (config,
|
||||||
|
gimp_prop_unit_menu_notify,
|
||||||
|
menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prop_unit_menu_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkWidget *menu)
|
||||||
|
{
|
||||||
|
GimpUnit unit;
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
param_spec->name, &unit,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_signal_handlers_block_by_func (menu,
|
||||||
|
gimp_prop_unit_menu_callback,
|
||||||
|
config);
|
||||||
|
|
||||||
|
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (menu), unit);
|
||||||
|
|
||||||
|
g_signal_handlers_unblock_by_func (menu,
|
||||||
|
gimp_prop_unit_menu_callback,
|
||||||
|
config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
/* private utility functions */
|
/* private utility functions */
|
||||||
/*******************************/
|
/*******************************/
|
||||||
|
|
|
@ -49,15 +49,6 @@ GtkWidget * gimp_prop_spin_button_new (GObject *config,
|
||||||
gdouble step_increment,
|
gdouble step_increment,
|
||||||
gdouble page_increment,
|
gdouble page_increment,
|
||||||
gint digits);
|
gint digits);
|
||||||
void gimp_prop_scale_entry_new (GObject *config,
|
|
||||||
const gchar *property_name,
|
|
||||||
GtkTable *table,
|
|
||||||
gint column,
|
|
||||||
gint row,
|
|
||||||
const gchar *text,
|
|
||||||
gdouble step_increment,
|
|
||||||
gdouble page_increment,
|
|
||||||
gint digits);
|
|
||||||
|
|
||||||
|
|
||||||
/* GimpParamMemsize */
|
/* GimpParamMemsize */
|
||||||
|
@ -113,4 +104,11 @@ GtkWidget * gimp_prop_color_button_new (GObject *config,
|
||||||
GimpColorAreaType type);
|
GimpColorAreaType type);
|
||||||
|
|
||||||
|
|
||||||
|
/* GimpParamUnit */
|
||||||
|
|
||||||
|
GtkWidget * gimp_prop_unit_menu_new (GObject *config,
|
||||||
|
const gchar *property_name,
|
||||||
|
const gchar *unit_format);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_PROP_WIDGETS_H__ */
|
#endif /* __GIMP_PROP_WIDGETS_H__ */
|
||||||
|
|
|
@ -383,53 +383,6 @@ gimp_prop_spin_button_new (GObject *config,
|
||||||
return spinbutton;
|
return spinbutton;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gimp_prop_scale_entry_new (GObject *config,
|
|
||||||
const gchar *property_name,
|
|
||||||
GtkTable *table,
|
|
||||||
gint column,
|
|
||||||
gint row,
|
|
||||||
const gchar *text,
|
|
||||||
gdouble step_increment,
|
|
||||||
gdouble page_increment,
|
|
||||||
gint digits)
|
|
||||||
{
|
|
||||||
GtkWidget *label;
|
|
||||||
GtkWidget *scale;
|
|
||||||
GtkWidget *spinbutton;
|
|
||||||
GtkAdjustment *adj;
|
|
||||||
|
|
||||||
label = gtk_label_new_with_mnemonic (text);
|
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
||||||
gtk_table_attach (GTK_TABLE (table), label,
|
|
||||||
column, column + 1, row, row + 1,
|
|
||||||
GTK_FILL, GTK_FILL, 0, 0);
|
|
||||||
gtk_widget_show (label);
|
|
||||||
|
|
||||||
spinbutton = gimp_prop_spin_button_new (config, property_name,
|
|
||||||
step_increment, page_increment,
|
|
||||||
digits);
|
|
||||||
|
|
||||||
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 4 + digits);
|
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), spinbutton,
|
|
||||||
column + 2, column + 3, row, row + 1,
|
|
||||||
GTK_SHRINK, GTK_SHRINK, 0, 0);
|
|
||||||
gtk_widget_show (spinbutton);
|
|
||||||
|
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
|
||||||
|
|
||||||
adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton));
|
|
||||||
scale = gtk_hscale_new (adj);
|
|
||||||
|
|
||||||
gtk_scale_set_digits (GTK_SCALE (scale), digits);
|
|
||||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
|
||||||
gtk_table_attach (GTK_TABLE (table), scale,
|
|
||||||
column + 1, column + 2, row, row + 1,
|
|
||||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
|
||||||
gtk_widget_show (scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_prop_adjustment_callback (GtkAdjustment *adjustment,
|
gimp_prop_adjustment_callback (GtkAdjustment *adjustment,
|
||||||
GObject *config)
|
GObject *config)
|
||||||
|
@ -1658,6 +1611,108 @@ gimp_prop_color_button_notify (GObject *config,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************/
|
||||||
|
/* unit menu */
|
||||||
|
/***************/
|
||||||
|
|
||||||
|
static void gimp_prop_unit_menu_callback (GtkWidget *menu,
|
||||||
|
GObject *config);
|
||||||
|
static void gimp_prop_unit_menu_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkWidget *menu);
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gimp_prop_unit_menu_new (GObject *config,
|
||||||
|
const gchar *property_name,
|
||||||
|
const gchar *unit_format)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
GtkWidget *menu;
|
||||||
|
GimpUnit unit;
|
||||||
|
GValue value = { 0, };
|
||||||
|
gboolean show_pixels;
|
||||||
|
|
||||||
|
param_spec = check_param_spec (config, property_name,
|
||||||
|
GIMP_TYPE_PARAM_UNIT, G_STRLOC);
|
||||||
|
if (! param_spec)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
g_value_init (&value, param_spec->value_type);
|
||||||
|
g_value_set_int (&value, GIMP_UNIT_PIXEL);
|
||||||
|
|
||||||
|
show_pixels = (g_param_value_validate (param_spec, &value) == FALSE);
|
||||||
|
|
||||||
|
g_value_unset (&value);
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
property_name, &unit,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
menu = gimp_unit_menu_new (unit_format, unit, show_pixels, FALSE, TRUE);
|
||||||
|
|
||||||
|
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
||||||
|
|
||||||
|
g_signal_connect (menu, "unit_changed",
|
||||||
|
G_CALLBACK (gimp_prop_unit_menu_callback),
|
||||||
|
config);
|
||||||
|
|
||||||
|
connect_notify (config, property_name,
|
||||||
|
G_CALLBACK (gimp_prop_unit_menu_notify),
|
||||||
|
menu);
|
||||||
|
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prop_unit_menu_callback (GtkWidget *menu,
|
||||||
|
GObject *config)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
GimpUnit unit;
|
||||||
|
|
||||||
|
param_spec = get_param_spec (G_OBJECT (menu));
|
||||||
|
if (! param_spec)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gimp_unit_menu_update (menu, &unit);
|
||||||
|
|
||||||
|
g_signal_handlers_block_by_func (config,
|
||||||
|
gimp_prop_unit_menu_notify,
|
||||||
|
menu);
|
||||||
|
|
||||||
|
g_object_set (config,
|
||||||
|
param_spec->name, unit,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_signal_handlers_unblock_by_func (config,
|
||||||
|
gimp_prop_unit_menu_notify,
|
||||||
|
menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prop_unit_menu_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkWidget *menu)
|
||||||
|
{
|
||||||
|
GimpUnit unit;
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
param_spec->name, &unit,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_signal_handlers_block_by_func (menu,
|
||||||
|
gimp_prop_unit_menu_callback,
|
||||||
|
config);
|
||||||
|
|
||||||
|
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (menu), unit);
|
||||||
|
|
||||||
|
g_signal_handlers_unblock_by_func (menu,
|
||||||
|
gimp_prop_unit_menu_callback,
|
||||||
|
config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
/* private utility functions */
|
/* private utility functions */
|
||||||
/*******************************/
|
/*******************************/
|
||||||
|
|
|
@ -49,15 +49,6 @@ GtkWidget * gimp_prop_spin_button_new (GObject *config,
|
||||||
gdouble step_increment,
|
gdouble step_increment,
|
||||||
gdouble page_increment,
|
gdouble page_increment,
|
||||||
gint digits);
|
gint digits);
|
||||||
void gimp_prop_scale_entry_new (GObject *config,
|
|
||||||
const gchar *property_name,
|
|
||||||
GtkTable *table,
|
|
||||||
gint column,
|
|
||||||
gint row,
|
|
||||||
const gchar *text,
|
|
||||||
gdouble step_increment,
|
|
||||||
gdouble page_increment,
|
|
||||||
gint digits);
|
|
||||||
|
|
||||||
|
|
||||||
/* GimpParamMemsize */
|
/* GimpParamMemsize */
|
||||||
|
@ -113,4 +104,11 @@ GtkWidget * gimp_prop_color_button_new (GObject *config,
|
||||||
GimpColorAreaType type);
|
GimpColorAreaType type);
|
||||||
|
|
||||||
|
|
||||||
|
/* GimpParamUnit */
|
||||||
|
|
||||||
|
GtkWidget * gimp_prop_unit_menu_new (GObject *config,
|
||||||
|
const gchar *property_name,
|
||||||
|
const gchar *unit_format);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_PROP_WIDGETS_H__ */
|
#endif /* __GIMP_PROP_WIDGETS_H__ */
|
||||||
|
|
Loading…
Reference in New Issue