Moved from toggle_key_func to modifier_key_func.

--Sven
This commit is contained in:
Sven Neumann 1999-04-27 21:06:00 +00:00
parent 0355c5aa10
commit d342563d60
101 changed files with 611 additions and 562 deletions

View File

@ -1,3 +1,23 @@
Tue Apr 27 22:59:08 MEST 1999 Sven Neumann <sven@gimp.org>
* tool_options.c
* tool_options_ui.h: redid the tool_options_radio_buttons_new
function I introduced yesterday
* tools.c
* tools.h
* toolsF.h: decided that it makes more sense to have a
modifier_key_func instead of a toggle_key_func. That way we can
catch all modifiers. Now if someone knows how to handle non-GDK
cursors, please implement context-cursors for the selection tools.
* bucket_fill.c
* convolve.c
* crop.c
* flip_tool.c: adapted to use the new modifier_key_func
* all other tools: changed to use standard_modifier_key_func
Tue Apr 27 20:58:14 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen)
* app/tile_swap.c (tile_swap_exit1): close swap file before unlink.

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "brush_select.h"
#include "bucket_fill.h"
@ -60,7 +61,7 @@ struct _BucketOptions
BucketFillMode fill_mode;
BucketFillMode fill_mode_d;
ToolOptionsRadioButtons type_toggle[4];
GtkWidget *fill_mode_w[3];
};
@ -97,7 +98,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->type_toggle[options->fill_mode_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
}
static BucketOptions *
@ -110,7 +111,12 @@ bucket_options_new (void)
GtkWidget *label;
GtkWidget *scale;
GtkWidget *frame;
gchar* fill_mode_label[3] = { _("FG Color Fill"),
_("BG Color Fill"),
_("Pattern Fill") };
gint fill_mode_value[3] = { FG_BUCKET_FILL,
BG_BUCKET_FILL,
PATTERN_BUCKET_FILL };
/* the new bucket fill tool options structure */
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
@ -119,13 +125,6 @@ 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 */
@ -163,8 +162,13 @@ bucket_options_new (void)
gtk_widget_show (options->sample_merged_w);
/* 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);
frame = tool_options_radio_buttons_new (_("Fill Type"),
&options->fill_mode,
options->fill_mode_w,
fill_mode_label,
fill_mode_value,
3);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -286,19 +290,28 @@ bucket_fill_cursor_update (Tool *tool,
}
static void
bucket_fill_toggle_key_func (Tool *tool,
bucket_fill_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (bucket_options->fill_mode)
switch (kevent->keyval)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[BG_BUCKET_FILL].widget), TRUE);
case GDK_Alt_L: case GDK_Alt_R:
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[FG_BUCKET_FILL].widget), TRUE);
case GDK_Shift_L: case GDK_Shift_R:
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->fill_mode_w[BG_BUCKET_FILL]), TRUE);
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->fill_mode_w[FG_BUCKET_FILL]), TRUE);
break;
default:
break;
}
break;
default:
case GDK_Control_L: case GDK_Control_R:
break;
}
}
@ -605,7 +618,7 @@ tools_new_bucket_fill (void)
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->toggle_key_func = bucket_fill_toggle_key_func;
tool->modifier_key_func = bucket_fill_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
tool->preserve = TRUE;

View File

@ -17,6 +17,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "drawable.h"
#include "errors.h"
@ -47,7 +48,7 @@ struct _ConvolveOptions
ConvolveType type;
ConvolveType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
double pressure;
double pressure_d;
@ -112,7 +113,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_toggle[options->type_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static ConvolveOptions *
@ -125,22 +126,14 @@ convolve_options_new (void)
GtkWidget *label;
GtkWidget *scale;
GtkWidget *frame;
gchar* type_label[2] = { _("Blur"), _("Sharpen") };
gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE };
/* 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;
@ -168,8 +161,13 @@ convolve_options_new (void)
gtk_widget_show (scale);
gtk_widget_show (hbox);
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);
frame = tool_options_radio_buttons_new (_("Convolve Type"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -192,24 +190,32 @@ convolve_paint_func (PaintCore *paint_core,
}
static void
convolve_toggle_key_func (Tool *tool,
convolve_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (convolve_options->type)
switch (kevent->keyval)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[SHARPEN_CONVOLVE].widget), TRUE);
case GDK_Alt_L: case GDK_Alt_R:
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[BLUR_CONVOLVE].widget), TRUE);
break;
default:
case GDK_Shift_L: case GDK_Shift_R:
switch (convolve_options->type)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_w[SHARPEN_CONVOLVE]), TRUE);
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_w[BLUR_CONVOLVE]), TRUE);
break;
default:
break;
}
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
Tool *
tools_new_convolve ()
{
@ -227,7 +233,7 @@ tools_new_convolve ()
}
tool = paint_core_new (CONVOLVE);
tool->toggle_key_func = convolve_toggle_key_func;
tool->modifier_key_func = convolve_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = blend_cursor_update;
tool->control_func = blend_control;
tool->preserve = TRUE;

View File

@ -147,13 +147,17 @@ tool_options_radio_buttons_update (GtkWidget *widget,
}
GtkWidget*
tool_options_radio_buttons_new (gchar* label,
ToolOptionsRadioButtons* radio_buttons,
gpointer toggle_val)
tool_options_radio_buttons_new (gchar* label,
gpointer toggle_val,
GtkWidget* button_widget[],
gchar* button_label[],
gint button_value[],
gint num)
{
GtkWidget *frame;
GtkWidget *vbox;
GSList *group = NULL;
gint i;
frame = gtk_frame_new (label);
@ -163,20 +167,18 @@ tool_options_radio_buttons_new (gchar* label,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
while (radio_buttons->label != NULL)
for (i=0; i<num; i++)
{
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",
button_widget[i] = gtk_radio_button_new_with_label (group,
button_label[i]);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button_widget[i]));
gtk_box_pack_start (GTK_BOX (vbox), button_widget[i], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button_widget[i]), "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_object_set_data (GTK_OBJECT (button_widget[i]), "toggle_value",
(gpointer)button_value[i]);
gtk_widget_show (button_widget[i]);
}
gtk_widget_show (vbox);

View File

@ -86,7 +86,7 @@ struct _CropOptions
CropType type;
CropType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
};
@ -110,7 +110,7 @@ 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);
static void crop_modifier_key_func (Tool *, GdkEventKey *, gpointer);
/* Crop helper functions */
static void crop_recalc (Tool *, Crop *);
@ -156,7 +156,7 @@ crop_options_reset (void)
options->layer_only_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);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static CropOptions *
@ -165,7 +165,9 @@ crop_options_new (void)
CropOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
gchar* type_label[2] = { _("Crop"), _("Resize") };
gint type_value[2] = { CROP_CROP, RESIZE_CROP };
/* the new crop tool options structure */
options = (CropOptions *) g_malloc (sizeof (CropOptions));
tool_options_init ((ToolOptions *) options,
@ -173,12 +175,7 @@ crop_options_new (void)
crop_options_reset);
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;
options->type = options->type_d = CROP_CROP;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -207,8 +204,13 @@ crop_options_new (void)
gtk_widget_show (options->allow_enlarge_w);
/* 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);
frame = tool_options_radio_buttons_new (_("Tool Toggle"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -390,7 +392,6 @@ crop_motion (Tool *tool,
int curx, cury;
int inc_x, inc_y;
gchar size[STATUSBAR_SIZE];
int clamp;
int min_x, min_y, max_x, max_y;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
@ -414,22 +415,6 @@ crop_motion (Tool *tool,
return;
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->allow_enlarge)
{
if (mevent->state & GDK_MOD1_MASK)
clamp = TRUE;
else
clamp = FALSE;
}
else
{
if (mevent->state & GDK_MOD1_MASK)
clamp = FALSE;
else
clamp = TRUE;
}
if (crop_options->layer_only)
{
@ -448,7 +433,7 @@ crop_motion (Tool *tool,
switch (crop->function)
{
case CREATING :
if (clamp)
if (!crop_options->allow_enlarge)
{
x1 = BOUNDS (x1, min_x, max_x);
y1 = BOUNDS (y1, min_y, max_y);
@ -460,7 +445,7 @@ crop_motion (Tool *tool,
case RESIZING_LEFT :
x1 = crop->tx1 + inc_x;
y1 = crop->ty1 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
x1 = BOUNDS (x1, min_x, max_x);
y1 = BOUNDS (y1, min_y, max_y);
@ -474,7 +459,7 @@ crop_motion (Tool *tool,
case RESIZING_RIGHT :
x2 = crop->tx2 + inc_x;
y2 = crop->ty2 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
x2 = BOUNDS (x2, min_x, max_x);
y2 = BOUNDS (y2, min_y, max_y);
@ -486,7 +471,7 @@ crop_motion (Tool *tool,
break;
case MOVING :
if (clamp)
if (!crop_options->allow_enlarge)
{
inc_x = BOUNDS (inc_x, min_x - crop->tx1, max_x - crop->tx2);
inc_y = BOUNDS (inc_y, min_y - crop->ty1, max_y - crop->ty2);
@ -591,7 +576,6 @@ crop_arrow_keys_func (Tool *tool,
GDisplay * gdisp;
Layer * layer;
Crop * crop;
int clamp;
int min_x, min_y, max_x, max_y;
gdisp = (GDisplay *) gdisp_ptr;
@ -618,22 +602,6 @@ crop_arrow_keys_func (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->allow_enlarge)
{
if (kevent->state & GDK_MOD1_MASK)
clamp = TRUE;
else
clamp = FALSE;
}
else
{
if (kevent->state & GDK_MOD1_MASK)
clamp = FALSE;
else
clamp = TRUE;
}
if (crop_options->layer_only)
{
layer = (gdisp->gimage)->active_layer;
@ -652,7 +620,7 @@ crop_arrow_keys_func (Tool *tool,
{
crop->tx2 = crop->tx2 + inc_x;
crop->ty2 = crop->ty2 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
crop->tx2 = BOUNDS (crop->tx2, min_x, max_x);
crop->ty2 = BOUNDS (crop->ty2, min_y, max_y);
@ -662,7 +630,7 @@ crop_arrow_keys_func (Tool *tool,
}
else
{
if (clamp)
if (!crop_options->allow_enlarge)
{
inc_x = BOUNDS (inc_x, -crop->tx1, gdisp->gimage->width - crop->tx2);
inc_y = BOUNDS (inc_y, -crop->ty1, gdisp->gimage->height - crop->ty2);
@ -679,20 +647,30 @@ crop_arrow_keys_func (Tool *tool,
}
static void
crop_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
crop_modifier_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);
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge);
break;
case GDK_Shift_L: case GDK_Shift_R:
if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
}
@ -787,7 +765,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->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = curves_cursor_update;
tool->control_func = curves_control;
tool->preserve = TRUE;

View File

@ -385,20 +385,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* Update the state based on modifiers being pressed */
case GDK_Alt_L: case GDK_Alt_R:
state |= GDK_MOD1_MASK;
break;
case GDK_Shift_L: case GDK_Shift_R:
state |= GDK_SHIFT_MASK;
case GDK_Control_L: case GDK_Control_R:
state |= GDK_CONTROL_MASK;
/* For all modifier keys: call the tools modifier_key_func */
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
(* active_tool->modifier_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;
break;
}
/* We need this here in case of accelerators */
@ -413,20 +412,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
case GDK_Alt_L: case GDK_Alt_R:
state &= ~GDK_MOD1_MASK;
break;
case GDK_Shift_L: case GDK_Shift_R:
kevent->state &= ~GDK_SHIFT_MASK;
case GDK_Control_L: case GDK_Control_R:
kevent->state &= ~GDK_CONTROL_MASK;
/* For all modifier keys: call the tools modifier_key_func */
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
(* active_tool->modifier_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;
break;
}
return_val = TRUE;

View File

@ -385,20 +385,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* Update the state based on modifiers being pressed */
case GDK_Alt_L: case GDK_Alt_R:
state |= GDK_MOD1_MASK;
break;
case GDK_Shift_L: case GDK_Shift_R:
state |= GDK_SHIFT_MASK;
case GDK_Control_L: case GDK_Control_R:
state |= GDK_CONTROL_MASK;
/* For all modifier keys: call the tools modifier_key_func */
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
(* active_tool->modifier_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;
break;
}
/* We need this here in case of accelerators */
@ -413,20 +412,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
case GDK_Alt_L: case GDK_Alt_R:
state &= ~GDK_MOD1_MASK;
break;
case GDK_Shift_L: case GDK_Shift_R:
kevent->state &= ~GDK_SHIFT_MASK;
case GDK_Control_L: case GDK_Control_R:
kevent->state &= ~GDK_CONTROL_MASK;
/* For all modifier keys: call the tools modifier_key_func */
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
(* active_tool->modifier_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;
break;
}
return_val = TRUE;

View File

@ -385,20 +385,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* Update the state based on modifiers being pressed */
case GDK_Alt_L: case GDK_Alt_R:
state |= GDK_MOD1_MASK;
break;
case GDK_Shift_L: case GDK_Shift_R:
state |= GDK_SHIFT_MASK;
case GDK_Control_L: case GDK_Control_R:
state |= GDK_CONTROL_MASK;
/* For all modifier keys: call the tools modifier_key_func */
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
(* active_tool->modifier_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;
break;
}
/* We need this here in case of accelerators */
@ -413,20 +412,19 @@ gdisplay_canvas_events (GtkWidget *canvas,
{
case GDK_Alt_L: case GDK_Alt_R:
state &= ~GDK_MOD1_MASK;
break;
case GDK_Shift_L: case GDK_Shift_R:
kevent->state &= ~GDK_SHIFT_MASK;
case GDK_Control_L: case GDK_Control_R:
kevent->state &= ~GDK_CONTROL_MASK;
/* For all modifier keys: call the tools modifier_key_func */
if (active_tool && !gimage_is_empty (gdisp->gimage))
{
(* active_tool->toggle_key_func) (active_tool, kevent, gdisp);
(* active_tool->modifier_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;
break;
}
return_val = TRUE;

View File

@ -605,7 +605,7 @@ create_display_shell (GDisplay* gdisp,
gtk_window_set_wmclass (GTK_WINDOW (gdisp->shell), "image_window", "Gimp");
gtk_window_set_policy (GTK_WINDOW (gdisp->shell), TRUE, TRUE, TRUE);
gtk_object_set_user_data (GTK_OBJECT (gdisp->shell), (gpointer) gdisp);
gtk_widget_set_events (gdisp->shell, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
gtk_widget_set_events (gdisp->shell, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_KEY_RELEASE_MASK);
gtk_signal_connect (GTK_OBJECT (gdisp->shell), "delete_event",
GTK_SIGNAL_FUNC (gdisplay_delete),
gdisp);

View File

@ -605,7 +605,7 @@ create_display_shell (GDisplay* gdisp,
gtk_window_set_wmclass (GTK_WINDOW (gdisp->shell), "image_window", "Gimp");
gtk_window_set_policy (GTK_WINDOW (gdisp->shell), TRUE, TRUE, TRUE);
gtk_object_set_user_data (GTK_OBJECT (gdisp->shell), (gpointer) gdisp);
gtk_widget_set_events (gdisp->shell, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
gtk_widget_set_events (gdisp->shell, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_KEY_RELEASE_MASK);
gtk_signal_connect (GTK_OBJECT (gdisp->shell), "delete_event",
GTK_SIGNAL_FUNC (gdisplay_delete),
gdisp);

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "cursorutil.h"
#include "drawable.h"
@ -43,7 +44,7 @@ struct _FlipOptions
ToolType type;
ToolType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
};
static FlipOptions *flip_options = NULL;
@ -56,7 +57,7 @@ flip_options_reset (void)
{
FlipOptions *options = flip_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static FlipOptions *
@ -66,25 +67,27 @@ flip_options_new (void)
GtkWidget *vbox;
GtkWidget *frame;
gchar* type_label[2] = { _("Horizontal"), _("Vertical") };
gint type_value[2] = { FLIP_HORZ, FLIP_VERT };
/* 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;
/* 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);
frame = tool_options_radio_buttons_new (_("Tool Toggle"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -92,16 +95,25 @@ flip_options_new (void)
}
static void
flip_toggle_key_func (Tool *tool,
flip_modifier_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);
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
break;
case GDK_Shift_L: case GDK_Shift_R:
if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE);
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
void *
flip_tool_transform (Tool *tool,
gpointer gdisp_ptr,
@ -172,7 +184,7 @@ tools_new_flip ()
private = tool->private;
private->trans_func = flip_tool_transform;
tool->toggle_key_func = flip_toggle_key_func;
tool->modifier_key_func = flip_modifier_key_func;
tool->cursor_update_func = flip_cursor_update;
private->trans_info[FLIP_INFO] = -1.0;

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = ink_cursor_update;
tool->control_func = ink_control;

View File

@ -605,7 +605,7 @@ create_display_shell (GDisplay* gdisp,
gtk_window_set_wmclass (GTK_WINDOW (gdisp->shell), "image_window", "Gimp");
gtk_window_set_policy (GTK_WINDOW (gdisp->shell), TRUE, TRUE, TRUE);
gtk_object_set_user_data (GTK_OBJECT (gdisp->shell), (gpointer) gdisp);
gtk_widget_set_events (gdisp->shell, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
gtk_widget_set_events (gdisp->shell, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_KEY_RELEASE_MASK);
gtk_signal_connect (GTK_OBJECT (gdisp->shell), "delete_event",
GTK_SIGNAL_FUNC (gdisplay_delete),
gdisp);

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;

View File

@ -452,7 +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->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->preserve = TRUE;

View File

@ -17,6 +17,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "drawable.h"
#include "errors.h"
@ -47,7 +48,7 @@ struct _ConvolveOptions
ConvolveType type;
ConvolveType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
double pressure;
double pressure_d;
@ -112,7 +113,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_toggle[options->type_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static ConvolveOptions *
@ -125,22 +126,14 @@ convolve_options_new (void)
GtkWidget *label;
GtkWidget *scale;
GtkWidget *frame;
gchar* type_label[2] = { _("Blur"), _("Sharpen") };
gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE };
/* 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;
@ -168,8 +161,13 @@ convolve_options_new (void)
gtk_widget_show (scale);
gtk_widget_show (hbox);
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);
frame = tool_options_radio_buttons_new (_("Convolve Type"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -192,24 +190,32 @@ convolve_paint_func (PaintCore *paint_core,
}
static void
convolve_toggle_key_func (Tool *tool,
convolve_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (convolve_options->type)
switch (kevent->keyval)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[SHARPEN_CONVOLVE].widget), TRUE);
case GDK_Alt_L: case GDK_Alt_R:
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[BLUR_CONVOLVE].widget), TRUE);
break;
default:
case GDK_Shift_L: case GDK_Shift_R:
switch (convolve_options->type)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_w[SHARPEN_CONVOLVE]), TRUE);
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_w[BLUR_CONVOLVE]), TRUE);
break;
default:
break;
}
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
Tool *
tools_new_convolve ()
{
@ -227,7 +233,7 @@ tools_new_convolve ()
}
tool = paint_core_new (CONVOLVE);
tool->toggle_key_func = convolve_toggle_key_func;
tool->modifier_key_func = convolve_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = paint_core_cursor_update;
tool->control_func = paint_core_control;

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
tool->preserve = FALSE;

View File

@ -147,13 +147,17 @@ tool_options_radio_buttons_update (GtkWidget *widget,
}
GtkWidget*
tool_options_radio_buttons_new (gchar* label,
ToolOptionsRadioButtons* radio_buttons,
gpointer toggle_val)
tool_options_radio_buttons_new (gchar* label,
gpointer toggle_val,
GtkWidget* button_widget[],
gchar* button_label[],
gint button_value[],
gint num)
{
GtkWidget *frame;
GtkWidget *vbox;
GSList *group = NULL;
gint i;
frame = gtk_frame_new (label);
@ -163,20 +167,18 @@ tool_options_radio_buttons_new (gchar* label,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
while (radio_buttons->label != NULL)
for (i=0; i<num; i++)
{
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",
button_widget[i] = gtk_radio_button_new_with_label (group,
button_label[i]);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button_widget[i]));
gtk_box_pack_start (GTK_BOX (vbox), button_widget[i], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button_widget[i]), "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_object_set_data (GTK_OBJECT (button_widget[i]), "toggle_value",
(gpointer)button_value[i]);
gtk_widget_show (button_widget[i]);
}
gtk_widget_show (vbox);

View File

@ -40,16 +40,12 @@ 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);
GtkWidget* tool_options_radio_buttons_new (gchar* label,
gpointer toggle_val,
GtkWidget* button_widget[],
gchar* button_label[],
gint button_value[],
gint num);
#endif /* __TOOL_OPTIONS_UI_H__ */

View File

@ -882,9 +882,9 @@ standard_arrow_keys_func (Tool *tool,
}
void
standard_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
standard_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
}

View File

@ -68,7 +68,7 @@ struct _tool
ButtonReleaseFunc button_release_func;
MotionFunc motion_func;
ArrowKeysFunc arrow_keys_func;
ToggleKeyFunc toggle_key_func;
ModifierKeyFunc modifier_key_func;
CursorUpdateFunc cursor_update_func;
ToolCtlFunc control_func;
};
@ -122,7 +122,7 @@ 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);
void standard_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
void standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "brush_select.h"
#include "bucket_fill.h"
@ -60,7 +61,7 @@ struct _BucketOptions
BucketFillMode fill_mode;
BucketFillMode fill_mode_d;
ToolOptionsRadioButtons type_toggle[4];
GtkWidget *fill_mode_w[3];
};
@ -97,7 +98,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->type_toggle[options->fill_mode_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
}
static BucketOptions *
@ -110,7 +111,12 @@ bucket_options_new (void)
GtkWidget *label;
GtkWidget *scale;
GtkWidget *frame;
gchar* fill_mode_label[3] = { _("FG Color Fill"),
_("BG Color Fill"),
_("Pattern Fill") };
gint fill_mode_value[3] = { FG_BUCKET_FILL,
BG_BUCKET_FILL,
PATTERN_BUCKET_FILL };
/* the new bucket fill tool options structure */
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
@ -119,13 +125,6 @@ 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 */
@ -163,8 +162,13 @@ bucket_options_new (void)
gtk_widget_show (options->sample_merged_w);
/* 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);
frame = tool_options_radio_buttons_new (_("Fill Type"),
&options->fill_mode,
options->fill_mode_w,
fill_mode_label,
fill_mode_value,
3);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -286,19 +290,28 @@ bucket_fill_cursor_update (Tool *tool,
}
static void
bucket_fill_toggle_key_func (Tool *tool,
bucket_fill_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (bucket_options->fill_mode)
switch (kevent->keyval)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[BG_BUCKET_FILL].widget), TRUE);
case GDK_Alt_L: case GDK_Alt_R:
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[FG_BUCKET_FILL].widget), TRUE);
case GDK_Shift_L: case GDK_Shift_R:
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->fill_mode_w[BG_BUCKET_FILL]), TRUE);
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->fill_mode_w[FG_BUCKET_FILL]), TRUE);
break;
default:
break;
}
break;
default:
case GDK_Control_L: case GDK_Control_R:
break;
}
}
@ -605,7 +618,7 @@ tools_new_bucket_fill (void)
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->toggle_key_func = bucket_fill_toggle_key_func;
tool->modifier_key_func = bucket_fill_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_picker_cursor_update;
tool->control_func = color_picker_control;
tool->preserve = TRUE;

View File

@ -17,6 +17,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "drawable.h"
#include "errors.h"
@ -47,7 +48,7 @@ struct _ConvolveOptions
ConvolveType type;
ConvolveType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
double pressure;
double pressure_d;
@ -112,7 +113,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_toggle[options->type_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static ConvolveOptions *
@ -125,22 +126,14 @@ convolve_options_new (void)
GtkWidget *label;
GtkWidget *scale;
GtkWidget *frame;
gchar* type_label[2] = { _("Blur"), _("Sharpen") };
gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE };
/* 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;
@ -168,8 +161,13 @@ convolve_options_new (void)
gtk_widget_show (scale);
gtk_widget_show (hbox);
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);
frame = tool_options_radio_buttons_new (_("Convolve Type"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -192,24 +190,32 @@ convolve_paint_func (PaintCore *paint_core,
}
static void
convolve_toggle_key_func (Tool *tool,
convolve_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (convolve_options->type)
switch (kevent->keyval)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[SHARPEN_CONVOLVE].widget), TRUE);
case GDK_Alt_L: case GDK_Alt_R:
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[BLUR_CONVOLVE].widget), TRUE);
break;
default:
case GDK_Shift_L: case GDK_Shift_R:
switch (convolve_options->type)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_w[SHARPEN_CONVOLVE]), TRUE);
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_w[BLUR_CONVOLVE]), TRUE);
break;
default:
break;
}
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
Tool *
tools_new_convolve ()
{
@ -227,7 +233,7 @@ tools_new_convolve ()
}
tool = paint_core_new (CONVOLVE);
tool->toggle_key_func = convolve_toggle_key_func;
tool->modifier_key_func = convolve_modifier_key_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View File

@ -86,7 +86,7 @@ struct _CropOptions
CropType type;
CropType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
};
@ -110,7 +110,7 @@ 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);
static void crop_modifier_key_func (Tool *, GdkEventKey *, gpointer);
/* Crop helper functions */
static void crop_recalc (Tool *, Crop *);
@ -156,7 +156,7 @@ crop_options_reset (void)
options->layer_only_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);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static CropOptions *
@ -165,7 +165,9 @@ crop_options_new (void)
CropOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
gchar* type_label[2] = { _("Crop"), _("Resize") };
gint type_value[2] = { CROP_CROP, RESIZE_CROP };
/* the new crop tool options structure */
options = (CropOptions *) g_malloc (sizeof (CropOptions));
tool_options_init ((ToolOptions *) options,
@ -173,12 +175,7 @@ crop_options_new (void)
crop_options_reset);
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;
options->type = options->type_d = CROP_CROP;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -207,8 +204,13 @@ crop_options_new (void)
gtk_widget_show (options->allow_enlarge_w);
/* 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);
frame = tool_options_radio_buttons_new (_("Tool Toggle"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -390,7 +392,6 @@ crop_motion (Tool *tool,
int curx, cury;
int inc_x, inc_y;
gchar size[STATUSBAR_SIZE];
int clamp;
int min_x, min_y, max_x, max_y;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
@ -414,22 +415,6 @@ crop_motion (Tool *tool,
return;
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->allow_enlarge)
{
if (mevent->state & GDK_MOD1_MASK)
clamp = TRUE;
else
clamp = FALSE;
}
else
{
if (mevent->state & GDK_MOD1_MASK)
clamp = FALSE;
else
clamp = TRUE;
}
if (crop_options->layer_only)
{
@ -448,7 +433,7 @@ crop_motion (Tool *tool,
switch (crop->function)
{
case CREATING :
if (clamp)
if (!crop_options->allow_enlarge)
{
x1 = BOUNDS (x1, min_x, max_x);
y1 = BOUNDS (y1, min_y, max_y);
@ -460,7 +445,7 @@ crop_motion (Tool *tool,
case RESIZING_LEFT :
x1 = crop->tx1 + inc_x;
y1 = crop->ty1 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
x1 = BOUNDS (x1, min_x, max_x);
y1 = BOUNDS (y1, min_y, max_y);
@ -474,7 +459,7 @@ crop_motion (Tool *tool,
case RESIZING_RIGHT :
x2 = crop->tx2 + inc_x;
y2 = crop->ty2 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
x2 = BOUNDS (x2, min_x, max_x);
y2 = BOUNDS (y2, min_y, max_y);
@ -486,7 +471,7 @@ crop_motion (Tool *tool,
break;
case MOVING :
if (clamp)
if (!crop_options->allow_enlarge)
{
inc_x = BOUNDS (inc_x, min_x - crop->tx1, max_x - crop->tx2);
inc_y = BOUNDS (inc_y, min_y - crop->ty1, max_y - crop->ty2);
@ -591,7 +576,6 @@ crop_arrow_keys_func (Tool *tool,
GDisplay * gdisp;
Layer * layer;
Crop * crop;
int clamp;
int min_x, min_y, max_x, max_y;
gdisp = (GDisplay *) gdisp_ptr;
@ -618,22 +602,6 @@ crop_arrow_keys_func (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->allow_enlarge)
{
if (kevent->state & GDK_MOD1_MASK)
clamp = TRUE;
else
clamp = FALSE;
}
else
{
if (kevent->state & GDK_MOD1_MASK)
clamp = FALSE;
else
clamp = TRUE;
}
if (crop_options->layer_only)
{
layer = (gdisp->gimage)->active_layer;
@ -652,7 +620,7 @@ crop_arrow_keys_func (Tool *tool,
{
crop->tx2 = crop->tx2 + inc_x;
crop->ty2 = crop->ty2 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
crop->tx2 = BOUNDS (crop->tx2, min_x, max_x);
crop->ty2 = BOUNDS (crop->ty2, min_y, max_y);
@ -662,7 +630,7 @@ crop_arrow_keys_func (Tool *tool,
}
else
{
if (clamp)
if (!crop_options->allow_enlarge)
{
inc_x = BOUNDS (inc_x, -crop->tx1, gdisp->gimage->width - crop->tx2);
inc_y = BOUNDS (inc_y, -crop->ty1, gdisp->gimage->height - crop->ty2);
@ -679,20 +647,30 @@ crop_arrow_keys_func (Tool *tool,
}
static void
crop_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
crop_modifier_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);
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge);
break;
case GDK_Shift_L: case GDK_Shift_R:
if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
}
@ -787,7 +765,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->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "cursorutil.h"
#include "drawable.h"
@ -43,7 +44,7 @@ struct _FlipOptions
ToolType type;
ToolType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
};
static FlipOptions *flip_options = NULL;
@ -56,7 +57,7 @@ flip_options_reset (void)
{
FlipOptions *options = flip_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static FlipOptions *
@ -66,25 +67,27 @@ flip_options_new (void)
GtkWidget *vbox;
GtkWidget *frame;
gchar* type_label[2] = { _("Horizontal"), _("Vertical") };
gint type_value[2] = { FLIP_HORZ, FLIP_VERT };
/* 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;
/* 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);
frame = tool_options_radio_buttons_new (_("Tool Toggle"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -92,16 +95,25 @@ flip_options_new (void)
}
static void
flip_toggle_key_func (Tool *tool,
flip_modifier_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);
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
break;
case GDK_Shift_L: case GDK_Shift_R:
if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE);
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
void *
flip_tool_transform (Tool *tool,
gpointer gdisp_ptr,
@ -172,7 +184,7 @@ tools_new_flip ()
private = tool->private;
private->trans_func = flip_tool_transform;
tool->toggle_key_func = flip_toggle_key_func;
tool->modifier_key_func = flip_modifier_key_func;
tool->cursor_update_func = flip_cursor_update;
private->trans_info[FLIP_INFO] = -1.0;

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = brightness_contrast_cursor_update;
tool->control_func = brightness_contrast_control;
tool->preserve = FALSE;

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "brush_select.h"
#include "bucket_fill.h"
@ -60,7 +61,7 @@ struct _BucketOptions
BucketFillMode fill_mode;
BucketFillMode fill_mode_d;
ToolOptionsRadioButtons type_toggle[4];
GtkWidget *fill_mode_w[3];
};
@ -97,7 +98,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->type_toggle[options->fill_mode_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
}
static BucketOptions *
@ -110,7 +111,12 @@ bucket_options_new (void)
GtkWidget *label;
GtkWidget *scale;
GtkWidget *frame;
gchar* fill_mode_label[3] = { _("FG Color Fill"),
_("BG Color Fill"),
_("Pattern Fill") };
gint fill_mode_value[3] = { FG_BUCKET_FILL,
BG_BUCKET_FILL,
PATTERN_BUCKET_FILL };
/* the new bucket fill tool options structure */
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
@ -119,13 +125,6 @@ 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 */
@ -163,8 +162,13 @@ bucket_options_new (void)
gtk_widget_show (options->sample_merged_w);
/* 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);
frame = tool_options_radio_buttons_new (_("Fill Type"),
&options->fill_mode,
options->fill_mode_w,
fill_mode_label,
fill_mode_value,
3);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -286,19 +290,28 @@ bucket_fill_cursor_update (Tool *tool,
}
static void
bucket_fill_toggle_key_func (Tool *tool,
bucket_fill_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (bucket_options->fill_mode)
switch (kevent->keyval)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[BG_BUCKET_FILL].widget), TRUE);
case GDK_Alt_L: case GDK_Alt_R:
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->type_toggle[FG_BUCKET_FILL].widget), TRUE);
case GDK_Shift_L: case GDK_Shift_R:
switch (bucket_options->fill_mode)
{
case FG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->fill_mode_w[BG_BUCKET_FILL]), TRUE);
break;
case BG_BUCKET_FILL:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bucket_options->fill_mode_w[FG_BUCKET_FILL]), TRUE);
break;
default:
break;
}
break;
default:
case GDK_Control_L: case GDK_Control_R:
break;
}
}
@ -605,7 +618,7 @@ tools_new_bucket_fill (void)
tool->button_release_func = bucket_fill_button_release;
tool->motion_func = bucket_fill_motion;
tool->arrow_keys_func = standard_arrow_keys_func;
tool->toggle_key_func = bucket_fill_toggle_key_func;
tool->modifier_key_func = bucket_fill_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = color_balance_cursor_update;
tool->control_func = color_balance_control;
tool->preserve = FALSE;

View File

@ -17,6 +17,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "drawable.h"
#include "errors.h"
@ -47,7 +48,7 @@ struct _ConvolveOptions
ConvolveType type;
ConvolveType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
double pressure;
double pressure_d;
@ -112,7 +113,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_toggle[options->type_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static ConvolveOptions *
@ -125,22 +126,14 @@ convolve_options_new (void)
GtkWidget *label;
GtkWidget *scale;
GtkWidget *frame;
gchar* type_label[2] = { _("Blur"), _("Sharpen") };
gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE };
/* 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;
@ -168,8 +161,13 @@ convolve_options_new (void)
gtk_widget_show (scale);
gtk_widget_show (hbox);
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);
frame = tool_options_radio_buttons_new (_("Convolve Type"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -192,24 +190,32 @@ convolve_paint_func (PaintCore *paint_core,
}
static void
convolve_toggle_key_func (Tool *tool,
convolve_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (convolve_options->type)
switch (kevent->keyval)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[SHARPEN_CONVOLVE].widget), TRUE);
case GDK_Alt_L: case GDK_Alt_R:
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_toggle[BLUR_CONVOLVE].widget), TRUE);
break;
default:
case GDK_Shift_L: case GDK_Shift_R:
switch (convolve_options->type)
{
case BLUR_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_w[SHARPEN_CONVOLVE]), TRUE);
break;
case SHARPEN_CONVOLVE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (convolve_options->type_w[BLUR_CONVOLVE]), TRUE);
break;
default:
break;
}
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
Tool *
tools_new_convolve ()
{
@ -227,7 +233,7 @@ tools_new_convolve ()
}
tool = paint_core_new (CONVOLVE);
tool->toggle_key_func = convolve_toggle_key_func;
tool->modifier_key_func = convolve_modifier_key_func;
private = (PaintCore *) tool->private;
private->paint_func = convolve_paint_func;

View File

@ -86,7 +86,7 @@ struct _CropOptions
CropType type;
CropType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
};
@ -110,7 +110,7 @@ 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);
static void crop_modifier_key_func (Tool *, GdkEventKey *, gpointer);
/* Crop helper functions */
static void crop_recalc (Tool *, Crop *);
@ -156,7 +156,7 @@ crop_options_reset (void)
options->layer_only_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);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static CropOptions *
@ -165,7 +165,9 @@ crop_options_new (void)
CropOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
gchar* type_label[2] = { _("Crop"), _("Resize") };
gint type_value[2] = { CROP_CROP, RESIZE_CROP };
/* the new crop tool options structure */
options = (CropOptions *) g_malloc (sizeof (CropOptions));
tool_options_init ((ToolOptions *) options,
@ -173,12 +175,7 @@ crop_options_new (void)
crop_options_reset);
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;
options->type = options->type_d = CROP_CROP;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -207,8 +204,13 @@ crop_options_new (void)
gtk_widget_show (options->allow_enlarge_w);
/* 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);
frame = tool_options_radio_buttons_new (_("Tool Toggle"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -390,7 +392,6 @@ crop_motion (Tool *tool,
int curx, cury;
int inc_x, inc_y;
gchar size[STATUSBAR_SIZE];
int clamp;
int min_x, min_y, max_x, max_y;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
@ -414,22 +415,6 @@ crop_motion (Tool *tool,
return;
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->allow_enlarge)
{
if (mevent->state & GDK_MOD1_MASK)
clamp = TRUE;
else
clamp = FALSE;
}
else
{
if (mevent->state & GDK_MOD1_MASK)
clamp = FALSE;
else
clamp = TRUE;
}
if (crop_options->layer_only)
{
@ -448,7 +433,7 @@ crop_motion (Tool *tool,
switch (crop->function)
{
case CREATING :
if (clamp)
if (!crop_options->allow_enlarge)
{
x1 = BOUNDS (x1, min_x, max_x);
y1 = BOUNDS (y1, min_y, max_y);
@ -460,7 +445,7 @@ crop_motion (Tool *tool,
case RESIZING_LEFT :
x1 = crop->tx1 + inc_x;
y1 = crop->ty1 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
x1 = BOUNDS (x1, min_x, max_x);
y1 = BOUNDS (y1, min_y, max_y);
@ -474,7 +459,7 @@ crop_motion (Tool *tool,
case RESIZING_RIGHT :
x2 = crop->tx2 + inc_x;
y2 = crop->ty2 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
x2 = BOUNDS (x2, min_x, max_x);
y2 = BOUNDS (y2, min_y, max_y);
@ -486,7 +471,7 @@ crop_motion (Tool *tool,
break;
case MOVING :
if (clamp)
if (!crop_options->allow_enlarge)
{
inc_x = BOUNDS (inc_x, min_x - crop->tx1, max_x - crop->tx2);
inc_y = BOUNDS (inc_y, min_y - crop->ty1, max_y - crop->ty2);
@ -591,7 +576,6 @@ crop_arrow_keys_func (Tool *tool,
GDisplay * gdisp;
Layer * layer;
Crop * crop;
int clamp;
int min_x, min_y, max_x, max_y;
gdisp = (GDisplay *) gdisp_ptr;
@ -618,22 +602,6 @@ crop_arrow_keys_func (Tool *tool,
draw_core_pause (crop->core, tool);
/* shall we clamp the coordinates to the image dimensions? */
if (crop_options->allow_enlarge)
{
if (kevent->state & GDK_MOD1_MASK)
clamp = TRUE;
else
clamp = FALSE;
}
else
{
if (kevent->state & GDK_MOD1_MASK)
clamp = FALSE;
else
clamp = TRUE;
}
if (crop_options->layer_only)
{
layer = (gdisp->gimage)->active_layer;
@ -652,7 +620,7 @@ crop_arrow_keys_func (Tool *tool,
{
crop->tx2 = crop->tx2 + inc_x;
crop->ty2 = crop->ty2 + inc_y;
if (clamp)
if (!crop_options->allow_enlarge)
{
crop->tx2 = BOUNDS (crop->tx2, min_x, max_x);
crop->ty2 = BOUNDS (crop->ty2, min_y, max_y);
@ -662,7 +630,7 @@ crop_arrow_keys_func (Tool *tool,
}
else
{
if (clamp)
if (!crop_options->allow_enlarge)
{
inc_x = BOUNDS (inc_x, -crop->tx1, gdisp->gimage->width - crop->tx2);
inc_y = BOUNDS (inc_y, -crop->ty1, gdisp->gimage->height - crop->ty2);
@ -679,20 +647,30 @@ crop_arrow_keys_func (Tool *tool,
}
static void
crop_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
crop_modifier_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);
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge);
break;
case GDK_Shift_L: case GDK_Shift_R:
if (crop_options->type == CROP_CROP)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
}
@ -787,7 +765,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->modifier_key_func = crop_modifier_key_func;
tool->cursor_update_func = crop_cursor_update;
tool->control_func = crop_control;
tool->preserve = TRUE; /* XXX Check me */

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = rect_select_cursor_update;
tool->control_func = rect_select_control;
tool->preserve = TRUE;

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "cursorutil.h"
#include "drawable.h"
@ -43,7 +44,7 @@ struct _FlipOptions
ToolType type;
ToolType type_d;
ToolOptionsRadioButtons type_toggle[3];
GtkWidget *type_w[2];
};
static FlipOptions *flip_options = NULL;
@ -56,7 +57,7 @@ flip_options_reset (void)
{
FlipOptions *options = flip_options;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_toggle[options->type_d].widget), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static FlipOptions *
@ -66,25 +67,27 @@ flip_options_new (void)
GtkWidget *vbox;
GtkWidget *frame;
gchar* type_label[2] = { _("Horizontal"), _("Vertical") };
gint type_value[2] = { FLIP_HORZ, FLIP_VERT };
/* 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;
/* 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);
frame = tool_options_radio_buttons_new (_("Tool Toggle"),
&options->type,
options->type_w,
type_label,
type_value,
2);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
@ -92,16 +95,25 @@ flip_options_new (void)
}
static void
flip_toggle_key_func (Tool *tool,
flip_modifier_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);
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
break;
case GDK_Shift_L: case GDK_Shift_R:
if (flip_options->type == FLIP_HORZ)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_VERT]), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flip_options->type_w[FLIP_HORZ]), TRUE);
break;
case GDK_Control_L: case GDK_Control_R:
break;
}
}
void *
flip_tool_transform (Tool *tool,
gpointer gdisp_ptr,
@ -172,7 +184,7 @@ tools_new_flip ()
private = tool->private;
private->trans_func = flip_tool_transform;
tool->toggle_key_func = flip_toggle_key_func;
tool->modifier_key_func = flip_modifier_key_func;
tool->cursor_update_func = flip_cursor_update;
private->trans_info[FLIP_INFO] = -1.0;

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;

View File

@ -452,7 +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->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;

View File

@ -452,7 +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->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = move_tool_cursor_update;
tool->control_func = move_tool_control;
tool->preserve = TRUE;

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = paint_core_cursor_update;
tool->control_func = paint_core_control;

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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_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->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = threshold_cursor_update;
tool->control_func = threshold_control;
tool->preserve = FALSE;

View File

@ -147,13 +147,17 @@ tool_options_radio_buttons_update (GtkWidget *widget,
}
GtkWidget*
tool_options_radio_buttons_new (gchar* label,
ToolOptionsRadioButtons* radio_buttons,
gpointer toggle_val)
tool_options_radio_buttons_new (gchar* label,
gpointer toggle_val,
GtkWidget* button_widget[],
gchar* button_label[],
gint button_value[],
gint num)
{
GtkWidget *frame;
GtkWidget *vbox;
GSList *group = NULL;
gint i;
frame = gtk_frame_new (label);
@ -163,20 +167,18 @@ tool_options_radio_buttons_new (gchar* label,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox);
while (radio_buttons->label != NULL)
for (i=0; i<num; i++)
{
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",
button_widget[i] = gtk_radio_button_new_with_label (group,
button_label[i]);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button_widget[i]));
gtk_box_pack_start (GTK_BOX (vbox), button_widget[i], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button_widget[i]), "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_object_set_data (GTK_OBJECT (button_widget[i]), "toggle_value",
(gpointer)button_value[i]);
gtk_widget_show (button_widget[i]);
}
gtk_widget_show (vbox);

View File

@ -882,9 +882,9 @@ standard_arrow_keys_func (Tool *tool,
}
void
standard_toggle_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
standard_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
}

View File

@ -68,7 +68,7 @@ struct _tool
ButtonReleaseFunc button_release_func;
MotionFunc motion_func;
ArrowKeysFunc arrow_keys_func;
ToggleKeyFunc toggle_key_func;
ModifierKeyFunc modifier_key_func;
CursorUpdateFunc cursor_update_func;
ToolCtlFunc control_func;
};
@ -122,7 +122,7 @@ 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);
void standard_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
void standard_modifier_key_func (Tool *, GdkEventKey *, gpointer);
#endif /* __TOOLS_H__ */

View File

@ -710,8 +710,8 @@ transform_core_new (type, interactive)
tool->button_press_func = transform_core_button_press;
tool->button_release_func = transform_core_button_release;
tool->motion_func = transform_core_motion;
tool->arrow_keys_func = standard_arrow_keys_func; tool->toggle_key_func = standard_toggle_key_func;
tool->toggle_key_func = standard_toggle_key_func;
tool->arrow_keys_func = standard_arrow_keys_func; tool->modifier_key_func = standard_modifier_key_func;
tool->modifier_key_func = standard_modifier_key_func;
tool->cursor_update_func = transform_core_cursor_update;
tool->control_func = transform_core_control;

View File

@ -72,7 +72,7 @@ typedef void (* ButtonPressFunc) (Tool *, GdkEventButton *, gpointer);
typedef void (* ButtonReleaseFunc) (Tool *, GdkEventButton *, gpointer);
typedef void (* MotionFunc) (Tool *, GdkEventMotion *, gpointer);
typedef void (* ArrowKeysFunc) (Tool *, GdkEventKey *, gpointer);
typedef void (* ToggleKeyFunc) (Tool *, GdkEventKey *, gpointer);
typedef void (* ModifierKeyFunc) (Tool *, GdkEventKey *, gpointer);
typedef void (* CursorUpdateFunc) (Tool *, GdkEventMotion *, gpointer);
typedef void (* ToolCtlFunc) (Tool *, int, gpointer);

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