mirror of https://github.com/GNOME/gimp.git
app/bezier_select.c app/commands.[ch] app/devices.c app/disp_callbacks.c
Sun Jun 21 15:16:46 CDT 1998 Larry Ewing <lewing@gimp.org> * app/bezier_select.c * app/commands.[ch] * app/devices.c * app/disp_callbacks.c * app/interface.c * app/menus.c * app/pixmaps.h * app/tools.[ch] * app/undo.c: Lots of changes to the way tools are intialized and accessed. All information about a tool type is now contained in a single ToolInfo array. There are still some small issues to adress about tool groups and we need some way of getting menu ordering/grouping to work better (plug-ins need this too). There is still much to be done, but this is the next in cleaning up the tools. * app/posterize.[ch] * app/threshold.[ch] * app/histogram_tool.[ch] * app/hue_saturation.[ch] * app/levels.[ch] * app/brightness_contrast.[ch] * app/by_color_select.[ch] * app/color_balance.[ch] * app/curves.[ch]: Changed the *_initalize function prototypes from gpointer to GDisplay, to allow better type chacking and provide a uniform interface for all the dialog tools.
This commit is contained in:
parent
2d46c61b87
commit
db79dc64df
30
ChangeLog
30
ChangeLog
|
@ -1,3 +1,33 @@
|
|||
Sun Jun 21 15:16:46 CDT 1998 Larry Ewing <lewing@gimp.org>
|
||||
|
||||
* app/bezier_select.c
|
||||
* app/commands.[ch]
|
||||
* app/devices.c
|
||||
* app/disp_callbacks.c
|
||||
* app/interface.c
|
||||
* app/menus.c
|
||||
* app/pixmaps.h
|
||||
* app/tools.[ch]
|
||||
* app/undo.c: Lots of changes to the way tools are intialized and
|
||||
accessed. All information about a tool type is now contained in a
|
||||
single ToolInfo array. There are still some small issues to
|
||||
adress about tool groups and we need some way of getting menu
|
||||
ordering/grouping to work better (plug-ins need this too). There
|
||||
is still much to be done, but this is the next in cleaning up the
|
||||
tools.
|
||||
|
||||
* app/posterize.[ch]
|
||||
* app/threshold.[ch]
|
||||
* app/histogram_tool.[ch]
|
||||
* app/hue_saturation.[ch]
|
||||
* app/levels.[ch]
|
||||
* app/brightness_contrast.[ch]
|
||||
* app/by_color_select.[ch]
|
||||
* app/color_balance.[ch]
|
||||
* app/curves.[ch]: Changed the *_initalize function prototypes from
|
||||
gpointer to GDisplay, to allow better type chacking and provide a
|
||||
uniform interface for all the dialog tools.
|
||||
|
||||
Sun Jun 21 15:49:43 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* app/tools.c (tools_select): Set active_tool before
|
||||
|
|
|
@ -403,21 +403,6 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
gimage_mask_shrink_callback, (gpointer) gdisp->gimage->ID);
|
||||
}
|
||||
|
||||
void
|
||||
select_by_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) BY_COLOR_SELECT].toolbar_position]);
|
||||
by_color_select_initialize ((void *) gdisp->gimage);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
select_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -661,112 +646,6 @@ image_invert_cmd_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_posterize_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) POSTERIZE].toolbar_position]);
|
||||
posterize_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_threshold_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) THRESHOLD].toolbar_position]);
|
||||
threshold_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_color_balance_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) COLOR_BALANCE].toolbar_position]);
|
||||
color_balance_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
image_brightness_contrast_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) BRIGHTNESS_CONTRAST].toolbar_position]);
|
||||
brightness_contrast_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_hue_saturation_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) HUE_SATURATION].toolbar_position]);
|
||||
hue_saturation_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_curves_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) CURVES].toolbar_position]);
|
||||
curves_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_levels_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) LEVELS].toolbar_position]);
|
||||
levels_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_desaturate_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -922,21 +801,6 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (image_scale->shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_histogram_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) HISTOGRAM].toolbar_position]);
|
||||
histogram_tool_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
layers_raise_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -1054,9 +918,21 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
/* Activate the approriate widget */
|
||||
gtk_widget_activate (tool_widgets[tool_info[callback_action].toolbar_position]);
|
||||
|
||||
if (!tool_info[callback_action].init_func)
|
||||
{
|
||||
/* Activate the approriate widget */
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if the tool_info has an init_func */
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
}
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
|
|
@ -56,20 +56,12 @@ void view_new_view_cmd_callback (GtkWidget *, gpointer);
|
|||
void view_shrink_wrap_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_equalize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_posterize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_threshold_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_color_balance_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_brightness_contrast_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_hue_saturation_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_curves_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_levels_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_desaturate_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_resize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_scale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_histogram_cmd_callback (GtkWidget *, gpointer);
|
||||
void channel_ops_duplicate_cmd_callback (GtkWidget *, gpointer);
|
||||
void channel_ops_offset_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_raise_cmd_callback (GtkWidget *, gpointer);
|
||||
|
|
|
@ -311,13 +311,10 @@ tools_free_color_balance (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
color_balance_initialize (void *gdisp_ptr)
|
||||
color_balance_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Color balance operates only on RGB color drawables.");
|
||||
|
@ -340,7 +337,7 @@ color_balance_initialize (void *gdisp_ptr)
|
|||
color_balance_dialog->yellow_blue[i] = 0.0;
|
||||
}
|
||||
color_balance_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
color_balance_dialog->image_map = image_map_create (gdisp_ptr, color_balance_dialog->drawable);
|
||||
color_balance_dialog->image_map = image_map_create (gdisp, color_balance_dialog->drawable);
|
||||
color_balance_update (color_balance_dialog, ALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_color_balance (void);
|
||||
void tools_free_color_balance (Tool *);
|
||||
|
||||
void color_balance_initialize (void *);
|
||||
void color_balance_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord color_balance_proc;
|
||||
|
|
|
@ -337,13 +337,10 @@ static MenuItem curve_type_items[] =
|
|||
};
|
||||
|
||||
void
|
||||
curves_initialize (void *gdisp_ptr)
|
||||
curves_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i, j;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Curves for indexed drawables cannot be adjusted.");
|
||||
|
@ -376,7 +373,7 @@ curves_initialize (void *gdisp_ptr)
|
|||
|
||||
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
curves_dialog->color = drawable_color ( (curves_dialog->drawable));
|
||||
curves_dialog->image_map = image_map_create (gdisp_ptr, curves_dialog->drawable);
|
||||
curves_dialog->image_map = image_map_create (gdisp, curves_dialog->drawable);
|
||||
|
||||
/* check for alpha channel */
|
||||
if (drawable_has_alpha ( (curves_dialog->drawable)))
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_curves (void);
|
||||
void tools_free_curves (Tool *);
|
||||
|
||||
void curves_initialize (void *);
|
||||
void curves_initialize (GDisplay *);
|
||||
void curves_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -355,13 +355,10 @@ tools_free_hue_saturation (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
hue_saturation_initialize (void *gdisp_ptr)
|
||||
hue_saturation_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Hue-Saturation operates only on RGB color drawables.");
|
||||
|
@ -383,7 +380,7 @@ hue_saturation_initialize (void *gdisp_ptr)
|
|||
}
|
||||
|
||||
hue_saturation_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
hue_saturation_dialog->image_map = image_map_create (gdisp_ptr, hue_saturation_dialog->drawable);
|
||||
hue_saturation_dialog->image_map = image_map_create (gdisp, hue_saturation_dialog->drawable);
|
||||
hue_saturation_update (hue_saturation_dialog, ALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_hue_saturation (void);
|
||||
void tools_free_hue_saturation (Tool *);
|
||||
|
||||
void hue_saturation_initialize (void *);
|
||||
void hue_saturation_initialize (GDisplay *);
|
||||
void hue_saturation_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -335,12 +335,8 @@ tools_free_threshold (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
threshold_initialize (void *gdisp_ptr)
|
||||
threshold_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Threshold does not operate on indexed drawables.");
|
||||
|
@ -356,7 +352,7 @@ threshold_initialize (void *gdisp_ptr)
|
|||
|
||||
threshold_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
threshold_dialog->color = drawable_color (threshold_dialog->drawable);
|
||||
threshold_dialog->image_map = image_map_create (gdisp_ptr, threshold_dialog->drawable);
|
||||
threshold_dialog->image_map = image_map_create (gdisp, threshold_dialog->drawable);
|
||||
histogram_update (threshold_dialog->histogram,
|
||||
threshold_dialog->drawable,
|
||||
threshold_histogram_info,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_threshold (void);
|
||||
void tools_free_threshold (Tool *);
|
||||
|
||||
void threshold_initialize (void *);
|
||||
void threshold_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord threshold_proc;
|
||||
|
|
|
@ -173,7 +173,7 @@ bezier_select_load (void *gdisp_ptr,
|
|||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
/* select the bezier tool */
|
||||
gtk_widget_activate (tool_widgets[tool_info[BEZIER_SELECT].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[BEZIER_SELECT].tool_widget);
|
||||
tool = active_tool;
|
||||
tool->state = ACTIVE;
|
||||
tool->gdisp_ptr = gdisp_ptr;
|
||||
|
|
|
@ -278,12 +278,8 @@ tools_free_brightness_contrast (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
brightness_contrast_initialize (void *gdisp_ptr)
|
||||
brightness_contrast_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Brightness-Contrast does not operate on indexed drawables.");
|
||||
|
@ -303,7 +299,7 @@ brightness_contrast_initialize (void *gdisp_ptr)
|
|||
brightness_contrast_dialog->contrast = 0.0;
|
||||
|
||||
brightness_contrast_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
brightness_contrast_dialog->image_map = image_map_create (gdisp_ptr,
|
||||
brightness_contrast_dialog->image_map = image_map_create (gdisp,
|
||||
brightness_contrast_dialog->drawable);
|
||||
|
||||
brightness_contrast_update (brightness_contrast_dialog, ALL);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_brightness_contrast (void);
|
||||
void tools_free_brightness_contrast (Tool *);
|
||||
|
||||
void brightness_contrast_initialize (void *);
|
||||
void brightness_contrast_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord brightness_contrast_proc;
|
||||
|
|
|
@ -505,12 +505,8 @@ tools_free_by_color_select (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
by_color_select_initialize (void *gimage_ptr)
|
||||
by_color_select_initialize_by_image (GImage *gimage)
|
||||
{
|
||||
GImage *gimage;
|
||||
|
||||
gimage = (GImage *) gimage_ptr;
|
||||
|
||||
/* update the preview window */
|
||||
if (by_color_dialog)
|
||||
{
|
||||
|
@ -521,6 +517,12 @@ by_color_select_initialize (void *gimage_ptr)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
by_color_select_initialize (GDisplay *gdisp)
|
||||
{
|
||||
/* wrap this call so the tool_info->init_func works */
|
||||
by_color_select_initialize_by_image (gdisp->gimage);
|
||||
}
|
||||
|
||||
/****************************/
|
||||
/* Select by Color dialog */
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
Tool * tools_new_by_color_select (void);
|
||||
void tools_free_by_color_select (Tool *);
|
||||
|
||||
void by_color_select_initialize (void *);
|
||||
void by_color_select_initialize (GDisplay *);
|
||||
void by_color_select_initialize_by_image (GImage *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord by_color_select_proc;
|
||||
|
|
|
@ -311,13 +311,10 @@ tools_free_color_balance (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
color_balance_initialize (void *gdisp_ptr)
|
||||
color_balance_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Color balance operates only on RGB color drawables.");
|
||||
|
@ -340,7 +337,7 @@ color_balance_initialize (void *gdisp_ptr)
|
|||
color_balance_dialog->yellow_blue[i] = 0.0;
|
||||
}
|
||||
color_balance_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
color_balance_dialog->image_map = image_map_create (gdisp_ptr, color_balance_dialog->drawable);
|
||||
color_balance_dialog->image_map = image_map_create (gdisp, color_balance_dialog->drawable);
|
||||
color_balance_update (color_balance_dialog, ALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_color_balance (void);
|
||||
void tools_free_color_balance (Tool *);
|
||||
|
||||
void color_balance_initialize (void *);
|
||||
void color_balance_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord color_balance_proc;
|
||||
|
|
154
app/commands.c
154
app/commands.c
|
@ -403,21 +403,6 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
gimage_mask_shrink_callback, (gpointer) gdisp->gimage->ID);
|
||||
}
|
||||
|
||||
void
|
||||
select_by_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) BY_COLOR_SELECT].toolbar_position]);
|
||||
by_color_select_initialize ((void *) gdisp->gimage);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
select_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -661,112 +646,6 @@ image_invert_cmd_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_posterize_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) POSTERIZE].toolbar_position]);
|
||||
posterize_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_threshold_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) THRESHOLD].toolbar_position]);
|
||||
threshold_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_color_balance_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) COLOR_BALANCE].toolbar_position]);
|
||||
color_balance_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
image_brightness_contrast_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) BRIGHTNESS_CONTRAST].toolbar_position]);
|
||||
brightness_contrast_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_hue_saturation_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) HUE_SATURATION].toolbar_position]);
|
||||
hue_saturation_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_curves_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) CURVES].toolbar_position]);
|
||||
curves_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_levels_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) LEVELS].toolbar_position]);
|
||||
levels_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_desaturate_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -922,21 +801,6 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (image_scale->shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_histogram_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) HISTOGRAM].toolbar_position]);
|
||||
histogram_tool_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
layers_raise_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -1054,9 +918,21 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
/* Activate the approriate widget */
|
||||
gtk_widget_activate (tool_widgets[tool_info[callback_action].toolbar_position]);
|
||||
|
||||
if (!tool_info[callback_action].init_func)
|
||||
{
|
||||
/* Activate the approriate widget */
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if the tool_info has an init_func */
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
}
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
|
|
@ -56,20 +56,12 @@ void view_new_view_cmd_callback (GtkWidget *, gpointer);
|
|||
void view_shrink_wrap_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_equalize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_posterize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_threshold_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_color_balance_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_brightness_contrast_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_hue_saturation_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_curves_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_levels_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_desaturate_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_resize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_scale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_histogram_cmd_callback (GtkWidget *, gpointer);
|
||||
void channel_ops_duplicate_cmd_callback (GtkWidget *, gpointer);
|
||||
void channel_ops_offset_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_raise_cmd_callback (GtkWidget *, gpointer);
|
||||
|
|
|
@ -760,7 +760,7 @@ undo_pop_mask (GImage *gimage,
|
|||
* for this gimage's mask, send it an update notice
|
||||
*/
|
||||
if (gimage->by_color_select)
|
||||
by_color_select_initialize ((void *) gimage);
|
||||
by_color_select_initialize_by_image (gimage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -337,13 +337,10 @@ static MenuItem curve_type_items[] =
|
|||
};
|
||||
|
||||
void
|
||||
curves_initialize (void *gdisp_ptr)
|
||||
curves_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i, j;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Curves for indexed drawables cannot be adjusted.");
|
||||
|
@ -376,7 +373,7 @@ curves_initialize (void *gdisp_ptr)
|
|||
|
||||
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
curves_dialog->color = drawable_color ( (curves_dialog->drawable));
|
||||
curves_dialog->image_map = image_map_create (gdisp_ptr, curves_dialog->drawable);
|
||||
curves_dialog->image_map = image_map_create (gdisp, curves_dialog->drawable);
|
||||
|
||||
/* check for alpha channel */
|
||||
if (drawable_has_alpha ( (curves_dialog->drawable)))
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_curves (void);
|
||||
void tools_free_curves (Tool *);
|
||||
|
||||
void curves_initialize (void *);
|
||||
void curves_initialize (GDisplay *);
|
||||
void curves_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -365,7 +365,7 @@ select_device (guint32 new_device)
|
|||
{
|
||||
if (device_info->brush)
|
||||
select_brush (device_info->brush);
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) device_info->tool].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) device_info->tool].tool_widget);
|
||||
palette_set_foreground (device_info->foreground[0],
|
||||
device_info->foreground[1],
|
||||
device_info->foreground[2]);
|
||||
|
@ -799,6 +799,7 @@ device_status_update (guint32 deviceid)
|
|||
create_tool_pixmap (deviceD->table,
|
||||
device_info->tool),
|
||||
NULL);
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
|
||||
for (j=0;j<20*3;j+=3)
|
||||
|
@ -822,3 +823,7 @@ device_status_update (guint32 deviceid)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -435,7 +435,7 @@ gdisplay_hruler_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) MOVE].tool_widget);
|
||||
move_tool_start_hguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ gdisplay_vruler_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) MOVE].tool_widget);
|
||||
move_tool_start_vguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ gdisplay_hruler_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) MOVE].tool_widget);
|
||||
move_tool_start_hguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ gdisplay_vruler_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) MOVE].tool_widget);
|
||||
move_tool_start_vguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ gdisplay_hruler_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) MOVE].tool_widget);
|
||||
move_tool_start_hguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ gdisplay_vruler_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) MOVE].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) MOVE].tool_widget);
|
||||
move_tool_start_vguide (active_tool, gdisp);
|
||||
gtk_grab_add (gdisp->canvas);
|
||||
}
|
||||
|
|
|
@ -65,144 +65,6 @@ static GdkPixmap *create_pixmap (GdkWindow *parent,
|
|||
int width,
|
||||
int height);
|
||||
|
||||
typedef struct _ToolButton ToolButton;
|
||||
|
||||
struct _ToolButton
|
||||
{
|
||||
char **icon_data;
|
||||
char *tool_desc;
|
||||
char *private_tip;
|
||||
gpointer callback_data;
|
||||
};
|
||||
|
||||
static ToolButton tool_data[] =
|
||||
{
|
||||
{ (char **) rect_bits,
|
||||
"Select rectangular regions",
|
||||
"ContextHelp/rect-select",
|
||||
(gpointer) RECT_SELECT },
|
||||
{ (char **) circ_bits,
|
||||
"Select elliptical regions",
|
||||
"ContextHelp/ellipse-select",
|
||||
(gpointer) ELLIPSE_SELECT },
|
||||
{ (char **) free_bits,
|
||||
"Select hand-drawn regions",
|
||||
"ContextHelp/free-select",
|
||||
(gpointer) FREE_SELECT },
|
||||
{ (char **) fuzzy_bits,
|
||||
"Select contiguous regions",
|
||||
"ContextHelp/fuzzy-select",
|
||||
(gpointer) FUZZY_SELECT },
|
||||
{ (char **) bezier_bits,
|
||||
"Select regions using Bezier curves",
|
||||
"ContextHelp/bezier-select",
|
||||
(gpointer) BEZIER_SELECT },
|
||||
{ (char **) iscissors_bits,
|
||||
"Select shapes from image",
|
||||
"ContextHelp/iscissors",
|
||||
(gpointer) ISCISSORS },
|
||||
{ (char **) move_bits,
|
||||
"Move layers & selections",
|
||||
"ContextHelp/move",
|
||||
(gpointer) MOVE },
|
||||
{ (char **) magnify_bits,
|
||||
"Zoom in & out",
|
||||
"ContextHelp/magnify",
|
||||
(gpointer) MAGNIFY },
|
||||
{ (char **) crop_bits,
|
||||
"Crop the image",
|
||||
"ContextHelp/crop",
|
||||
(gpointer) CROP },
|
||||
{ (char **) scale_bits,
|
||||
"Transform the layer or selection",
|
||||
"ContextHelp/rotate",
|
||||
(gpointer) ROTATE },
|
||||
{ (char **) horizflip_bits,
|
||||
"Flip the layer or selection",
|
||||
"ContextHelp/flip",
|
||||
(gpointer) FLIP_HORZ },
|
||||
{ (char **) text_bits,
|
||||
"Add text to the image",
|
||||
"ContextHelp/text",
|
||||
(gpointer) TEXT },
|
||||
{ (char **) colorpicker_bits,
|
||||
"Pick colors from the image",
|
||||
"ContextHelp/color-picker",
|
||||
(gpointer) COLOR_PICKER },
|
||||
{ (char **) fill_bits,
|
||||
"Fill with a color or pattern",
|
||||
"ContextHelp/bucket-fill",
|
||||
(gpointer) BUCKET_FILL },
|
||||
{ (char **) gradient_bits,
|
||||
"Fill with a color gradient",
|
||||
"ContextHelp/gradient",
|
||||
(gpointer) BLEND },
|
||||
{ (char **) pencil_bits,
|
||||
"Draw sharp pencil strokes",
|
||||
"ContextHelp/pencil",
|
||||
(gpointer) PENCIL },
|
||||
{ (char **) paint_bits,
|
||||
"Paint fuzzy brush strokes",
|
||||
"ContextHelp/paintbrush",
|
||||
(gpointer) PAINTBRUSH },
|
||||
{ (char **) erase_bits,
|
||||
"Erase to background or transparency",
|
||||
"ContextHelp/eraser",
|
||||
(gpointer) ERASER },
|
||||
{ (char **) airbrush_bits,
|
||||
"Airbrush with variable pressure",
|
||||
"ContextHelp/airbrush",
|
||||
(gpointer) AIRBRUSH },
|
||||
{ (char **) clone_bits,
|
||||
"Paint using patterns or image regions",
|
||||
"ContextHelp/clone",
|
||||
(gpointer) CLONE },
|
||||
{ (char **) blur_bits,
|
||||
"Blur or sharpen",
|
||||
"ContextHelp/convolve",
|
||||
(gpointer) CONVOLVE },
|
||||
{ (char **) ink_bits,
|
||||
"Draw in ink",
|
||||
"ContextHelp/ink",
|
||||
(gpointer) INK },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) BY_COLOR_SELECT },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) COLOR_BALANCE },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) BRIGHTNESS_CONTRAST },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) HUE_SATURATION },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) POSTERIZE },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) THRESHOLD },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) CURVES },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) LEVELS },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) HISTOGRAM }
|
||||
};
|
||||
|
||||
static int pixmap_colors[8][3] =
|
||||
{
|
||||
{ 0x00, 0x00, 0x00 }, /* a - 0 */
|
||||
|
@ -215,7 +77,8 @@ static int pixmap_colors[8][3] =
|
|||
{ 0xFF, 0xFF, 0xFF }, /* h - 255 */
|
||||
};
|
||||
|
||||
#define NUM_TOOLS (sizeof (tool_data) / sizeof (ToolButton))
|
||||
extern int num_tools;
|
||||
|
||||
#define COLUMNS 3
|
||||
#define ROWS 8
|
||||
#define MARGIN 2
|
||||
|
@ -223,7 +86,6 @@ static int pixmap_colors[8][3] =
|
|||
/* Widgets for each tool button--these are used from command.c to activate on
|
||||
* tool selection via both menus and keyboard accelerators.
|
||||
*/
|
||||
GtkWidget *tool_widgets[NUM_TOOLS];
|
||||
GtkWidget *tool_label;
|
||||
GtkTooltips *tool_tips;
|
||||
|
||||
|
@ -379,18 +241,24 @@ create_tool_pixmap (GtkWidget *parent, ToolType type)
|
|||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* FIXME this really should be dones without using the #defined tool names
|
||||
* but it should work this way for now
|
||||
*/
|
||||
if (type == SCALE || type == SHEAR || type == PERSPECTIVE)
|
||||
type = ROTATE;
|
||||
else if (type == FLIP_VERT)
|
||||
type = FLIP_HORZ;
|
||||
|
||||
for (i = FIRST_TOOLBOX_TOOL; i <= LAST_TOOLBOX_TOOL; i++)
|
||||
{
|
||||
if ((ToolType)tool_data[i].callback_data == type)
|
||||
if (tool_info[(int) type].icon_data)
|
||||
return create_pixmap (parent->window, NULL,
|
||||
tool_data[i].icon_data, 22, 22);
|
||||
}
|
||||
|
||||
tool_info[(int) type].icon_data,
|
||||
22, 22);
|
||||
else
|
||||
return create_pixmap (parent->window, NULL,
|
||||
dialog_bits,
|
||||
22, 22);
|
||||
|
||||
g_return_val_if_fail (FALSE, NULL);
|
||||
|
||||
return NULL; /* not reached */
|
||||
|
@ -404,7 +272,7 @@ create_tools (GtkWidget *parent)
|
|||
GtkWidget *alignment;
|
||||
GtkWidget *pixmap;
|
||||
GSList *group;
|
||||
gint i;
|
||||
gint i, j;
|
||||
|
||||
/*create_logo (parent);*/
|
||||
table = gtk_table_new (ROWS, COLUMNS, TRUE);
|
||||
|
@ -413,54 +281,56 @@ create_tools (GtkWidget *parent)
|
|||
|
||||
group = NULL;
|
||||
|
||||
for (i = 0; i < 22; i++)
|
||||
i = 0;
|
||||
for (j = 0; j < num_tools; j++)
|
||||
{
|
||||
tool_widgets[i] = button = gtk_radio_button_new (group);
|
||||
gtk_container_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
if (tool_info[j].icon_data)
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
gtk_container_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), button,
|
||||
(i % 3), (i % 3) + 1,
|
||||
(i / 3), (i / 3) + 1,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
0, 0);
|
||||
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), button,
|
||||
(i % 3), (i % 3) + 1,
|
||||
(i / 3), (i / 3) + 1,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
0, 0);
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = create_pixmap_widget (table->window, tool_data[i].icon_data, 22, 22);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
tool_data[i].callback_data);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
(GtkSignalFunc) tools_button_press,
|
||||
tool_data[i].callback_data);
|
||||
|
||||
gtk_tooltips_set_tip (tool_tips, button, tool_data[i].tool_desc, tool_data[i].private_tip);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
/* The non-visible tool buttons */
|
||||
for (i = 22; i < NUM_TOOLS; i++)
|
||||
{
|
||||
tool_widgets[i] = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
tool_data[i].callback_data);
|
||||
}
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = create_pixmap_widget (table->window, tool_info[j].icon_data, 22, 22);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
(GtkSignalFunc) tools_button_press,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
|
||||
gtk_tooltips_set_tip (tool_tips, button, tool_info[j].tool_desc, tool_info[i].private_tip);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
}
|
||||
}
|
||||
gtk_widget_show (table);
|
||||
}
|
||||
|
||||
|
@ -654,9 +524,10 @@ toolbox_free ()
|
|||
|
||||
gdk_window_get_position (toolbox_shell->window, &toolbox_x, &toolbox_y);
|
||||
gtk_widget_destroy (toolbox_shell);
|
||||
for (i = 22; i < NUM_TOOLS; i++)
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
gtk_object_sink (GTK_OBJECT (tool_widgets[i]));
|
||||
if (!tool_info[i].icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget));
|
||||
}
|
||||
gtk_object_destroy (GTK_OBJECT (tool_tips));
|
||||
gtk_object_unref (GTK_OBJECT (tool_tips));
|
||||
|
|
|
@ -65,144 +65,6 @@ static GdkPixmap *create_pixmap (GdkWindow *parent,
|
|||
int width,
|
||||
int height);
|
||||
|
||||
typedef struct _ToolButton ToolButton;
|
||||
|
||||
struct _ToolButton
|
||||
{
|
||||
char **icon_data;
|
||||
char *tool_desc;
|
||||
char *private_tip;
|
||||
gpointer callback_data;
|
||||
};
|
||||
|
||||
static ToolButton tool_data[] =
|
||||
{
|
||||
{ (char **) rect_bits,
|
||||
"Select rectangular regions",
|
||||
"ContextHelp/rect-select",
|
||||
(gpointer) RECT_SELECT },
|
||||
{ (char **) circ_bits,
|
||||
"Select elliptical regions",
|
||||
"ContextHelp/ellipse-select",
|
||||
(gpointer) ELLIPSE_SELECT },
|
||||
{ (char **) free_bits,
|
||||
"Select hand-drawn regions",
|
||||
"ContextHelp/free-select",
|
||||
(gpointer) FREE_SELECT },
|
||||
{ (char **) fuzzy_bits,
|
||||
"Select contiguous regions",
|
||||
"ContextHelp/fuzzy-select",
|
||||
(gpointer) FUZZY_SELECT },
|
||||
{ (char **) bezier_bits,
|
||||
"Select regions using Bezier curves",
|
||||
"ContextHelp/bezier-select",
|
||||
(gpointer) BEZIER_SELECT },
|
||||
{ (char **) iscissors_bits,
|
||||
"Select shapes from image",
|
||||
"ContextHelp/iscissors",
|
||||
(gpointer) ISCISSORS },
|
||||
{ (char **) move_bits,
|
||||
"Move layers & selections",
|
||||
"ContextHelp/move",
|
||||
(gpointer) MOVE },
|
||||
{ (char **) magnify_bits,
|
||||
"Zoom in & out",
|
||||
"ContextHelp/magnify",
|
||||
(gpointer) MAGNIFY },
|
||||
{ (char **) crop_bits,
|
||||
"Crop the image",
|
||||
"ContextHelp/crop",
|
||||
(gpointer) CROP },
|
||||
{ (char **) scale_bits,
|
||||
"Transform the layer or selection",
|
||||
"ContextHelp/rotate",
|
||||
(gpointer) ROTATE },
|
||||
{ (char **) horizflip_bits,
|
||||
"Flip the layer or selection",
|
||||
"ContextHelp/flip",
|
||||
(gpointer) FLIP_HORZ },
|
||||
{ (char **) text_bits,
|
||||
"Add text to the image",
|
||||
"ContextHelp/text",
|
||||
(gpointer) TEXT },
|
||||
{ (char **) colorpicker_bits,
|
||||
"Pick colors from the image",
|
||||
"ContextHelp/color-picker",
|
||||
(gpointer) COLOR_PICKER },
|
||||
{ (char **) fill_bits,
|
||||
"Fill with a color or pattern",
|
||||
"ContextHelp/bucket-fill",
|
||||
(gpointer) BUCKET_FILL },
|
||||
{ (char **) gradient_bits,
|
||||
"Fill with a color gradient",
|
||||
"ContextHelp/gradient",
|
||||
(gpointer) BLEND },
|
||||
{ (char **) pencil_bits,
|
||||
"Draw sharp pencil strokes",
|
||||
"ContextHelp/pencil",
|
||||
(gpointer) PENCIL },
|
||||
{ (char **) paint_bits,
|
||||
"Paint fuzzy brush strokes",
|
||||
"ContextHelp/paintbrush",
|
||||
(gpointer) PAINTBRUSH },
|
||||
{ (char **) erase_bits,
|
||||
"Erase to background or transparency",
|
||||
"ContextHelp/eraser",
|
||||
(gpointer) ERASER },
|
||||
{ (char **) airbrush_bits,
|
||||
"Airbrush with variable pressure",
|
||||
"ContextHelp/airbrush",
|
||||
(gpointer) AIRBRUSH },
|
||||
{ (char **) clone_bits,
|
||||
"Paint using patterns or image regions",
|
||||
"ContextHelp/clone",
|
||||
(gpointer) CLONE },
|
||||
{ (char **) blur_bits,
|
||||
"Blur or sharpen",
|
||||
"ContextHelp/convolve",
|
||||
(gpointer) CONVOLVE },
|
||||
{ (char **) ink_bits,
|
||||
"Draw in ink",
|
||||
"ContextHelp/ink",
|
||||
(gpointer) INK },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) BY_COLOR_SELECT },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) COLOR_BALANCE },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) BRIGHTNESS_CONTRAST },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) HUE_SATURATION },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) POSTERIZE },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) THRESHOLD },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) CURVES },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) LEVELS },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) HISTOGRAM }
|
||||
};
|
||||
|
||||
static int pixmap_colors[8][3] =
|
||||
{
|
||||
{ 0x00, 0x00, 0x00 }, /* a - 0 */
|
||||
|
@ -215,7 +77,8 @@ static int pixmap_colors[8][3] =
|
|||
{ 0xFF, 0xFF, 0xFF }, /* h - 255 */
|
||||
};
|
||||
|
||||
#define NUM_TOOLS (sizeof (tool_data) / sizeof (ToolButton))
|
||||
extern int num_tools;
|
||||
|
||||
#define COLUMNS 3
|
||||
#define ROWS 8
|
||||
#define MARGIN 2
|
||||
|
@ -223,7 +86,6 @@ static int pixmap_colors[8][3] =
|
|||
/* Widgets for each tool button--these are used from command.c to activate on
|
||||
* tool selection via both menus and keyboard accelerators.
|
||||
*/
|
||||
GtkWidget *tool_widgets[NUM_TOOLS];
|
||||
GtkWidget *tool_label;
|
||||
GtkTooltips *tool_tips;
|
||||
|
||||
|
@ -379,18 +241,24 @@ create_tool_pixmap (GtkWidget *parent, ToolType type)
|
|||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* FIXME this really should be dones without using the #defined tool names
|
||||
* but it should work this way for now
|
||||
*/
|
||||
if (type == SCALE || type == SHEAR || type == PERSPECTIVE)
|
||||
type = ROTATE;
|
||||
else if (type == FLIP_VERT)
|
||||
type = FLIP_HORZ;
|
||||
|
||||
for (i = FIRST_TOOLBOX_TOOL; i <= LAST_TOOLBOX_TOOL; i++)
|
||||
{
|
||||
if ((ToolType)tool_data[i].callback_data == type)
|
||||
if (tool_info[(int) type].icon_data)
|
||||
return create_pixmap (parent->window, NULL,
|
||||
tool_data[i].icon_data, 22, 22);
|
||||
}
|
||||
|
||||
tool_info[(int) type].icon_data,
|
||||
22, 22);
|
||||
else
|
||||
return create_pixmap (parent->window, NULL,
|
||||
dialog_bits,
|
||||
22, 22);
|
||||
|
||||
g_return_val_if_fail (FALSE, NULL);
|
||||
|
||||
return NULL; /* not reached */
|
||||
|
@ -404,7 +272,7 @@ create_tools (GtkWidget *parent)
|
|||
GtkWidget *alignment;
|
||||
GtkWidget *pixmap;
|
||||
GSList *group;
|
||||
gint i;
|
||||
gint i, j;
|
||||
|
||||
/*create_logo (parent);*/
|
||||
table = gtk_table_new (ROWS, COLUMNS, TRUE);
|
||||
|
@ -413,54 +281,56 @@ create_tools (GtkWidget *parent)
|
|||
|
||||
group = NULL;
|
||||
|
||||
for (i = 0; i < 22; i++)
|
||||
i = 0;
|
||||
for (j = 0; j < num_tools; j++)
|
||||
{
|
||||
tool_widgets[i] = button = gtk_radio_button_new (group);
|
||||
gtk_container_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
if (tool_info[j].icon_data)
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
gtk_container_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), button,
|
||||
(i % 3), (i % 3) + 1,
|
||||
(i / 3), (i / 3) + 1,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
0, 0);
|
||||
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), button,
|
||||
(i % 3), (i % 3) + 1,
|
||||
(i / 3), (i / 3) + 1,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
0, 0);
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = create_pixmap_widget (table->window, tool_data[i].icon_data, 22, 22);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
tool_data[i].callback_data);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
(GtkSignalFunc) tools_button_press,
|
||||
tool_data[i].callback_data);
|
||||
|
||||
gtk_tooltips_set_tip (tool_tips, button, tool_data[i].tool_desc, tool_data[i].private_tip);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
/* The non-visible tool buttons */
|
||||
for (i = 22; i < NUM_TOOLS; i++)
|
||||
{
|
||||
tool_widgets[i] = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
tool_data[i].callback_data);
|
||||
}
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = create_pixmap_widget (table->window, tool_info[j].icon_data, 22, 22);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
(GtkSignalFunc) tools_button_press,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
|
||||
gtk_tooltips_set_tip (tool_tips, button, tool_info[j].tool_desc, tool_info[i].private_tip);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
}
|
||||
}
|
||||
gtk_widget_show (table);
|
||||
}
|
||||
|
||||
|
@ -654,9 +524,10 @@ toolbox_free ()
|
|||
|
||||
gdk_window_get_position (toolbox_shell->window, &toolbox_x, &toolbox_y);
|
||||
gtk_widget_destroy (toolbox_shell);
|
||||
for (i = 22; i < NUM_TOOLS; i++)
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
gtk_object_sink (GTK_OBJECT (tool_widgets[i]));
|
||||
if (!tool_info[i].icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget));
|
||||
}
|
||||
gtk_object_destroy (GTK_OBJECT (tool_tips));
|
||||
gtk_object_unref (GTK_OBJECT (tool_tips));
|
||||
|
|
|
@ -403,21 +403,6 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
gimage_mask_shrink_callback, (gpointer) gdisp->gimage->ID);
|
||||
}
|
||||
|
||||
void
|
||||
select_by_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) BY_COLOR_SELECT].toolbar_position]);
|
||||
by_color_select_initialize ((void *) gdisp->gimage);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
select_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -661,112 +646,6 @@ image_invert_cmd_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_posterize_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) POSTERIZE].toolbar_position]);
|
||||
posterize_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_threshold_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) THRESHOLD].toolbar_position]);
|
||||
threshold_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_color_balance_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) COLOR_BALANCE].toolbar_position]);
|
||||
color_balance_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
image_brightness_contrast_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) BRIGHTNESS_CONTRAST].toolbar_position]);
|
||||
brightness_contrast_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_hue_saturation_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) HUE_SATURATION].toolbar_position]);
|
||||
hue_saturation_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_curves_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) CURVES].toolbar_position]);
|
||||
curves_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_levels_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) LEVELS].toolbar_position]);
|
||||
levels_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_desaturate_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -922,21 +801,6 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (image_scale->shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_histogram_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) HISTOGRAM].toolbar_position]);
|
||||
histogram_tool_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
layers_raise_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -1054,9 +918,21 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
/* Activate the approriate widget */
|
||||
gtk_widget_activate (tool_widgets[tool_info[callback_action].toolbar_position]);
|
||||
|
||||
if (!tool_info[callback_action].init_func)
|
||||
{
|
||||
/* Activate the approriate widget */
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if the tool_info has an init_func */
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
}
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
|
|
@ -56,20 +56,12 @@ void view_new_view_cmd_callback (GtkWidget *, gpointer);
|
|||
void view_shrink_wrap_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_equalize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_posterize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_threshold_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_color_balance_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_brightness_contrast_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_hue_saturation_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_curves_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_levels_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_desaturate_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_resize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_scale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_histogram_cmd_callback (GtkWidget *, gpointer);
|
||||
void channel_ops_duplicate_cmd_callback (GtkWidget *, gpointer);
|
||||
void channel_ops_offset_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_raise_cmd_callback (GtkWidget *, gpointer);
|
||||
|
|
|
@ -365,7 +365,7 @@ select_device (guint32 new_device)
|
|||
{
|
||||
if (device_info->brush)
|
||||
select_brush (device_info->brush);
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) device_info->tool].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) device_info->tool].tool_widget);
|
||||
palette_set_foreground (device_info->foreground[0],
|
||||
device_info->foreground[1],
|
||||
device_info->foreground[2]);
|
||||
|
@ -799,6 +799,7 @@ device_status_update (guint32 deviceid)
|
|||
create_tool_pixmap (deviceD->table,
|
||||
device_info->tool),
|
||||
NULL);
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
|
||||
for (j=0;j<20*3;j+=3)
|
||||
|
@ -822,3 +823,7 @@ device_status_update (guint32 deviceid)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -403,21 +403,6 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
gimage_mask_shrink_callback, (gpointer) gdisp->gimage->ID);
|
||||
}
|
||||
|
||||
void
|
||||
select_by_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) BY_COLOR_SELECT].toolbar_position]);
|
||||
by_color_select_initialize ((void *) gdisp->gimage);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
select_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -661,112 +646,6 @@ image_invert_cmd_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_posterize_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) POSTERIZE].toolbar_position]);
|
||||
posterize_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_threshold_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) THRESHOLD].toolbar_position]);
|
||||
threshold_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_color_balance_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) COLOR_BALANCE].toolbar_position]);
|
||||
color_balance_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
image_brightness_contrast_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) BRIGHTNESS_CONTRAST].toolbar_position]);
|
||||
brightness_contrast_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_hue_saturation_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) HUE_SATURATION].toolbar_position]);
|
||||
hue_saturation_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_curves_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) CURVES].toolbar_position]);
|
||||
curves_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_levels_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) LEVELS].toolbar_position]);
|
||||
levels_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_desaturate_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -922,21 +801,6 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (image_scale->shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_histogram_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) HISTOGRAM].toolbar_position]);
|
||||
histogram_tool_initialize ((void *) gdisp);
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
layers_raise_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
@ -1054,9 +918,21 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
/* Activate the approriate widget */
|
||||
gtk_widget_activate (tool_widgets[tool_info[callback_action].toolbar_position]);
|
||||
|
||||
if (!tool_info[callback_action].init_func)
|
||||
{
|
||||
/* Activate the approriate widget */
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if the tool_info has an init_func */
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
gtk_widget_activate (tool_info[callback_action].tool_widget);
|
||||
|
||||
(* tool_info[callback_action].init_func) (gdisp);
|
||||
}
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
active_tool->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
|
|
@ -56,20 +56,12 @@ void view_new_view_cmd_callback (GtkWidget *, gpointer);
|
|||
void view_shrink_wrap_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_equalize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_posterize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_threshold_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_color_balance_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_brightness_contrast_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_hue_saturation_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_curves_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_levels_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_desaturate_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_resize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_scale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_histogram_cmd_callback (GtkWidget *, gpointer);
|
||||
void channel_ops_duplicate_cmd_callback (GtkWidget *, gpointer);
|
||||
void channel_ops_offset_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_raise_cmd_callback (GtkWidget *, gpointer);
|
||||
|
|
|
@ -365,7 +365,7 @@ select_device (guint32 new_device)
|
|||
{
|
||||
if (device_info->brush)
|
||||
select_brush (device_info->brush);
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) device_info->tool].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) device_info->tool].tool_widget);
|
||||
palette_set_foreground (device_info->foreground[0],
|
||||
device_info->foreground[1],
|
||||
device_info->foreground[2]);
|
||||
|
@ -799,6 +799,7 @@ device_status_update (guint32 deviceid)
|
|||
create_tool_pixmap (deviceD->table,
|
||||
device_info->tool),
|
||||
NULL);
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
|
||||
for (j=0;j<20*3;j+=3)
|
||||
|
@ -822,3 +823,7 @@ device_status_update (guint32 deviceid)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -94,8 +94,9 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Select/Grow", NULL, select_grow_cmd_callback, 0 },
|
||||
{ "/Select/Shrink", NULL, select_shrink_cmd_callback, 0 },
|
||||
{ "/Select/Save To Channel", NULL, select_save_cmd_callback, 0 },
|
||||
{ "/Select/By Color...", NULL, select_by_color_cmd_callback, 0 },
|
||||
|
||||
/*
|
||||
{ "/Select/By Color...", NULL, tools_select_cmd_callback, BY_COLOR_SELECT },
|
||||
*/
|
||||
{ "/View/Zoom In", "equal", view_zoomin_cmd_callback, 0 },
|
||||
{ "/View/Zoom Out", "minus", view_zoomout_cmd_callback, 0 },
|
||||
{ "/View/Zoom/16:1", NULL, view_zoom_16_1_callback, 0 },
|
||||
|
@ -117,14 +118,16 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
|
||||
{ "/Image/Colors/Equalize", NULL, image_equalize_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Invert", NULL, image_invert_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Posterize", NULL, image_posterize_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Threshold", NULL, image_threshold_cmd_callback, 0 },
|
||||
/*
|
||||
{ "/Image/Colors/Posterize", NULL, tools_select_cmd_callback, POSTERIZE },
|
||||
{ "/Image/Colors/Threshold", NULL, tools_select_cmd_callback, THRESHOLD },
|
||||
{ "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Colors/Color Balance", NULL, image_color_balance_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Brightness-Contrast", NULL, image_brightness_contrast_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Hue-Saturation", NULL, image_hue_saturation_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Curves", NULL, image_curves_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Levels", NULL, image_levels_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Color Balance", NULL, tools_select_cmd_callback, COLOR_BALANCE },
|
||||
{ "/Image/Colors/Brightness-Contrast", NULL, tools_select_cmd_callback, BRIGHTNESS_CONTRAST },
|
||||
{ "/Image/Colors/Hue-Saturation", NULL, tools_select_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Curves", NULL, tools_select_cmd_callback, CURVES },
|
||||
{ "/Image/Colors/Levels", NULL, tools_select_cmd_callback, LEVELS },
|
||||
*/
|
||||
{ "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Colors/Desaturate", NULL, image_desaturate_cmd_callback, 0 },
|
||||
{ "/Image/Channel Ops/Duplicate", "<control>D", channel_ops_duplicate_cmd_callback, 0 },
|
||||
|
@ -139,7 +142,7 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Image/Resize", NULL, image_resize_cmd_callback, 0 },
|
||||
{ "/Image/Scale", NULL, image_scale_cmd_callback, 0 },
|
||||
{ "/Image/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Histogram", NULL, image_histogram_cmd_callback, 0 },
|
||||
/* { "/Image/Histogram", NULL, tools_select_cmd_callback, HISTOGRAM}, */
|
||||
{ "/Image/---", NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ "/Layers/Layers & Channels...", "<control>L", dialogs_lc_cmd_callback, 0 },
|
||||
|
@ -152,7 +155,7 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Layers/Mask To Selection", NULL, layers_mask_select_cmd_callback, 0 },
|
||||
{ "/Layers/Add Alpha Channel", NULL, layers_add_alpha_channel_cmd_callback, 0 },
|
||||
|
||||
{ "/Tools/Rect Select", "R", tools_select_cmd_callback, RECT_SELECT },
|
||||
/* { "/Tools/Rect Select", "R", tools_select_cmd_callback, RECT_SELECT },
|
||||
{ "/Tools/Ellipse Select", "E", tools_select_cmd_callback, ELLIPSE_SELECT },
|
||||
{ "/Tools/Free Select", "F", tools_select_cmd_callback, FREE_SELECT },
|
||||
{ "/Tools/Fuzzy Select", "Z", tools_select_cmd_callback, FUZZY_SELECT },
|
||||
|
@ -175,10 +178,9 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Tools/Convolve", "V", tools_select_cmd_callback, CONVOLVE },
|
||||
{ "/Tools/Ink", "K", tools_select_cmd_callback, INK },
|
||||
{ "/Tools/Default Colors", "D", tools_default_colors_cmd_callback, 0 },
|
||||
{ "/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, 0 },
|
||||
{ "/Tools/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, 0 }, */
|
||||
{ "/Tools/Toolbox", NULL, toolbox_raise_callback, 0 },
|
||||
|
||||
{ "/Tools/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Filters/", NULL, NULL, 0 },
|
||||
{ "/Filters/Repeat last", "<alt>F", filters_repeat_cmd_callback, 0x0 },
|
||||
{ "/Filters/Re-show last", "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
|
||||
|
@ -217,6 +219,7 @@ static GtkItemFactory *save_factory = NULL;
|
|||
|
||||
static int initialize = TRUE;
|
||||
|
||||
extern int num_tools;
|
||||
|
||||
void
|
||||
menus_get_toolbox_menubar (GtkWidget **menubar,
|
||||
|
@ -280,6 +283,28 @@ menus_create (GtkMenuEntry *entries,
|
|||
gtk_item_factory_create_menu_entries (nmenu_entries, entries);
|
||||
}
|
||||
|
||||
void
|
||||
menus_tools_create (ToolInfo *tool_info)
|
||||
{
|
||||
GtkItemFactoryEntry entry;
|
||||
|
||||
/* entry.path = g_strconcat ("<Image>", tool_info->menu_path, NULL);*/
|
||||
/* entry.callback_data = tool_info; */
|
||||
entry.path = tool_info->menu_path;
|
||||
entry.accelerator = tool_info->menu_accel;
|
||||
entry.callback = tools_select_cmd_callback;
|
||||
entry.callback_action = tool_info->tool_id;
|
||||
entry.item_type = NULL;
|
||||
|
||||
fflush(stderr);
|
||||
/*menus_create (&entry, 1);*/
|
||||
gtk_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
(gpointer)tool_info,
|
||||
2);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
menus_set_sensitive (char *path,
|
||||
int sensitive)
|
||||
|
@ -359,6 +384,8 @@ menus_quit ()
|
|||
static void
|
||||
menus_init ()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (initialize)
|
||||
{
|
||||
gchar *filename;
|
||||
|
@ -385,9 +412,19 @@ menus_init ()
|
|||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (tool_info+i);
|
||||
}
|
||||
filename = g_strconcat (gimp_directory (), "/menurc", NULL);
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -379,12 +379,8 @@ tools_free_histogram_tool (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
histogram_tool_initialize (void *gdisp_ptr)
|
||||
histogram_tool_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Histogram does not operate on indexed drawables.");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_histogram_tool (void);
|
||||
void tools_free_histogram_tool (Tool *);
|
||||
|
||||
void histogram_tool_initialize (void *);
|
||||
void histogram_tool_initialize (GDisplay *);
|
||||
void histogram_tool_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -355,13 +355,10 @@ tools_free_hue_saturation (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
hue_saturation_initialize (void *gdisp_ptr)
|
||||
hue_saturation_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Hue-Saturation operates only on RGB color drawables.");
|
||||
|
@ -383,7 +380,7 @@ hue_saturation_initialize (void *gdisp_ptr)
|
|||
}
|
||||
|
||||
hue_saturation_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
hue_saturation_dialog->image_map = image_map_create (gdisp_ptr, hue_saturation_dialog->drawable);
|
||||
hue_saturation_dialog->image_map = image_map_create (gdisp, hue_saturation_dialog->drawable);
|
||||
hue_saturation_update (hue_saturation_dialog, ALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_hue_saturation (void);
|
||||
void tools_free_hue_saturation (Tool *);
|
||||
|
||||
void hue_saturation_initialize (void *);
|
||||
void hue_saturation_initialize (GDisplay *);
|
||||
void hue_saturation_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
259
app/interface.c
259
app/interface.c
|
@ -65,144 +65,6 @@ static GdkPixmap *create_pixmap (GdkWindow *parent,
|
|||
int width,
|
||||
int height);
|
||||
|
||||
typedef struct _ToolButton ToolButton;
|
||||
|
||||
struct _ToolButton
|
||||
{
|
||||
char **icon_data;
|
||||
char *tool_desc;
|
||||
char *private_tip;
|
||||
gpointer callback_data;
|
||||
};
|
||||
|
||||
static ToolButton tool_data[] =
|
||||
{
|
||||
{ (char **) rect_bits,
|
||||
"Select rectangular regions",
|
||||
"ContextHelp/rect-select",
|
||||
(gpointer) RECT_SELECT },
|
||||
{ (char **) circ_bits,
|
||||
"Select elliptical regions",
|
||||
"ContextHelp/ellipse-select",
|
||||
(gpointer) ELLIPSE_SELECT },
|
||||
{ (char **) free_bits,
|
||||
"Select hand-drawn regions",
|
||||
"ContextHelp/free-select",
|
||||
(gpointer) FREE_SELECT },
|
||||
{ (char **) fuzzy_bits,
|
||||
"Select contiguous regions",
|
||||
"ContextHelp/fuzzy-select",
|
||||
(gpointer) FUZZY_SELECT },
|
||||
{ (char **) bezier_bits,
|
||||
"Select regions using Bezier curves",
|
||||
"ContextHelp/bezier-select",
|
||||
(gpointer) BEZIER_SELECT },
|
||||
{ (char **) iscissors_bits,
|
||||
"Select shapes from image",
|
||||
"ContextHelp/iscissors",
|
||||
(gpointer) ISCISSORS },
|
||||
{ (char **) move_bits,
|
||||
"Move layers & selections",
|
||||
"ContextHelp/move",
|
||||
(gpointer) MOVE },
|
||||
{ (char **) magnify_bits,
|
||||
"Zoom in & out",
|
||||
"ContextHelp/magnify",
|
||||
(gpointer) MAGNIFY },
|
||||
{ (char **) crop_bits,
|
||||
"Crop the image",
|
||||
"ContextHelp/crop",
|
||||
(gpointer) CROP },
|
||||
{ (char **) scale_bits,
|
||||
"Transform the layer or selection",
|
||||
"ContextHelp/rotate",
|
||||
(gpointer) ROTATE },
|
||||
{ (char **) horizflip_bits,
|
||||
"Flip the layer or selection",
|
||||
"ContextHelp/flip",
|
||||
(gpointer) FLIP_HORZ },
|
||||
{ (char **) text_bits,
|
||||
"Add text to the image",
|
||||
"ContextHelp/text",
|
||||
(gpointer) TEXT },
|
||||
{ (char **) colorpicker_bits,
|
||||
"Pick colors from the image",
|
||||
"ContextHelp/color-picker",
|
||||
(gpointer) COLOR_PICKER },
|
||||
{ (char **) fill_bits,
|
||||
"Fill with a color or pattern",
|
||||
"ContextHelp/bucket-fill",
|
||||
(gpointer) BUCKET_FILL },
|
||||
{ (char **) gradient_bits,
|
||||
"Fill with a color gradient",
|
||||
"ContextHelp/gradient",
|
||||
(gpointer) BLEND },
|
||||
{ (char **) pencil_bits,
|
||||
"Draw sharp pencil strokes",
|
||||
"ContextHelp/pencil",
|
||||
(gpointer) PENCIL },
|
||||
{ (char **) paint_bits,
|
||||
"Paint fuzzy brush strokes",
|
||||
"ContextHelp/paintbrush",
|
||||
(gpointer) PAINTBRUSH },
|
||||
{ (char **) erase_bits,
|
||||
"Erase to background or transparency",
|
||||
"ContextHelp/eraser",
|
||||
(gpointer) ERASER },
|
||||
{ (char **) airbrush_bits,
|
||||
"Airbrush with variable pressure",
|
||||
"ContextHelp/airbrush",
|
||||
(gpointer) AIRBRUSH },
|
||||
{ (char **) clone_bits,
|
||||
"Paint using patterns or image regions",
|
||||
"ContextHelp/clone",
|
||||
(gpointer) CLONE },
|
||||
{ (char **) blur_bits,
|
||||
"Blur or sharpen",
|
||||
"ContextHelp/convolve",
|
||||
(gpointer) CONVOLVE },
|
||||
{ (char **) ink_bits,
|
||||
"Draw in ink",
|
||||
"ContextHelp/ink",
|
||||
(gpointer) INK },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) BY_COLOR_SELECT },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) COLOR_BALANCE },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) BRIGHTNESS_CONTRAST },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) HUE_SATURATION },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) POSTERIZE },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) THRESHOLD },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) CURVES },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) LEVELS },
|
||||
{ NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(gpointer) HISTOGRAM }
|
||||
};
|
||||
|
||||
static int pixmap_colors[8][3] =
|
||||
{
|
||||
{ 0x00, 0x00, 0x00 }, /* a - 0 */
|
||||
|
@ -215,7 +77,8 @@ static int pixmap_colors[8][3] =
|
|||
{ 0xFF, 0xFF, 0xFF }, /* h - 255 */
|
||||
};
|
||||
|
||||
#define NUM_TOOLS (sizeof (tool_data) / sizeof (ToolButton))
|
||||
extern int num_tools;
|
||||
|
||||
#define COLUMNS 3
|
||||
#define ROWS 8
|
||||
#define MARGIN 2
|
||||
|
@ -223,7 +86,6 @@ static int pixmap_colors[8][3] =
|
|||
/* Widgets for each tool button--these are used from command.c to activate on
|
||||
* tool selection via both menus and keyboard accelerators.
|
||||
*/
|
||||
GtkWidget *tool_widgets[NUM_TOOLS];
|
||||
GtkWidget *tool_label;
|
||||
GtkTooltips *tool_tips;
|
||||
|
||||
|
@ -379,18 +241,24 @@ create_tool_pixmap (GtkWidget *parent, ToolType type)
|
|||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* FIXME this really should be dones without using the #defined tool names
|
||||
* but it should work this way for now
|
||||
*/
|
||||
if (type == SCALE || type == SHEAR || type == PERSPECTIVE)
|
||||
type = ROTATE;
|
||||
else if (type == FLIP_VERT)
|
||||
type = FLIP_HORZ;
|
||||
|
||||
for (i = FIRST_TOOLBOX_TOOL; i <= LAST_TOOLBOX_TOOL; i++)
|
||||
{
|
||||
if ((ToolType)tool_data[i].callback_data == type)
|
||||
if (tool_info[(int) type].icon_data)
|
||||
return create_pixmap (parent->window, NULL,
|
||||
tool_data[i].icon_data, 22, 22);
|
||||
}
|
||||
|
||||
tool_info[(int) type].icon_data,
|
||||
22, 22);
|
||||
else
|
||||
return create_pixmap (parent->window, NULL,
|
||||
dialog_bits,
|
||||
22, 22);
|
||||
|
||||
g_return_val_if_fail (FALSE, NULL);
|
||||
|
||||
return NULL; /* not reached */
|
||||
|
@ -404,7 +272,7 @@ create_tools (GtkWidget *parent)
|
|||
GtkWidget *alignment;
|
||||
GtkWidget *pixmap;
|
||||
GSList *group;
|
||||
gint i;
|
||||
gint i, j;
|
||||
|
||||
/*create_logo (parent);*/
|
||||
table = gtk_table_new (ROWS, COLUMNS, TRUE);
|
||||
|
@ -413,54 +281,56 @@ create_tools (GtkWidget *parent)
|
|||
|
||||
group = NULL;
|
||||
|
||||
for (i = 0; i < 22; i++)
|
||||
i = 0;
|
||||
for (j = 0; j < num_tools; j++)
|
||||
{
|
||||
tool_widgets[i] = button = gtk_radio_button_new (group);
|
||||
gtk_container_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
if (tool_info[j].icon_data)
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
gtk_container_border_width (GTK_CONTAINER (button), 0);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), button,
|
||||
(i % 3), (i % 3) + 1,
|
||||
(i / 3), (i / 3) + 1,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
0, 0);
|
||||
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), button,
|
||||
(i % 3), (i % 3) + 1,
|
||||
(i / 3), (i / 3) + 1,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
||||
0, 0);
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = create_pixmap_widget (table->window, tool_data[i].icon_data, 22, 22);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
tool_data[i].callback_data);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
(GtkSignalFunc) tools_button_press,
|
||||
tool_data[i].callback_data);
|
||||
|
||||
gtk_tooltips_set_tip (tool_tips, button, tool_data[i].tool_desc, tool_data[i].private_tip);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
/* The non-visible tool buttons */
|
||||
for (i = 22; i < NUM_TOOLS; i++)
|
||||
{
|
||||
tool_widgets[i] = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
tool_data[i].callback_data);
|
||||
}
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_border_width (GTK_CONTAINER (alignment), 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), alignment);
|
||||
|
||||
pixmap = create_pixmap_widget (table->window, tool_info[j].icon_data, 22, 22);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
(GtkSignalFunc) tools_button_press,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
|
||||
gtk_tooltips_set_tip (tool_tips, button, tool_info[j].tool_desc, tool_info[i].private_tip);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (alignment);
|
||||
gtk_widget_show (button);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) tools_select_update,
|
||||
(gpointer) tool_info[j].tool_id);
|
||||
}
|
||||
}
|
||||
gtk_widget_show (table);
|
||||
}
|
||||
|
||||
|
@ -654,9 +524,10 @@ toolbox_free ()
|
|||
|
||||
gdk_window_get_position (toolbox_shell->window, &toolbox_x, &toolbox_y);
|
||||
gtk_widget_destroy (toolbox_shell);
|
||||
for (i = 22; i < NUM_TOOLS; i++)
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
gtk_object_sink (GTK_OBJECT (tool_widgets[i]));
|
||||
if (!tool_info[i].icon_data)
|
||||
gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget));
|
||||
}
|
||||
gtk_object_destroy (GTK_OBJECT (tool_tips));
|
||||
gtk_object_unref (GTK_OBJECT (tool_tips));
|
||||
|
|
|
@ -416,13 +416,10 @@ static MenuItem color_option_items[] =
|
|||
};
|
||||
|
||||
void
|
||||
levels_initialize (void *gdisp_ptr)
|
||||
levels_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Levels for indexed drawables cannot be adjusted.");
|
||||
|
@ -449,7 +446,7 @@ levels_initialize (void *gdisp_ptr)
|
|||
|
||||
levels_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
levels_dialog->color = drawable_color (levels_dialog->drawable);
|
||||
levels_dialog->image_map = image_map_create (gdisp_ptr, levels_dialog->drawable);
|
||||
levels_dialog->image_map = image_map_create (gdisp, levels_dialog->drawable);
|
||||
|
||||
/* check for alpha channel */
|
||||
if (drawable_has_alpha (levels_dialog->drawable))
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_levels (void);
|
||||
void tools_free_levels (Tool *);
|
||||
|
||||
void levels_initialize (void *);
|
||||
void levels_initialize (GDisplay *);
|
||||
void levels_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
67
app/menus.c
67
app/menus.c
|
@ -94,8 +94,9 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Select/Grow", NULL, select_grow_cmd_callback, 0 },
|
||||
{ "/Select/Shrink", NULL, select_shrink_cmd_callback, 0 },
|
||||
{ "/Select/Save To Channel", NULL, select_save_cmd_callback, 0 },
|
||||
{ "/Select/By Color...", NULL, select_by_color_cmd_callback, 0 },
|
||||
|
||||
/*
|
||||
{ "/Select/By Color...", NULL, tools_select_cmd_callback, BY_COLOR_SELECT },
|
||||
*/
|
||||
{ "/View/Zoom In", "equal", view_zoomin_cmd_callback, 0 },
|
||||
{ "/View/Zoom Out", "minus", view_zoomout_cmd_callback, 0 },
|
||||
{ "/View/Zoom/16:1", NULL, view_zoom_16_1_callback, 0 },
|
||||
|
@ -117,14 +118,16 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
|
||||
{ "/Image/Colors/Equalize", NULL, image_equalize_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Invert", NULL, image_invert_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Posterize", NULL, image_posterize_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Threshold", NULL, image_threshold_cmd_callback, 0 },
|
||||
/*
|
||||
{ "/Image/Colors/Posterize", NULL, tools_select_cmd_callback, POSTERIZE },
|
||||
{ "/Image/Colors/Threshold", NULL, tools_select_cmd_callback, THRESHOLD },
|
||||
{ "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Colors/Color Balance", NULL, image_color_balance_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Brightness-Contrast", NULL, image_brightness_contrast_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Hue-Saturation", NULL, image_hue_saturation_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Curves", NULL, image_curves_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Levels", NULL, image_levels_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Color Balance", NULL, tools_select_cmd_callback, COLOR_BALANCE },
|
||||
{ "/Image/Colors/Brightness-Contrast", NULL, tools_select_cmd_callback, BRIGHTNESS_CONTRAST },
|
||||
{ "/Image/Colors/Hue-Saturation", NULL, tools_select_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Curves", NULL, tools_select_cmd_callback, CURVES },
|
||||
{ "/Image/Colors/Levels", NULL, tools_select_cmd_callback, LEVELS },
|
||||
*/
|
||||
{ "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Colors/Desaturate", NULL, image_desaturate_cmd_callback, 0 },
|
||||
{ "/Image/Channel Ops/Duplicate", "<control>D", channel_ops_duplicate_cmd_callback, 0 },
|
||||
|
@ -139,7 +142,7 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Image/Resize", NULL, image_resize_cmd_callback, 0 },
|
||||
{ "/Image/Scale", NULL, image_scale_cmd_callback, 0 },
|
||||
{ "/Image/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Histogram", NULL, image_histogram_cmd_callback, 0 },
|
||||
/* { "/Image/Histogram", NULL, tools_select_cmd_callback, HISTOGRAM}, */
|
||||
{ "/Image/---", NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ "/Layers/Layers & Channels...", "<control>L", dialogs_lc_cmd_callback, 0 },
|
||||
|
@ -152,7 +155,7 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Layers/Mask To Selection", NULL, layers_mask_select_cmd_callback, 0 },
|
||||
{ "/Layers/Add Alpha Channel", NULL, layers_add_alpha_channel_cmd_callback, 0 },
|
||||
|
||||
{ "/Tools/Rect Select", "R", tools_select_cmd_callback, RECT_SELECT },
|
||||
/* { "/Tools/Rect Select", "R", tools_select_cmd_callback, RECT_SELECT },
|
||||
{ "/Tools/Ellipse Select", "E", tools_select_cmd_callback, ELLIPSE_SELECT },
|
||||
{ "/Tools/Free Select", "F", tools_select_cmd_callback, FREE_SELECT },
|
||||
{ "/Tools/Fuzzy Select", "Z", tools_select_cmd_callback, FUZZY_SELECT },
|
||||
|
@ -175,10 +178,9 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Tools/Convolve", "V", tools_select_cmd_callback, CONVOLVE },
|
||||
{ "/Tools/Ink", "K", tools_select_cmd_callback, INK },
|
||||
{ "/Tools/Default Colors", "D", tools_default_colors_cmd_callback, 0 },
|
||||
{ "/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, 0 },
|
||||
{ "/Tools/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, 0 }, */
|
||||
{ "/Tools/Toolbox", NULL, toolbox_raise_callback, 0 },
|
||||
|
||||
{ "/Tools/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Filters/", NULL, NULL, 0 },
|
||||
{ "/Filters/Repeat last", "<alt>F", filters_repeat_cmd_callback, 0x0 },
|
||||
{ "/Filters/Re-show last", "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
|
||||
|
@ -217,6 +219,7 @@ static GtkItemFactory *save_factory = NULL;
|
|||
|
||||
static int initialize = TRUE;
|
||||
|
||||
extern int num_tools;
|
||||
|
||||
void
|
||||
menus_get_toolbox_menubar (GtkWidget **menubar,
|
||||
|
@ -280,6 +283,28 @@ menus_create (GtkMenuEntry *entries,
|
|||
gtk_item_factory_create_menu_entries (nmenu_entries, entries);
|
||||
}
|
||||
|
||||
void
|
||||
menus_tools_create (ToolInfo *tool_info)
|
||||
{
|
||||
GtkItemFactoryEntry entry;
|
||||
|
||||
/* entry.path = g_strconcat ("<Image>", tool_info->menu_path, NULL);*/
|
||||
/* entry.callback_data = tool_info; */
|
||||
entry.path = tool_info->menu_path;
|
||||
entry.accelerator = tool_info->menu_accel;
|
||||
entry.callback = tools_select_cmd_callback;
|
||||
entry.callback_action = tool_info->tool_id;
|
||||
entry.item_type = NULL;
|
||||
|
||||
fflush(stderr);
|
||||
/*menus_create (&entry, 1);*/
|
||||
gtk_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
(gpointer)tool_info,
|
||||
2);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
menus_set_sensitive (char *path,
|
||||
int sensitive)
|
||||
|
@ -359,6 +384,8 @@ menus_quit ()
|
|||
static void
|
||||
menus_init ()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (initialize)
|
||||
{
|
||||
gchar *filename;
|
||||
|
@ -385,9 +412,19 @@ menus_init ()
|
|||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (tool_info+i);
|
||||
}
|
||||
filename = g_strconcat (gimp_directory (), "/menurc", NULL);
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -94,8 +94,9 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Select/Grow", NULL, select_grow_cmd_callback, 0 },
|
||||
{ "/Select/Shrink", NULL, select_shrink_cmd_callback, 0 },
|
||||
{ "/Select/Save To Channel", NULL, select_save_cmd_callback, 0 },
|
||||
{ "/Select/By Color...", NULL, select_by_color_cmd_callback, 0 },
|
||||
|
||||
/*
|
||||
{ "/Select/By Color...", NULL, tools_select_cmd_callback, BY_COLOR_SELECT },
|
||||
*/
|
||||
{ "/View/Zoom In", "equal", view_zoomin_cmd_callback, 0 },
|
||||
{ "/View/Zoom Out", "minus", view_zoomout_cmd_callback, 0 },
|
||||
{ "/View/Zoom/16:1", NULL, view_zoom_16_1_callback, 0 },
|
||||
|
@ -117,14 +118,16 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
|
||||
{ "/Image/Colors/Equalize", NULL, image_equalize_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Invert", NULL, image_invert_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Posterize", NULL, image_posterize_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Threshold", NULL, image_threshold_cmd_callback, 0 },
|
||||
/*
|
||||
{ "/Image/Colors/Posterize", NULL, tools_select_cmd_callback, POSTERIZE },
|
||||
{ "/Image/Colors/Threshold", NULL, tools_select_cmd_callback, THRESHOLD },
|
||||
{ "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Colors/Color Balance", NULL, image_color_balance_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Brightness-Contrast", NULL, image_brightness_contrast_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Hue-Saturation", NULL, image_hue_saturation_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Curves", NULL, image_curves_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Levels", NULL, image_levels_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Color Balance", NULL, tools_select_cmd_callback, COLOR_BALANCE },
|
||||
{ "/Image/Colors/Brightness-Contrast", NULL, tools_select_cmd_callback, BRIGHTNESS_CONTRAST },
|
||||
{ "/Image/Colors/Hue-Saturation", NULL, tools_select_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Curves", NULL, tools_select_cmd_callback, CURVES },
|
||||
{ "/Image/Colors/Levels", NULL, tools_select_cmd_callback, LEVELS },
|
||||
*/
|
||||
{ "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Colors/Desaturate", NULL, image_desaturate_cmd_callback, 0 },
|
||||
{ "/Image/Channel Ops/Duplicate", "<control>D", channel_ops_duplicate_cmd_callback, 0 },
|
||||
|
@ -139,7 +142,7 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Image/Resize", NULL, image_resize_cmd_callback, 0 },
|
||||
{ "/Image/Scale", NULL, image_scale_cmd_callback, 0 },
|
||||
{ "/Image/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Histogram", NULL, image_histogram_cmd_callback, 0 },
|
||||
/* { "/Image/Histogram", NULL, tools_select_cmd_callback, HISTOGRAM}, */
|
||||
{ "/Image/---", NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ "/Layers/Layers & Channels...", "<control>L", dialogs_lc_cmd_callback, 0 },
|
||||
|
@ -152,7 +155,7 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Layers/Mask To Selection", NULL, layers_mask_select_cmd_callback, 0 },
|
||||
{ "/Layers/Add Alpha Channel", NULL, layers_add_alpha_channel_cmd_callback, 0 },
|
||||
|
||||
{ "/Tools/Rect Select", "R", tools_select_cmd_callback, RECT_SELECT },
|
||||
/* { "/Tools/Rect Select", "R", tools_select_cmd_callback, RECT_SELECT },
|
||||
{ "/Tools/Ellipse Select", "E", tools_select_cmd_callback, ELLIPSE_SELECT },
|
||||
{ "/Tools/Free Select", "F", tools_select_cmd_callback, FREE_SELECT },
|
||||
{ "/Tools/Fuzzy Select", "Z", tools_select_cmd_callback, FUZZY_SELECT },
|
||||
|
@ -175,10 +178,9 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Tools/Convolve", "V", tools_select_cmd_callback, CONVOLVE },
|
||||
{ "/Tools/Ink", "K", tools_select_cmd_callback, INK },
|
||||
{ "/Tools/Default Colors", "D", tools_default_colors_cmd_callback, 0 },
|
||||
{ "/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, 0 },
|
||||
{ "/Tools/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, 0 }, */
|
||||
{ "/Tools/Toolbox", NULL, toolbox_raise_callback, 0 },
|
||||
|
||||
{ "/Tools/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Filters/", NULL, NULL, 0 },
|
||||
{ "/Filters/Repeat last", "<alt>F", filters_repeat_cmd_callback, 0x0 },
|
||||
{ "/Filters/Re-show last", "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
|
||||
|
@ -217,6 +219,7 @@ static GtkItemFactory *save_factory = NULL;
|
|||
|
||||
static int initialize = TRUE;
|
||||
|
||||
extern int num_tools;
|
||||
|
||||
void
|
||||
menus_get_toolbox_menubar (GtkWidget **menubar,
|
||||
|
@ -280,6 +283,28 @@ menus_create (GtkMenuEntry *entries,
|
|||
gtk_item_factory_create_menu_entries (nmenu_entries, entries);
|
||||
}
|
||||
|
||||
void
|
||||
menus_tools_create (ToolInfo *tool_info)
|
||||
{
|
||||
GtkItemFactoryEntry entry;
|
||||
|
||||
/* entry.path = g_strconcat ("<Image>", tool_info->menu_path, NULL);*/
|
||||
/* entry.callback_data = tool_info; */
|
||||
entry.path = tool_info->menu_path;
|
||||
entry.accelerator = tool_info->menu_accel;
|
||||
entry.callback = tools_select_cmd_callback;
|
||||
entry.callback_action = tool_info->tool_id;
|
||||
entry.item_type = NULL;
|
||||
|
||||
fflush(stderr);
|
||||
/*menus_create (&entry, 1);*/
|
||||
gtk_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
(gpointer)tool_info,
|
||||
2);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
menus_set_sensitive (char *path,
|
||||
int sensitive)
|
||||
|
@ -359,6 +384,8 @@ menus_quit ()
|
|||
static void
|
||||
menus_init ()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (initialize)
|
||||
{
|
||||
gchar *filename;
|
||||
|
@ -385,9 +412,19 @@ menus_init ()
|
|||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (tool_info+i);
|
||||
}
|
||||
filename = g_strconcat (gimp_directory (), "/menurc", NULL);
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -957,3 +957,38 @@ static char *ink_bits [] =
|
|||
};
|
||||
#define ink_width 22
|
||||
#define ink_height 22
|
||||
|
||||
/* FIXME dialog is basicaly a teporary pixmap so the device status
|
||||
* window doesn't have problems showing the dialog devices, it doesn't
|
||||
* really represent anything and really should be changed
|
||||
*/
|
||||
|
||||
/* GIMP icon image format -- S. Kimball, P. Mattis */
|
||||
/* Image name: dialog */
|
||||
#define dialog_width 22
|
||||
#define dialog_height 22
|
||||
static char *dialog_bits [] =
|
||||
{
|
||||
"......................",
|
||||
"......................",
|
||||
"......................",
|
||||
"......................",
|
||||
"........aaaaa.........",
|
||||
"......aagggggaa.......",
|
||||
".....aaggh.gggaa......",
|
||||
".....agggh.eggga......",
|
||||
"....aggggh.egggga.....",
|
||||
"....aghhhh.ehhhga.....",
|
||||
"....ag.........ga.....",
|
||||
"....aggeee.eeeega.....",
|
||||
"....aggggh.egggga.....",
|
||||
".....agggh.eggga......",
|
||||
".....aaggg.eggaa......",
|
||||
"......aagggggaa.......",
|
||||
"........aaaaa.........",
|
||||
"......................",
|
||||
"......................",
|
||||
"......................",
|
||||
"......................",
|
||||
"......................"
|
||||
};
|
||||
|
|
|
@ -243,12 +243,8 @@ tools_free_posterize (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
posterize_initialize (void *gdisp_ptr)
|
||||
posterize_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Posterize does not operate on indexed drawables.");
|
||||
|
@ -262,7 +258,7 @@ posterize_initialize (void *gdisp_ptr)
|
|||
if (!GTK_WIDGET_VISIBLE (posterize_dialog->shell))
|
||||
gtk_widget_show (posterize_dialog->shell);
|
||||
posterize_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
posterize_dialog->image_map = image_map_create (gdisp_ptr, posterize_dialog->drawable);
|
||||
posterize_dialog->image_map = image_map_create (gdisp, posterize_dialog->drawable);
|
||||
if (posterize_dialog->preview)
|
||||
posterize_preview (posterize_dialog);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_posterize (void);
|
||||
void tools_free_posterize (Tool *);
|
||||
|
||||
void posterize_initialize (void *);
|
||||
void posterize_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord posterize_proc;
|
||||
|
|
|
@ -335,12 +335,8 @@ tools_free_threshold (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
threshold_initialize (void *gdisp_ptr)
|
||||
threshold_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Threshold does not operate on indexed drawables.");
|
||||
|
@ -356,7 +352,7 @@ threshold_initialize (void *gdisp_ptr)
|
|||
|
||||
threshold_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
threshold_dialog->color = drawable_color (threshold_dialog->drawable);
|
||||
threshold_dialog->image_map = image_map_create (gdisp_ptr, threshold_dialog->drawable);
|
||||
threshold_dialog->image_map = image_map_create (gdisp, threshold_dialog->drawable);
|
||||
histogram_update (threshold_dialog->histogram,
|
||||
threshold_dialog->drawable,
|
||||
threshold_histogram_info,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_threshold (void);
|
||||
void tools_free_threshold (Tool *);
|
||||
|
||||
void threshold_initialize (void *);
|
||||
void threshold_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord threshold_proc;
|
||||
|
|
643
app/tools.c
643
app/tools.c
|
@ -55,6 +55,7 @@
|
|||
#include "threshold.h"
|
||||
#include "tools.h"
|
||||
#include "transform_tool.h"
|
||||
#include "pixmaps.h"
|
||||
|
||||
/* Global Data */
|
||||
|
||||
|
@ -71,45 +72,534 @@ static int global_tool_ID = 0;
|
|||
|
||||
ToolInfo tool_info[] =
|
||||
{
|
||||
{ NULL, "Rect Select", 0, tools_new_rect_select, tools_free_rect_select },
|
||||
{ NULL, "Ellipse Select", 1, tools_new_ellipse_select, tools_free_ellipse_select },
|
||||
{ NULL, "Free Select", 2, tools_new_free_select, tools_free_free_select },
|
||||
{ NULL, "Fuzzy Select", 3, tools_new_fuzzy_select, tools_free_fuzzy_select },
|
||||
{ NULL, "Bezier Select", 4, tools_new_bezier_select, tools_free_bezier_select },
|
||||
{ NULL, "Intelligent Scissors", 5, tools_new_iscissors, tools_free_iscissors },
|
||||
{ NULL, "Move", 6, tools_new_move_tool, tools_free_move_tool },
|
||||
{ NULL, "Magnify", 7, tools_new_magnify, tools_free_magnify },
|
||||
{ NULL, "Crop", 8, tools_new_crop, tools_free_crop },
|
||||
{ NULL, "Transform", 9, tools_new_transform_tool, tools_free_transform_tool}, /* rotate */
|
||||
{ NULL, "Transform", 9, tools_new_transform_tool, tools_free_transform_tool }, /* scale */
|
||||
{ NULL, "Transform", 9, tools_new_transform_tool, tools_free_transform_tool }, /* shear */
|
||||
{ NULL, "Transform", 9, tools_new_transform_tool, tools_free_transform_tool }, /* perspective */
|
||||
{ NULL, "Flip", 10, tools_new_flip, tools_free_flip_tool }, /* horizontal */
|
||||
{ NULL, "Flip", 10, tools_new_flip, tools_free_flip_tool }, /* vertical */
|
||||
{ NULL, "Text", 11, tools_new_text, tools_free_text },
|
||||
{ NULL, "Color Picker", 12, tools_new_color_picker, tools_free_color_picker },
|
||||
{ NULL, "Bucket Fill", 13, tools_new_bucket_fill, tools_free_bucket_fill },
|
||||
{ NULL, "Blend", 14, tools_new_blend, tools_free_blend },
|
||||
{ NULL, "Pencil", 15, tools_new_pencil, tools_free_pencil },
|
||||
{ NULL, "Paintbrush", 16, tools_new_paintbrush, tools_free_paintbrush },
|
||||
{ NULL, "Eraser", 17, tools_new_eraser, tools_free_eraser },
|
||||
{ NULL, "Airbrush", 18, tools_new_airbrush, tools_free_airbrush },
|
||||
{ NULL, "Clone", 19, tools_new_clone, tools_free_clone },
|
||||
{ NULL, "Convolve", 20, tools_new_convolve, tools_free_convolve },
|
||||
{ NULL, "Ink", 21, tools_new_ink, tools_free_ink },
|
||||
{
|
||||
NULL,
|
||||
"Rect Select",
|
||||
0,
|
||||
"/Tools/Rect Select",
|
||||
"R",
|
||||
(char **)rect_bits,
|
||||
"Select rectangular regions",
|
||||
"ContextHelp/rect-select",
|
||||
RECT_SELECT,
|
||||
tools_new_rect_select,
|
||||
tools_free_rect_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Ellipse Select",
|
||||
1,
|
||||
"/Tools/Ellipse Select",
|
||||
"E",
|
||||
(char **) circ_bits,
|
||||
"Select elliptical regions",
|
||||
"ContextHelp/ellipse-select",
|
||||
ELLIPSE_SELECT,
|
||||
tools_new_ellipse_select,
|
||||
tools_free_ellipse_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Free Select",
|
||||
2,
|
||||
"/Tools/Free Select",
|
||||
"F",
|
||||
(char **) free_bits,
|
||||
"Select hand-drawn regions",
|
||||
"ContextHelp/free-select",
|
||||
FREE_SELECT,
|
||||
tools_new_free_select,
|
||||
tools_free_free_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Fuzzy Select",
|
||||
3,
|
||||
"/Tools/Fuzzy Select",
|
||||
"Z",
|
||||
(char **) fuzzy_bits,
|
||||
"Select contiguous regions",
|
||||
"ContextHelp/fuzzy-select",
|
||||
FUZZY_SELECT,
|
||||
tools_new_fuzzy_select,
|
||||
tools_free_fuzzy_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Bezier Select",
|
||||
4,
|
||||
"/Tools/Bezier Select",
|
||||
"B",
|
||||
(char **) bezier_bits,
|
||||
"Select regions using Bezier curves",
|
||||
"ContextHelp/bezier-select",
|
||||
BEZIER_SELECT,
|
||||
tools_new_bezier_select,
|
||||
tools_free_bezier_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Intelligent Scissors",
|
||||
5,
|
||||
"/Tools/Intelligent Scissors",
|
||||
"I",
|
||||
(char **) iscissors_bits,
|
||||
"Select shapes from image",
|
||||
"ContextHelp/iscissors",
|
||||
ISCISSORS,
|
||||
tools_new_iscissors,
|
||||
tools_free_iscissors,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Move",
|
||||
6,
|
||||
"/Tools/Move",
|
||||
"M",
|
||||
(char **) move_bits,
|
||||
"Move layers & selections",
|
||||
"ContextHelp/move",
|
||||
MOVE,
|
||||
tools_new_move_tool,
|
||||
tools_free_move_tool,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Magnify",
|
||||
7,
|
||||
"/Tools/Magnify",
|
||||
"<shift>M",
|
||||
(char **) magnify_bits,
|
||||
"Zoom in & out",
|
||||
"ContextHelp/magnify",
|
||||
MAGNIFY,
|
||||
tools_new_magnify,
|
||||
tools_free_magnify,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Crop",
|
||||
8,
|
||||
"/Tools/Crop",
|
||||
"<shift>C",
|
||||
(char **) crop_bits,
|
||||
"Crop the image",
|
||||
"ContextHelp/crop",
|
||||
CROP,
|
||||
tools_new_crop,
|
||||
tools_free_crop,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Transform",
|
||||
9,
|
||||
"/Tools/Transform",
|
||||
"<shift>T",
|
||||
(char **) scale_bits,
|
||||
"Transform the layer or selection",
|
||||
"ContextHelp/rotate",
|
||||
ROTATE,
|
||||
tools_new_transform_tool,
|
||||
tools_free_transform_tool,
|
||||
NULL
|
||||
}, /* rotate */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Transform",
|
||||
9,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SCALE,
|
||||
tools_new_transform_tool,
|
||||
tools_free_transform_tool,
|
||||
NULL
|
||||
}, /* scale */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Transform",
|
||||
9,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SHEAR,
|
||||
tools_new_transform_tool,
|
||||
tools_free_transform_tool,
|
||||
NULL
|
||||
}, /* shear */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Transform",
|
||||
9,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
PERSPECTIVE,
|
||||
tools_new_transform_tool,
|
||||
tools_free_transform_tool,
|
||||
NULL
|
||||
}, /* perspective */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Flip",
|
||||
10,
|
||||
"/Tools/Flip",
|
||||
"<shift>F",
|
||||
(char **) horizflip_bits,
|
||||
"Flip the layer or selection",
|
||||
"ContextHelp/flip",
|
||||
FLIP_HORZ,
|
||||
tools_new_flip,
|
||||
tools_free_flip_tool,
|
||||
NULL
|
||||
}, /* horizontal */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Flip",
|
||||
10,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
FLIP_VERT,
|
||||
tools_new_flip,
|
||||
tools_free_flip_tool,
|
||||
NULL
|
||||
}, /* vertical */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Text",
|
||||
11,
|
||||
"/Tools/Text",
|
||||
"T",
|
||||
(char **) text_bits,
|
||||
"Add text to the image",
|
||||
"ContextHelp/text",
|
||||
TEXT,
|
||||
tools_new_text,
|
||||
tools_free_text,
|
||||
NULL,
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Color Picker",
|
||||
12,
|
||||
"/Tools/Color Picker",
|
||||
"O",
|
||||
(char **) colorpicker_bits,
|
||||
"Pick colors from the image",
|
||||
"ContextHelp/color-picker",
|
||||
COLOR_PICKER,
|
||||
tools_new_color_picker,
|
||||
tools_free_color_picker,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Bucket Fill",
|
||||
13,
|
||||
"/Tools/Bucket Fill",
|
||||
"<shift>B",
|
||||
(char **) fill_bits,
|
||||
"Fill with a color or pattern",
|
||||
"ContextHelp/bucket-fill",
|
||||
BUCKET_FILL,
|
||||
tools_new_bucket_fill,
|
||||
tools_free_bucket_fill,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Blend",
|
||||
14,
|
||||
"/Tools/Blend",
|
||||
"L",
|
||||
(char **) gradient_bits,
|
||||
"Fill with a color gradient",
|
||||
"ContextHelp/gradient",
|
||||
BLEND,
|
||||
tools_new_blend,
|
||||
tools_free_blend,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Pencil",
|
||||
15,
|
||||
"/Tools/Pencil",
|
||||
"<shift>P",
|
||||
(char **) pencil_bits,
|
||||
"Draw sharp pencil strokes",
|
||||
"ContextHelp/pencil",
|
||||
PENCIL,
|
||||
tools_new_pencil,
|
||||
tools_free_pencil,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Paintbrush",
|
||||
16,
|
||||
"/Tools/Paintbrush",
|
||||
"P",
|
||||
(char **) paint_bits,
|
||||
"Paint fuzzy brush strokes",
|
||||
"ContextHelp/paintbrush",
|
||||
PAINTBRUSH,
|
||||
tools_new_paintbrush,
|
||||
tools_free_paintbrush,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Eraser",
|
||||
17,
|
||||
"/Tools/Eraser",
|
||||
"<shift>E",
|
||||
(char **) erase_bits,
|
||||
"Erase to background or transparency",
|
||||
"ContextHelp/eraser",
|
||||
ERASER,
|
||||
tools_new_eraser,
|
||||
tools_free_eraser,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Airbrush",
|
||||
18,
|
||||
"/Tools/Airbrush",
|
||||
"A",
|
||||
(char **) airbrush_bits,
|
||||
"Airbrush with variable pressure",
|
||||
"ContextHelp/airbrush",
|
||||
AIRBRUSH,
|
||||
tools_new_airbrush,
|
||||
tools_free_airbrush,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Clone",
|
||||
19,
|
||||
"/Tools/Clone",
|
||||
"C",
|
||||
(char **) clone_bits,
|
||||
"Paint using patterns or image regions",
|
||||
"ContextHelp/clone",
|
||||
CLONE,
|
||||
tools_new_clone,
|
||||
tools_free_clone,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Convolve",
|
||||
20,
|
||||
"/Tools/Convolve",
|
||||
"V",
|
||||
(char **) blur_bits,
|
||||
"Blur or sharpen",
|
||||
"ContextHelp/convolve",
|
||||
CONVOLVE,
|
||||
tools_new_convolve,
|
||||
tools_free_convolve,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Ink",
|
||||
21,
|
||||
"/Tools/Ink",
|
||||
"K",
|
||||
(char **) ink_bits,
|
||||
"Draw in ink",
|
||||
"ContextHelp/ink",
|
||||
INK,
|
||||
tools_new_ink,
|
||||
tools_free_ink,
|
||||
NULL
|
||||
},
|
||||
|
||||
/* Non-toolbox tools */
|
||||
{ NULL, "By Color Select", 22, tools_new_by_color_select, tools_free_by_color_select },
|
||||
{ NULL, "Color Balance", 23, tools_new_color_balance, tools_free_color_balance },
|
||||
{ NULL, "Brightness-Contrast", 24, tools_new_brightness_contrast, tools_free_brightness_contrast },
|
||||
{ NULL, "Hue-Saturation", 25, tools_new_hue_saturation, tools_free_hue_saturation },
|
||||
{ NULL, "Posterize", 26, tools_new_posterize, tools_free_posterize },
|
||||
{ NULL, "Threshold", 27, tools_new_threshold, tools_free_threshold },
|
||||
{ NULL, "Curves", 28, tools_new_curves, tools_free_curves },
|
||||
{ NULL, "Levels", 29, tools_new_levels, tools_free_levels },
|
||||
{ NULL, "Histogram", 30, tools_new_histogram_tool, tools_free_histogram_tool }
|
||||
{
|
||||
NULL,
|
||||
"By Color Select",
|
||||
22,
|
||||
"/Select/By Color",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
BY_COLOR_SELECT,
|
||||
tools_new_by_color_select,
|
||||
tools_free_by_color_select,
|
||||
by_color_select_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Color Balance",
|
||||
23,
|
||||
"/Image/Colors/Color Balance",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
COLOR_BALANCE,
|
||||
tools_new_color_balance,
|
||||
tools_free_color_balance,
|
||||
color_balance_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Brightness-Contrast",
|
||||
24,
|
||||
"/Image/Colors/Brightness-Contrast",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
tools_new_brightness_contrast,
|
||||
tools_free_brightness_contrast,
|
||||
brightness_contrast_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Hue-Saturation",
|
||||
25,
|
||||
"/Image/Colors/Hue-Saturation",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
HUE_SATURATION,
|
||||
tools_new_hue_saturation,
|
||||
tools_free_hue_saturation,
|
||||
hue_saturation_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Posterize",
|
||||
26,
|
||||
"/Image/Colors/Posterize",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
POSTERIZE,
|
||||
tools_new_posterize,
|
||||
tools_free_posterize,
|
||||
posterize_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Threshold",
|
||||
27,
|
||||
"/Image/Colors/Threshold",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
THRESHOLD,
|
||||
tools_new_threshold,
|
||||
tools_free_threshold,
|
||||
threshold_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Curves",
|
||||
28,
|
||||
"/Image/Colors/Curves",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
CURVES,
|
||||
tools_new_curves,
|
||||
tools_free_curves,
|
||||
curves_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Levels",
|
||||
29,
|
||||
"/Image/Colors/Levels",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
LEVELS,
|
||||
tools_new_levels,
|
||||
tools_free_levels,
|
||||
levels_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Histogram",
|
||||
30,
|
||||
"/Image/Histogram",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
HISTOGRAM,
|
||||
tools_new_histogram_tool,
|
||||
tools_free_histogram_tool,
|
||||
histogram_tool_initialize
|
||||
}
|
||||
};
|
||||
|
||||
gint num_tools = sizeof (tool_info) / sizeof (ToolInfo);
|
||||
|
||||
/* Local function declarations */
|
||||
|
||||
|
@ -163,94 +653,23 @@ tools_select (ToolType type)
|
|||
}
|
||||
|
||||
void
|
||||
tools_initialize (ToolType type, GDisplay *gdisp_ptr)
|
||||
tools_initialize (ToolType type, GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
/* If you're wondering... only these dialog type tools have init functions */
|
||||
gdisp = gdisp_ptr;
|
||||
|
||||
if (active_tool)
|
||||
active_tool_free ();
|
||||
|
||||
switch (type)
|
||||
if (tool_info[(int) type].init_func)
|
||||
{
|
||||
case BY_COLOR_SELECT:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_by_color_select ();
|
||||
by_color_select_initialize (gdisp->gimage);
|
||||
active_tool = (* tool_info[(int) type].new_func) ();
|
||||
(* tool_info[(int) type].init_func) (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case COLOR_BALANCE:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_color_balance ();
|
||||
color_balance_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case BRIGHTNESS_CONTRAST:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_brightness_contrast ();
|
||||
brightness_contrast_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case HUE_SATURATION:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_hue_saturation ();
|
||||
hue_saturation_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case POSTERIZE:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_posterize ();
|
||||
posterize_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case THRESHOLD:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_threshold ();
|
||||
threshold_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case CURVES:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_curves ();
|
||||
curves_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case LEVELS:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_levels ();
|
||||
levels_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case HISTOGRAM:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_histogram_tool ();
|
||||
histogram_tool_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
active_tool = (* tool_info[(int) type].new_func) ();
|
||||
break;
|
||||
}
|
||||
else
|
||||
active_tool = (* tool_info[(int) type].new_func) ();
|
||||
|
||||
/* Show the options for the active tool
|
||||
*/
|
||||
|
|
18
app/tools.h
18
app/tools.h
|
@ -103,6 +103,7 @@ typedef void (* ToolCtlFunc) (Tool *, int, gpointer);
|
|||
/* ToolInfo function declarations */
|
||||
typedef Tool *(* ToolInfoNewFunc) (void);
|
||||
typedef void (* ToolInfoFreeFunc) (Tool *);
|
||||
typedef void (* ToolInfoInitFunc) (GDisplay *);
|
||||
|
||||
struct _tool
|
||||
{
|
||||
|
@ -134,9 +135,24 @@ struct _ToolInfo
|
|||
{
|
||||
GtkWidget *tool_options;
|
||||
char *tool_name;
|
||||
int toolbar_position;
|
||||
|
||||
int toolbar_position;
|
||||
|
||||
char *menu_path;
|
||||
char *menu_accel;
|
||||
|
||||
char **icon_data;
|
||||
|
||||
char *tool_desc;
|
||||
char *private_tip;
|
||||
|
||||
gint tool_id;
|
||||
|
||||
ToolInfoNewFunc new_func;
|
||||
ToolInfoFreeFunc free_func;
|
||||
ToolInfoInitFunc init_func;
|
||||
|
||||
GtkWidget *tool_widget;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ bezier_select_load (void *gdisp_ptr,
|
|||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
/* select the bezier tool */
|
||||
gtk_widget_activate (tool_widgets[tool_info[BEZIER_SELECT].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[BEZIER_SELECT].tool_widget);
|
||||
tool = active_tool;
|
||||
tool->state = ACTIVE;
|
||||
tool->gdisp_ptr = gdisp_ptr;
|
||||
|
|
|
@ -278,12 +278,8 @@ tools_free_brightness_contrast (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
brightness_contrast_initialize (void *gdisp_ptr)
|
||||
brightness_contrast_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Brightness-Contrast does not operate on indexed drawables.");
|
||||
|
@ -303,7 +299,7 @@ brightness_contrast_initialize (void *gdisp_ptr)
|
|||
brightness_contrast_dialog->contrast = 0.0;
|
||||
|
||||
brightness_contrast_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
brightness_contrast_dialog->image_map = image_map_create (gdisp_ptr,
|
||||
brightness_contrast_dialog->image_map = image_map_create (gdisp,
|
||||
brightness_contrast_dialog->drawable);
|
||||
|
||||
brightness_contrast_update (brightness_contrast_dialog, ALL);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_brightness_contrast (void);
|
||||
void tools_free_brightness_contrast (Tool *);
|
||||
|
||||
void brightness_contrast_initialize (void *);
|
||||
void brightness_contrast_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord brightness_contrast_proc;
|
||||
|
|
|
@ -505,12 +505,8 @@ tools_free_by_color_select (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
by_color_select_initialize (void *gimage_ptr)
|
||||
by_color_select_initialize_by_image (GImage *gimage)
|
||||
{
|
||||
GImage *gimage;
|
||||
|
||||
gimage = (GImage *) gimage_ptr;
|
||||
|
||||
/* update the preview window */
|
||||
if (by_color_dialog)
|
||||
{
|
||||
|
@ -521,6 +517,12 @@ by_color_select_initialize (void *gimage_ptr)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
by_color_select_initialize (GDisplay *gdisp)
|
||||
{
|
||||
/* wrap this call so the tool_info->init_func works */
|
||||
by_color_select_initialize_by_image (gdisp->gimage);
|
||||
}
|
||||
|
||||
/****************************/
|
||||
/* Select by Color dialog */
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
Tool * tools_new_by_color_select (void);
|
||||
void tools_free_by_color_select (Tool *);
|
||||
|
||||
void by_color_select_initialize (void *);
|
||||
void by_color_select_initialize (GDisplay *);
|
||||
void by_color_select_initialize_by_image (GImage *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord by_color_select_proc;
|
||||
|
|
|
@ -311,13 +311,10 @@ tools_free_color_balance (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
color_balance_initialize (void *gdisp_ptr)
|
||||
color_balance_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Color balance operates only on RGB color drawables.");
|
||||
|
@ -340,7 +337,7 @@ color_balance_initialize (void *gdisp_ptr)
|
|||
color_balance_dialog->yellow_blue[i] = 0.0;
|
||||
}
|
||||
color_balance_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
color_balance_dialog->image_map = image_map_create (gdisp_ptr, color_balance_dialog->drawable);
|
||||
color_balance_dialog->image_map = image_map_create (gdisp, color_balance_dialog->drawable);
|
||||
color_balance_update (color_balance_dialog, ALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_color_balance (void);
|
||||
void tools_free_color_balance (Tool *);
|
||||
|
||||
void color_balance_initialize (void *);
|
||||
void color_balance_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord color_balance_proc;
|
||||
|
|
|
@ -337,13 +337,10 @@ static MenuItem curve_type_items[] =
|
|||
};
|
||||
|
||||
void
|
||||
curves_initialize (void *gdisp_ptr)
|
||||
curves_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i, j;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Curves for indexed drawables cannot be adjusted.");
|
||||
|
@ -376,7 +373,7 @@ curves_initialize (void *gdisp_ptr)
|
|||
|
||||
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
curves_dialog->color = drawable_color ( (curves_dialog->drawable));
|
||||
curves_dialog->image_map = image_map_create (gdisp_ptr, curves_dialog->drawable);
|
||||
curves_dialog->image_map = image_map_create (gdisp, curves_dialog->drawable);
|
||||
|
||||
/* check for alpha channel */
|
||||
if (drawable_has_alpha ( (curves_dialog->drawable)))
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_curves (void);
|
||||
void tools_free_curves (Tool *);
|
||||
|
||||
void curves_initialize (void *);
|
||||
void curves_initialize (GDisplay *);
|
||||
void curves_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -278,12 +278,8 @@ tools_free_brightness_contrast (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
brightness_contrast_initialize (void *gdisp_ptr)
|
||||
brightness_contrast_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Brightness-Contrast does not operate on indexed drawables.");
|
||||
|
@ -303,7 +299,7 @@ brightness_contrast_initialize (void *gdisp_ptr)
|
|||
brightness_contrast_dialog->contrast = 0.0;
|
||||
|
||||
brightness_contrast_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
brightness_contrast_dialog->image_map = image_map_create (gdisp_ptr,
|
||||
brightness_contrast_dialog->image_map = image_map_create (gdisp,
|
||||
brightness_contrast_dialog->drawable);
|
||||
|
||||
brightness_contrast_update (brightness_contrast_dialog, ALL);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_brightness_contrast (void);
|
||||
void tools_free_brightness_contrast (Tool *);
|
||||
|
||||
void brightness_contrast_initialize (void *);
|
||||
void brightness_contrast_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord brightness_contrast_proc;
|
||||
|
|
|
@ -505,12 +505,8 @@ tools_free_by_color_select (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
by_color_select_initialize (void *gimage_ptr)
|
||||
by_color_select_initialize_by_image (GImage *gimage)
|
||||
{
|
||||
GImage *gimage;
|
||||
|
||||
gimage = (GImage *) gimage_ptr;
|
||||
|
||||
/* update the preview window */
|
||||
if (by_color_dialog)
|
||||
{
|
||||
|
@ -521,6 +517,12 @@ by_color_select_initialize (void *gimage_ptr)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
by_color_select_initialize (GDisplay *gdisp)
|
||||
{
|
||||
/* wrap this call so the tool_info->init_func works */
|
||||
by_color_select_initialize_by_image (gdisp->gimage);
|
||||
}
|
||||
|
||||
/****************************/
|
||||
/* Select by Color dialog */
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
Tool * tools_new_by_color_select (void);
|
||||
void tools_free_by_color_select (Tool *);
|
||||
|
||||
void by_color_select_initialize (void *);
|
||||
void by_color_select_initialize (GDisplay *);
|
||||
void by_color_select_initialize_by_image (GImage *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord by_color_select_proc;
|
||||
|
|
|
@ -311,13 +311,10 @@ tools_free_color_balance (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
color_balance_initialize (void *gdisp_ptr)
|
||||
color_balance_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Color balance operates only on RGB color drawables.");
|
||||
|
@ -340,7 +337,7 @@ color_balance_initialize (void *gdisp_ptr)
|
|||
color_balance_dialog->yellow_blue[i] = 0.0;
|
||||
}
|
||||
color_balance_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
color_balance_dialog->image_map = image_map_create (gdisp_ptr, color_balance_dialog->drawable);
|
||||
color_balance_dialog->image_map = image_map_create (gdisp, color_balance_dialog->drawable);
|
||||
color_balance_update (color_balance_dialog, ALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_color_balance (void);
|
||||
void tools_free_color_balance (Tool *);
|
||||
|
||||
void color_balance_initialize (void *);
|
||||
void color_balance_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord color_balance_proc;
|
||||
|
|
|
@ -337,13 +337,10 @@ static MenuItem curve_type_items[] =
|
|||
};
|
||||
|
||||
void
|
||||
curves_initialize (void *gdisp_ptr)
|
||||
curves_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i, j;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Curves for indexed drawables cannot be adjusted.");
|
||||
|
@ -376,7 +373,7 @@ curves_initialize (void *gdisp_ptr)
|
|||
|
||||
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
curves_dialog->color = drawable_color ( (curves_dialog->drawable));
|
||||
curves_dialog->image_map = image_map_create (gdisp_ptr, curves_dialog->drawable);
|
||||
curves_dialog->image_map = image_map_create (gdisp, curves_dialog->drawable);
|
||||
|
||||
/* check for alpha channel */
|
||||
if (drawable_has_alpha ( (curves_dialog->drawable)))
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_curves (void);
|
||||
void tools_free_curves (Tool *);
|
||||
|
||||
void curves_initialize (void *);
|
||||
void curves_initialize (GDisplay *);
|
||||
void curves_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -379,12 +379,8 @@ tools_free_histogram_tool (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
histogram_tool_initialize (void *gdisp_ptr)
|
||||
histogram_tool_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Histogram does not operate on indexed drawables.");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_histogram_tool (void);
|
||||
void tools_free_histogram_tool (Tool *);
|
||||
|
||||
void histogram_tool_initialize (void *);
|
||||
void histogram_tool_initialize (GDisplay *);
|
||||
void histogram_tool_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -355,13 +355,10 @@ tools_free_hue_saturation (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
hue_saturation_initialize (void *gdisp_ptr)
|
||||
hue_saturation_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Hue-Saturation operates only on RGB color drawables.");
|
||||
|
@ -383,7 +380,7 @@ hue_saturation_initialize (void *gdisp_ptr)
|
|||
}
|
||||
|
||||
hue_saturation_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
hue_saturation_dialog->image_map = image_map_create (gdisp_ptr, hue_saturation_dialog->drawable);
|
||||
hue_saturation_dialog->image_map = image_map_create (gdisp, hue_saturation_dialog->drawable);
|
||||
hue_saturation_update (hue_saturation_dialog, ALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_hue_saturation (void);
|
||||
void tools_free_hue_saturation (Tool *);
|
||||
|
||||
void hue_saturation_initialize (void *);
|
||||
void hue_saturation_initialize (GDisplay *);
|
||||
void hue_saturation_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -416,13 +416,10 @@ static MenuItem color_option_items[] =
|
|||
};
|
||||
|
||||
void
|
||||
levels_initialize (void *gdisp_ptr)
|
||||
levels_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Levels for indexed drawables cannot be adjusted.");
|
||||
|
@ -449,7 +446,7 @@ levels_initialize (void *gdisp_ptr)
|
|||
|
||||
levels_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
levels_dialog->color = drawable_color (levels_dialog->drawable);
|
||||
levels_dialog->image_map = image_map_create (gdisp_ptr, levels_dialog->drawable);
|
||||
levels_dialog->image_map = image_map_create (gdisp, levels_dialog->drawable);
|
||||
|
||||
/* check for alpha channel */
|
||||
if (drawable_has_alpha (levels_dialog->drawable))
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_levels (void);
|
||||
void tools_free_levels (Tool *);
|
||||
|
||||
void levels_initialize (void *);
|
||||
void levels_initialize (GDisplay *);
|
||||
void levels_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -243,12 +243,8 @@ tools_free_posterize (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
posterize_initialize (void *gdisp_ptr)
|
||||
posterize_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Posterize does not operate on indexed drawables.");
|
||||
|
@ -262,7 +258,7 @@ posterize_initialize (void *gdisp_ptr)
|
|||
if (!GTK_WIDGET_VISIBLE (posterize_dialog->shell))
|
||||
gtk_widget_show (posterize_dialog->shell);
|
||||
posterize_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
posterize_dialog->image_map = image_map_create (gdisp_ptr, posterize_dialog->drawable);
|
||||
posterize_dialog->image_map = image_map_create (gdisp, posterize_dialog->drawable);
|
||||
if (posterize_dialog->preview)
|
||||
posterize_preview (posterize_dialog);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_posterize (void);
|
||||
void tools_free_posterize (Tool *);
|
||||
|
||||
void posterize_initialize (void *);
|
||||
void posterize_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord posterize_proc;
|
||||
|
|
|
@ -335,12 +335,8 @@ tools_free_threshold (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
threshold_initialize (void *gdisp_ptr)
|
||||
threshold_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Threshold does not operate on indexed drawables.");
|
||||
|
@ -356,7 +352,7 @@ threshold_initialize (void *gdisp_ptr)
|
|||
|
||||
threshold_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
threshold_dialog->color = drawable_color (threshold_dialog->drawable);
|
||||
threshold_dialog->image_map = image_map_create (gdisp_ptr, threshold_dialog->drawable);
|
||||
threshold_dialog->image_map = image_map_create (gdisp, threshold_dialog->drawable);
|
||||
histogram_update (threshold_dialog->histogram,
|
||||
threshold_dialog->drawable,
|
||||
threshold_histogram_info,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_threshold (void);
|
||||
void tools_free_threshold (Tool *);
|
||||
|
||||
void threshold_initialize (void *);
|
||||
void threshold_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord threshold_proc;
|
||||
|
|
|
@ -379,12 +379,8 @@ tools_free_histogram_tool (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
histogram_tool_initialize (void *gdisp_ptr)
|
||||
histogram_tool_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Histogram does not operate on indexed drawables.");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_histogram_tool (void);
|
||||
void tools_free_histogram_tool (Tool *);
|
||||
|
||||
void histogram_tool_initialize (void *);
|
||||
void histogram_tool_initialize (GDisplay *);
|
||||
void histogram_tool_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -355,13 +355,10 @@ tools_free_hue_saturation (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
hue_saturation_initialize (void *gdisp_ptr)
|
||||
hue_saturation_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Hue-Saturation operates only on RGB color drawables.");
|
||||
|
@ -383,7 +380,7 @@ hue_saturation_initialize (void *gdisp_ptr)
|
|||
}
|
||||
|
||||
hue_saturation_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
hue_saturation_dialog->image_map = image_map_create (gdisp_ptr, hue_saturation_dialog->drawable);
|
||||
hue_saturation_dialog->image_map = image_map_create (gdisp, hue_saturation_dialog->drawable);
|
||||
hue_saturation_update (hue_saturation_dialog, ALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_hue_saturation (void);
|
||||
void tools_free_hue_saturation (Tool *);
|
||||
|
||||
void hue_saturation_initialize (void *);
|
||||
void hue_saturation_initialize (GDisplay *);
|
||||
void hue_saturation_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -416,13 +416,10 @@ static MenuItem color_option_items[] =
|
|||
};
|
||||
|
||||
void
|
||||
levels_initialize (void *gdisp_ptr)
|
||||
levels_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
int i;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Levels for indexed drawables cannot be adjusted.");
|
||||
|
@ -449,7 +446,7 @@ levels_initialize (void *gdisp_ptr)
|
|||
|
||||
levels_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
levels_dialog->color = drawable_color (levels_dialog->drawable);
|
||||
levels_dialog->image_map = image_map_create (gdisp_ptr, levels_dialog->drawable);
|
||||
levels_dialog->image_map = image_map_create (gdisp, levels_dialog->drawable);
|
||||
|
||||
/* check for alpha channel */
|
||||
if (drawable_has_alpha (levels_dialog->drawable))
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_levels (void);
|
||||
void tools_free_levels (Tool *);
|
||||
|
||||
void levels_initialize (void *);
|
||||
void levels_initialize (GDisplay *);
|
||||
void levels_free (void);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
|
|
|
@ -243,12 +243,8 @@ tools_free_posterize (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
posterize_initialize (void *gdisp_ptr)
|
||||
posterize_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Posterize does not operate on indexed drawables.");
|
||||
|
@ -262,7 +258,7 @@ posterize_initialize (void *gdisp_ptr)
|
|||
if (!GTK_WIDGET_VISIBLE (posterize_dialog->shell))
|
||||
gtk_widget_show (posterize_dialog->shell);
|
||||
posterize_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
posterize_dialog->image_map = image_map_create (gdisp_ptr, posterize_dialog->drawable);
|
||||
posterize_dialog->image_map = image_map_create (gdisp, posterize_dialog->drawable);
|
||||
if (posterize_dialog->preview)
|
||||
posterize_preview (posterize_dialog);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_posterize (void);
|
||||
void tools_free_posterize (Tool *);
|
||||
|
||||
void posterize_initialize (void *);
|
||||
void posterize_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord posterize_proc;
|
||||
|
|
|
@ -335,12 +335,8 @@ tools_free_threshold (Tool *tool)
|
|||
}
|
||||
|
||||
void
|
||||
threshold_initialize (void *gdisp_ptr)
|
||||
threshold_initialize (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
if (drawable_indexed (gimage_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
g_message ("Threshold does not operate on indexed drawables.");
|
||||
|
@ -356,7 +352,7 @@ threshold_initialize (void *gdisp_ptr)
|
|||
|
||||
threshold_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
threshold_dialog->color = drawable_color (threshold_dialog->drawable);
|
||||
threshold_dialog->image_map = image_map_create (gdisp_ptr, threshold_dialog->drawable);
|
||||
threshold_dialog->image_map = image_map_create (gdisp, threshold_dialog->drawable);
|
||||
histogram_update (threshold_dialog->histogram,
|
||||
threshold_dialog->drawable,
|
||||
threshold_histogram_info,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Tool * tools_new_threshold (void);
|
||||
void tools_free_threshold (Tool *);
|
||||
|
||||
void threshold_initialize (void *);
|
||||
void threshold_initialize (GDisplay *);
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord threshold_proc;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "threshold.h"
|
||||
#include "tools.h"
|
||||
#include "transform_tool.h"
|
||||
#include "pixmaps.h"
|
||||
|
||||
/* Global Data */
|
||||
|
||||
|
@ -71,45 +72,534 @@ static int global_tool_ID = 0;
|
|||
|
||||
ToolInfo tool_info[] =
|
||||
{
|
||||
{ NULL, "Rect Select", 0, tools_new_rect_select, tools_free_rect_select },
|
||||
{ NULL, "Ellipse Select", 1, tools_new_ellipse_select, tools_free_ellipse_select },
|
||||
{ NULL, "Free Select", 2, tools_new_free_select, tools_free_free_select },
|
||||
{ NULL, "Fuzzy Select", 3, tools_new_fuzzy_select, tools_free_fuzzy_select },
|
||||
{ NULL, "Bezier Select", 4, tools_new_bezier_select, tools_free_bezier_select },
|
||||
{ NULL, "Intelligent Scissors", 5, tools_new_iscissors, tools_free_iscissors },
|
||||
{ NULL, "Move", 6, tools_new_move_tool, tools_free_move_tool },
|
||||
{ NULL, "Magnify", 7, tools_new_magnify, tools_free_magnify },
|
||||
{ NULL, "Crop", 8, tools_new_crop, tools_free_crop },
|
||||
{ NULL, "Transform", 9, tools_new_transform_tool, tools_free_transform_tool}, /* rotate */
|
||||
{ NULL, "Transform", 9, tools_new_transform_tool, tools_free_transform_tool }, /* scale */
|
||||
{ NULL, "Transform", 9, tools_new_transform_tool, tools_free_transform_tool }, /* shear */
|
||||
{ NULL, "Transform", 9, tools_new_transform_tool, tools_free_transform_tool }, /* perspective */
|
||||
{ NULL, "Flip", 10, tools_new_flip, tools_free_flip_tool }, /* horizontal */
|
||||
{ NULL, "Flip", 10, tools_new_flip, tools_free_flip_tool }, /* vertical */
|
||||
{ NULL, "Text", 11, tools_new_text, tools_free_text },
|
||||
{ NULL, "Color Picker", 12, tools_new_color_picker, tools_free_color_picker },
|
||||
{ NULL, "Bucket Fill", 13, tools_new_bucket_fill, tools_free_bucket_fill },
|
||||
{ NULL, "Blend", 14, tools_new_blend, tools_free_blend },
|
||||
{ NULL, "Pencil", 15, tools_new_pencil, tools_free_pencil },
|
||||
{ NULL, "Paintbrush", 16, tools_new_paintbrush, tools_free_paintbrush },
|
||||
{ NULL, "Eraser", 17, tools_new_eraser, tools_free_eraser },
|
||||
{ NULL, "Airbrush", 18, tools_new_airbrush, tools_free_airbrush },
|
||||
{ NULL, "Clone", 19, tools_new_clone, tools_free_clone },
|
||||
{ NULL, "Convolve", 20, tools_new_convolve, tools_free_convolve },
|
||||
{ NULL, "Ink", 21, tools_new_ink, tools_free_ink },
|
||||
{
|
||||
NULL,
|
||||
"Rect Select",
|
||||
0,
|
||||
"/Tools/Rect Select",
|
||||
"R",
|
||||
(char **)rect_bits,
|
||||
"Select rectangular regions",
|
||||
"ContextHelp/rect-select",
|
||||
RECT_SELECT,
|
||||
tools_new_rect_select,
|
||||
tools_free_rect_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Ellipse Select",
|
||||
1,
|
||||
"/Tools/Ellipse Select",
|
||||
"E",
|
||||
(char **) circ_bits,
|
||||
"Select elliptical regions",
|
||||
"ContextHelp/ellipse-select",
|
||||
ELLIPSE_SELECT,
|
||||
tools_new_ellipse_select,
|
||||
tools_free_ellipse_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Free Select",
|
||||
2,
|
||||
"/Tools/Free Select",
|
||||
"F",
|
||||
(char **) free_bits,
|
||||
"Select hand-drawn regions",
|
||||
"ContextHelp/free-select",
|
||||
FREE_SELECT,
|
||||
tools_new_free_select,
|
||||
tools_free_free_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Fuzzy Select",
|
||||
3,
|
||||
"/Tools/Fuzzy Select",
|
||||
"Z",
|
||||
(char **) fuzzy_bits,
|
||||
"Select contiguous regions",
|
||||
"ContextHelp/fuzzy-select",
|
||||
FUZZY_SELECT,
|
||||
tools_new_fuzzy_select,
|
||||
tools_free_fuzzy_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Bezier Select",
|
||||
4,
|
||||
"/Tools/Bezier Select",
|
||||
"B",
|
||||
(char **) bezier_bits,
|
||||
"Select regions using Bezier curves",
|
||||
"ContextHelp/bezier-select",
|
||||
BEZIER_SELECT,
|
||||
tools_new_bezier_select,
|
||||
tools_free_bezier_select,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Intelligent Scissors",
|
||||
5,
|
||||
"/Tools/Intelligent Scissors",
|
||||
"I",
|
||||
(char **) iscissors_bits,
|
||||
"Select shapes from image",
|
||||
"ContextHelp/iscissors",
|
||||
ISCISSORS,
|
||||
tools_new_iscissors,
|
||||
tools_free_iscissors,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Move",
|
||||
6,
|
||||
"/Tools/Move",
|
||||
"M",
|
||||
(char **) move_bits,
|
||||
"Move layers & selections",
|
||||
"ContextHelp/move",
|
||||
MOVE,
|
||||
tools_new_move_tool,
|
||||
tools_free_move_tool,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Magnify",
|
||||
7,
|
||||
"/Tools/Magnify",
|
||||
"<shift>M",
|
||||
(char **) magnify_bits,
|
||||
"Zoom in & out",
|
||||
"ContextHelp/magnify",
|
||||
MAGNIFY,
|
||||
tools_new_magnify,
|
||||
tools_free_magnify,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Crop",
|
||||
8,
|
||||
"/Tools/Crop",
|
||||
"<shift>C",
|
||||
(char **) crop_bits,
|
||||
"Crop the image",
|
||||
"ContextHelp/crop",
|
||||
CROP,
|
||||
tools_new_crop,
|
||||
tools_free_crop,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Transform",
|
||||
9,
|
||||
"/Tools/Transform",
|
||||
"<shift>T",
|
||||
(char **) scale_bits,
|
||||
"Transform the layer or selection",
|
||||
"ContextHelp/rotate",
|
||||
ROTATE,
|
||||
tools_new_transform_tool,
|
||||
tools_free_transform_tool,
|
||||
NULL
|
||||
}, /* rotate */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Transform",
|
||||
9,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SCALE,
|
||||
tools_new_transform_tool,
|
||||
tools_free_transform_tool,
|
||||
NULL
|
||||
}, /* scale */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Transform",
|
||||
9,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SHEAR,
|
||||
tools_new_transform_tool,
|
||||
tools_free_transform_tool,
|
||||
NULL
|
||||
}, /* shear */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Transform",
|
||||
9,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
PERSPECTIVE,
|
||||
tools_new_transform_tool,
|
||||
tools_free_transform_tool,
|
||||
NULL
|
||||
}, /* perspective */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Flip",
|
||||
10,
|
||||
"/Tools/Flip",
|
||||
"<shift>F",
|
||||
(char **) horizflip_bits,
|
||||
"Flip the layer or selection",
|
||||
"ContextHelp/flip",
|
||||
FLIP_HORZ,
|
||||
tools_new_flip,
|
||||
tools_free_flip_tool,
|
||||
NULL
|
||||
}, /* horizontal */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Flip",
|
||||
10,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
FLIP_VERT,
|
||||
tools_new_flip,
|
||||
tools_free_flip_tool,
|
||||
NULL
|
||||
}, /* vertical */
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Text",
|
||||
11,
|
||||
"/Tools/Text",
|
||||
"T",
|
||||
(char **) text_bits,
|
||||
"Add text to the image",
|
||||
"ContextHelp/text",
|
||||
TEXT,
|
||||
tools_new_text,
|
||||
tools_free_text,
|
||||
NULL,
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Color Picker",
|
||||
12,
|
||||
"/Tools/Color Picker",
|
||||
"O",
|
||||
(char **) colorpicker_bits,
|
||||
"Pick colors from the image",
|
||||
"ContextHelp/color-picker",
|
||||
COLOR_PICKER,
|
||||
tools_new_color_picker,
|
||||
tools_free_color_picker,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Bucket Fill",
|
||||
13,
|
||||
"/Tools/Bucket Fill",
|
||||
"<shift>B",
|
||||
(char **) fill_bits,
|
||||
"Fill with a color or pattern",
|
||||
"ContextHelp/bucket-fill",
|
||||
BUCKET_FILL,
|
||||
tools_new_bucket_fill,
|
||||
tools_free_bucket_fill,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Blend",
|
||||
14,
|
||||
"/Tools/Blend",
|
||||
"L",
|
||||
(char **) gradient_bits,
|
||||
"Fill with a color gradient",
|
||||
"ContextHelp/gradient",
|
||||
BLEND,
|
||||
tools_new_blend,
|
||||
tools_free_blend,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Pencil",
|
||||
15,
|
||||
"/Tools/Pencil",
|
||||
"<shift>P",
|
||||
(char **) pencil_bits,
|
||||
"Draw sharp pencil strokes",
|
||||
"ContextHelp/pencil",
|
||||
PENCIL,
|
||||
tools_new_pencil,
|
||||
tools_free_pencil,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Paintbrush",
|
||||
16,
|
||||
"/Tools/Paintbrush",
|
||||
"P",
|
||||
(char **) paint_bits,
|
||||
"Paint fuzzy brush strokes",
|
||||
"ContextHelp/paintbrush",
|
||||
PAINTBRUSH,
|
||||
tools_new_paintbrush,
|
||||
tools_free_paintbrush,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Eraser",
|
||||
17,
|
||||
"/Tools/Eraser",
|
||||
"<shift>E",
|
||||
(char **) erase_bits,
|
||||
"Erase to background or transparency",
|
||||
"ContextHelp/eraser",
|
||||
ERASER,
|
||||
tools_new_eraser,
|
||||
tools_free_eraser,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Airbrush",
|
||||
18,
|
||||
"/Tools/Airbrush",
|
||||
"A",
|
||||
(char **) airbrush_bits,
|
||||
"Airbrush with variable pressure",
|
||||
"ContextHelp/airbrush",
|
||||
AIRBRUSH,
|
||||
tools_new_airbrush,
|
||||
tools_free_airbrush,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Clone",
|
||||
19,
|
||||
"/Tools/Clone",
|
||||
"C",
|
||||
(char **) clone_bits,
|
||||
"Paint using patterns or image regions",
|
||||
"ContextHelp/clone",
|
||||
CLONE,
|
||||
tools_new_clone,
|
||||
tools_free_clone,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Convolve",
|
||||
20,
|
||||
"/Tools/Convolve",
|
||||
"V",
|
||||
(char **) blur_bits,
|
||||
"Blur or sharpen",
|
||||
"ContextHelp/convolve",
|
||||
CONVOLVE,
|
||||
tools_new_convolve,
|
||||
tools_free_convolve,
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Ink",
|
||||
21,
|
||||
"/Tools/Ink",
|
||||
"K",
|
||||
(char **) ink_bits,
|
||||
"Draw in ink",
|
||||
"ContextHelp/ink",
|
||||
INK,
|
||||
tools_new_ink,
|
||||
tools_free_ink,
|
||||
NULL
|
||||
},
|
||||
|
||||
/* Non-toolbox tools */
|
||||
{ NULL, "By Color Select", 22, tools_new_by_color_select, tools_free_by_color_select },
|
||||
{ NULL, "Color Balance", 23, tools_new_color_balance, tools_free_color_balance },
|
||||
{ NULL, "Brightness-Contrast", 24, tools_new_brightness_contrast, tools_free_brightness_contrast },
|
||||
{ NULL, "Hue-Saturation", 25, tools_new_hue_saturation, tools_free_hue_saturation },
|
||||
{ NULL, "Posterize", 26, tools_new_posterize, tools_free_posterize },
|
||||
{ NULL, "Threshold", 27, tools_new_threshold, tools_free_threshold },
|
||||
{ NULL, "Curves", 28, tools_new_curves, tools_free_curves },
|
||||
{ NULL, "Levels", 29, tools_new_levels, tools_free_levels },
|
||||
{ NULL, "Histogram", 30, tools_new_histogram_tool, tools_free_histogram_tool }
|
||||
{
|
||||
NULL,
|
||||
"By Color Select",
|
||||
22,
|
||||
"/Select/By Color",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
BY_COLOR_SELECT,
|
||||
tools_new_by_color_select,
|
||||
tools_free_by_color_select,
|
||||
by_color_select_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Color Balance",
|
||||
23,
|
||||
"/Image/Colors/Color Balance",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
COLOR_BALANCE,
|
||||
tools_new_color_balance,
|
||||
tools_free_color_balance,
|
||||
color_balance_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Brightness-Contrast",
|
||||
24,
|
||||
"/Image/Colors/Brightness-Contrast",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
BRIGHTNESS_CONTRAST,
|
||||
tools_new_brightness_contrast,
|
||||
tools_free_brightness_contrast,
|
||||
brightness_contrast_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Hue-Saturation",
|
||||
25,
|
||||
"/Image/Colors/Hue-Saturation",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
HUE_SATURATION,
|
||||
tools_new_hue_saturation,
|
||||
tools_free_hue_saturation,
|
||||
hue_saturation_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Posterize",
|
||||
26,
|
||||
"/Image/Colors/Posterize",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
POSTERIZE,
|
||||
tools_new_posterize,
|
||||
tools_free_posterize,
|
||||
posterize_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Threshold",
|
||||
27,
|
||||
"/Image/Colors/Threshold",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
THRESHOLD,
|
||||
tools_new_threshold,
|
||||
tools_free_threshold,
|
||||
threshold_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Curves",
|
||||
28,
|
||||
"/Image/Colors/Curves",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
CURVES,
|
||||
tools_new_curves,
|
||||
tools_free_curves,
|
||||
curves_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Levels",
|
||||
29,
|
||||
"/Image/Colors/Levels",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
LEVELS,
|
||||
tools_new_levels,
|
||||
tools_free_levels,
|
||||
levels_initialize
|
||||
},
|
||||
|
||||
{
|
||||
NULL,
|
||||
"Histogram",
|
||||
30,
|
||||
"/Image/Histogram",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
HISTOGRAM,
|
||||
tools_new_histogram_tool,
|
||||
tools_free_histogram_tool,
|
||||
histogram_tool_initialize
|
||||
}
|
||||
};
|
||||
|
||||
gint num_tools = sizeof (tool_info) / sizeof (ToolInfo);
|
||||
|
||||
/* Local function declarations */
|
||||
|
||||
|
@ -163,94 +653,23 @@ tools_select (ToolType type)
|
|||
}
|
||||
|
||||
void
|
||||
tools_initialize (ToolType type, GDisplay *gdisp_ptr)
|
||||
tools_initialize (ToolType type, GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
/* If you're wondering... only these dialog type tools have init functions */
|
||||
gdisp = gdisp_ptr;
|
||||
|
||||
if (active_tool)
|
||||
active_tool_free ();
|
||||
|
||||
switch (type)
|
||||
if (tool_info[(int) type].init_func)
|
||||
{
|
||||
case BY_COLOR_SELECT:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_by_color_select ();
|
||||
by_color_select_initialize (gdisp->gimage);
|
||||
active_tool = (* tool_info[(int) type].new_func) ();
|
||||
(* tool_info[(int) type].init_func) (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case COLOR_BALANCE:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_color_balance ();
|
||||
color_balance_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case BRIGHTNESS_CONTRAST:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_brightness_contrast ();
|
||||
brightness_contrast_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case HUE_SATURATION:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_hue_saturation ();
|
||||
hue_saturation_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case POSTERIZE:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_posterize ();
|
||||
posterize_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case THRESHOLD:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_threshold ();
|
||||
threshold_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case CURVES:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_curves ();
|
||||
curves_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case LEVELS:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_levels ();
|
||||
levels_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
case HISTOGRAM:
|
||||
if (gdisp) {
|
||||
active_tool = tools_new_histogram_tool ();
|
||||
histogram_tool_initialize (gdisp);
|
||||
} else {
|
||||
active_tool = tools_new_rect_select ();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
active_tool = (* tool_info[(int) type].new_func) ();
|
||||
break;
|
||||
}
|
||||
else
|
||||
active_tool = (* tool_info[(int) type].new_func) ();
|
||||
|
||||
/* Show the options for the active tool
|
||||
*/
|
||||
|
|
|
@ -103,6 +103,7 @@ typedef void (* ToolCtlFunc) (Tool *, int, gpointer);
|
|||
/* ToolInfo function declarations */
|
||||
typedef Tool *(* ToolInfoNewFunc) (void);
|
||||
typedef void (* ToolInfoFreeFunc) (Tool *);
|
||||
typedef void (* ToolInfoInitFunc) (GDisplay *);
|
||||
|
||||
struct _tool
|
||||
{
|
||||
|
@ -134,9 +135,24 @@ struct _ToolInfo
|
|||
{
|
||||
GtkWidget *tool_options;
|
||||
char *tool_name;
|
||||
int toolbar_position;
|
||||
|
||||
int toolbar_position;
|
||||
|
||||
char *menu_path;
|
||||
char *menu_accel;
|
||||
|
||||
char **icon_data;
|
||||
|
||||
char *tool_desc;
|
||||
char *private_tip;
|
||||
|
||||
gint tool_id;
|
||||
|
||||
ToolInfoNewFunc new_func;
|
||||
ToolInfoFreeFunc free_func;
|
||||
ToolInfoInitFunc init_func;
|
||||
|
||||
GtkWidget *tool_widget;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -760,7 +760,7 @@ undo_pop_mask (GImage *gimage,
|
|||
* for this gimage's mask, send it an update notice
|
||||
*/
|
||||
if (gimage->by_color_select)
|
||||
by_color_select_initialize ((void *) gimage);
|
||||
by_color_select_initialize_by_image (gimage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ select_device (guint32 new_device)
|
|||
{
|
||||
if (device_info->brush)
|
||||
select_brush (device_info->brush);
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) device_info->tool].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) device_info->tool].tool_widget);
|
||||
palette_set_foreground (device_info->foreground[0],
|
||||
device_info->foreground[1],
|
||||
device_info->foreground[2]);
|
||||
|
@ -799,6 +799,7 @@ device_status_update (guint32 deviceid)
|
|||
create_tool_pixmap (deviceD->table,
|
||||
device_info->tool),
|
||||
NULL);
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
|
||||
for (j=0;j<20*3;j+=3)
|
||||
|
@ -822,3 +823,7 @@ device_status_update (guint32 deviceid)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ select_device (guint32 new_device)
|
|||
{
|
||||
if (device_info->brush)
|
||||
select_brush (device_info->brush);
|
||||
gtk_widget_activate (tool_widgets[tool_info[(int) device_info->tool].toolbar_position]);
|
||||
gtk_widget_activate (tool_info[(int) device_info->tool].tool_widget);
|
||||
palette_set_foreground (device_info->foreground[0],
|
||||
device_info->foreground[1],
|
||||
device_info->foreground[2]);
|
||||
|
@ -799,6 +799,7 @@ device_status_update (guint32 deviceid)
|
|||
create_tool_pixmap (deviceD->table,
|
||||
device_info->tool),
|
||||
NULL);
|
||||
gtk_widget_draw (deviceD->tools[i], NULL);
|
||||
gtk_widget_show (deviceD->tools[i]);
|
||||
|
||||
for (j=0;j<20*3;j+=3)
|
||||
|
@ -822,3 +823,7 @@ device_status_update (guint32 deviceid)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -94,8 +94,9 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Select/Grow", NULL, select_grow_cmd_callback, 0 },
|
||||
{ "/Select/Shrink", NULL, select_shrink_cmd_callback, 0 },
|
||||
{ "/Select/Save To Channel", NULL, select_save_cmd_callback, 0 },
|
||||
{ "/Select/By Color...", NULL, select_by_color_cmd_callback, 0 },
|
||||
|
||||
/*
|
||||
{ "/Select/By Color...", NULL, tools_select_cmd_callback, BY_COLOR_SELECT },
|
||||
*/
|
||||
{ "/View/Zoom In", "equal", view_zoomin_cmd_callback, 0 },
|
||||
{ "/View/Zoom Out", "minus", view_zoomout_cmd_callback, 0 },
|
||||
{ "/View/Zoom/16:1", NULL, view_zoom_16_1_callback, 0 },
|
||||
|
@ -117,14 +118,16 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
|
||||
{ "/Image/Colors/Equalize", NULL, image_equalize_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Invert", NULL, image_invert_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Posterize", NULL, image_posterize_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Threshold", NULL, image_threshold_cmd_callback, 0 },
|
||||
/*
|
||||
{ "/Image/Colors/Posterize", NULL, tools_select_cmd_callback, POSTERIZE },
|
||||
{ "/Image/Colors/Threshold", NULL, tools_select_cmd_callback, THRESHOLD },
|
||||
{ "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Colors/Color Balance", NULL, image_color_balance_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Brightness-Contrast", NULL, image_brightness_contrast_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Hue-Saturation", NULL, image_hue_saturation_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Curves", NULL, image_curves_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Levels", NULL, image_levels_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Color Balance", NULL, tools_select_cmd_callback, COLOR_BALANCE },
|
||||
{ "/Image/Colors/Brightness-Contrast", NULL, tools_select_cmd_callback, BRIGHTNESS_CONTRAST },
|
||||
{ "/Image/Colors/Hue-Saturation", NULL, tools_select_cmd_callback, 0 },
|
||||
{ "/Image/Colors/Curves", NULL, tools_select_cmd_callback, CURVES },
|
||||
{ "/Image/Colors/Levels", NULL, tools_select_cmd_callback, LEVELS },
|
||||
*/
|
||||
{ "/Image/Colors/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Colors/Desaturate", NULL, image_desaturate_cmd_callback, 0 },
|
||||
{ "/Image/Channel Ops/Duplicate", "<control>D", channel_ops_duplicate_cmd_callback, 0 },
|
||||
|
@ -139,7 +142,7 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Image/Resize", NULL, image_resize_cmd_callback, 0 },
|
||||
{ "/Image/Scale", NULL, image_scale_cmd_callback, 0 },
|
||||
{ "/Image/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Image/Histogram", NULL, image_histogram_cmd_callback, 0 },
|
||||
/* { "/Image/Histogram", NULL, tools_select_cmd_callback, HISTOGRAM}, */
|
||||
{ "/Image/---", NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ "/Layers/Layers & Channels...", "<control>L", dialogs_lc_cmd_callback, 0 },
|
||||
|
@ -152,7 +155,7 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Layers/Mask To Selection", NULL, layers_mask_select_cmd_callback, 0 },
|
||||
{ "/Layers/Add Alpha Channel", NULL, layers_add_alpha_channel_cmd_callback, 0 },
|
||||
|
||||
{ "/Tools/Rect Select", "R", tools_select_cmd_callback, RECT_SELECT },
|
||||
/* { "/Tools/Rect Select", "R", tools_select_cmd_callback, RECT_SELECT },
|
||||
{ "/Tools/Ellipse Select", "E", tools_select_cmd_callback, ELLIPSE_SELECT },
|
||||
{ "/Tools/Free Select", "F", tools_select_cmd_callback, FREE_SELECT },
|
||||
{ "/Tools/Fuzzy Select", "Z", tools_select_cmd_callback, FUZZY_SELECT },
|
||||
|
@ -175,10 +178,9 @@ static GtkItemFactoryEntry image_entries[] =
|
|||
{ "/Tools/Convolve", "V", tools_select_cmd_callback, CONVOLVE },
|
||||
{ "/Tools/Ink", "K", tools_select_cmd_callback, INK },
|
||||
{ "/Tools/Default Colors", "D", tools_default_colors_cmd_callback, 0 },
|
||||
{ "/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, 0 },
|
||||
{ "/Tools/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, 0 }, */
|
||||
{ "/Tools/Toolbox", NULL, toolbox_raise_callback, 0 },
|
||||
|
||||
{ "/Tools/---", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Filters/", NULL, NULL, 0 },
|
||||
{ "/Filters/Repeat last", "<alt>F", filters_repeat_cmd_callback, 0x0 },
|
||||
{ "/Filters/Re-show last", "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
|
||||
|
@ -217,6 +219,7 @@ static GtkItemFactory *save_factory = NULL;
|
|||
|
||||
static int initialize = TRUE;
|
||||
|
||||
extern int num_tools;
|
||||
|
||||
void
|
||||
menus_get_toolbox_menubar (GtkWidget **menubar,
|
||||
|
@ -280,6 +283,28 @@ menus_create (GtkMenuEntry *entries,
|
|||
gtk_item_factory_create_menu_entries (nmenu_entries, entries);
|
||||
}
|
||||
|
||||
void
|
||||
menus_tools_create (ToolInfo *tool_info)
|
||||
{
|
||||
GtkItemFactoryEntry entry;
|
||||
|
||||
/* entry.path = g_strconcat ("<Image>", tool_info->menu_path, NULL);*/
|
||||
/* entry.callback_data = tool_info; */
|
||||
entry.path = tool_info->menu_path;
|
||||
entry.accelerator = tool_info->menu_accel;
|
||||
entry.callback = tools_select_cmd_callback;
|
||||
entry.callback_action = tool_info->tool_id;
|
||||
entry.item_type = NULL;
|
||||
|
||||
fflush(stderr);
|
||||
/*menus_create (&entry, 1);*/
|
||||
gtk_item_factory_create_item (image_factory,
|
||||
&entry,
|
||||
(gpointer)tool_info,
|
||||
2);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
menus_set_sensitive (char *path,
|
||||
int sensitive)
|
||||
|
@ -359,6 +384,8 @@ menus_quit ()
|
|||
static void
|
||||
menus_init ()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (initialize)
|
||||
{
|
||||
gchar *filename;
|
||||
|
@ -385,9 +412,19 @@ menus_init ()
|
|||
n_save_entries,
|
||||
save_entries,
|
||||
NULL, 2);
|
||||
|
||||
for (i = 0; i < num_tools; i++)
|
||||
{
|
||||
/* FIXME this need to use access functions to check a flag */
|
||||
if (tool_info[i].menu_path)
|
||||
menus_tools_create (tool_info+i);
|
||||
}
|
||||
filename = g_strconcat (gimp_directory (), "/menurc", NULL);
|
||||
gtk_item_factory_parse_rc (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue