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:
Sven Neumann 2003-02-03 23:54:19 +00:00 committed by Sven Neumann
parent bec52119ce
commit 2c708acab4
14 changed files with 291 additions and 166 deletions

View File

@ -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>
* app/widgets/gimpfontselection-dialog.c: changed the text used in

View File

@ -83,6 +83,7 @@ gimp_display_shell_selection_create (GdkWindow *win,
gint size,
gint width)
{
GimpImage *gimage;
GdkColor fg, bg;
Selection *new;
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);
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;

View File

@ -23,14 +23,14 @@
struct _Selection
{
/* This information is for maintaining the selection's appearance */
GdkWindow *win; /* Window to draw to */
GimpDisplayShell *shell; /* GimpDisplay that owns the selection */
GdkGC *gc_in; /* GC for drawing selection outline */
GdkGC *gc_out; /* GC for selected regions outside
* current layer */
GdkGC *gc_layer; /* GC for current layer outline */
GdkWindow *win; /* Window to draw to */
GimpDisplayShell *shell; /* GimpDisplay that owns the selection */
GdkGC *gc_in; /* GC for drawing selection outline */
GdkGC *gc_out; /* GC for selected regions outside *
* current layer */
GdkGC *gc_layer; /* GC for current layer outline */
/* This information is for drawing the marching ants around the border */
/* This information is for drawing the marching ants around the border */
GdkSegment *segs_in; /* gdk segments of area boundary */
GdkSegment *segs_out; /* gdk segments of area boundary */
GdkSegment *segs_layer; /* gdk segments of area boundary */
@ -49,7 +49,7 @@ struct _Selection
gint cycle; /* color cycling turned on */
GdkPixmap *cycle_pix; /* cycling pixmap */
/* These are used only if USE_XDRAWPOINTS is defined. */
/* These are used only if USE_XDRAWPOINTS is defined. */
GdkPoint *points_in[8]; /* points of segs_in for fast ants */
gint num_points_in[8]; /* number of points in points_in */
GdkGC *gc_white; /* gc for drawing white points */
@ -71,8 +71,8 @@ void gimp_display_shell_selection_start (Selection *select,
void gimp_display_shell_selection_invis (Selection *select);
void gimp_display_shell_selection_layer_invis (Selection *select);
void gimp_display_shell_selection_toggle (Selection *select);
void gimp_display_shell_selection_toggle_layer (Selection *select);
void gimp_display_shell_selection_toggle (Selection *select);
void gimp_display_shell_selection_toggle_layer (Selection *select);
#endif /* __GIMP_DISPLAY_SHELL_SELECTION_H__ */

View File

@ -127,7 +127,7 @@ gimp_text_class_init (GimpTextClass *klass)
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FONT_SIZE,
"font-size", NULL,
0.0, 1024.0, 18.0,
0.0, 8192.0, 18.0,
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_FONT_SIZE_UNIT,
"font-size-unit", NULL,

View File

@ -225,11 +225,14 @@ gimp_blend_tool_button_press (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpBlendTool *blend_tool;
GimpDrawable *drawable;
gint off_x, off_y;
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:
g_message (_("Blend: Invalid for indexed images."));
@ -240,8 +243,7 @@ gimp_blend_tool_button_press (GimpTool *tool,
break;
}
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
&off_x, &off_y);
gimp_drawable_offsets (drawable, &off_x, &off_y);
blend_tool->endx = blend_tool->startx = coords->x - off_x;
blend_tool->endy = blend_tool->starty = coords->y - off_y;

View File

@ -361,8 +361,7 @@ gimp_color_picker_tool_motion (GimpTool *tool,
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
&off_x, &off_y);
gimp_drawable_offsets (tool->drawable, &off_x, &off_y);
cp_tool->centerx = coords->x - off_x;
cp_tool->centery = coords->y - off_y;

View File

@ -274,7 +274,9 @@ gimp_levels_tool_initialize (GimpTool *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."));
return;
@ -287,8 +289,6 @@ gimp_levels_tool_initialize (GimpTool *tool,
l_tool->hist = gimp_histogram_new (GIMP_BASE_CONFIG (gimp->config));
}
drawable = gimp_image_active_drawable (gdisp->gimage);
levels_init (l_tool->levels);
l_tool->channel = GIMP_HISTOGRAM_VALUE;

View File

@ -370,7 +370,8 @@ text_tool_options_new (GimpToolInfo *tool_info)
GtkWidget *button;
GtkWidget *unit_menu;
GtkWidget *font_selection;
GtkWidget *spin_button;
GtkWidget *spinbutton;
gint digits;
options = g_new0 (TextOptions, 1);
@ -387,7 +388,7 @@ text_tool_options_new (GimpToolInfo *tool_info)
/* the 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_row_spacings (GTK_TABLE (table), 2);
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_selection, 2, FALSE);
gimp_prop_scale_entry_new (text, "font-size",
GTK_TABLE (table), 0, 1,
_("_Size:"), 1.0, 50.0, 1);
digits = gimp_unit_get_digits (GIMP_TEXT (text)->font_size_unit);
spinbutton = gimp_prop_spin_button_new (text, "font-size",
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,
TRUE, FALSE, TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Unit:"), 1.0, 0.5, unit_menu, 2, TRUE);
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
unit_menu = gimp_prop_unit_menu_new (text, "font-size-unit", "%a");
g_object_set_data (G_OBJECT (unit_menu), "set_digits", spinbutton);
gtk_table_attach (GTK_TABLE (table), unit_menu, 2, 3, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (unit_menu);
button = gimp_prop_color_button_new (text, "color", _("Text Color"),
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);
spin_button = gimp_prop_spin_button_new (text, "letter-spacing", 0.1, 1.0, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spin_button), 5);
gimp_table_attach_stock (GTK_TABLE (table), 0, 4,
GIMP_STOCK_LETTER_SPACING, spin_button);
spinbutton = gimp_prop_spin_button_new (text, "letter-spacing", 0.1, 1.0, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
gimp_table_attach_stock (GTK_TABLE (table), 0, 3,
GIMP_STOCK_LETTER_SPACING, spinbutton);
spin_button = gimp_prop_spin_button_new (text, "line-spacing", 0.1, 1.0, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spin_button), 5);
gimp_table_attach_stock (GTK_TABLE (table), 0, 5,
GIMP_STOCK_LINE_SPACING, spin_button);
spinbutton = gimp_prop_spin_button_new (text, "line-spacing", 0.1, 1.0, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
gimp_table_attach_stock (GTK_TABLE (table), 0, 4,
GIMP_STOCK_LINE_SPACING, spinbutton);
return (GimpToolOptions *) options;
}

View File

@ -194,7 +194,9 @@ gimp_threshold_tool_initialize (GimpTool *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."));
return;
@ -207,8 +209,6 @@ gimp_threshold_tool_initialize (GimpTool *tool,
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->low_threshold = 127;
t_tool->threshold->high_threshold = 255;

View File

@ -736,6 +736,7 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
GimpDisplay *gdisp)
{
GimpTool *tool;
GimpDrawable *drawable;
TransformOptions *options;
GimpProgress *progress;
TileManager *ret;
@ -750,7 +751,9 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
progress = gimp_progress_start (gdisp, tr_tool->progress_text, FALSE,
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,
options->interpolation,
options->clip,

View File

@ -383,53 +383,6 @@ gimp_prop_spin_button_new (GObject *config,
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
gimp_prop_adjustment_callback (GtkAdjustment *adjustment,
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 */
/*******************************/

View File

@ -49,15 +49,6 @@ GtkWidget * gimp_prop_spin_button_new (GObject *config,
gdouble step_increment,
gdouble page_increment,
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 */
@ -113,4 +104,11 @@ GtkWidget * gimp_prop_color_button_new (GObject *config,
GimpColorAreaType type);
/* GimpParamUnit */
GtkWidget * gimp_prop_unit_menu_new (GObject *config,
const gchar *property_name,
const gchar *unit_format);
#endif /* __GIMP_PROP_WIDGETS_H__ */

View File

@ -383,53 +383,6 @@ gimp_prop_spin_button_new (GObject *config,
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
gimp_prop_adjustment_callback (GtkAdjustment *adjustment,
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 */
/*******************************/

View File

@ -49,15 +49,6 @@ GtkWidget * gimp_prop_spin_button_new (GObject *config,
gdouble step_increment,
gdouble page_increment,
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 */
@ -113,4 +104,11 @@ GtkWidget * gimp_prop_color_button_new (GObject *config,
GimpColorAreaType type);
/* GimpParamUnit */
GtkWidget * gimp_prop_unit_menu_new (GObject *config,
const gchar *property_name,
const gchar *unit_format);
#endif /* __GIMP_PROP_WIDGETS_H__ */