Some code cleanup, changes to the crop-modifier_key_func and 128n fixes.

--Sven
This commit is contained in:
Sven Neumann 1999-04-28 18:58:01 +00:00
parent 4e3c804f09
commit 2ec50a9d93
18 changed files with 140 additions and 185 deletions

View File

@ -1,3 +1,12 @@
Wed Apr 28 20:53:18 MEST 1999 Sven Neumann <sven@gimp.org>
* app/bucket_fill.c
* app/convolve.c
* app/crop.c
* app/flip_tool.c
* app/ops_buttons.c
* app/tool_options.c: some code cleanup and i18n fixes
Wed Apr 28 16:28:08 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen) Wed Apr 28 16:28:08 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen)
* app/gimprc.c: Add <sys/types.h>, Open text files with "rt". * app/gimprc.c: Add <sys/types.h>, Open text files with "rt".

View File

@ -111,9 +111,9 @@ bucket_options_new (void)
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *frame; GtkWidget *frame;
gchar* fill_mode_label[3] = { _("FG Color Fill"), gchar* fill_mode_label[3] = { N_("FG Color Fill"),
_("BG Color Fill"), N_("BG Color Fill"),
_("Pattern Fill") }; N_("Pattern Fill") };
gint fill_mode_value[3] = { FG_BUCKET_FILL, gint fill_mode_value[3] = { FG_BUCKET_FILL,
BG_BUCKET_FILL, BG_BUCKET_FILL,
PATTERN_BUCKET_FILL }; PATTERN_BUCKET_FILL };

View File

@ -126,7 +126,7 @@ convolve_options_new (void)
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Blur"), _("Sharpen") }; gchar* type_label[2] = { N_("Blur"), N_("Sharpen") };
gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE }; gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE };
/* the new convolve tool options structure */ /* the new convolve tool options structure */

View File

@ -170,7 +170,7 @@ tool_options_radio_buttons_new (gchar* label,
for (i=0; i<num; i++) for (i=0; i<num; i++)
{ {
button_widget[i] = gtk_radio_button_new_with_label (group, button_widget[i] = gtk_radio_button_new_with_label (group,
button_label[i]); gettext (button_label[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button_widget[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_box_pack_start (GTK_BOX (vbox), button_widget[i], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button_widget[i]), "toggled", gtk_signal_connect (GTK_OBJECT (button_widget[i]), "toggled",

View File

@ -40,8 +40,6 @@
#define RESIZING_LEFT 2 #define RESIZING_LEFT 2
#define RESIZING_RIGHT 3 #define RESIZING_RIGHT 3
#define CROPPING 4 #define CROPPING 4
#define REFRAMING 5
/* speed of key movement */ /* speed of key movement */
#define ARROW_VELOCITY 25 #define ARROW_VELOCITY 25
@ -120,7 +118,7 @@ static void crop_adjust_guides (GImage *, int, int, int, int);
/* Crop dialog functions */ /* Crop dialog functions */
static void crop_info_update (Tool *); static void crop_info_update (Tool *);
static void crop_info_create (Tool *); static void crop_info_create (Tool *);
static void crop_ok_callback (GtkWidget *, gpointer); static void crop_crop_callback (GtkWidget *, gpointer);
static void crop_resize_callback (GtkWidget *, gpointer); static void crop_resize_callback (GtkWidget *, gpointer);
static void crop_close_callback (GtkWidget *, gpointer); static void crop_close_callback (GtkWidget *, gpointer);
@ -165,7 +163,7 @@ crop_options_new (void)
CropOptions *options; CropOptions *options;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Crop"), _("Resize") }; gchar* type_label[2] = { N_("Crop"), N_("Resize") };
gint type_value[2] = { CROP_CROP, RESIZE_CROP }; gint type_value[2] = { CROP_CROP, RESIZE_CROP };
/* the new crop tool options structure */ /* the new crop tool options structure */
@ -175,7 +173,7 @@ crop_options_new (void)
crop_options_reset); crop_options_reset);
options->layer_only = options->layer_only_d = FALSE; options->layer_only = options->layer_only_d = FALSE;
options->allow_enlarge = options->allow_enlarge_d = TRUE; options->allow_enlarge = options->allow_enlarge_d = TRUE;
options->type = options->type_d = CROP_CROP; options->type = options->type_d = RESIZE_CROP;
/* the main vbox */ /* the main vbox */
vbox = options->tool_options.main_vbox; vbox = options->tool_options.main_vbox;
@ -255,12 +253,7 @@ crop_button_press (Tool *tool,
/* If the pointer is in the rectangular region, crop or resize it! */ /* If the pointer is in the rectangular region, crop or resize it! */
else if (bevent->x > crop->x1 && bevent->x < crop->x2 && else if (bevent->x > crop->x1 && bevent->x < crop->x2 &&
bevent->y > crop->y1 && bevent->y < crop->y2) bevent->y > crop->y1 && bevent->y < crop->y2)
{ crop->function = CROPPING;
if ( crop_options->type == CROP_CROP )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
/* otherwise, the new function will be creating, since we want to start anew */ /* otherwise, the new function will be creating, since we want to start anew */
else else
crop->function = CREATING; crop->function = CREATING;
@ -307,30 +300,27 @@ crop_button_release (Tool *tool,
gdk_pointer_ungrab (bevent->time); gdk_pointer_ungrab (bevent->time);
gdk_flush (); gdk_flush ();
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), crop->context_id); gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id);
if (! (bevent->state & GDK_BUTTON3_MASK)) if (! (bevent->state & GDK_BUTTON3_MASK))
{ {
switch (crop->function) if (crop->function == CROPPING)
{ {
case CROPPING: if (crop_options->type == CROP_CROP)
crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2, crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2,
crop_options->layer_only, TRUE); crop_options->layer_only, TRUE);
break; else
case REFRAMING: crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2,
crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2, crop_options->layer_only, FALSE);
crop_options->layer_only, FALSE);
break;
default:
crop_info_update (tool);
return;
}
}
/* Finish the tool */ /* Finish the tool */
draw_core_stop (crop->core, tool); draw_core_stop (crop->core, tool);
info_dialog_popdown (crop_info); info_dialog_popdown (crop_info);
tool->state = INACTIVE; tool->state = INACTIVE;
}
else
crop_info_update (tool);
}
} }
static void static void
@ -398,7 +388,7 @@ crop_motion (Tool *tool,
/* This is the only case when the motion events should be ignored-- /* This is the only case when the motion events should be ignored--
we're just waiting for the button release event to crop the image */ we're just waiting for the button release event to crop the image */
if (crop->function == CROPPING || crop->function == REFRAMING) if (crop->function == CROPPING)
return; return;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &curx, &cury, TRUE, FALSE); gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &curx, &cury, TRUE, FALSE);
@ -651,26 +641,19 @@ crop_modifier_key_func (Tool *tool,
GdkEventKey *kevent, GdkEventKey *kevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay * gdisp; switch (kevent->keyval)
gdisp = (GDisplay *) gdisp_ptr;
if (tool->state == ACTIVE && tool->gdisp_ptr == gdisp_ptr)
{ {
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);
case GDK_Alt_L: case GDK_Alt_R: break;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge); case GDK_Shift_L: case GDK_Shift_R:
break; if (crop_options->type == CROP_CROP)
case GDK_Shift_L: case GDK_Shift_R: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
if (crop_options->type == CROP_CROP) else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
else break;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE); case GDK_Control_L: case GDK_Control_R:
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
}
} }
} }
@ -1007,11 +990,10 @@ crop_start (Tool *tool,
/* Crop dialog functions */ /* Crop dialog functions */
/*******************************************************/ /*******************************************************/
static ActionAreaItem action_items[4] = static ActionAreaItem action_items[3] =
{ {
{ N_("Crop"), crop_ok_callback, NULL, NULL }, { N_("Crop"), crop_crop_callback, NULL, NULL },
{ N_("Resize"), crop_resize_callback, NULL, NULL }, { N_("Resize"), crop_resize_callback, NULL, NULL },
/* { N_("Selection"), crop_selection_callback, NULL, NULL }, */
{ N_("Close"), crop_close_callback, NULL, NULL }, { N_("Close"), crop_close_callback, NULL, NULL },
}; };
@ -1132,8 +1114,8 @@ crop_info_update (Tool *tool)
} }
static void static void
crop_ok_callback (GtkWidget *w, crop_crop_callback (GtkWidget *w,
gpointer client_data) gpointer client_data)
{ {
Tool * tool; Tool * tool;
Crop * crop; Crop * crop;

View File

@ -67,7 +67,7 @@ flip_options_new (void)
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Horizontal"), _("Vertical") }; gchar* type_label[2] = { N_("Horizontal"), N_("Vertical") };
gint type_value[2] = { FLIP_HORZ, FLIP_VERT }; gint type_value[2] = { FLIP_HORZ, FLIP_VERT };
/* the new flip tool options structure */ /* the new flip tool options structure */

View File

@ -93,7 +93,7 @@ GtkWidget *ops_button_box_new (GtkWidget *parent,
} }
if (tool_tips != NULL) if (tool_tips != NULL)
gtk_tooltips_set_tip (tool_tips, button, ops_button->tooltip, NULL); gtk_tooltips_set_tip (tool_tips, button, gettext (ops_button->tooltip), NULL);
gtk_box_pack_start (GTK_BOX(button_box), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX(button_box), button, TRUE, TRUE, 0);

View File

@ -126,7 +126,7 @@ convolve_options_new (void)
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Blur"), _("Sharpen") }; gchar* type_label[2] = { N_("Blur"), N_("Sharpen") };
gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE }; gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE };
/* the new convolve tool options structure */ /* the new convolve tool options structure */

View File

@ -170,7 +170,7 @@ tool_options_radio_buttons_new (gchar* label,
for (i=0; i<num; i++) for (i=0; i<num; i++)
{ {
button_widget[i] = gtk_radio_button_new_with_label (group, button_widget[i] = gtk_radio_button_new_with_label (group,
button_label[i]); gettext (button_label[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button_widget[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_box_pack_start (GTK_BOX (vbox), button_widget[i], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button_widget[i]), "toggled", gtk_signal_connect (GTK_OBJECT (button_widget[i]), "toggled",

View File

@ -111,9 +111,9 @@ bucket_options_new (void)
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *frame; GtkWidget *frame;
gchar* fill_mode_label[3] = { _("FG Color Fill"), gchar* fill_mode_label[3] = { N_("FG Color Fill"),
_("BG Color Fill"), N_("BG Color Fill"),
_("Pattern Fill") }; N_("Pattern Fill") };
gint fill_mode_value[3] = { FG_BUCKET_FILL, gint fill_mode_value[3] = { FG_BUCKET_FILL,
BG_BUCKET_FILL, BG_BUCKET_FILL,
PATTERN_BUCKET_FILL }; PATTERN_BUCKET_FILL };

View File

@ -126,7 +126,7 @@ convolve_options_new (void)
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Blur"), _("Sharpen") }; gchar* type_label[2] = { N_("Blur"), N_("Sharpen") };
gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE }; gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE };
/* the new convolve tool options structure */ /* the new convolve tool options structure */

View File

@ -40,8 +40,6 @@
#define RESIZING_LEFT 2 #define RESIZING_LEFT 2
#define RESIZING_RIGHT 3 #define RESIZING_RIGHT 3
#define CROPPING 4 #define CROPPING 4
#define REFRAMING 5
/* speed of key movement */ /* speed of key movement */
#define ARROW_VELOCITY 25 #define ARROW_VELOCITY 25
@ -120,7 +118,7 @@ static void crop_adjust_guides (GImage *, int, int, int, int);
/* Crop dialog functions */ /* Crop dialog functions */
static void crop_info_update (Tool *); static void crop_info_update (Tool *);
static void crop_info_create (Tool *); static void crop_info_create (Tool *);
static void crop_ok_callback (GtkWidget *, gpointer); static void crop_crop_callback (GtkWidget *, gpointer);
static void crop_resize_callback (GtkWidget *, gpointer); static void crop_resize_callback (GtkWidget *, gpointer);
static void crop_close_callback (GtkWidget *, gpointer); static void crop_close_callback (GtkWidget *, gpointer);
@ -165,7 +163,7 @@ crop_options_new (void)
CropOptions *options; CropOptions *options;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Crop"), _("Resize") }; gchar* type_label[2] = { N_("Crop"), N_("Resize") };
gint type_value[2] = { CROP_CROP, RESIZE_CROP }; gint type_value[2] = { CROP_CROP, RESIZE_CROP };
/* the new crop tool options structure */ /* the new crop tool options structure */
@ -175,7 +173,7 @@ crop_options_new (void)
crop_options_reset); crop_options_reset);
options->layer_only = options->layer_only_d = FALSE; options->layer_only = options->layer_only_d = FALSE;
options->allow_enlarge = options->allow_enlarge_d = TRUE; options->allow_enlarge = options->allow_enlarge_d = TRUE;
options->type = options->type_d = CROP_CROP; options->type = options->type_d = RESIZE_CROP;
/* the main vbox */ /* the main vbox */
vbox = options->tool_options.main_vbox; vbox = options->tool_options.main_vbox;
@ -255,12 +253,7 @@ crop_button_press (Tool *tool,
/* If the pointer is in the rectangular region, crop or resize it! */ /* If the pointer is in the rectangular region, crop or resize it! */
else if (bevent->x > crop->x1 && bevent->x < crop->x2 && else if (bevent->x > crop->x1 && bevent->x < crop->x2 &&
bevent->y > crop->y1 && bevent->y < crop->y2) bevent->y > crop->y1 && bevent->y < crop->y2)
{ crop->function = CROPPING;
if ( crop_options->type == CROP_CROP )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
/* otherwise, the new function will be creating, since we want to start anew */ /* otherwise, the new function will be creating, since we want to start anew */
else else
crop->function = CREATING; crop->function = CREATING;
@ -307,30 +300,27 @@ crop_button_release (Tool *tool,
gdk_pointer_ungrab (bevent->time); gdk_pointer_ungrab (bevent->time);
gdk_flush (); gdk_flush ();
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), crop->context_id); gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id);
if (! (bevent->state & GDK_BUTTON3_MASK)) if (! (bevent->state & GDK_BUTTON3_MASK))
{ {
switch (crop->function) if (crop->function == CROPPING)
{ {
case CROPPING: if (crop_options->type == CROP_CROP)
crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2, crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2,
crop_options->layer_only, TRUE); crop_options->layer_only, TRUE);
break; else
case REFRAMING: crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2,
crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2, crop_options->layer_only, FALSE);
crop_options->layer_only, FALSE);
break;
default:
crop_info_update (tool);
return;
}
}
/* Finish the tool */ /* Finish the tool */
draw_core_stop (crop->core, tool); draw_core_stop (crop->core, tool);
info_dialog_popdown (crop_info); info_dialog_popdown (crop_info);
tool->state = INACTIVE; tool->state = INACTIVE;
}
else
crop_info_update (tool);
}
} }
static void static void
@ -398,7 +388,7 @@ crop_motion (Tool *tool,
/* This is the only case when the motion events should be ignored-- /* This is the only case when the motion events should be ignored--
we're just waiting for the button release event to crop the image */ we're just waiting for the button release event to crop the image */
if (crop->function == CROPPING || crop->function == REFRAMING) if (crop->function == CROPPING)
return; return;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &curx, &cury, TRUE, FALSE); gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &curx, &cury, TRUE, FALSE);
@ -651,26 +641,19 @@ crop_modifier_key_func (Tool *tool,
GdkEventKey *kevent, GdkEventKey *kevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay * gdisp; switch (kevent->keyval)
gdisp = (GDisplay *) gdisp_ptr;
if (tool->state == ACTIVE && tool->gdisp_ptr == gdisp_ptr)
{ {
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);
case GDK_Alt_L: case GDK_Alt_R: break;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge); case GDK_Shift_L: case GDK_Shift_R:
break; if (crop_options->type == CROP_CROP)
case GDK_Shift_L: case GDK_Shift_R: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
if (crop_options->type == CROP_CROP) else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
else break;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE); case GDK_Control_L: case GDK_Control_R:
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
}
} }
} }
@ -1007,11 +990,10 @@ crop_start (Tool *tool,
/* Crop dialog functions */ /* Crop dialog functions */
/*******************************************************/ /*******************************************************/
static ActionAreaItem action_items[4] = static ActionAreaItem action_items[3] =
{ {
{ N_("Crop"), crop_ok_callback, NULL, NULL }, { N_("Crop"), crop_crop_callback, NULL, NULL },
{ N_("Resize"), crop_resize_callback, NULL, NULL }, { N_("Resize"), crop_resize_callback, NULL, NULL },
/* { N_("Selection"), crop_selection_callback, NULL, NULL }, */
{ N_("Close"), crop_close_callback, NULL, NULL }, { N_("Close"), crop_close_callback, NULL, NULL },
}; };
@ -1132,8 +1114,8 @@ crop_info_update (Tool *tool)
} }
static void static void
crop_ok_callback (GtkWidget *w, crop_crop_callback (GtkWidget *w,
gpointer client_data) gpointer client_data)
{ {
Tool * tool; Tool * tool;
Crop * crop; Crop * crop;

View File

@ -67,7 +67,7 @@ flip_options_new (void)
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Horizontal"), _("Vertical") }; gchar* type_label[2] = { N_("Horizontal"), N_("Vertical") };
gint type_value[2] = { FLIP_HORZ, FLIP_VERT }; gint type_value[2] = { FLIP_HORZ, FLIP_VERT };
/* the new flip tool options structure */ /* the new flip tool options structure */

View File

@ -111,9 +111,9 @@ bucket_options_new (void)
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *frame; GtkWidget *frame;
gchar* fill_mode_label[3] = { _("FG Color Fill"), gchar* fill_mode_label[3] = { N_("FG Color Fill"),
_("BG Color Fill"), N_("BG Color Fill"),
_("Pattern Fill") }; N_("Pattern Fill") };
gint fill_mode_value[3] = { FG_BUCKET_FILL, gint fill_mode_value[3] = { FG_BUCKET_FILL,
BG_BUCKET_FILL, BG_BUCKET_FILL,
PATTERN_BUCKET_FILL }; PATTERN_BUCKET_FILL };

View File

@ -126,7 +126,7 @@ convolve_options_new (void)
GtkWidget *label; GtkWidget *label;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Blur"), _("Sharpen") }; gchar* type_label[2] = { N_("Blur"), N_("Sharpen") };
gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE }; gint type_value[2] = { BLUR_CONVOLVE, SHARPEN_CONVOLVE };
/* the new convolve tool options structure */ /* the new convolve tool options structure */

View File

@ -40,8 +40,6 @@
#define RESIZING_LEFT 2 #define RESIZING_LEFT 2
#define RESIZING_RIGHT 3 #define RESIZING_RIGHT 3
#define CROPPING 4 #define CROPPING 4
#define REFRAMING 5
/* speed of key movement */ /* speed of key movement */
#define ARROW_VELOCITY 25 #define ARROW_VELOCITY 25
@ -120,7 +118,7 @@ static void crop_adjust_guides (GImage *, int, int, int, int);
/* Crop dialog functions */ /* Crop dialog functions */
static void crop_info_update (Tool *); static void crop_info_update (Tool *);
static void crop_info_create (Tool *); static void crop_info_create (Tool *);
static void crop_ok_callback (GtkWidget *, gpointer); static void crop_crop_callback (GtkWidget *, gpointer);
static void crop_resize_callback (GtkWidget *, gpointer); static void crop_resize_callback (GtkWidget *, gpointer);
static void crop_close_callback (GtkWidget *, gpointer); static void crop_close_callback (GtkWidget *, gpointer);
@ -165,7 +163,7 @@ crop_options_new (void)
CropOptions *options; CropOptions *options;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Crop"), _("Resize") }; gchar* type_label[2] = { N_("Crop"), N_("Resize") };
gint type_value[2] = { CROP_CROP, RESIZE_CROP }; gint type_value[2] = { CROP_CROP, RESIZE_CROP };
/* the new crop tool options structure */ /* the new crop tool options structure */
@ -175,7 +173,7 @@ crop_options_new (void)
crop_options_reset); crop_options_reset);
options->layer_only = options->layer_only_d = FALSE; options->layer_only = options->layer_only_d = FALSE;
options->allow_enlarge = options->allow_enlarge_d = TRUE; options->allow_enlarge = options->allow_enlarge_d = TRUE;
options->type = options->type_d = CROP_CROP; options->type = options->type_d = RESIZE_CROP;
/* the main vbox */ /* the main vbox */
vbox = options->tool_options.main_vbox; vbox = options->tool_options.main_vbox;
@ -255,12 +253,7 @@ crop_button_press (Tool *tool,
/* If the pointer is in the rectangular region, crop or resize it! */ /* If the pointer is in the rectangular region, crop or resize it! */
else if (bevent->x > crop->x1 && bevent->x < crop->x2 && else if (bevent->x > crop->x1 && bevent->x < crop->x2 &&
bevent->y > crop->y1 && bevent->y < crop->y2) bevent->y > crop->y1 && bevent->y < crop->y2)
{ crop->function = CROPPING;
if ( crop_options->type == CROP_CROP )
crop->function = CROPPING;
else
crop->function = REFRAMING;
}
/* otherwise, the new function will be creating, since we want to start anew */ /* otherwise, the new function will be creating, since we want to start anew */
else else
crop->function = CREATING; crop->function = CREATING;
@ -307,30 +300,27 @@ crop_button_release (Tool *tool,
gdk_pointer_ungrab (bevent->time); gdk_pointer_ungrab (bevent->time);
gdk_flush (); gdk_flush ();
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), crop->context_id); gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id);
if (! (bevent->state & GDK_BUTTON3_MASK)) if (! (bevent->state & GDK_BUTTON3_MASK))
{ {
switch (crop->function) if (crop->function == CROPPING)
{ {
case CROPPING: if (crop_options->type == CROP_CROP)
crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2, crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2,
crop_options->layer_only, TRUE); crop_options->layer_only, TRUE);
break; else
case REFRAMING: crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2,
crop_image (gdisp->gimage, crop->tx1, crop->ty1, crop->tx2, crop->ty2, crop_options->layer_only, FALSE);
crop_options->layer_only, FALSE);
break;
default:
crop_info_update (tool);
return;
}
}
/* Finish the tool */ /* Finish the tool */
draw_core_stop (crop->core, tool); draw_core_stop (crop->core, tool);
info_dialog_popdown (crop_info); info_dialog_popdown (crop_info);
tool->state = INACTIVE; tool->state = INACTIVE;
}
else
crop_info_update (tool);
}
} }
static void static void
@ -398,7 +388,7 @@ crop_motion (Tool *tool,
/* This is the only case when the motion events should be ignored-- /* This is the only case when the motion events should be ignored--
we're just waiting for the button release event to crop the image */ we're just waiting for the button release event to crop the image */
if (crop->function == CROPPING || crop->function == REFRAMING) if (crop->function == CROPPING)
return; return;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &curx, &cury, TRUE, FALSE); gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &curx, &cury, TRUE, FALSE);
@ -651,26 +641,19 @@ crop_modifier_key_func (Tool *tool,
GdkEventKey *kevent, GdkEventKey *kevent,
gpointer gdisp_ptr) gpointer gdisp_ptr)
{ {
GDisplay * gdisp; switch (kevent->keyval)
gdisp = (GDisplay *) gdisp_ptr;
if (tool->state == ACTIVE && tool->gdisp_ptr == gdisp_ptr)
{ {
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);
case GDK_Alt_L: case GDK_Alt_R: break;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->allow_enlarge_w), !crop_options->allow_enlarge); case GDK_Shift_L: case GDK_Shift_R:
break; if (crop_options->type == CROP_CROP)
case GDK_Shift_L: case GDK_Shift_R: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE);
if (crop_options->type == CROP_CROP) else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[RESIZE_CROP]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE);
else break;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (crop_options->type_w[CROP_CROP]), TRUE); case GDK_Control_L: case GDK_Control_R:
break; break;
case GDK_Control_L: case GDK_Control_R:
break;
}
} }
} }
@ -1007,11 +990,10 @@ crop_start (Tool *tool,
/* Crop dialog functions */ /* Crop dialog functions */
/*******************************************************/ /*******************************************************/
static ActionAreaItem action_items[4] = static ActionAreaItem action_items[3] =
{ {
{ N_("Crop"), crop_ok_callback, NULL, NULL }, { N_("Crop"), crop_crop_callback, NULL, NULL },
{ N_("Resize"), crop_resize_callback, NULL, NULL }, { N_("Resize"), crop_resize_callback, NULL, NULL },
/* { N_("Selection"), crop_selection_callback, NULL, NULL }, */
{ N_("Close"), crop_close_callback, NULL, NULL }, { N_("Close"), crop_close_callback, NULL, NULL },
}; };
@ -1132,8 +1114,8 @@ crop_info_update (Tool *tool)
} }
static void static void
crop_ok_callback (GtkWidget *w, crop_crop_callback (GtkWidget *w,
gpointer client_data) gpointer client_data)
{ {
Tool * tool; Tool * tool;
Crop * crop; Crop * crop;

View File

@ -67,7 +67,7 @@ flip_options_new (void)
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *frame; GtkWidget *frame;
gchar* type_label[2] = { _("Horizontal"), _("Vertical") }; gchar* type_label[2] = { N_("Horizontal"), N_("Vertical") };
gint type_value[2] = { FLIP_HORZ, FLIP_VERT }; gint type_value[2] = { FLIP_HORZ, FLIP_VERT };
/* the new flip tool options structure */ /* the new flip tool options structure */

View File

@ -170,7 +170,7 @@ tool_options_radio_buttons_new (gchar* label,
for (i=0; i<num; i++) for (i=0; i<num; i++)
{ {
button_widget[i] = gtk_radio_button_new_with_label (group, button_widget[i] = gtk_radio_button_new_with_label (group,
button_label[i]); gettext (button_label[i]));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button_widget[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_box_pack_start (GTK_BOX (vbox), button_widget[i], FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button_widget[i]), "toggled", gtk_signal_connect (GTK_OBJECT (button_widget[i]), "toggled",