Commit 8b46a4f9 authored by Sven Neumann's avatar Sven Neumann

Toggable tools!

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


--Sven
parent bd74c628
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:
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 ***************************************************/
......
......@@ -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);
/* 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);
&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);
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,