Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
d342563d
Commit
d342563d
authored
Apr 27, 1999
by
Sven Neumann
Browse files
Moved from toggle_key_func to modifier_key_func.
--Sven
parent
0355c5aa
Changes
101
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
d342563d
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.
...
...
app/base/color-balance.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/base/curves.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/base/hue-saturation.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/base/threshold.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/bezier_select.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/blend.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/brightness_contrast.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/bucket_fill.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/by_color_select.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/color_balance.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/color_picker.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/convolve.c
View file @
d342563d
...
...
@@ -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
);
break
;
case
SHARPEN_CONVOLVE
:
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
convolve_options
->
type_toggle
[
BLUR_CONVOLVE
].
widget
),
TRUE
);
case
GDK_Alt_L
:
case
GDK_Alt_R
:
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
;
...
...
app/core/gimpdrawable-blend.c
View file @
d342563d
...
...
@@ -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
;
...
...
app/core/gimptooloptions.c
View file @
d342563d
...
...
@@ -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_
button
s
->
widget
=
gtk_radio_button_new_with_label
(
group
,
radio_
button
s
->
label
);
group
=
gtk_radio_button_group
(
GTK_RADIO_BUTTON
(
radio_
button
s
->
widget
));
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
radio_
button
s
->
widget
,
FALSE
,
FALSE
,
0
);
gtk_signal_connect
(
GTK_OBJECT
(
radio_
button
s
->
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
);
...
...
app/crop.c
View file @
d342563d
...
...
@@ -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
);