Toggable tools!

I hope I haven't broken too much ;-)


--Sven
This commit is contained in:
Sven Neumann 1999-04-27 02:09:03 +00:00
parent bd74c628f6
commit 8b46a4f9f5
116 changed files with 1076 additions and 1356 deletions

View file

@ -1,3 +1,19 @@
Tue Apr 27 03:55:44 MEST 1999 Sven Neumann <sven@gimp.org>
* app/tool_options.c
* app/tool_options_ui.h
* app/tools.[ch]
* app/toolsF.h
* app/tools_cmds.c: Enabled toggable tools. Tools can hook to
the key-press event of the Shift key.
* app/bucket_fill.c
* app/convolve.c
* app/crop.[ch]
* app/flip_tool.[ch]: Made these tools toggleable.
* all other tools: added a standard_toggle_key_func.
Mon Apr 26 16:05:55 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen)
* plug-ins/MapObject/mapobject_main.c:

View file

@ -235,7 +235,7 @@ tools_new_color_balance ()
tool->button_press_func = color_balance_button_press;
tool->button_release_func = color_balance_button_release;
tool->motion_func = color_balance_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;

View file

@ -340,7 +340,7 @@ tools_new_curves ()
tool->button_press_func = curves_button_press;
tool->button_release_func = curves_button_release;
tool->motion_func = curves_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;

View file

@ -314,7 +314,7 @@ tools_new_hue_saturation ()
tool->button_press_func = hue_saturation_button_press;
tool->button_release_func = hue_saturation_button_release;
tool->motion_func = hue_saturation_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
tool->preserve = FALSE;

View file

@ -253,7 +253,7 @@ tools_new_threshold ()
tool->button_press_func = threshold_button_press;
tool->button_release_func = threshold_button_release;
tool->motion_func = threshold_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
tool->preserve = FALSE;

View file

@ -207,7 +207,7 @@ tools_new_bezier_select ()
tool->button_press_func = bezier_select_button_press;
tool->button_release_func = bezier_select_button_release;
tool->motion_func = bezier_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = bezier_select_control;
tool->preserve = FALSE;

View file

@ -1738,7 +1738,7 @@ tools_new_blend ()
tool->button_press_func = blend_button_press;
tool->button_release_func = blend_button_release;
tool->motion_func = blend_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;

View file

@ -189,7 +189,7 @@ tools_new_brightness_contrast ()
tool->button_press_func = brightness_contrast_button_press;
tool->button_release_func = brightness_contrast_button_release;
tool->motion_func = brightness_contrast_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;

View file

@ -60,7 +60,7 @@ struct _BucketOptions
BucketFillMode fill_mode;
BucketFillMode fill_mode_d;
GtkWidget *fill_mode_w[3]; /* 3 radio buttons */
ToolOptionsRadioButtons type_toggle[4];
};
@ -86,13 +86,6 @@ static void bucket_fill_line_pattern (unsigned char *, unsigned char *,
/* functions */
static void
bucket_fill_mode_callback (GtkWidget *widget,
gpointer client_data)
{
bucket_options->fill_mode = (BucketFillMode) client_data;
}
static void
bucket_options_reset (void)
{
@ -104,7 +97,7 @@ bucket_options_reset (void)
options->sample_merged_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
options->threshold_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->fill_mode_d].widget), TRUE);
}
static BucketOptions *
@ -116,18 +109,8 @@ bucket_options_new (void)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *scale;
GSList *group = NULL;
GtkWidget *radio_frame;
GtkWidget *radio_box;
GtkWidget *radio_button;
GtkWidget *frame;
int i;
char *button_names[3] =
{
N_("FG Color Fill"),
N_("BG Color Fill"),
N_("Pattern Fill")
};
/* the new bucket fill tool options structure */
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
@ -136,6 +119,13 @@ bucket_options_new (void)
bucket_options_reset);
options->sample_merged = options->sample_merged_d = FALSE;
options->threshold = options->threshold_d = 15.0;
options->type_toggle[0].label = _("FG Color Fill");
options->type_toggle[0].value = FG_BUCKET_FILL;
options->type_toggle[1].label = _("BG Color Fill");
options->type_toggle[1].value = BG_BUCKET_FILL;
options->type_toggle[2].label = _("Pattern Fill");
options->type_toggle[2].value = PATTERN_BUCKET_FILL;
options->type_toggle[3].label = NULL;
options->fill_mode = options->fill_mode_d = FG_BUCKET_FILL;
/* the main vbox */
@ -172,30 +162,11 @@ bucket_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0);
gtk_widget_show (options->sample_merged_w);
/* the radio frame and box */
radio_frame = gtk_frame_new (_("Fill Type"));
gtk_box_pack_start (GTK_BOX (vbox), radio_frame, FALSE, FALSE, 0);
radio_box = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
/* the radio buttons */
for (i = 0; i < 3; i++)
{
radio_button =
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
(GtkSignalFunc) bucket_fill_mode_callback,
(gpointer) i);
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button);
options->fill_mode_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
/* fill type */
frame = tool_options_radio_buttons_new (_("Fill Type"), options->type_toggle, &options->fill_mode);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->fill_mode_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
@ -237,7 +208,6 @@ bucket_fill_button_release (Tool *tool,
{
GDisplay * gdisp;
BucketTool * bucket_tool;
BucketFillMode fill_mode;
Argument *return_vals;
int nreturn_vals;
@ -250,19 +220,10 @@ bucket_fill_button_release (Tool *tool,
/* if the 3rd button isn't pressed, fill the selected region */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
fill_mode = bucket_options->fill_mode;
/* If the mode is color filling, and shift mask is down,
* toggle FG/BG fill mode
*/
if ((bevent->state & GDK_SHIFT_MASK) && (fill_mode != PATTERN_BUCKET_FILL))
fill_mode =
(fill_mode == BG_BUCKET_FILL) ? FG_BUCKET_FILL : BG_BUCKET_FILL;
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
PDB_INT32, (gint32) fill_mode,
PDB_INT32, (gint32) bucket_options->fill_mode,
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (bucket_options),
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (bucket_options) * 100,
PDB_FLOAT, (gdouble) bucket_options->threshold,
@ -324,6 +285,23 @@ bucket_fill_cursor_update (Tool *tool,
gdisplay_install_tool_cursor (gdisp, ctype);
}
static void
bucket_fill_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[BG_BUCKET_FILL].widget), TRUE);
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[FG_BUCKET_FILL].widget), TRUE);
break;
default:
break;
}
}
static void
bucket_fill_control (Tool *tool,
@ -626,7 +604,8 @@ tools_new_bucket_fill (void)
tool->button_press_func = bucket_fill_button_press;
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->toggle_key_func = bucket_fill_toggle_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->preserve = TRUE;

View file

@ -481,7 +481,7 @@ tools_new_by_color_select ()
tool->button_press_func = by_color_select_button_press;
tool->button_release_func = by_color_select_button_release;
tool->motion_func = by_color_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
tool->gdisp_ptr = NULL;

View file

@ -235,7 +235,7 @@ tools_new_color_balance ()
tool->button_press_func = color_balance_button_press;
tool->button_release_func = color_balance_button_release;
tool->motion_func = color_balance_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;

View file

@ -622,7 +622,7 @@ tools_new_color_picker ()
tool->button_press_func = color_picker_button_press;
tool->button_release_func = color_picker_button_release;
tool->motion_func = color_picker_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
tool->preserve = TRUE;

View file

@ -47,7 +47,7 @@ struct _ConvolveOptions
ConvolveType type;
ConvolveType type_d;
GtkWidget *type_w[2]; /* 2 radio buttons */
ToolOptionsRadioButtons type_toggle[3];
double pressure;
double pressure_d;
@ -102,12 +102,6 @@ static void convolve_motion (PaintCore *, GimpDrawable *);
/* functions */
static void
convolve_type_callback (GtkWidget *widget,
gpointer data)
{
convolve_options->type = (ConvolveType) data;
}
static void
convolve_options_reset (void)
@ -118,7 +112,7 @@ convolve_options_reset (void)
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static ConvolveOptions *
@ -130,24 +124,23 @@ convolve_options_new (void)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *scale;
GSList *group = NULL;
GtkWidget *frame;
GtkWidget *radio_box;
GtkWidget *radio_button;
int i;
char *button_names[3] =
{
N_("Blur"),
N_("Sharpen"),
N_("Custom")
};
/* the new convolve tool options structure */
options = (ConvolveOptions *) g_malloc (sizeof (ConvolveOptions));
paint_options_init ((PaintOptions *) options,
CONVOLVE,
convolve_options_reset);
options->type_toggle[0].label = _("Blur");
options->type_toggle[0].value = BLUR_CONVOLVE;
options->type_toggle[1].label = _("Sharpen");
options->type_toggle[1].value = SHARPEN_CONVOLVE;
options->type_toggle[2].label = NULL;
/*
options->type_toggle[2].label = N_("Sharpen");
options->type_toggle[2].value = CUSTOM_CONVOLVE;
options->type_toggle[3].label = NULL;
*/
options->type = options->type_d = BLUR_CONVOLVE;
options->pressure = options->pressure_d = 50.0;
@ -175,30 +168,11 @@ convolve_options_new (void)
gtk_widget_show (scale);
gtk_widget_show (hbox);
frame = gtk_frame_new (_("Convolve Type"));
frame = tool_options_radio_buttons_new (_("Convolve Type"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
radio_box = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
gtk_container_add (GTK_CONTAINER (frame), radio_box);
/* the radio buttons */
for (i = 0; i < 2; i++)
{
radio_button =
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
(GtkSignalFunc) convolve_type_callback,
(gpointer) ((long) i));
gtk_widget_show (radio_button);
options->type_w[i] = radio_button;
}
gtk_widget_show (radio_box);
return options;
}
@ -217,6 +191,25 @@ convolve_paint_func (PaintCore *paint_core,
return NULL;
}
static void
convolve_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (convolve_options->type)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[SHARPEN_CONVOLVE].widget), TRUE);
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[BLUR_CONVOLVE].widget), TRUE);
break;
default:
break;
}
}
Tool *
tools_new_convolve ()
{
@ -234,6 +227,7 @@ tools_new_convolve ()
}
tool = paint_core_new (CONVOLVE);
tool->toggle_key_func = convolve_toggle_key_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View file

@ -1738,7 +1738,7 @@ tools_new_blend ()
tool->button_press_func = blend_button_press;
tool->button_release_func = blend_button_release;
tool->motion_func = blend_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;

View file

@ -135,6 +135,54 @@ tool_options_paint_mode_update (GtkWidget *widget,
options->paint_mode = (long) data;
}
static void
tool_options_radio_buttons_update (GtkWidget *widget,
gpointer data)
{
int *toggle_val;
toggle_val = (int *) data;
if (GTK_TOGGLE_BUTTON (widget)->active)
*toggle_val = (int) gtk_object_get_data (GTK_OBJECT (widget), "toggle_value");
}
GtkWidget*
tool_options_radio_buttons_new (gchar* label,
ToolOptionsRadioButtons* radio_buttons,
gpointer toggle_val)
{
GtkWidget *frame;
GtkWidget *vbox;
GSList *group = NULL;
frame = gtk_frame_new (label);
g_return_val_if_fail (toggle_val != NULL, frame);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
while (radio_buttons->label != NULL)
{
radio_buttons->widget = gtk_radio_button_new_with_label (group,
radio_buttons->label);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_buttons->widget));
gtk_box_pack_start (GTK_BOX (vbox), radio_buttons->widget, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_buttons->widget), "toggled",
(GtkSignalFunc) tool_options_radio_buttons_update,
toggle_val);
gtk_object_set_data (GTK_OBJECT (radio_buttons->widget), "toggle_value",
(gpointer)radio_buttons->value);
gtk_widget_show (radio_buttons->widget);
radio_buttons++;
}
gtk_widget_show (vbox);
return (frame);
}
/* tool options functions ***************************************************/

View file

@ -42,6 +42,7 @@
#define CROPPING 4
#define REFRAMING 5
/* speed of key movement */
#define ARROW_VELOCITY 25
@ -79,15 +80,16 @@ struct _CropOptions
int layer_only_d;
GtkWidget *layer_only_w;
int default_to_enlarge;
int default_to_enlarge_d;
GtkWidget *default_to_enlarge_w;
int allow_enlarge;
int allow_enlarge_d;
GtkWidget *allow_enlarge_w;
int default_to_crop;
int default_to_crop_d;
GtkWidget *default_to_crop_w;
CropType type;
CropType type_d;
ToolOptionsRadioButtons type_toggle[3];
};
/* the crop tool options */
static CropOptions *crop_options = NULL;
@ -101,13 +103,14 @@ static GtkWidget *origin_sizeentry;
static GtkWidget *size_sizeentry;
/* Crop action functions */
/* Crop type functions */
static void crop_button_press (Tool *, GdkEventButton *, gpointer);
static void crop_button_release (Tool *, GdkEventButton *, gpointer);
static void crop_motion (Tool *, GdkEventMotion *, gpointer);
static void crop_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void crop_control (Tool *, int, gpointer);
static void crop_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
static void crop_toggle_key_func (Tool *, GdkEventKey *, gpointer);
/* Crop helper functions */
static void crop_recalc (Tool *, Crop *);
@ -151,29 +154,31 @@ crop_options_reset (void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->layer_only_w),
options->layer_only_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->default_to_enlarge_w),
options->default_to_enlarge_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->default_to_crop_w),
options->default_to_crop_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->allow_enlarge_w),
options->allow_enlarge_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static CropOptions *
crop_options_new (void)
{
CropOptions *options;
GtkWidget *vbox;
GtkWidget *defaults_frame;
GtkWidget *defaults_vbox;
GtkWidget *frame;
/* the new crop tool options structure */
options = (CropOptions *) g_malloc (sizeof (CropOptions));
tool_options_init ((ToolOptions *) options,
_("Crop & Resize Options"),
crop_options_reset);
options->layer_only = options->layer_only_d = FALSE;
options->default_to_enlarge = options->default_to_enlarge_d = TRUE;
options->default_to_crop = options->default_to_crop_d = FALSE;
options->layer_only = options->layer_only_d = FALSE;
options->allow_enlarge = options->allow_enlarge_d = TRUE;
options->type_toggle[0].label = _("Crop");
options->type_toggle[0].value = CROP_CROP;
options->type_toggle[1].label = _("Resize");
options->type_toggle[1].value = RESIZE_CROP;
options->type_toggle[2].label = NULL;
options->type = options->type_d = CROP_CROP;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -190,40 +195,22 @@ crop_options_new (void)
options->layer_only_d);
gtk_widget_show (options->layer_only_w);
/* defaults */
defaults_frame = gtk_frame_new (_("Defaults"));
gtk_box_pack_start (GTK_BOX (vbox), defaults_frame, FALSE, FALSE, 0);
defaults_vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (defaults_vbox), 2);
gtk_container_add (GTK_CONTAINER (defaults_frame), defaults_vbox);
/* enlarge toggle */
options->default_to_enlarge_w =
gtk_check_button_new_with_label (_("Allow Enlarging"));
gtk_box_pack_start (GTK_BOX (defaults_vbox), options->default_to_enlarge_w,
options->allow_enlarge_w = gtk_check_button_new_with_label (_("Allow Enlarging"));
gtk_box_pack_start (GTK_BOX (vbox), options->allow_enlarge_w,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->default_to_enlarge_w), "toggled",
gtk_signal_connect (GTK_OBJECT (options->allow_enlarge_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->default_to_enlarge);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->default_to_enlarge_w),
options->default_to_enlarge_d);
gtk_widget_show (options->default_to_enlarge_w);
&options->allow_enlarge);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_enlarge_w),
options->allow_enlarge_d);
gtk_widget_show (options->allow_enlarge_w);
/* crop toggle */
options->default_to_crop_w =
gtk_check_button_new_with_label(_("Crop Layers"));
gtk_box_pack_start (GTK_BOX (defaults_vbox), options->default_to_crop_w,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->default_to_crop_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->default_to_crop);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->default_to_crop_w),
options->default_to_crop_d);
gtk_widget_show (options->default_to_crop_w);
gtk_widget_show (defaults_vbox);
gtk_widget_show (defaults_frame);
/* tool toggle */
frame = tool_options_radio_buttons_new (_("Tool Toggle"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
@ -267,21 +254,11 @@ crop_button_press (Tool *tool,
else if (bevent->x > crop->x1 && bevent->x < crop->x2 &&
bevent->y > crop->y1 && bevent->y < crop->y2)
{
if ( crop_options->default_to_crop )
{
if ( bevent->state & GDK_SHIFT_MASK )
crop->function = REFRAMING;
else
crop->function = CROPPING;
}
else
{
if ( bevent->state & GDK_SHIFT_MASK )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
}
if ( crop_options->type == CROP_CROP )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
/* otherwise, the new function will be creating, since we want to start anew */
else
crop->function = CREATING;
@ -439,7 +416,7 @@ crop_motion (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->default_to_enlarge)
if (crop_options->allow_enlarge)
{
if (mevent->state & GDK_MOD1_MASK)
clamp = TRUE;
@ -570,15 +547,12 @@ crop_cursor_update (Tool *tool,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
int x, y;
GdkCursorType ctype;
Crop * crop;
gdisp = (GDisplay *) gdisp_ptr;
crop = (Crop *) tool->private;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, FALSE, FALSE);
if (tool->state == INACTIVE ||
(tool->state == ACTIVE && tool->gdisp_ptr != gdisp_ptr))
ctype = GDK_CROSS;
@ -597,20 +571,10 @@ crop_cursor_update (Tool *tool,
else if (mevent->x > crop->x1 && mevent->x < crop->x2 &&
mevent->y > crop->y1 && mevent->y < crop->y2)
{
if ( crop_options->default_to_crop )
{
if ( mevent->state & GDK_SHIFT_MASK )
ctype = GDK_SIZING;
else
ctype = GDK_ICON;
}
if ( crop_options->type == CROP_CROP )
ctype = GDK_ICON;
else
{
if ( mevent->state & GDK_SHIFT_MASK )
ctype = GDK_ICON;
else
ctype = GDK_SIZING;
}
ctype = GDK_SIZING;
}
else
ctype = GDK_CROSS;
@ -655,7 +619,7 @@ crop_arrow_keys_func (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->default_to_enlarge)
if (crop_options->allow_enlarge)
{
if (kevent->state & GDK_MOD1_MASK)
clamp = TRUE;
@ -714,6 +678,24 @@ crop_arrow_keys_func (Tool *tool,
}
}
static void
crop_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
GDisplay * gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if (tool->state == ACTIVE && tool->gdisp_ptr == gdisp_ptr)
{
if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_toggle[RESIZE_CROP].widget), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_toggle[CROP_CROP].widget), TRUE);
}
}
static void
crop_control (Tool *tool,
int action,
@ -805,6 +787,7 @@ tools_new_crop ()
tool->button_release_func = crop_button_release;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->toggle_key_func = crop_toggle_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */
@ -1156,8 +1139,10 @@ static void
crop_info_update (Tool *tool)
{
Crop * crop;
GDisplay * gdisp;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
orig_vals[0] = crop->tx1;
orig_vals[1] = crop->ty1;

View file

@ -21,6 +21,13 @@
#include "gimpimageF.h"
#include "tools.h"
typedef enum
{
CROP_CROP,
RESIZE_CROP
} CropType;
/* select functions */
void crop_draw (Tool *);
void crop_image (GimpImage *gimage, int, int, int, int, int, int);

View file

@ -340,7 +340,7 @@ tools_new_curves ()
tool->button_press_func = curves_button_press;
tool->button_release_func = curves_button_release;
tool->motion_func = curves_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;

View file

@ -365,6 +365,7 @@ info_dialog_popup (InfoDialog *idialog)
if (!GTK_WIDGET_VISIBLE (idialog->shell))
gtk_widget_show (idialog->shell);
}
void

View file

@ -388,6 +388,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
case GDK_Shift_L: case GDK_Shift_R:
state |= GDK_SHIFT_MASK;
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
gdk_input_window_get_pointer (canvas->window, current_device,
&tx, &ty, NULL, NULL, NULL, NULL);
return_val = TRUE;
}
break;
case GDK_Control_L: case GDK_Control_R:
state |= GDK_CONTROL_MASK;
@ -409,6 +416,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
case GDK_Shift_L: case GDK_Shift_R:
kevent->state &= ~GDK_SHIFT_MASK;
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
gdk_input_window_get_pointer (canvas->window, current_device,
&tx, &ty, NULL, NULL, NULL, NULL);
return_val = TRUE;
}
break;
case GDK_Control_L: case GDK_Control_R:
kevent->state &= ~GDK_CONTROL_MASK;

View file

@ -388,6 +388,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
case GDK_Shift_L: case GDK_Shift_R:
state |= GDK_SHIFT_MASK;
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
gdk_input_window_get_pointer (canvas->window, current_device,
&tx, &ty, NULL, NULL, NULL, NULL);
return_val = TRUE;
}
break;
case GDK_Control_L: case GDK_Control_R:
state |= GDK_CONTROL_MASK;
@ -409,6 +416,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
case GDK_Shift_L: case GDK_Shift_R:
kevent->state &= ~GDK_SHIFT_MASK;
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
gdk_input_window_get_pointer (canvas->window, current_device,
&tx, &ty, NULL, NULL, NULL, NULL);
return_val = TRUE;
}
break;
case GDK_Control_L: case GDK_Control_R:
kevent->state &= ~GDK_CONTROL_MASK;

View file

@ -388,6 +388,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
case GDK_Shift_L: case GDK_Shift_R:
state |= GDK_SHIFT_MASK;
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
gdk_input_window_get_pointer (canvas->window, current_device,
&tx, &ty, NULL, NULL, NULL, NULL);
return_val = TRUE;
}
break;
case GDK_Control_L: case GDK_Control_R:
state |= GDK_CONTROL_MASK;
@ -409,6 +416,13 @@ gdisplay_canvas_events (GtkWidget *canvas,
break;
case GDK_Shift_L: case GDK_Shift_R:
kevent->state &= ~GDK_SHIFT_MASK;
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
gdk_input_window_get_pointer (canvas->window, current_device,
&tx, &ty, NULL, NULL, NULL, NULL);
return_val = TRUE;
}
break;
case GDK_Control_L: case GDK_Control_R:
kevent->state &= ~GDK_CONTROL_MASK;

View file

@ -251,17 +251,15 @@ create_tool_pixmap (GtkWidget *parent, ToolType type)
*/
if (type == SCALE || type == SHEAR || type == PERSPECTIVE)
type = ROTATE;
else if (type == FLIP_VERT)
type = FLIP_HORZ;
if (tool_info[(int) type].icon_data)
return create_pixmap (parent->window, NULL,
tool_info[(int) type].icon_data,
22, 22);
else
return create_pixmap (parent->window, NULL,
dialog_bits,
22, 22);
if (tool_info[(int) type].icon_data)
return create_pixmap (parent->window, NULL,
tool_info[(int) type].icon_data,
22, 22);
else
return create_pixmap (parent->window, NULL,
dialog_bits,
22, 22);
g_return_val_if_fail (FALSE, NULL);
@ -691,7 +689,6 @@ create_display_shell (GDisplay* gdisp,
gtk_object_set_user_data (GTK_OBJECT (gdisp->canvas), (gpointer) gdisp);
/* pack all the widgets */
gtk_table_attach (GTK_TABLE (table), table_inner, 0, 1, 0, 1,
GTK_FILL | GTK_EXPAND | GTK_SHRINK,

View file

@ -251,17 +251,15 @@ create_tool_pixmap (GtkWidget *parent, ToolType type)
*/
if (type == SCALE || type == SHEAR || type == PERSPECTIVE)
type = ROTATE;
else if (type == FLIP_VERT)
type = FLIP_HORZ;
if (tool_info[(int) type].icon_data)
return create_pixmap (parent->window, NULL,
tool_info[(int) type].icon_data,
22, 22);
else
return create_pixmap (parent->window, NULL,
dialog_bits,
22, 22);
if (tool_info[(int) type].icon_data)
return create_pixmap (parent->window, NULL,
tool_info[(int) type].icon_data,
22, 22);
else
return create_pixmap (parent->window, NULL,
dialog_bits,
22, 22);
g_return_val_if_fail (FALSE, NULL);
@ -691,7 +689,6 @@ create_display_shell (GDisplay* gdisp,
gtk_object_set_user_data (GTK_OBJECT (gdisp->canvas), (gpointer) gdisp);
/* pack all the widgets */
gtk_table_attach (GTK_TABLE (table), table_inner, 0, 1, 0, 1,
GTK_FILL | GTK_EXPAND | GTK_SHRINK,

View file

@ -137,7 +137,7 @@ tools_new_ellipse_select (void)
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;

View file

@ -22,7 +22,9 @@
#include "flip_tool.h"
#include "gdisplay.h"
#include "temp_buf.h"
#include "tool_options_ui.h"
#include "transform_core.h"
#include "undo.h"
#include "gimage.h"
@ -30,7 +32,7 @@
#include "tile_manager_pvt.h" /* ick. */
#define FLIP 0
#define FLIP_INFO 0
/* the flip structures */
@ -41,38 +43,20 @@ struct _FlipOptions
ToolType type;
ToolType type_d;
GtkWidget *type_w[2]; /* 2 radio buttons */
ToolOptionsRadioButtons type_toggle[3];
};
/* the flip tool options */
static FlipOptions *flip_options = NULL;
/* forward function declarations */
static Tool * tools_new_flip_horz (void);
static Tool * tools_new_flip_vert (void);
static void flip_change_type (int);
/* functions */
static void
flip_type_callback (GtkWidget *widget,
gpointer client_data)
{
flip_change_type ((long) client_data);
}
static void
flip_options_reset (void)
{
FlipOptions *options = flip_options;
gtk_toggle_button_set_active (((options->type_d == FLIP_HORZ) ?
GTK_TOGGLE_BUTTON (options->type_w[0]) :
GTK_TOGGLE_BUTTON (options->type_w[1])),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static FlipOptions *
@ -81,49 +65,47 @@ flip_options_new (void)
FlipOptions *options;
GtkWidget *vbox;
GSList *group = NULL;
GtkWidget *radio_box;
GtkWidget *frame;
/* the new flip tool options structure */
options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
tool_options_init ((ToolOptions *) options,
_("Flip Tool Options"),
flip_options_reset);
options->type_toggle[0].label = _("Horizontal");
options->type_toggle[0].value = FLIP_HORZ;
options->type_toggle[1].label = _("Vertical");
options->type_toggle[1].value = FLIP_VERT;
options->type_toggle[2].label = NULL;
options->type = options->type_d = FLIP_HORZ;
/* the main vbox */
vbox = options->tool_options.main_vbox;
radio_box = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0);
/* the radio buttons */
options->type_w[0] =
gtk_radio_button_new_with_label (group, _("Horizontal"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[0]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[0], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w[0]), "toggled",
(GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_HORZ)));
gtk_widget_show (options->type_w[0]);
options->type_w[1] = gtk_radio_button_new_with_label (group, _("Vertical"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[1]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[1], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w[1]), "toggled",
(GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_VERT)));
gtk_widget_show (options->type_w[1]);
gtk_widget_show (radio_box);
/* tool toggle */
frame = tool_options_radio_buttons_new (_("Tool Toggle"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
static void *
flip_tool_transform_horz (Tool *tool,
gpointer gdisp_ptr,
int state)
static void
flip_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_toggle[1].widget), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_toggle[0].widget), TRUE);
}
void *
flip_tool_transform (Tool *tool,
gpointer gdisp_ptr,
int state)
{
TransformCore * transform_core;
GDisplay *gdisp;
@ -145,73 +127,56 @@ flip_tool_transform_horz (Tool *tool,
case FINISH :
/* transform_core->trans_info[FLIP] *= -1.0;*/
return flip_tool_flip_horz (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP]);
return flip_tool_flip (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP],
flip_options->type);
break;
}
return NULL;
}
static void *
flip_tool_transform_vert (Tool *tool,
gpointer gdisp_ptr,
int state)
static void
flip_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
TransformCore * transform_core;
GDisplay *gdisp;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
transform_core = (TransformCore *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
switch (state)
{
case INIT :
transform_info = NULL;
break;
if (flip_options->type == FLIP_HORZ)
ctype = GDK_SB_H_DOUBLE_ARROW;
else
ctype = GDK_SB_V_DOUBLE_ARROW;
case MOTION :
break;
case RECALC :
break;
case FINISH :
/*transform_core->trans_info[FLIP] *= -1.0;*/
return flip_tool_flip_vert (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP]);
break;
}
return NULL;
gdisplay_install_tool_cursor (gdisp, ctype);
}
Tool *
tools_new_flip ()
{
Tool * tool;
TransformCore * private;
/* The tool options */
if (! flip_options)
{
flip_options = flip_options_new ();
tools_register (FLIP_HORZ, (ToolOptions *) flip_options);
tools_register (FLIP_VERT, (ToolOptions *) flip_options);
/* press all default buttons */
flip_options_reset ();
tools_register (FLIP, (ToolOptions *) flip_options);
}
switch (flip_options->type)
{
case FLIP_HORZ:
return tools_new_flip_horz ();
break;
case FLIP_VERT:
return tools_new_flip_vert ();
break;
default:
return NULL;
break;
}
tool = transform_core_new (FLIP, NON_INTERACTIVE);
private = tool->private;
private->trans_func = flip_tool_transform;
tool->toggle_key_func = flip_toggle_key_func;
tool->cursor_update_func = flip_cursor_update;
private->trans_info[FLIP_INFO] = -1.0;
return tool;
}
void
@ -220,45 +185,12 @@ tools_free_flip_tool (Tool *tool)
transform_core_free (tool);
}
static Tool *
tools_new_flip_horz ()
{
Tool * tool;
TransformCore * private;
tool = transform_core_new (FLIP_HORZ, NON_INTERACTIVE);
private = tool->private;
/* set the rotation specific transformation attributes */
private->trans_func = flip_tool_transform_horz;
private->trans_info[FLIP] = -1.0;
return tool;
}
static Tool *
tools_new_flip_vert ()
{
Tool * tool;
TransformCore * private;
tool = transform_core_new (FLIP_VERT, NON_INTERACTIVE);
private = tool->private;
/* set the rotation specific transformation attributes */
private->trans_func = flip_tool_transform_vert;
private->trans_info[FLIP] = -1.0;
return tool;
}
TileManager *
flip_tool_flip_horz (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip)
flip_tool_flip (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip,
FlipType type)
{
TileManager *new;
PixelRegion srcPR, destPR;
@ -283,67 +215,21 @@ flip_tool_flip_horz (GImage *gimage,
new->x = orig->x;
new->y = orig->y;
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
copy_region (&srcPR, &destPR);
}
if (type == FLIP_HORZ)
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
copy_region (&srcPR, &destPR);
}
else
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
copy_region (&srcPR, &destPR);
}
}
return new;
}
TileManager *
flip_tool_flip_vert (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip)
{
TileManager *new;
PixelRegion srcPR, destPR;
int i;
if (!orig)
return NULL;
if (flip > 0)
{
new = tile_manager_new (orig->width, orig->height, orig->bpp);
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
copy_region (&srcPR, &destPR);
new->x = orig->x;
new->y = orig->y;
}
else
{
new = tile_manager_new (orig->width, orig->height, orig->bpp);
new->x = orig->x;
new->y = orig->y;
for (i = 0; i < orig->height; i++)
{
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
copy_region (&srcPR, &destPR);
}
}
return new;
}
static void
flip_change_type (int new_type)
{
if (flip_options->type != new_type)
{
/* change the type, free the old tool, create the new tool */
flip_options->type = new_type;
tools_select (flip_options->type);
}
}

View file

@ -20,16 +20,20 @@
#include "tools.h"
typedef enum
{
FLIP_HORZ,
FLIP_VERT
} FlipType;
/* Flip tool functions */
void * flip_tool_transform (Tool *, gpointer, int);
TileManager * flip_tool_flip_horz (GimpImage *, GimpDrawable *,
TileManager *, int);
TileManager * flip_tool_flip_vert (GimpImage *, GimpDrawable *,
TileManager *, int);
TileManager * flip_tool_flip (GimpImage *, GimpDrawable *,
TileManager *, int, FlipType);
Tool * tools_new_flip (void);
void tools_free_flip_tool (Tool *);
#endif /* __FLIP_TOOL_H__ */

View file

@ -479,7 +479,7 @@ tools_new_free_select (void)
tool->button_press_func = free_select_button_press;
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->preserve = TRUE;

View file

@ -573,7 +573,7 @@ tools_new_fuzzy_select (void)
tool->button_press_func = fuzzy_select_button_press;
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;

View file

@ -365,6 +365,7 @@ info_dialog_popup (InfoDialog *idialog)
if (!GTK_WIDGET_VISIBLE (idialog->shell))
gtk_widget_show (idialog->shell);
}
void

View file

@ -176,7 +176,7 @@ static const GtkItemFactoryEntry image_entries[] =
{ N_("/Tools/Magnify"), "<shift>M", tools_select_cmd_callback, MAGNIFY },
{ N_("/Tools/Crop"), "<shift>C", tools_select_cmd_callback, CROP },
{ N_("/Tools/Transform"), "<shift>T", tools_select_cmd_callback, ROTATE },
{ N_("/Tools/Flip"), "<shift>F", tools_select_cmd_callback, FLIP_HORZ },
{ N_("/Tools/Flip"), "<shift>F", tools_select_cmd_callback, FLIP },
{ N_("/Tools/Text"), "T", tools_select_cmd_callback, TEXT },
{ N_("/Tools/Color Picker"), "O", tools_select_cmd_callback, COLOR_PICKER },
{ N_("/Tools/Bucket Fill"), "<shift>B", tools_select_cmd_callback, BUCKET_FILL },

View file

@ -220,7 +220,7 @@ tools_new_histogram_tool ()
tool->button_press_func = histogram_tool_button_press;
tool->button_release_func = histogram_tool_button_release;
tool->motion_func = histogram_tool_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
tool->preserve = FALSE;

View file

@ -314,7 +314,7 @@ tools_new_hue_saturation ()
tool->button_press_func = hue_saturation_button_press;
tool->button_release_func = hue_saturation_button_release;
tool->motion_func = hue_saturation_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
tool->preserve = FALSE;

View file

@ -365,6 +365,7 @@ info_dialog_popup (InfoDialog *idialog)
if (!GTK_WIDGET_VISIBLE (idialog->shell))
gtk_widget_show (idialog->shell);
}
void

View file

@ -1564,7 +1564,7 @@ tools_new_ink ()
tool->button_press_func = ink_button_press;
tool->button_release_func = ink_button_release;
tool->motion_func = ink_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;

View file

@ -251,17 +251,15 @@ create_tool_pixmap (GtkWidget *parent, ToolType type)
*/
if (type == SCALE || type == SHEAR || type == PERSPECTIVE)
type = ROTATE;
else if (type == FLIP_VERT)
type = FLIP_HORZ;
if (tool_info[(int) type].icon_data)
return create_pixmap (parent->window, NULL,
tool_info[(int) type].icon_data,
22, 22);
else
return create_pixmap (parent->window, NULL,
dialog_bits,
22, 22);
if (tool_info[(int) type].icon_data)
return create_pixmap (parent->window, NULL,
tool_info[(int) type].icon_data,
22, 22);
else
return create_pixmap (parent->window, NULL,
dialog_bits,
22, 22);
g_return_val_if_fail (FALSE, NULL);
@ -691,7 +689,6 @@ create_display_shell (GDisplay* gdisp,
gtk_object_set_user_data (GTK_OBJECT (gdisp->canvas), (gpointer) gdisp);
/* pack all the widgets */
gtk_table_attach (GTK_TABLE (table), table_inner, 0, 1, 0, 1,
GTK_FILL | GTK_EXPAND | GTK_SHRINK,

View file

@ -436,7 +436,7 @@ tools_new_iscissors ()
tool->button_press_func = iscissors_button_press;
tool->button_release_func = iscissors_button_release;
tool->motion_func = iscissors_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
tool->auto_snap_to = 0;

View file

@ -252,7 +252,7 @@ tools_new_levels ()
tool->button_press_func = levels_button_press;
tool->button_release_func = levels_button_release;
tool->motion_func = levels_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = levels_cursor_update;
tool->control_func = levels_control;
tool->preserve = FALSE;

View file

@ -370,7 +370,7 @@ tools_new_magnify (void)
tool->button_press_func = magnify_button_press;
tool->button_release_func = magnify_button_release;
tool->motion_func = magnify_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;

View file

@ -176,7 +176,7 @@ static const GtkItemFactoryEntry image_entries[] =
{ N_("/Tools/Magnify"), "<shift>M", tools_select_cmd_callback, MAGNIFY },
{ N_("/Tools/Crop"), "<shift>C", tools_select_cmd_callback, CROP },
{ N_("/Tools/Transform"), "<shift>T", tools_select_cmd_callback, ROTATE },
{ N_("/Tools/Flip"), "<shift>F", tools_select_cmd_callback, FLIP_HORZ },
{ N_("/Tools/Flip"), "<shift>F", tools_select_cmd_callback, FLIP },
{ N_("/Tools/Text"), "T", tools_select_cmd_callback, TEXT },
{ N_("/Tools/Color Picker"), "O", tools_select_cmd_callback, COLOR_PICKER },
{ N_("/Tools/Bucket Fill"), "<shift>B", tools_select_cmd_callback, BUCKET_FILL },

View file

@ -176,7 +176,7 @@ static const GtkItemFactoryEntry image_entries[] =
{ N_("/Tools/Magnify"), "<shift>M", tools_select_cmd_callback, MAGNIFY },
{ N_("/Tools/Crop"), "<shift>C", tools_select_cmd_callback, CROP },
{ N_("/Tools/Transform"), "<shift>T", tools_select_cmd_callback, ROTATE },
{ N_("/Tools/Flip"), "<shift>F", tools_select_cmd_callback, FLIP_HORZ },
{ N_("/Tools/Flip"), "<shift>F", tools_select_cmd_callback, FLIP },
{ N_("/Tools/Text"), "T", tools_select_cmd_callback, TEXT },
{ N_("/Tools/Color Picker"), "O", tools_select_cmd_callback, COLOR_PICKER },
{ N_("/Tools/Bucket Fill"), "<shift>B", tools_select_cmd_callback, BUCKET_FILL },

View file

@ -452,6 +452,7 @@ tools_new_move_tool ()
tool->button_release_func = move_tool_button_release;
tool->motion_func = move_tool_motion;
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->preserve = TRUE;

View file

@ -47,7 +47,7 @@ struct _ConvolveOptions
ConvolveType type;
ConvolveType type_d;
GtkWidget *type_w[2]; /* 2 radio buttons */
ToolOptionsRadioButtons type_toggle[3];
double pressure;
double pressure_d;
@ -102,12 +102,6 @@ static void convolve_motion (PaintCore *, GimpDrawable *);
/* functions */
static void
convolve_type_callback (GtkWidget *widget,
gpointer data)
{
convolve_options->type = (ConvolveType) data;
}
static void
convolve_options_reset (void)
@ -118,7 +112,7 @@ convolve_options_reset (void)
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static ConvolveOptions *
@ -130,24 +124,23 @@ convolve_options_new (void)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *scale;
GSList *group = NULL;
GtkWidget *frame;
GtkWidget *radio_box;
GtkWidget *radio_button;
int i;
char *button_names[3] =
{
N_("Blur"),
N_("Sharpen"),
N_("Custom")
};
/* the new convolve tool options structure */
options = (ConvolveOptions *) g_malloc (sizeof (ConvolveOptions));
paint_options_init ((PaintOptions *) options,
CONVOLVE,
convolve_options_reset);
options->type_toggle[0].label = _("Blur");
options->type_toggle[0].value = BLUR_CONVOLVE;
options->type_toggle[1].label = _("Sharpen");
options->type_toggle[1].value = SHARPEN_CONVOLVE;
options->type_toggle[2].label = NULL;
/*
options->type_toggle[2].label = N_("Sharpen");
options->type_toggle[2].value = CUSTOM_CONVOLVE;
options->type_toggle[3].label = NULL;
*/
options->type = options->type_d = BLUR_CONVOLVE;
options->pressure = options->pressure_d = 50.0;
@ -175,30 +168,11 @@ convolve_options_new (void)
gtk_widget_show (scale);
gtk_widget_show (hbox);
frame = gtk_frame_new (_("Convolve Type"));
frame = tool_options_radio_buttons_new (_("Convolve Type"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
radio_box = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
gtk_container_add (GTK_CONTAINER (frame), radio_box);
/* the radio buttons */
for (i = 0; i < 2; i++)
{
radio_button =
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
(GtkSignalFunc) convolve_type_callback,
(gpointer) ((long) i));
gtk_widget_show (radio_button);
options->type_w[i] = radio_button;
}
gtk_widget_show (radio_box);
return options;
}
@ -217,6 +191,25 @@ convolve_paint_func (PaintCore *paint_core,
return NULL;
}
static void
convolve_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (convolve_options->type)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[SHARPEN_CONVOLVE].widget), TRUE);
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[BLUR_CONVOLVE].widget), TRUE);
break;
default:
break;
}
}
Tool *
tools_new_convolve ()
{
@ -234,6 +227,7 @@ tools_new_convolve ()
}
tool = paint_core_new (CONVOLVE);
tool->toggle_key_func = convolve_toggle_key_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View file

@ -1564,7 +1564,7 @@ tools_new_ink ()
tool->button_press_func = ink_button_press;
tool->button_release_func = ink_button_release;
tool->motion_func = ink_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;

View file

@ -369,7 +369,7 @@ paint_core_new (type)
tool->button_press_func = paint_core_button_press;
tool->button_release_func = paint_core_button_release;
tool->motion_func = paint_core_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = paint_core_cursor_update;
tool->control_func = paint_core_control;

View file

@ -374,9 +374,9 @@ static char *gradient_bits [] =
/* Image name: horizflip */
#define horizflip_width 22
#define horizflip_height 22
static char *horizflip_bits [] =
#define flip_width 22
#define flip_height 22
static char *flip_bits [] =
{
"......................",
"......................",
@ -847,39 +847,6 @@ static char *text_bits [] =
"......................",
"......................"
};
/* GIMP icon image format -- S. Kimball, P. Mattis */
/* Image name: vertflip */
/*
#define vertflip_width 22
#define vertflip_height 22
static char *vertflip_bits [] =
{
"......................",
"......................",
"......................",
"..........a...........",
".........aaa..........",
"........aaaaa.........",
".......aaaeaaa........",
".........aeaeee.......",
".........aeae.........",
".........aeae.........",
".........aeae.........",
".........aeae.........",
".........aeae.........",
".........aeae.........",
".........aeae.........",
".......aaaeaaa........",
"........aaaaaee.......",
".........aaaee........",
"..........aee.........",
"...........e..........",
"......................",
"......................"
};
*/
/* GIMP icon image format -- S. Kimball, P. Mattis */
/* Image name: ink */

View file

@ -185,7 +185,7 @@ tools_new_posterize ()
tool->button_press_func = posterize_button_press;
tool->button_release_func = posterize_button_release;
tool->motion_func = posterize_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = posterize_cursor_update;
tool->control_func = posterize_control;
tool->preserve = FALSE;

View file

@ -538,7 +538,7 @@ tools_new_rect_select ()
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;

View file

@ -244,7 +244,7 @@ tools_new_text ()
tool->button_press_func = text_button_press;
tool->button_release_func = text_button_release;
tool->motion_func = text_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
tool->preserve = TRUE;

View file

@ -253,7 +253,7 @@ tools_new_threshold ()
tool->button_press_func = threshold_button_press;
tool->button_release_func = threshold_button_release;
tool->motion_func = threshold_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
tool->preserve = FALSE;

View file

@ -135,6 +135,54 @@ tool_options_paint_mode_update (GtkWidget *widget,
options->paint_mode = (long) data;
}
static void
tool_options_radio_buttons_update (GtkWidget *widget,
gpointer data)
{
int *toggle_val;
toggle_val = (int *) data;
if (GTK_TOGGLE_BUTTON (widget)->active)
*toggle_val = (int) gtk_object_get_data (GTK_OBJECT (widget), "toggle_value");
}
GtkWidget*
tool_options_radio_buttons_new (gchar* label,
ToolOptionsRadioButtons* radio_buttons,
gpointer toggle_val)
{
GtkWidget *frame;
GtkWidget *vbox;
GSList *group = NULL;
frame = gtk_frame_new (label);
g_return_val_if_fail (toggle_val != NULL, frame);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
while (radio_buttons->label != NULL)
{
radio_buttons->widget = gtk_radio_button_new_with_label (group,
radio_buttons->label);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_buttons->widget));
gtk_box_pack_start (GTK_BOX (vbox), radio_buttons->widget, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_buttons->widget), "toggled",
(GtkSignalFunc) tool_options_radio_buttons_update,
toggle_val);
gtk_object_set_data (GTK_OBJECT (radio_buttons->widget), "toggle_value",
(gpointer)radio_buttons->value);
gtk_widget_show (radio_buttons->widget);
radio_buttons++;
}
gtk_widget_show (vbox);
return (frame);
}
/* tool options functions ***************************************************/

View file

@ -39,4 +39,19 @@ void tool_options_int_adjustment_update (GtkWidget *widget,
void tool_options_double_adjustment_update (GtkWidget *widget,
gpointer data);
/* a group of radio buttons with a frame around them */
typedef struct _ToolOptionsRadioButtons ToolOptionsRadioButtons;
struct _ToolOptionsRadioButtons
{
GtkWidget *widget;
gchar *label;
int value;
};
GtkWidget* tool_options_radio_buttons_new (gchar* label,
ToolOptionsRadioButtons *radio_buttons,
gpointer toggle_val);
#endif /* __TOOL_OPTIONS_UI_H__ */

View file

@ -281,30 +281,15 @@ ToolInfo tool_info[] =
10,
N_("/Tools/Flip"),
"<shift>F",
(char **) horizflip_bits,
(char **) flip_bits,
N_("Flip the layer or selection"),
"ContextHelp/flip",
FLIP_HORZ,
FLIP,
tools_new_flip,
tools_free_flip_tool,
NULL
}, /* horizontal */
{
NULL,
N_("Flip"),
10,
NULL,
NULL,
NULL,
NULL,
NULL,
FLIP_VERT,
tools_new_flip,
tools_free_flip_tool,
NULL
}, /* vertical */
},
{
NULL,
N_("Text"),
@ -896,6 +881,13 @@ standard_arrow_keys_func (Tool *tool,
{
}
void
standard_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
}
static gint
tools_options_delete_callback (GtkWidget *w,
GdkEvent *e,

View file

@ -68,6 +68,7 @@ struct _tool
ButtonReleaseFunc button_release_func;
MotionFunc motion_func;
ArrowKeysFunc arrow_keys_func;
ToggleKeyFunc toggle_key_func;
CursorUpdateFunc cursor_update_func;
ToolCtlFunc control_func;
};
@ -122,5 +123,6 @@ void active_tool_control (int, void *);
/* Standard member functions */
void standard_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
void standard_toggle_key_func (Tool *, GdkEventKey *, gpointer);
#endif /* __TOOLS_H__ */

View file

@ -207,7 +207,7 @@ tools_new_bezier_select ()
tool->button_press_func = bezier_select_button_press;
tool->button_release_func = bezier_select_button_release;
tool->motion_func = bezier_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = bezier_select_control;
tool->preserve = FALSE;

View file

@ -1738,7 +1738,7 @@ tools_new_blend ()
tool->button_press_func = blend_button_press;
tool->button_release_func = blend_button_release;
tool->motion_func = blend_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;

View file

@ -189,7 +189,7 @@ tools_new_brightness_contrast ()
tool->button_press_func = brightness_contrast_button_press;
tool->button_release_func = brightness_contrast_button_release;
tool->motion_func = brightness_contrast_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;

View file

@ -60,7 +60,7 @@ struct _BucketOptions
BucketFillMode fill_mode;
BucketFillMode fill_mode_d;
GtkWidget *fill_mode_w[3]; /* 3 radio buttons */
ToolOptionsRadioButtons type_toggle[4];
};
@ -86,13 +86,6 @@ static void bucket_fill_line_pattern (unsigned char *, unsigned char *,
/* functions */
static void
bucket_fill_mode_callback (GtkWidget *widget,
gpointer client_data)
{
bucket_options->fill_mode = (BucketFillMode) client_data;
}
static void
bucket_options_reset (void)
{
@ -104,7 +97,7 @@ bucket_options_reset (void)
options->sample_merged_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
options->threshold_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->fill_mode_d].widget), TRUE);
}
static BucketOptions *
@ -116,18 +109,8 @@ bucket_options_new (void)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *scale;
GSList *group = NULL;
GtkWidget *radio_frame;
GtkWidget *radio_box;
GtkWidget *radio_button;
GtkWidget *frame;
int i;
char *button_names[3] =
{
N_("FG Color Fill"),
N_("BG Color Fill"),
N_("Pattern Fill")
};
/* the new bucket fill tool options structure */
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
@ -136,6 +119,13 @@ bucket_options_new (void)
bucket_options_reset);
options->sample_merged = options->sample_merged_d = FALSE;
options->threshold = options->threshold_d = 15.0;
options->type_toggle[0].label = _("FG Color Fill");
options->type_toggle[0].value = FG_BUCKET_FILL;
options->type_toggle[1].label = _("BG Color Fill");
options->type_toggle[1].value = BG_BUCKET_FILL;
options->type_toggle[2].label = _("Pattern Fill");
options->type_toggle[2].value = PATTERN_BUCKET_FILL;
options->type_toggle[3].label = NULL;
options->fill_mode = options->fill_mode_d = FG_BUCKET_FILL;
/* the main vbox */
@ -172,30 +162,11 @@ bucket_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0);
gtk_widget_show (options->sample_merged_w);
/* the radio frame and box */
radio_frame = gtk_frame_new (_("Fill Type"));
gtk_box_pack_start (GTK_BOX (vbox), radio_frame, FALSE, FALSE, 0);
radio_box = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
/* the radio buttons */
for (i = 0; i < 3; i++)
{
radio_button =
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
(GtkSignalFunc) bucket_fill_mode_callback,
(gpointer) i);
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button);
options->fill_mode_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
/* fill type */
frame = tool_options_radio_buttons_new (_("Fill Type"), options->type_toggle, &options->fill_mode);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->fill_mode_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
@ -237,7 +208,6 @@ bucket_fill_button_release (Tool *tool,
{
GDisplay * gdisp;
BucketTool * bucket_tool;
BucketFillMode fill_mode;
Argument *return_vals;
int nreturn_vals;
@ -250,19 +220,10 @@ bucket_fill_button_release (Tool *tool,
/* if the 3rd button isn't pressed, fill the selected region */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
fill_mode = bucket_options->fill_mode;
/* If the mode is color filling, and shift mask is down,
* toggle FG/BG fill mode
*/
if ((bevent->state & GDK_SHIFT_MASK) && (fill_mode != PATTERN_BUCKET_FILL))
fill_mode =
(fill_mode == BG_BUCKET_FILL) ? FG_BUCKET_FILL : BG_BUCKET_FILL;
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
PDB_INT32, (gint32) fill_mode,
PDB_INT32, (gint32) bucket_options->fill_mode,
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (bucket_options),
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (bucket_options) * 100,
PDB_FLOAT, (gdouble) bucket_options->threshold,
@ -324,6 +285,23 @@ bucket_fill_cursor_update (Tool *tool,
gdisplay_install_tool_cursor (gdisp, ctype);
}
static void
bucket_fill_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[BG_BUCKET_FILL].widget), TRUE);
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[FG_BUCKET_FILL].widget), TRUE);
break;
default:
break;
}
}
static void
bucket_fill_control (Tool *tool,
@ -626,7 +604,8 @@ tools_new_bucket_fill (void)
tool->button_press_func = bucket_fill_button_press;
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->toggle_key_func = bucket_fill_toggle_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->preserve = TRUE;

View file

@ -481,7 +481,7 @@ tools_new_by_color_select ()
tool->button_press_func = by_color_select_button_press;
tool->button_release_func = by_color_select_button_release;
tool->motion_func = by_color_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
tool->gdisp_ptr = NULL;

View file

@ -235,7 +235,7 @@ tools_new_color_balance ()
tool->button_press_func = color_balance_button_press;
tool->button_release_func = color_balance_button_release;
tool->motion_func = color_balance_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;

View file

@ -622,7 +622,7 @@ tools_new_color_picker ()
tool->button_press_func = color_picker_button_press;
tool->button_release_func = color_picker_button_release;
tool->motion_func = color_picker_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
tool->preserve = TRUE;

View file

@ -47,7 +47,7 @@ struct _ConvolveOptions
ConvolveType type;
ConvolveType type_d;
GtkWidget *type_w[2]; /* 2 radio buttons */
ToolOptionsRadioButtons type_toggle[3];
double pressure;
double pressure_d;
@ -102,12 +102,6 @@ static void convolve_motion (PaintCore *, GimpDrawable *);
/* functions */
static void
convolve_type_callback (GtkWidget *widget,
gpointer data)
{
convolve_options->type = (ConvolveType) data;
}
static void
convolve_options_reset (void)
@ -118,7 +112,7 @@ convolve_options_reset (void)
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static ConvolveOptions *
@ -130,24 +124,23 @@ convolve_options_new (void)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *scale;
GSList *group = NULL;
GtkWidget *frame;
GtkWidget *radio_box;
GtkWidget *radio_button;
int i;
char *button_names[3] =
{
N_("Blur"),
N_("Sharpen"),
N_("Custom")
};
/* the new convolve tool options structure */
options = (ConvolveOptions *) g_malloc (sizeof (ConvolveOptions));
paint_options_init ((PaintOptions *) options,
CONVOLVE,
convolve_options_reset);
options->type_toggle[0].label = _("Blur");
options->type_toggle[0].value = BLUR_CONVOLVE;
options->type_toggle[1].label = _("Sharpen");
options->type_toggle[1].value = SHARPEN_CONVOLVE;
options->type_toggle[2].label = NULL;
/*
options->type_toggle[2].label = N_("Sharpen");
options->type_toggle[2].value = CUSTOM_CONVOLVE;
options->type_toggle[3].label = NULL;
*/
options->type = options->type_d = BLUR_CONVOLVE;
options->pressure = options->pressure_d = 50.0;
@ -175,30 +168,11 @@ convolve_options_new (void)
gtk_widget_show (scale);
gtk_widget_show (hbox);
frame = gtk_frame_new (_("Convolve Type"));
frame = tool_options_radio_buttons_new (_("Convolve Type"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
radio_box = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
gtk_container_add (GTK_CONTAINER (frame), radio_box);
/* the radio buttons */
for (i = 0; i < 2; i++)
{
radio_button =
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
(GtkSignalFunc) convolve_type_callback,
(gpointer) ((long) i));
gtk_widget_show (radio_button);
options->type_w[i] = radio_button;
}
gtk_widget_show (radio_box);
return options;
}
@ -217,6 +191,25 @@ convolve_paint_func (PaintCore *paint_core,
return NULL;
}
static void
convolve_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (convolve_options->type)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[SHARPEN_CONVOLVE].widget), TRUE);
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[BLUR_CONVOLVE].widget), TRUE);
break;
default:
break;
}
}
Tool *
tools_new_convolve ()
{
@ -234,6 +227,7 @@ tools_new_convolve ()
}
tool = paint_core_new (CONVOLVE);
tool->toggle_key_func = convolve_toggle_key_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View file

@ -42,6 +42,7 @@
#define CROPPING 4
#define REFRAMING 5
/* speed of key movement */
#define ARROW_VELOCITY 25
@ -79,15 +80,16 @@ struct _CropOptions
int layer_only_d;
GtkWidget *layer_only_w;
int default_to_enlarge;
int default_to_enlarge_d;
GtkWidget *default_to_enlarge_w;
int allow_enlarge;
int allow_enlarge_d;
GtkWidget *allow_enlarge_w;
int default_to_crop;
int default_to_crop_d;
GtkWidget *default_to_crop_w;
CropType type;
CropType type_d;
ToolOptionsRadioButtons type_toggle[3];
};
/* the crop tool options */
static CropOptions *crop_options = NULL;
@ -101,13 +103,14 @@ static GtkWidget *origin_sizeentry;
static GtkWidget *size_sizeentry;
/* Crop action functions */
/* Crop type functions */
static void crop_button_press (Tool *, GdkEventButton *, gpointer);
static void crop_button_release (Tool *, GdkEventButton *, gpointer);
static void crop_motion (Tool *, GdkEventMotion *, gpointer);
static void crop_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void crop_control (Tool *, int, gpointer);
static void crop_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
static void crop_toggle_key_func (Tool *, GdkEventKey *, gpointer);
/* Crop helper functions */
static void crop_recalc (Tool *, Crop *);
@ -151,29 +154,31 @@ crop_options_reset (void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->layer_only_w),
options->layer_only_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->default_to_enlarge_w),
options->default_to_enlarge_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->default_to_crop_w),
options->default_to_crop_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->allow_enlarge_w),
options->allow_enlarge_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static CropOptions *
crop_options_new (void)
{
CropOptions *options;
GtkWidget *vbox;
GtkWidget *defaults_frame;
GtkWidget *defaults_vbox;
GtkWidget *frame;
/* the new crop tool options structure */
options = (CropOptions *) g_malloc (sizeof (CropOptions));
tool_options_init ((ToolOptions *) options,
_("Crop & Resize Options"),
crop_options_reset);
options->layer_only = options->layer_only_d = FALSE;
options->default_to_enlarge = options->default_to_enlarge_d = TRUE;
options->default_to_crop = options->default_to_crop_d = FALSE;
options->layer_only = options->layer_only_d = FALSE;
options->allow_enlarge = options->allow_enlarge_d = TRUE;
options->type_toggle[0].label = _("Crop");
options->type_toggle[0].value = CROP_CROP;
options->type_toggle[1].label = _("Resize");
options->type_toggle[1].value = RESIZE_CROP;
options->type_toggle[2].label = NULL;
options->type = options->type_d = CROP_CROP;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -190,40 +195,22 @@ crop_options_new (void)
options->layer_only_d);
gtk_widget_show (options->layer_only_w);
/* defaults */
defaults_frame = gtk_frame_new (_("Defaults"));
gtk_box_pack_start (GTK_BOX (vbox), defaults_frame, FALSE, FALSE, 0);
defaults_vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (defaults_vbox), 2);
gtk_container_add (GTK_CONTAINER (defaults_frame), defaults_vbox);
/* enlarge toggle */
options->default_to_enlarge_w =
gtk_check_button_new_with_label (_("Allow Enlarging"));
gtk_box_pack_start (GTK_BOX (defaults_vbox), options->default_to_enlarge_w,
options->allow_enlarge_w = gtk_check_button_new_with_label (_("Allow Enlarging"));
gtk_box_pack_start (GTK_BOX (vbox), options->allow_enlarge_w,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->default_to_enlarge_w), "toggled",
gtk_signal_connect (GTK_OBJECT (options->allow_enlarge_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->default_to_enlarge);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->default_to_enlarge_w),
options->default_to_enlarge_d);
gtk_widget_show (options->default_to_enlarge_w);
&options->allow_enlarge);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_enlarge_w),
options->allow_enlarge_d);
gtk_widget_show (options->allow_enlarge_w);
/* crop toggle */
options->default_to_crop_w =
gtk_check_button_new_with_label(_("Crop Layers"));
gtk_box_pack_start (GTK_BOX (defaults_vbox), options->default_to_crop_w,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->default_to_crop_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->default_to_crop);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->default_to_crop_w),
options->default_to_crop_d);
gtk_widget_show (options->default_to_crop_w);
gtk_widget_show (defaults_vbox);
gtk_widget_show (defaults_frame);
/* tool toggle */
frame = tool_options_radio_buttons_new (_("Tool Toggle"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
@ -267,21 +254,11 @@ crop_button_press (Tool *tool,
else if (bevent->x > crop->x1 && bevent->x < crop->x2 &&
bevent->y > crop->y1 && bevent->y < crop->y2)
{
if ( crop_options->default_to_crop )
{
if ( bevent->state & GDK_SHIFT_MASK )
crop->function = REFRAMING;
else
crop->function = CROPPING;
}
else
{
if ( bevent->state & GDK_SHIFT_MASK )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
}
if ( crop_options->type == CROP_CROP )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
/* otherwise, the new function will be creating, since we want to start anew */
else
crop->function = CREATING;
@ -439,7 +416,7 @@ crop_motion (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->default_to_enlarge)
if (crop_options->allow_enlarge)
{
if (mevent->state & GDK_MOD1_MASK)
clamp = TRUE;
@ -570,15 +547,12 @@ crop_cursor_update (Tool *tool,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
int x, y;
GdkCursorType ctype;
Crop * crop;
gdisp = (GDisplay *) gdisp_ptr;
crop = (Crop *) tool->private;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, FALSE, FALSE);
if (tool->state == INACTIVE ||
(tool->state == ACTIVE && tool->gdisp_ptr != gdisp_ptr))
ctype = GDK_CROSS;
@ -597,20 +571,10 @@ crop_cursor_update (Tool *tool,
else if (mevent->x > crop->x1 && mevent->x < crop->x2 &&
mevent->y > crop->y1 && mevent->y < crop->y2)
{
if ( crop_options->default_to_crop )
{
if ( mevent->state & GDK_SHIFT_MASK )
ctype = GDK_SIZING;
else
ctype = GDK_ICON;
}
if ( crop_options->type == CROP_CROP )
ctype = GDK_ICON;
else
{
if ( mevent->state & GDK_SHIFT_MASK )
ctype = GDK_ICON;
else
ctype = GDK_SIZING;
}
ctype = GDK_SIZING;
}
else
ctype = GDK_CROSS;
@ -655,7 +619,7 @@ crop_arrow_keys_func (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->default_to_enlarge)
if (crop_options->allow_enlarge)
{
if (kevent->state & GDK_MOD1_MASK)
clamp = TRUE;
@ -714,6 +678,24 @@ crop_arrow_keys_func (Tool *tool,
}
}
static void
crop_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
GDisplay * gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if (tool->state == ACTIVE && tool->gdisp_ptr == gdisp_ptr)
{
if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_toggle[RESIZE_CROP].widget), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_toggle[CROP_CROP].widget), TRUE);
}
}
static void
crop_control (Tool *tool,
int action,
@ -805,6 +787,7 @@ tools_new_crop ()
tool->button_release_func = crop_button_release;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->toggle_key_func = crop_toggle_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */
@ -1156,8 +1139,10 @@ static void
crop_info_update (Tool *tool)
{
Crop * crop;
GDisplay * gdisp;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
orig_vals[0] = crop->tx1;
orig_vals[1] = crop->ty1;

View file

@ -21,6 +21,13 @@
#include "gimpimageF.h"
#include "tools.h"
typedef enum
{
CROP_CROP,
RESIZE_CROP
} CropType;
/* select functions */
void crop_draw (Tool *);
void crop_image (GimpImage *gimage, int, int, int, int, int, int);

View file

@ -340,7 +340,7 @@ tools_new_curves ()
tool->button_press_func = curves_button_press;
tool->button_release_func = curves_button_release;
tool->motion_func = curves_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;

View file

@ -137,7 +137,7 @@ tools_new_ellipse_select (void)
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;

View file

@ -22,7 +22,9 @@
#include "flip_tool.h"
#include "gdisplay.h"
#include "temp_buf.h"
#include "tool_options_ui.h"
#include "transform_core.h"
#include "undo.h"
#include "gimage.h"
@ -30,7 +32,7 @@
#include "tile_manager_pvt.h" /* ick. */
#define FLIP 0
#define FLIP_INFO 0
/* the flip structures */
@ -41,38 +43,20 @@ struct _FlipOptions
ToolType type;
ToolType type_d;
GtkWidget *type_w[2]; /* 2 radio buttons */
ToolOptionsRadioButtons type_toggle[3];
};
/* the flip tool options */
static FlipOptions *flip_options = NULL;
/* forward function declarations */
static Tool * tools_new_flip_horz (void);
static Tool * tools_new_flip_vert (void);
static void flip_change_type (int);
/* functions */
static void
flip_type_callback (GtkWidget *widget,
gpointer client_data)
{
flip_change_type ((long) client_data);
}
static void
flip_options_reset (void)
{
FlipOptions *options = flip_options;
gtk_toggle_button_set_active (((options->type_d == FLIP_HORZ) ?
GTK_TOGGLE_BUTTON (options->type_w[0]) :
GTK_TOGGLE_BUTTON (options->type_w[1])),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static FlipOptions *
@ -81,49 +65,47 @@ flip_options_new (void)
FlipOptions *options;
GtkWidget *vbox;
GSList *group = NULL;
GtkWidget *radio_box;
GtkWidget *frame;
/* the new flip tool options structure */
options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
tool_options_init ((ToolOptions *) options,
_("Flip Tool Options"),
flip_options_reset);
options->type_toggle[0].label = _("Horizontal");
options->type_toggle[0].value = FLIP_HORZ;
options->type_toggle[1].label = _("Vertical");
options->type_toggle[1].value = FLIP_VERT;
options->type_toggle[2].label = NULL;
options->type = options->type_d = FLIP_HORZ;
/* the main vbox */
vbox = options->tool_options.main_vbox;
radio_box = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0);
/* the radio buttons */
options->type_w[0] =
gtk_radio_button_new_with_label (group, _("Horizontal"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[0]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[0], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w[0]), "toggled",
(GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_HORZ)));
gtk_widget_show (options->type_w[0]);
options->type_w[1] = gtk_radio_button_new_with_label (group, _("Vertical"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[1]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[1], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w[1]), "toggled",
(GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_VERT)));
gtk_widget_show (options->type_w[1]);
gtk_widget_show (radio_box);
/* tool toggle */
frame = tool_options_radio_buttons_new (_("Tool Toggle"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
static void *
flip_tool_transform_horz (Tool *tool,
gpointer gdisp_ptr,
int state)
static void
flip_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_toggle[1].widget), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_toggle[0].widget), TRUE);
}
void *
flip_tool_transform (Tool *tool,
gpointer gdisp_ptr,
int state)
{
TransformCore * transform_core;
GDisplay *gdisp;
@ -145,73 +127,56 @@ flip_tool_transform_horz (Tool *tool,
case FINISH :
/* transform_core->trans_info[FLIP] *= -1.0;*/
return flip_tool_flip_horz (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP]);
return flip_tool_flip (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP],
flip_options->type);
break;
}
return NULL;
}
static void *
flip_tool_transform_vert (Tool *tool,
gpointer gdisp_ptr,
int state)
static void
flip_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
TransformCore * transform_core;
GDisplay *gdisp;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
transform_core = (TransformCore *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
switch (state)
{
case INIT :
transform_info = NULL;
break;
if (flip_options->type == FLIP_HORZ)
ctype = GDK_SB_H_DOUBLE_ARROW;
else
ctype = GDK_SB_V_DOUBLE_ARROW;
case MOTION :
break;
case RECALC :
break;
case FINISH :
/*transform_core->trans_info[FLIP] *= -1.0;*/
return flip_tool_flip_vert (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP]);
break;
}
return NULL;
gdisplay_install_tool_cursor (gdisp, ctype);
}
Tool *
tools_new_flip ()
{
Tool * tool;
TransformCore * private;
/* The tool options */
if (! flip_options)
{
flip_options = flip_options_new ();
tools_register (FLIP_HORZ, (ToolOptions *) flip_options);
tools_register (FLIP_VERT, (ToolOptions *) flip_options);
/* press all default buttons */
flip_options_reset ();
tools_register (FLIP, (ToolOptions *) flip_options);
}
switch (flip_options->type)
{
case FLIP_HORZ:
return tools_new_flip_horz ();
break;
case FLIP_VERT:
return tools_new_flip_vert ();
break;
default:
return NULL;
break;
}
tool = transform_core_new (FLIP, NON_INTERACTIVE);
private = tool->private;
private->trans_func = flip_tool_transform;
tool->toggle_key_func = flip_toggle_key_func;
tool->cursor_update_func = flip_cursor_update;
private->trans_info[FLIP_INFO] = -1.0;
return tool;
}
void
@ -220,45 +185,12 @@ tools_free_flip_tool (Tool *tool)
transform_core_free (tool);
}
static Tool *
tools_new_flip_horz ()
{
Tool * tool;
TransformCore * private;
tool = transform_core_new (FLIP_HORZ, NON_INTERACTIVE);
private = tool->private;
/* set the rotation specific transformation attributes */
private->trans_func = flip_tool_transform_horz;
private->trans_info[FLIP] = -1.0;
return tool;
}
static Tool *
tools_new_flip_vert ()
{
Tool * tool;
TransformCore * private;
tool = transform_core_new (FLIP_VERT, NON_INTERACTIVE);
private = tool->private;
/* set the rotation specific transformation attributes */
private->trans_func = flip_tool_transform_vert;
private->trans_info[FLIP] = -1.0;
return tool;
}
TileManager *
flip_tool_flip_horz (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip)
flip_tool_flip (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip,
FlipType type)
{
TileManager *new;
PixelRegion srcPR, destPR;
@ -283,67 +215,21 @@ flip_tool_flip_horz (GImage *gimage,
new->x = orig->x;
new->y = orig->y;
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
copy_region (&srcPR, &destPR);
}
if (type == FLIP_HORZ)
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
copy_region (&srcPR, &destPR);
}
else
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
copy_region (&srcPR, &destPR);
}
}
return new;
}
TileManager *
flip_tool_flip_vert (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip)
{
TileManager *new;
PixelRegion srcPR, destPR;
int i;
if (!orig)
return NULL;
if (flip > 0)
{
new = tile_manager_new (orig->width, orig->height, orig->bpp);
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
copy_region (&srcPR, &destPR);
new->x = orig->x;
new->y = orig->y;
}
else
{
new = tile_manager_new (orig->width, orig->height, orig->bpp);
new->x = orig->x;
new->y = orig->y;
for (i = 0; i < orig->height; i++)
{
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
copy_region (&srcPR, &destPR);
}
}
return new;
}
static void
flip_change_type (int new_type)
{
if (flip_options->type != new_type)
{
/* change the type, free the old tool, create the new tool */
flip_options->type = new_type;
tools_select (flip_options->type);
}
}

View file

@ -20,16 +20,20 @@
#include "tools.h"
typedef enum
{
FLIP_HORZ,
FLIP_VERT
} FlipType;
/* Flip tool functions */
void * flip_tool_transform (Tool *, gpointer, int);
TileManager * flip_tool_flip_horz (GimpImage *, GimpDrawable *,
TileManager *, int);
TileManager * flip_tool_flip_vert (GimpImage *, GimpDrawable *,
TileManager *, int);
TileManager * flip_tool_flip (GimpImage *, GimpDrawable *,
TileManager *, int, FlipType);
Tool * tools_new_flip (void);
void tools_free_flip_tool (Tool *);
#endif /* __FLIP_TOOL_H__ */

View file

@ -479,7 +479,7 @@ tools_new_free_select (void)
tool->button_press_func = free_select_button_press;
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->preserve = TRUE;

View file

@ -573,7 +573,7 @@ tools_new_fuzzy_select (void)
tool->button_press_func = fuzzy_select_button_press;
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;

View file

@ -1738,7 +1738,7 @@ tools_new_blend ()
tool->button_press_func = blend_button_press;
tool->button_release_func = blend_button_release;
tool->motion_func = blend_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;

View file

@ -189,7 +189,7 @@ tools_new_brightness_contrast ()
tool->button_press_func = brightness_contrast_button_press;
tool->button_release_func = brightness_contrast_button_release;
tool->motion_func = brightness_contrast_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;

View file

@ -60,7 +60,7 @@ struct _BucketOptions
BucketFillMode fill_mode;
BucketFillMode fill_mode_d;
GtkWidget *fill_mode_w[3]; /* 3 radio buttons */
ToolOptionsRadioButtons type_toggle[4];
};
@ -86,13 +86,6 @@ static void bucket_fill_line_pattern (unsigned char *, unsigned char *,
/* functions */
static void
bucket_fill_mode_callback (GtkWidget *widget,
gpointer client_data)
{
bucket_options->fill_mode = (BucketFillMode) client_data;
}
static void
bucket_options_reset (void)
{
@ -104,7 +97,7 @@ bucket_options_reset (void)
options->sample_merged_d);
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
options->threshold_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->fill_mode_d].widget), TRUE);
}
static BucketOptions *
@ -116,18 +109,8 @@ bucket_options_new (void)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *scale;
GSList *group = NULL;
GtkWidget *radio_frame;
GtkWidget *radio_box;
GtkWidget *radio_button;
GtkWidget *frame;
int i;
char *button_names[3] =
{
N_("FG Color Fill"),
N_("BG Color Fill"),
N_("Pattern Fill")
};
/* the new bucket fill tool options structure */
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
@ -136,6 +119,13 @@ bucket_options_new (void)
bucket_options_reset);
options->sample_merged = options->sample_merged_d = FALSE;
options->threshold = options->threshold_d = 15.0;
options->type_toggle[0].label = _("FG Color Fill");
options->type_toggle[0].value = FG_BUCKET_FILL;
options->type_toggle[1].label = _("BG Color Fill");
options->type_toggle[1].value = BG_BUCKET_FILL;
options->type_toggle[2].label = _("Pattern Fill");
options->type_toggle[2].value = PATTERN_BUCKET_FILL;
options->type_toggle[3].label = NULL;
options->fill_mode = options->fill_mode_d = FG_BUCKET_FILL;
/* the main vbox */
@ -172,30 +162,11 @@ bucket_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), options->sample_merged_w, FALSE, FALSE, 0);
gtk_widget_show (options->sample_merged_w);
/* the radio frame and box */
radio_frame = gtk_frame_new (_("Fill Type"));
gtk_box_pack_start (GTK_BOX (vbox), radio_frame, FALSE, FALSE, 0);
radio_box = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
/* the radio buttons */
for (i = 0; i < 3; i++)
{
radio_button =
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
(GtkSignalFunc) bucket_fill_mode_callback,
(gpointer) i);
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_widget_show (radio_button);
options->fill_mode_w[i] = radio_button;
}
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
/* fill type */
frame = tool_options_radio_buttons_new (_("Fill Type"), options->type_toggle, &options->fill_mode);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->fill_mode_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
@ -237,7 +208,6 @@ bucket_fill_button_release (Tool *tool,
{
GDisplay * gdisp;
BucketTool * bucket_tool;
BucketFillMode fill_mode;
Argument *return_vals;
int nreturn_vals;
@ -250,19 +220,10 @@ bucket_fill_button_release (Tool *tool,
/* if the 3rd button isn't pressed, fill the selected region */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
fill_mode = bucket_options->fill_mode;
/* If the mode is color filling, and shift mask is down,
* toggle FG/BG fill mode
*/
if ((bevent->state & GDK_SHIFT_MASK) && (fill_mode != PATTERN_BUCKET_FILL))
fill_mode =
(fill_mode == BG_BUCKET_FILL) ? FG_BUCKET_FILL : BG_BUCKET_FILL;
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
PDB_INT32, (gint32) fill_mode,
PDB_INT32, (gint32) bucket_options->fill_mode,
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (bucket_options),
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (bucket_options) * 100,
PDB_FLOAT, (gdouble) bucket_options->threshold,
@ -324,6 +285,23 @@ bucket_fill_cursor_update (Tool *tool,
gdisplay_install_tool_cursor (gdisp, ctype);
}
static void
bucket_fill_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[BG_BUCKET_FILL].widget), TRUE);
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[FG_BUCKET_FILL].widget), TRUE);
break;
default:
break;
}
}
static void
bucket_fill_control (Tool *tool,
@ -626,7 +604,8 @@ tools_new_bucket_fill (void)
tool->button_press_func = bucket_fill_button_press;
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->toggle_key_func = bucket_fill_toggle_key_func;
tool->cursor_update_func = bucket_fill_cursor_update;
tool->control_func = bucket_fill_control;
tool->preserve = TRUE;

View file

@ -481,7 +481,7 @@ tools_new_by_color_select ()
tool->button_press_func = by_color_select_button_press;
tool->button_release_func = by_color_select_button_release;
tool->motion_func = by_color_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = by_color_select_cursor_update;
tool->control_func = by_color_select_control;
tool->gdisp_ptr = NULL;

View file

@ -235,7 +235,7 @@ tools_new_color_balance ()
tool->button_press_func = color_balance_button_press;
tool->button_release_func = color_balance_button_release;
tool->motion_func = color_balance_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;

View file

@ -47,7 +47,7 @@ struct _ConvolveOptions
ConvolveType type;
ConvolveType type_d;
GtkWidget *type_w[2]; /* 2 radio buttons */
ToolOptionsRadioButtons type_toggle[3];
double pressure;
double pressure_d;
@ -102,12 +102,6 @@ static void convolve_motion (PaintCore *, GimpDrawable *);
/* functions */
static void
convolve_type_callback (GtkWidget *widget,
gpointer data)
{
convolve_options->type = (ConvolveType) data;
}
static void
convolve_options_reset (void)
@ -118,7 +112,7 @@ convolve_options_reset (void)
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->pressure_w),
options->pressure_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static ConvolveOptions *
@ -130,24 +124,23 @@ convolve_options_new (void)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *scale;
GSList *group = NULL;
GtkWidget *frame;
GtkWidget *radio_box;
GtkWidget *radio_button;
int i;
char *button_names[3] =
{
N_("Blur"),
N_("Sharpen"),
N_("Custom")
};
/* the new convolve tool options structure */
options = (ConvolveOptions *) g_malloc (sizeof (ConvolveOptions));
paint_options_init ((PaintOptions *) options,
CONVOLVE,
convolve_options_reset);
options->type_toggle[0].label = _("Blur");
options->type_toggle[0].value = BLUR_CONVOLVE;
options->type_toggle[1].label = _("Sharpen");
options->type_toggle[1].value = SHARPEN_CONVOLVE;
options->type_toggle[2].label = NULL;
/*
options->type_toggle[2].label = N_("Sharpen");
options->type_toggle[2].value = CUSTOM_CONVOLVE;
options->type_toggle[3].label = NULL;
*/
options->type = options->type_d = BLUR_CONVOLVE;
options->pressure = options->pressure_d = 50.0;
@ -175,30 +168,11 @@ convolve_options_new (void)
gtk_widget_show (scale);
gtk_widget_show (hbox);
frame = gtk_frame_new (_("Convolve Type"));
frame = tool_options_radio_buttons_new (_("Convolve Type"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
radio_box = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
gtk_container_add (GTK_CONTAINER (frame), radio_box);
/* the radio buttons */
for (i = 0; i < 2; i++)
{
radio_button =
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
(GtkSignalFunc) convolve_type_callback,
(gpointer) ((long) i));
gtk_widget_show (radio_button);
options->type_w[i] = radio_button;
}
gtk_widget_show (radio_box);
return options;
}
@ -217,6 +191,25 @@ convolve_paint_func (PaintCore *paint_core,
return NULL;
}
static void
convolve_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (convolve_options->type)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[SHARPEN_CONVOLVE].widget), TRUE);
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[BLUR_CONVOLVE].widget), TRUE);
break;
default:
break;
}
}
Tool *
tools_new_convolve ()
{
@ -234,6 +227,7 @@ tools_new_convolve ()
}
tool = paint_core_new (CONVOLVE);
tool->toggle_key_func = convolve_toggle_key_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View file

@ -42,6 +42,7 @@
#define CROPPING 4
#define REFRAMING 5
/* speed of key movement */
#define ARROW_VELOCITY 25
@ -79,15 +80,16 @@ struct _CropOptions
int layer_only_d;
GtkWidget *layer_only_w;
int default_to_enlarge;
int default_to_enlarge_d;
GtkWidget *default_to_enlarge_w;
int allow_enlarge;
int allow_enlarge_d;
GtkWidget *allow_enlarge_w;
int default_to_crop;
int default_to_crop_d;
GtkWidget *default_to_crop_w;
CropType type;
CropType type_d;
ToolOptionsRadioButtons type_toggle[3];
};
/* the crop tool options */
static CropOptions *crop_options = NULL;
@ -101,13 +103,14 @@ static GtkWidget *origin_sizeentry;
static GtkWidget *size_sizeentry;
/* Crop action functions */
/* Crop type functions */
static void crop_button_press (Tool *, GdkEventButton *, gpointer);
static void crop_button_release (Tool *, GdkEventButton *, gpointer);
static void crop_motion (Tool *, GdkEventMotion *, gpointer);
static void crop_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void crop_control (Tool *, int, gpointer);
static void crop_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
static void crop_toggle_key_func (Tool *, GdkEventKey *, gpointer);
/* Crop helper functions */
static void crop_recalc (Tool *, Crop *);
@ -151,29 +154,31 @@ crop_options_reset (void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->layer_only_w),
options->layer_only_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->default_to_enlarge_w),
options->default_to_enlarge_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->default_to_crop_w),
options->default_to_crop_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->allow_enlarge_w),
options->allow_enlarge_d);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static CropOptions *
crop_options_new (void)
{
CropOptions *options;
GtkWidget *vbox;
GtkWidget *defaults_frame;
GtkWidget *defaults_vbox;
GtkWidget *frame;
/* the new crop tool options structure */
options = (CropOptions *) g_malloc (sizeof (CropOptions));
tool_options_init ((ToolOptions *) options,
_("Crop & Resize Options"),
crop_options_reset);
options->layer_only = options->layer_only_d = FALSE;
options->default_to_enlarge = options->default_to_enlarge_d = TRUE;
options->default_to_crop = options->default_to_crop_d = FALSE;
options->layer_only = options->layer_only_d = FALSE;
options->allow_enlarge = options->allow_enlarge_d = TRUE;
options->type_toggle[0].label = _("Crop");
options->type_toggle[0].value = CROP_CROP;
options->type_toggle[1].label = _("Resize");
options->type_toggle[1].value = RESIZE_CROP;
options->type_toggle[2].label = NULL;
options->type = options->type_d = CROP_CROP;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -190,40 +195,22 @@ crop_options_new (void)
options->layer_only_d);
gtk_widget_show (options->layer_only_w);
/* defaults */
defaults_frame = gtk_frame_new (_("Defaults"));
gtk_box_pack_start (GTK_BOX (vbox), defaults_frame, FALSE, FALSE, 0);
defaults_vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (defaults_vbox), 2);
gtk_container_add (GTK_CONTAINER (defaults_frame), defaults_vbox);
/* enlarge toggle */
options->default_to_enlarge_w =
gtk_check_button_new_with_label (_("Allow Enlarging"));
gtk_box_pack_start (GTK_BOX (defaults_vbox), options->default_to_enlarge_w,
options->allow_enlarge_w = gtk_check_button_new_with_label (_("Allow Enlarging"));
gtk_box_pack_start (GTK_BOX (vbox), options->allow_enlarge_w,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->default_to_enlarge_w), "toggled",
gtk_signal_connect (GTK_OBJECT (options->allow_enlarge_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->default_to_enlarge);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(options->default_to_enlarge_w),
options->default_to_enlarge_d);
gtk_widget_show (options->default_to_enlarge_w);
&options->allow_enlarge);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_enlarge_w),
options->allow_enlarge_d);
gtk_widget_show (options->allow_enlarge_w);
/* crop toggle */
options->default_to_crop_w =
gtk_check_button_new_with_label(_("Crop Layers"));
gtk_box_pack_start (GTK_BOX (defaults_vbox), options->default_to_crop_w,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->default_to_crop_w), "toggled",
(GtkSignalFunc) tool_options_toggle_update,
&options->default_to_crop);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->default_to_crop_w),
options->default_to_crop_d);
gtk_widget_show (options->default_to_crop_w);
gtk_widget_show (defaults_vbox);
gtk_widget_show (defaults_frame);
/* tool toggle */
frame = tool_options_radio_buttons_new (_("Tool Toggle"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
@ -267,21 +254,11 @@ crop_button_press (Tool *tool,
else if (bevent->x > crop->x1 && bevent->x < crop->x2 &&
bevent->y > crop->y1 && bevent->y < crop->y2)
{
if ( crop_options->default_to_crop )
{
if ( bevent->state & GDK_SHIFT_MASK )
crop->function = REFRAMING;
else
crop->function = CROPPING;
}
else
{
if ( bevent->state & GDK_SHIFT_MASK )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
}
if ( crop_options->type == CROP_CROP )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
/* otherwise, the new function will be creating, since we want to start anew */
else
crop->function = CREATING;
@ -439,7 +416,7 @@ crop_motion (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->default_to_enlarge)
if (crop_options->allow_enlarge)
{
if (mevent->state & GDK_MOD1_MASK)
clamp = TRUE;
@ -570,15 +547,12 @@ crop_cursor_update (Tool *tool,
gpointer gdisp_ptr)
{
GDisplay *gdisp;
int x, y;
GdkCursorType ctype;
Crop * crop;
gdisp = (GDisplay *) gdisp_ptr;
crop = (Crop *) tool->private;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, FALSE, FALSE);
if (tool->state == INACTIVE ||
(tool->state == ACTIVE && tool->gdisp_ptr != gdisp_ptr))
ctype = GDK_CROSS;
@ -597,20 +571,10 @@ crop_cursor_update (Tool *tool,
else if (mevent->x > crop->x1 && mevent->x < crop->x2 &&
mevent->y > crop->y1 && mevent->y < crop->y2)
{
if ( crop_options->default_to_crop )
{
if ( mevent->state & GDK_SHIFT_MASK )
ctype = GDK_SIZING;
else
ctype = GDK_ICON;
}
if ( crop_options->type == CROP_CROP )
ctype = GDK_ICON;
else
{
if ( mevent->state & GDK_SHIFT_MASK )
ctype = GDK_ICON;
else
ctype = GDK_SIZING;
}
ctype = GDK_SIZING;
}
else
ctype = GDK_CROSS;
@ -655,7 +619,7 @@ crop_arrow_keys_func (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->default_to_enlarge)
if (crop_options->allow_enlarge)
{
if (kevent->state & GDK_MOD1_MASK)
clamp = TRUE;
@ -714,6 +678,24 @@ crop_arrow_keys_func (Tool *tool,
}
}
static void
crop_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
GDisplay * gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if (tool->state == ACTIVE && tool->gdisp_ptr == gdisp_ptr)
{
if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_toggle[RESIZE_CROP].widget), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_toggle[CROP_CROP].widget), TRUE);
}
}
static void
crop_control (Tool *tool,
int action,
@ -805,6 +787,7 @@ tools_new_crop ()
tool->button_release_func = crop_button_release;
tool->motion_func = crop_motion;
tool->arrow_keys_func = crop_arrow_keys_func;
tool->toggle_key_func = crop_toggle_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */
@ -1156,8 +1139,10 @@ static void
crop_info_update (Tool *tool)
{
Crop * crop;
GDisplay * gdisp;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
orig_vals[0] = crop->tx1;
orig_vals[1] = crop->ty1;

View file

@ -21,6 +21,13 @@
#include "gimpimageF.h"
#include "tools.h"
typedef enum
{
CROP_CROP,
RESIZE_CROP
} CropType;
/* select functions */
void crop_draw (Tool *);
void crop_image (GimpImage *gimage, int, int, int, int, int, int);

View file

@ -340,7 +340,7 @@ tools_new_curves ()
tool->button_press_func = curves_button_press;
tool->button_release_func = curves_button_release;
tool->motion_func = curves_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;

View file

@ -137,7 +137,7 @@ tools_new_ellipse_select (void)
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;

View file

@ -22,7 +22,9 @@
#include "flip_tool.h"
#include "gdisplay.h"
#include "temp_buf.h"
#include "tool_options_ui.h"
#include "transform_core.h"
#include "undo.h"
#include "gimage.h"
@ -30,7 +32,7 @@
#include "tile_manager_pvt.h" /* ick. */
#define FLIP 0
#define FLIP_INFO 0
/* the flip structures */
@ -41,38 +43,20 @@ struct _FlipOptions
ToolType type;
ToolType type_d;
GtkWidget *type_w[2]; /* 2 radio buttons */
ToolOptionsRadioButtons type_toggle[3];
};
/* the flip tool options */
static FlipOptions *flip_options = NULL;
/* forward function declarations */
static Tool * tools_new_flip_horz (void);
static Tool * tools_new_flip_vert (void);
static void flip_change_type (int);
/* functions */
static void
flip_type_callback (GtkWidget *widget,
gpointer client_data)
{
flip_change_type ((long) client_data);
}
static void
flip_options_reset (void)
{
FlipOptions *options = flip_options;
gtk_toggle_button_set_active (((options->type_d == FLIP_HORZ) ?
GTK_TOGGLE_BUTTON (options->type_w[0]) :
GTK_TOGGLE_BUTTON (options->type_w[1])),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
}
static FlipOptions *
@ -81,49 +65,47 @@ flip_options_new (void)
FlipOptions *options;
GtkWidget *vbox;
GSList *group = NULL;
GtkWidget *radio_box;
GtkWidget *frame;
/* the new flip tool options structure */
options = (FlipOptions *) g_malloc (sizeof (FlipOptions));
tool_options_init ((ToolOptions *) options,
_("Flip Tool Options"),
flip_options_reset);
options->type_toggle[0].label = _("Horizontal");
options->type_toggle[0].value = FLIP_HORZ;
options->type_toggle[1].label = _("Vertical");
options->type_toggle[1].value = FLIP_VERT;
options->type_toggle[2].label = NULL;
options->type = options->type_d = FLIP_HORZ;
/* the main vbox */
vbox = options->tool_options.main_vbox;
radio_box = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), radio_box, FALSE, FALSE, 0);
/* the radio buttons */
options->type_w[0] =
gtk_radio_button_new_with_label (group, _("Horizontal"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[0]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[0], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w[0]), "toggled",
(GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_HORZ)));
gtk_widget_show (options->type_w[0]);
options->type_w[1] = gtk_radio_button_new_with_label (group, _("Vertical"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (options->type_w[1]));
gtk_box_pack_start (GTK_BOX (radio_box), options->type_w[1], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (options->type_w[1]), "toggled",
(GtkSignalFunc) flip_type_callback,
(gpointer) ((long) (FLIP_VERT)));
gtk_widget_show (options->type_w[1]);
gtk_widget_show (radio_box);
/* tool toggle */
frame = tool_options_radio_buttons_new (_("Tool Toggle"), options->type_toggle, &options->type);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
static void *
flip_tool_transform_horz (Tool *tool,
gpointer gdisp_ptr,
int state)
static void
flip_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_toggle[1].widget), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_toggle[0].widget), TRUE);
}
void *
flip_tool_transform (Tool *tool,
gpointer gdisp_ptr,
int state)
{
TransformCore * transform_core;
GDisplay *gdisp;
@ -145,73 +127,56 @@ flip_tool_transform_horz (Tool *tool,
case FINISH :
/* transform_core->trans_info[FLIP] *= -1.0;*/
return flip_tool_flip_horz (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP]);
return flip_tool_flip (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP],
flip_options->type);
break;
}
return NULL;
}
static void *
flip_tool_transform_vert (Tool *tool,
gpointer gdisp_ptr,
int state)
static void
flip_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
{
TransformCore * transform_core;
GDisplay *gdisp;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
transform_core = (TransformCore *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
switch (state)
{
case INIT :
transform_info = NULL;
break;
if (flip_options->type == FLIP_HORZ)
ctype = GDK_SB_H_DOUBLE_ARROW;
else
ctype = GDK_SB_V_DOUBLE_ARROW;
case MOTION :
break;
case RECALC :
break;
case FINISH :
/*transform_core->trans_info[FLIP] *= -1.0;*/
return flip_tool_flip_vert (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
transform_core->original, transform_core->trans_info[FLIP]);
break;
}
return NULL;
gdisplay_install_tool_cursor (gdisp, ctype);
}
Tool *
tools_new_flip ()
{
Tool * tool;
TransformCore * private;
/* The tool options */
if (! flip_options)
{
flip_options = flip_options_new ();
tools_register (FLIP_HORZ, (ToolOptions *) flip_options);
tools_register (FLIP_VERT, (ToolOptions *) flip_options);
/* press all default buttons */
flip_options_reset ();
tools_register (FLIP, (ToolOptions *) flip_options);
}
switch (flip_options->type)
{
case FLIP_HORZ:
return tools_new_flip_horz ();
break;
case FLIP_VERT:
return tools_new_flip_vert ();
break;
default:
return NULL;
break;
}
tool = transform_core_new (FLIP, NON_INTERACTIVE);
private = tool->private;
private->trans_func = flip_tool_transform;
tool->toggle_key_func = flip_toggle_key_func;
tool->cursor_update_func = flip_cursor_update;
private->trans_info[FLIP_INFO] = -1.0;
return tool;
}
void
@ -220,45 +185,12 @@ tools_free_flip_tool (Tool *tool)
transform_core_free (tool);
}
static Tool *
tools_new_flip_horz ()
{
Tool * tool;
TransformCore * private;
tool = transform_core_new (FLIP_HORZ, NON_INTERACTIVE);
private = tool->private;
/* set the rotation specific transformation attributes */
private->trans_func = flip_tool_transform_horz;
private->trans_info[FLIP] = -1.0;
return tool;
}
static Tool *
tools_new_flip_vert ()
{
Tool * tool;
TransformCore * private;
tool = transform_core_new (FLIP_VERT, NON_INTERACTIVE);
private = tool->private;
/* set the rotation specific transformation attributes */
private->trans_func = flip_tool_transform_vert;
private->trans_info[FLIP] = -1.0;
return tool;
}
TileManager *
flip_tool_flip_horz (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip)
flip_tool_flip (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip,
FlipType type)
{
TileManager *new;
PixelRegion srcPR, destPR;
@ -283,67 +215,21 @@ flip_tool_flip_horz (GImage *gimage,
new->x = orig->x;
new->y = orig->y;
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
copy_region (&srcPR, &destPR);
}
if (type == FLIP_HORZ)
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
copy_region (&srcPR, &destPR);
}
else
for (i = 0; i < orig->width; i++)
{
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
copy_region (&srcPR, &destPR);
}
}
return new;
}
TileManager *
flip_tool_flip_vert (GImage *gimage,
GimpDrawable *drawable,
TileManager *orig,
int flip)
{
TileManager *new;
PixelRegion srcPR, destPR;
int i;
if (!orig)
return NULL;
if (flip > 0)
{
new = tile_manager_new (orig->width, orig->height, orig->bpp);
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
copy_region (&srcPR, &destPR);
new->x = orig->x;
new->y = orig->y;
}
else
{
new = tile_manager_new (orig->width, orig->height, orig->bpp);
new->x = orig->x;
new->y = orig->y;
for (i = 0; i < orig->height; i++)
{
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
copy_region (&srcPR, &destPR);
}
}
return new;
}
static void
flip_change_type (int new_type)
{
if (flip_options->type != new_type)
{
/* change the type, free the old tool, create the new tool */
flip_options->type = new_type;
tools_select (flip_options->type);
}
}

View file

@ -20,16 +20,20 @@
#include "tools.h"
typedef enum
{
FLIP_HORZ,
FLIP_VERT
} FlipType;
/* Flip tool functions */
void * flip_tool_transform (Tool *, gpointer, int);
TileManager * flip_tool_flip_horz (GimpImage *, GimpDrawable *,
TileManager *, int);
TileManager * flip_tool_flip_vert (GimpImage *, GimpDrawable *,
TileManager *, int);
TileManager * flip_tool_flip (GimpImage *, GimpDrawable *,
TileManager *, int, FlipType);
Tool * tools_new_flip (void);
void tools_free_flip_tool (Tool *);
#endif /* __FLIP_TOOL_H__ */

View file

@ -479,7 +479,7 @@ tools_new_free_select (void)
tool->button_press_func = free_select_button_press;
tool->button_release_func = free_select_button_release;
tool->motion_func = free_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = free_select_control;
tool->preserve = TRUE;

View file

@ -573,7 +573,7 @@ tools_new_fuzzy_select (void)
tool->button_press_func = fuzzy_select_button_press;
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;

View file

@ -220,7 +220,7 @@ tools_new_histogram_tool ()
tool->button_press_func = histogram_tool_button_press;
tool->button_release_func = histogram_tool_button_release;
tool->motion_func = histogram_tool_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
tool->preserve = FALSE;

View file

@ -314,7 +314,7 @@ tools_new_hue_saturation ()
tool->button_press_func = hue_saturation_button_press;
tool->button_release_func = hue_saturation_button_release;
tool->motion_func = hue_saturation_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
tool->preserve = FALSE;

View file

@ -1564,7 +1564,7 @@ tools_new_ink ()
tool->button_press_func = ink_button_press;
tool->button_release_func = ink_button_release;
tool->motion_func = ink_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;

View file

@ -436,7 +436,7 @@ tools_new_iscissors ()
tool->button_press_func = iscissors_button_press;
tool->button_release_func = iscissors_button_release;
tool->motion_func = iscissors_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
tool->auto_snap_to = 0;

View file

@ -252,7 +252,7 @@ tools_new_levels ()
tool->button_press_func = levels_button_press;
tool->button_release_func = levels_button_release;
tool->motion_func = levels_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = levels_cursor_update;
tool->control_func = levels_control;
tool->preserve = FALSE;

View file

@ -370,7 +370,7 @@ tools_new_magnify (void)
tool->button_press_func = magnify_button_press;
tool->button_release_func = magnify_button_release;
tool->motion_func = magnify_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;

View file

@ -452,6 +452,7 @@ tools_new_move_tool ()
tool->button_release_func = move_tool_button_release;
tool->motion_func = move_tool_motion;
tool->arrow_keys_func = edit_sel_arrow_keys_func;
tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->preserve = TRUE;

View file

@ -185,7 +185,7 @@ tools_new_posterize ()
tool->button_press_func = posterize_button_press;
tool->button_release_func = posterize_button_release;
tool->motion_func = posterize_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = posterize_cursor_update;
tool->control_func = posterize_control;
tool->preserve = FALSE;

View file

@ -538,7 +538,7 @@ tools_new_rect_select ()
tool->button_press_func = rect_select_button_press;
tool->button_release_func = rect_select_button_release;
tool->motion_func = rect_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;

View file

@ -573,7 +573,7 @@ tools_new_fuzzy_select (void)
tool->button_press_func = fuzzy_select_button_press;
tool->button_release_func = fuzzy_select_button_release;
tool->motion_func = fuzzy_select_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = fuzzy_select_control;

View file

@ -244,7 +244,7 @@ tools_new_text ()
tool->button_press_func = text_button_press;
tool->button_release_func = text_button_release;
tool->motion_func = text_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = text_cursor_update;
tool->control_func = text_control;
tool->preserve = TRUE;

View file

@ -253,7 +253,7 @@ tools_new_threshold ()
tool->button_press_func = threshold_button_press;
tool->button_release_func = threshold_button_release;
tool->motion_func = threshold_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
tool->preserve = FALSE;

View file

@ -220,7 +220,7 @@ tools_new_histogram_tool ()
tool->button_press_func = histogram_tool_button_press;
tool->button_release_func = histogram_tool_button_release;
tool->motion_func = histogram_tool_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = histogram_tool_cursor_update;
tool->control_func = histogram_tool_control;
tool->preserve = FALSE;

View file

@ -314,7 +314,7 @@ tools_new_hue_saturation ()
tool->button_press_func = hue_saturation_button_press;
tool->button_release_func = hue_saturation_button_release;
tool->motion_func = hue_saturation_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = hue_saturation_cursor_update;
tool->control_func = hue_saturation_control;
tool->preserve = FALSE;

View file

@ -1564,7 +1564,7 @@ tools_new_ink ()
tool->button_press_func = ink_button_press;
tool->button_release_func = ink_button_release;
tool->motion_func = ink_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;

View file

@ -436,7 +436,7 @@ tools_new_iscissors ()
tool->button_press_func = iscissors_button_press;
tool->button_release_func = iscissors_button_release;
tool->motion_func = iscissors_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = iscissors_control;
tool->auto_snap_to = 0;

Some files were not shown because too many files have changed in this diff Show more