app/Makefile.am app/gimphelp.[ch] new files

1999-09-27  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/gimphelp.[ch]
	* app/gimpui.[ch]: new files

	* app/interface.[ch]
	* app/preferences_dialog.[ch]

	The GIMP Help System part 1: Press "F1" in any dialog to pop up
	the help page for this dialog.

	Moved the widget constructors from preferences_dialog.[ch] and the
	query boxes from interface.[ch] to gimpui.[ch].

	The dialog constructors take a help_func and a help_data
	parameter and install the "F1" accelerator which emits the new
	"help" signal.

	The "help" signal callback calls help_func(help_data) which finally
	has to call gimp_help() which in turn invokes the help browser.

	Still have to find a proper way to (1) prevent "F1" being assigned
	to some menu item and (2) to catch "F1" while browsing the menu
	trees in order to pop up the help for the selected item.

	* app/menus.c: a <Toolbox>/File/Help... menu item.
	* app/commands.[ch]: a command callback for the "Help..." menu item.

	* app/gimprc.[ch]: new boolean gimprc variable "use_help".

	* app/info_dialog.[ch]: pass a help function and data to the info
	dialog constructor.

	* app/tools.[ch]: store the tools help page names in the tool info
	structure. Export a special tools_help_func() which shows the help
	page for the active tool.

	* app/[all files calling a dialog constructor]: pass the dialog's
	help page to the constructor.

	Most dialogs are now created by gimp_dialog_new() which also sets
	up the action_area and the WM delete event callback, so I removed
	the resp. code from these files.

	Fixed some minor bugs and did some other stuff but didn't change
	any logic except dialog creation.

	* plug-ins/helpbrowser/helpbrowser.c: don't try to call a running
	help browser and don't install any menu path (all done in
	app/gimphelp.[ch] now).
This commit is contained in:
Michael Natterer 1999-09-27 17:58:10 +00:00 committed by Michael Natterer
parent 46a53f0a7d
commit 002aa905db
191 changed files with 12912 additions and 15115 deletions

View File

@ -1,3 +1,55 @@
1999-09-27 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/gimphelp.[ch]
* app/gimpui.[ch]: new files
* app/interface.[ch]
* app/preferences_dialog.[ch]
The GIMP Help System part 1: Press "F1" in any dialog to pop up
the help page for this dialog.
Moved the widget constructors from preferences_dialog.[ch] and the
query boxes from interface.[ch] to gimpui.[ch].
The dialog constructors take a help_func and a help_data
parameter and install the "F1" accelerator which emits the new
"help" signal.
The "help" signal callback calls help_func(help_data) which finally
has to call gimp_help() which in turn invokes the help browser.
Still have to find a proper way to (1) prevent "F1" being assigned
to some menu item and (2) to catch "F1" while browsing the menu
trees in order to pop up the help for the selected item.
* app/menus.c: a <Toolbox>/File/Help... menu item.
* app/commands.[ch]: a command callback for the "Help..." menu item.
* app/gimprc.[ch]: new boolean gimprc variable "use_help".
* app/info_dialog.[ch]: pass a help function and data to the info
dialog constructor.
* app/tools.[ch]: store the tools help page names in the tool info
structure. Export a special tools_help_func() which shows the help
page for the active tool.
* app/[all files calling a dialog constructor]: pass the dialog's
help page to the constructor.
Most dialogs are now created by gimp_dialog_new() which also sets
up the action_area and the WM delete event callback, so I removed
the resp. code from these files.
Fixed some minor bugs and did some other stuff but didn't change
any logic except dialog creation.
* plug-ins/helpbrowser/helpbrowser.c: don't try to call a running
help browser and don't install any menu path (all done in
app/gimphelp.[ch] now).
Mon Sep 27 17:13:48 1999 ape@gandalf.spacetec.no (Asbjorn Pettersen)
* app/unittest/gimpparse.c (global_parse_init):

View File

@ -203,6 +203,8 @@ gimp_SOURCES = \
gimpcontextpreview.h \
gimpdnd.c \
gimpdnd.h \
gimphelp.c \
gimphelp.h \
gimphistogram.c \
gimphistogram.h \
gimphistogramP.h \
@ -222,6 +224,8 @@ gimp_SOURCES = \
gimprc.c \
gimprc.h \
gimprc_cmds.c \
gimpui.c \
gimpui.h \
gimpunit.c \
global_edit.c \
global_edit.h \

View File

@ -35,13 +35,14 @@
#include "gdisplay_ops.h"
#include "gdisplay_color_ui.h"
#include "gimage_mask.h"
#include "gimphelp.h"
#include "gimprc.h"
#include "gimpui.h"
#include "global_edit.h"
#include "gradient.h"
#include "image_render.h"
#include "info_window.h"
#include "nav_window.h"
#include "interface.h"
#include "invert.h"
#include "lc_dialog.h"
#include "layer_select.h"
@ -74,7 +75,6 @@ extern void layers_dialog_layer_merge_query (GImage *, gboolean);
static void image_resize_callback (GtkWidget *, gpointer);
static void image_scale_callback (GtkWidget *, gpointer);
static void image_cancel_callback (GtkWidget *, gpointer);
static gint image_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void gimage_mask_feather_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_border_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
@ -345,54 +345,69 @@ void
select_border_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Border Selection"),
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Border Selection"),
gimp_standard_help_func,
"dialogs/border_selection_dialog.html",
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_feather_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Feather Selection"),
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Feather Selection"),
gimp_standard_help_func,
"dialogs/feather_selection_dialog.html",
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_grow_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Grow Selection"),
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Grow Selection"),
gimp_standard_help_func,
"dialogs/grow_selection_dialog.html",
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
@ -405,15 +420,18 @@ select_shrink_cmd_callback (GtkWidget *widget,
GDisplay * gdisp;
return_if_no_display (gdisp);
shrink_dialog = query_size_box (N_("Shrink Selection"),
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
shrink_dialog =
gimp_query_size_box (N_("Shrink Selection"),
gimp_standard_help_func,
"dialogs/shrink_selection_dialog.html",
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
/* eeek */
@ -810,7 +828,6 @@ image_resize_cmd_callback (GtkWidget *widget,
gdisp->dot_for_dot,
image_resize_callback,
image_cancel_callback,
image_delete_callback,
image_resize);
gtk_widget_show (image_resize->resize->resize_shell);
@ -842,7 +859,6 @@ image_scale_cmd_callback (GtkWidget *widget,
gdisp->dot_for_dot,
image_scale_callback,
image_cancel_callback,
image_delete_callback,
image_scale);
gtk_widget_show (image_scale->resize->resize_shell);
@ -1175,6 +1191,13 @@ about_dialog_cmd_callback (GtkWidget *widget,
about_dialog_create (FALSE);
}
void
gimp_help_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gimp_help ("");
}
void
tips_dialog_cmd_callback (GtkWidget *widget,
gpointer client_data)
@ -1284,17 +1307,6 @@ image_scale_callback (GtkWidget *widget,
g_free (image_scale);
}
static gint
image_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
image_cancel_callback (widget, client_data);
return TRUE;
}
static void
image_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -109,6 +109,7 @@ void dialogs_error_console_cmd_callback (GtkWidget *, gpointer);
void dialogs_module_browser_cmd_callback (GtkWidget *, gpointer);
void dialogs_display_filters_cmd_callback (GtkWidget *, gpointer);
void about_dialog_cmd_callback (GtkWidget *, gpointer);
void gimp_help_cmd_callback (GtkWidget *, gpointer);
void tips_dialog_cmd_callback (GtkWidget *, gpointer);
#endif /* __COMMANDS_H__ */

View File

@ -24,7 +24,6 @@
#include <string.h>
#include "libgimp/gimpintl.h"
#include "actionarea.h"
#include "appenv.h"
#include "channel.h"
#include "color_panel.h"
@ -33,6 +32,7 @@
#include "gimpcontext.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"
@ -60,23 +60,8 @@ static void edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gdouble *scale_val);
static gint qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data);
/* Actual code */
static gint
qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
edit_qmask_query_cancel_callback (widget, client_data);
return TRUE;
}
static void
qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
{
@ -86,40 +71,39 @@ qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
void
qmask_buttons_update (GDisplay *gdisp)
{
g_assert(gdisp);
g_assert(gdisp);
g_assert(gdisp->gimage);
g_assert(gdisp->gimage);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
}
void
qmask_click_handler (GtkWidget *widget,
GdkEventButton *event,
@ -135,104 +119,103 @@ qmask_click_handler (GtkWidget *widget,
}
}
void
qmask_deactivate(GtkWidget *w,
GDisplay *gdisp)
qmask_deactivate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpImage *gimg;
GimpChannel *gmask;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
return; /* if already set do nothing */
}
}
undo_push_group_start (gimg, QMASK_UNDO);
undo_push_group_start (gimg, QMASK_UNDO);
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
{
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
}
else
else
gdisp->gimage->qmask_state = 0;
undo_push_group_end (gimg);
}
undo_push_group_end (gimg);
}
}
void
qmask_activate(GtkWidget *w,
GDisplay *gdisp)
qmask_activate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
double opacity;
unsigned char *color;
double opacity;
unsigned char *color;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp->gimage->qmask_state) {
if (gdisp->gimage->qmask_state) {
return; /* If already set, do nothing */
}
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
}
static void
@ -249,12 +232,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
gint i;
guchar channel_color[3] = { 0, 0, 0 };
static ActionAreaItem action_items[] =
{
{ N_("OK"), edit_qmask_query_ok_callback, NULL, NULL },
{ N_("Cancel"), edit_qmask_query_cancel_callback, NULL, NULL }
};
/* channel = gimp_image_get_channel_by_name (gdisp->gimage, "Qmask"); */
/* the new options structure */
options = g_new (EditQmaskOptions, 1);
@ -267,24 +244,25 @@ edit_qmask_channel_query (GDisplay * gdisp)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"edit_qmask_atributes", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("Edit Qmask Attributes"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (qmask_query_delete_callback),
options);
_("OK"), edit_qmask_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), edit_qmask_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
@ -316,10 +294,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
@ -327,7 +301,7 @@ edit_qmask_channel_query (GDisplay * gdisp)
}
static void edit_qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
EditQmaskOptions *options;
Channel *channel;
@ -338,8 +312,8 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
gint i;
options = (EditQmaskOptions *) client_data;
channel = gimp_image_get_channel_by_name(options->gimage, "Qmask");
opacity = (int) (255* options->opacity/100);
channel = gimp_image_get_channel_by_name (options->gimage, "Qmask");
opacity = (int) (255 * options->opacity/100);
if (options->gimage && channel)
{ /* don't update if opacity hasn't changed */
@ -377,7 +351,9 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
g_free (options);
}
static void edit_qmask_query_cancel_callback (GtkWidget *widget, gpointer client_data)
static void
edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data)
{
EditQmaskOptions *options;

View File

@ -24,7 +24,6 @@
#include <string.h>
#include "libgimp/gimpintl.h"
#include "actionarea.h"
#include "appenv.h"
#include "channel.h"
#include "color_panel.h"
@ -33,6 +32,7 @@
#include "gimpcontext.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"
@ -60,23 +60,8 @@ static void edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gdouble *scale_val);
static gint qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data);
/* Actual code */
static gint
qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
edit_qmask_query_cancel_callback (widget, client_data);
return TRUE;
}
static void
qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
{
@ -86,40 +71,39 @@ qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
void
qmask_buttons_update (GDisplay *gdisp)
{
g_assert(gdisp);
g_assert(gdisp);
g_assert(gdisp->gimage);
g_assert(gdisp->gimage);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
}
void
qmask_click_handler (GtkWidget *widget,
GdkEventButton *event,
@ -135,104 +119,103 @@ qmask_click_handler (GtkWidget *widget,
}
}
void
qmask_deactivate(GtkWidget *w,
GDisplay *gdisp)
qmask_deactivate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpImage *gimg;
GimpChannel *gmask;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
return; /* if already set do nothing */
}
}
undo_push_group_start (gimg, QMASK_UNDO);
undo_push_group_start (gimg, QMASK_UNDO);
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
{
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
}
else
else
gdisp->gimage->qmask_state = 0;
undo_push_group_end (gimg);
}
undo_push_group_end (gimg);
}
}
void
qmask_activate(GtkWidget *w,
GDisplay *gdisp)
qmask_activate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
double opacity;
unsigned char *color;
double opacity;
unsigned char *color;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp->gimage->qmask_state) {
if (gdisp->gimage->qmask_state) {
return; /* If already set, do nothing */
}
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
}
static void
@ -249,12 +232,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
gint i;
guchar channel_color[3] = { 0, 0, 0 };
static ActionAreaItem action_items[] =
{
{ N_("OK"), edit_qmask_query_ok_callback, NULL, NULL },
{ N_("Cancel"), edit_qmask_query_cancel_callback, NULL, NULL }
};
/* channel = gimp_image_get_channel_by_name (gdisp->gimage, "Qmask"); */
/* the new options structure */
options = g_new (EditQmaskOptions, 1);
@ -267,24 +244,25 @@ edit_qmask_channel_query (GDisplay * gdisp)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"edit_qmask_atributes", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("Edit Qmask Attributes"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (qmask_query_delete_callback),
options);
_("OK"), edit_qmask_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), edit_qmask_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
@ -316,10 +294,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
@ -327,7 +301,7 @@ edit_qmask_channel_query (GDisplay * gdisp)
}
static void edit_qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
EditQmaskOptions *options;
Channel *channel;
@ -338,8 +312,8 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
gint i;
options = (EditQmaskOptions *) client_data;
channel = gimp_image_get_channel_by_name(options->gimage, "Qmask");
opacity = (int) (255* options->opacity/100);
channel = gimp_image_get_channel_by_name (options->gimage, "Qmask");
opacity = (int) (255 * options->opacity/100);
if (options->gimage && channel)
{ /* don't update if opacity hasn't changed */
@ -377,7 +351,9 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
g_free (options);
}
static void edit_qmask_query_cancel_callback (GtkWidget *widget, gpointer client_data)
static void
edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data)
{
EditQmaskOptions *options;

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@ -57,6 +58,7 @@
#include "gimprc.h"
#include "gimpparasite.h"
#include "gimpset.h"
#include "gimpui.h"
#include "global_edit.h"
#include "gradient.h"
#include "gximage.h"
@ -325,7 +327,7 @@ static GtkWidget *label2 = NULL;
static GtkWidget *pbar = NULL;
static void
destroy_initialization_status_window(void)
destroy_initialization_status_window (void)
{
if (win_initstatus)
{
@ -338,7 +340,7 @@ destroy_initialization_status_window(void)
}
static void
make_initialization_status_window(void)
make_initialization_status_window (void)
{
if (no_interface == FALSE)
{
@ -413,9 +415,9 @@ make_initialization_status_window(void)
}
void
app_init_update_status (char *label1val,
char *label2val,
float pct_progress)
app_init_update_status (char *label1val,
char *label2val,
float pct_progress)
{
char *temp;
@ -710,20 +712,10 @@ really_quit_cancel_callback (GtkWidget *widget,
gtk_widget_destroy (dialog);
}
static gint
really_quit_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
really_quit_cancel_callback (widget, (GtkWidget *) client_data);
return TRUE;
}
static void
really_quit_dialog (void)
{
GtkWidget *dialog;
GtkWidget *button;
GtkWidget *hbox;
GtkWidget *pixmap_widget;
GdkPixmap *pixmap;
@ -734,36 +726,22 @@ really_quit_dialog (void)
menus_set_sensitive_glue ("<Toolbox>", N_("/File/Quit"), FALSE);
menus_set_sensitive_glue ("<Image>", N_("/File/Quit"), FALSE);
dialog = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (dialog), "really_quit", "Gimp");
gtk_window_set_title (GTK_WINDOW (dialog), _("Really Quit?"));
gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 2);
dialog = gimp_dialog_new (_("Really Quit?"), "really_quit",
gimp_standard_help_func,
"dialogs/really_quit_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GtkSignalFunc) really_quit_delete_callback,
dialog);
_("Quit"), really_quit_callback,
NULL, NULL, TRUE, FALSE,
_("Cancel"), really_quit_cancel_callback,
NULL, NULL, FALSE, TRUE,
button = gtk_button_new_with_label (_("Quit"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) really_quit_callback,
dialog);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), button, TRUE, TRUE, 0);
gtk_widget_grab_default (button);
gtk_widget_show (button);
button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) really_quit_cancel_callback,
dialog);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), button, TRUE, TRUE, 0);
gtk_widget_show (button);
NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
gtk_widget_show (hbox);
gtk_widget_realize (dialog);

View File

@ -28,6 +28,7 @@
#include "general.h"
#include "gimage_mask.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "image_map.h"
#include "interface.h"
@ -69,8 +70,6 @@ static void color_balance_update (ColorBalanceDialog *, int);
static void color_balance_preview (ColorBalanceDialog *);
static void color_balance_ok_callback (GtkWidget *, gpointer);
static void color_balance_cancel_callback (GtkWidget *, gpointer);
static gint color_balance_delete_callback (GtkWidget *, GdkEvent *,
gpointer);
static void color_balance_shadows_callback (GtkWidget *, gpointer);
static void color_balance_midtones_callback (GtkWidget *, gpointer);
static void color_balance_highlights_callback (GtkWidget *, gpointer);
@ -253,7 +252,6 @@ color_balance_initialize (GDisplay *gdisp)
/* Color Balance dialog */
/**************************/
/* the action area structure */
static ColorBalanceDialog *
color_balance_new_dialog ()
{
@ -269,15 +267,9 @@ color_balance_new_dialog ()
GtkWidget *radio_button;
GtkObject *data;
GSList *group = NULL;
int i;
gint i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), color_balance_ok_callback, NULL, NULL },
{ N_("Cancel"), color_balance_cancel_callback, NULL, NULL }
};
char *appl_mode_names[] =
gchar *appl_mode_names[] =
{
N_("Shadows"),
N_("Midtones"),
@ -297,18 +289,21 @@ color_balance_new_dialog ()
cbd->application_mode = SHADOWS;
/* The shell and main vbox */
cbd->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cbd->shell), "color_balance", "Gimp");
gtk_window_set_title (GTK_WINDOW (cbd->shell), _("Color Balance"));
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (cbd->shell), "delete_event",
GTK_SIGNAL_FUNC (color_balance_delete_callback),
cbd);
cbd->shell = gimp_dialog_new (_("Color Balance"), "color_balance",
tools_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("OK"), color_balance_ok_callback,
cbd, NULL, TRUE, FALSE,
_("Cancel"), color_balance_cancel_callback,
cbd, NULL, FALSE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cbd->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cbd->shell)->vbox), vbox);
/* Horizontal box for application mode */
hbox = gtk_hbox_new (TRUE, 2);
@ -473,11 +468,6 @@ color_balance_new_dialog ()
}
gtk_widget_show (hbox);
/* The action area */
action_items[0].user_data = cbd;
action_items[1].user_data = cbd;
build_action_area (GTK_DIALOG (cbd->shell), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (cbd->shell);
@ -614,16 +604,6 @@ color_balance_ok_callback (GtkWidget *widget,
active_tool->drawable = NULL;
}
static gint
color_balance_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
color_balance_cancel_callback (w, client_data);
return TRUE;
}
static void
color_balance_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -21,7 +21,6 @@
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "buildmenu.h"
#include "colormaps.h"
#include "cursorutil.h"
@ -29,6 +28,7 @@
#include "general.h"
#include "gdisplay.h"
#include "gimphistogram.h"
#include "gimpui.h"
#include "interface.h"
#include "curves.h"
#include "gimplut.h"
@ -114,7 +114,6 @@ static void curves_free_callback (GtkWidget *, gpointer);
static void curves_reset_callback (GtkWidget *, gpointer);
static void curves_ok_callback (GtkWidget *, gpointer);
static void curves_cancel_callback (GtkWidget *, gpointer);
static gint curves_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void curves_preview_update (GtkWidget *, gpointer);
static gint curves_xrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static gint curves_yrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
@ -519,14 +518,7 @@ curves_new_dialog ()
GtkWidget *channel_hbox;
GtkWidget *menu;
GtkWidget *table;
int i, j;
static ActionAreaItem action_items[] =
{
{ N_("Reset"), curves_reset_callback, NULL, NULL },
{ N_("OK"), curves_ok_callback, NULL, NULL },
{ N_("Cancel"), curves_cancel_callback, NULL, NULL }
};
gint i, j;
static MenuItem curve_type_items[] =
{
@ -535,7 +527,7 @@ curves_new_dialog ()
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
};
cd = g_malloc (sizeof (CurvesDialog));
cd = g_new (CurvesDialog, 1);
cd->cursor_ind_height = cd->cursor_ind_width = -1;
cd->preview = TRUE;
cd->curve_type = SMOOTH;
@ -556,17 +548,23 @@ curves_new_dialog ()
curve_type_items [i].user_data = (gpointer) cd;
/* The shell and main vbox */
cd->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cd->shell), "curves", "Gimp");
gtk_window_set_title (GTK_WINDOW (cd->shell), _("Curves"));
cd->shell = gimp_dialog_new (_("Curves"), "curves",
tools_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("Reset"), curves_reset_callback,
cd, NULL, FALSE, FALSE,
_("OK"), curves_ok_callback,
cd, NULL, TRUE, FALSE,
_("Cancel"), curves_cancel_callback,
cd, NULL, FALSE, TRUE,
NULL);
gtk_signal_connect (GTK_OBJECT (cd->shell), "delete_event",
GTK_SIGNAL_FUNC (curves_delete_callback),
cd);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cd->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cd->shell)->vbox), vbox);
/* The option menu for selecting channels */
channel_hbox = gtk_hbox_new (FALSE, 2);
@ -670,12 +668,6 @@ curves_new_dialog ()
gtk_widget_show (toggle);
gtk_widget_show (hbox);
/* The action area */
action_items[0].user_data = cd;
action_items[1].user_data = cd;
action_items[2].user_data = cd;
build_action_area (GTK_DIALOG (cd->shell), action_items, 3, 0);
gtk_widget_show (vbox);
return cd;
@ -1278,24 +1270,15 @@ curves_cancel_callback (GtkWidget *widget,
active_tool->drawable = NULL;
}
static gint
curves_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer data)
{
curves_cancel_callback (w, data);
return TRUE;
}
static void
curves_preview_update (GtkWidget *w,
curves_preview_update (GtkWidget *widget,
gpointer data)
{
CurvesDialog *cd;
cd = (CurvesDialog *) data;
if (GTK_TOGGLE_BUTTON (w)->active)
if (GTK_TOGGLE_BUTTON (widget)->active)
{
cd->preview = TRUE;
curves_preview (cd);

View File

@ -18,6 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "actionarea.h"
#include "colormaps.h"
@ -25,6 +26,7 @@
#include "general.h"
#include "gimage_mask.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "hue_saturation.h"
#include "interface.h"
@ -88,8 +90,6 @@ static void hue_saturation_update (HueSaturationDialog *,
static void hue_saturation_preview (HueSaturationDialog *);
static void hue_saturation_ok_callback (GtkWidget *, gpointer);
static void hue_saturation_cancel_callback (GtkWidget *, gpointer);
static gint hue_saturation_delete_callback (GtkWidget *, GdkEvent *,
gpointer);
static void hue_saturation_master_callback (GtkWidget *, gpointer);
static void hue_saturation_R_callback (GtkWidget *, gpointer);
static void hue_saturation_Y_callback (GtkWidget *, gpointer);
@ -223,7 +223,7 @@ hue_saturation (PixelRegion *srcPR,
}
/* by_color select action functions */
/* hue saturation action functions */
static void
hue_saturation_control (Tool *tool,
@ -281,7 +281,7 @@ tools_free_hue_saturation (Tool *tool)
color_bal = (HueSaturation *) tool->private;
/* Close the color select dialog */
/* Close the hue saturation dialog */
if (hue_saturation_dialog)
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
@ -299,7 +299,7 @@ hue_saturation_initialize (GDisplay *gdisp)
return;
}
/* The "hue-saturation color" dialog */
/* The "hue-saturation" dialog */
if (!hue_saturation_dialog)
hue_saturation_dialog = hue_saturation_new_dialog ();
else
@ -354,15 +354,9 @@ hue_saturation_new_dialog ()
GtkWidget *frame;
GtkObject *data;
GSList *group = NULL;
int i;
gint i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), hue_saturation_ok_callback, NULL, NULL },
{ N_("Cancel"), hue_saturation_cancel_callback, NULL, NULL }
};
char *hue_partition_names[] =
gchar *hue_partition_names[] =
{
N_("Master"),
N_("R"),
@ -384,23 +378,26 @@ hue_saturation_new_dialog ()
hue_saturation_M_callback
};
hsd = g_malloc (sizeof (HueSaturationDialog));
hsd = g_new (HueSaturationDialog, 1);
hsd->hue_partition = 0;
hsd->preview = TRUE;
hsd->preview = TRUE;
/* The shell and main vbox */
hsd->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (hsd->shell), "hue_saturation", "Gimp");
gtk_window_set_title (GTK_WINDOW (hsd->shell), _("Hue-Saturation"));
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (hsd->shell), "delete_event",
GTK_SIGNAL_FUNC (hue_saturation_delete_callback),
hsd);
hsd->shell = gimp_dialog_new (_("Hue-Saturation"), "hue_satiration",
tools_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("OK"), hue_saturation_ok_callback,
hsd, NULL, TRUE, FALSE,
_("Cancel"), hue_saturation_cancel_callback,
hsd, NULL, FALSE, TRUE,
NULL);
main_vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (hsd->shell)->vbox), main_vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (hsd->shell)->vbox), main_vbox);
/* The main hbox containing hue partitions and sliders */
main_hbox = gtk_hbox_new (FALSE, 2);
@ -579,12 +576,6 @@ hue_saturation_new_dialog ()
gtk_widget_show (toggle);
gtk_widget_show (hbox);
/* The action area */
action_items[0].user_data = hsd;
action_items[1].user_data = hsd;
build_action_area (GTK_DIALOG (hsd->shell), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (main_hbox);
@ -699,16 +690,6 @@ hue_saturation_ok_callback (GtkWidget *widget,
active_tool->drawable = NULL;
}
static gint
hue_saturation_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
hue_saturation_cancel_callback (w, client_data);
return TRUE;
}
static void
hue_saturation_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -19,10 +19,10 @@
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "actionarea.h"
#include "drawable.h"
#include "general.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "threshold.h"
@ -56,8 +56,6 @@ static ThresholdDialog * threshold_new_dialog (void);
static void threshold_preview (ThresholdDialog *);
static void threshold_ok_callback (GtkWidget *, gpointer);
static void threshold_cancel_callback (GtkWidget *, gpointer);
static gint threshold_delete_callback (GtkWidget *, GdkEvent *,
gpointer);
static void threshold_preview_update (GtkWidget *, gpointer);
static void threshold_low_threshold_text_update (GtkWidget *, gpointer);
static void threshold_high_threshold_text_update (GtkWidget *, gpointer);
@ -273,31 +271,29 @@ threshold_new_dialog ()
GtkWidget *frame;
GtkWidget *toggle;
static ActionAreaItem action_items[] =
{
{ N_("OK"), threshold_ok_callback, NULL, NULL },
{ N_("Cancel"), threshold_cancel_callback, NULL, NULL }
};
td = g_malloc (sizeof (ThresholdDialog));
td->preview = TRUE;
td->low_threshold = 127;
td = g_new (ThresholdDialog, 1);
td->preview = TRUE;
td->low_threshold = 127;
td->high_threshold = 255;
td->hist = gimp_histogram_new();
td->hist = gimp_histogram_new ();
/* The shell and main vbox */
td->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (td->shell), "threshold", "Gimp");
gtk_window_set_title (GTK_WINDOW (td->shell), _("Threshold"));
td->shell =
gimp_dialog_new (_("Threshold"), "threshold",
tools_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (td->shell), "delete_event",
GTK_SIGNAL_FUNC (threshold_delete_callback),
td);
_("OK"), threshold_ok_callback,
td, NULL, TRUE, FALSE,
_("Cancel"), threshold_cancel_callback,
td, NULL, FALSE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (td->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (td->shell)->vbox), vbox);
/* Horizontal box for threshold text widget */
hbox = gtk_hbox_new (TRUE, 2);
@ -362,11 +358,6 @@ threshold_new_dialog ()
gtk_widget_show (toggle);
gtk_widget_show (hbox);
/* The action area */
action_items[0].user_data = td;
action_items[1].user_data = td;
build_action_area (GTK_DIALOG (td->shell), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (td->shell);
@ -411,16 +402,6 @@ threshold_ok_callback (GtkWidget *widget,
active_tool->drawable = NULL;
}
static gint
threshold_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
threshold_cancel_callback (w, client_data);
return TRUE;
}
static void
threshold_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -19,10 +19,10 @@
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "actionarea.h"
#include "brightness_contrast.h"
#include "drawable.h"
#include "gimage_mask.h"
#include "gimpui.h"
#include "gdisplay.h"
#include "image_map.h"
#include "interface.h"
@ -89,7 +89,6 @@ static void brightness_contrast_update (BrightnessContrastDia
static void brightness_contrast_preview (BrightnessContrastDialog *);
static void brightness_contrast_ok_callback (GtkWidget *, gpointer);
static void brightness_contrast_cancel_callback (GtkWidget *, gpointer);
static gint brightness_contrast_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void brightness_contrast_preview_update (GtkWidget *, gpointer);
static void brightness_contrast_brightness_scale_update (GtkAdjustment *, gpointer);
static void brightness_contrast_contrast_scale_update (GtkAdjustment *, gpointer);
@ -208,26 +207,24 @@ brightness_contrast_new_dialog ()
GtkWidget *toggle;
GtkObject *data;
static ActionAreaItem action_items[] =
{
{ N_("OK"), brightness_contrast_ok_callback, NULL, NULL },
{ N_("Cancel"), brightness_contrast_cancel_callback, NULL, NULL }
};
bcd = g_new (BrightnessContrastDialog, 1);
bcd->preview = TRUE;
bcd->lut = gimp_lut_new ();
/* The shell and main vbox */
bcd->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (bcd->shell), "brightness_contrast", "Gimp");
gtk_window_set_title (GTK_WINDOW (bcd->shell), _("Brightness-Contrast"));
bcd->shell =
gimp_dialog_new (_("Brightness-Contrast"), "brightness_contrast",
tools_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* handle wm close signal */
gtk_signal_connect (GTK_OBJECT (bcd->shell), "delete_event",
GTK_SIGNAL_FUNC (brightness_contrast_delete_callback),
bcd);
_("OK"), brightness_contrast_ok_callback,
bcd, NULL, TRUE, FALSE,
_("Cancel"), brightness_contrast_cancel_callback,
bcd, NULL, FALSE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
@ -320,12 +317,6 @@ brightness_contrast_new_dialog ()
gtk_widget_show (toggle);
gtk_widget_show (hbox);
/* The action area */
action_items[0].user_data = bcd;
action_items[1].user_data = bcd;
build_action_area (GTK_DIALOG (bcd->shell), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (bcd->shell);
@ -412,16 +403,6 @@ brightness_contrast_ok_callback (GtkWidget *widget,
active_tool->drawable = NULL;
}
static gint
brightness_contrast_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
brightness_contrast_cancel_callback (widget, data);
return TRUE;
}
static void
brightness_contrast_cancel_callback (GtkWidget *widget,
gpointer data)

View File

@ -23,22 +23,16 @@
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "brush_edit.h"
#include "actionarea.h"
#include "gimpui.h"
#include "libgimp/gimpintl.h"
static void brush_edit_close_callback (GtkWidget *w, void *data);
static void brush_edit_close_callback (GtkWidget *, gpointer);
static gint brush_edit_preview_resize (GtkWidget *widget, GdkEvent *event,
BrushEditGeneratedWindow *begw);
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("Close"), brush_edit_close_callback, NULL, NULL }
};
static void
update_brush_callback (GtkAdjustment *adjustment,
update_brush_callback (GtkAdjustment *adjustment,
BrushEditGeneratedWindow *begw)
{
if (begw->brush &&
@ -64,15 +58,6 @@ update_brush_callback (GtkAdjustment *adjustment,
}
}
static gint
brush_edit_delete_callback (GtkWidget *w,
BrushEditGeneratedWindow *begw)
{
if (GTK_WIDGET_VISIBLE (w))
gtk_widget_hide (w);
return TRUE;
}
static void
brush_edit_clear_preview (BrushEditGeneratedWindow *begw)
{
@ -93,7 +78,7 @@ brush_edit_clear_preview (BrushEditGeneratedWindow *begw)
}
static gint
brush_edit_brush_dirty_callback(GimpBrush *brush,
brush_edit_brush_dirty_callback (GimpBrush *brush,
BrushEditGeneratedWindow *begw)
{
int x, y, width, yend, ystart, xo;
@ -138,15 +123,17 @@ brush_edit_brush_dirty_callback(GimpBrush *brush,
return TRUE;
}
void brush_renamed_callback(GtkWidget *widget, BrushEditGeneratedWindow *begw)
void
brush_renamed_callback (GtkWidget *widget,
BrushEditGeneratedWindow *begw)
{
gtk_entry_set_text(GTK_ENTRY(begw->name),
gimp_brush_get_name(GIMP_BRUSH(begw->brush)));
}
void
brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
GimpBrush *gbrush)
brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
GimpBrush *gbrush)
{
GimpBrushGenerated *brush = 0;
if (begw->brush == (GimpBrushGenerated*)gbrush)
@ -189,16 +176,21 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
}
}
void name_changed_func(GtkWidget *widget, BrushEditGeneratedWindow *begw)
void
name_changed_func (GtkWidget *widget,
BrushEditGeneratedWindow *begw)
{
gchar *entry_text;
entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
gimp_brush_set_name(GIMP_BRUSH(begw->brush), entry_text);
}
void focus_out_func(GtkWidget *wid1, GtkWidget *wid2, BrushEditGeneratedWindow *begw)
void
focus_out_func (GtkWidget *wid1,
GtkWidget *wid2,
BrushEditGeneratedWindow *begw)
{
name_changed_func(wid1, begw);
name_changed_func (wid1, begw);
}
BrushEditGeneratedWindow *
@ -210,34 +202,31 @@ brush_edit_generated_new ()
GtkWidget *slider;
GtkWidget *table;
begw = g_malloc (sizeof (BrushEditGeneratedWindow));
begw = g_new (BrushEditGeneratedWindow, 1);
begw->brush = NULL;
begw->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (begw->shell), "generatedbrusheditor",
"Gimp");
gtk_window_set_title (GTK_WINDOW (begw->shell), _("Brush Editor"));
gtk_window_set_policy(GTK_WINDOW(begw->shell), FALSE, TRUE, FALSE);
begw->shell = gimp_dialog_new (_("Brush Editor"), "generated_brush_editor",
gimp_standard_help_func,
"dialogs/generated_brush_editor_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("Close"), brush_edit_close_callback,
begw, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (begw->shell)->vbox), vbox,
TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (begw->shell)->vbox), vbox);
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (begw->shell), "delete_event",
GTK_SIGNAL_FUNC (brush_edit_delete_callback),
begw);
/* Populate the window with some widgets */
/* Populate the window with some widgets */
/* table for brush controlls */
/* table for brush controlls */
table = gtk_table_new(5, 4, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
/* Brush's name */
/* Brush's name */
begw->name = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (vbox), begw->name, TRUE, TRUE, 0);
@ -249,7 +238,7 @@ brush_edit_generated_new ()
begw);
gtk_widget_show(begw->name);
/* brush's preview widget w/frame */
/* brush's preview widget w/frame */
begw->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (begw->frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), begw->frame, TRUE, TRUE, 0);
@ -276,7 +265,7 @@ brush_edit_generated_new ()
/* brush radius scale */
label = gtk_label_new (_("Radius:"));
gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
/* gtk_table_attach(GTK_TABLE (table), label, 0, 1, 0, 1, 0, 0, 0, 0); */
/* gtk_table_attach(GTK_TABLE (table), label, 0, 1, 0, 1, 0, 0, 0, 0); */
gtk_table_attach(GTK_TABLE (table), label, 0, 1, 0, 1, 3, 0, 0, 0);
begw->radius_data = GTK_ADJUSTMENT (gtk_adjustment_new (10.0, 0.0, 100.0, 0.1, 1.0, 0.0));
slider = gtk_hscale_new (begw->radius_data);
@ -341,20 +330,15 @@ brush_edit_generated_new ()
gtk_table_set_col_spacing(GTK_TABLE (table), 0, 3);
gtk_widget_show (table);
/* The action area */
action_items[0].user_data = begw;
build_action_area (GTK_DIALOG (begw->shell), action_items, 1, 0);
gtk_widget_show (vbox);
gtk_widget_show (begw->shell);
return begw;
}
static gint
brush_edit_preview_resize (GtkWidget *widget,
GdkEvent *event,
brush_edit_preview_resize (GtkWidget *widget,
GdkEvent *event,
BrushEditGeneratedWindow *begw)
{
gtk_preview_size (GTK_PREVIEW (begw->preview),
@ -363,14 +347,16 @@ brush_edit_preview_resize (GtkWidget *widget,
/* update the display */
if (begw->brush)
brush_edit_brush_dirty_callback(GIMP_BRUSH(begw->brush), begw);
brush_edit_brush_dirty_callback (GIMP_BRUSH (begw->brush), begw);
return FALSE;
}
static void
brush_edit_close_callback (GtkWidget *w, void *data)
brush_edit_close_callback (GtkWidget *widget,
gpointer data)
{
BrushEditGeneratedWindow *begw = (BrushEditGeneratedWindow *)data;
BrushEditGeneratedWindow *begw = (BrushEditGeneratedWindow *) data;
if (GTK_WIDGET_VISIBLE (begw->shell))
gtk_widget_hide (begw->shell);
}

View File

@ -23,7 +23,6 @@
#endif
#include "appenv.h"
#include "actionarea.h"
#include "brush_scale.h"
#include "gimpbrushgenerated.h"
#include "gimpbrushlist.h"
@ -32,6 +31,7 @@
#include "gimpcontext.h"
#include "gimplist.h"
#include "gimprc.h"
#include "gimpui.h"
#include "brush_edit.h"
#include "brush_select.h"
#include "colormaps.h"
@ -140,12 +140,10 @@ static void paint_mode_menu_callback (GtkWidget *, gpointer);
static gint brush_select_events (GtkWidget *, GdkEvent *, BrushSelectP);
static gint brush_select_resize (GtkWidget *, GdkEvent *, BrushSelectP);
static gint brush_select_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void preview_scroll_update (GtkAdjustment *, gpointer);
static void opacity_scale_update (GtkAdjustment *, gpointer);
static void spacing_scale_update (GtkAdjustment *, gpointer);
/* local variables */
/* List of active dialogs */
@ -154,7 +152,6 @@ GSList *brush_active_dialogs = NULL;
/* Brush editor dialog (main brush dialog only) */
static BrushEditGeneratedWindow *brush_edit_generated_dialog;
/* If title == NULL then it is the main brush dialog */
BrushSelectP
brush_select_new (gchar *title,
@ -184,13 +181,7 @@ brush_select_new (gchar *title,
GimpBrushP active = NULL;
gint gotinitbrush = FALSE;
static ActionAreaItem action_items[] =
{
{ N_("Refresh"), brush_select_refresh_callback, NULL, NULL },
{ N_("Close"), brush_select_close_callback, NULL, NULL }
};
bsp = g_malloc (sizeof (_BrushSelect));
bsp = g_new (_BrushSelect, 1);
bsp->redraw = TRUE;
bsp->scroll_offset = 0;
bsp->callback_name = 0;
@ -205,35 +196,42 @@ brush_select_new (gchar *title,
bsp->freeze = FALSE;
/* The shell and main vbox */
bsp->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (bsp->shell), "brushselection", "Gimp");
if (!title)
if (title)
{
gtk_window_set_title (GTK_WINDOW (bsp->shell), _("Brush Selection"));
bsp->shell = gimp_dialog_new (title, "brush_selection",
gimp_standard_help_func,
"dialogs/brush_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* set dialog's size later because weird thing will happen if the
* size was not saved in the current paint options mode
*/
session_set_window_geometry (bsp->shell, &brush_select_session_info,
FALSE);
}
else
{
gtk_window_set_title (GTK_WINDOW (bsp->shell), title);
_("Close"), brush_select_close_callback,
bsp, NULL, TRUE, TRUE,
NULL);
if (init_name && strlen (init_name))
active = gimp_brush_list_get_brush (brush_list, init_name);
if (active)
gotinitbrush = TRUE;
}
else
{
bsp->shell = gimp_dialog_new (_("Brush Selection"), "brush_selection",
gimp_standard_help_func,
"dialogs/brush_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
gtk_window_set_policy (GTK_WINDOW (bsp->shell), FALSE, TRUE, FALSE);
_("Refresh"), brush_select_refresh_callback,
bsp, NULL, FALSE, FALSE,
_("Close"), brush_select_close_callback,
bsp, NULL, TRUE, TRUE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (bsp->shell), "delete_event",
GTK_SIGNAL_FUNC (brush_select_delete_callback),
bsp);
NULL);
session_set_window_geometry (bsp->shell, &brush_select_session_info,
FALSE);
}
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 0);
@ -425,14 +423,6 @@ brush_select_new (gchar *title,
gtk_widget_show (table);
/* The action area */
action_items[0].user_data = bsp;
action_items[1].user_data = bsp;
if (title)
build_action_area (GTK_DIALOG (bsp->shell), &action_items[1], 1, 0);
else
build_action_area (GTK_DIALOG (bsp->shell), action_items, 2, 1);
gtk_widget_show (bsp->options_box);
gtk_widget_show (hbox);
gtk_widget_show (vbox);
@ -447,7 +437,7 @@ brush_select_new (gchar *title,
display_brushes (bsp);
/* Only for main dialog */
if(!title)
if (!title)
{
/* add callbacks to keep the display area current */
gimp_list_foreach (GIMP_LIST (brush_list),
@ -514,7 +504,6 @@ brush_select_new (gchar *title,
return bsp;
}
void
brush_select_select (BrushSelectP bsp,
GimpBrushP brush)
@ -546,7 +535,6 @@ brush_select_select (BrushSelectP bsp,
brush_select_show_selected (bsp, row, col);
}
void
brush_select_free (BrushSelectP bsp)
{
@ -838,7 +826,6 @@ typedef struct {
GimpBrushP brush;
} popup_timeout_args_t;
static gint
brush_popup_anim_timeout (gpointer data)
{
@ -1104,7 +1091,6 @@ display_brush (BrushSelectP bsp,
}
}
static void
display_setup (BrushSelectP bsp)
{
@ -1156,7 +1142,6 @@ display_brushes (BrushSelectP bsp)
gimp_list_foreach (GIMP_LIST (brush_list), (GFunc) do_display_brush, bsp);
}
static void
brush_select_show_selected (BrushSelectP bsp,
int row,
@ -1246,7 +1231,6 @@ brush_select_show_selected (BrushSelectP bsp,
g_free (buf);
}
static void
preview_calc_scrollbar (BrushSelectP bsp)
{
@ -1343,7 +1327,6 @@ update_active_brush_field (BrushSelectP bsp)
gtk_signal_emit_by_name (GTK_OBJECT (bsp->spacing_data), "value_changed");
}
static void
edit_active_brush ()
{
@ -1508,56 +1491,47 @@ brush_select_events (GtkWidget *widget,
}
static gint
edit_brush_callback (GtkWidget *w,
GdkEvent *e,
edit_brush_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
edit_active_brush();
edit_active_brush ();
return TRUE;
}
static gint
delete_brush_callback (GtkWidget *w,
GdkEvent *e,
delete_brush_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
delete_active_brush(data);
delete_active_brush (data);
return TRUE;
}
static gint
new_brush_callback (GtkWidget *w,
GdkEvent *e,
new_brush_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
GimpBrushGenerated *brush;
brush = gimp_brush_generated_new (10, .5, 0.0, 1.0);
gimp_brush_list_add(brush_list, GIMP_BRUSH (brush));
gimp_brush_list_add (brush_list, GIMP_BRUSH (brush));
select_brush (GIMP_BRUSH (brush));
if (brush_edit_generated_dialog)
brush_edit_generated_set_brush (brush_edit_generated_dialog,
get_active_brush());
edit_brush_callback (w, e, data);
return TRUE;
}
static gint
brush_select_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer data)
{
brush_select_close_callback (w, data);
get_active_brush ());
edit_brush_callback (widget, event, data);
return TRUE;
}
static void
brush_select_close_callback (GtkWidget *w, /* Unused so can be NULL */
gpointer client_data)
brush_select_close_callback (GtkWidget *widget,
gpointer data)
{
BrushSelectP bsp;
bsp = (BrushSelectP) client_data;
bsp = (BrushSelectP) data;
if (GTK_WIDGET_VISIBLE (bsp->shell))
gtk_widget_hide (bsp->shell);
@ -1572,15 +1546,14 @@ brush_select_close_callback (GtkWidget *w, /* Unused so can be NULL */
}
}
static void
brush_select_refresh_callback (GtkWidget *w,
gpointer client_data)
brush_select_refresh_callback (GtkWidget *widget,
gpointer data)
{
BrushSelectP bsp;
GimpBrushP active;
bsp = (BrushSelectP) client_data;
bsp = (BrushSelectP) data;
/* re-init the brush list */
bsp->freeze = TRUE;
@ -1608,7 +1581,6 @@ brush_select_refresh_callback (GtkWidget *w,
gtk_widget_draw (bsp->preview, NULL);
}
static void
preview_scroll_update (GtkAdjustment *adjustment,
gpointer data)
@ -1617,7 +1589,7 @@ preview_scroll_update (GtkAdjustment *adjustment,
GimpBrushP active;
int row, col, index;
bsp = data;
bsp = (BrushSelectP) data;
if (bsp)
{
@ -1645,24 +1617,25 @@ preview_scroll_update (GtkAdjustment *adjustment,
}
static void
paint_mode_menu_callback (GtkWidget *w,
gpointer client_data)
paint_mode_menu_callback (GtkWidget *widget,
gpointer data)
{
BrushSelectP bsp = (BrushSelectP) gtk_object_get_user_data (GTK_OBJECT (w));
BrushSelectP bsp;
bsp = (BrushSelectP) gtk_object_get_user_data (GTK_OBJECT (widget));
if (bsp == brush_select_dialog)
{
gimp_context_set_paint_mode (gimp_context_get_user (),
(int) client_data);
(int) data);
}
else
{
bsp->paint_mode = (int) client_data;
bsp->paint_mode = (int) data;
brush_change_callbacks (bsp, 0);
}
}
static void
opacity_scale_update (GtkAdjustment *adjustment,
gpointer data)

View File

@ -28,6 +28,7 @@
#include "gimage_mask.h"
#include "gimprc.h"
#include "gimpset.h"
#include "gimpui.h"
#include "gdisplay.h"
#include "selection_options.h"
@ -87,8 +88,6 @@ static gint by_color_select_preview_events (GtkWidget *, GdkEventButton *,
static void by_color_select_type_callback (GtkWidget *, gpointer);
static void by_color_select_reset_callback (GtkWidget *, gpointer);
static void by_color_select_close_callback (GtkWidget *, gpointer);
static gint by_color_select_delete_callback (GtkWidget *, GdkEvent *,
gpointer);
static void by_color_select_fuzzy_update (GtkAdjustment *, gpointer);
static void by_color_select_preview_button_press (ByColorDialog *,
GdkEventButton *);
@ -529,15 +528,14 @@ by_color_select_new_dialog ()
GtkWidget *options_box;
GtkWidget *label;
GtkWidget *util_box;
GtkWidget *push_button;
GtkWidget *slider;
GtkWidget *radio_box;
GtkWidget *radio_button;
GtkObject *data;
GSList *group = NULL;
int i;
gint i;
char *button_names[] =
gchar *button_names[] =
{
N_("Replace"),
N_("Add"),
@ -545,7 +543,7 @@ by_color_select_new_dialog ()
N_("Intersect")
};
int button_values[] =
gint button_values[] =
{
REPLACE,
ADD,
@ -553,28 +551,30 @@ by_color_select_new_dialog ()
INTERSECT
};
bcd = g_malloc (sizeof (ByColorDialog));
bcd->gimage = NULL;
bcd = g_new (ByColorDialog, 1);
bcd->gimage = NULL;
bcd->operation = REPLACE;
bcd->threshold = DEFAULT_FUZZINESS;
/* The shell and main vbox */
bcd->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (bcd->shell), "by_color_selection", "Gimp");
gtk_window_set_title (GTK_WINDOW (bcd->shell), _("By Color Selection"));
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (bcd->shell)->action_area), 2);
bcd->shell = gimp_dialog_new (_("By Color Selection"), "by_color_selection",
tools_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (bcd->shell), "delete_event",
(GtkSignalFunc) by_color_select_delete_callback,
bcd);
_("Reset"), by_color_select_reset_callback,
bcd, NULL, FALSE, FALSE,
_("Close"), by_color_select_close_callback,
bcd, NULL, TRUE, TRUE,
/* The vbox */
NULL);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bcd->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (bcd->shell)->vbox), vbox);
/* The horizontal box containing preview & options box */
/* The horizontal box containing preview & options box */
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@ -650,25 +650,6 @@ by_color_select_new_dialog ()
gtk_widget_show (slider);
gtk_widget_show (util_box);
/* The reset push button */
push_button = gtk_button_new_with_label (_("Reset"));
GTK_WIDGET_SET_FLAGS (push_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bcd->shell)->action_area), push_button, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (push_button), "clicked",
(GtkSignalFunc) by_color_select_reset_callback,
bcd);
gtk_widget_grab_default (push_button);
gtk_widget_show (push_button);
/* The close push button */
push_button = gtk_button_new_with_label (_("Close"));
GTK_WIDGET_SET_FLAGS (push_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bcd->shell)->action_area), push_button, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (push_button), "clicked",
(GtkSignalFunc) by_color_select_close_callback,
bcd);
gtk_widget_show (push_button);
gtk_widget_show (options_box);
gtk_widget_show (hbox);
gtk_widget_show (vbox);
@ -852,16 +833,6 @@ by_color_select_reset_callback (GtkWidget *widget,
by_color_select_draw (bcd, bcd->gimage);
}
static gint
by_color_select_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
by_color_select_close_callback (w, client_data);
return TRUE;
}
static void
by_color_select_close_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -18,12 +18,12 @@
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "actionarea.h"
#include "channel_ops.h"
#include "cursorutil.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "palette.h"
@ -53,7 +53,6 @@ struct _OffsetDialog
/* Forward declarations */
static void offset_ok_callback (GtkWidget *, gpointer);
static void offset_cancel_callback (GtkWidget *, gpointer);
static gint offset_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void offset_wraparound_update (GtkWidget *, gpointer);
static void offset_fill_type_update (GtkWidget *, gpointer);
@ -77,12 +76,6 @@ channel_ops_offset (GimpImage* gimage)
GimpDrawable *drawable;
static ActionAreaItem action_items[] =
{
{ N_("OK"), offset_ok_callback, NULL, NULL },
{ N_("Cancel"), offset_cancel_callback, NULL, NULL }
};
drawable = gimage_active_drawable (gimage);
off_d = g_new (OffsetDialog, 1);
@ -90,15 +83,19 @@ channel_ops_offset (GimpImage* gimage)
off_d->fill_type = drawable_has_alpha (drawable);
off_d->gimage = gimage;
off_d->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (off_d->dlg), "offset", "Gimp");
gtk_window_set_title (GTK_WINDOW (off_d->dlg), _("Offset"));
off_d->dlg = gimp_dialog_new (_("Offset"), "offset",
gimp_standard_help_func,
"dialogs/offset_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (off_d->dlg), "delete_event",
GTK_SIGNAL_FUNC (offset_delete_callback),
off_d);
_("OK"), offset_ok_callback,
off_d, NULL, TRUE, FALSE,
_("Cancel"), offset_cancel_callback,
off_d, NULL, FALSE, TRUE,
NULL);
/* The vbox for first column of options */
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
@ -221,15 +218,10 @@ channel_ops_offset (GimpImage* gimage)
(GtkSignalFunc) offset_halfheight_callback,
off_d);
action_items[0].user_data = off_d;
action_items[1].user_data = off_d;
build_action_area (GTK_DIALOG (off_d->dlg), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (off_d->dlg);
}
void
offset (GimpImage *gimage,
GimpDrawable *drawable,
@ -495,16 +487,6 @@ offset_ok_callback (GtkWidget *widget,
g_free (off_d);
}
static gint
offset_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
offset_cancel_callback (widget, data);
return TRUE;
}
static void
offset_cancel_callback (GtkWidget *widget,
gpointer data)

View File

@ -17,7 +17,6 @@
*/
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "actionarea.h"
#include "channels_dialog.h"
#include "colormaps.h"
#include "color_panel.h"
@ -28,6 +27,7 @@
#include "gimage_mask.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "gimpui.h"
#include "interface.h"
#include "layers_dialogP.h"
#include "lc_dialogP.h"
@ -2363,16 +2363,6 @@ new_channel_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
new_channel_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
new_channel_query_cancel_callback (widget, data);
return TRUE;
}
static void
new_channel_query_scale_update (GtkAdjustment *adjustment,
gdouble *scale_val)
@ -2391,12 +2381,6 @@ channels_dialog_new_channel_query (GimpImage* gimage)
GtkWidget *opacity_scale;
GtkObject *opacity_scale_data;
static ActionAreaItem action_items[] =
{
{ N_("OK"), new_channel_query_ok_callback, NULL, NULL },
{ N_("Cancel"), new_channel_query_cancel_callback, NULL, NULL }
};
/* the new options structure */
options = g_new (NewChannelOptions, 1);
options->gimage = gimage;
@ -2404,17 +2388,19 @@ channels_dialog_new_channel_query (GimpImage* gimage)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"new_channel_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("New Channel Options"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("New Channel Options"), "new_channel_options",
gimp_standard_help_func,
"dialogs/channels_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (new_channel_query_delete_callback),
options);
_("OK"), new_channel_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), new_channel_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
@ -2469,11 +2455,6 @@ channels_dialog_new_channel_query (GimpImage* gimage)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
/* The action area */
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 1);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
@ -2558,16 +2539,6 @@ edit_channel_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
edit_channel_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
edit_channel_query_cancel_callback (widget, data);
return TRUE;
}
static void
channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
{
@ -2580,12 +2551,6 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
GtkObject *opacity_scale_data;
gint i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), edit_channel_query_ok_callback, NULL, NULL },
{ N_("Cancel"), edit_channel_query_cancel_callback, NULL, NULL }
};
/* the new options structure */
options = g_new (EditChannelOptions, 1);
options->channel_widget = channel_widget;
@ -2597,17 +2562,19 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"edit_channel_atributes", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("Edit Channel Attributes"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Edit Channel Attributes"), "edit_channel_attributes",
gimp_standard_help_func,
"dialogs/channels_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (edit_channel_query_delete_callback),
options);
_("OK"), edit_channel_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), edit_channel_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
@ -2661,11 +2628,6 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
/* The action area */
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);

View File

@ -28,6 +28,7 @@
#include "general.h"
#include "gimage_mask.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "image_map.h"
#include "interface.h"
@ -69,8 +70,6 @@ static void color_balance_update (ColorBalanceDialog *, int);
static void color_balance_preview (ColorBalanceDialog *);
static void color_balance_ok_callback (GtkWidget *, gpointer);
static void color_balance_cancel_callback (GtkWidget *, gpointer);
static gint color_balance_delete_callback (GtkWidget *, GdkEvent *,
gpointer);
static void color_balance_shadows_callback (GtkWidget *, gpointer);
static void color_balance_midtones_callback (GtkWidget *, gpointer);
static void color_balance_highlights_callback (GtkWidget *, gpointer);
@ -253,7 +252,6 @@ color_balance_initialize (GDisplay *gdisp)
/* Color Balance dialog */
/**************************/
/* the action area structure */
static ColorBalanceDialog *
color_balance_new_dialog ()
{
@ -269,15 +267,9 @@ color_balance_new_dialog ()
GtkWidget *radio_button;
GtkObject *data;
GSList *group = NULL;
int i;
gint i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), color_balance_ok_callback, NULL, NULL },
{ N_("Cancel"), color_balance_cancel_callback, NULL, NULL }
};
char *appl_mode_names[] =
gchar *appl_mode_names[] =
{
N_("Shadows"),
N_("Midtones"),
@ -297,18 +289,21 @@ color_balance_new_dialog ()
cbd->application_mode = SHADOWS;
/* The shell and main vbox */
cbd->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cbd->shell), "color_balance", "Gimp");
gtk_window_set_title (GTK_WINDOW (cbd->shell), _("Color Balance"));
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (cbd->shell), "delete_event",
GTK_SIGNAL_FUNC (color_balance_delete_callback),
cbd);
cbd->shell = gimp_dialog_new (_("Color Balance"), "color_balance",
tools_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("OK"), color_balance_ok_callback,
cbd, NULL, TRUE, FALSE,
_("Cancel"), color_balance_cancel_callback,
cbd, NULL, FALSE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cbd->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cbd->shell)->vbox), vbox);
/* Horizontal box for application mode */
hbox = gtk_hbox_new (TRUE, 2);
@ -473,11 +468,6 @@ color_balance_new_dialog ()
}
gtk_widget_show (hbox);
/* The action area */
action_items[0].user_data = cbd;
action_items[1].user_data = cbd;
build_action_area (GTK_DIALOG (cbd->shell), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (cbd->shell);
@ -614,16 +604,6 @@ color_balance_ok_callback (GtkWidget *widget,
active_tool->drawable = NULL;
}
static gint
color_balance_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
color_balance_cancel_callback (w, client_data);
return TRUE;
}
static void
color_balance_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define __COLOR_NOTEBOOK_C__ 1
#include "config.h"
@ -29,28 +28,17 @@
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_notebook.h"
#include "gimpui.h"
#include "libgimp/color_selector.h"
#include "libgimp/gimpintl.h"
static void color_notebook_ok_callback (GtkWidget *, gpointer);
static void color_notebook_ok_callback (GtkWidget *, gpointer);
static void color_notebook_cancel_callback (GtkWidget *, gpointer);
static gint color_notebook_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void color_notebook_update_callback (void *, int, int, int);
static void color_notebook_page_switch (GtkWidget *, GtkNotebookPage *, guint);
static ActionAreaItem action_items[2] =
{
{ N_("OK"), color_notebook_ok_callback, NULL, NULL },
{ N_("Cancel"), color_notebook_cancel_callback, NULL, NULL },
};
/* information we keep on each registered colour selector */
typedef struct _ColorSelectorInfo {
char *name; /* label used in notebook tab */
@ -98,28 +86,33 @@ color_notebook_new (int r,
g_return_val_if_fail (selector_info != NULL, NULL);
cnp = g_malloc (sizeof (_ColorNotebook));
cnp = g_new (_ColorNotebook, 1);
cnp->callback = callback;
cnp->client_data = client_data;
cnp->callback = callback;
cnp->client_data = client_data;
cnp->wants_updates = wants_updates;
cnp->selectors = NULL;
cnp->cur_page = NULL;
cnp->selectors = NULL;
cnp->cur_page = NULL;
cnp->values[RED] = cnp->orig_values[RED] = r & 0xff;
cnp->values[RED] = cnp->orig_values[RED] = r & 0xff;
cnp->values[GREEN] = cnp->orig_values[GREEN] = g & 0xff;
cnp->values[BLUE] = cnp->orig_values[BLUE] = b & 0xff;
cnp->values[BLUE] = cnp->orig_values[BLUE] = b & 0xff;
/* window hints need to stay the same, so people's window manager
* setups still work */
cnp->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cnp->shell), "color_selection", "Gimp");
gtk_window_set_title (GTK_WINDOW (cnp->shell), _("Color Selection"));
gtk_window_set_policy (GTK_WINDOW (cnp->shell), FALSE, FALSE, FALSE);
cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
gimp_standard_help_func,
"dialogs/color_notebook_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (cnp->shell), "delete_event",
(GtkSignalFunc) color_notebook_delete_callback, cnp);
wants_updates ? _("Close") : _("OK"),
color_notebook_ok_callback,
cnp, NULL, TRUE, FALSE,
wants_updates ? _("Revert to Old Color") : _("Cancel"),
color_notebook_cancel_callback,
cnp, NULL, FALSE, TRUE,
NULL);
/* do we actually need a notebook? */
if (selector_info->next)
@ -179,21 +172,6 @@ color_notebook_new (int r,
info = info->next;
}
/* The action area */
action_items[0].user_data = cnp;
action_items[1].user_data = cnp;
if (cnp->wants_updates)
{
action_items[0].label = _("Close");
action_items[1].label = _("Revert to Old Color");
}
else
{
action_items[0].label = _("OK");
action_items[1].label = _("Cancel");
}
build_action_area (GTK_DIALOG (cnp->shell), action_items, 2, 0);
gtk_widget_show (cnp->shell);
/* this must come after showing the widget, otherwise we get a
@ -209,7 +187,6 @@ color_notebook_new (int r,
return cnp;
}
void
color_notebook_show (ColorNotebookP cnp)
{
@ -217,7 +194,6 @@ color_notebook_show (ColorNotebookP cnp)
gtk_widget_show (cnp->shell);
}
void
color_notebook_hide (ColorNotebookP cnp)
{
@ -253,13 +229,12 @@ color_notebook_free (ColorNotebookP cnp)
g_free (cnp);
}
void
color_notebook_set_color (ColorNotebookP cnp,
int r,
int g,
int b,
int set_current)
int r,
int g,
int b,
int set_current)
{
ColorSelectorInstance *csel;
g_return_if_fail (cnp != NULL);
@ -279,11 +254,12 @@ color_notebook_set_color (ColorNotebookP cnp,
csel->info->m.setcolor (csel->selector_data, r, g, b, set_current);
}
/* Called by a colour selector on user selection of a colour */
static void
color_notebook_update_callback (void *data, int r, int g, int b)
color_notebook_update_callback (void *data,
int r,
int g,
int b)
{
ColorSelectorInstance *csel;
ColorNotebookP cnp;
@ -307,16 +283,13 @@ color_notebook_update_callback (void *data, int r, int g, int b)
}
}
static void
color_notebook_ok_callback (GtkWidget *w,
gpointer client_data)
color_notebook_ok_callback (GtkWidget *widget,
gpointer data)
{
ColorNotebookP cnp;
cnp = (ColorNotebookP) client_data;
cnp = (ColorNotebookP) data;
if (cnp->callback)
(* cnp->callback) (cnp->values[RED],
@ -326,25 +299,13 @@ color_notebook_ok_callback (GtkWidget *w,
cnp->client_data);
}
static gint
color_notebook_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
color_notebook_cancel_callback (w, client_data);
return TRUE;
}
static void
color_notebook_cancel_callback (GtkWidget *w,
gpointer client_data)
color_notebook_cancel_callback (GtkWidget *widget,
gpointer data)
{
ColorNotebookP cnp;
cnp = (ColorNotebookP) client_data;
cnp = (ColorNotebookP) data;
if (cnp->callback)
(* cnp->callback) (cnp->orig_values[RED],
@ -355,14 +316,14 @@ color_notebook_cancel_callback (GtkWidget *w,
}
static void
color_notebook_page_switch (GtkWidget *w,
color_notebook_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
guint page_num)
{
ColorNotebookP cnp;
ColorSelectorInstance *csel;
cnp = gtk_object_get_user_data (GTK_OBJECT (w));
cnp = gtk_object_get_user_data (GTK_OBJECT (widget));
csel = gtk_object_get_data (GTK_OBJECT(page->child), "gimp_color_notebook");
g_return_if_fail (cnp != NULL && csel != NULL);
@ -466,5 +427,4 @@ selector_death (ColorSelectorInfo *info)
g_warning ("color selector %p not found, can't happen!", info);
}
/* End of color_notebook.c */

View File

@ -22,6 +22,7 @@
#include "draw_core.h"
#include "drawable.h"
#include "gdisplay.h"
#include "gimphelp.h"
#include "cursorutil.h"
#include "info_dialog.h"
#include "palette.h"
@ -248,7 +249,8 @@ color_picker_button_press (Tool *tool,
{
GtkWidget *hbox;
color_picker_info = info_dialog_new (_("Color Picker"));
color_picker_info = info_dialog_new (_("Color Picker"),
tools_help_func, NULL);
/* if the gdisplay is for a color image, the dialog must have RGB */
switch (drawable_type (tool->drawable))

View File

@ -16,16 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_select.h"
#include "colormaps.h"
#include "errors.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "gimpui.h"
#include "session.h"
#include "color_area.h" /* for color_area_draw_rect */
@ -110,7 +112,6 @@ static void color_select_update_colors (ColorSelect *, gint);
static void color_select_ok_callback (GtkWidget *, gpointer);
static void color_select_cancel_callback (GtkWidget *, gpointer);
static gint color_select_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static gint color_select_xy_expose (GtkWidget *, GdkEventExpose *,
ColorSelect *);
static gint color_select_xy_events (GtkWidget *, GdkEvent *,
@ -190,12 +191,6 @@ color_select_new (gint r,
ColorSelect *csp;
GtkWidget *main_vbox;
static ActionAreaItem action_items[] =
{
{ N_("OK"), color_select_ok_callback, NULL, NULL },
{ N_("Cancel"), color_select_cancel_callback, NULL, NULL }
};
csp = g_new (ColorSelect, 1);
csp->callback = callback;
@ -211,37 +206,26 @@ color_select_new (gint r,
color_select_update_hsv_values (csp);
color_select_update_pos (csp);
csp->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (csp->shell), "color_selection", "Gimp");
gtk_window_set_title (GTK_WINDOW (csp->shell), _("Color Selection"));
gtk_window_set_policy (GTK_WINDOW (csp->shell), FALSE, FALSE, FALSE);
csp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
gimp_standard_help_func,
"dialogs/color_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
wants_updates ? _("Close") : _("OK"),
color_select_ok_callback,
csp, NULL, TRUE, FALSE,
wants_updates ? _("Revert to Old Color") : _("Cancel"),
color_select_cancel_callback,
csp, NULL, FALSE, TRUE,
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (csp->shell), "delete_event",
(GtkSignalFunc) color_select_delete_callback, csp);
NULL);
main_vbox = color_select_widget_new (csp, r, g, b);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (csp->shell)->vbox), main_vbox);
gtk_widget_show (main_vbox);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (csp->shell)->vbox), main_vbox,
TRUE, TRUE, 0);
/* The action area */
action_items[0].user_data = csp;
action_items[1].user_data = csp;
if (csp->wants_updates)
{
action_items[0].label = _("Close");
action_items[1].label = _("Revert to Old Color");
}
else
{
action_items[0].label = _("OK");
action_items[1].label = _("Cancel");
}
build_action_area (GTK_DIALOG (csp->shell), action_items, 2, 0);
color_select_image_fill (csp->z_color, csp->z_color_fill, csp->values);
color_select_image_fill (csp->xy_color, csp->xy_color_fill, csp->values);
@ -997,16 +981,6 @@ color_select_ok_callback (GtkWidget *widget,
}
}
static gint
color_select_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
color_select_cancel_callback (widget, data);
return TRUE;
}
static void
color_select_cancel_callback (GtkWidget *widget,
gpointer data)

View File

@ -35,13 +35,14 @@
#include "gdisplay_ops.h"
#include "gdisplay_color_ui.h"
#include "gimage_mask.h"
#include "gimphelp.h"
#include "gimprc.h"
#include "gimpui.h"
#include "global_edit.h"
#include "gradient.h"
#include "image_render.h"
#include "info_window.h"
#include "nav_window.h"
#include "interface.h"
#include "invert.h"
#include "lc_dialog.h"
#include "layer_select.h"
@ -74,7 +75,6 @@ extern void layers_dialog_layer_merge_query (GImage *, gboolean);
static void image_resize_callback (GtkWidget *, gpointer);
static void image_scale_callback (GtkWidget *, gpointer);
static void image_cancel_callback (GtkWidget *, gpointer);
static gint image_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void gimage_mask_feather_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_border_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
@ -345,54 +345,69 @@ void
select_border_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Border Selection"),
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Border Selection"),
gimp_standard_help_func,
"dialogs/border_selection_dialog.html",
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_feather_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Feather Selection"),
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Feather Selection"),
gimp_standard_help_func,
"dialogs/feather_selection_dialog.html",
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_grow_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Grow Selection"),
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Grow Selection"),
gimp_standard_help_func,
"dialogs/grow_selection_dialog.html",
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
@ -405,15 +420,18 @@ select_shrink_cmd_callback (GtkWidget *widget,
GDisplay * gdisp;
return_if_no_display (gdisp);
shrink_dialog = query_size_box (N_("Shrink Selection"),
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
shrink_dialog =
gimp_query_size_box (N_("Shrink Selection"),
gimp_standard_help_func,
"dialogs/shrink_selection_dialog.html",
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
/* eeek */
@ -810,7 +828,6 @@ image_resize_cmd_callback (GtkWidget *widget,
gdisp->dot_for_dot,
image_resize_callback,
image_cancel_callback,
image_delete_callback,
image_resize);
gtk_widget_show (image_resize->resize->resize_shell);
@ -842,7 +859,6 @@ image_scale_cmd_callback (GtkWidget *widget,
gdisp->dot_for_dot,
image_scale_callback,
image_cancel_callback,
image_delete_callback,
image_scale);
gtk_widget_show (image_scale->resize->resize_shell);
@ -1175,6 +1191,13 @@ about_dialog_cmd_callback (GtkWidget *widget,
about_dialog_create (FALSE);
}
void
gimp_help_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gimp_help ("");
}
void
tips_dialog_cmd_callback (GtkWidget *widget,
gpointer client_data)
@ -1284,17 +1307,6 @@ image_scale_callback (GtkWidget *widget,
g_free (image_scale);
}
static gint
image_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
image_cancel_callback (widget, client_data);
return TRUE;
}
static void
image_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -109,6 +109,7 @@ void dialogs_error_console_cmd_callback (GtkWidget *, gpointer);
void dialogs_module_browser_cmd_callback (GtkWidget *, gpointer);
void dialogs_display_filters_cmd_callback (GtkWidget *, gpointer);
void about_dialog_cmd_callback (GtkWidget *, gpointer);
void gimp_help_cmd_callback (GtkWidget *, gpointer);
void tips_dialog_cmd_callback (GtkWidget *, gpointer);
#endif /* __COMMANDS_H__ */

View File

@ -86,17 +86,16 @@
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "convert.h"
#include "cursorutil.h"
#include "drawable.h"
#include "floating_sel.h"
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "undo.h"
#include "palette.h"
#include "preferences_dialog.h" /* ick. */
#include "libgimp/gimpintl.h"
#include "libgimp/gimpmath.h"
@ -393,7 +392,6 @@ typedef struct
static void indexed_ok_callback (GtkWidget *, gpointer);
static void indexed_cancel_callback (GtkWidget *, gpointer);
static gint indexed_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void indexed_num_cols_update (GtkWidget *, gpointer);
static void indexed_radio_update (GtkWidget *, gpointer);
static void frame_sensitivity_update (GtkWidget *, gpointer);
@ -457,13 +455,6 @@ convert_to_grayscale (GimpImage* gimage)
gdisplays_flush ();
}
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("OK"), indexed_ok_callback, NULL, NULL },
{ N_("Cancel"), indexed_cancel_callback, NULL, NULL }
};
void
convert_to_indexed (GimpImage *gimage)
{
@ -478,7 +469,7 @@ convert_to_indexed (GimpImage *gimage)
GSList *group = NULL;
gint maxval;
dialog = g_new(IndexedDialog, 1);
dialog = g_new (IndexedDialog, 1);
dialog->gimage = gimage;
dialog->custom_frame = NULL;
@ -496,21 +487,31 @@ convert_to_indexed (GimpImage *gimage)
dialog->monopal_flag = smonopal_flag;
dialog->reusepal_flag = sreusepal_flag;
dialog->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (dialog->shell), "indexed_color_conversion", "Gimp");
gtk_window_set_title (GTK_WINDOW (dialog->shell), _("Indexed Color Conversion"));
gtk_signal_connect (GTK_OBJECT (dialog->shell), "delete_event",
GTK_SIGNAL_FUNC (indexed_delete_callback),
dialog);
dialog->shell =
gimp_dialog_new (_("Indexed Color Conversion"), "indexed_color_conversion",
gimp_standard_help_func,
"dialogs/indexed_color_conversion_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("OK"), indexed_ok_callback,
dialog, NULL, TRUE, FALSE,
_("Cancel"), indexed_cancel_callback,
dialog, NULL, FALSE, TRUE,
NULL);
frame = gtk_frame_new (_("General Palette Options"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_container_set_border_width (GTK_CONTAINER (frame), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame,
TRUE, TRUE, 0);
gtk_widget_show(frame);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox)), 4);
/* put the vbox in the frame */
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show(vbox);
@ -823,11 +824,6 @@ convert_to_indexed (GimpImage *gimage)
gtk_widget_show(frame);
}
/* The action area */
action_items[0].user_data = dialog;
action_items[1].user_data = dialog;
build_action_area (GTK_DIALOG (dialog->shell), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (dialog->shell);
}
@ -957,16 +953,6 @@ indexed_ok_callback (GtkWidget *widget,
dialog = NULL;
}
static gint
indexed_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
indexed_cancel_callback (w, client_data);
return TRUE;
}
static void
indexed_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -24,8 +24,8 @@
#include "gdisplay.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpui.h"
#include "global_edit.h"
#include "interface.h"
#include "layer.h"
#include "paint_funcs.h"
#include "tools.h"
@ -666,12 +666,12 @@ named_buffer_delete_callback (GtkWidget *w,
}
static void
named_buffer_cancel_callback (GtkWidget *w,
gpointer client_data)
named_buffer_cancel_callback (GtkWidget *widget,
gpointer data)
{
PasteNamedDlg *pn_dlg;
pn_dlg = (PasteNamedDlg *) client_data;
pn_dlg = (PasteNamedDlg *) data;
/* Destroy the box */
gtk_widget_destroy (pn_dlg->shell);
@ -679,16 +679,6 @@ named_buffer_cancel_callback (GtkWidget *w,
g_free (pn_dlg);
}
static gint
named_buffer_dialog_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
named_buffer_cancel_callback (w, client_data);
return TRUE;
}
static void
paste_named_buffer (GDisplay *gdisp)
{
@ -706,27 +696,27 @@ paste_named_buffer (GDisplay *gdisp)
{ N_("Paste Into"), named_buffer_paste_into_callback, NULL, NULL },
{ N_("Paste As New"), named_buffer_paste_as_new_callback, NULL, NULL }
};
static ActionAreaItem other_action_items[] =
{
{ N_("Delete"), named_buffer_delete_callback, NULL, NULL },
{ N_("Cancel"), named_buffer_cancel_callback, NULL, NULL }
};
pn_dlg = (PasteNamedDlg *) g_malloc (sizeof (PasteNamedDlg));
pn_dlg = g_new (PasteNamedDlg, 1);
pn_dlg->gdisp = gdisp;
pn_dlg->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (pn_dlg->shell), "paste_named_buffer", "Gimp");
gtk_window_set_title (GTK_WINDOW (pn_dlg->shell), _("Paste Named Buffer"));
gtk_window_position (GTK_WINDOW (pn_dlg->shell), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (pn_dlg->shell), "delete_event",
GTK_SIGNAL_FUNC (named_buffer_dialog_delete_callback),
pn_dlg);
pn_dlg->shell =
gimp_dialog_new (_("Paste Named Buffer"), "paste_named_buffer",
gimp_standard_help_func,
"dialogs/paste_named_buffer_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("Delete"), named_buffer_delete_callback,
pn_dlg, NULL, FALSE, FALSE,
_("Cancel"), named_buffer_cancel_callback,
pn_dlg, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (pn_dlg->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (pn_dlg->shell)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (_("Select a buffer to paste:"));
@ -763,10 +753,6 @@ paste_named_buffer (GDisplay *gdisp)
}
gtk_widget_show (bbox);
other_action_items[0].user_data = pn_dlg;
other_action_items[1].user_data = pn_dlg;
build_action_area (GTK_DIALOG (pn_dlg->shell), other_action_items, 2, 1);
gtk_widget_show (pn_dlg->shell);
}
@ -791,7 +777,7 @@ new_named_buffer (TileManager *tiles,
}
static void
cut_named_buffer_callback (GtkWidget *w,
cut_named_buffer_callback (GtkWidget *widget,
gpointer client_data,
gpointer call_data)
{
@ -811,22 +797,27 @@ cut_named_buffer_callback (GtkWidget *w,
int
named_edit_cut (void *gdisp_ptr)
{
GDisplay *gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
/* stop any active tool */
gdisp = (GDisplay *) gdisp_ptr;
active_tool_control (HALT, gdisp_ptr);
gtk_widget_show (query_string_box (_("Cut Named"),
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
cut_named_buffer_callback, gdisp));
qbox = gimp_query_string_box (_("Cut Named"),
gimp_standard_help_func,
"dialogs/cut_named_dialog.html",
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
cut_named_buffer_callback, gdisp);
gtk_widget_show (qbox);
return TRUE;
}
static void
copy_named_buffer_callback (GtkWidget *w,
copy_named_buffer_callback (GtkWidget *widget,
gpointer client_data,
gpointer call_data)
{
@ -845,15 +836,20 @@ copy_named_buffer_callback (GtkWidget *w,
int
named_edit_copy (void *gdisp_ptr)
{
GDisplay *gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gtk_widget_show (query_string_box (_("Copy Named"),
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
copy_named_buffer_callback, gdisp));
qbox = gimp_query_string_box (_("Copy Named"),
gimp_standard_help_func,
"dialogs/copy_named_dialog.html",
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
copy_named_buffer_callback, gdisp);
gtk_widget_show (qbox);
return TRUE;
}

View File

@ -18,12 +18,12 @@
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "actionarea.h"
#include "channel_ops.h"
#include "cursorutil.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "palette.h"
@ -53,7 +53,6 @@ struct _OffsetDialog
/* Forward declarations */
static void offset_ok_callback (GtkWidget *, gpointer);
static void offset_cancel_callback (GtkWidget *, gpointer);
static gint offset_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void offset_wraparound_update (GtkWidget *, gpointer);
static void offset_fill_type_update (GtkWidget *, gpointer);
@ -77,12 +76,6 @@ channel_ops_offset (GimpImage* gimage)
GimpDrawable *drawable;
static ActionAreaItem action_items[] =
{
{ N_("OK"), offset_ok_callback, NULL, NULL },
{ N_("Cancel"), offset_cancel_callback, NULL, NULL }
};
drawable = gimage_active_drawable (gimage);
off_d = g_new (OffsetDialog, 1);
@ -90,15 +83,19 @@ channel_ops_offset (GimpImage* gimage)
off_d->fill_type = drawable_has_alpha (drawable);
off_d->gimage = gimage;
off_d->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (off_d->dlg), "offset", "Gimp");
gtk_window_set_title (GTK_WINDOW (off_d->dlg), _("Offset"));
off_d->dlg = gimp_dialog_new (_("Offset"), "offset",
gimp_standard_help_func,
"dialogs/offset_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (off_d->dlg), "delete_event",
GTK_SIGNAL_FUNC (offset_delete_callback),
off_d);
_("OK"), offset_ok_callback,
off_d, NULL, TRUE, FALSE,
_("Cancel"), offset_cancel_callback,
off_d, NULL, FALSE, TRUE,
NULL);
/* The vbox for first column of options */
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
@ -221,15 +218,10 @@ channel_ops_offset (GimpImage* gimage)
(GtkSignalFunc) offset_halfheight_callback,
off_d);
action_items[0].user_data = off_d;
action_items[1].user_data = off_d;
build_action_area (GTK_DIALOG (off_d->dlg), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (off_d->dlg);
}
void
offset (GimpImage *gimage,
GimpDrawable *drawable,
@ -495,16 +487,6 @@ offset_ok_callback (GtkWidget *widget,
g_free (off_d);
}
static gint
offset_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
offset_cancel_callback (widget, data);
return TRUE;
}
static void
offset_cancel_callback (GtkWidget *widget,
gpointer data)

View File

@ -24,8 +24,8 @@
#include "gdisplay.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpui.h"
#include "global_edit.h"
#include "interface.h"
#include "layer.h"
#include "paint_funcs.h"
#include "tools.h"
@ -666,12 +666,12 @@ named_buffer_delete_callback (GtkWidget *w,
}
static void
named_buffer_cancel_callback (GtkWidget *w,
gpointer client_data)
named_buffer_cancel_callback (GtkWidget *widget,
gpointer data)
{
PasteNamedDlg *pn_dlg;
pn_dlg = (PasteNamedDlg *) client_data;
pn_dlg = (PasteNamedDlg *) data;
/* Destroy the box */
gtk_widget_destroy (pn_dlg->shell);
@ -679,16 +679,6 @@ named_buffer_cancel_callback (GtkWidget *w,
g_free (pn_dlg);
}
static gint
named_buffer_dialog_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
named_buffer_cancel_callback (w, client_data);
return TRUE;
}
static void
paste_named_buffer (GDisplay *gdisp)
{
@ -706,27 +696,27 @@ paste_named_buffer (GDisplay *gdisp)
{ N_("Paste Into"), named_buffer_paste_into_callback, NULL, NULL },
{ N_("Paste As New"), named_buffer_paste_as_new_callback, NULL, NULL }
};
static ActionAreaItem other_action_items[] =
{
{ N_("Delete"), named_buffer_delete_callback, NULL, NULL },
{ N_("Cancel"), named_buffer_cancel_callback, NULL, NULL }
};
pn_dlg = (PasteNamedDlg *) g_malloc (sizeof (PasteNamedDlg));
pn_dlg = g_new (PasteNamedDlg, 1);
pn_dlg->gdisp = gdisp;
pn_dlg->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (pn_dlg->shell), "paste_named_buffer", "Gimp");
gtk_window_set_title (GTK_WINDOW (pn_dlg->shell), _("Paste Named Buffer"));
gtk_window_position (GTK_WINDOW (pn_dlg->shell), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (pn_dlg->shell), "delete_event",
GTK_SIGNAL_FUNC (named_buffer_dialog_delete_callback),
pn_dlg);
pn_dlg->shell =
gimp_dialog_new (_("Paste Named Buffer"), "paste_named_buffer",
gimp_standard_help_func,
"dialogs/paste_named_buffer_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("Delete"), named_buffer_delete_callback,
pn_dlg, NULL, FALSE, FALSE,
_("Cancel"), named_buffer_cancel_callback,
pn_dlg, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (pn_dlg->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (pn_dlg->shell)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (_("Select a buffer to paste:"));
@ -763,10 +753,6 @@ paste_named_buffer (GDisplay *gdisp)
}
gtk_widget_show (bbox);
other_action_items[0].user_data = pn_dlg;
other_action_items[1].user_data = pn_dlg;
build_action_area (GTK_DIALOG (pn_dlg->shell), other_action_items, 2, 1);
gtk_widget_show (pn_dlg->shell);
}
@ -791,7 +777,7 @@ new_named_buffer (TileManager *tiles,
}
static void
cut_named_buffer_callback (GtkWidget *w,
cut_named_buffer_callback (GtkWidget *widget,
gpointer client_data,
gpointer call_data)
{
@ -811,22 +797,27 @@ cut_named_buffer_callback (GtkWidget *w,
int
named_edit_cut (void *gdisp_ptr)
{
GDisplay *gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
/* stop any active tool */
gdisp = (GDisplay *) gdisp_ptr;
active_tool_control (HALT, gdisp_ptr);
gtk_widget_show (query_string_box (_("Cut Named"),
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
cut_named_buffer_callback, gdisp));
qbox = gimp_query_string_box (_("Cut Named"),
gimp_standard_help_func,
"dialogs/cut_named_dialog.html",
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
cut_named_buffer_callback, gdisp);
gtk_widget_show (qbox);
return TRUE;
}
static void
copy_named_buffer_callback (GtkWidget *w,
copy_named_buffer_callback (GtkWidget *widget,
gpointer client_data,
gpointer call_data)
{
@ -845,15 +836,20 @@ copy_named_buffer_callback (GtkWidget *w,
int
named_edit_copy (void *gdisp_ptr)
{
GDisplay *gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gtk_widget_show (query_string_box (_("Copy Named"),
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
copy_named_buffer_callback, gdisp));
qbox = gimp_query_string_box (_("Copy Named"),
gimp_standard_help_func,
"dialogs/copy_named_dialog.html",
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
copy_named_buffer_callback, gdisp);
gtk_widget_show (qbox);
return TRUE;
}

View File

@ -86,17 +86,16 @@
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "convert.h"
#include "cursorutil.h"
#include "drawable.h"
#include "floating_sel.h"
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "undo.h"
#include "palette.h"
#include "preferences_dialog.h" /* ick. */
#include "libgimp/gimpintl.h"
#include "libgimp/gimpmath.h"
@ -393,7 +392,6 @@ typedef struct
static void indexed_ok_callback (GtkWidget *, gpointer);
static void indexed_cancel_callback (GtkWidget *, gpointer);
static gint indexed_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void indexed_num_cols_update (GtkWidget *, gpointer);
static void indexed_radio_update (GtkWidget *, gpointer);
static void frame_sensitivity_update (GtkWidget *, gpointer);
@ -457,13 +455,6 @@ convert_to_grayscale (GimpImage* gimage)
gdisplays_flush ();
}
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("OK"), indexed_ok_callback, NULL, NULL },
{ N_("Cancel"), indexed_cancel_callback, NULL, NULL }
};
void
convert_to_indexed (GimpImage *gimage)
{
@ -478,7 +469,7 @@ convert_to_indexed (GimpImage *gimage)
GSList *group = NULL;
gint maxval;
dialog = g_new(IndexedDialog, 1);
dialog = g_new (IndexedDialog, 1);
dialog->gimage = gimage;
dialog->custom_frame = NULL;
@ -496,21 +487,31 @@ convert_to_indexed (GimpImage *gimage)
dialog->monopal_flag = smonopal_flag;
dialog->reusepal_flag = sreusepal_flag;
dialog->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (dialog->shell), "indexed_color_conversion", "Gimp");
gtk_window_set_title (GTK_WINDOW (dialog->shell), _("Indexed Color Conversion"));
gtk_signal_connect (GTK_OBJECT (dialog->shell), "delete_event",
GTK_SIGNAL_FUNC (indexed_delete_callback),
dialog);
dialog->shell =
gimp_dialog_new (_("Indexed Color Conversion"), "indexed_color_conversion",
gimp_standard_help_func,
"dialogs/indexed_color_conversion_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("OK"), indexed_ok_callback,
dialog, NULL, TRUE, FALSE,
_("Cancel"), indexed_cancel_callback,
dialog, NULL, FALSE, TRUE,
NULL);
frame = gtk_frame_new (_("General Palette Options"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_container_set_border_width (GTK_CONTAINER (frame), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame,
TRUE, TRUE, 0);
gtk_widget_show(frame);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox)), 4);
/* put the vbox in the frame */
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show(vbox);
@ -823,11 +824,6 @@ convert_to_indexed (GimpImage *gimage)
gtk_widget_show(frame);
}
/* The action area */
action_items[0].user_data = dialog;
action_items[1].user_data = dialog;
build_action_area (GTK_DIALOG (dialog->shell), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (dialog->shell);
}
@ -957,16 +953,6 @@ indexed_ok_callback (GtkWidget *widget,
dialog = NULL;
}
static gint
indexed_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
indexed_cancel_callback (w, client_data);
return TRUE;
}
static void
indexed_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -18,12 +18,12 @@
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "actionarea.h"
#include "channel_ops.h"
#include "cursorutil.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "palette.h"
@ -53,7 +53,6 @@ struct _OffsetDialog
/* Forward declarations */
static void offset_ok_callback (GtkWidget *, gpointer);
static void offset_cancel_callback (GtkWidget *, gpointer);
static gint offset_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void offset_wraparound_update (GtkWidget *, gpointer);
static void offset_fill_type_update (GtkWidget *, gpointer);
@ -77,12 +76,6 @@ channel_ops_offset (GimpImage* gimage)
GimpDrawable *drawable;
static ActionAreaItem action_items[] =
{
{ N_("OK"), offset_ok_callback, NULL, NULL },
{ N_("Cancel"), offset_cancel_callback, NULL, NULL }
};
drawable = gimage_active_drawable (gimage);
off_d = g_new (OffsetDialog, 1);
@ -90,15 +83,19 @@ channel_ops_offset (GimpImage* gimage)
off_d->fill_type = drawable_has_alpha (drawable);
off_d->gimage = gimage;
off_d->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (off_d->dlg), "offset", "Gimp");
gtk_window_set_title (GTK_WINDOW (off_d->dlg), _("Offset"));
off_d->dlg = gimp_dialog_new (_("Offset"), "offset",
gimp_standard_help_func,
"dialogs/offset_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (off_d->dlg), "delete_event",
GTK_SIGNAL_FUNC (offset_delete_callback),
off_d);
_("OK"), offset_ok_callback,
off_d, NULL, TRUE, FALSE,
_("Cancel"), offset_cancel_callback,
off_d, NULL, FALSE, TRUE,
NULL);
/* The vbox for first column of options */
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
@ -221,15 +218,10 @@ channel_ops_offset (GimpImage* gimage)
(GtkSignalFunc) offset_halfheight_callback,
off_d);
action_items[0].user_data = off_d;
action_items[1].user_data = off_d;
build_action_area (GTK_DIALOG (off_d->dlg), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (off_d->dlg);
}
void
offset (GimpImage *gimage,
GimpDrawable *drawable,
@ -495,16 +487,6 @@ offset_ok_callback (GtkWidget *widget,
g_free (off_d);
}
static gint
offset_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
offset_cancel_callback (widget, data);
return TRUE;
}
static void
offset_cancel_callback (GtkWidget *widget,
gpointer data)

View File

@ -24,7 +24,6 @@
#include <string.h>
#include "libgimp/gimpintl.h"
#include "actionarea.h"
#include "appenv.h"
#include "channel.h"
#include "color_panel.h"
@ -33,6 +32,7 @@
#include "gimpcontext.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"
@ -60,23 +60,8 @@ static void edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gdouble *scale_val);
static gint qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data);
/* Actual code */
static gint
qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
edit_qmask_query_cancel_callback (widget, client_data);
return TRUE;
}
static void
qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
{
@ -86,40 +71,39 @@ qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
void
qmask_buttons_update (GDisplay *gdisp)
{
g_assert(gdisp);
g_assert(gdisp);
g_assert(gdisp->gimage);
g_assert(gdisp->gimage);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
}
void
qmask_click_handler (GtkWidget *widget,
GdkEventButton *event,
@ -135,104 +119,103 @@ qmask_click_handler (GtkWidget *widget,
}
}
void
qmask_deactivate(GtkWidget *w,
GDisplay *gdisp)
qmask_deactivate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpImage *gimg;
GimpChannel *gmask;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
return; /* if already set do nothing */
}
}
undo_push_group_start (gimg, QMASK_UNDO);
undo_push_group_start (gimg, QMASK_UNDO);
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
{
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
}
else
else
gdisp->gimage->qmask_state = 0;
undo_push_group_end (gimg);
}
undo_push_group_end (gimg);
}
}
void
qmask_activate(GtkWidget *w,
GDisplay *gdisp)
qmask_activate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
double opacity;
unsigned char *color;
double opacity;
unsigned char *color;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp->gimage->qmask_state) {
if (gdisp->gimage->qmask_state) {
return; /* If already set, do nothing */
}
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
}
static void
@ -249,12 +232,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
gint i;
guchar channel_color[3] = { 0, 0, 0 };
static ActionAreaItem action_items[] =
{
{ N_("OK"), edit_qmask_query_ok_callback, NULL, NULL },
{ N_("Cancel"), edit_qmask_query_cancel_callback, NULL, NULL }
};
/* channel = gimp_image_get_channel_by_name (gdisp->gimage, "Qmask"); */
/* the new options structure */
options = g_new (EditQmaskOptions, 1);
@ -267,24 +244,25 @@ edit_qmask_channel_query (GDisplay * gdisp)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"edit_qmask_atributes", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("Edit Qmask Attributes"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (qmask_query_delete_callback),
options);
_("OK"), edit_qmask_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), edit_qmask_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
@ -316,10 +294,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
@ -327,7 +301,7 @@ edit_qmask_channel_query (GDisplay * gdisp)
}
static void edit_qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
EditQmaskOptions *options;
Channel *channel;
@ -338,8 +312,8 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
gint i;
options = (EditQmaskOptions *) client_data;
channel = gimp_image_get_channel_by_name(options->gimage, "Qmask");
opacity = (int) (255* options->opacity/100);
channel = gimp_image_get_channel_by_name (options->gimage, "Qmask");
opacity = (int) (255 * options->opacity/100);
if (options->gimage && channel)
{ /* don't update if opacity hasn't changed */
@ -377,7 +351,9 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
g_free (options);
}
static void edit_qmask_query_cancel_callback (GtkWidget *widget, gpointer client_data)
static void
edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data)
{
EditQmaskOptions *options;

View File

@ -24,7 +24,6 @@
#include <string.h>
#include "libgimp/gimpintl.h"
#include "actionarea.h"
#include "appenv.h"
#include "channel.h"
#include "color_panel.h"
@ -33,6 +32,7 @@
#include "gimpcontext.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"
@ -60,23 +60,8 @@ static void edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gdouble *scale_val);
static gint qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data);
/* Actual code */
static gint
qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
edit_qmask_query_cancel_callback (widget, client_data);
return TRUE;
}
static void
qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
{
@ -86,40 +71,39 @@ qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
void
qmask_buttons_update (GDisplay *gdisp)
{
g_assert(gdisp);
g_assert(gdisp);
g_assert(gdisp->gimage);
g_assert(gdisp->gimage);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
}
void
qmask_click_handler (GtkWidget *widget,
GdkEventButton *event,
@ -135,104 +119,103 @@ qmask_click_handler (GtkWidget *widget,
}
}
void
qmask_deactivate(GtkWidget *w,
GDisplay *gdisp)
qmask_deactivate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpImage *gimg;
GimpChannel *gmask;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
return; /* if already set do nothing */
}
}
undo_push_group_start (gimg, QMASK_UNDO);
undo_push_group_start (gimg, QMASK_UNDO);
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
{
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
}
else
else
gdisp->gimage->qmask_state = 0;
undo_push_group_end (gimg);
}
undo_push_group_end (gimg);
}
}
void
qmask_activate(GtkWidget *w,
GDisplay *gdisp)
qmask_activate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
double opacity;
unsigned char *color;
double opacity;
unsigned char *color;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp->gimage->qmask_state) {
if (gdisp->gimage->qmask_state) {
return; /* If already set, do nothing */
}
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
}
static void
@ -249,12 +232,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
gint i;
guchar channel_color[3] = { 0, 0, 0 };
static ActionAreaItem action_items[] =
{
{ N_("OK"), edit_qmask_query_ok_callback, NULL, NULL },
{ N_("Cancel"), edit_qmask_query_cancel_callback, NULL, NULL }
};
/* channel = gimp_image_get_channel_by_name (gdisp->gimage, "Qmask"); */
/* the new options structure */
options = g_new (EditQmaskOptions, 1);
@ -267,24 +244,25 @@ edit_qmask_channel_query (GDisplay * gdisp)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"edit_qmask_atributes", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("Edit Qmask Attributes"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (qmask_query_delete_callback),
options);
_("OK"), edit_qmask_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), edit_qmask_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
@ -316,10 +294,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
@ -327,7 +301,7 @@ edit_qmask_channel_query (GDisplay * gdisp)
}
static void edit_qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
EditQmaskOptions *options;
Channel *channel;
@ -338,8 +312,8 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
gint i;
options = (EditQmaskOptions *) client_data;
channel = gimp_image_get_channel_by_name(options->gimage, "Qmask");
opacity = (int) (255* options->opacity/100);
channel = gimp_image_get_channel_by_name (options->gimage, "Qmask");
opacity = (int) (255 * options->opacity/100);
if (options->gimage && channel)
{ /* don't update if opacity hasn't changed */
@ -377,7 +351,9 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
g_free (options);
}
static void edit_qmask_query_cancel_callback (GtkWidget *widget, gpointer client_data)
static void
edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data)
{
EditQmaskOptions *options;

View File

@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include "gdk/gdkkeysyms.h"
@ -28,6 +27,7 @@
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimphelp.h"
#include "info_dialog.h"
#include "tool_options_ui.h"
#include "undo.h"
@ -1030,7 +1030,8 @@ crop_info_create (Tool *tool)
gdisp = (GDisplay *) tool->gdisp_ptr;
/* create the info dialog */
crop_info = info_dialog_new (_("Crop & Resize Information"));
crop_info = info_dialog_new (_("Crop & Resize Information"),
tools_help_func, NULL);
/* add the information fields */
spinbutton = info_dialog_add_spinbutton (crop_info, _("Origin X:"), NULL,

View File

@ -21,7 +21,6 @@
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "buildmenu.h"
#include "colormaps.h"
#include "cursorutil.h"
@ -29,6 +28,7 @@
#include "general.h"
#include "gdisplay.h"
#include "gimphistogram.h"
#include "gimpui.h"
#include "interface.h"
#include "curves.h"
#include "gimplut.h"
@ -114,7 +114,6 @@ static void curves_free_callback (GtkWidget *, gpointer);
static void curves_reset_callback (GtkWidget *, gpointer);
static void curves_ok_callback (GtkWidget *, gpointer);
static void curves_cancel_callback (GtkWidget *, gpointer);
static gint curves_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void curves_preview_update (GtkWidget *, gpointer);
static gint curves_xrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static gint curves_yrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
@ -519,14 +518,7 @@ curves_new_dialog ()
GtkWidget *channel_hbox;
GtkWidget *menu;
GtkWidget *table;
int i, j;
static ActionAreaItem action_items[] =
{
{ N_("Reset"), curves_reset_callback, NULL, NULL },
{ N_("OK"), curves_ok_callback, NULL, NULL },
{ N_("Cancel"), curves_cancel_callback, NULL, NULL }
};
gint i, j;
static MenuItem curve_type_items[] =
{
@ -535,7 +527,7 @@ curves_new_dialog ()
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
};
cd = g_malloc (sizeof (CurvesDialog));
cd = g_new (CurvesDialog, 1);
cd->cursor_ind_height = cd->cursor_ind_width = -1;
cd->preview = TRUE;
cd->curve_type = SMOOTH;
@ -556,17 +548,23 @@ curves_new_dialog ()
curve_type_items [i].user_data = (gpointer) cd;
/* The shell and main vbox */
cd->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cd->shell), "curves", "Gimp");
gtk_window_set_title (GTK_WINDOW (cd->shell), _("Curves"));
cd->shell = gimp_dialog_new (_("Curves"), "curves",
tools_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("Reset"), curves_reset_callback,
cd, NULL, FALSE, FALSE,
_("OK"), curves_ok_callback,
cd, NULL, TRUE, FALSE,
_("Cancel"), curves_cancel_callback,
cd, NULL, FALSE, TRUE,
NULL);
gtk_signal_connect (GTK_OBJECT (cd->shell), "delete_event",
GTK_SIGNAL_FUNC (curves_delete_callback),
cd);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cd->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cd->shell)->vbox), vbox);
/* The option menu for selecting channels */
channel_hbox = gtk_hbox_new (FALSE, 2);
@ -670,12 +668,6 @@ curves_new_dialog ()
gtk_widget_show (toggle);
gtk_widget_show (hbox);
/* The action area */
action_items[0].user_data = cd;
action_items[1].user_data = cd;
action_items[2].user_data = cd;
build_action_area (GTK_DIALOG (cd->shell), action_items, 3, 0);
gtk_widget_show (vbox);
return cd;
@ -1278,24 +1270,15 @@ curves_cancel_callback (GtkWidget *widget,
active_tool->drawable = NULL;
}
static gint
curves_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer data)
{
curves_cancel_callback (w, data);
return TRUE;
}
static void
curves_preview_update (GtkWidget *w,
curves_preview_update (GtkWidget *widget,
gpointer data)
{
CurvesDialog *cd;
cd = (CurvesDialog *) data;
if (GTK_TOGGLE_BUTTON (w)->active)
if (GTK_TOGGLE_BUTTON (widget)->active)
{
cd->preview = TRUE;
curves_preview (cd);

View File

@ -15,19 +15,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include <string.h>
#include <stdio.h>
#include "appenv.h"
#include "actionarea.h"
#include "gimpcontextpreview.h"
#include "gimpdnd.h"
#include "devices.h"
#include "interface.h"
#include "gimprc.h"
#include "gimpui.h"
#include "palette.h"
#include "session.h"
#include "tools.h"
@ -63,7 +62,7 @@ struct _DeviceInfo {
GimpBrushP brush;
GPatternP pattern;
ToolType tool;
unsigned char foreground[3];
guchar foreground[3];
};
typedef struct _DeviceInfoDialog DeviceInfoDialog;
@ -115,13 +114,6 @@ static void device_status_drop_pattern (GtkWidget *,
/* Global data */
int current_device = GDK_CORE_POINTER;
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("Save"), (ActionCallback)devices_write_rc, NULL, NULL },
{ N_("Close"), devices_close_callback, NULL, NULL }
};
/* dnd stuff */
static GtkTargetEntry color_area_target_table[] =
{
@ -151,17 +143,17 @@ create_input_dialog (void)
if (!inputd)
{
inputd = gtk_input_dialog_new();
inputd = gtk_input_dialog_new ();
/* register this one only */
dialog_register(inputd);
dialog_register (inputd);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX (hbbox), 4);
hbbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
@ -170,46 +162,52 @@ create_input_dialog (void)
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->save_button),
gtk_signal_connect (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->save_button),
"clicked",
GTK_SIGNAL_FUNC(devices_write_rc), NULL);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button),
GTK_SIGNAL_FUNC (devices_write_rc), NULL);
gtk_signal_connect (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
"clicked",
GTK_SIGNAL_FUNC(devices_close_callback), inputd);
GTK_SIGNAL_FUNC (devices_close_callback), inputd);
gtk_signal_connect (GTK_OBJECT(inputd), "destroy",
(GtkSignalFunc)input_dialog_destroy_callback,
gtk_signal_connect (GTK_OBJECT (inputd), "destroy",
(GtkSignalFunc) input_dialog_destroy_callback,
&inputd);
gtk_signal_connect (GTK_OBJECT(inputd), "enable_device",
GTK_SIGNAL_FUNC(input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT(inputd), "disable_device",
GTK_SIGNAL_FUNC(input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT (inputd), "enable_device",
GTK_SIGNAL_FUNC (input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT (inputd), "disable_device",
GTK_SIGNAL_FUNC (input_dialog_able_callback), NULL);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (inputd,
gimp_standard_help_func,
"dialogs/input_devices_dialog.html");
gtk_widget_show (inputd);
}
else
{
if (!GTK_WIDGET_MAPPED(inputd))
gtk_widget_show(inputd);
if (!GTK_WIDGET_MAPPED (inputd))
gtk_widget_show (inputd);
else
gdk_window_raise(inputd->window);
gdk_window_raise (inputd->window);
}
}
void
input_dialog_able_callback (GtkWidget *w,
guint32 deviceid,
input_dialog_able_callback (GtkWidget *widget,
guint32 deviceid,
gpointer data)
{
device_status_update (deviceid);
}
static void
input_dialog_destroy_callback (GtkWidget *w,
input_dialog_destroy_callback (GtkWidget *widget,
gpointer call_data)
{
*((GtkWidget **)call_data) = NULL;
@ -223,7 +221,7 @@ devices_init (void)
/* Create device info structures for present devices */
tmp_list = gdk_input_list_devices ();
while (tmp_list)
{
GdkDeviceInfo *gdk_info = (GdkDeviceInfo *)tmp_list->data;
@ -528,7 +526,7 @@ devices_save_current_info (void)
device_info->is_init = TRUE;
device_info->device = current_device;
device_info->brush = get_active_brush ();
device_info->pattern = get_active_pattern();
device_info->pattern = get_active_pattern ();
if (active_tool)
device_info->tool = active_tool->type;
else
@ -539,7 +537,7 @@ devices_save_current_info (void)
}
static void
devices_write_rc_device (DeviceInfo *device_info,
devices_write_rc_device (DeviceInfo *device_info,
FILE *fp)
{
GdkDeviceInfo *gdk_info;
@ -552,7 +550,7 @@ devices_write_rc_device (DeviceInfo *device_info,
{
/* gdk_input_list_devices returns an internal list, so we shouldn't
free it afterwards */
tmp_list = gdk_input_list_devices();
tmp_list = gdk_input_list_devices ();
while (tmp_list)
{
GdkDeviceInfo *info = (GdkDeviceInfo *)tmp_list->data;
@ -566,7 +564,7 @@ devices_write_rc_device (DeviceInfo *device_info,
}
}
fprintf(fp, "(device \"%s\"",device_info->name);
fprintf (fp, "(device \"%s\"",device_info->name);
switch (gdk_info ? gdk_info->mode : device_info->mode)
{
@ -581,9 +579,10 @@ devices_write_rc_device (DeviceInfo *device_info,
break;
}
fprintf(fp, "\n (mode %s)",mode);
fprintf (fp, "\n (mode %s)", mode);
fprintf(fp, "\n (axes %d",gdk_info ? gdk_info->num_axes : device_info->num_axes);
fprintf (fp, "\n (axes %d",
gdk_info ? gdk_info->num_axes : device_info->num_axes);
for (i=0; i<(gdk_info ? gdk_info->num_axes : device_info->num_axes); i++)
{
@ -615,19 +614,20 @@ devices_write_rc_device (DeviceInfo *device_info,
break;
#endif /* GTK_HAVE_SIX_VALUATORS */
}
fprintf(fp, " %s",axis_type);
fprintf (fp, " %s",axis_type);
}
fprintf(fp,")");
fprintf (fp,")");
fprintf(fp, "\n (keys %d", gdk_info ? gdk_info->num_keys : device_info->num_keys);
fprintf (fp, "\n (keys %d",
gdk_info ? gdk_info->num_keys : device_info->num_keys);
for (i=0; i<(gdk_info ? gdk_info->num_keys : device_info->num_keys); i++)
for (i=0; i < (gdk_info ? gdk_info->num_keys : device_info->num_keys); i++)
{
GdkModifierType modifiers = gdk_info ? gdk_info->keys[i].modifiers :
device_info->keys[i].modifiers;
guint keyval = gdk_info ? gdk_info->keys[i].keyval :
device_info->keys[i].keyval;
if (keyval)
{
/* FIXME: integrate this back with menus_install_accelerator */
@ -650,22 +650,22 @@ devices_write_rc_device (DeviceInfo *device_info,
else
fprintf (fp, " \"\"");
}
fprintf(fp,")");
fprintf (fp,")");
if (device_info->is_init)
{
if (device_info->brush)
fprintf(fp, "\n (brush \"%s\")",device_info->brush->name);
fprintf (fp, "\n (brush \"%s\")",device_info->brush->name);
if (device_info->pattern)
fprintf(fp, "\n (pattern \"%s\")",device_info->pattern->name);
fprintf (fp, "\n (pattern \"%s\")",device_info->pattern->name);
/* Fixme: hard coded last tool.... see gimprc */
if (device_info->tool && device_info->tool <= LAST_TOOLBOX_TOOL)
fprintf(fp, "\n (tool \"%s\")",
tool_info[device_info->tool].tool_name);
fprintf(fp, "\n (foreground %d %d %d)",
device_info->foreground[0],
device_info->foreground[1],
device_info->foreground[2]);
fprintf (fp, "\n (tool \"%s\")",
tool_info[device_info->tool].tool_name);
fprintf (fp, "\n (foreground %d %d %d)",
device_info->foreground[0],
device_info->foreground[1],
device_info->foreground[2]);
}
fprintf(fp,")\n");
@ -702,18 +702,25 @@ create_device_status (void)
if (deviceD == NULL)
{
deviceD = g_new (DeviceInfoDialog, 1);
deviceD->shell = gtk_dialog_new ();
deviceD->shell =
gimp_dialog_new (_("Device Status"), "device_status",
gimp_standard_help_func,
"dialogs/device_status_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, TRUE,
_("Save"), (GtkSignalFunc) devices_write_rc,
NULL, NULL, FALSE, FALSE,
_("Close"), devices_close_callback,
NULL, NULL, TRUE, TRUE,
NULL);
/* register this one only */
dialog_register(deviceD->shell);
gtk_window_set_title (GTK_WINDOW(deviceD->shell), _("Device Status"));
gtk_window_set_policy (GTK_WINDOW (deviceD->shell), FALSE, FALSE, TRUE);
/* don't set the dialog's size, as the number of devices may have
* changed since the last session
*/
session_set_window_geometry (deviceD->shell,
&device_status_session_info, FALSE);
dialog_register (deviceD->shell);
session_set_window_geometry (deviceD->shell, &device_status_session_info,
FALSE);
deviceD->num_devices = 0;
tmp_list = devices_info;
@ -723,10 +730,10 @@ create_device_status (void)
deviceD->num_devices++;
tmp_list = tmp_list->next;
}
/* devices table */
/* devices table */
deviceD->table = gtk_table_new (deviceD->num_devices, 5, FALSE);
gtk_container_set_border_width (GTK_CONTAINER(deviceD->table), 3);
gtk_container_add (GTK_CONTAINER(GTK_DIALOG(deviceD->shell)->vbox),
gtk_container_set_border_width (GTK_CONTAINER (deviceD->table), 3);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (deviceD->shell)->vbox),
deviceD->table);
gtk_widget_realize (deviceD->table);
gtk_widget_show (deviceD->table);
@ -841,9 +848,6 @@ create_device_status (void)
i++;
}
action_items[1].user_data = deviceD->shell;
build_action_area (GTK_DIALOG (deviceD->shell), action_items, 2, 1);
deviceD->current = 0xffffffff; /* random, but doesn't matter */
device_status_update_current ();
@ -878,7 +882,7 @@ device_status_destroy_callback (void)
}
static void
devices_close_callback (GtkWidget *w,
devices_close_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (GTK_WIDGET(data));

View File

@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define __COLOR_NOTEBOOK_C__ 1
#include "config.h"
@ -29,28 +28,17 @@
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_notebook.h"
#include "gimpui.h"
#include "libgimp/color_selector.h"
#include "libgimp/gimpintl.h"
static void color_notebook_ok_callback (GtkWidget *, gpointer);
static void color_notebook_ok_callback (GtkWidget *, gpointer);
static void color_notebook_cancel_callback (GtkWidget *, gpointer);
static gint color_notebook_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void color_notebook_update_callback (void *, int, int, int);
static void color_notebook_page_switch (GtkWidget *, GtkNotebookPage *, guint);
static ActionAreaItem action_items[2] =
{
{ N_("OK"), color_notebook_ok_callback, NULL, NULL },
{ N_("Cancel"), color_notebook_cancel_callback, NULL, NULL },
};
/* information we keep on each registered colour selector */
typedef struct _ColorSelectorInfo {
char *name; /* label used in notebook tab */
@ -98,28 +86,33 @@ color_notebook_new (int r,
g_return_val_if_fail (selector_info != NULL, NULL);
cnp = g_malloc (sizeof (_ColorNotebook));
cnp = g_new (_ColorNotebook, 1);
cnp->callback = callback;
cnp->client_data = client_data;
cnp->callback = callback;
cnp->client_data = client_data;
cnp->wants_updates = wants_updates;
cnp->selectors = NULL;
cnp->cur_page = NULL;
cnp->selectors = NULL;
cnp->cur_page = NULL;
cnp->values[RED] = cnp->orig_values[RED] = r & 0xff;
cnp->values[RED] = cnp->orig_values[RED] = r & 0xff;
cnp->values[GREEN] = cnp->orig_values[GREEN] = g & 0xff;
cnp->values[BLUE] = cnp->orig_values[BLUE] = b & 0xff;
cnp->values[BLUE] = cnp->orig_values[BLUE] = b & 0xff;
/* window hints need to stay the same, so people's window manager
* setups still work */
cnp->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cnp->shell), "color_selection", "Gimp");
gtk_window_set_title (GTK_WINDOW (cnp->shell), _("Color Selection"));
gtk_window_set_policy (GTK_WINDOW (cnp->shell), FALSE, FALSE, FALSE);
cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
gimp_standard_help_func,
"dialogs/color_notebook_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (cnp->shell), "delete_event",
(GtkSignalFunc) color_notebook_delete_callback, cnp);
wants_updates ? _("Close") : _("OK"),
color_notebook_ok_callback,
cnp, NULL, TRUE, FALSE,
wants_updates ? _("Revert to Old Color") : _("Cancel"),
color_notebook_cancel_callback,
cnp, NULL, FALSE, TRUE,
NULL);
/* do we actually need a notebook? */
if (selector_info->next)
@ -179,21 +172,6 @@ color_notebook_new (int r,
info = info->next;
}
/* The action area */
action_items[0].user_data = cnp;
action_items[1].user_data = cnp;
if (cnp->wants_updates)
{
action_items[0].label = _("Close");
action_items[1].label = _("Revert to Old Color");
}
else
{
action_items[0].label = _("OK");
action_items[1].label = _("Cancel");
}
build_action_area (GTK_DIALOG (cnp->shell), action_items, 2, 0);
gtk_widget_show (cnp->shell);
/* this must come after showing the widget, otherwise we get a
@ -209,7 +187,6 @@ color_notebook_new (int r,
return cnp;
}
void
color_notebook_show (ColorNotebookP cnp)
{
@ -217,7 +194,6 @@ color_notebook_show (ColorNotebookP cnp)
gtk_widget_show (cnp->shell);
}
void
color_notebook_hide (ColorNotebookP cnp)
{
@ -253,13 +229,12 @@ color_notebook_free (ColorNotebookP cnp)
g_free (cnp);
}
void
color_notebook_set_color (ColorNotebookP cnp,
int r,
int g,
int b,
int set_current)
int r,
int g,
int b,
int set_current)
{
ColorSelectorInstance *csel;
g_return_if_fail (cnp != NULL);
@ -279,11 +254,12 @@ color_notebook_set_color (ColorNotebookP cnp,
csel->info->m.setcolor (csel->selector_data, r, g, b, set_current);
}
/* Called by a colour selector on user selection of a colour */
static void
color_notebook_update_callback (void *data, int r, int g, int b)
color_notebook_update_callback (void *data,
int r,
int g,
int b)
{
ColorSelectorInstance *csel;
ColorNotebookP cnp;
@ -307,16 +283,13 @@ color_notebook_update_callback (void *data, int r, int g, int b)
}
}
static void
color_notebook_ok_callback (GtkWidget *w,
gpointer client_data)
color_notebook_ok_callback (GtkWidget *widget,
gpointer data)
{
ColorNotebookP cnp;
cnp = (ColorNotebookP) client_data;
cnp = (ColorNotebookP) data;
if (cnp->callback)
(* cnp->callback) (cnp->values[RED],
@ -326,25 +299,13 @@ color_notebook_ok_callback (GtkWidget *w,
cnp->client_data);
}
static gint
color_notebook_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
color_notebook_cancel_callback (w, client_data);
return TRUE;
}
static void
color_notebook_cancel_callback (GtkWidget *w,
gpointer client_data)
color_notebook_cancel_callback (GtkWidget *widget,
gpointer data)
{
ColorNotebookP cnp;
cnp = (ColorNotebookP) client_data;
cnp = (ColorNotebookP) data;
if (cnp->callback)
(* cnp->callback) (cnp->orig_values[RED],
@ -355,14 +316,14 @@ color_notebook_cancel_callback (GtkWidget *w,
}
static void
color_notebook_page_switch (GtkWidget *w,
color_notebook_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
guint page_num)
{
ColorNotebookP cnp;
ColorSelectorInstance *csel;
cnp = gtk_object_get_user_data (GTK_OBJECT (w));
cnp = gtk_object_get_user_data (GTK_OBJECT (widget));
csel = gtk_object_get_data (GTK_OBJECT(page->child), "gimp_color_notebook");
g_return_if_fail (cnp != NULL && csel != NULL);
@ -466,5 +427,4 @@ selector_death (ColorSelectorInfo *info)
g_warning ("color selector %p not found, can't happen!", info);
}
/* End of color_notebook.c */

View File

@ -15,11 +15,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "file_new_dialog.h"
#include "actionarea.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gdisplay.h"
#include "libgimp/gimpchainbutton.h"
@ -27,7 +25,8 @@
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
typedef struct {
typedef struct
{
GtkWidget *dlg;
GtkWidget *confirm_dlg;
@ -50,7 +49,6 @@ static void file_new_confirm_dialog (NewImageInfo *);
static void file_new_ok_callback (GtkWidget *, gpointer);
static void file_new_reset_callback (GtkWidget *, gpointer);
static gint file_new_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void file_new_cancel_callback (GtkWidget *, gpointer);
static void file_new_toggle_callback (GtkWidget *, gpointer);
static void file_new_resolution_callback (GtkWidget *, gpointer);
@ -136,15 +134,6 @@ file_new_reset_callback (GtkWidget *widget,
(GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE);
}
static gint
file_new_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
file_new_cancel_callback (widget, data);
return TRUE;
}
static void
file_new_cancel_callback (GtkWidget *widget,
gpointer data)
@ -185,15 +174,6 @@ file_new_confirm_dialog_cancel_callback (GtkWidget *widget,
gtk_widget_set_sensitive (info->dlg, TRUE);
}
static gint
file_new_confirm_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
file_new_confirm_dialog_cancel_callback (widget, data);
return TRUE;
}
static void
file_new_confirm_dialog (NewImageInfo *info)
{
@ -202,32 +182,21 @@ file_new_confirm_dialog (NewImageInfo *info)
gchar *max_size;
gchar *text;
static ActionAreaItem action_items[] =
{
{ N_("OK"),
(ActionCallback) file_new_confirm_dialog_ok_callback, NULL, NULL },
{ N_("Cancel"),
(ActionCallback) file_new_confirm_dialog_cancel_callback, NULL, NULL }
};
gtk_widget_set_sensitive (info->dlg, FALSE);
info->confirm_dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (info->confirm_dlg),
"confirm_size", "Gimp");
gtk_window_set_title (GTK_WINDOW (info->confirm_dlg), _("Confirm Image Size"));
gtk_window_set_policy (GTK_WINDOW (info->confirm_dlg), FALSE, FALSE, FALSE);
gtk_window_position (GTK_WINDOW (info->confirm_dlg), GTK_WIN_POS_MOUSE);
info->confirm_dlg =
gimp_dialog_new (_("Confirm Image Size"), "confirm_size",
gimp_standard_help_func,
"dialogs/file_new_dialog.html#confirm_size_dialog",
GTK_WIN_POS_MOUSE,
FALSE, FALSE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (info->confirm_dlg), "delete_event",
(GtkSignalFunc) file_new_confirm_dialog_delete_callback,
info);
_("OK"), file_new_confirm_dialog_ok_callback,
info, NULL, TRUE, FALSE,
_("Cancel"), file_new_confirm_dialog_cancel_callback,
info, NULL, FALSE, TRUE,
/* The action area */
action_items[0].user_data = info;
action_items[1].user_data = info;
build_action_area (GTK_DIALOG (info->confirm_dlg), action_items, 2, 0);
NULL);
size = image_new_get_size_string (info->size);
max_size = image_new_get_size_string (max_new_image_size);
@ -326,15 +295,14 @@ file_new_image_size_callback (GtkWidget *widget,
gpointer data)
{
NewImageInfo *info;
gdouble width, height;
gchar *text;
gchar *label;
info = (NewImageInfo*) data;
width = (gdouble) (gint)
info->values->width = (gdouble) (gint)
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (info->size_se), 0) + 0.5);
height = (gdouble) (gint)
info->values->height = (gdouble) (gint)
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (info->size_se), 1) + 0.5);
info->size = image_new_calculate_size (info->values);
@ -391,35 +359,26 @@ ui_new_image_window_create (const GimpImageNewValues *values_orig)
GSList *group;
GList *list;
static ActionAreaItem action_items[] =
{
{ N_("OK"), file_new_ok_callback, NULL, NULL },
{ N_("Reset"), file_new_reset_callback, NULL, NULL },
{ N_("Cancel"), file_new_cancel_callback, NULL, NULL }
};
info = g_new (NewImageInfo, 1);
info->values = values = image_new_values_new (values_orig);
info->confirm_dlg = NULL;
info->size = 0.0;
info->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (info->dlg), "new_image", "Gimp");
gtk_window_set_title (GTK_WINDOW (info->dlg), _("New Image"));
gtk_window_set_position (GTK_WINDOW (info->dlg), GTK_WIN_POS_MOUSE);
gtk_window_set_policy(GTK_WINDOW (info->dlg), FALSE, FALSE, TRUE);
info->dlg = gimp_dialog_new (_("New Image"), "new_image",
gimp_standard_help_func,
"dialogs/file_new_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, FALSE, TRUE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (info->dlg), "delete_event",
GTK_SIGNAL_FUNC (file_new_delete_callback),
info);
_("OK"), file_new_ok_callback,
info, NULL, FALSE, FALSE,
_("Reset"), file_new_reset_callback,
info, NULL, FALSE, FALSE,
_("Cancel"), file_new_cancel_callback,
info, NULL, TRUE, TRUE,
/* The action area */
action_items[0].user_data = info;
action_items[1].user_data = info;
action_items[2].user_data = info;
build_action_area (GTK_DIALOG (info->dlg), action_items, 3, 2);
NULL);
/* vbox holding the rest of the dialog */
top_vbox = gtk_vbox_new (FALSE, 2);

View File

@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
@ -143,8 +142,10 @@ info_dialog_delete_callback (GtkWidget *widget,
}
static InfoDialog *
info_dialog_new_extended (gchar *title,
gboolean in_notebook)
info_dialog_new_extended (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gboolean in_notebook)
{
InfoDialog *idialog;
GtkWidget *shell;
@ -171,7 +172,7 @@ info_dialog_new_extended (gchar *title,
info_table = gtk_table_new (2, 0, FALSE);
if( in_notebook)
if (in_notebook)
{
info_notebook = gtk_notebook_new ();
gtk_notebook_append_page (GTK_NOTEBOOK (info_notebook),
@ -196,21 +197,28 @@ info_dialog_new_extended (gchar *title,
gtk_widget_show (idialog->info_table);
gtk_widget_show (idialog->vbox);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (idialog->shell, help_func, help_data);
return idialog;
}
/* public functions */
InfoDialog *
info_dialog_notebook_new (gchar *title)
info_dialog_notebook_new (gchar *title,
GimpHelpFunc help_func,
gpointer help_data)
{
return info_dialog_new_extended (title, TRUE);
return info_dialog_new_extended (title, help_func, help_data, TRUE);
}
InfoDialog *
info_dialog_new (gchar *title)
info_dialog_new (gchar *title,
GimpHelpFunc help_func,
gpointer help_data)
{
return info_dialog_new_extended (title, FALSE);
return info_dialog_new_extended (title, help_func, help_data, FALSE);
}
void
@ -236,7 +244,6 @@ info_dialog_free (InfoDialog *idialog)
g_free (idialog);
}
void
info_dialog_popup (InfoDialog *idialog)
{

View File

@ -18,7 +18,9 @@
#ifndef __INFO_DIALOG_H__
#define __INFO_DIALOG_H__
#include "gtk/gtk.h"
#include <gtk/gtk.h>
#include "gimphelp.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpunit.h"
@ -61,8 +63,12 @@ struct _InfoDialog
/* Info Dialog functions */
InfoDialog *info_dialog_new (gchar *title);
InfoDialog *info_dialog_notebook_new (gchar *title);
InfoDialog *info_dialog_new (gchar *title,
GimpHelpFunc help_func,
gpointer help_data);
InfoDialog *info_dialog_notebook_new (gchar *title,
GimpHelpFunc help_func,
gpointer help_data);
void info_dialog_free (InfoDialog *idialog);
void info_dialog_popup (InfoDialog *idialog);

View File

@ -15,8 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "appenv.h"
#include "actionarea.h"
#include "colormaps.h"
@ -283,10 +283,12 @@ info_window_create (void *gdisp_ptr)
/* create the info dialog */
title_buf = g_strdup_printf (_("%s: Window Info"), title);
info_win = info_dialog_notebook_new (title_buf);
info_win = info_dialog_notebook_new (title_buf,
gimp_standard_help_func,
"dialogs/info_window.html");
g_free (title_buf);
iwd = (InfoWinData *) g_malloc (sizeof (InfoWinData));
iwd = g_new (InfoWinData, 1);
info_win->user_data = iwd;
iwd->dimensions_str[0] = '\0';
iwd->resolution_str[0] = '\0';

View File

@ -36,10 +36,10 @@
#include "gimpsignal.h"
#include "gimprc.h"
#include "datafiles.h"
#include "actionarea.h"
#include "gimpset.h"
#include "libgimp/gimpenv.h"
#include "gimpui.h"
#include "libgimp/gimpenv.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"
@ -258,19 +258,21 @@ module_db_browser_new (void)
GtkWidget *listbox;
GtkWidget *button;
browser_st *st;
ActionAreaItem action_items[] =
{
{ N_("OK"), browser_popdown_callback, NULL, NULL }
};
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
gimp_standard_help_func,
"dialogs/module_db_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (shell), "module_db_dialog", "Gimp");
gtk_window_set_title (GTK_WINDOW (shell), _("Module DB"));
_("OK"), browser_popdown_callback,
NULL, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
gtk_widget_show (vbox);
listbox = gtk_scrolled_window_new (NULL, NULL);
@ -333,12 +335,6 @@ module_db_browser_new (void)
gtk_signal_connect (GTK_OBJECT (shell), "destroy",
browser_destroy_callback, st);
action_items[0].user_data = shell;
build_action_area (GTK_DIALOG (shell),
action_items,
sizeof( action_items)/sizeof( ActionAreaItem),
0);
return shell;
}

View File

@ -23,6 +23,7 @@
#include "gdisplay_ops.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "gimpui.h"
#include "image_render.h"
#include "interface.h"
#include "lc_dialog.h"
@ -107,6 +108,7 @@ static int old_max_new_image_size;
static int old_thumbnail_mode;
static int old_show_indicators;
static int old_trust_dirty_flag;
static int old_use_help;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
@ -531,7 +533,12 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "trust-dirty-flag");
remove = g_list_append (update, "dont-trust-dirty-flag");
}
if (use_help != old_use_help)
{
update = g_list_append (update, "use-help");
remove = g_list_append (remove, "dont-use-help");
}
save_gimprc (&update, &remove);
if (using_xserver_resolution)
@ -597,6 +604,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
thumbnail_mode = old_thumbnail_mode;
show_indicators = old_show_indicators;
trust_dirty_flag = old_trust_dirty_flag;
use_help = old_use_help;
if (preview_size != old_preview_size)
{
@ -703,6 +711,8 @@ file_prefs_toggle_callback (GtkWidget *widget,
val = data;
*val = (long) gtk_object_get_user_data (GTK_OBJECT (widget));
}
else if (data == &use_help)
use_help = GTK_TOGGLE_BUTTON (widget)->active;
else
{
/* Are you a gimp-hacker who is getting this message? You
@ -972,360 +982,6 @@ file_prefs_monitor_resolution_callback (GtkWidget *widget,
monitor_yres = yres;
}
/* ********************************************************************
* convenience constructors test site ;)
*/
/* local callbacks of gimp_dialog_new () */
static int
gimp_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
GtkSignalFunc cancel_callback;
GtkWidget *cancel_widget;
cancel_callback =
(GtkSignalFunc) gtk_object_get_data (GTK_OBJECT (widget),
"gimp_dialog_cancel_callback");
cancel_widget =
(GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
"gimp_dialog_cancel_widget");
/* the cancel callback has to destroy the dialog */
if (cancel_callback)
(* cancel_callback) (cancel_widget, data);
return TRUE;
}
/*
#include "/home/mitschel/gimpfiles/wilber.xpm"
static void
gimp_dialog_realize_callback (GtkWidget *widget,
gpointer data)
{
static GdkPixmap *wilber_pixmap = NULL;
static GdkBitmap *wilber_mask = NULL;
GtkStyle *style;
style = gtk_widget_get_style (widget);
if (wilber_pixmap == NULL)
wilber_pixmap =
gdk_pixmap_create_from_xpm_d (widget->window,
&wilber_mask,
&style->bg[GTK_STATE_NORMAL],
wilber_xpm);
gdk_window_set_icon (widget->window, NULL,
wilber_pixmap, wilber_mask);
}
*/
/* this is an experimental one
* I tried to fold the entire dialog creation and the ActionArea stuff
* into one function. Might be not general enough.
*/
GtkWidget*
gimp_dialog_new (const gchar *title,
const gchar *wmclass_name,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,
gint auto_shrink,
/* specify action area buttons as va_list:
* gchar *label,
* GtkSignalFunc callback,
* gpointer data,
* gboolean default_action,
* gboolean connect_delete,
*/
...)
{
GtkWidget *dialog;
GtkWidget *hbbox;
GtkWidget *button;
/* action area variables */
gchar *label;
GtkSignalFunc callback;
gpointer data;
gboolean default_action;
gboolean connect_delete;
va_list args;
gboolean delete_connected = FALSE;
g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (wmclass_name != NULL, NULL);
dialog = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp");
gtk_window_set_title (GTK_WINDOW (dialog), title);
gtk_window_set_position (GTK_WINDOW (dialog), position);
gtk_window_set_policy (GTK_WINDOW (dialog),
allow_grow, allow_shrink, auto_shrink);
/* prepare the action_area */
gtk_container_set_border_width
(GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
hbbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_show (hbbox);
/* the action_area buttons */
va_start (args, auto_shrink);
label = va_arg (args, gchar*);
while (label)
{
callback = va_arg (args, GtkSignalFunc);
data = va_arg (args, gpointer);
default_action = va_arg (args, gboolean);
connect_delete = va_arg (args, gboolean);
button = gtk_button_new_with_label (label);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
/* pass data as user_data if data != NULL, or the dialog otherwise */
if (callback)
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback),
data ? data : dialog);
if (connect_delete && callback && !delete_connected)
{
gtk_object_set_data (GTK_OBJECT (dialog),
"gimp_dialog_cancel_callback",
callback);
gtk_object_set_data (GTK_OBJECT (dialog),
"gimp_dialog_cancel_widget",
button);
/* catch the WM delete event */
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
data ? data : dialog);
delete_connected = TRUE;
}
if (default_action)
gtk_widget_grab_default (button);
gtk_widget_show (button);
label = va_arg (args, gchar*);
}
va_end (args);
/* catch the WM delete event if not already done */
if (! delete_connected)
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
NULL);
/* the realize callback sets the WM icon */
/*
gtk_signal_connect (GTK_OBJECT (dialog), "realize",
(GtkSignalFunc) gimp_dialog_realize_callback,
NULL);
*/
return dialog;
}
GtkWidget*
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gpointer initial, /* user_data */
/* specify menu items as va_list:
* gchar *label,
* gpointer data,
* gpointer user_data,
*/
...)
{
GtkWidget *menu;
GtkWidget *menuitem;
GtkWidget *optionmenu;
/* menu item variables */
gchar *label;
gpointer data;
gpointer user_data;
va_list args;
gint i;
gint initial_index;
menu = gtk_menu_new ();
/* create the menu items */
initial_index = 0;
va_start (args, initial);
label = va_arg (args, gchar*);
for (i = 0; label; i++)
{
data = va_arg (args, gpointer);
user_data = va_arg (args, gpointer);
menuitem = gtk_menu_item_new_with_label (label);
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
menu_item_callback, data);
gtk_object_set_user_data (GTK_OBJECT (menuitem), user_data);
gtk_widget_show (menuitem);
/* remember the initial menu item */
if (user_data == initial)
initial_index = i;
label = va_arg (args, gchar*);
}
va_end (args);
optionmenu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
/* select the initial menu item */
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), initial_index);
return optionmenu;
}
GtkWidget*
gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gpointer initial, /* user_data */
/* specify radio buttons as va_list:
* gchar *label,
* gpointer data,
* gpointer user_data,
*/
...)
{
GtkWidget *vbox;
GtkWidget *button;
GSList *group;
/* radio button variables */
gchar *label;
gpointer data;
gpointer user_data;
va_list args;
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
group = NULL;
/* create the radio buttons */
va_start (args, initial);
label = va_arg (args, gchar*);
while (label)
{
data = va_arg (args, gpointer);
user_data = va_arg (args, gpointer);
button = gtk_radio_button_new_with_label (group, label);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
(GtkSignalFunc) radio_button_callback,
data);
gtk_object_set_user_data (GTK_OBJECT (button), user_data);
/* press the initially active radio button */
if (user_data == initial)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_widget_show (button);
label = va_arg (args, gchar*);
}
va_end (args);
return vbox;
}
/* this might be the standard gimp spinbutton */
GtkWidget*
gimp_spin_button_new (GtkObject **adjustment, /* return value */
gfloat value,
gfloat lower,
gfloat upper,
gfloat step_increment,
gfloat page_increment,
gfloat page_size,
gfloat climb_rate,
guint digits)
{
GtkWidget *spinbutton;
*adjustment = gtk_adjustment_new (value, lower, upper,
step_increment, page_increment, page_size);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (*adjustment),
climb_rate, digits);
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
GTK_SHADOW_NONE);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_usize (spinbutton, 75, 0);
return spinbutton;
}
/* add aligned label & widget to a two-column table */
void
gimp_table_attach_aligned (GtkTable *table,
gint row,
gchar *text,
gfloat xalign,
gfloat yalign,
GtkWidget *widget,
gboolean left_adjust)
{
GtkWidget *label;
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
gtk_table_attach (table, GTK_WIDGET (label), 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
if (left_adjust)
{
GtkWidget *alignment;
alignment = gtk_alignment_new (0.0, 1.0, 0.0, 0.0);
gtk_table_attach_defaults (table, alignment, 1, 2, row, row + 1);
gtk_widget_show (alignment);
gtk_container_add (GTK_CONTAINER (alignment), widget);
}
else
{
gtk_table_attach_defaults (table, widget, 1, 2, row, row + 1);
}
gtk_widget_show (widget);
}
/**********************************************************************
* preferences-specific GUI helpers
*/
/* create a new notebook page */
static GtkWidget*
file_prefs_notebook_append_page (GtkNotebook *notebook,
@ -1492,6 +1148,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_thumbnail_mode = thumbnail_mode;
old_show_indicators = show_indicators;
old_trust_dirty_flag = trust_dirty_flag;
old_use_help = use_help;
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
@ -1506,20 +1163,24 @@ file_pref_cmd_callback (GtkWidget *widget,
/* Create the dialog */
prefs_dlg =
gimp_dialog_new (_("Preferences"), "gimp_preferences",
GTK_WIN_POS_NONE, FALSE, FALSE, FALSE,
_("OK"), file_prefs_ok_callback, NULL,
FALSE, FALSE,
_("Save"), file_prefs_save_callback, NULL,
FALSE, FALSE,
_("Cancel"), file_prefs_cancel_callback, NULL,
TRUE, TRUE,
gimp_standard_help_func,
"dialogs/preferences_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
_("OK"), file_prefs_ok_callback,
NULL, NULL, FALSE, FALSE,
_("Save"), file_prefs_save_callback,
NULL, NULL, FALSE, FALSE,
_("Cancel"), file_prefs_cancel_callback,
NULL, NULL, TRUE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (prefs_dlg)->vbox),
hbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (prefs_dlg)->vbox), hbox);
gtk_widget_show (hbox);
/* The categories tree */
@ -1849,7 +1510,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
button = gtk_check_button_new_with_label(_("Show Tool Tips"));
button = gtk_check_button_new_with_label (_("Show Tool Tips"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
show_tool_tips);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
@ -1858,6 +1519,16 @@ file_pref_cmd_callback (GtkWidget *widget,
&show_tool_tips);
gtk_widget_show (button);
button =
gtk_check_button_new_with_label (_("Context Sensitive Help with \"F1\""));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
use_help);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
(GtkSignalFunc) file_prefs_toggle_callback,
&use_help);
gtk_widget_show (button);
/* Interface / Image Windows */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Image Windows Settings"),

View File

@ -20,14 +20,5 @@
#define __PREFERENCES_DIALOG_H__
void file_pref_cmd_callback (GtkWidget *, gpointer);
GtkWidget* gimp_spin_button_new (GtkObject **,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
gfloat,
guint);
#endif /* __PREFERENCES_DIALOG_H__ */

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "appenv.h"
#include "resize.h"
#include "actionarea.h"
#include "gimprc.h"
#include "gimpui.h"
#include "libgimp/gimpchainbutton.h"
#include "libgimp/gimplimits.h"
@ -91,9 +91,6 @@ resize_widget_new (ResizeType type,
gboolean dot_for_dot,
GtkSignalFunc ok_cb,
GtkSignalFunc cancel_cb,
gint (*delete_cb) (GtkWidget *,
GdkEvent *,
gpointer),
gpointer user_data)
{
Resize *resize;
@ -110,12 +107,6 @@ resize_widget_new (ResizeType type,
GtkWidget *alignment;
GtkObject *adjustment;
static ActionAreaItem action_items[] =
{
{ N_("OK"), NULL, NULL, NULL },
{ N_("Cancel"), NULL, NULL, NULL }
};
alignment = NULL;
frame = NULL;
@ -149,52 +140,62 @@ resize_widget_new (ResizeType type,
/* dialog box */
{
const char *wmclass = NULL;
const char *window_title = NULL;
const gchar *wmclass = NULL;
const gchar *window_title = NULL;
gchar *help_page = NULL;
switch (type) {
case ScaleWidget:
switch (target) {
case ResizeLayer:
switch (type)
{
case ScaleWidget:
switch (target)
{
case ResizeLayer:
wmclass = "scale_layer";
window_title = _("Scale Layer");
help_page = "dialogs/scale_layer_dialog.html";
frame = gtk_frame_new (_("Size"));
break;
case ResizeImage:
case ResizeImage:
wmclass = "image_scale";
window_title = _("Image Scale");
help_page = "dialogs/scale_image_dialog.html";
frame = gtk_frame_new (_("Pixel Dimensions"));
break;
}
}
break;
case ResizeWidget:
switch (target) {
case ResizeLayer:
case ResizeWidget:
switch (target)
{
case ResizeLayer:
wmclass = "resize_layer";
window_title = _("Resize Layer");
help_page = "dialogs/resize_layer_dialog.html";
break;
case ResizeImage:
case ResizeImage:
wmclass = "image_resize";
window_title = _("Image Resize");
help_page = "dialogs/resize_image_dialog.html";
break;
}
}
frame = gtk_frame_new (_("Size"));
break;
}
}
resize->resize_shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (resize->resize_shell), wmclass,"Gimp");
gtk_window_set_title (GTK_WINDOW (resize->resize_shell), window_title);
gtk_window_set_policy(GTK_WINDOW (resize->resize_shell), FALSE,FALSE,TRUE);
gtk_window_position (GTK_WINDOW (resize->resize_shell), GTK_WIN_POS_MOUSE);
resize->resize_shell =
gimp_dialog_new (window_title, wmclass,
gimp_standard_help_func, help_page,
GTK_WIN_POS_MOUSE,
FALSE, FALSE, TRUE,
_("OK"), ok_cb,
user_data, NULL, TRUE, FALSE,
_("Cancel"), cancel_cb,
user_data, NULL, FALSE, TRUE,
NULL);
}
/* handle the wm close singal */
if (delete_cb)
gtk_signal_connect (GTK_OBJECT (resize->resize_shell), "delete_event",
GTK_SIGNAL_FUNC (delete_cb), user_data);
/* handle the image disappearing under our feet */
if (object)
{
@ -203,16 +204,9 @@ resize_widget_new (ResizeType type,
signame = (target == ResizeLayer) ? "removed" : "destroy";
private->object = object;
private->object_destroy_handler =
gtk_signal_connect(GTK_OBJECT (object), signame, cancel_cb, user_data);
gtk_signal_connect (GTK_OBJECT (object), signame, cancel_cb, user_data);
}
/* the action area */
action_items[0].user_data = user_data;
action_items[0].callback = ok_cb;
action_items[1].user_data = user_data;
action_items[1].callback = cancel_cb;
build_action_area (GTK_DIALOG (resize->resize_shell), action_items, 2, 0);
/* the main vbox */
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);

View File

@ -73,9 +73,6 @@ Resize * resize_widget_new (ResizeType type,
gboolean dot_for_dot,
GtkSignalFunc ok_cb,
GtkSignalFunc cancel_cb,
gint (*delete_cb) (GtkWidget *,
GdkEvent *,
gpointer),
gpointer user_data);
void resize_widget_free (Resize * resize);

View File

@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib.h>
@ -29,9 +28,9 @@
#endif
#include "appenv.h"
#include "actionarea.h"
#include "install.h"
#include "gimprc.h"
#include "gimpui.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimpenv.h"
@ -49,13 +48,13 @@
# define USER_INSTALL "user_install.bat"
#endif
static void install_run (InstallCallback);
static void install_help (InstallCallback);
static void help_install_callback (GtkWidget *, gpointer);
static void help_ignore_callback (GtkWidget *, gpointer);
static void help_quit_callback (GtkWidget *, gpointer);
static void install_run (InstallCallback);
static void install_help (InstallCallback);
static void help_install_callback (GtkWidget *, gpointer);
static void help_ignore_callback (GtkWidget *, gpointer);
static void help_quit_callback (GtkWidget *, gpointer);
static void install_continue_callback (GtkWidget *, gpointer);
static void install_quit_callback (GtkWidget *, gpointer);
static void install_quit_callback (GtkWidget *, gpointer);
static GtkWidget *help_widget;
static GtkWidget *install_widget;
@ -100,12 +99,6 @@ install_verify (InstallCallback install_callback)
static void
install_help (InstallCallback callback)
{
static ActionAreaItem action_items[] =
{
{ N_("Install"), help_install_callback, NULL, NULL },
{ N_("Ignore"), help_ignore_callback, NULL, NULL },
{ N_("Quit"), help_quit_callback, NULL, NULL }
};
GtkWidget *text;
GtkWidget *table;
GtkWidget *vsb;
@ -175,7 +168,7 @@ install_help (InstallCallback callback)
{ 1, N_("generated_brushes\n") },
{ 0, N_("\t\tThis is a subdirectory which is used to store brushes\n"
"\t\tthat are created with the brush editor. The default\n"
"\t\gimprc file checks this subdirectory when searching for\n"
"\t\tgimprc file checks this subdirectory when searching for\n"
"\t\tgenerated brushes.\n") },
{ 1, N_("gradients\n") },
@ -254,13 +247,24 @@ install_help (InstallCallback callback)
gint nhelp_lines = sizeof (help_lines) / sizeof (help_lines[0]);
gint i;
help_widget = gtk_dialog_new ();
gtk_signal_connect (GTK_OBJECT (help_widget), "delete_event",
GTK_SIGNAL_FUNC (gtk_true),
NULL);
gtk_window_set_wmclass (GTK_WINDOW (help_widget), "gimp_installation", "Gimp");
gtk_window_set_title (GTK_WINDOW (help_widget), _("GIMP Installation"));
gtk_window_position (GTK_WINDOW (help_widget), GTK_WIN_POS_CENTER);
help_widget = gimp_dialog_new (_("GIMP Installation"), "gimp_installation",
NULL, NULL,
GTK_WIN_POS_CENTER,
FALSE, TRUE, FALSE,
_("Install"), help_install_callback,
callback, NULL, TRUE, FALSE,
_("Ignore"), help_ignore_callback,
callback, NULL, FALSE, FALSE,
_("Quit"), help_quit_callback,
callback, NULL, FALSE, TRUE,
NULL);
table = gtk_table_new (1, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (help_widget)->vbox), table);
vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
vsb = gtk_vscrollbar_new (vadj);
@ -268,25 +272,12 @@ install_help (InstallCallback callback)
gtk_text_set_editable (GTK_TEXT (text), FALSE);
gtk_widget_set_usize (text, 450, 475);
table = gtk_table_new (1, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
action_items[0].user_data = (void *) callback;
action_items[1].user_data = (void *) callback;
action_items[2].user_data = (void *) callback;
build_action_area (GTK_DIALOG (help_widget), action_items, 3, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (help_widget)->vbox), table,
TRUE, TRUE, 0);
gtk_table_attach (GTK_TABLE (table), vsb, 1, 2, 0, 1,
0, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), text, 0, 1, 0, 1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
font_strong = gdk_font_load ("-*-helvetica-bold-r-normal-*-*-120-*-*-*-*-*-*");
font_emphasis = gdk_font_load ("-*-helvetica-medium-o-normal-*-*-100-*-*-*-*-*-*");
font = gdk_font_load ("-*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*");
@ -392,11 +383,6 @@ quote_spaces (char *string)
static void
install_run (InstallCallback callback)
{
static ActionAreaItem action_items[] =
{
{ N_("Continue"), install_continue_callback, NULL, NULL },
{ N_("Quit"), install_quit_callback, NULL, NULL }
};
GtkWidget *text;
GtkWidget *table;
GtkWidget *vsb;
@ -409,27 +395,28 @@ install_run (InstallCallback callback)
int err;
int executable = TRUE;
install_widget = gtk_dialog_new ();
gtk_signal_connect (GTK_OBJECT (install_widget), "delete_event",
GTK_SIGNAL_FUNC (gtk_true),
NULL);
gtk_window_set_wmclass (GTK_WINDOW (install_widget), "installation_log", "Gimp");
gtk_window_set_title (GTK_WINDOW (install_widget), _("Installation Log"));
gtk_window_position (GTK_WINDOW (install_widget), GTK_WIN_POS_CENTER);
install_widget = gimp_dialog_new (_("Installation Log"), "installation_log",
NULL, NULL,
GTK_WIN_POS_CENTER,
FALSE, TRUE, FALSE,
_("Continue"), install_continue_callback,
callback, NULL, TRUE, FALSE,
_("Quit"), install_quit_callback,
callback, NULL, FALSE, TRUE,
NULL);
table = gtk_table_new (1, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (install_widget)->vbox), table);
vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
vsb = gtk_vscrollbar_new (vadj);
text = gtk_text_new (NULL, vadj);
gtk_widget_set_usize (text, 384, 356);
table = gtk_table_new (1, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
action_items[0].user_data = (void *) callback;
action_items[1].user_data = (void *) callback;
build_action_area (GTK_DIALOG (install_widget), action_items, 2, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (install_widget)->vbox), table, TRUE, TRUE, 0);
gtk_table_attach (GTK_TABLE (table), vsb, 1, 2, 0, 1,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table), text, 0, 1, 0, 1,
@ -437,8 +424,6 @@ install_run (InstallCallback callback)
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
0, 0);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
font_strong = gdk_font_load ("-*-helvetica-bold-r-normal-*-*-120-*-*-*-*-*-*");
font = gdk_font_load ("-*-helvetica-medium-r-normal-*-*-120-*-*-*-*-*-*");

View File

@ -18,14 +18,13 @@
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "colormaps.h"
#include "cursorutil.h"
#include "fileops.h"
#include "gdisplay_ops.h"
#include "gimage.h"
#include "gimpui.h"
#include "gximage.h"
#include "interface.h"
#include "menus.h"
#include "scale.h"
#include "gimprc.h"
@ -320,16 +319,6 @@ gdisplay_cancel_warning_callback (GtkWidget *widget,
gtk_widget_destroy (mbox);
}
static gint
gdisplay_delete_warning_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
gdisplay_cancel_warning_callback (widget, client_data);
return TRUE;
}
static void
gdisplay_destroy_warning_callback (GtkWidget *widget,
gpointer client_data)
@ -346,12 +335,6 @@ gdisplay_close_warning_dialog (char *image_name,
GtkWidget *label;
gchar *warning_buf;
static ActionAreaItem action_items[] =
{
{ N_("Close"), gdisplay_close_warning_callback, NULL, NULL },
{ N_("Cancel"), gdisplay_cancel_warning_callback, NULL, NULL }
};
/* FIXUP this will raise any prexsisting close dialogs, which can be a
a bit confusing if you tried to close a new window because you had
forgotten the old dialog was still around */
@ -364,16 +347,21 @@ gdisplay_close_warning_dialog (char *image_name,
menus_set_sensitive_glue ("<Image>", N_("/File/Close"), FALSE);
warning_dialog = mbox = gtk_dialog_new ();
/* should this be image_window or the actual image name??? */
gtk_window_set_wmclass (GTK_WINDOW (mbox), "really_close", "Gimp");
gtk_window_set_title (GTK_WINDOW (mbox), image_name);
gtk_window_set_position (GTK_WINDOW (mbox), GTK_WIN_POS_MOUSE);
gtk_object_set_user_data (GTK_OBJECT (mbox), gdisp);
warning_dialog = mbox =
gimp_dialog_new (image_name, "really_close",
gimp_standard_help_func,
"dialogs/really_close_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gtk_signal_connect (GTK_OBJECT (mbox), "delete_event",
GTK_SIGNAL_FUNC (gdisplay_delete_warning_callback),
mbox);
_("Close"), gdisplay_close_warning_callback,
NULL, NULL, FALSE, FALSE,
_("Cancel"), gdisplay_cancel_warning_callback,
NULL, NULL, TRUE, TRUE,
NULL);
gtk_object_set_user_data (GTK_OBJECT (mbox), gdisp);
gtk_signal_connect (GTK_OBJECT (mbox), "destroy",
GTK_SIGNAL_FUNC (gdisplay_destroy_warning_callback),
@ -392,9 +380,5 @@ gdisplay_close_warning_dialog (char *image_name,
gtk_widget_show (label);
g_free (warning_buf);
action_items[0].user_data = mbox;
action_items[1].user_data = mbox;
build_action_area (GTK_DIALOG (mbox), action_items, 2, 1);
gtk_widget_show (mbox);
}

View File

@ -20,7 +20,6 @@
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "app_procs.h"
#include "colormaps.h"
#include "color_area.h"
@ -34,7 +33,9 @@
#include "gdisplay_ops.h"
#include "gimage.h"
#include "gimpdnd.h"
#include "gimphelp.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gtkhwrapbox.h"
#include "gtkvwrapbox.h"
#include "indicator_area.h"
@ -50,7 +51,6 @@
#include "pixmaps/qmasknosel.xpm"
#include "pixmaps/navbutton.xpm"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
/* local functions */
@ -305,9 +305,10 @@ create_color_area (GtkWidget *parent)
col_area = color_area_create (54, 42, default_pixmap, swap_pixmap);
gtk_container_add (GTK_CONTAINER (alignment), col_area);
gtk_tooltips_set_tip (tool_tips, col_area, _("Foreground & background colors. The black "
"and white squares reset colors. The arrows swap colors. Double "
"click to select a color from a colorrequester."),
gtk_tooltips_set_tip (tool_tips, col_area,
_("Foreground & background colors. The black "
"and white squares reset colors. The arrows swap colors. Double "
"click to select a color from a colorrequester."),
NULL);
gtk_widget_show (col_area);
gtk_widget_show (alignment);
@ -524,7 +525,7 @@ create_toolbox (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* Register dialog */
dialog_register_toolbox(window);
dialog_register_toolbox (window);
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
@ -587,6 +588,11 @@ create_toolbox (void)
/* Install the accelerator table in the main window */
gtk_window_add_accel_group (GTK_WINDOW (window), table);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (window,
gimp_standard_help_func,
"dialogs/toolbox.html");
wbox = gtk_vwrap_box_new (FALSE);
gtk_wrap_box_set_justify (GTK_WRAP_BOX (wbox), GTK_JUSTIFY_FILL);
gtk_container_set_border_width (GTK_CONTAINER (wbox), 0);
@ -626,7 +632,7 @@ void
toolbox_raise_callback (GtkWidget *widget,
gpointer client_data)
{
gdk_window_raise(toolbox_shell->window);
gdk_window_raise (toolbox_shell->window);
}
void
@ -873,7 +879,7 @@ create_display_shell (GDisplay* gdisp,
gtk_table_attach (GTK_TABLE (table), table_inner, 0, 1, 0, 1,
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);
/* sneak in an extra table here */
/* sneak in an extra table here */
gtk_table_attach (GTK_TABLE (table_lower), evbox, 3, 4, 0, 1,
GTK_SHRINK, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
@ -939,12 +945,17 @@ create_display_shell (GDisplay* gdisp,
gtk_box_pack_start (GTK_BOX (gdisp->statusarea), gdisp->cancelbutton, FALSE, TRUE, 0);
gtk_widget_set_sensitive (gdisp->cancelbutton, FALSE);
/* the popup menu */
/* the popup menu */
gdisp->popup = image_popup_menu;
/* the accelerator table for images */
/* The accelerator table for images */
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell), image_accel_group);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (gdisp->shell,
gimp_standard_help_func,
"dialogs/image_window.html");
gtk_widget_show (arrow);
gtk_widget_show (gdisp->qmaskon);
gtk_widget_show (gdisp->qmaskoff);
@ -981,492 +992,12 @@ create_display_shell (GDisplay* gdisp,
#warning DODGY?
#endif /*__GNUC__ */
gtk_widget_realize (gdisp->canvas);
gdk_window_set_back_pixmap(gdisp->canvas->window, NULL, 0);
gdk_window_set_back_pixmap (gdisp->canvas->window, NULL, 0);
/* set the focus to the canvas area */
gtk_widget_grab_focus (gdisp->canvas);
}
/*
* String, integer, double and size query boxes
*/
typedef struct _QueryBox QueryBox;
struct _QueryBox
{
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *entry;
GtkWidget *ok_button;
GtkObject *object;
QueryFunc callback;
gpointer data;
};
static QueryBox * create_query_box (gchar *, gchar *, GtkObject *, gchar *,
QueryFunc, gpointer);
static gint query_box_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void query_box_cancel_callback (GtkWidget *, gpointer);
static void string_query_box_ok_callback (GtkWidget *, gpointer);
static void int_query_box_ok_callback (GtkWidget *, gpointer);
static void double_query_box_ok_callback (GtkWidget *, gpointer);
static void size_query_box_ok_callback (GtkWidget *, gpointer);
/* create a generic query box without any entry widget */
static QueryBox *
create_query_box (gchar *title,
gchar *message,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *label;
static ActionAreaItem action_items[] =
{
{ N_("OK"), (ActionCallback) NULL, NULL, NULL },
{ N_("Cancel"), (ActionCallback) query_box_cancel_callback, NULL, NULL }
};
query_box = (QueryBox *) g_malloc (sizeof (QueryBox));
qbox = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (qbox), title);
gtk_window_set_wmclass (GTK_WINDOW (qbox), "query_box", "Gimp");
gtk_window_position (GTK_WINDOW (qbox), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (qbox), "delete_event",
(GtkSignalFunc) query_box_delete_callback,
query_box);
/* if we are associated with an object, connect to the provided signal */
if (object && GTK_IS_OBJECT (object) && signal)
gtk_signal_connect (GTK_OBJECT (object), signal,
(GtkSignalFunc) query_box_cancel_callback,
query_box);
else
object = NULL;
/* The action area */
action_items[1].user_data = query_box;
build_action_area (GTK_DIALOG (qbox), action_items, 2, 0);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (qbox)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (message);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
query_box->qbox = qbox;
query_box->vbox = vbox;
query_box->entry = NULL;
query_box->ok_button = action_items[0].widget;
query_box->object = object;
query_box->callback = callback;
query_box->data = data;
return query_box;
}
GtkWidget *
query_string_box (gchar *title,
gchar *message,
gchar *initial,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *entry;
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) string_query_box_ok_callback,
query_box);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, FALSE, FALSE, 0);
if (initial)
gtk_entry_set_text (GTK_ENTRY (entry), initial);
gtk_widget_grab_focus (entry);
gtk_widget_show (entry);
query_box->entry = entry;
return query_box->qbox;
}
GtkWidget *
query_int_box (gchar *title,
gchar *message,
gint initial,
gint lower,
gint upper,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
GtkWidget *spinbutton;
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) int_query_box_ok_callback,
query_box);
adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
spinbutton = gtk_spin_button_new (adjustment, 1.0, 0);
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_grab_focus (spinbutton);
gtk_widget_show (spinbutton);
query_box->entry = spinbutton;
return query_box->qbox;
}
GtkWidget *
query_double_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
GtkWidget *spinbutton;
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) double_query_box_ok_callback,
query_box);
adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
spinbutton = gtk_spin_button_new (adjustment, 1.0, digits);
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_grab_focus (spinbutton);
gtk_widget_show (spinbutton);
query_box->entry = spinbutton;
return query_box->qbox;
}
GtkWidget *
query_size_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *sizeentry;
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) size_query_box_ok_callback,
query_box);
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE);
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
lower, upper);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, FALSE, FALSE, 0);
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
gtk_widget_show (sizeentry);
query_box->entry = sizeentry;
return query_box->qbox;
}
static gint
query_box_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
query_box_cancel_callback (widget, client_data);
return TRUE;
}
static void
query_box_cancel_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
query_box = (QueryBox *) client_data;
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
string_query_box_ok_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
gchar *string;
query_box = (QueryBox *) client_data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the entry data */
string = g_strdup (gtk_entry_get_text (GTK_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data, (gpointer) string);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
int_query_box_ok_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
gint *integer_value;
query_box = (QueryBox *) client_data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
integer_value = g_malloc (sizeof (gint));
*integer_value =
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) integer_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
double_query_box_ok_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
gdouble *double_value;
query_box = (QueryBox *) client_data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
double_value = g_malloc (sizeof (gdouble));
*double_value =
gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
size_query_box_ok_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
gdouble *double_value;
query_box = (QueryBox *) client_data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the sizeentry data */
double_value = g_malloc (sizeof (gdouble));
*double_value =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (query_box->entry), 0);
/* Pass the selected unit to the callback */
gtk_object_set_data
(GTK_OBJECT (widget), "size_query_unit",
(gpointer) gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
/*
* Message Boxes...
*/
typedef struct _MessageBox MessageBox;
struct _MessageBox
{
GtkWidget *mbox;
GtkCallback callback;
gpointer data;
};
static void message_box_close_callback (GtkWidget *, gpointer);
static gint message_box_delete_callback (GtkWidget *, GdkEvent *, gpointer);
GtkWidget *
message_box (gchar *message,
GtkCallback callback,
gpointer data)
{
MessageBox *msg_box;
GtkWidget *mbox;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *button;
if (! message)
return NULL;
msg_box = (MessageBox *) g_malloc (sizeof (MessageBox));
mbox = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (mbox), "gimp_message", "Gimp");
gtk_window_set_title (GTK_WINDOW (mbox), _("GIMP Message"));
gtk_window_position (GTK_WINDOW (mbox), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (mbox)->action_area), 2);
gtk_signal_connect (GTK_OBJECT (mbox), "delete_event",
GTK_SIGNAL_FUNC (message_box_delete_callback),
msg_box);
button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) message_box_close_callback,
msg_box);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mbox)->action_area), button,
TRUE, TRUE, 0);
gtk_widget_grab_default (button);
gtk_widget_show (button);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (mbox)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (message);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
gtk_widget_show (label);
msg_box->mbox = mbox;
msg_box->callback = callback;
msg_box->data = data;
gtk_widget_show (mbox);
return mbox;
}
static gint
message_box_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
message_box_close_callback (widget, client_data);
return TRUE;
}
static void
message_box_close_callback (GtkWidget *widget,
gpointer client_data)
{
MessageBox *msg_box;
msg_box = (MessageBox *) client_data;
/* If there is a valid callback, invoke it */
if (msg_box->callback)
(* msg_box->callback) (widget, msg_box->data);
/* Destroy the box */
gtk_widget_destroy (msg_box->mbox);
g_free (msg_box);
}
/* DnD functions */
static void
toolbox_set_drag_dest (GtkWidget *object)

View File

@ -20,85 +20,30 @@
#include "toolsF.h"
#include "gdisplayF.h"
#include "libgimp/gimpunit.h"
/* typedefs */
typedef void (*QueryFunc) (GtkWidget *, gpointer, gpointer);
/* externed variables */
extern GtkWidget * tool_widgets[];
extern GtkTooltips * tool_tips;
/* function declarations */
GtkWidget * create_pixmap_widget (GdkWindow *parent,
gchar **data,
gint width,
gint height);
GtkWidget * create_pixmap_widget (GdkWindow *parent,
gchar **data,
gint width,
gint height);
GdkPixmap * create_tool_pixmap (GtkWidget *parent,
ToolType type);
GdkPixmap * create_tool_pixmap (GtkWidget *parent,
ToolType type);
void create_toolbox (void);
void toolbox_free (void);
void toolbox_raise_callback (GtkWidget *widget,
gpointer client_data);
void toolbox_raise_callback (GtkWidget *widget,
gpointer client_data);
void create_display_shell (GDisplay *gdisp,
gint width,
gint height,
gchar *title,
gint type);
/* some simple query dialogs
* if object != NULL then the query boxes will connect their cancel callback
* to the provided signal of this object
*
* it's the caller's job to show the returned widgets
*/
GtkWidget * query_string_box (gchar *title,
gchar *message,
gchar *initial,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_int_box (gchar *title,
char *message,
gint initial,
gint lower,
gint upper,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_double_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_size_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data);
/* a simple message box */
GtkWidget * message_box (gchar *message,
GtkCallback callback,
gpointer data);
void create_display_shell (GDisplay *gdisp,
gint width,
gint height,
gchar *title,
gint type);
#endif /* __INTERFACE_H__ */

View File

@ -15,12 +15,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "actionarea.h"
#include "gdisplay.h"
#include "gdisplay_color.h"
#include "gdisplay_color_ui.h"
#include "gimpimageP.h"
#include "gimpui.h"
#include "libgimp/parasite.h"
#include "libgimp/gimpintl.h"
#include <gtk/gtk.h>
@ -48,7 +47,6 @@ struct _ButtonInfo
static void color_display_ok_callback (GtkWidget *, gpointer);
static void color_display_cancel_callback (GtkWidget *, gpointer);
static gint color_display_delete_callback (GtkWidget *, gpointer);
static gint color_display_destroy_callback (GtkWidget *, gpointer);
static void color_display_add_callback (GtkWidget *, gpointer);
static void color_display_remove_callback (GtkWidget *, gpointer);
@ -68,12 +66,6 @@ make_dialog (void)
char *titles[2];
int i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), color_display_ok_callback, NULL, NULL },
{ N_("Cancel"), color_display_cancel_callback, NULL, NULL }
};
static ButtonInfo buttons[] =
{
{ N_("Add"), color_display_add_callback },
@ -83,13 +75,18 @@ make_dialog (void)
{ N_("Configure"), color_display_configure_callback }
};
cdd.shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cdd.shell), "display_color", "Gimp");
gtk_window_set_title (GTK_WINDOW (cdd.shell), _("Color Display Filters"));
cdd.shell = gimp_dialog_new (_("Color Display Filters"), "display_color",
gimp_standard_help_func,
"dialogs/color_diaplsy_filters_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
gtk_signal_connect (GTK_OBJECT (cdd.shell), "delete_event",
GTK_SIGNAL_FUNC (color_display_delete_callback),
NULL);
_("OK"), color_display_ok_callback,
NULL, NULL, TRUE, FALSE,
_("Cancel"), color_display_cancel_callback,
NULL, NULL, FALSE, TRUE,
NULL);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd.shell)->vbox), hbox,
@ -139,10 +136,6 @@ make_dialog (void)
}
gtk_widget_show_all (hbox);
action_items[0].user_data = cdd.shell;
action_items[1].user_data = cdd.shell;
build_action_area (GTK_DIALOG (cdd.shell), action_items, 2, 0);
}
static void
@ -159,14 +152,6 @@ color_display_cancel_callback (GtkWidget *widget,
gtk_widget_hide (GTK_WIDGET (data));
}
static gint
color_display_delete_callback (GtkWidget *widget,
gpointer data)
{
color_display_cancel_callback (widget, data);
return TRUE;
}
static gint
color_display_destroy_callback (GtkWidget *widget,
gpointer data)

View File

@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
@ -23,6 +22,7 @@
#include "gdisplay_color.h"
#include "gdisplay.h"
#include "gimpimageP.h"
#include "gimpui.h"
#include "libgimp/parasite.h"
#include "libgimp/gimpintl.h"
@ -75,9 +75,6 @@ static void gamma_configure_ok_callback (GtkWidget *widget,
gpointer data);
static void gamma_configure_cancel_callback (GtkWidget *widget,
gpointer data);
static gint gamma_configure_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void gamma_configure (gpointer cd_ID);
void
@ -400,15 +397,6 @@ gamma_configure_cancel_callback (GtkWidget *widget,
gtk_widget_hide (widget);
}
static gint
gamma_configure_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
gamma_configure_cancel_callback (widget, data);
return TRUE;
}
static void
gamma_configure (gpointer cd_ID)
{
@ -417,19 +405,23 @@ gamma_configure (gpointer cd_ID)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *entry;
GtkWidget *hbbox;
GtkWidget *button;
GtkObject *adjustment;
if (!context->shell)
{
context->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (context->shell), "gamma", "Gimp");
gtk_window_set_title (GTK_WINDOW (context->shell), _("Gamma"));
context->shell =
gimp_dialog_new (_("Gamma"), "gamma",
gimp_standard_help_func,
"dialogs/gamma_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
gtk_signal_connect (GTK_OBJECT (context->shell), "delete_event",
GTK_SIGNAL_FUNC (gamma_configure_delete_callback),
NULL);
_("OK"), gamma_configure_ok_callback,
cd_ID, NULL, FALSE, FALSE,
_("Cancel"), gamma_configure_cancel_callback,
cd_ID, NULL, TRUE, TRUE,
NULL);
hbox = gtk_hbox_new (TRUE, 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (context->shell)->vbox),
@ -446,27 +438,6 @@ gamma_configure (gpointer cd_ID)
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
gtk_widget_show_all (hbox);
hbbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (context->shell)->action_area),
hbbox, FALSE, FALSE, 0);
button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gamma_configure_ok_callback),
cd_ID);
button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gamma_configure_cancel_callback),
cd_ID);
gtk_widget_show_all (hbbox);
}
gtk_widget_show (context->shell);

View File

@ -24,7 +24,6 @@
#include <string.h>
#include "libgimp/gimpintl.h"
#include "actionarea.h"
#include "appenv.h"
#include "channel.h"
#include "color_panel.h"
@ -33,6 +32,7 @@
#include "gimpcontext.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"
@ -60,23 +60,8 @@ static void edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data);
static void qmask_query_scale_update (GtkAdjustment *adjustment,
gdouble *scale_val);
static gint qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data);
/* Actual code */
static gint
qmask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
edit_qmask_query_cancel_callback (widget, client_data);
return TRUE;
}
static void
qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
{
@ -86,40 +71,39 @@ qmask_query_scale_update (GtkAdjustment *adjustment, gdouble *scale_val)
void
qmask_buttons_update (GDisplay *gdisp)
{
g_assert(gdisp);
g_assert(gdisp);
g_assert(gdisp->gimage);
g_assert(gdisp->gimage);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
if (gdisp->gimage->qmask_state != GTK_TOGGLE_BUTTON(gdisp->qmaskon)->active)
{
/* Disable toggle from doing anything */
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_block_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
/* Change the state of the buttons */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskon),
gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gdisp->qmaskoff),
!gdisp->gimage->qmask_state);
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
/* Enable toggle again */
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskoff),
(GtkSignalFunc) qmask_deactivate,
gdisp);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(gdisp->qmaskon),
(GtkSignalFunc) qmask_activate,
gdisp);
/* Flush event queue */
/* while (g_main_iteration(FALSE)); */
}
}
void
qmask_click_handler (GtkWidget *widget,
GdkEventButton *event,
@ -135,104 +119,103 @@ qmask_click_handler (GtkWidget *widget,
}
}
void
qmask_deactivate(GtkWidget *w,
GDisplay *gdisp)
qmask_deactivate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpImage *gimg;
GimpChannel *gmask;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (!gdisp->gimage->qmask_state) {
return; /* if already set do nothing */
}
}
undo_push_group_start (gimg, QMASK_UNDO);
undo_push_group_start (gimg, QMASK_UNDO);
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) )
{
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
gimage_mask_load (gimg, gmask);
gimage_remove_channel(gimg, gmask);
undo_push_qmask(gimg,1);
gdisp->gimage->qmask_state = 0;
gdisplays_flush ();
}
else
else
gdisp->gimage->qmask_state = 0;
undo_push_group_end (gimg);
}
undo_push_group_end (gimg);
}
}
void
qmask_activate(GtkWidget *w,
GDisplay *gdisp)
qmask_activate (GtkWidget *w,
GDisplay *gdisp)
{
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
GimpImage *gimg;
GimpChannel *gmask;
GimpLayer *layer;
double opacity;
unsigned char *color;
double opacity;
unsigned char *color;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp)
{
gimg = gdisp->gimage;
if (!gimg) return;
if (gdisp->gimage->qmask_state) {
if (gdisp->gimage->qmask_state) {
return; /* If already set, do nothing */
}
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
/* Set the defaults */
opacity = (double) gimg->qmask_opacity;
color = gimg->qmask_color;
if ( (gmask = gimp_image_get_channel_by_name (gimg, "Qmask")) ) {
gimg->qmask_state = 1; /* if the user was clever and created his own */
return;
}
undo_push_group_start (gimg, QMASK_UNDO);
if (gimage_mask_is_empty(gimg))
{
if ((layer = gimage_floating_sel (gimg)))
{
floating_sel_to_layer (layer);
}
/* if no selection */
gmask = channel_new(gimg,
gimg->width,
gimg->height,
"Qmask",
(int)(255*opacity)/100,
color);
gimp_image_add_channel (gimg, gmask, 0);
gimp_drawable_fill (GIMP_DRAWABLE(gmask), 0, 0, 0, 0);
/* edit_clear(gimg,GIMP_DRAWABLE(gmask)); */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
else
{ /* if selection */
gmask = channel_copy (gimage_get_mask (gimg));
gimp_image_add_channel (gimg, gmask, 0);
channel_set_color(gmask, color);
channel_set_name(gmask, "Qmask");
channel_set_opacity(gmask, opacity);
gimage_mask_none (gimg); /* Clear the selection */
undo_push_qmask(gimg,0);
gdisp->gimage->qmask_state = 1;
gdisplays_flush();
}
undo_push_group_end(gimg);
}
}
static void
@ -249,12 +232,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
gint i;
guchar channel_color[3] = { 0, 0, 0 };
static ActionAreaItem action_items[] =
{
{ N_("OK"), edit_qmask_query_ok_callback, NULL, NULL },
{ N_("Cancel"), edit_qmask_query_cancel_callback, NULL, NULL }
};
/* channel = gimp_image_get_channel_by_name (gdisp->gimage, "Qmask"); */
/* the new options structure */
options = g_new (EditQmaskOptions, 1);
@ -267,24 +244,25 @@ edit_qmask_channel_query (GDisplay * gdisp)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"edit_qmask_atributes", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("Edit Qmask Attributes"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (qmask_query_delete_callback),
options);
_("OK"), edit_qmask_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), edit_qmask_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
/* The vbox */
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
@ -316,10 +294,6 @@ edit_qmask_channel_query (GDisplay * gdisp)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
@ -327,7 +301,7 @@ edit_qmask_channel_query (GDisplay * gdisp)
}
static void edit_qmask_query_ok_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
EditQmaskOptions *options;
Channel *channel;
@ -338,8 +312,8 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
gint i;
options = (EditQmaskOptions *) client_data;
channel = gimp_image_get_channel_by_name(options->gimage, "Qmask");
opacity = (int) (255* options->opacity/100);
channel = gimp_image_get_channel_by_name (options->gimage, "Qmask");
opacity = (int) (255 * options->opacity/100);
if (options->gimage && channel)
{ /* don't update if opacity hasn't changed */
@ -377,7 +351,9 @@ static void edit_qmask_query_ok_callback (GtkWidget *widget,
g_free (options);
}
static void edit_qmask_query_cancel_callback (GtkWidget *widget, gpointer client_data)
static void
edit_qmask_query_cancel_callback (GtkWidget *widget,
gpointer client_data)
{
EditQmaskOptions *options;

View File

@ -20,7 +20,6 @@
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "app_procs.h"
#include "colormaps.h"
#include "color_area.h"
@ -34,7 +33,9 @@
#include "gdisplay_ops.h"
#include "gimage.h"
#include "gimpdnd.h"
#include "gimphelp.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gtkhwrapbox.h"
#include "gtkvwrapbox.h"
#include "indicator_area.h"
@ -50,7 +51,6 @@
#include "pixmaps/qmasknosel.xpm"
#include "pixmaps/navbutton.xpm"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
/* local functions */
@ -305,9 +305,10 @@ create_color_area (GtkWidget *parent)
col_area = color_area_create (54, 42, default_pixmap, swap_pixmap);
gtk_container_add (GTK_CONTAINER (alignment), col_area);
gtk_tooltips_set_tip (tool_tips, col_area, _("Foreground & background colors. The black "
"and white squares reset colors. The arrows swap colors. Double "
"click to select a color from a colorrequester."),
gtk_tooltips_set_tip (tool_tips, col_area,
_("Foreground & background colors. The black "
"and white squares reset colors. The arrows swap colors. Double "
"click to select a color from a colorrequester."),
NULL);
gtk_widget_show (col_area);
gtk_widget_show (alignment);
@ -524,7 +525,7 @@ create_toolbox (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* Register dialog */
dialog_register_toolbox(window);
dialog_register_toolbox (window);
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
@ -587,6 +588,11 @@ create_toolbox (void)
/* Install the accelerator table in the main window */
gtk_window_add_accel_group (GTK_WINDOW (window), table);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (window,
gimp_standard_help_func,
"dialogs/toolbox.html");
wbox = gtk_vwrap_box_new (FALSE);
gtk_wrap_box_set_justify (GTK_WRAP_BOX (wbox), GTK_JUSTIFY_FILL);
gtk_container_set_border_width (GTK_CONTAINER (wbox), 0);
@ -626,7 +632,7 @@ void
toolbox_raise_callback (GtkWidget *widget,
gpointer client_data)
{
gdk_window_raise(toolbox_shell->window);
gdk_window_raise (toolbox_shell->window);
}
void
@ -873,7 +879,7 @@ create_display_shell (GDisplay* gdisp,
gtk_table_attach (GTK_TABLE (table), table_inner, 0, 1, 0, 1,
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);
/* sneak in an extra table here */
/* sneak in an extra table here */
gtk_table_attach (GTK_TABLE (table_lower), evbox, 3, 4, 0, 1,
GTK_SHRINK, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
@ -939,12 +945,17 @@ create_display_shell (GDisplay* gdisp,
gtk_box_pack_start (GTK_BOX (gdisp->statusarea), gdisp->cancelbutton, FALSE, TRUE, 0);
gtk_widget_set_sensitive (gdisp->cancelbutton, FALSE);
/* the popup menu */
/* the popup menu */
gdisp->popup = image_popup_menu;
/* the accelerator table for images */
/* The accelerator table for images */
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell), image_accel_group);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (gdisp->shell,
gimp_standard_help_func,
"dialogs/image_window.html");
gtk_widget_show (arrow);
gtk_widget_show (gdisp->qmaskon);
gtk_widget_show (gdisp->qmaskoff);
@ -981,492 +992,12 @@ create_display_shell (GDisplay* gdisp,
#warning DODGY?
#endif /*__GNUC__ */
gtk_widget_realize (gdisp->canvas);
gdk_window_set_back_pixmap(gdisp->canvas->window, NULL, 0);
gdk_window_set_back_pixmap (gdisp->canvas->window, NULL, 0);
/* set the focus to the canvas area */
gtk_widget_grab_focus (gdisp->canvas);
}
/*
* String, integer, double and size query boxes
*/
typedef struct _QueryBox QueryBox;
struct _QueryBox
{
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *entry;
GtkWidget *ok_button;
GtkObject *object;
QueryFunc callback;
gpointer data;
};
static QueryBox * create_query_box (gchar *, gchar *, GtkObject *, gchar *,
QueryFunc, gpointer);
static gint query_box_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void query_box_cancel_callback (GtkWidget *, gpointer);
static void string_query_box_ok_callback (GtkWidget *, gpointer);
static void int_query_box_ok_callback (GtkWidget *, gpointer);
static void double_query_box_ok_callback (GtkWidget *, gpointer);
static void size_query_box_ok_callback (GtkWidget *, gpointer);
/* create a generic query box without any entry widget */
static QueryBox *
create_query_box (gchar *title,
gchar *message,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *label;
static ActionAreaItem action_items[] =
{
{ N_("OK"), (ActionCallback) NULL, NULL, NULL },
{ N_("Cancel"), (ActionCallback) query_box_cancel_callback, NULL, NULL }
};
query_box = (QueryBox *) g_malloc (sizeof (QueryBox));
qbox = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (qbox), title);
gtk_window_set_wmclass (GTK_WINDOW (qbox), "query_box", "Gimp");
gtk_window_position (GTK_WINDOW (qbox), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (qbox), "delete_event",
(GtkSignalFunc) query_box_delete_callback,
query_box);
/* if we are associated with an object, connect to the provided signal */
if (object && GTK_IS_OBJECT (object) && signal)
gtk_signal_connect (GTK_OBJECT (object), signal,
(GtkSignalFunc) query_box_cancel_callback,
query_box);
else
object = NULL;
/* The action area */
action_items[1].user_data = query_box;
build_action_area (GTK_DIALOG (qbox), action_items, 2, 0);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (qbox)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (message);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
query_box->qbox = qbox;
query_box->vbox = vbox;
query_box->entry = NULL;
query_box->ok_button = action_items[0].widget;
query_box->object = object;
query_box->callback = callback;
query_box->data = data;
return query_box;
}
GtkWidget *
query_string_box (gchar *title,
gchar *message,
gchar *initial,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *entry;
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) string_query_box_ok_callback,
query_box);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, FALSE, FALSE, 0);
if (initial)
gtk_entry_set_text (GTK_ENTRY (entry), initial);
gtk_widget_grab_focus (entry);
gtk_widget_show (entry);
query_box->entry = entry;
return query_box->qbox;
}
GtkWidget *
query_int_box (gchar *title,
gchar *message,
gint initial,
gint lower,
gint upper,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
GtkWidget *spinbutton;
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) int_query_box_ok_callback,
query_box);
adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
spinbutton = gtk_spin_button_new (adjustment, 1.0, 0);
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_grab_focus (spinbutton);
gtk_widget_show (spinbutton);
query_box->entry = spinbutton;
return query_box->qbox;
}
GtkWidget *
query_double_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
GtkWidget *spinbutton;
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) double_query_box_ok_callback,
query_box);
adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
spinbutton = gtk_spin_button_new (adjustment, 1.0, digits);
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_grab_focus (spinbutton);
gtk_widget_show (spinbutton);
query_box->entry = spinbutton;
return query_box->qbox;
}
GtkWidget *
query_size_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *sizeentry;
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) size_query_box_ok_callback,
query_box);
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE);
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
lower, upper);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, FALSE, FALSE, 0);
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
gtk_widget_show (sizeentry);
query_box->entry = sizeentry;
return query_box->qbox;
}
static gint
query_box_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
query_box_cancel_callback (widget, client_data);
return TRUE;
}
static void
query_box_cancel_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
query_box = (QueryBox *) client_data;
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
string_query_box_ok_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
gchar *string;
query_box = (QueryBox *) client_data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the entry data */
string = g_strdup (gtk_entry_get_text (GTK_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data, (gpointer) string);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
int_query_box_ok_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
gint *integer_value;
query_box = (QueryBox *) client_data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
integer_value = g_malloc (sizeof (gint));
*integer_value =
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) integer_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
double_query_box_ok_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
gdouble *double_value;
query_box = (QueryBox *) client_data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
double_value = g_malloc (sizeof (gdouble));
*double_value =
gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
size_query_box_ok_callback (GtkWidget *widget,
gpointer client_data)
{
QueryBox *query_box;
gdouble *double_value;
query_box = (QueryBox *) client_data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the sizeentry data */
double_value = g_malloc (sizeof (gdouble));
*double_value =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (query_box->entry), 0);
/* Pass the selected unit to the callback */
gtk_object_set_data
(GTK_OBJECT (widget), "size_query_unit",
(gpointer) gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
/*
* Message Boxes...
*/
typedef struct _MessageBox MessageBox;
struct _MessageBox
{
GtkWidget *mbox;
GtkCallback callback;
gpointer data;
};
static void message_box_close_callback (GtkWidget *, gpointer);
static gint message_box_delete_callback (GtkWidget *, GdkEvent *, gpointer);
GtkWidget *
message_box (gchar *message,
GtkCallback callback,
gpointer data)
{
MessageBox *msg_box;
GtkWidget *mbox;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *button;
if (! message)
return NULL;
msg_box = (MessageBox *) g_malloc (sizeof (MessageBox));
mbox = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (mbox), "gimp_message", "Gimp");
gtk_window_set_title (GTK_WINDOW (mbox), _("GIMP Message"));
gtk_window_position (GTK_WINDOW (mbox), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (mbox)->action_area), 2);
gtk_signal_connect (GTK_OBJECT (mbox), "delete_event",
GTK_SIGNAL_FUNC (message_box_delete_callback),
msg_box);
button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) message_box_close_callback,
msg_box);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mbox)->action_area), button,
TRUE, TRUE, 0);
gtk_widget_grab_default (button);
gtk_widget_show (button);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (mbox)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (message);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
gtk_widget_show (label);
msg_box->mbox = mbox;
msg_box->callback = callback;
msg_box->data = data;
gtk_widget_show (mbox);
return mbox;
}
static gint
message_box_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
message_box_close_callback (widget, client_data);
return TRUE;
}
static void
message_box_close_callback (GtkWidget *widget,
gpointer client_data)
{
MessageBox *msg_box;
msg_box = (MessageBox *) client_data;
/* If there is a valid callback, invoke it */
if (msg_box->callback)
(* msg_box->callback) (widget, msg_box->data);
/* Destroy the box */
gtk_widget_destroy (msg_box->mbox);
g_free (msg_box);
}
/* DnD functions */
static void
toolbox_set_drag_dest (GtkWidget *object)

View File

@ -20,85 +20,30 @@
#include "toolsF.h"
#include "gdisplayF.h"
#include "libgimp/gimpunit.h"
/* typedefs */
typedef void (*QueryFunc) (GtkWidget *, gpointer, gpointer);
/* externed variables */
extern GtkWidget * tool_widgets[];
extern GtkTooltips * tool_tips;
/* function declarations */
GtkWidget * create_pixmap_widget (GdkWindow *parent,
gchar **data,
gint width,
gint height);
GtkWidget * create_pixmap_widget (GdkWindow *parent,
gchar **data,
gint width,
gint height);
GdkPixmap * create_tool_pixmap (GtkWidget *parent,
ToolType type);
GdkPixmap * create_tool_pixmap (GtkWidget *parent,
ToolType type);
void create_toolbox (void);
void toolbox_free (void);
void toolbox_raise_callback (GtkWidget *widget,
gpointer client_data);
void toolbox_raise_callback (GtkWidget *widget,
gpointer client_data);
void create_display_shell (GDisplay *gdisp,
gint width,
gint height,
gchar *title,
gint type);
/* some simple query dialogs
* if object != NULL then the query boxes will connect their cancel callback
* to the provided signal of this object
*
* it's the caller's job to show the returned widgets
*/
GtkWidget * query_string_box (gchar *title,
gchar *message,
gchar *initial,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_int_box (gchar *title,
char *message,
gint initial,
gint lower,
gint upper,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_double_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_size_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data);
/* a simple message box */
GtkWidget * message_box (gchar *message,
GtkCallback callback,
gpointer data);
void create_display_shell (GDisplay *gdisp,
gint width,
gint height,
gchar *title,
gint type);
#endif /* __INTERFACE_H__ */

View File

@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
@ -29,6 +28,7 @@
#include "info_window.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "gimphelp.h"
#include "gximage.h"
#include "interface.h"
#include "scroll.h"
@ -1144,19 +1144,21 @@ nav_window_create (void *gdisp_ptr)
/* create the info dialog */
title_buf = g_strdup_printf (_("%s: Window Navigation"), title);
info_win = info_dialog_new (title_buf);
dialog_register(info_win->shell);
info_win = info_dialog_new (title_buf,
gimp_standard_help_func,
"dialogs/navigation_window.html");
dialog_register (info_win->shell);
gtk_signal_connect (GTK_OBJECT (info_win->shell), "destroy",
(GtkSignalFunc) nav_window_destroy_callback,
info_win);
g_free (title_buf);
iwd = create_dummy_iwd(gdisp_ptr,NAV_WINDOW);
iwd = create_dummy_iwd (gdisp_ptr, NAV_WINDOW);
info_win->user_data = iwd;
iwd->info_win = info_win;
/* Add preview */
container = info_window_image_preview_new(info_win);
container = info_window_image_preview_new (info_win);
gtk_table_attach_defaults (GTK_TABLE (info_win->info_table), container,
0, 2, 0, 1);
/* Create the action area */

View File

@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
@ -29,6 +28,7 @@
#include "info_window.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "gimphelp.h"
#include "gximage.h"
#include "interface.h"
#include "scroll.h"
@ -1144,19 +1144,21 @@ nav_window_create (void *gdisp_ptr)
/* create the info dialog */
title_buf = g_strdup_printf (_("%s: Window Navigation"), title);
info_win = info_dialog_new (title_buf);
dialog_register(info_win->shell);
info_win = info_dialog_new (title_buf,
gimp_standard_help_func,
"dialogs/navigation_window.html");
dialog_register (info_win->shell);
gtk_signal_connect (GTK_OBJECT (info_win->shell), "destroy",
(GtkSignalFunc) nav_window_destroy_callback,
info_win);
g_free (title_buf);
iwd = create_dummy_iwd(gdisp_ptr,NAV_WINDOW);
iwd = create_dummy_iwd (gdisp_ptr, NAV_WINDOW);
info_win->user_data = iwd;
iwd->info_win = info_win;
/* Add preview */
container = info_window_image_preview_new(info_win);
container = info_window_image_preview_new (info_win);
gtk_table_attach_defaults (GTK_TABLE (info_win->info_table), container,
0, 2, 0, 1);
/* Create the action area */

View File

@ -15,13 +15,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "appenv.h"
#include "gdisplay.h"
#include "libgimp/gimpintl.h"
#include "gimpprogress.h"
#include "gimpui.h"
struct gimp_progress_pvt {
GDisplay *gdisp; /* gdisp in use, or NULL*/
@ -63,14 +61,17 @@ static void progress_signal_setup (gimp_progress *, GtkSignalFunc, gpointer);
* shown to the user if it would mean creating a new window.
*/
gimp_progress *
progress_start (GDisplay *gdisp, const char *message, gboolean important,
GtkSignalFunc cancel_callback, gpointer cancel_data)
progress_start (GDisplay *gdisp,
const char *message,
gboolean important,
GtkSignalFunc cancel_callback,
gpointer cancel_data)
{
gimp_progress *p;
guint cid;
GtkWidget *vbox;
p = g_malloc (sizeof (*p));
p = g_new (gimp_progress, 1);
p->gdisp = gdisp;
p->dialog = NULL;
@ -105,23 +106,22 @@ progress_start (GDisplay *gdisp, const char *message, gboolean important,
}
p->gdisp = NULL;
p->dialog = gtk_dialog_new ();
p->dialog = gimp_dialog_new (_("Progress"), "plug_in_progress",
NULL, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* not strictly true anymore, but needed in case anyone's window
* manager knows about WMCLASS "plug_in_progress" */
gtk_window_set_wmclass (GTK_WINDOW (p->dialog),
"plug_in_progress", "Gimp");
_("Cancel"), NULL,
NULL, &p->cancelbutton, TRUE, TRUE,
gtk_window_set_title (GTK_WINDOW (p->dialog), _("Progress"));
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (p->dialog)->action_area), 2);
NULL);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (p->dialog)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (p->dialog)->vbox), vbox);
gtk_widget_show (vbox);
p->dialog_label = gtk_label_new (message? message :
p->dialog_label = gtk_label_new (message ? message :
DEFAULT_PROGRESS_MESSAGE);
gtk_misc_set_alignment (GTK_MISC (p->dialog_label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), p->dialog_label, FALSE, TRUE, 0);
@ -132,13 +132,6 @@ progress_start (GDisplay *gdisp, const char *message, gboolean important,
gtk_box_pack_start (GTK_BOX (vbox), p->progressbar, TRUE, TRUE, 0);
gtk_widget_show (p->progressbar);
p->cancelbutton = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (p->cancelbutton, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (p->dialog)->action_area),
p->cancelbutton, TRUE, TRUE, 0);
gtk_widget_grab_default (p->cancelbutton);
gtk_widget_show (p->cancelbutton);
gtk_widget_show (p->dialog);
}
@ -151,8 +144,10 @@ progress_start (GDisplay *gdisp, const char *message, gboolean important,
/* Update the message and/or the callbacks for a progress and reset
* the bar to zero, with the minimum of disturbance to the user. */
gimp_progress *
progress_restart (gimp_progress *p, const char *message,
GtkSignalFunc cancel_callback, gpointer cancel_data)
progress_restart (gimp_progress *p,
const char *message,
GtkSignalFunc cancel_callback,
gpointer cancel_data)
{
int cid;
GtkWidget *bar;
@ -174,7 +169,7 @@ progress_restart (gimp_progress *p, const char *message,
else
{
gtk_label_set_text (GTK_LABEL (p->dialog_label),
message? message : DEFAULT_PROGRESS_MESSAGE);
message ? message : DEFAULT_PROGRESS_MESSAGE);
bar = p->progressbar;
}
@ -189,7 +184,8 @@ progress_restart (gimp_progress *p, const char *message,
void
progress_update (gimp_progress *progress, float percentage)
progress_update (gimp_progress *progress,
float percentage)
{
GtkWidget *bar;
@ -210,7 +206,10 @@ progress_update (gimp_progress *progress, float percentage)
/* This function's prototype is conveniently the same as progress_func_t */
void
progress_update_and_flush (int ymin, int ymax, int curr_y, gpointer data)
progress_update_and_flush (int ymin,
int ymax,
int curr_y,
gpointer data)
{
progress_update ((gimp_progress *)data,
(float)(curr_y - ymin) / (float)(ymax - ymin));
@ -275,12 +274,11 @@ progress_end (gimp_progress *p)
}
/* Helper function to add or remove signals */
static void
progress_signal_setup (gimp_progress *p,
GtkSignalFunc cancel_callback,
gpointer cancel_data)
GtkSignalFunc cancel_callback,
gpointer cancel_data)
{
GtkWidget *button;
GtkWidget *dialog;
@ -322,11 +320,10 @@ progress_signal_setup (gimp_progress *p,
}
gtk_widget_set_sensitive (GTK_WIDGET (button),
cancel_callback? TRUE : FALSE);
cancel_callback ? TRUE : FALSE);
p->cancel_callback = cancel_callback;
p->cancel_data = cancel_data;
}
/* End of gimpprogress.c */

View File

@ -18,7 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib.h>
@ -47,12 +46,11 @@
#endif
#endif
#include "actionarea.h"
#include <gtk/gtk.h>
#include "appenv.h"
#include "commands.h"
#include "gimpui.h"
#include "session.h"
#include "dialog_handler.h"
@ -83,16 +81,6 @@ error_console_clear_callback (GtkWidget *widget,
(GTK_EDITABLE (text), 0, gtk_text_get_length (GTK_TEXT (text)));
}
static gint
error_console_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
error_console_close_callback (NULL, NULL);
return TRUE;
}
void
error_console_free (void)
{
@ -104,13 +92,13 @@ gint
error_console_write_file (gchar *path,
gint textscope)
{
gint fd;
gint text_length;
gint bytes_written;
gint fd;
gint text_length;
gint bytes_written;
gchar *text_contents;
GtkText *gtext;
gtext = GTK_TEXT(text);
GtkText *gtext;
gtext = GTK_TEXT (text);
fd = open (path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
@ -165,9 +153,9 @@ static void
error_console_file_ok_callback (GtkWidget *widget,
gpointer data)
{
GtkWidget *filesel;
gchar *filename;
gint textscope;
GtkWidget *filesel;
gchar *filename;
gint textscope;
filesel = (GtkWidget *) data;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
@ -179,7 +167,8 @@ error_console_file_ok_callback (GtkWidget *widget,
GString *string;
string = g_string_new ("");
g_string_sprintf (string, _("Error opening file %s: %s"), filename, g_strerror (errno));
g_string_sprintf (string, _("Error opening file %s: %s"),
filename, g_strerror (errno));
g_message (string->str);
g_string_free (string, TRUE);
}
@ -190,9 +179,10 @@ error_console_file_ok_callback (GtkWidget *widget,
static void
error_console_menu_callback (gint textscope)
{
GtkWidget *filesel;
GtkWidget *filesel;
if (!(GTK_TEXT (text)->editable.has_selection) && (textscope == ERRORS_SELECTION))
if (!(GTK_TEXT (text)->editable.has_selection) &&
(textscope == ERRORS_SELECTION))
{
g_message (_("Can't save, nothing selected!"));
return;
@ -213,16 +203,22 @@ error_console_menu_callback (gint textscope)
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filesel)->cancel_button),
"delete_event", (GtkSignalFunc) gtk_widget_destroy,
GTK_OBJECT (filesel));
/* Connect the "F1" help key */
gimp_help_connect_help_accel (filesel,
gimp_standard_help_func,
"dialogs/error_console.html");
gtk_widget_show (filesel);
}
static gint
text_clicked_callback (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
text_clicked_callback (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
{
GtkMenu *menu = (GtkMenu *) data;
GtkText *gtext;
GtkMenu *menu = (GtkMenu *) data;
GtkText *gtext;
gtext = GTK_TEXT (text);
@ -262,35 +258,40 @@ text_clicked_callback (GtkWidget *widget,
return TRUE;
}
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("Clear"), error_console_clear_callback, NULL, NULL },
{ N_("Close"), error_console_close_callback, NULL, NULL }
};
static void
error_console_create_window (void)
{
GtkWidget *table;
GtkWidget *vscrollbar;
GtkWidget *menu;
GtkWidget *menuitem;
GtkWidget *table;
GtkWidget *vscrollbar;
GtkWidget *menu;
GtkWidget *menuitem;
error_console = gtk_dialog_new ();
error_console = gimp_dialog_new (_("GIMP Error Console"), "error_console",
gimp_standard_help_func,
"dialogs/error_console.html",
GTK_WIN_POS_NONE,
TRUE, TRUE, FALSE,
_("Clear"), error_console_clear_callback,
NULL, NULL, FALSE, FALSE,
_("Close"), error_console_close_callback,
text, NULL, TRUE, TRUE,
NULL);
/* register this one only */
dialog_register (error_console);
session_set_window_geometry (error_console, &error_console_session_info,
TRUE);
gtk_window_set_wmclass (GTK_WINDOW (error_console), "error_console", "Gimp");
gtk_window_set_title (GTK_WINDOW (error_console), _("GIMP Error console"));
session_set_window_geometry (error_console, &error_console_session_info, TRUE);
/* The next line should disappear when setting the size works in SM */
gtk_widget_set_usize (error_console, 250, 300);
gtk_window_set_policy (GTK_WINDOW(error_console), TRUE, TRUE, FALSE);
gtk_signal_connect (GTK_OBJECT (error_console), "delete_event",
(GdkEventFunc) error_console_delete_callback, NULL);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (error_console)->vbox), 2);
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (error_console)->vbox), table);
gtk_widget_show (table);
menu = gtk_menu_new ();
@ -308,13 +309,6 @@ error_console_create_window (void)
(gpointer) ERRORS_SELECTION);
gtk_widget_show (menuitem);
table = gtk_table_new (2, 2, FALSE);
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
gtk_container_set_border_width (GTK_CONTAINER (table), 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (error_console)->vbox), table, TRUE, TRUE, 0);
gtk_widget_show (table);
/* The output text widget */
text = gtk_text_new (NULL, NULL);
gtk_text_set_editable (GTK_TEXT (text), FALSE);
@ -334,11 +328,6 @@ error_console_create_window (void)
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (vscrollbar);
/* Action area */
action_items[0].user_data = error_console;
action_items[1].user_data = text;
build_action_area (GTK_DIALOG (error_console), action_items, 2, 0);
gtk_widget_show (error_console);
}

View File

@ -36,9 +36,10 @@
#include <gtk/gtk.h>
#include "appenv.h"
#include "app_procs.h"
#include "interface.h"
#include "errorconsole.h"
#include "errors.h"
#include "gimpui.h"
#include "libgimp/gimpintl.h"
#ifdef NATIVE_WIN32
@ -54,7 +55,7 @@ gimp_message_func (gchar *str)
switch (message_handler)
{
case MESSAGE_BOX:
message_box (str, NULL, NULL);
gimp_message_box (str, NULL, NULL);
break;
case ERROR_CONSOLE:

View File

@ -15,11 +15,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "file_new_dialog.h"
#include "actionarea.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gdisplay.h"
#include "libgimp/gimpchainbutton.h"
@ -27,7 +25,8 @@
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
typedef struct {
typedef struct
{
GtkWidget *dlg;
GtkWidget *confirm_dlg;
@ -50,7 +49,6 @@ static void file_new_confirm_dialog (NewImageInfo *);
static void file_new_ok_callback (GtkWidget *, gpointer);
static void file_new_reset_callback (GtkWidget *, gpointer);
static gint file_new_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void file_new_cancel_callback (GtkWidget *, gpointer);
static void file_new_toggle_callback (GtkWidget *, gpointer);
static void file_new_resolution_callback (GtkWidget *, gpointer);
@ -136,15 +134,6 @@ file_new_reset_callback (GtkWidget *widget,
(GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE);
}
static gint
file_new_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
file_new_cancel_callback (widget, data);
return TRUE;
}
static void
file_new_cancel_callback (GtkWidget *widget,
gpointer data)
@ -185,15 +174,6 @@ file_new_confirm_dialog_cancel_callback (GtkWidget *widget,
gtk_widget_set_sensitive (info->dlg, TRUE);
}
static gint
file_new_confirm_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
file_new_confirm_dialog_cancel_callback (widget, data);
return TRUE;
}
static void
file_new_confirm_dialog (NewImageInfo *info)
{
@ -202,32 +182,21 @@ file_new_confirm_dialog (NewImageInfo *info)
gchar *max_size;
gchar *text;
static ActionAreaItem action_items[] =
{
{ N_("OK"),
(ActionCallback) file_new_confirm_dialog_ok_callback, NULL, NULL },
{ N_("Cancel"),
(ActionCallback) file_new_confirm_dialog_cancel_callback, NULL, NULL }
};
gtk_widget_set_sensitive (info->dlg, FALSE);
info->confirm_dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (info->confirm_dlg),
"confirm_size", "Gimp");
gtk_window_set_title (GTK_WINDOW (info->confirm_dlg), _("Confirm Image Size"));
gtk_window_set_policy (GTK_WINDOW (info->confirm_dlg), FALSE, FALSE, FALSE);
gtk_window_position (GTK_WINDOW (info->confirm_dlg), GTK_WIN_POS_MOUSE);
info->confirm_dlg =
gimp_dialog_new (_("Confirm Image Size"), "confirm_size",
gimp_standard_help_func,
"dialogs/file_new_dialog.html#confirm_size_dialog",
GTK_WIN_POS_MOUSE,
FALSE, FALSE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (info->confirm_dlg), "delete_event",
(GtkSignalFunc) file_new_confirm_dialog_delete_callback,
info);
_("OK"), file_new_confirm_dialog_ok_callback,
info, NULL, TRUE, FALSE,
_("Cancel"), file_new_confirm_dialog_cancel_callback,
info, NULL, FALSE, TRUE,
/* The action area */
action_items[0].user_data = info;
action_items[1].user_data = info;
build_action_area (GTK_DIALOG (info->confirm_dlg), action_items, 2, 0);
NULL);
size = image_new_get_size_string (info->size);
max_size = image_new_get_size_string (max_new_image_size);
@ -326,15 +295,14 @@ file_new_image_size_callback (GtkWidget *widget,
gpointer data)
{
NewImageInfo *info;
gdouble width, height;
gchar *text;
gchar *label;
info = (NewImageInfo*) data;
width = (gdouble) (gint)
info->values->width = (gdouble) (gint)
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (info->size_se), 0) + 0.5);
height = (gdouble) (gint)
info->values->height = (gdouble) (gint)
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (info->size_se), 1) + 0.5);
info->size = image_new_calculate_size (info->values);
@ -391,35 +359,26 @@ ui_new_image_window_create (const GimpImageNewValues *values_orig)
GSList *group;
GList *list;
static ActionAreaItem action_items[] =
{
{ N_("OK"), file_new_ok_callback, NULL, NULL },
{ N_("Reset"), file_new_reset_callback, NULL, NULL },
{ N_("Cancel"), file_new_cancel_callback, NULL, NULL }
};
info = g_new (NewImageInfo, 1);
info->values = values = image_new_values_new (values_orig);
info->confirm_dlg = NULL;
info->size = 0.0;
info->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (info->dlg), "new_image", "Gimp");
gtk_window_set_title (GTK_WINDOW (info->dlg), _("New Image"));
gtk_window_set_position (GTK_WINDOW (info->dlg), GTK_WIN_POS_MOUSE);
gtk_window_set_policy(GTK_WINDOW (info->dlg), FALSE, FALSE, TRUE);
info->dlg = gimp_dialog_new (_("New Image"), "new_image",
gimp_standard_help_func,
"dialogs/file_new_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, FALSE, TRUE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (info->dlg), "delete_event",
GTK_SIGNAL_FUNC (file_new_delete_callback),
info);
_("OK"), file_new_ok_callback,
info, NULL, FALSE, FALSE,
_("Reset"), file_new_reset_callback,
info, NULL, FALSE, FALSE,
_("Cancel"), file_new_cancel_callback,
info, NULL, TRUE, TRUE,
/* The action area */
action_items[0].user_data = info;
action_items[1].user_data = info;
action_items[2].user_data = info;
build_action_area (GTK_DIALOG (info->dlg), action_items, 3, 2);
NULL);
/* vbox holding the rest of the dialog */
top_vbox = gtk_vbox_new (FALSE, 2);

View File

@ -16,7 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#ifdef HAVE_SYS_PARAM_H
@ -42,14 +41,13 @@
#endif
#include "appenv.h"
#include "actionarea.h"
#include "cursorutil.h"
#include "gdisplay.h"
#include "general.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpui.h"
#include "fileops.h"
#include "interface.h"
#include "menus.h"
#include "layer.h"
#include "channel.h"
@ -73,54 +71,42 @@ struct _OverwriteBox
static void file_overwrite (char *filename,
char* raw_filename);
static void file_overwrite_yes_callback (GtkWidget *w,
gpointer client_data);
static void file_overwrite_no_callback (GtkWidget *w,
gpointer client_data);
static gint file_overwrite_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data);
static void file_overwrite_yes_callback (GtkWidget *, gpointer);
static void file_overwrite_no_callback (GtkWidget *, gpointer);
static GimpImage* file_open_image (char *filename,
char *raw_filename,
RunModeType runmode);
static void genbutton_callback (GtkWidget *w,
gpointer client_data);
static void genbutton_callback (GtkWidget *, gpointer);
static void file_open_clistrow_callback (GtkWidget *w,
int client_data);
static void file_open_ok_callback (GtkWidget *w,
gpointer client_data);
static void file_save_ok_callback (GtkWidget *w,
gpointer client_data);
static void file_open_clistrow_callback (GtkWidget *, gint);
static void file_open_ok_callback (GtkWidget *, gpointer);
static void file_save_ok_callback (GtkWidget *, gpointer);
static void file_dialog_show (GtkWidget *filesel);
static int file_dialog_hide (GtkWidget *filesel);
static void file_update_name (PlugInProcDef *proc,
GtkWidget *filesel);
static void file_load_type_callback (GtkWidget *w,
gpointer client_data);
static void file_save_type_callback (GtkWidget *w,
gpointer client_data);
static void file_load_type_callback (GtkWidget *, gpointer);
static void file_save_type_callback (GtkWidget *, gpointer);
static void file_convert_string (char *instr,
char *outmem,
int maxmem,
int *nmem);
int maxmem,
int *nmem);
static int file_check_single_magic (char *offset,
char *type,
char *value,
int headsize,
unsigned char *file_head,
FILE *ifp);
static int file_check_single_magic (char *offset,
char *type,
char *value,
int headsize,
guchar *file_head,
FILE *ifp);
static int file_check_magic_list (GSList *magics_list,
int headsize,
unsigned char *head,
FILE *ifp);
int headsize,
guchar *head,
FILE *ifp);
static void file_update_menus (GSList *procs,
int image_type);
@ -149,20 +135,20 @@ static GimpImage *the_gimage = NULL;
extern GSList *display_list; /* from gdisplay.c */
#define FILE_ERR_MESSAGE(str) G_STMT_START{ \
if (message_handler == MESSAGE_BOX) \
message_box ((str), file_message_box_close_callback, (void *) fs); \
else \
g_message (str); \
#define FILE_ERR_MESSAGE(str) G_STMT_START{ \
if (message_handler == MESSAGE_BOX) \
gimp_message_box ((str), file_message_box_close_callback, (void *) fs); \
else \
g_message (str); \
gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE); }G_STMT_END
static void
file_message_box_close_callback (GtkWidget *w,
gpointer client_data)
file_message_box_close_callback (GtkWidget *widget,
gpointer data)
{
GtkFileSelection *fs;
fs = (GtkFileSelection *) client_data;
fs = (GtkFileSelection *) data;
gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE);
}
@ -212,8 +198,8 @@ file_ops_post_init (void)
}
void
file_open_callback (GtkWidget *w,
gpointer client_data)
file_open_callback (GtkWidget *widget,
gpointer data)
{
GtkWidget *hbox;
GtkWidget *vbox;
@ -244,6 +230,11 @@ file_open_callback (GtkWidget *w,
/* Catch file-clist clicks so we can update the preview thumbnail */
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (fileload)->file_list), "select_row", (GtkSignalFunc) file_open_clistrow_callback, fileload);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (fileload,
gimp_standard_help_func,
"dialogs/file_load_dialog.html");
}
else
{
@ -408,8 +399,8 @@ file_open_callback (GtkWidget *w,
}
void
file_save_callback (GtkWidget *w,
gpointer client_data)
file_save_callback (GtkWidget *widget,
gpointer data)
{
GDisplay *gdisplay;
@ -421,7 +412,7 @@ file_save_callback (GtkWidget *w,
{
if (gdisplay->gimage->has_filename == FALSE)
{
file_save_as_callback (w, client_data);
file_save_as_callback (widget, data);
}
else
{
@ -432,8 +423,8 @@ file_save_callback (GtkWidget *w,
}
void
file_save_as_callback (GtkWidget *w,
gpointer client_data)
file_save_as_callback (GtkWidget *widget,
gpointer data)
{
GtkWidget *hbox;
GtkWidget *label;
@ -466,6 +457,11 @@ file_save_as_callback (GtkWidget *w,
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filesave),
"." G_DIR_SEPARATOR_S);
gtk_window_set_title (GTK_WINDOW (filesave), _("Save Image"));
/* Connect the "F1" help key */
gimp_help_connect_help_accel (filesave,
gimp_standard_help_func,
"dialogs/file_save_dialog.html");
}
gdisplay = gdisplay_active ();
@ -515,12 +511,12 @@ file_save_as_callback (GtkWidget *w,
}
void
file_revert_callback (GtkWidget *w,
gpointer client_data)
file_revert_callback (GtkWidget *widget,
gpointer data)
{
GDisplay *gdisplay;
GimpImage *gimage;
char *filename, *raw_filename;
gchar *filename = NULL, *raw_filename = NULL;
gdisplay = gdisplay_active ();
if (!gdisplay) return;
@ -546,21 +542,22 @@ file_revert_callback (GtkWidget *w,
}
void
file_load_by_extension_callback (GtkWidget *w,
gpointer client_data)
file_load_by_extension_callback (GtkWidget *widget,
gpointer data)
{
load_file_proc = NULL;
}
void
file_save_by_extension_callback (GtkWidget *w,
gpointer client_data)
file_save_by_extension_callback (GtkWidget *widget,
gpointer data)
{
save_file_proc = NULL;
}
static void
file_update_name (PlugInProcDef *proc, GtkWidget *filesel)
file_update_name (PlugInProcDef *proc,
GtkWidget *filesel)
{
if (proc->extensions_list)
{
@ -586,10 +583,10 @@ file_update_name (PlugInProcDef *proc, GtkWidget *filesel)
}
static void
file_load_type_callback (GtkWidget *w,
gpointer client_data)
file_load_type_callback (GtkWidget *widget,
gpointer data)
{
PlugInProcDef* proc = (PlugInProcDef *) client_data;
PlugInProcDef* proc = (PlugInProcDef *) data;
file_update_name (proc, fileload);
@ -597,10 +594,10 @@ file_load_type_callback (GtkWidget *w,
}
static void
file_save_type_callback (GtkWidget *w,
gpointer client_data)
file_save_type_callback (GtkWidget *widget,
gpointer data)
{
PlugInProcDef* proc = (PlugInProcDef *) client_data;
PlugInProcDef* proc = (PlugInProcDef *) data;
file_update_name (proc, filesave);
@ -608,7 +605,9 @@ file_save_type_callback (GtkWidget *w,
}
static GimpImage*
file_open_image (char *filename, char *raw_filename, RunModeType runmode)
file_open_image (char *filename,
char *raw_filename,
RunModeType runmode)
{
PlugInProcDef *file_proc;
ProcRecord *proc;
@ -658,7 +657,8 @@ file_open_image (char *filename, char *raw_filename, RunModeType runmode)
}
int
file_open (char *filename, char *raw_filename)
file_open (char *filename,
char *raw_filename)
{
GimpImage *gimage;
GDisplay *gdisplay;
@ -687,8 +687,7 @@ file_open (char *filename, char *raw_filename)
return FALSE;
}
static TempBuf*
static TempBuf *
make_thumb_tempbuf (GimpImage* gimage)
{
gint w,h;
@ -722,9 +721,10 @@ make_thumb_tempbuf (GimpImage* gimage)
return (gimp_image_composite_preview (gimage, GRAY_CHANNEL, w, h));
}
static guchar*
make_RGBbuf_from_tempbuf (TempBuf* tempbuf, gint* width_rtn, gint* height_rtn)
static guchar *
make_RGBbuf_from_tempbuf (TempBuf *tempbuf,
gint *width_rtn,
gint *height_rtn)
{
int i,j,w,h;
guchar* tbd;
@ -794,9 +794,9 @@ make_RGBbuf_from_tempbuf (TempBuf* tempbuf, gint* width_rtn, gint* height_rtn)
static gboolean
file_save_thumbnail (GimpImage* gimage,
file_save_thumbnail (GimpImage * gimage,
const char *full_source_filename,
TempBuf* tempbuf)
TempBuf *tempbuf)
{
gint i,j;
gint w,h;
@ -944,12 +944,11 @@ file_save_thumbnail (GimpImage* gimage,
return (TRUE);
}
int
file_save (GimpImage* gimage,
char *filename,
char *raw_filename,
gint mode)
file_save (GimpImage *gimage,
char *filename,
char *raw_filename,
gint mode)
{
PlugInProcDef *file_proc;
ProcRecord *proc;
@ -1029,9 +1028,10 @@ file_save (GimpImage* gimage,
/* The readXVThumb function source may be re-used under
the XFree86-style license. <adam@gimp.org> */
static guchar*
readXVThumb(const gchar *fnam,
gint* w, gint* h,
gchar** imginfo /* caller frees if != NULL */)
readXVThumb(const gchar *fnam,
gint *w,
gint *h,
gchar **imginfo /* caller frees if != NULL */)
{
FILE *fp;
const gchar *P7_332 = "P7 332";
@ -1112,10 +1112,12 @@ readXVThumb(const gchar *fnam,
return(buf);
}
/* don't call with preview_fullname as parameter! will be clobbered! */
static void
set_preview (const gchar* fullfname, guchar* RGB_source, gint RGB_w, gint RGB_h)
set_preview (const gchar *fullfname,
guchar *RGB_source,
gint RGB_w,
gint RGB_h)
{
guchar *thumb_rgb;
guchar *raw_thumb;
@ -1255,23 +1257,21 @@ set_preview (const gchar* fullfname, guchar* RGB_source, gint RGB_w, gint RGB_h)
}
}
static void
file_open_clistrow_callback (GtkWidget *w,
int client_data)
file_open_clistrow_callback (GtkWidget *widget,
int data)
{
gchar *fullfname = NULL;
fullfname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileload));
fullfname = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fileload));
gtk_widget_set_sensitive (GTK_WIDGET(open_options_frame), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), TRUE);
set_preview (fullfname, NULL, 0, 0);
}
static void
genbutton_callback (GtkWidget *w,
gpointer client_data)
genbutton_callback (GtkWidget *widget,
gpointer data)
{
GimpImage* gimage_to_be_thumbed;
gchar* filename;
@ -1282,9 +1282,9 @@ genbutton_callback (GtkWidget *w,
return;
}
filename = g_strdup(preview_fullname);
filename = g_strdup (preview_fullname);
gimp_add_busy_cursors();
gimp_add_busy_cursors ();
gtk_widget_set_sensitive (GTK_WIDGET (fileload), FALSE);
if ((gimage_to_be_thumbed = file_open_image (filename,
g_basename(filename),
@ -1322,10 +1322,9 @@ genbutton_callback (GtkWidget *w,
g_free (filename);
}
static void
file_open_ok_callback (GtkWidget *w,
gpointer client_data)
file_open_ok_callback (GtkWidget *widget,
gpointer data)
{
GtkFileSelection *fs;
char* filename, *raw_filename, *mfilename;
@ -1334,7 +1333,7 @@ file_open_ok_callback (GtkWidget *w,
int err;
GString *s;
fs = GTK_FILE_SELECTION (client_data);
fs = GTK_FILE_SELECTION (data);
filename = gtk_file_selection_get_filename (fs);
raw_filename = gtk_entry_get_text (GTK_ENTRY(fs->selection_entry));
@ -1364,7 +1363,7 @@ file_open_ok_callback (GtkWidget *w,
if (file_open (filename, raw_filename))
{
file_dialog_hide (client_data);
file_dialog_hide (data);
gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE);
}
else
@ -1454,7 +1453,7 @@ file_open_ok_callback (GtkWidget *w,
if (file_open (mfilename, temp))
{
file_dialog_hide (client_data);
file_dialog_hide (data);
gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE);
}
else
@ -1490,8 +1489,8 @@ file_open_ok_callback (GtkWidget *w,
}
static void
file_save_ok_callback (GtkWidget *w,
gpointer client_data)
file_save_ok_callback (GtkWidget *widget,
gpointer data)
{
GtkFileSelection *fs;
char* filename, *raw_filename;
@ -1499,7 +1498,7 @@ file_save_ok_callback (GtkWidget *w,
struct stat buf;
int err;
fs = GTK_FILE_SELECTION (client_data);
fs = GTK_FILE_SELECTION (data);
filename = gtk_file_selection_get_filename (fs);
raw_filename = gtk_entry_get_text (GTK_ENTRY(fs->selection_entry));
err = stat (filename, &buf);
@ -1533,7 +1532,7 @@ file_save_ok_callback (GtkWidget *w,
gimage_set_save_proc(the_gimage, save_file_proc);
if (file_save (the_gimage, filename, raw_filename, 0))
{
file_dialog_hide (client_data);
file_dialog_hide (data);
gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE);
return;
}
@ -1577,45 +1576,41 @@ file_dialog_hide (GtkWidget *filesel)
}
static void
file_overwrite (char *filename, char* raw_filename)
file_overwrite (char *filename,
char *raw_filename)
{
static ActionAreaItem obox_action_items[2] =
{
{ N_("Yes"), file_overwrite_yes_callback, NULL, NULL },
{ N_("No"), file_overwrite_no_callback, NULL, NULL }
};
OverwriteBox *overwrite_box;
GtkWidget *vbox;
GtkWidget *label;
char *overwrite_text;
overwrite_box = (OverwriteBox *) g_malloc (sizeof (OverwriteBox));
overwrite_box = g_new (OverwriteBox, 1);
overwrite_text = g_strdup_printf (_("%s exists, overwrite?"), filename);
overwrite_box->full_filename = filename;
overwrite_box->raw_filename = raw_filename;
overwrite_box->obox = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (overwrite_box->obox), "file_exists", "Gimp");
gtk_window_set_title (GTK_WINDOW (overwrite_box->obox), _("File Exists!"));
gtk_window_set_position (GTK_WINDOW (overwrite_box->obox), GTK_WIN_POS_MOUSE);
overwrite_box->obox =
gimp_dialog_new (_("File Exists!"), "file_exists",
gimp_standard_help_func,
"dialogs/file_exists_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gtk_signal_connect (GTK_OBJECT (overwrite_box->obox),
"delete_event",
(GtkSignalFunc) file_overwrite_delete_callback,
overwrite_box);
_("Yes"), file_overwrite_yes_callback,
overwrite_box, NULL, TRUE, FALSE,
_("No"), file_overwrite_no_callback,
overwrite_box, NULL, FALSE, TRUE,
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (overwrite_box->obox)->vbox), vbox, TRUE, TRUE, 0);
NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (overwrite_box->obox)->vbox),
vbox);
label = gtk_label_new (overwrite_text);
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
obox_action_items[0].user_data = overwrite_box;
obox_action_items[1].user_data = overwrite_box;
build_action_area (GTK_DIALOG (overwrite_box->obox), obox_action_items, 2, 0);
gtk_widget_show (label);
gtk_widget_show (vbox);
gtk_widget_show (overwrite_box->obox);
@ -1624,13 +1619,13 @@ file_overwrite (char *filename, char* raw_filename)
}
static void
file_overwrite_yes_callback (GtkWidget *w,
gpointer client_data)
file_overwrite_yes_callback (GtkWidget *widget,
gpointer data)
{
OverwriteBox *overwrite_box;
GImage *gimage;
overwrite_box = (OverwriteBox *) client_data;
overwrite_box = (OverwriteBox *) data;
gtk_widget_destroy (overwrite_box->obox);
@ -1657,23 +1652,13 @@ file_overwrite_yes_callback (GtkWidget *w,
g_free (overwrite_box);
}
static gint
file_overwrite_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
file_overwrite_no_callback (w, client_data);
return TRUE;
}
static void
file_overwrite_no_callback (GtkWidget *w,
gpointer client_data)
file_overwrite_no_callback (GtkWidget *widget,
gpointer data)
{
OverwriteBox *overwrite_box;
overwrite_box = (OverwriteBox *) client_data;
overwrite_box = (OverwriteBox *) data;
gtk_widget_destroy (overwrite_box->obox);
g_free (overwrite_box->full_filename);
@ -2017,6 +2002,7 @@ file_update_menus (GSList *procs,
procs = procs->next;
if (file_proc->db_info.proc_type != PDB_EXTENSION)
menus_set_sensitive (file_proc->menu_path, (file_proc->image_types_val & image_type));
menus_set_sensitive (file_proc->menu_path,
(file_proc->image_types_val & image_type));
}
}

View File

@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
@ -23,6 +22,7 @@
#include "gdisplay_color.h"
#include "gdisplay.h"
#include "gimpimageP.h"
#include "gimpui.h"
#include "libgimp/parasite.h"
#include "libgimp/gimpintl.h"
@ -75,9 +75,6 @@ static void gamma_configure_ok_callback (GtkWidget *widget,
gpointer data);
static void gamma_configure_cancel_callback (GtkWidget *widget,
gpointer data);
static gint gamma_configure_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void gamma_configure (gpointer cd_ID);
void
@ -400,15 +397,6 @@ gamma_configure_cancel_callback (GtkWidget *widget,
gtk_widget_hide (widget);
}
static gint
gamma_configure_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
gamma_configure_cancel_callback (widget, data);
return TRUE;
}
static void
gamma_configure (gpointer cd_ID)
{
@ -417,19 +405,23 @@ gamma_configure (gpointer cd_ID)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *entry;
GtkWidget *hbbox;
GtkWidget *button;
GtkObject *adjustment;
if (!context->shell)
{
context->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (context->shell), "gamma", "Gimp");
gtk_window_set_title (GTK_WINDOW (context->shell), _("Gamma"));
context->shell =
gimp_dialog_new (_("Gamma"), "gamma",
gimp_standard_help_func,
"dialogs/gamma_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
gtk_signal_connect (GTK_OBJECT (context->shell), "delete_event",
GTK_SIGNAL_FUNC (gamma_configure_delete_callback),
NULL);
_("OK"), gamma_configure_ok_callback,
cd_ID, NULL, FALSE, FALSE,
_("Cancel"), gamma_configure_cancel_callback,
cd_ID, NULL, TRUE, TRUE,
NULL);
hbox = gtk_hbox_new (TRUE, 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (context->shell)->vbox),
@ -446,27 +438,6 @@ gamma_configure (gpointer cd_ID)
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
gtk_widget_show_all (hbox);
hbbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (context->shell)->action_area),
hbbox, FALSE, FALSE, 0);
button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gamma_configure_ok_callback),
cd_ID);
button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gamma_configure_cancel_callback),
cd_ID);
gtk_widget_show_all (hbbox);
}
gtk_widget_show (context->shell);

View File

@ -15,12 +15,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "actionarea.h"
#include "gdisplay.h"
#include "gdisplay_color.h"
#include "gdisplay_color_ui.h"
#include "gimpimageP.h"
#include "gimpui.h"
#include "libgimp/parasite.h"
#include "libgimp/gimpintl.h"
#include <gtk/gtk.h>
@ -48,7 +47,6 @@ struct _ButtonInfo
static void color_display_ok_callback (GtkWidget *, gpointer);
static void color_display_cancel_callback (GtkWidget *, gpointer);
static gint color_display_delete_callback (GtkWidget *, gpointer);
static gint color_display_destroy_callback (GtkWidget *, gpointer);
static void color_display_add_callback (GtkWidget *, gpointer);
static void color_display_remove_callback (GtkWidget *, gpointer);
@ -68,12 +66,6 @@ make_dialog (void)
char *titles[2];
int i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), color_display_ok_callback, NULL, NULL },
{ N_("Cancel"), color_display_cancel_callback, NULL, NULL }
};
static ButtonInfo buttons[] =
{
{ N_("Add"), color_display_add_callback },
@ -83,13 +75,18 @@ make_dialog (void)
{ N_("Configure"), color_display_configure_callback }
};
cdd.shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cdd.shell), "display_color", "Gimp");
gtk_window_set_title (GTK_WINDOW (cdd.shell), _("Color Display Filters"));
cdd.shell = gimp_dialog_new (_("Color Display Filters"), "display_color",
gimp_standard_help_func,
"dialogs/color_diaplsy_filters_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
gtk_signal_connect (GTK_OBJECT (cdd.shell), "delete_event",
GTK_SIGNAL_FUNC (color_display_delete_callback),
NULL);
_("OK"), color_display_ok_callback,
NULL, NULL, TRUE, FALSE,
_("Cancel"), color_display_cancel_callback,
NULL, NULL, FALSE, TRUE,
NULL);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd.shell)->vbox), hbox,
@ -139,10 +136,6 @@ make_dialog (void)
}
gtk_widget_show_all (hbox);
action_items[0].user_data = cdd.shell;
action_items[1].user_data = cdd.shell;
build_action_area (GTK_DIALOG (cdd.shell), action_items, 2, 0);
}
static void
@ -159,14 +152,6 @@ color_display_cancel_callback (GtkWidget *widget,
gtk_widget_hide (GTK_WIDGET (data));
}
static gint
color_display_delete_callback (GtkWidget *widget,
gpointer data)
{
color_display_cancel_callback (widget, data);
return TRUE;
}
static gint
color_display_destroy_callback (GtkWidget *widget,
gpointer data)

View File

@ -18,14 +18,13 @@
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "colormaps.h"
#include "cursorutil.h"
#include "fileops.h"
#include "gdisplay_ops.h"
#include "gimage.h"
#include "gimpui.h"
#include "gximage.h"
#include "interface.h"
#include "menus.h"
#include "scale.h"
#include "gimprc.h"
@ -320,16 +319,6 @@ gdisplay_cancel_warning_callback (GtkWidget *widget,
gtk_widget_destroy (mbox);
}
static gint
gdisplay_delete_warning_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
gdisplay_cancel_warning_callback (widget, client_data);
return TRUE;
}
static void
gdisplay_destroy_warning_callback (GtkWidget *widget,
gpointer client_data)
@ -346,12 +335,6 @@ gdisplay_close_warning_dialog (char *image_name,
GtkWidget *label;
gchar *warning_buf;
static ActionAreaItem action_items[] =
{
{ N_("Close"), gdisplay_close_warning_callback, NULL, NULL },
{ N_("Cancel"), gdisplay_cancel_warning_callback, NULL, NULL }
};
/* FIXUP this will raise any prexsisting close dialogs, which can be a
a bit confusing if you tried to close a new window because you had
forgotten the old dialog was still around */
@ -364,16 +347,21 @@ gdisplay_close_warning_dialog (char *image_name,
menus_set_sensitive_glue ("<Image>", N_("/File/Close"), FALSE);
warning_dialog = mbox = gtk_dialog_new ();
/* should this be image_window or the actual image name??? */
gtk_window_set_wmclass (GTK_WINDOW (mbox), "really_close", "Gimp");
gtk_window_set_title (GTK_WINDOW (mbox), image_name);
gtk_window_set_position (GTK_WINDOW (mbox), GTK_WIN_POS_MOUSE);
gtk_object_set_user_data (GTK_OBJECT (mbox), gdisp);
warning_dialog = mbox =
gimp_dialog_new (image_name, "really_close",
gimp_standard_help_func,
"dialogs/really_close_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gtk_signal_connect (GTK_OBJECT (mbox), "delete_event",
GTK_SIGNAL_FUNC (gdisplay_delete_warning_callback),
mbox);
_("Close"), gdisplay_close_warning_callback,
NULL, NULL, FALSE, FALSE,
_("Cancel"), gdisplay_cancel_warning_callback,
NULL, NULL, TRUE, TRUE,
NULL);
gtk_object_set_user_data (GTK_OBJECT (mbox), gdisp);
gtk_signal_connect (GTK_OBJECT (mbox), "destroy",
GTK_SIGNAL_FUNC (gdisplay_destroy_warning_callback),
@ -392,9 +380,5 @@ gdisplay_close_warning_dialog (char *image_name,
gtk_widget_show (label);
g_free (warning_buf);
action_items[0].user_data = mbox;
action_items[1].user_data = mbox;
build_action_area (GTK_DIALOG (mbox), action_items, 2, 1);
gtk_widget_show (mbox);
}

View File

@ -18,12 +18,12 @@
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "actionarea.h"
#include "channel_ops.h"
#include "cursorutil.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "palette.h"
@ -53,7 +53,6 @@ struct _OffsetDialog
/* Forward declarations */
static void offset_ok_callback (GtkWidget *, gpointer);
static void offset_cancel_callback (GtkWidget *, gpointer);
static gint offset_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void offset_wraparound_update (GtkWidget *, gpointer);
static void offset_fill_type_update (GtkWidget *, gpointer);
@ -77,12 +76,6 @@ channel_ops_offset (GimpImage* gimage)
GimpDrawable *drawable;
static ActionAreaItem action_items[] =
{
{ N_("OK"), offset_ok_callback, NULL, NULL },
{ N_("Cancel"), offset_cancel_callback, NULL, NULL }
};
drawable = gimage_active_drawable (gimage);
off_d = g_new (OffsetDialog, 1);
@ -90,15 +83,19 @@ channel_ops_offset (GimpImage* gimage)
off_d->fill_type = drawable_has_alpha (drawable);
off_d->gimage = gimage;
off_d->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (off_d->dlg), "offset", "Gimp");
gtk_window_set_title (GTK_WINDOW (off_d->dlg), _("Offset"));
off_d->dlg = gimp_dialog_new (_("Offset"), "offset",
gimp_standard_help_func,
"dialogs/offset_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (off_d->dlg), "delete_event",
GTK_SIGNAL_FUNC (offset_delete_callback),
off_d);
_("OK"), offset_ok_callback,
off_d, NULL, TRUE, FALSE,
_("Cancel"), offset_cancel_callback,
off_d, NULL, FALSE, TRUE,
NULL);
/* The vbox for first column of options */
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
@ -221,15 +218,10 @@ channel_ops_offset (GimpImage* gimage)
(GtkSignalFunc) offset_halfheight_callback,
off_d);
action_items[0].user_data = off_d;
action_items[1].user_data = off_d;
build_action_area (GTK_DIALOG (off_d->dlg), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (off_d->dlg);
}
void
offset (GimpImage *gimage,
GimpDrawable *drawable,
@ -495,16 +487,6 @@ offset_ok_callback (GtkWidget *widget,
g_free (off_d);
}
static gint
offset_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
offset_cancel_callback (widget, data);
return TRUE;
}
static void
offset_cancel_callback (GtkWidget *widget,
gpointer data)

132
app/gimphelp.c Normal file
View File

@ -0,0 +1,132 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimphelp.c
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "gimphelp.h"
#include "gimprc.h"
#include "plug_in.h"
#include "procedural_db.h"
#include "libgimp/gimpintl.h"
/* The standard help function */
void
gimp_standard_help_func (gpointer help_data)
{
gchar *help_page;
help_page = (gchar *) help_data;
gimp_help (help_page);
}
static void
gimp_help_callback (GtkWidget *widget,
gpointer data)
{
GimpHelpFunc help_function;
gpointer help_data;
help_function = (GimpHelpFunc) data;
help_data = gtk_object_get_data (GTK_OBJECT (widget),
"gimp_help_data");
if (help_function && use_help)
(* help_function) (help_data);
}
void
gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func,
gpointer help_data)
{
GtkAccelGroup *accel_group;
static guint help_signal_id = 0;
/* create the help signal if not already done */
if (! help_signal_id)
{
help_signal_id =
gtk_object_class_user_signal_new (GTK_OBJECT (widget)->klass,
"help",
GTK_RUN_LAST,
gtk_signal_default_marshaller,
GTK_TYPE_NONE,
0,
NULL);
}
if (help_data)
{
gtk_object_set_data (GTK_OBJECT (widget), "gimp_help_data",
help_data);
}
gtk_signal_connect (GTK_OBJECT (widget), "help",
GTK_SIGNAL_FUNC (gimp_help_callback),
(gpointer) help_func);
/* a new accelerator group for this widget */
accel_group = gtk_accel_group_new ();
gtk_accel_group_add (accel_group, GDK_F1, 0, 0,
GTK_OBJECT (widget), "help");
gtk_accel_group_attach (accel_group, GTK_OBJECT (widget));
}
/* the main help function */
void
gimp_help (gchar *help_page)
{
ProcRecord *proc_rec;
Argument *return_vals;
gint nreturn_vals;
/* Check if a help browser is already running */
proc_rec = procedural_db_lookup ("extension_gimp_help_browser_temp");
if (proc_rec == NULL)
{
proc_rec = procedural_db_lookup ("extension_gimp_help_browser");
if (proc_rec == NULL)
{
g_message (_("Could not find the GIMP Help Browser procedure\n"
"Note that you still have to compile this plugin "
"manually"));
return;
}
return_vals =
procedural_db_run_proc ("extension_gimp_help_browser",
&nreturn_vals,
PDB_INT32, RUN_INTERACTIVE,
PDB_STRING, help_page,
PDB_END);
}
else
{
return_vals =
procedural_db_run_proc ("extension_gimp_help_browser_temp",
&nreturn_vals,
PDB_STRING, help_page,
PDB_END);
}
procedural_db_destroy_args (return_vals, nreturn_vals);
}

39
app/gimphelp.h Normal file
View File

@ -0,0 +1,39 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimphelp.h
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_HELP_H__
#define __GIMP_HELP_H__
#include <glib.h>
typedef void (* GimpHelpFunc) (gpointer);
/* the standard help function */
void gimp_standard_help_func (gpointer help_data);
/* connect the "F1" accelerator of a window */
void gimp_help_connect_help_accel (GtkWidget *widget,
GimpHelpFunc help_func,
gpointer help_data);
/* the main help function */
void gimp_help (gchar *help_page);
#endif /* __GIMP_HELP_H__ */

View File

@ -86,17 +86,16 @@
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "convert.h"
#include "cursorutil.h"
#include "drawable.h"
#include "floating_sel.h"
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "undo.h"
#include "palette.h"
#include "preferences_dialog.h" /* ick. */
#include "libgimp/gimpintl.h"
#include "libgimp/gimpmath.h"
@ -393,7 +392,6 @@ typedef struct
static void indexed_ok_callback (GtkWidget *, gpointer);
static void indexed_cancel_callback (GtkWidget *, gpointer);
static gint indexed_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void indexed_num_cols_update (GtkWidget *, gpointer);
static void indexed_radio_update (GtkWidget *, gpointer);
static void frame_sensitivity_update (GtkWidget *, gpointer);
@ -457,13 +455,6 @@ convert_to_grayscale (GimpImage* gimage)
gdisplays_flush ();
}
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("OK"), indexed_ok_callback, NULL, NULL },
{ N_("Cancel"), indexed_cancel_callback, NULL, NULL }
};
void
convert_to_indexed (GimpImage *gimage)
{
@ -478,7 +469,7 @@ convert_to_indexed (GimpImage *gimage)
GSList *group = NULL;
gint maxval;
dialog = g_new(IndexedDialog, 1);
dialog = g_new (IndexedDialog, 1);
dialog->gimage = gimage;
dialog->custom_frame = NULL;
@ -496,21 +487,31 @@ convert_to_indexed (GimpImage *gimage)
dialog->monopal_flag = smonopal_flag;
dialog->reusepal_flag = sreusepal_flag;
dialog->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (dialog->shell), "indexed_color_conversion", "Gimp");
gtk_window_set_title (GTK_WINDOW (dialog->shell), _("Indexed Color Conversion"));
gtk_signal_connect (GTK_OBJECT (dialog->shell), "delete_event",
GTK_SIGNAL_FUNC (indexed_delete_callback),
dialog);
dialog->shell =
gimp_dialog_new (_("Indexed Color Conversion"), "indexed_color_conversion",
gimp_standard_help_func,
"dialogs/indexed_color_conversion_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("OK"), indexed_ok_callback,
dialog, NULL, TRUE, FALSE,
_("Cancel"), indexed_cancel_callback,
dialog, NULL, FALSE, TRUE,
NULL);
frame = gtk_frame_new (_("General Palette Options"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_container_set_border_width (GTK_CONTAINER (frame), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame,
TRUE, TRUE, 0);
gtk_widget_show(frame);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox)), 4);
/* put the vbox in the frame */
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show(vbox);
@ -823,11 +824,6 @@ convert_to_indexed (GimpImage *gimage)
gtk_widget_show(frame);
}
/* The action area */
action_items[0].user_data = dialog;
action_items[1].user_data = dialog;
build_action_area (GTK_DIALOG (dialog->shell), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (dialog->shell);
}
@ -957,16 +953,6 @@ indexed_ok_callback (GtkWidget *widget,
dialog = NULL;
}
static gint
indexed_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
indexed_cancel_callback (w, client_data);
return TRUE;
}
static void
indexed_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -18,12 +18,12 @@
#include <string.h>
#include <math.h>
#include "appenv.h"
#include "actionarea.h"
#include "channel_ops.h"
#include "cursorutil.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "interface.h"
#include "palette.h"
@ -53,7 +53,6 @@ struct _OffsetDialog
/* Forward declarations */
static void offset_ok_callback (GtkWidget *, gpointer);
static void offset_cancel_callback (GtkWidget *, gpointer);
static gint offset_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void offset_wraparound_update (GtkWidget *, gpointer);
static void offset_fill_type_update (GtkWidget *, gpointer);
@ -77,12 +76,6 @@ channel_ops_offset (GimpImage* gimage)
GimpDrawable *drawable;
static ActionAreaItem action_items[] =
{
{ N_("OK"), offset_ok_callback, NULL, NULL },
{ N_("Cancel"), offset_cancel_callback, NULL, NULL }
};
drawable = gimage_active_drawable (gimage);
off_d = g_new (OffsetDialog, 1);
@ -90,15 +83,19 @@ channel_ops_offset (GimpImage* gimage)
off_d->fill_type = drawable_has_alpha (drawable);
off_d->gimage = gimage;
off_d->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (off_d->dlg), "offset", "Gimp");
gtk_window_set_title (GTK_WINDOW (off_d->dlg), _("Offset"));
off_d->dlg = gimp_dialog_new (_("Offset"), "offset",
gimp_standard_help_func,
"dialogs/offset_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (off_d->dlg), "delete_event",
GTK_SIGNAL_FUNC (offset_delete_callback),
off_d);
_("OK"), offset_ok_callback,
off_d, NULL, TRUE, FALSE,
_("Cancel"), offset_cancel_callback,
off_d, NULL, FALSE, TRUE,
NULL);
/* The vbox for first column of options */
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
@ -221,15 +218,10 @@ channel_ops_offset (GimpImage* gimage)
(GtkSignalFunc) offset_halfheight_callback,
off_d);
action_items[0].user_data = off_d;
action_items[1].user_data = off_d;
build_action_area (GTK_DIALOG (off_d->dlg), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (off_d->dlg);
}
void
offset (GimpImage *gimage,
GimpDrawable *drawable,
@ -495,16 +487,6 @@ offset_ok_callback (GtkWidget *widget,
g_free (off_d);
}
static gint
offset_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
offset_cancel_callback (widget, data);
return TRUE;
}
static void
offset_cancel_callback (GtkWidget *widget,
gpointer data)

View File

@ -15,13 +15,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "appenv.h"
#include "gdisplay.h"
#include "libgimp/gimpintl.h"
#include "gimpprogress.h"
#include "gimpui.h"
struct gimp_progress_pvt {
GDisplay *gdisp; /* gdisp in use, or NULL*/
@ -63,14 +61,17 @@ static void progress_signal_setup (gimp_progress *, GtkSignalFunc, gpointer);
* shown to the user if it would mean creating a new window.
*/
gimp_progress *
progress_start (GDisplay *gdisp, const char *message, gboolean important,
GtkSignalFunc cancel_callback, gpointer cancel_data)
progress_start (GDisplay *gdisp,
const char *message,
gboolean important,
GtkSignalFunc cancel_callback,
gpointer cancel_data)
{
gimp_progress *p;
guint cid;
GtkWidget *vbox;
p = g_malloc (sizeof (*p));
p = g_new (gimp_progress, 1);
p->gdisp = gdisp;
p->dialog = NULL;
@ -105,23 +106,22 @@ progress_start (GDisplay *gdisp, const char *message, gboolean important,
}
p->gdisp = NULL;
p->dialog = gtk_dialog_new ();
p->dialog = gimp_dialog_new (_("Progress"), "plug_in_progress",
NULL, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* not strictly true anymore, but needed in case anyone's window
* manager knows about WMCLASS "plug_in_progress" */
gtk_window_set_wmclass (GTK_WINDOW (p->dialog),
"plug_in_progress", "Gimp");
_("Cancel"), NULL,
NULL, &p->cancelbutton, TRUE, TRUE,
gtk_window_set_title (GTK_WINDOW (p->dialog), _("Progress"));
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (p->dialog)->action_area), 2);
NULL);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (p->dialog)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (p->dialog)->vbox), vbox);
gtk_widget_show (vbox);
p->dialog_label = gtk_label_new (message? message :
p->dialog_label = gtk_label_new (message ? message :
DEFAULT_PROGRESS_MESSAGE);
gtk_misc_set_alignment (GTK_MISC (p->dialog_label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), p->dialog_label, FALSE, TRUE, 0);
@ -132,13 +132,6 @@ progress_start (GDisplay *gdisp, const char *message, gboolean important,
gtk_box_pack_start (GTK_BOX (vbox), p->progressbar, TRUE, TRUE, 0);
gtk_widget_show (p->progressbar);
p->cancelbutton = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (p->cancelbutton, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (p->dialog)->action_area),
p->cancelbutton, TRUE, TRUE, 0);
gtk_widget_grab_default (p->cancelbutton);
gtk_widget_show (p->cancelbutton);
gtk_widget_show (p->dialog);
}
@ -151,8 +144,10 @@ progress_start (GDisplay *gdisp, const char *message, gboolean important,
/* Update the message and/or the callbacks for a progress and reset
* the bar to zero, with the minimum of disturbance to the user. */
gimp_progress *
progress_restart (gimp_progress *p, const char *message,
GtkSignalFunc cancel_callback, gpointer cancel_data)
progress_restart (gimp_progress *p,
const char *message,
GtkSignalFunc cancel_callback,
gpointer cancel_data)
{
int cid;
GtkWidget *bar;
@ -174,7 +169,7 @@ progress_restart (gimp_progress *p, const char *message,
else
{
gtk_label_set_text (GTK_LABEL (p->dialog_label),
message? message : DEFAULT_PROGRESS_MESSAGE);
message ? message : DEFAULT_PROGRESS_MESSAGE);
bar = p->progressbar;
}
@ -189,7 +184,8 @@ progress_restart (gimp_progress *p, const char *message,
void
progress_update (gimp_progress *progress, float percentage)
progress_update (gimp_progress *progress,
float percentage)
{
GtkWidget *bar;
@ -210,7 +206,10 @@ progress_update (gimp_progress *progress, float percentage)
/* This function's prototype is conveniently the same as progress_func_t */
void
progress_update_and_flush (int ymin, int ymax, int curr_y, gpointer data)
progress_update_and_flush (int ymin,
int ymax,
int curr_y,
gpointer data)
{
progress_update ((gimp_progress *)data,
(float)(curr_y - ymin) / (float)(ymax - ymin));
@ -275,12 +274,11 @@ progress_end (gimp_progress *p)
}
/* Helper function to add or remove signals */
static void
progress_signal_setup (gimp_progress *p,
GtkSignalFunc cancel_callback,
gpointer cancel_data)
GtkSignalFunc cancel_callback,
gpointer cancel_data)
{
GtkWidget *button;
GtkWidget *dialog;
@ -322,11 +320,10 @@ progress_signal_setup (gimp_progress *p,
}
gtk_widget_set_sensitive (GTK_WIDGET (button),
cancel_callback? TRUE : FALSE);
cancel_callback ? TRUE : FALSE);
p->cancel_callback = cancel_callback;
p->cancel_data = cancel_data;
}
/* End of gimpprogress.c */

View File

@ -157,6 +157,7 @@ int show_indicators = TRUE;
int max_new_image_size = 33554432; /* 32 MB */
int thumbnail_mode = 1;
int trust_dirty_flag = FALSE;
int use_help = FALSE;
extern char * module_db_load_inhibit;
@ -307,7 +308,9 @@ static ParseFunc funcs[] =
{ "max-new-image-size", TT_MEMSIZE, &max_new_image_size, NULL },
{ "thumbnail-mode", TT_INT, &thumbnail_mode, NULL },
{ "trust-dirty-flag", TT_BOOLEAN, &trust_dirty_flag, NULL },
{ "dont-trust-dirty-flag", TT_BOOLEAN, NULL, &trust_dirty_flag }
{ "dont-trust-dirty-flag", TT_BOOLEAN, NULL, &trust_dirty_flag },
{ "use-help", TT_BOOLEAN, &use_help, NULL },
{ "dont-use-help", TT_BOOLEAN, NULL, &use_help }
};
static int nfuncs = sizeof (funcs) / sizeof (funcs[0]);

View File

@ -81,7 +81,7 @@ extern int show_indicators;
extern int max_new_image_size;
extern int thumbnail_mode;
extern int trust_dirty_flag;
extern int use_help;
/* function prototypes */
void parse_buffers_init (); /* this has to be called before any file

857
app/gimpui.c Normal file
View File

@ -0,0 +1,857 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpui.c
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "gimpui.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
/*
* Widget Constructors...
*/
/* local callbacks of gimp_dialog_new () */
static gint
gimp_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
GtkSignalFunc cancel_callback;
GtkWidget *cancel_widget;
cancel_callback =
(GtkSignalFunc) gtk_object_get_data (GTK_OBJECT (widget),
"gimp_dialog_cancel_callback");
cancel_widget =
(GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
"gimp_dialog_cancel_widget");
/* the cancel callback has to destroy the dialog */
if (cancel_callback)
(* cancel_callback) (cancel_widget, data);
return TRUE;
}
/*
#include "/home/mitschel/gimpfiles/wilber.xpm"
static void
gimp_dialog_realize_callback (GtkWidget *widget,
gpointer data)
{
static GdkPixmap *wilber_pixmap = NULL;
static GdkBitmap *wilber_mask = NULL;
GtkStyle *style;
style = gtk_widget_get_style (widget);
if (wilber_pixmap == NULL)
wilber_pixmap =
gdk_pixmap_create_from_xpm_d (widget->window,
&wilber_mask,
&style->bg[GTK_STATE_NORMAL],
wilber_xpm);
gdk_window_set_icon (widget->window, NULL,
wilber_pixmap, wilber_mask);
}
*/
GtkWidget *
gimp_dialog_new (const gchar *title,
const gchar *wmclass_name,
GimpHelpFunc help_func,
gpointer help_data,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,
gint auto_shrink,
/* specify action area buttons as va_list:
* gchar *label,
* GtkSignalFunc callback,
* gpointer data,
* gboolean default_action,
* gboolean connect_delete,
*/
...)
{
GtkWidget *dialog;
va_list args;
va_start (args, auto_shrink);
dialog = gimp_dialog_newv (title,
wmclass_name,
help_func,
help_data,
position,
allow_shrink,
allow_grow,
auto_shrink,
args);
va_end (args);
return dialog;
}
GtkWidget *
gimp_dialog_newv (const gchar *title,
const gchar *wmclass_name,
GimpHelpFunc help_func,
gpointer help_data,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,
gint auto_shrink,
va_list args)
{
GtkWidget *dialog;
GtkWidget *hbbox;
GtkWidget *button;
/* action area variables */
gchar *label;
GtkSignalFunc callback;
gpointer data;
GtkWidget **widget_ptr;
gboolean default_action;
gboolean connect_delete;
gboolean delete_connected = FALSE;
g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (wmclass_name != NULL, NULL);
dialog = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp");
gtk_window_set_title (GTK_WINDOW (dialog), title);
gtk_window_set_position (GTK_WINDOW (dialog), position);
gtk_window_set_policy (GTK_WINDOW (dialog),
allow_shrink, allow_grow, auto_shrink);
/* prepare the action_area */
gtk_container_set_border_width
(GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
hbbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_show (hbbox);
/* the action_area buttons */
label = va_arg (args, gchar*);
while (label)
{
callback = va_arg (args, GtkSignalFunc);
data = va_arg (args, gpointer);
widget_ptr = va_arg (args, gpointer);
default_action = va_arg (args, gboolean);
connect_delete = va_arg (args, gboolean);
button = gtk_button_new_with_label (label);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
/* pass data as user_data if data != NULL, or the dialog otherwise */
if (callback)
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback),
data ? data : dialog);
if (widget_ptr)
*widget_ptr = button;
if (connect_delete && callback && !delete_connected)
{
gtk_object_set_data (GTK_OBJECT (dialog),
"gimp_dialog_cancel_callback",
callback);
gtk_object_set_data (GTK_OBJECT (dialog),
"gimp_dialog_cancel_widget",
button);
/* catch the WM delete event */
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
data ? data : dialog);
delete_connected = TRUE;
}
if (default_action)
gtk_widget_grab_default (button);
gtk_widget_show (button);
label = va_arg (args, gchar*);
}
/* catch the WM delete event if not already done */
if (! delete_connected)
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
(GdkEventFunc) gimp_dialog_delete_callback,
NULL);
/* the realize callback sets the WM icon */
/*
gtk_signal_connect (GTK_OBJECT (dialog), "realize",
(GtkSignalFunc) gimp_dialog_realize_callback,
NULL);
*/
/* connect the "F1" help key */
if (help_func)
gimp_help_connect_help_accel (dialog, help_func, help_data);
return dialog;
}
GtkWidget *
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gpointer initial, /* user_data */
/* specify menu items as va_list:
* gchar *label,
* gpointer data,
* gpointer user_data,
*/
...)
{
GtkWidget *menu;
GtkWidget *menuitem;
GtkWidget *optionmenu;
/* menu item variables */
gchar *label;
gpointer data;
gpointer user_data;
va_list args;
gint i;
gint initial_index;
menu = gtk_menu_new ();
/* create the menu items */
initial_index = 0;
va_start (args, initial);
label = va_arg (args, gchar*);
for (i = 0; label; i++)
{
data = va_arg (args, gpointer);
user_data = va_arg (args, gpointer);
menuitem = gtk_menu_item_new_with_label (label);
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
menu_item_callback, data);
gtk_object_set_user_data (GTK_OBJECT (menuitem), user_data);
gtk_widget_show (menuitem);
/* remember the initial menu item */
if (user_data == initial)
initial_index = i;
label = va_arg (args, gchar*);
}
va_end (args);
optionmenu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
/* select the initial menu item */
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), initial_index);
return optionmenu;
}
GtkWidget *
gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gpointer initial, /* user_data */
/* specify radio buttons as va_list:
* gchar *label,
* gpointer data,
* gpointer user_data,
*/
...)
{
GtkWidget *vbox;
GtkWidget *button;
GSList *group;
/* radio button variables */
gchar *label;
gpointer data;
gpointer user_data;
va_list args;
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
group = NULL;
/* create the radio buttons */
va_start (args, initial);
label = va_arg (args, gchar*);
while (label)
{
data = va_arg (args, gpointer);
user_data = va_arg (args, gpointer);
button = gtk_radio_button_new_with_label (group, label);
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
(GtkSignalFunc) radio_button_callback,
data);
gtk_object_set_user_data (GTK_OBJECT (button), user_data);
/* press the initially active radio button */
if (user_data == initial)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_widget_show (button);
label = va_arg (args, gchar*);
}
va_end (args);
return vbox;
}
GtkWidget *
gimp_spin_button_new (GtkObject **adjustment, /* return value */
gfloat value,
gfloat lower,
gfloat upper,
gfloat step_increment,
gfloat page_increment,
gfloat page_size,
gfloat climb_rate,
guint digits)
{
GtkWidget *spinbutton;
*adjustment = gtk_adjustment_new (value, lower, upper,
step_increment, page_increment, page_size);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (*adjustment),
climb_rate, digits);
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
GTK_SHADOW_NONE);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_usize (spinbutton, 75, 0);
return spinbutton;
}
/*
* String, integer, double and size query boxes
*/
typedef struct _QueryBox QueryBox;
struct _QueryBox
{
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *entry;
GtkObject *object;
GimpQueryFunc callback;
gpointer data;
};
static QueryBox * create_query_box (gchar *, GimpHelpFunc, gpointer,
GtkSignalFunc,
gchar *, GtkObject *, gchar *,
GimpQueryFunc, gpointer);
static void query_box_cancel_callback (GtkWidget *, gpointer);
static void string_query_box_ok_callback (GtkWidget *, gpointer);
static void int_query_box_ok_callback (GtkWidget *, gpointer);
static void double_query_box_ok_callback (GtkWidget *, gpointer);
static void size_query_box_ok_callback (GtkWidget *, gpointer);
/* create a generic query box without any entry widget */
static QueryBox *
create_query_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
GtkSignalFunc ok_callback,
gchar *message,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *label;
query_box = g_new (QueryBox, 1);
qbox = gimp_dialog_new (title, "query_box",
help_func, help_data,
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("OK"), ok_callback,
query_box, NULL, TRUE, FALSE,
_("Cancel"), query_box_cancel_callback,
query_box, NULL, FALSE, TRUE,
NULL);
/* if we are associated with an object, connect to the provided signal */
if (object && GTK_IS_OBJECT (object) && signal)
gtk_signal_connect (GTK_OBJECT (object), signal,
(GtkSignalFunc) query_box_cancel_callback,
query_box);
else
object = NULL;
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (qbox)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (message);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
query_box->qbox = qbox;
query_box->vbox = vbox;
query_box->entry = NULL;
query_box->object = object;
query_box->callback = callback;
query_box->data = data;
return query_box;
}
GtkWidget *
gimp_query_string_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gchar *message,
gchar *initial,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *entry;
query_box = create_query_box (title, help_func, help_data,
string_query_box_ok_callback,
message, object, signal, callback, data);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (query_box->vbox), entry, FALSE, FALSE, 0);
if (initial)
gtk_entry_set_text (GTK_ENTRY (entry), initial);
gtk_widget_grab_focus (entry);
gtk_widget_show (entry);
query_box->entry = entry;
return query_box->qbox;
}
GtkWidget *
gimp_query_int_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gchar *message,
gint initial,
gint lower,
gint upper,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
GtkWidget *spinbutton;
query_box = create_query_box (title, help_func, help_data,
int_query_box_ok_callback,
message, object, signal, callback, data);
adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
spinbutton = gtk_spin_button_new (adjustment, 1.0, 0);
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_grab_focus (spinbutton);
gtk_widget_show (spinbutton);
query_box->entry = spinbutton;
return query_box->qbox;
}
GtkWidget *
gimp_query_double_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
GtkWidget *spinbutton;
query_box = create_query_box (title, help_func, help_data,
double_query_box_ok_callback,
message, object, signal, callback, data);
adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper, 1, 10, 0));
spinbutton = gtk_spin_button_new (adjustment, 1.0, digits);
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_grab_focus (spinbutton);
gtk_widget_show (spinbutton);
query_box->entry = spinbutton;
return query_box->qbox;
}
GtkWidget *
gimp_query_size_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gdouble resolution,
gboolean dot_for_dot,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkWidget *sizeentry;
query_box = create_query_box (title, help_func, help_data,
size_query_box_ok_callback,
message, object, signal, callback, data);
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE);
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
lower, upper);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, FALSE, FALSE, 0);
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
gtk_widget_show (sizeentry);
query_box->entry = sizeentry;
return query_box->qbox;
}
static void
query_box_cancel_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
query_box = (QueryBox *) data;
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
string_query_box_ok_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
gchar *string;
query_box = (QueryBox *) data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the entry data */
string = g_strdup (gtk_entry_get_text (GTK_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data, (gpointer) string);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
int_query_box_ok_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
gint *integer_value;
query_box = (QueryBox *) data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
integer_value = g_malloc (sizeof (gint));
*integer_value =
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) integer_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
double_query_box_ok_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
gdouble *double_value;
query_box = (QueryBox *) data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
double_value = g_malloc (sizeof (gdouble));
*double_value =
gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
static void
size_query_box_ok_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
gdouble *double_value;
query_box = (QueryBox *) data;
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect, if we are connected to some signal */
if (query_box->object)
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the sizeentry data */
double_value = g_malloc (sizeof (gdouble));
*double_value =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (query_box->entry), 0);
/* Pass the selected unit to the callback */
gtk_object_set_data
(GTK_OBJECT (widget), "size_query_unit",
(gpointer) gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (query_box->qbox, query_box->data,
(gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
g_free (query_box);
}
/*
* Message Boxes...
*/
typedef struct _MessageBox MessageBox;
struct _MessageBox
{
GtkWidget *mbox;
GtkCallback callback;
gpointer data;
};
static void gimp_message_box_close_callback (GtkWidget *, gpointer);
GtkWidget *
gimp_message_box (gchar *message,
GtkCallback callback,
gpointer data)
{
MessageBox *msg_box;
GtkWidget *mbox;
GtkWidget *vbox;
GtkWidget *label;
if (! message)
return NULL;
msg_box = g_new (MessageBox, 1);
mbox = gimp_dialog_new (_("GIMP Message"), "gimp_message",
NULL, NULL,
GTK_WIN_POS_MOUSE,
FALSE, FALSE, FALSE,
_("OK"), gimp_message_box_close_callback,
msg_box, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (mbox)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (message);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
gtk_widget_show (label);
msg_box->mbox = mbox;
msg_box->callback = callback;
msg_box->data = data;
gtk_widget_show (mbox);
return mbox;
}
static void
gimp_message_box_close_callback (GtkWidget *widget,
gpointer data)
{
MessageBox *msg_box;
msg_box = (MessageBox *) data;
/* If there is a valid callback, invoke it */
if (msg_box->callback)
(* msg_box->callback) (widget, msg_box->data);
/* Destroy the box */
gtk_widget_destroy (msg_box->mbox);
g_free (msg_box);
}
/*
* Helper Functions...
*/
/* add aligned label & widget to a two-column table */
void
gimp_table_attach_aligned (GtkTable *table,
gint row,
gchar *text,
gfloat xalign,
gfloat yalign,
GtkWidget *widget,
gboolean left_adjust)
{
GtkWidget *label;
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
gtk_table_attach (table, GTK_WIDGET (label), 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
if (left_adjust)
{
GtkWidget *alignment;
alignment = gtk_alignment_new (0.0, 1.0, 0.0, 0.0);
gtk_table_attach_defaults (table, alignment, 1, 2, row, row + 1);
gtk_widget_show (alignment);
gtk_container_add (GTK_CONTAINER (alignment), widget);
}
else
{
gtk_table_attach_defaults (table, widget, 1, 2, row, row + 1);
}
gtk_widget_show (widget);
}

175
app/gimpui.h Normal file
View File

@ -0,0 +1,175 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpui.h
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_UI_H__
#define __GIMP_UI_H__
#include <gtk/gtk.h>
#include "gimphelp.h"
#include "libgimp/gimpunit.h"
/* typedefs */
typedef void (* GimpQueryFunc) (GtkWidget *, gpointer, gpointer);
/* widget constructors */
GtkWidget * gimp_dialog_new (const gchar *title,
const gchar *wmclass_name,
GimpHelpFunc help_func,
gpointer help_data,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,
gint auto_shrink,
/* specify action area buttons as va_list:
* gchar *label,
* GtkSignalFunc callback,
* gpointer data,
* GtkWidget **widget_ptr,
* gboolean default_action,
* gboolean connect_delete,
*/
...);
GtkWidget * gimp_dialog_newv (const gchar *title,
const gchar *wmclass_name,
GimpHelpFunc help_func,
gpointer help_data,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,
gint auto_shrink,
va_list args);
GtkWidget * gimp_option_menu_new (GtkSignalFunc menu_item_callback,
gpointer initial, /* user_data */
/* specify menu items as va_list:
* gchar *label,
* gpointer data,
* gpointer user_data,
*/
...);
GtkWidget * gimp_radio_group_new (GtkSignalFunc radio_button_callback,
gpointer initial, /* user_data */
/* specify radio buttons as va_list:
* gchar *label,
* gpointer data,
* gpointer user_data,
*/
...);
GtkWidget * gimp_spin_button_new (/* return value: */
GtkObject **adjustment,
gfloat value,
gfloat lower,
gfloat upper,
gfloat step_increment,
gfloat page_increment,
gfloat page_size,
gfloat climb_rate,
guint digits);
/* some simple query dialogs
* if object != NULL then the query boxes will connect their cancel callback
* to the provided signal of this object
*
* it's the caller's job to show the returned widgets
*/
GtkWidget * gimp_query_string_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gchar *message,
gchar *initial,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data);
GtkWidget * gimp_query_int_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
char *message,
gint initial,
gint lower,
gint upper,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data);
GtkWidget * gimp_query_double_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data);
GtkWidget * gimp_query_size_box (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gdouble resolution,
gboolean dot_for_dot,
GtkObject *object,
gchar *signal,
GimpQueryFunc callback,
gpointer data);
/* a simple message box */
GtkWidget * gimp_message_box (gchar *message,
GtkCallback callback,
gpointer data);
/* helper functions */
/* add aligned label & widget to a two-column table */
void gimp_table_attach_aligned (GtkTable *table,
gint row,
gchar *text,
gfloat xalign,
gfloat yalign,
GtkWidget *widget,
gboolean left_adjust);
#endif /* __GIMP_UI_H__ */

View File

@ -24,8 +24,8 @@
#include "gdisplay.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpui.h"
#include "global_edit.h"
#include "interface.h"
#include "layer.h"
#include "paint_funcs.h"
#include "tools.h"
@ -666,12 +666,12 @@ named_buffer_delete_callback (GtkWidget *w,
}
static void
named_buffer_cancel_callback (GtkWidget *w,
gpointer client_data)
named_buffer_cancel_callback (GtkWidget *widget,
gpointer data)
{
PasteNamedDlg *pn_dlg;
pn_dlg = (PasteNamedDlg *) client_data;
pn_dlg = (PasteNamedDlg *) data;
/* Destroy the box */
gtk_widget_destroy (pn_dlg->shell);
@ -679,16 +679,6 @@ named_buffer_cancel_callback (GtkWidget *w,
g_free (pn_dlg);
}
static gint
named_buffer_dialog_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
named_buffer_cancel_callback (w, client_data);
return TRUE;
}
static void
paste_named_buffer (GDisplay *gdisp)
{
@ -706,27 +696,27 @@ paste_named_buffer (GDisplay *gdisp)
{ N_("Paste Into"), named_buffer_paste_into_callback, NULL, NULL },
{ N_("Paste As New"), named_buffer_paste_as_new_callback, NULL, NULL }
};
static ActionAreaItem other_action_items[] =
{
{ N_("Delete"), named_buffer_delete_callback, NULL, NULL },
{ N_("Cancel"), named_buffer_cancel_callback, NULL, NULL }
};
pn_dlg = (PasteNamedDlg *) g_malloc (sizeof (PasteNamedDlg));
pn_dlg = g_new (PasteNamedDlg, 1);
pn_dlg->gdisp = gdisp;
pn_dlg->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (pn_dlg->shell), "paste_named_buffer", "Gimp");
gtk_window_set_title (GTK_WINDOW (pn_dlg->shell), _("Paste Named Buffer"));
gtk_window_position (GTK_WINDOW (pn_dlg->shell), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (pn_dlg->shell), "delete_event",
GTK_SIGNAL_FUNC (named_buffer_dialog_delete_callback),
pn_dlg);
pn_dlg->shell =
gimp_dialog_new (_("Paste Named Buffer"), "paste_named_buffer",
gimp_standard_help_func,
"dialogs/paste_named_buffer_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("Delete"), named_buffer_delete_callback,
pn_dlg, NULL, FALSE, FALSE,
_("Cancel"), named_buffer_cancel_callback,
pn_dlg, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (pn_dlg->shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (pn_dlg->shell)->vbox), vbox);
gtk_widget_show (vbox);
label = gtk_label_new (_("Select a buffer to paste:"));
@ -763,10 +753,6 @@ paste_named_buffer (GDisplay *gdisp)
}
gtk_widget_show (bbox);
other_action_items[0].user_data = pn_dlg;
other_action_items[1].user_data = pn_dlg;
build_action_area (GTK_DIALOG (pn_dlg->shell), other_action_items, 2, 1);
gtk_widget_show (pn_dlg->shell);
}
@ -791,7 +777,7 @@ new_named_buffer (TileManager *tiles,
}
static void
cut_named_buffer_callback (GtkWidget *w,
cut_named_buffer_callback (GtkWidget *widget,
gpointer client_data,
gpointer call_data)
{
@ -811,22 +797,27 @@ cut_named_buffer_callback (GtkWidget *w,
int
named_edit_cut (void *gdisp_ptr)
{
GDisplay *gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
/* stop any active tool */
gdisp = (GDisplay *) gdisp_ptr;
active_tool_control (HALT, gdisp_ptr);
gtk_widget_show (query_string_box (_("Cut Named"),
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
cut_named_buffer_callback, gdisp));
qbox = gimp_query_string_box (_("Cut Named"),
gimp_standard_help_func,
"dialogs/cut_named_dialog.html",
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
cut_named_buffer_callback, gdisp);
gtk_widget_show (qbox);
return TRUE;
}
static void
copy_named_buffer_callback (GtkWidget *w,
copy_named_buffer_callback (GtkWidget *widget,
gpointer client_data,
gpointer call_data)
{
@ -845,15 +836,20 @@ copy_named_buffer_callback (GtkWidget *w,
int
named_edit_copy (void *gdisp_ptr)
{
GDisplay *gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gtk_widget_show (query_string_box (_("Copy Named"),
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
copy_named_buffer_callback, gdisp));
qbox = gimp_query_string_box (_("Copy Named"),
gimp_standard_help_func,
"dialogs/copy_named_dialog.html",
_("Enter a name for this buffer"),
NULL,
GTK_OBJECT (gdisp->gimage), "destroy",
copy_named_buffer_callback, gdisp);
gtk_widget_show (qbox);
return TRUE;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* This is the popup for the gradient selection stuff..
* idea is a cut down version of the gradient selection widget
* just a clist on which each gradient can be selected.
@ -28,7 +27,6 @@
* setting the slection all need to be done as well.
*/
/* Main structure for the dialog. There can be multiple of these
* so every thing has to go into the strcuture and we have to have a list
* the structures so we can find which one we are taking about.
@ -48,123 +46,125 @@
#include "colormaps.h"
#include "cursorutil.h"
#include "datafiles.h"
#include "dialog_handler.h"
#include "errors.h"
#include "general.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gradient.h"
#include "gradient_header.h"
#include "indicator_area.h"
#include "interface.h"
#include "palette.h"
#include "session.h"
#include "actionarea.h"
#include "dialog_handler.h"
#include "libgimp/gimpintl.h"
GSList *grad_active_dialogs = NULL; /* List of active dialogs */
GradSelectP gradient_select_dialog = NULL; /* The main selection dialog */
static void grad_select_close_callback (GtkWidget *, gpointer);
static void grad_select_close_callback (GtkWidget *, gpointer);
static void grad_select_edit_callback (GtkWidget *, gpointer);
static void grad_change_callbacks(GradSelectP gsp, gint closing);
extern void import_palette_grad_update(gradient_t *); /* ALT Hmm... */
static ActionAreaItem action_items[2] =
{
{ N_("Edit"), grad_select_edit_callback, NULL, NULL },
{ N_("Close"), grad_select_close_callback, NULL, NULL }
};
static void grad_change_callbacks (GradSelectP gsp, gint closing);
extern void import_palette_grad_update (gradient_t *); /* ALT Hmm... */
void
grad_free_gradient_editor(void)
grad_free_gradient_editor (void)
{
if (gradient_select_dialog)
session_get_window_info (gradient_select_dialog->shell, &gradient_select_session_info);
} /* grad_free_gradient_editor */
session_get_window_info (gradient_select_dialog->shell,
&gradient_select_session_info);
}
void
grad_sel_rename_all(gint n, gradient_t *grad)
grad_sel_rename_all (gint n,
gradient_t *grad)
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_set_text(GTK_CLIST(gsp->clist),n,1,grad->name);
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_set_text (GTK_CLIST (gsp->clist), n, 1, grad->name);
list = g_slist_next (list);
}
if(gradient_select_dialog)
{
gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),n,1,grad->name);
gtk_clist_set_text (GTK_CLIST (gradient_select_dialog->clist),
n, 1, grad->name);
}
}
void
grad_sel_new_all(gint pos, gradient_t *grad)
grad_sel_new_all (gint pos,
gradient_t *grad)
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_freeze (GTK_CLIST (gsp->clist));
ed_insert_in_gradients_listbox (gsp->gc, gsp->clist, grad, pos, 1);
gtk_clist_thaw (GTK_CLIST (gsp->clist));
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_freeze (GTK_CLIST (gradient_select_dialog->clist));
ed_insert_in_gradients_listbox (gradient_select_dialog->gc,
gradient_select_dialog->clist,
grad, pos, 1);
gtk_clist_thaw (GTK_CLIST (gradient_select_dialog->clist));
}
}
void
grad_sel_copy_all(gint pos, gradient_t *grad)
grad_sel_copy_all (gint pos,
gradient_t *grad)
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_freeze (GTK_CLIST (gsp->clist));
ed_insert_in_gradients_listbox (gsp->gc, gsp->clist, grad, pos, 1);
gtk_clist_thaw (GTK_CLIST (gsp->clist));
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_freeze (GTK_CLIST (gradient_select_dialog->clist));
ed_insert_in_gradients_listbox (gradient_select_dialog->gc,
gradient_select_dialog->clist,
grad, pos, 1);
gtk_clist_thaw (GTK_CLIST (gradient_select_dialog->clist));
}
}
void
grad_sel_delete_all(gint n)
grad_sel_delete_all (gint n)
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_remove(GTK_CLIST(gsp->clist), n);
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_remove (GTK_CLIST (gsp->clist), n);
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gtk_clist_remove(GTK_CLIST(gradient_select_dialog->clist), n);
gtk_clist_remove (GTK_CLIST (gradient_select_dialog->clist), n);
}
}
@ -174,117 +174,119 @@ grad_sel_free_all()
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
gtk_clist_clear(GTK_CLIST(gsp->clist));
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_freeze (GTK_CLIST (gsp->clist));
gtk_clist_clear (GTK_CLIST (gsp->clist));
gtk_clist_thaw (GTK_CLIST (gsp->clist));
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_clear(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_freeze (GTK_CLIST (gradient_select_dialog->clist));
gtk_clist_clear (GTK_CLIST (gradient_select_dialog->clist));
gtk_clist_thaw (GTK_CLIST (gradient_select_dialog->clist));
}
}
void
grad_sel_refill_all()
grad_sel_refill_all ()
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
int select_pos = -1;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gsp = (GradSelectP) list->data;
gsp->grad = curr_gradient;
select_pos = ed_set_list_of_gradients(gsp->gc,
gsp->clist,
curr_gradient);
if(select_pos != -1)
gtk_clist_moveto(GTK_CLIST(gsp->clist),select_pos,0,0.0,0.0);
list = g_slist_next(list);
select_pos = ed_set_list_of_gradients (gsp->gc,
gsp->clist,
curr_gradient);
if (select_pos != -1)
gtk_clist_moveto (GTK_CLIST (gsp->clist), select_pos, 0, 0.0, 0.0);
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gradient_select_dialog->grad = curr_gradient;
select_pos = ed_set_list_of_gradients(gradient_select_dialog->gc,
gradient_select_dialog->clist,
curr_gradient);
if(select_pos != -1)
gtk_clist_moveto(GTK_CLIST(gradient_select_dialog->clist),select_pos,0,0.0,0.0);
select_pos = ed_set_list_of_gradients (gradient_select_dialog->gc,
gradient_select_dialog->clist,
curr_gradient);
if (select_pos != -1)
gtk_clist_moveto (GTK_CLIST (gradient_select_dialog->clist),
select_pos, 0, 0.0, 0.0);
}
}
void
sel_update_dialogs(gint row, gradient_t *grad)
sel_update_dialogs (gint row,
gradient_t *grad)
{
/* Go around each updating the names and hopefully the previews */
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_set_text(GTK_CLIST(gsp->clist),row,1,grad->name);
gsp = (GradSelectP) list->data;
gtk_clist_set_text (GTK_CLIST (gsp->clist), row, 1, grad->name);
/* Are we updating one that is selected in a popup dialog? */
if(grad == gsp->grad)
grad_change_callbacks(gsp, 0);
list = g_slist_next(list);
if (grad == gsp->grad)
grad_change_callbacks (gsp, 0);
list = g_slist_next (list);
}
if(gradient_select_dialog)
gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),row,1,grad->name);
if (gradient_select_dialog)
gtk_clist_set_text (GTK_CLIST (gradient_select_dialog->clist),
row, 1, grad->name);
gradient_area_update (); /* update the indicator_area */
import_palette_grad_update(grad);
import_palette_grad_update (grad);
}
static void
sel_list_item_update(GtkWidget *widget,
gint row,
gint column,
GdkEventButton *event,
gpointer data)
sel_list_item_update (GtkWidget *widget,
gint row,
gint column,
GdkEventButton *event,
gpointer data)
{
GradSelectP gsp = (GradSelectP)data;
GradSelectP gsp = (GradSelectP) data;
GSList* tmp = g_slist_nth(gradients_list,row);
gsp->grad = (gradient_t *)(tmp->data);
GSList* tmp = g_slist_nth (gradients_list, row);
gsp->grad = (gradient_t *) (tmp->data);
/* If main one then make it the current selection */
if(gsp == gradient_select_dialog)
if (gsp == gradient_select_dialog)
{
grad_set_grad_to_name(gsp->grad->name);
grad_set_grad_to_name (gsp->grad->name);
gradient_area_update (); /* update the indicator_area */
import_palette_grad_update(gsp->grad);
import_palette_grad_update (gsp->grad);
}
else
{
grad_change_callbacks(gsp, 0);
grad_change_callbacks (gsp, 0);
}
}
static void
grad_select_edit_callback (GtkWidget *w,
grad_select_edit_callback (GtkWidget *widget,
gpointer client_data)
{
GradSelectP gsp;
gsp = (GradSelectP) client_data;
grad_create_gradient_editor_init(TRUE);
grad_create_gradient_editor_init (TRUE);
/* Set the current gradient in this dialog to the "real current"*/
if(gsp && gsp->grad)
grad_set_grad_to_name(gsp->grad->name);
/* Set the current gradient in this dialog to the "real current"*/
if (gsp && gsp->grad)
grad_set_grad_to_name (gsp->grad->name);
}
void
@ -292,21 +294,19 @@ grad_select_free (GradSelectP gsp)
{
if (gsp)
{
if(gsp->callback_name)
g_free(gsp->callback_name);
if (gsp->callback_name)
g_free (gsp->callback_name);
/* remove from active list */
grad_active_dialogs = g_slist_remove(grad_active_dialogs,gsp);
grad_active_dialogs = g_slist_remove (grad_active_dialogs, gsp);
g_free (gsp);
}
}
/* Close active dialogs that no longer have PDB registered for them */
void
gradients_check_dialogs(void)
gradients_check_dialogs (void)
{
GSList *list;
GradSelectP gsp;
@ -321,21 +321,21 @@ gradients_check_dialogs(void)
list = list->next;
name = gsp->callback_name;
prec = procedural_db_lookup(name);
if(!prec)
prec = procedural_db_lookup (name);
if (!prec)
{
grad_active_dialogs = g_slist_remove(grad_active_dialogs,gsp);
grad_active_dialogs = g_slist_remove (grad_active_dialogs, gsp);
/* Can alter grad_active_dialogs list*/
grad_select_close_callback(NULL,gsp);
grad_select_close_callback (NULL, gsp);
}
}
}
static void
grad_change_callbacks(GradSelectP gsp, gint closing)
grad_change_callbacks(GradSelectP gsp,
gint closing)
{
gchar * name;
ProcRecord *prec = NULL;
@ -346,8 +346,8 @@ grad_change_callbacks(GradSelectP gsp, gint closing)
/* Any procs registered to callback? */
Argument *return_vals;
if(!gsp || !gsp->callback_name || busy != 0)
if (!gsp || !gsp->callback_name || busy != 0)
return;
busy = 1;
@ -355,9 +355,9 @@ grad_change_callbacks(GradSelectP gsp, gint closing)
grad = gsp->grad;
/* If its still registered run it */
prec = procedural_db_lookup(name);
prec = procedural_db_lookup (name);
if(prec && grad)
if (prec && grad)
{
gdouble *values, *pv;
double pos, delta;
@ -366,30 +366,31 @@ grad_change_callbacks(GradSelectP gsp, gint closing)
pos = 0.0;
delta = 1.0 / (i - 1);
values = g_malloc(i * 4 * sizeof(gdouble));
values = g_new (gdouble, 4 * i);
pv = values;
curr_gradient = grad;
while (i--) {
grad_get_color_at(pos, &r, &g, &b, &a);
*pv++ = r;
*pv++ = g;
*pv++ = b;
*pv++ = a;
pos += delta;
} /* while */
while (i--)
{
grad_get_color_at (pos, &r, &g, &b, &a);
*pv++ = r;
*pv++ = g;
*pv++ = b;
*pv++ = a;
pos += delta;
}
curr_gradient = oldgrad;
return_vals = procedural_db_run_proc (name,
&nreturn_vals,
PDB_STRING,grad->name,
PDB_INT32,gsp->sample_size*4,
PDB_FLOATARRAY,values,
PDB_INT32,closing,
PDB_STRING, grad->name,
PDB_INT32, gsp->sample_size*4,
PDB_FLOATARRAY, values,
PDB_INT32, closing,
PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
@ -401,7 +402,7 @@ grad_change_callbacks(GradSelectP gsp, gint closing)
}
static void
grad_select_close_callback (GtkWidget *w,
grad_select_close_callback (GtkWidget *widget,
gpointer client_data)
{
GradSelectP gsp;
@ -420,18 +421,9 @@ grad_select_close_callback (GtkWidget *w,
}
}
static gint
grad_select_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
grad_select_close_callback (w, client_data);
return TRUE;
}
GradSelectP
gsel_new_selection (gchar * title,
gchar * initial_gradient)
gsel_new_selection (gchar *title,
gchar *initial_gradient)
{
GradSelectP gsp;
gradient_t *grad = NULL;
@ -448,23 +440,27 @@ gsel_new_selection (gchar * title,
grad_create_gradient_editor_init(FALSE);
}
gsp = g_malloc (sizeof (_GradSelect));
gsp = g_new (_GradSelect, 1);
gsp->callback_name = NULL;
/* The shell and main vbox */
gsp->shell = gtk_dialog_new ();
gsp->shell = gimp_dialog_new (title ? title : _("Gradient Selection"),
"gradient_selection",
gimp_standard_help_func,
"dialogs/gradient_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
gtk_window_set_wmclass (GTK_WINDOW (gsp->shell), "gradselection", "Gimp");
gtk_window_set_policy (GTK_WINDOW (gsp->shell), FALSE, TRUE, FALSE);
_("Edit"), grad_select_edit_callback,
gsp, NULL, FALSE, FALSE,
_("Close"), grad_select_close_callback,
gsp, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (gsp->shell)->vbox), vbox, TRUE, TRUE, 0);
/* handle the wm close event */
gtk_signal_connect (GTK_OBJECT (gsp->shell), "delete_event",
GTK_SIGNAL_FUNC (grad_select_delete_callback),
gsp);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gsp->shell)->vbox), vbox);
/* clist preview of gradients */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
@ -498,23 +494,10 @@ gsel_new_selection (gchar * title,
gdk_color_parse ("black", &gsp->black);
gdk_color_alloc (colormap, &gsp->black);
gtk_signal_connect (GTK_OBJECT(gsp->clist), "select_row",
GTK_SIGNAL_FUNC(sel_list_item_update),
gtk_signal_connect (GTK_OBJECT (gsp->clist), "select_row",
GTK_SIGNAL_FUNC (sel_list_item_update),
(gpointer) gsp);
action_items[0].user_data = gsp;
action_items[1].user_data = gsp;
build_action_area (GTK_DIALOG (gsp->shell), action_items, 2, 1);
if(!title)
{
gtk_window_set_title (GTK_WINDOW (gsp->shell), _("Gradient Selection"));
}
else
{
gtk_window_set_title (GTK_WINDOW (gsp->shell), title);
}
if (initial_gradient && strlen (initial_gradient))
{
list = gradients_list;
@ -547,31 +530,32 @@ gsel_new_selection (gchar * title,
gtk_widget_show (gsp->shell);
if (select_pos != -1)
gtk_clist_moveto (GTK_CLIST(gsp->clist),select_pos,0,0.0,0.0);
gtk_clist_moveto (GTK_CLIST (gsp->clist), select_pos, 0, 0.0, 0.0);
return gsp;
}
void
grad_create_gradient_editor(void)
grad_create_gradient_editor (void)
{
if(gradient_select_dialog == NULL)
if (gradient_select_dialog == NULL)
{
gradient_select_dialog = gsel_new_selection(_("Gradients"),NULL);
gradient_select_dialog = gsel_new_selection (_("Gradients"), NULL);
/* register this one only */
dialog_register(gradient_select_dialog->shell);
dialog_register (gradient_select_dialog->shell);
session_set_window_geometry (gradient_select_dialog->shell, &gradient_select_session_info, TRUE);
session_set_window_geometry (gradient_select_dialog->shell,
&gradient_select_session_info, TRUE);
}
else
{
if (!GTK_WIDGET_VISIBLE(gradient_select_dialog->shell))
if (!GTK_WIDGET_VISIBLE (gradient_select_dialog->shell))
{
gtk_widget_show(gradient_select_dialog->shell);
gtk_widget_show (gradient_select_dialog->shell);
}
else
gdk_window_raise(gradient_select_dialog->shell->window);
gdk_window_raise (gradient_select_dialog->shell->window);
return;
}
}

View File

@ -23,22 +23,16 @@
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "brush_edit.h"
#include "actionarea.h"
#include "gimpui.h"
#include "libgimp/gimpintl.h"
static void brush_edit_close_callback (GtkWidget *w, void *data);
static void brush_edit_close_callback (GtkWidget *, gpointer);
static gint brush_edit_preview_resize (GtkWidget *widget, GdkEvent *event,
BrushEditGeneratedWindow *begw);
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("Close"), brush_edit_close_callback, NULL, NULL }
};
static void
update_brush_callback (GtkAdjustment *adjustment,
update_brush_callback (GtkAdjustment *adjustment,
BrushEditGeneratedWindow *begw)
{
if (begw->brush &&
@ -64,15 +58,6 @@ update_brush_callback (GtkAdjustment *adjustment,
}
}
static gint
brush_edit_delete_callback (GtkWidget *w,
BrushEditGeneratedWindow *begw)
{
if (GTK_WIDGET_VISIBLE (w))
gtk_widget_hide (w);
return TRUE;
}
static void
brush_edit_clear_preview (BrushEditGeneratedWindow *begw)
{
@ -93,7 +78,7 @@ brush_edit_clear_preview (BrushEditGeneratedWindow *begw)
}
static gint
brush_edit_brush_dirty_callback(GimpBrush *brush,
brush_edit_brush_dirty_callback (GimpBrush *brush,
BrushEditGeneratedWindow *begw)
{
int x, y, width, yend, ystart, xo;
@ -138,15 +123,17 @@ brush_edit_brush_dirty_callback(GimpBrush *brush,
return TRUE;
}
void brush_renamed_callback(GtkWidget *widget, BrushEditGeneratedWindow *begw)
void
brush_renamed_callback (GtkWidget *widget,
BrushEditGeneratedWindow *begw)
{
gtk_entry_set_text(GTK_ENTRY(begw->name),
gimp_brush_get_name(GIMP_BRUSH(begw->brush)));
}
void
brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
GimpBrush *gbrush)
brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
GimpBrush *gbrush)
{
GimpBrushGenerated *brush = 0;
if (begw->brush == (GimpBrushGenerated*)gbrush)
@ -189,16 +176,21 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
}
}
void name_changed_func(GtkWidget *widget, BrushEditGeneratedWindow *begw)
void
name_changed_func (GtkWidget *widget,
BrushEditGeneratedWindow *begw)
{
gchar *entry_text;
entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
gimp_brush_set_name(GIMP_BRUSH(begw->brush), entry_text);
}
void focus_out_func(GtkWidget *wid1, GtkWidget *wid2, BrushEditGeneratedWindow *begw)
void
focus_out_func (GtkWidget *wid1,
GtkWidget *wid2,
BrushEditGeneratedWindow *begw)
{
name_changed_func(wid1, begw);
name_changed_func (wid1, begw);
}
BrushEditGeneratedWindow *
@ -210,34 +202,31 @@ brush_edit_generated_new ()
GtkWidget *slider;
GtkWidget *table;
begw = g_malloc (sizeof (BrushEditGeneratedWindow));
begw = g_new (BrushEditGeneratedWindow, 1);
begw->brush = NULL;
begw->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (begw->shell), "generatedbrusheditor",
"Gimp");
gtk_window_set_title (GTK_WINDOW (begw->shell), _("Brush Editor"));
gtk_window_set_policy(GTK_WINDOW(begw->shell), FALSE, TRUE, FALSE);
begw->shell = gimp_dialog_new (_("Brush Editor"), "generated_brush_editor",
gimp_standard_help_func,
"dialogs/generated_brush_editor_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("Close"), brush_edit_close_callback,
begw, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (begw->shell)->vbox), vbox,
TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (begw->shell)->vbox), vbox);
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (begw->shell), "delete_event",
GTK_SIGNAL_FUNC (brush_edit_delete_callback),
begw);
/* Populate the window with some widgets */
/* Populate the window with some widgets */
/* table for brush controlls */
/* table for brush controlls */
table = gtk_table_new(5, 4, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
/* Brush's name */
/* Brush's name */
begw->name = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (vbox), begw->name, TRUE, TRUE, 0);
@ -249,7 +238,7 @@ brush_edit_generated_new ()
begw);
gtk_widget_show(begw->name);
/* brush's preview widget w/frame */
/* brush's preview widget w/frame */
begw->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (begw->frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), begw->frame, TRUE, TRUE, 0);
@ -276,7 +265,7 @@ brush_edit_generated_new ()
/* brush radius scale */
label = gtk_label_new (_("Radius:"));
gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
/* gtk_table_attach(GTK_TABLE (table), label, 0, 1, 0, 1, 0, 0, 0, 0); */
/* gtk_table_attach(GTK_TABLE (table), label, 0, 1, 0, 1, 0, 0, 0, 0); */
gtk_table_attach(GTK_TABLE (table), label, 0, 1, 0, 1, 3, 0, 0, 0);
begw->radius_data = GTK_ADJUSTMENT (gtk_adjustment_new (10.0, 0.0, 100.0, 0.1, 1.0, 0.0));
slider = gtk_hscale_new (begw->radius_data);
@ -341,20 +330,15 @@ brush_edit_generated_new ()
gtk_table_set_col_spacing(GTK_TABLE (table), 0, 3);
gtk_widget_show (table);
/* The action area */
action_items[0].user_data = begw;
build_action_area (GTK_DIALOG (begw->shell), action_items, 1, 0);
gtk_widget_show (vbox);
gtk_widget_show (begw->shell);
return begw;
}
static gint
brush_edit_preview_resize (GtkWidget *widget,
GdkEvent *event,
brush_edit_preview_resize (GtkWidget *widget,
GdkEvent *event,
BrushEditGeneratedWindow *begw)
{
gtk_preview_size (GTK_PREVIEW (begw->preview),
@ -363,14 +347,16 @@ brush_edit_preview_resize (GtkWidget *widget,
/* update the display */
if (begw->brush)
brush_edit_brush_dirty_callback(GIMP_BRUSH(begw->brush), begw);
brush_edit_brush_dirty_callback (GIMP_BRUSH (begw->brush), begw);
return FALSE;
}
static void
brush_edit_close_callback (GtkWidget *w, void *data)
brush_edit_close_callback (GtkWidget *widget,
gpointer data)
{
BrushEditGeneratedWindow *begw = (BrushEditGeneratedWindow *)data;
BrushEditGeneratedWindow *begw = (BrushEditGeneratedWindow *) data;
if (GTK_WIDGET_VISIBLE (begw->shell))
gtk_widget_hide (begw->shell);
}

View File

@ -23,7 +23,6 @@
#endif
#include "appenv.h"
#include "actionarea.h"
#include "brush_scale.h"
#include "gimpbrushgenerated.h"
#include "gimpbrushlist.h"
@ -32,6 +31,7 @@
#include "gimpcontext.h"
#include "gimplist.h"
#include "gimprc.h"
#include "gimpui.h"
#include "brush_edit.h"
#include "brush_select.h"
#include "colormaps.h"
@ -140,12 +140,10 @@ static void paint_mode_menu_callback (GtkWidget *, gpointer);
static gint brush_select_events (GtkWidget *, GdkEvent *, BrushSelectP);
static gint brush_select_resize (GtkWidget *, GdkEvent *, BrushSelectP);
static gint brush_select_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void preview_scroll_update (GtkAdjustment *, gpointer);
static void opacity_scale_update (GtkAdjustment *, gpointer);
static void spacing_scale_update (GtkAdjustment *, gpointer);
/* local variables */
/* List of active dialogs */
@ -154,7 +152,6 @@ GSList *brush_active_dialogs = NULL;
/* Brush editor dialog (main brush dialog only) */
static BrushEditGeneratedWindow *brush_edit_generated_dialog;
/* If title == NULL then it is the main brush dialog */
BrushSelectP
brush_select_new (gchar *title,
@ -184,13 +181,7 @@ brush_select_new (gchar *title,
GimpBrushP active = NULL;
gint gotinitbrush = FALSE;
static ActionAreaItem action_items[] =
{
{ N_("Refresh"), brush_select_refresh_callback, NULL, NULL },
{ N_("Close"), brush_select_close_callback, NULL, NULL }
};
bsp = g_malloc (sizeof (_BrushSelect));
bsp = g_new (_BrushSelect, 1);
bsp->redraw = TRUE;
bsp->scroll_offset = 0;
bsp->callback_name = 0;
@ -205,35 +196,42 @@ brush_select_new (gchar *title,
bsp->freeze = FALSE;
/* The shell and main vbox */
bsp->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (bsp->shell), "brushselection", "Gimp");
if (!title)
if (title)
{
gtk_window_set_title (GTK_WINDOW (bsp->shell), _("Brush Selection"));
bsp->shell = gimp_dialog_new (title, "brush_selection",
gimp_standard_help_func,
"dialogs/brush_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* set dialog's size later because weird thing will happen if the
* size was not saved in the current paint options mode
*/
session_set_window_geometry (bsp->shell, &brush_select_session_info,
FALSE);
}
else
{
gtk_window_set_title (GTK_WINDOW (bsp->shell), title);
_("Close"), brush_select_close_callback,
bsp, NULL, TRUE, TRUE,
NULL);
if (init_name && strlen (init_name))
active = gimp_brush_list_get_brush (brush_list, init_name);
if (active)
gotinitbrush = TRUE;
}
else
{
bsp->shell = gimp_dialog_new (_("Brush Selection"), "brush_selection",
gimp_standard_help_func,
"dialogs/brush_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
gtk_window_set_policy (GTK_WINDOW (bsp->shell), FALSE, TRUE, FALSE);
_("Refresh"), brush_select_refresh_callback,
bsp, NULL, FALSE, FALSE,
_("Close"), brush_select_close_callback,
bsp, NULL, TRUE, TRUE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (bsp->shell), "delete_event",
GTK_SIGNAL_FUNC (brush_select_delete_callback),
bsp);
NULL);
session_set_window_geometry (bsp->shell, &brush_select_session_info,
FALSE);
}
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 0);
@ -425,14 +423,6 @@ brush_select_new (gchar *title,
gtk_widget_show (table);
/* The action area */
action_items[0].user_data = bsp;
action_items[1].user_data = bsp;
if (title)
build_action_area (GTK_DIALOG (bsp->shell), &action_items[1], 1, 0);
else
build_action_area (GTK_DIALOG (bsp->shell), action_items, 2, 1);
gtk_widget_show (bsp->options_box);
gtk_widget_show (hbox);
gtk_widget_show (vbox);
@ -447,7 +437,7 @@ brush_select_new (gchar *title,
display_brushes (bsp);
/* Only for main dialog */
if(!title)
if (!title)
{
/* add callbacks to keep the display area current */
gimp_list_foreach (GIMP_LIST (brush_list),
@ -514,7 +504,6 @@ brush_select_new (gchar *title,
return bsp;
}
void
brush_select_select (BrushSelectP bsp,
GimpBrushP brush)
@ -546,7 +535,6 @@ brush_select_select (BrushSelectP bsp,
brush_select_show_selected (bsp, row, col);
}
void
brush_select_free (BrushSelectP bsp)
{
@ -838,7 +826,6 @@ typedef struct {
GimpBrushP brush;
} popup_timeout_args_t;
static gint
brush_popup_anim_timeout (gpointer data)
{
@ -1104,7 +1091,6 @@ display_brush (BrushSelectP bsp,
}
}
static void
display_setup (BrushSelectP bsp)
{
@ -1156,7 +1142,6 @@ display_brushes (BrushSelectP bsp)
gimp_list_foreach (GIMP_LIST (brush_list), (GFunc) do_display_brush, bsp);
}
static void
brush_select_show_selected (BrushSelectP bsp,
int row,
@ -1246,7 +1231,6 @@ brush_select_show_selected (BrushSelectP bsp,
g_free (buf);
}
static void
preview_calc_scrollbar (BrushSelectP bsp)
{
@ -1343,7 +1327,6 @@ update_active_brush_field (BrushSelectP bsp)
gtk_signal_emit_by_name (GTK_OBJECT (bsp->spacing_data), "value_changed");
}
static void
edit_active_brush ()
{
@ -1508,56 +1491,47 @@ brush_select_events (GtkWidget *widget,
}
static gint
edit_brush_callback (GtkWidget *w,
GdkEvent *e,
edit_brush_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
edit_active_brush();
edit_active_brush ();
return TRUE;
}
static gint
delete_brush_callback (GtkWidget *w,
GdkEvent *e,
delete_brush_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
delete_active_brush(data);
delete_active_brush (data);
return TRUE;
}
static gint
new_brush_callback (GtkWidget *w,
GdkEvent *e,
new_brush_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
GimpBrushGenerated *brush;
brush = gimp_brush_generated_new (10, .5, 0.0, 1.0);
gimp_brush_list_add(brush_list, GIMP_BRUSH (brush));
gimp_brush_list_add (brush_list, GIMP_BRUSH (brush));
select_brush (GIMP_BRUSH (brush));
if (brush_edit_generated_dialog)
brush_edit_generated_set_brush (brush_edit_generated_dialog,
get_active_brush());
edit_brush_callback (w, e, data);
return TRUE;
}
static gint
brush_select_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer data)
{
brush_select_close_callback (w, data);
get_active_brush ());
edit_brush_callback (widget, event, data);
return TRUE;
}
static void
brush_select_close_callback (GtkWidget *w, /* Unused so can be NULL */
gpointer client_data)
brush_select_close_callback (GtkWidget *widget,
gpointer data)
{
BrushSelectP bsp;
bsp = (BrushSelectP) client_data;
bsp = (BrushSelectP) data;
if (GTK_WIDGET_VISIBLE (bsp->shell))
gtk_widget_hide (bsp->shell);
@ -1572,15 +1546,14 @@ brush_select_close_callback (GtkWidget *w, /* Unused so can be NULL */
}
}
static void
brush_select_refresh_callback (GtkWidget *w,
gpointer client_data)
brush_select_refresh_callback (GtkWidget *widget,
gpointer data)
{
BrushSelectP bsp;
GimpBrushP active;
bsp = (BrushSelectP) client_data;
bsp = (BrushSelectP) data;
/* re-init the brush list */
bsp->freeze = TRUE;
@ -1608,7 +1581,6 @@ brush_select_refresh_callback (GtkWidget *w,
gtk_widget_draw (bsp->preview, NULL);
}
static void
preview_scroll_update (GtkAdjustment *adjustment,
gpointer data)
@ -1617,7 +1589,7 @@ preview_scroll_update (GtkAdjustment *adjustment,
GimpBrushP active;
int row, col, index;
bsp = data;
bsp = (BrushSelectP) data;
if (bsp)
{
@ -1645,24 +1617,25 @@ preview_scroll_update (GtkAdjustment *adjustment,
}
static void
paint_mode_menu_callback (GtkWidget *w,
gpointer client_data)
paint_mode_menu_callback (GtkWidget *widget,
gpointer data)
{
BrushSelectP bsp = (BrushSelectP) gtk_object_get_user_data (GTK_OBJECT (w));
BrushSelectP bsp;
bsp = (BrushSelectP) gtk_object_get_user_data (GTK_OBJECT (widget));
if (bsp == brush_select_dialog)
{
gimp_context_set_paint_mode (gimp_context_get_user (),
(int) client_data);
(int) data);
}
else
{
bsp->paint_mode = (int) client_data;
bsp->paint_mode = (int) data;
brush_change_callbacks (bsp, 0);
}
}
static void
opacity_scale_update (GtkAdjustment *adjustment,
gpointer data)

View File

@ -17,7 +17,6 @@
*/
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "actionarea.h"
#include "channels_dialog.h"
#include "colormaps.h"
#include "color_panel.h"
@ -28,6 +27,7 @@
#include "gimage_mask.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "gimpui.h"
#include "interface.h"
#include "layers_dialogP.h"
#include "lc_dialogP.h"
@ -2363,16 +2363,6 @@ new_channel_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
new_channel_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
new_channel_query_cancel_callback (widget, data);
return TRUE;
}
static void
new_channel_query_scale_update (GtkAdjustment *adjustment,
gdouble *scale_val)
@ -2391,12 +2381,6 @@ channels_dialog_new_channel_query (GimpImage* gimage)
GtkWidget *opacity_scale;
GtkObject *opacity_scale_data;
static ActionAreaItem action_items[] =
{
{ N_("OK"), new_channel_query_ok_callback, NULL, NULL },
{ N_("Cancel"), new_channel_query_cancel_callback, NULL, NULL }
};
/* the new options structure */
options = g_new (NewChannelOptions, 1);
options->gimage = gimage;
@ -2404,17 +2388,19 @@ channels_dialog_new_channel_query (GimpImage* gimage)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"new_channel_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("New Channel Options"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("New Channel Options"), "new_channel_options",
gimp_standard_help_func,
"dialogs/channels_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (new_channel_query_delete_callback),
options);
_("OK"), new_channel_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), new_channel_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
@ -2469,11 +2455,6 @@ channels_dialog_new_channel_query (GimpImage* gimage)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
/* The action area */
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 1);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);
@ -2558,16 +2539,6 @@ edit_channel_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
edit_channel_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
edit_channel_query_cancel_callback (widget, data);
return TRUE;
}
static void
channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
{
@ -2580,12 +2551,6 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
GtkObject *opacity_scale_data;
gint i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), edit_channel_query_ok_callback, NULL, NULL },
{ N_("Cancel"), edit_channel_query_cancel_callback, NULL, NULL }
};
/* the new options structure */
options = g_new (EditChannelOptions, 1);
options->channel_widget = channel_widget;
@ -2597,17 +2562,19 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
options->color_panel = color_panel_new (channel_color, 48, 64);
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"edit_channel_atributes", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("Edit Channel Attributes"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Edit Channel Attributes"), "edit_channel_attributes",
gimp_standard_help_func,
"dialogs/channels_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (edit_channel_query_delete_callback),
options);
_("OK"), edit_channel_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), edit_channel_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
@ -2661,11 +2628,6 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
TRUE, TRUE, 0);
gtk_widget_show (options->color_panel->color_panel_widget);
/* The action area */
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (table);
gtk_widget_show (vbox);
gtk_widget_show (hbox);

View File

@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define __COLOR_NOTEBOOK_C__ 1
#include "config.h"
@ -29,28 +28,17 @@
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_notebook.h"
#include "gimpui.h"
#include "libgimp/color_selector.h"
#include "libgimp/gimpintl.h"
static void color_notebook_ok_callback (GtkWidget *, gpointer);
static void color_notebook_ok_callback (GtkWidget *, gpointer);
static void color_notebook_cancel_callback (GtkWidget *, gpointer);
static gint color_notebook_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void color_notebook_update_callback (void *, int, int, int);
static void color_notebook_page_switch (GtkWidget *, GtkNotebookPage *, guint);
static ActionAreaItem action_items[2] =
{
{ N_("OK"), color_notebook_ok_callback, NULL, NULL },
{ N_("Cancel"), color_notebook_cancel_callback, NULL, NULL },
};
/* information we keep on each registered colour selector */
typedef struct _ColorSelectorInfo {
char *name; /* label used in notebook tab */
@ -98,28 +86,33 @@ color_notebook_new (int r,
g_return_val_if_fail (selector_info != NULL, NULL);
cnp = g_malloc (sizeof (_ColorNotebook));
cnp = g_new (_ColorNotebook, 1);
cnp->callback = callback;
cnp->client_data = client_data;
cnp->callback = callback;
cnp->client_data = client_data;
cnp->wants_updates = wants_updates;
cnp->selectors = NULL;
cnp->cur_page = NULL;
cnp->selectors = NULL;
cnp->cur_page = NULL;
cnp->values[RED] = cnp->orig_values[RED] = r & 0xff;
cnp->values[RED] = cnp->orig_values[RED] = r & 0xff;
cnp->values[GREEN] = cnp->orig_values[GREEN] = g & 0xff;
cnp->values[BLUE] = cnp->orig_values[BLUE] = b & 0xff;
cnp->values[BLUE] = cnp->orig_values[BLUE] = b & 0xff;
/* window hints need to stay the same, so people's window manager
* setups still work */
cnp->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (cnp->shell), "color_selection", "Gimp");
gtk_window_set_title (GTK_WINDOW (cnp->shell), _("Color Selection"));
gtk_window_set_policy (GTK_WINDOW (cnp->shell), FALSE, FALSE, FALSE);
cnp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
gimp_standard_help_func,
"dialogs/color_notebook_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (cnp->shell), "delete_event",
(GtkSignalFunc) color_notebook_delete_callback, cnp);
wants_updates ? _("Close") : _("OK"),
color_notebook_ok_callback,
cnp, NULL, TRUE, FALSE,
wants_updates ? _("Revert to Old Color") : _("Cancel"),
color_notebook_cancel_callback,
cnp, NULL, FALSE, TRUE,
NULL);
/* do we actually need a notebook? */
if (selector_info->next)
@ -179,21 +172,6 @@ color_notebook_new (int r,
info = info->next;
}
/* The action area */
action_items[0].user_data = cnp;
action_items[1].user_data = cnp;
if (cnp->wants_updates)
{
action_items[0].label = _("Close");
action_items[1].label = _("Revert to Old Color");
}
else
{
action_items[0].label = _("OK");
action_items[1].label = _("Cancel");
}
build_action_area (GTK_DIALOG (cnp->shell), action_items, 2, 0);
gtk_widget_show (cnp->shell);
/* this must come after showing the widget, otherwise we get a
@ -209,7 +187,6 @@ color_notebook_new (int r,
return cnp;
}
void
color_notebook_show (ColorNotebookP cnp)
{
@ -217,7 +194,6 @@ color_notebook_show (ColorNotebookP cnp)
gtk_widget_show (cnp->shell);
}
void
color_notebook_hide (ColorNotebookP cnp)
{
@ -253,13 +229,12 @@ color_notebook_free (ColorNotebookP cnp)
g_free (cnp);
}
void
color_notebook_set_color (ColorNotebookP cnp,
int r,
int g,
int b,
int set_current)
int r,
int g,
int b,
int set_current)
{
ColorSelectorInstance *csel;
g_return_if_fail (cnp != NULL);
@ -279,11 +254,12 @@ color_notebook_set_color (ColorNotebookP cnp,
csel->info->m.setcolor (csel->selector_data, r, g, b, set_current);
}
/* Called by a colour selector on user selection of a colour */
static void
color_notebook_update_callback (void *data, int r, int g, int b)
color_notebook_update_callback (void *data,
int r,
int g,
int b)
{
ColorSelectorInstance *csel;
ColorNotebookP cnp;
@ -307,16 +283,13 @@ color_notebook_update_callback (void *data, int r, int g, int b)
}
}
static void
color_notebook_ok_callback (GtkWidget *w,
gpointer client_data)
color_notebook_ok_callback (GtkWidget *widget,
gpointer data)
{
ColorNotebookP cnp;
cnp = (ColorNotebookP) client_data;
cnp = (ColorNotebookP) data;
if (cnp->callback)
(* cnp->callback) (cnp->values[RED],
@ -326,25 +299,13 @@ color_notebook_ok_callback (GtkWidget *w,
cnp->client_data);
}
static gint
color_notebook_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
color_notebook_cancel_callback (w, client_data);
return TRUE;
}
static void
color_notebook_cancel_callback (GtkWidget *w,
gpointer client_data)
color_notebook_cancel_callback (GtkWidget *widget,
gpointer data)
{
ColorNotebookP cnp;
cnp = (ColorNotebookP) client_data;
cnp = (ColorNotebookP) data;
if (cnp->callback)
(* cnp->callback) (cnp->orig_values[RED],
@ -355,14 +316,14 @@ color_notebook_cancel_callback (GtkWidget *w,
}
static void
color_notebook_page_switch (GtkWidget *w,
color_notebook_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
guint page_num)
{
ColorNotebookP cnp;
ColorSelectorInstance *csel;
cnp = gtk_object_get_user_data (GTK_OBJECT (w));
cnp = gtk_object_get_user_data (GTK_OBJECT (widget));
csel = gtk_object_get_data (GTK_OBJECT(page->child), "gimp_color_notebook");
g_return_if_fail (cnp != NULL && csel != NULL);
@ -466,5 +427,4 @@ selector_death (ColorSelectorInfo *info)
g_warning ("color selector %p not found, can't happen!", info);
}
/* End of color_notebook.c */

View File

@ -16,16 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_select.h"
#include "colormaps.h"
#include "errors.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "gimpui.h"
#include "session.h"
#include "color_area.h" /* for color_area_draw_rect */
@ -110,7 +112,6 @@ static void color_select_update_colors (ColorSelect *, gint);
static void color_select_ok_callback (GtkWidget *, gpointer);
static void color_select_cancel_callback (GtkWidget *, gpointer);
static gint color_select_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static gint color_select_xy_expose (GtkWidget *, GdkEventExpose *,
ColorSelect *);
static gint color_select_xy_events (GtkWidget *, GdkEvent *,
@ -190,12 +191,6 @@ color_select_new (gint r,
ColorSelect *csp;
GtkWidget *main_vbox;
static ActionAreaItem action_items[] =
{
{ N_("OK"), color_select_ok_callback, NULL, NULL },
{ N_("Cancel"), color_select_cancel_callback, NULL, NULL }
};
csp = g_new (ColorSelect, 1);
csp->callback = callback;
@ -211,37 +206,26 @@ color_select_new (gint r,
color_select_update_hsv_values (csp);
color_select_update_pos (csp);
csp->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (csp->shell), "color_selection", "Gimp");
gtk_window_set_title (GTK_WINDOW (csp->shell), _("Color Selection"));
gtk_window_set_policy (GTK_WINDOW (csp->shell), FALSE, FALSE, FALSE);
csp->shell =
gimp_dialog_new (_("Color Selection"), "color_selection",
gimp_standard_help_func,
"dialogs/color_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, FALSE,
wants_updates ? _("Close") : _("OK"),
color_select_ok_callback,
csp, NULL, TRUE, FALSE,
wants_updates ? _("Revert to Old Color") : _("Cancel"),
color_select_cancel_callback,
csp, NULL, FALSE, TRUE,
/* handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (csp->shell), "delete_event",
(GtkSignalFunc) color_select_delete_callback, csp);
NULL);
main_vbox = color_select_widget_new (csp, r, g, b);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (csp->shell)->vbox), main_vbox);
gtk_widget_show (main_vbox);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (csp->shell)->vbox), main_vbox,
TRUE, TRUE, 0);
/* The action area */
action_items[0].user_data = csp;
action_items[1].user_data = csp;
if (csp->wants_updates)
{
action_items[0].label = _("Close");
action_items[1].label = _("Revert to Old Color");
}
else
{
action_items[0].label = _("OK");
action_items[1].label = _("Cancel");
}
build_action_area (GTK_DIALOG (csp->shell), action_items, 2, 0);
color_select_image_fill (csp->z_color, csp->z_color_fill, csp->values);
color_select_image_fill (csp->xy_color, csp->xy_color_fill, csp->values);
@ -997,16 +981,6 @@ color_select_ok_callback (GtkWidget *widget,
}
}
static gint
color_select_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
color_select_cancel_callback (widget, data);
return TRUE;
}
static void
color_select_cancel_callback (GtkWidget *widget,
gpointer data)

View File

@ -35,13 +35,14 @@
#include "gdisplay_ops.h"
#include "gdisplay_color_ui.h"
#include "gimage_mask.h"
#include "gimphelp.h"
#include "gimprc.h"
#include "gimpui.h"
#include "global_edit.h"
#include "gradient.h"
#include "image_render.h"
#include "info_window.h"
#include "nav_window.h"
#include "interface.h"
#include "invert.h"
#include "lc_dialog.h"
#include "layer_select.h"
@ -74,7 +75,6 @@ extern void layers_dialog_layer_merge_query (GImage *, gboolean);
static void image_resize_callback (GtkWidget *, gpointer);
static void image_scale_callback (GtkWidget *, gpointer);
static void image_cancel_callback (GtkWidget *, gpointer);
static gint image_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void gimage_mask_feather_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_border_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
@ -345,54 +345,69 @@ void
select_border_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Border Selection"),
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Border Selection"),
gimp_standard_help_func,
"dialogs/border_selection_dialog.html",
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_feather_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Feather Selection"),
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Feather Selection"),
gimp_standard_help_func,
"dialogs/feather_selection_dialog.html",
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_grow_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Grow Selection"),
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Grow Selection"),
gimp_standard_help_func,
"dialogs/grow_selection_dialog.html",
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
@ -405,15 +420,18 @@ select_shrink_cmd_callback (GtkWidget *widget,
GDisplay * gdisp;
return_if_no_display (gdisp);
shrink_dialog = query_size_box (N_("Shrink Selection"),
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
shrink_dialog =
gimp_query_size_box (N_("Shrink Selection"),
gimp_standard_help_func,
"dialogs/shrink_selection_dialog.html",
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
/* eeek */
@ -810,7 +828,6 @@ image_resize_cmd_callback (GtkWidget *widget,
gdisp->dot_for_dot,
image_resize_callback,
image_cancel_callback,
image_delete_callback,
image_resize);
gtk_widget_show (image_resize->resize->resize_shell);
@ -842,7 +859,6 @@ image_scale_cmd_callback (GtkWidget *widget,
gdisp->dot_for_dot,
image_scale_callback,
image_cancel_callback,
image_delete_callback,
image_scale);
gtk_widget_show (image_scale->resize->resize_shell);
@ -1175,6 +1191,13 @@ about_dialog_cmd_callback (GtkWidget *widget,
about_dialog_create (FALSE);
}
void
gimp_help_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gimp_help ("");
}
void
tips_dialog_cmd_callback (GtkWidget *widget,
gpointer client_data)
@ -1284,17 +1307,6 @@ image_scale_callback (GtkWidget *widget,
g_free (image_scale);
}
static gint
image_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
image_cancel_callback (widget, client_data);
return TRUE;
}
static void
image_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -109,6 +109,7 @@ void dialogs_error_console_cmd_callback (GtkWidget *, gpointer);
void dialogs_module_browser_cmd_callback (GtkWidget *, gpointer);
void dialogs_display_filters_cmd_callback (GtkWidget *, gpointer);
void about_dialog_cmd_callback (GtkWidget *, gpointer);
void gimp_help_cmd_callback (GtkWidget *, gpointer);
void tips_dialog_cmd_callback (GtkWidget *, gpointer);
#endif /* __COMMANDS_H__ */

View File

@ -15,19 +15,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include <string.h>
#include <stdio.h>
#include "appenv.h"
#include "actionarea.h"
#include "gimpcontextpreview.h"
#include "gimpdnd.h"
#include "devices.h"
#include "interface.h"
#include "gimprc.h"
#include "gimpui.h"
#include "palette.h"
#include "session.h"
#include "tools.h"
@ -63,7 +62,7 @@ struct _DeviceInfo {
GimpBrushP brush;
GPatternP pattern;
ToolType tool;
unsigned char foreground[3];
guchar foreground[3];
};
typedef struct _DeviceInfoDialog DeviceInfoDialog;
@ -115,13 +114,6 @@ static void device_status_drop_pattern (GtkWidget *,
/* Global data */
int current_device = GDK_CORE_POINTER;
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("Save"), (ActionCallback)devices_write_rc, NULL, NULL },
{ N_("Close"), devices_close_callback, NULL, NULL }
};
/* dnd stuff */
static GtkTargetEntry color_area_target_table[] =
{
@ -151,17 +143,17 @@ create_input_dialog (void)
if (!inputd)
{
inputd = gtk_input_dialog_new();
inputd = gtk_input_dialog_new ();
/* register this one only */
dialog_register(inputd);
dialog_register (inputd);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX (hbbox), 4);
hbbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
@ -170,46 +162,52 @@ create_input_dialog (void)
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->save_button),
gtk_signal_connect (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->save_button),
"clicked",
GTK_SIGNAL_FUNC(devices_write_rc), NULL);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button),
GTK_SIGNAL_FUNC (devices_write_rc), NULL);
gtk_signal_connect (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
"clicked",
GTK_SIGNAL_FUNC(devices_close_callback), inputd);
GTK_SIGNAL_FUNC (devices_close_callback), inputd);
gtk_signal_connect (GTK_OBJECT(inputd), "destroy",
(GtkSignalFunc)input_dialog_destroy_callback,
gtk_signal_connect (GTK_OBJECT (inputd), "destroy",
(GtkSignalFunc) input_dialog_destroy_callback,
&inputd);
gtk_signal_connect (GTK_OBJECT(inputd), "enable_device",
GTK_SIGNAL_FUNC(input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT(inputd), "disable_device",
GTK_SIGNAL_FUNC(input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT (inputd), "enable_device",
GTK_SIGNAL_FUNC (input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT (inputd), "disable_device",
GTK_SIGNAL_FUNC (input_dialog_able_callback), NULL);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (inputd,
gimp_standard_help_func,
"dialogs/input_devices_dialog.html");
gtk_widget_show (inputd);
}
else
{
if (!GTK_WIDGET_MAPPED(inputd))
gtk_widget_show(inputd);
if (!GTK_WIDGET_MAPPED (inputd))
gtk_widget_show (inputd);
else
gdk_window_raise(inputd->window);
gdk_window_raise (inputd->window);
}
}
void
input_dialog_able_callback (GtkWidget *w,
guint32 deviceid,
input_dialog_able_callback (GtkWidget *widget,
guint32 deviceid,
gpointer data)
{
device_status_update (deviceid);
}
static void
input_dialog_destroy_callback (GtkWidget *w,
input_dialog_destroy_callback (GtkWidget *widget,
gpointer call_data)
{
*((GtkWidget **)call_data) = NULL;
@ -223,7 +221,7 @@ devices_init (void)
/* Create device info structures for present devices */
tmp_list = gdk_input_list_devices ();
while (tmp_list)
{
GdkDeviceInfo *gdk_info = (GdkDeviceInfo *)tmp_list->data;
@ -528,7 +526,7 @@ devices_save_current_info (void)
device_info->is_init = TRUE;
device_info->device = current_device;
device_info->brush = get_active_brush ();
device_info->pattern = get_active_pattern();
device_info->pattern = get_active_pattern ();
if (active_tool)
device_info->tool = active_tool->type;
else
@ -539,7 +537,7 @@ devices_save_current_info (void)
}
static void
devices_write_rc_device (DeviceInfo *device_info,
devices_write_rc_device (DeviceInfo *device_info,
FILE *fp)
{
GdkDeviceInfo *gdk_info;
@ -552,7 +550,7 @@ devices_write_rc_device (DeviceInfo *device_info,
{
/* gdk_input_list_devices returns an internal list, so we shouldn't
free it afterwards */
tmp_list = gdk_input_list_devices();
tmp_list = gdk_input_list_devices ();
while (tmp_list)
{
GdkDeviceInfo *info = (GdkDeviceInfo *)tmp_list->data;
@ -566,7 +564,7 @@ devices_write_rc_device (DeviceInfo *device_info,
}
}
fprintf(fp, "(device \"%s\"",device_info->name);
fprintf (fp, "(device \"%s\"",device_info->name);
switch (gdk_info ? gdk_info->mode : device_info->mode)
{
@ -581,9 +579,10 @@ devices_write_rc_device (DeviceInfo *device_info,
break;
}
fprintf(fp, "\n (mode %s)",mode);
fprintf (fp, "\n (mode %s)", mode);
fprintf(fp, "\n (axes %d",gdk_info ? gdk_info->num_axes : device_info->num_axes);
fprintf (fp, "\n (axes %d",
gdk_info ? gdk_info->num_axes : device_info->num_axes);
for (i=0; i<(gdk_info ? gdk_info->num_axes : device_info->num_axes); i++)
{
@ -615,19 +614,20 @@ devices_write_rc_device (DeviceInfo *device_info,
break;
#endif /* GTK_HAVE_SIX_VALUATORS */
}
fprintf(fp, " %s",axis_type);
fprintf (fp, " %s",axis_type);
}
fprintf(fp,")");
fprintf (fp,")");
fprintf(fp, "\n (keys %d", gdk_info ? gdk_info->num_keys : device_info->num_keys);
fprintf (fp, "\n (keys %d",
gdk_info ? gdk_info->num_keys : device_info->num_keys);
for (i=0; i<(gdk_info ? gdk_info->num_keys : device_info->num_keys); i++)
for (i=0; i < (gdk_info ? gdk_info->num_keys : device_info->num_keys); i++)
{
GdkModifierType modifiers = gdk_info ? gdk_info->keys[i].modifiers :
device_info->keys[i].modifiers;
guint keyval = gdk_info ? gdk_info->keys[i].keyval :
device_info->keys[i].keyval;
if (keyval)
{
/* FIXME: integrate this back with menus_install_accelerator */
@ -650,22 +650,22 @@ devices_write_rc_device (DeviceInfo *device_info,
else
fprintf (fp, " \"\"");
}
fprintf(fp,")");
fprintf (fp,")");
if (device_info->is_init)
{
if (device_info->brush)
fprintf(fp, "\n (brush \"%s\")",device_info->brush->name);
fprintf (fp, "\n (brush \"%s\")",device_info->brush->name);
if (device_info->pattern)
fprintf(fp, "\n (pattern \"%s\")",device_info->pattern->name);
fprintf (fp, "\n (pattern \"%s\")",device_info->pattern->name);
/* Fixme: hard coded last tool.... see gimprc */
if (device_info->tool && device_info->tool <= LAST_TOOLBOX_TOOL)
fprintf(fp, "\n (tool \"%s\")",
tool_info[device_info->tool].tool_name);
fprintf(fp, "\n (foreground %d %d %d)",
device_info->foreground[0],
device_info->foreground[1],
device_info->foreground[2]);
fprintf (fp, "\n (tool \"%s\")",
tool_info[device_info->tool].tool_name);
fprintf (fp, "\n (foreground %d %d %d)",
device_info->foreground[0],
device_info->foreground[1],
device_info->foreground[2]);
}
fprintf(fp,")\n");
@ -702,18 +702,25 @@ create_device_status (void)
if (deviceD == NULL)
{
deviceD = g_new (DeviceInfoDialog, 1);
deviceD->shell = gtk_dialog_new ();
deviceD->shell =
gimp_dialog_new (_("Device Status"), "device_status",
gimp_standard_help_func,
"dialogs/device_status_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, TRUE,
_("Save"), (GtkSignalFunc) devices_write_rc,
NULL, NULL, FALSE, FALSE,
_("Close"), devices_close_callback,
NULL, NULL, TRUE, TRUE,
NULL);
/* register this one only */
dialog_register(deviceD->shell);
gtk_window_set_title (GTK_WINDOW(deviceD->shell), _("Device Status"));
gtk_window_set_policy (GTK_WINDOW (deviceD->shell), FALSE, FALSE, TRUE);
/* don't set the dialog's size, as the number of devices may have
* changed since the last session
*/
session_set_window_geometry (deviceD->shell,
&device_status_session_info, FALSE);
dialog_register (deviceD->shell);
session_set_window_geometry (deviceD->shell, &device_status_session_info,
FALSE);
deviceD->num_devices = 0;
tmp_list = devices_info;
@ -723,10 +730,10 @@ create_device_status (void)
deviceD->num_devices++;
tmp_list = tmp_list->next;
}
/* devices table */
/* devices table */
deviceD->table = gtk_table_new (deviceD->num_devices, 5, FALSE);
gtk_container_set_border_width (GTK_CONTAINER(deviceD->table), 3);
gtk_container_add (GTK_CONTAINER(GTK_DIALOG(deviceD->shell)->vbox),
gtk_container_set_border_width (GTK_CONTAINER (deviceD->table), 3);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (deviceD->shell)->vbox),
deviceD->table);
gtk_widget_realize (deviceD->table);
gtk_widget_show (deviceD->table);
@ -841,9 +848,6 @@ create_device_status (void)
i++;
}
action_items[1].user_data = deviceD->shell;
build_action_area (GTK_DIALOG (deviceD->shell), action_items, 2, 1);
deviceD->current = 0xffffffff; /* random, but doesn't matter */
device_status_update_current ();
@ -878,7 +882,7 @@ device_status_destroy_callback (void)
}
static void
devices_close_callback (GtkWidget *w,
devices_close_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (GTK_WIDGET(data));

View File

@ -15,11 +15,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "file_new_dialog.h"
#include "actionarea.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gdisplay.h"
#include "libgimp/gimpchainbutton.h"
@ -27,7 +25,8 @@
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpintl.h"
typedef struct {
typedef struct
{
GtkWidget *dlg;
GtkWidget *confirm_dlg;
@ -50,7 +49,6 @@ static void file_new_confirm_dialog (NewImageInfo *);
static void file_new_ok_callback (GtkWidget *, gpointer);
static void file_new_reset_callback (GtkWidget *, gpointer);
static gint file_new_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void file_new_cancel_callback (GtkWidget *, gpointer);
static void file_new_toggle_callback (GtkWidget *, gpointer);
static void file_new_resolution_callback (GtkWidget *, gpointer);
@ -136,15 +134,6 @@ file_new_reset_callback (GtkWidget *widget,
(GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE);
}
static gint
file_new_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
file_new_cancel_callback (widget, data);
return TRUE;
}
static void
file_new_cancel_callback (GtkWidget *widget,
gpointer data)
@ -185,15 +174,6 @@ file_new_confirm_dialog_cancel_callback (GtkWidget *widget,
gtk_widget_set_sensitive (info->dlg, TRUE);
}
static gint
file_new_confirm_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
file_new_confirm_dialog_cancel_callback (widget, data);
return TRUE;
}
static void
file_new_confirm_dialog (NewImageInfo *info)
{
@ -202,32 +182,21 @@ file_new_confirm_dialog (NewImageInfo *info)
gchar *max_size;
gchar *text;
static ActionAreaItem action_items[] =
{
{ N_("OK"),
(ActionCallback) file_new_confirm_dialog_ok_callback, NULL, NULL },
{ N_("Cancel"),
(ActionCallback) file_new_confirm_dialog_cancel_callback, NULL, NULL }
};
gtk_widget_set_sensitive (info->dlg, FALSE);
info->confirm_dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (info->confirm_dlg),
"confirm_size", "Gimp");
gtk_window_set_title (GTK_WINDOW (info->confirm_dlg), _("Confirm Image Size"));
gtk_window_set_policy (GTK_WINDOW (info->confirm_dlg), FALSE, FALSE, FALSE);
gtk_window_position (GTK_WINDOW (info->confirm_dlg), GTK_WIN_POS_MOUSE);
info->confirm_dlg =
gimp_dialog_new (_("Confirm Image Size"), "confirm_size",
gimp_standard_help_func,
"dialogs/file_new_dialog.html#confirm_size_dialog",
GTK_WIN_POS_MOUSE,
FALSE, FALSE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (info->confirm_dlg), "delete_event",
(GtkSignalFunc) file_new_confirm_dialog_delete_callback,
info);
_("OK"), file_new_confirm_dialog_ok_callback,
info, NULL, TRUE, FALSE,
_("Cancel"), file_new_confirm_dialog_cancel_callback,
info, NULL, FALSE, TRUE,
/* The action area */
action_items[0].user_data = info;
action_items[1].user_data = info;
build_action_area (GTK_DIALOG (info->confirm_dlg), action_items, 2, 0);
NULL);
size = image_new_get_size_string (info->size);
max_size = image_new_get_size_string (max_new_image_size);
@ -326,15 +295,14 @@ file_new_image_size_callback (GtkWidget *widget,
gpointer data)
{
NewImageInfo *info;
gdouble width, height;
gchar *text;
gchar *label;
info = (NewImageInfo*) data;
width = (gdouble) (gint)
info->values->width = (gdouble) (gint)
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (info->size_se), 0) + 0.5);
height = (gdouble) (gint)
info->values->height = (gdouble) (gint)
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (info->size_se), 1) + 0.5);
info->size = image_new_calculate_size (info->values);
@ -391,35 +359,26 @@ ui_new_image_window_create (const GimpImageNewValues *values_orig)
GSList *group;
GList *list;
static ActionAreaItem action_items[] =
{
{ N_("OK"), file_new_ok_callback, NULL, NULL },
{ N_("Reset"), file_new_reset_callback, NULL, NULL },
{ N_("Cancel"), file_new_cancel_callback, NULL, NULL }
};
info = g_new (NewImageInfo, 1);
info->values = values = image_new_values_new (values_orig);
info->confirm_dlg = NULL;
info->size = 0.0;
info->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (info->dlg), "new_image", "Gimp");
gtk_window_set_title (GTK_WINDOW (info->dlg), _("New Image"));
gtk_window_set_position (GTK_WINDOW (info->dlg), GTK_WIN_POS_MOUSE);
gtk_window_set_policy(GTK_WINDOW (info->dlg), FALSE, FALSE, TRUE);
info->dlg = gimp_dialog_new (_("New Image"), "new_image",
gimp_standard_help_func,
"dialogs/file_new_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, FALSE, TRUE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (info->dlg), "delete_event",
GTK_SIGNAL_FUNC (file_new_delete_callback),
info);
_("OK"), file_new_ok_callback,
info, NULL, FALSE, FALSE,
_("Reset"), file_new_reset_callback,
info, NULL, FALSE, FALSE,
_("Cancel"), file_new_cancel_callback,
info, NULL, TRUE, TRUE,
/* The action area */
action_items[0].user_data = info;
action_items[1].user_data = info;
action_items[2].user_data = info;
build_action_area (GTK_DIALOG (info->dlg), action_items, 3, 2);
NULL);
/* vbox holding the rest of the dialog */
top_vbox = gtk_vbox_new (FALSE, 2);

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* This is the popup for the gradient selection stuff..
* idea is a cut down version of the gradient selection widget
* just a clist on which each gradient can be selected.
@ -28,7 +27,6 @@
* setting the slection all need to be done as well.
*/
/* Main structure for the dialog. There can be multiple of these
* so every thing has to go into the strcuture and we have to have a list
* the structures so we can find which one we are taking about.
@ -48,123 +46,125 @@
#include "colormaps.h"
#include "cursorutil.h"
#include "datafiles.h"
#include "dialog_handler.h"
#include "errors.h"
#include "general.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gradient.h"
#include "gradient_header.h"
#include "indicator_area.h"
#include "interface.h"
#include "palette.h"
#include "session.h"
#include "actionarea.h"
#include "dialog_handler.h"
#include "libgimp/gimpintl.h"
GSList *grad_active_dialogs = NULL; /* List of active dialogs */
GradSelectP gradient_select_dialog = NULL; /* The main selection dialog */
static void grad_select_close_callback (GtkWidget *, gpointer);
static void grad_select_close_callback (GtkWidget *, gpointer);
static void grad_select_edit_callback (GtkWidget *, gpointer);
static void grad_change_callbacks(GradSelectP gsp, gint closing);
extern void import_palette_grad_update(gradient_t *); /* ALT Hmm... */
static ActionAreaItem action_items[2] =
{
{ N_("Edit"), grad_select_edit_callback, NULL, NULL },
{ N_("Close"), grad_select_close_callback, NULL, NULL }
};
static void grad_change_callbacks (GradSelectP gsp, gint closing);
extern void import_palette_grad_update (gradient_t *); /* ALT Hmm... */
void
grad_free_gradient_editor(void)
grad_free_gradient_editor (void)
{
if (gradient_select_dialog)
session_get_window_info (gradient_select_dialog->shell, &gradient_select_session_info);
} /* grad_free_gradient_editor */
session_get_window_info (gradient_select_dialog->shell,
&gradient_select_session_info);
}
void
grad_sel_rename_all(gint n, gradient_t *grad)
grad_sel_rename_all (gint n,
gradient_t *grad)
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_set_text(GTK_CLIST(gsp->clist),n,1,grad->name);
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_set_text (GTK_CLIST (gsp->clist), n, 1, grad->name);
list = g_slist_next (list);
}
if(gradient_select_dialog)
{
gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),n,1,grad->name);
gtk_clist_set_text (GTK_CLIST (gradient_select_dialog->clist),
n, 1, grad->name);
}
}
void
grad_sel_new_all(gint pos, gradient_t *grad)
grad_sel_new_all (gint pos,
gradient_t *grad)
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_freeze (GTK_CLIST (gsp->clist));
ed_insert_in_gradients_listbox (gsp->gc, gsp->clist, grad, pos, 1);
gtk_clist_thaw (GTK_CLIST (gsp->clist));
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_freeze (GTK_CLIST (gradient_select_dialog->clist));
ed_insert_in_gradients_listbox (gradient_select_dialog->gc,
gradient_select_dialog->clist,
grad, pos, 1);
gtk_clist_thaw (GTK_CLIST (gradient_select_dialog->clist));
}
}
void
grad_sel_copy_all(gint pos, gradient_t *grad)
grad_sel_copy_all (gint pos,
gradient_t *grad)
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_freeze (GTK_CLIST (gsp->clist));
ed_insert_in_gradients_listbox (gsp->gc, gsp->clist, grad, pos, 1);
gtk_clist_thaw (GTK_CLIST (gsp->clist));
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_freeze (GTK_CLIST (gradient_select_dialog->clist));
ed_insert_in_gradients_listbox (gradient_select_dialog->gc,
gradient_select_dialog->clist,
grad, pos, 1);
gtk_clist_thaw (GTK_CLIST (gradient_select_dialog->clist));
}
}
void
grad_sel_delete_all(gint n)
grad_sel_delete_all (gint n)
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_remove(GTK_CLIST(gsp->clist), n);
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_remove (GTK_CLIST (gsp->clist), n);
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gtk_clist_remove(GTK_CLIST(gradient_select_dialog->clist), n);
gtk_clist_remove (GTK_CLIST (gradient_select_dialog->clist), n);
}
}
@ -174,117 +174,119 @@ grad_sel_free_all()
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
gtk_clist_clear(GTK_CLIST(gsp->clist));
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
gsp = (GradSelectP) list->data;
gtk_clist_freeze (GTK_CLIST (gsp->clist));
gtk_clist_clear (GTK_CLIST (gsp->clist));
gtk_clist_thaw (GTK_CLIST (gsp->clist));
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_clear(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
gtk_clist_freeze (GTK_CLIST (gradient_select_dialog->clist));
gtk_clist_clear (GTK_CLIST (gradient_select_dialog->clist));
gtk_clist_thaw (GTK_CLIST (gradient_select_dialog->clist));
}
}
void
grad_sel_refill_all()
grad_sel_refill_all ()
{
GSList *list = grad_active_dialogs;
GradSelectP gsp;
int select_pos = -1;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gsp = (GradSelectP) list->data;
gsp->grad = curr_gradient;
select_pos = ed_set_list_of_gradients(gsp->gc,
gsp->clist,
curr_gradient);
if(select_pos != -1)
gtk_clist_moveto(GTK_CLIST(gsp->clist),select_pos,0,0.0,0.0);
list = g_slist_next(list);
select_pos = ed_set_list_of_gradients (gsp->gc,
gsp->clist,
curr_gradient);
if (select_pos != -1)
gtk_clist_moveto (GTK_CLIST (gsp->clist), select_pos, 0, 0.0, 0.0);
list = g_slist_next (list);
}
if(gradient_select_dialog)
if (gradient_select_dialog)
{
gradient_select_dialog->grad = curr_gradient;
select_pos = ed_set_list_of_gradients(gradient_select_dialog->gc,
gradient_select_dialog->clist,
curr_gradient);
if(select_pos != -1)
gtk_clist_moveto(GTK_CLIST(gradient_select_dialog->clist),select_pos,0,0.0,0.0);
select_pos = ed_set_list_of_gradients (gradient_select_dialog->gc,
gradient_select_dialog->clist,
curr_gradient);
if (select_pos != -1)
gtk_clist_moveto (GTK_CLIST (gradient_select_dialog->clist),
select_pos, 0, 0.0, 0.0);
}
}
void
sel_update_dialogs(gint row, gradient_t *grad)
sel_update_dialogs (gint row,
gradient_t *grad)
{
/* Go around each updating the names and hopefully the previews */
GSList *list = grad_active_dialogs;
GradSelectP gsp;
while(list)
while (list)
{
gsp = (GradSelectP)list->data;
gtk_clist_set_text(GTK_CLIST(gsp->clist),row,1,grad->name);
gsp = (GradSelectP) list->data;
gtk_clist_set_text (GTK_CLIST (gsp->clist), row, 1, grad->name);
/* Are we updating one that is selected in a popup dialog? */
if(grad == gsp->grad)
grad_change_callbacks(gsp, 0);
list = g_slist_next(list);
if (grad == gsp->grad)
grad_change_callbacks (gsp, 0);
list = g_slist_next (list);
}
if(gradient_select_dialog)
gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),row,1,grad->name);
if (gradient_select_dialog)
gtk_clist_set_text (GTK_CLIST (gradient_select_dialog->clist),
row, 1, grad->name);
gradient_area_update (); /* update the indicator_area */
import_palette_grad_update(grad);
import_palette_grad_update (grad);
}
static void
sel_list_item_update(GtkWidget *widget,
gint row,
gint column,
GdkEventButton *event,
gpointer data)
sel_list_item_update (GtkWidget *widget,
gint row,
gint column,
GdkEventButton *event,
gpointer data)
{
GradSelectP gsp = (GradSelectP)data;
GradSelectP gsp = (GradSelectP) data;
GSList* tmp = g_slist_nth(gradients_list,row);
gsp->grad = (gradient_t *)(tmp->data);
GSList* tmp = g_slist_nth (gradients_list, row);
gsp->grad = (gradient_t *) (tmp->data);
/* If main one then make it the current selection */
if(gsp == gradient_select_dialog)
if (gsp == gradient_select_dialog)
{
grad_set_grad_to_name(gsp->grad->name);
grad_set_grad_to_name (gsp->grad->name);
gradient_area_update (); /* update the indicator_area */
import_palette_grad_update(gsp->grad);
import_palette_grad_update (gsp->grad);
}
else
{
grad_change_callbacks(gsp, 0);
grad_change_callbacks (gsp, 0);
}
}
static void
grad_select_edit_callback (GtkWidget *w,
grad_select_edit_callback (GtkWidget *widget,
gpointer client_data)
{
GradSelectP gsp;
gsp = (GradSelectP) client_data;
grad_create_gradient_editor_init(TRUE);
grad_create_gradient_editor_init (TRUE);
/* Set the current gradient in this dialog to the "real current"*/
if(gsp && gsp->grad)
grad_set_grad_to_name(gsp->grad->name);
/* Set the current gradient in this dialog to the "real current"*/
if (gsp && gsp->grad)
grad_set_grad_to_name (gsp->grad->name);
}
void
@ -292,21 +294,19 @@ grad_select_free (GradSelectP gsp)
{
if (gsp)
{
if(gsp->callback_name)
g_free(gsp->callback_name);
if (gsp->callback_name)
g_free (gsp->callback_name);
/* remove from active list */
grad_active_dialogs = g_slist_remove(grad_active_dialogs,gsp);
grad_active_dialogs = g_slist_remove (grad_active_dialogs, gsp);
g_free (gsp);
}
}
/* Close active dialogs that no longer have PDB registered for them */
void
gradients_check_dialogs(void)
gradients_check_dialogs (void)
{
GSList *list;
GradSelectP gsp;
@ -321,21 +321,21 @@ gradients_check_dialogs(void)
list = list->next;
name = gsp->callback_name;
prec = procedural_db_lookup(name);
if(!prec)
prec = procedural_db_lookup (name);
if (!prec)
{
grad_active_dialogs = g_slist_remove(grad_active_dialogs,gsp);
grad_active_dialogs = g_slist_remove (grad_active_dialogs, gsp);
/* Can alter grad_active_dialogs list*/
grad_select_close_callback(NULL,gsp);
grad_select_close_callback (NULL, gsp);
}
}
}
static void
grad_change_callbacks(GradSelectP gsp, gint closing)
grad_change_callbacks(GradSelectP gsp,
gint closing)
{
gchar * name;
ProcRecord *prec = NULL;
@ -346,8 +346,8 @@ grad_change_callbacks(GradSelectP gsp, gint closing)
/* Any procs registered to callback? */
Argument *return_vals;
if(!gsp || !gsp->callback_name || busy != 0)
if (!gsp || !gsp->callback_name || busy != 0)
return;
busy = 1;
@ -355,9 +355,9 @@ grad_change_callbacks(GradSelectP gsp, gint closing)
grad = gsp->grad;
/* If its still registered run it */
prec = procedural_db_lookup(name);
prec = procedural_db_lookup (name);
if(prec && grad)
if (prec && grad)
{
gdouble *values, *pv;
double pos, delta;
@ -366,30 +366,31 @@ grad_change_callbacks(GradSelectP gsp, gint closing)
pos = 0.0;
delta = 1.0 / (i - 1);
values = g_malloc(i * 4 * sizeof(gdouble));
values = g_new (gdouble, 4 * i);
pv = values;
curr_gradient = grad;
while (i--) {
grad_get_color_at(pos, &r, &g, &b, &a);
*pv++ = r;
*pv++ = g;
*pv++ = b;
*pv++ = a;
pos += delta;
} /* while */
while (i--)
{
grad_get_color_at (pos, &r, &g, &b, &a);
*pv++ = r;
*pv++ = g;
*pv++ = b;
*pv++ = a;
pos += delta;
}
curr_gradient = oldgrad;
return_vals = procedural_db_run_proc (name,
&nreturn_vals,
PDB_STRING,grad->name,
PDB_INT32,gsp->sample_size*4,
PDB_FLOATARRAY,values,
PDB_INT32,closing,
PDB_STRING, grad->name,
PDB_INT32, gsp->sample_size*4,
PDB_FLOATARRAY, values,
PDB_INT32, closing,
PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
@ -401,7 +402,7 @@ grad_change_callbacks(GradSelectP gsp, gint closing)
}
static void
grad_select_close_callback (GtkWidget *w,
grad_select_close_callback (GtkWidget *widget,
gpointer client_data)
{
GradSelectP gsp;
@ -420,18 +421,9 @@ grad_select_close_callback (GtkWidget *w,
}
}
static gint
grad_select_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data)
{
grad_select_close_callback (w, client_data);
return TRUE;
}
GradSelectP
gsel_new_selection (gchar * title,
gchar * initial_gradient)
gsel_new_selection (gchar *title,
gchar *initial_gradient)
{
GradSelectP gsp;
gradient_t *grad = NULL;
@ -448,23 +440,27 @@ gsel_new_selection (gchar * title,
grad_create_gradient_editor_init(FALSE);
}
gsp = g_malloc (sizeof (_GradSelect));
gsp = g_new (_GradSelect, 1);
gsp->callback_name = NULL;
/* The shell and main vbox */
gsp->shell = gtk_dialog_new ();
gsp->shell = gimp_dialog_new (title ? title : _("Gradient Selection"),
"gradient_selection",
gimp_standard_help_func,
"dialogs/gradient_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
gtk_window_set_wmclass (GTK_WINDOW (gsp->shell), "gradselection", "Gimp");
gtk_window_set_policy (GTK_WINDOW (gsp->shell), FALSE, TRUE, FALSE);
_("Edit"), grad_select_edit_callback,
gsp, NULL, FALSE, FALSE,
_("Close"), grad_select_close_callback,
gsp, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (gsp->shell)->vbox), vbox, TRUE, TRUE, 0);
/* handle the wm close event */
gtk_signal_connect (GTK_OBJECT (gsp->shell), "delete_event",
GTK_SIGNAL_FUNC (grad_select_delete_callback),
gsp);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gsp->shell)->vbox), vbox);
/* clist preview of gradients */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
@ -498,23 +494,10 @@ gsel_new_selection (gchar * title,
gdk_color_parse ("black", &gsp->black);
gdk_color_alloc (colormap, &gsp->black);
gtk_signal_connect (GTK_OBJECT(gsp->clist), "select_row",
GTK_SIGNAL_FUNC(sel_list_item_update),
gtk_signal_connect (GTK_OBJECT (gsp->clist), "select_row",
GTK_SIGNAL_FUNC (sel_list_item_update),
(gpointer) gsp);
action_items[0].user_data = gsp;
action_items[1].user_data = gsp;
build_action_area (GTK_DIALOG (gsp->shell), action_items, 2, 1);
if(!title)
{
gtk_window_set_title (GTK_WINDOW (gsp->shell), _("Gradient Selection"));
}
else
{
gtk_window_set_title (GTK_WINDOW (gsp->shell), title);
}
if (initial_gradient && strlen (initial_gradient))
{
list = gradients_list;
@ -547,31 +530,32 @@ gsel_new_selection (gchar * title,
gtk_widget_show (gsp->shell);
if (select_pos != -1)
gtk_clist_moveto (GTK_CLIST(gsp->clist),select_pos,0,0.0,0.0);
gtk_clist_moveto (GTK_CLIST (gsp->clist), select_pos, 0, 0.0, 0.0);
return gsp;
}
void
grad_create_gradient_editor(void)
grad_create_gradient_editor (void)
{
if(gradient_select_dialog == NULL)
if (gradient_select_dialog == NULL)
{
gradient_select_dialog = gsel_new_selection(_("Gradients"),NULL);
gradient_select_dialog = gsel_new_selection (_("Gradients"), NULL);
/* register this one only */
dialog_register(gradient_select_dialog->shell);
dialog_register (gradient_select_dialog->shell);
session_set_window_geometry (gradient_select_dialog->shell, &gradient_select_session_info, TRUE);
session_set_window_geometry (gradient_select_dialog->shell,
&gradient_select_session_info, TRUE);
}
else
{
if (!GTK_WIDGET_VISIBLE(gradient_select_dialog->shell))
if (!GTK_WIDGET_VISIBLE (gradient_select_dialog->shell))
{
gtk_widget_show(gradient_select_dialog->shell);
gtk_widget_show (gradient_select_dialog->shell);
}
else
gdk_window_raise(gradient_select_dialog->shell->window);
gdk_window_raise (gradient_select_dialog->shell->window);
return;
}
}

View File

@ -35,13 +35,14 @@
#include "gdisplay_ops.h"
#include "gdisplay_color_ui.h"
#include "gimage_mask.h"
#include "gimphelp.h"
#include "gimprc.h"
#include "gimpui.h"
#include "global_edit.h"
#include "gradient.h"
#include "image_render.h"
#include "info_window.h"
#include "nav_window.h"
#include "interface.h"
#include "invert.h"
#include "lc_dialog.h"
#include "layer_select.h"
@ -74,7 +75,6 @@ extern void layers_dialog_layer_merge_query (GImage *, gboolean);
static void image_resize_callback (GtkWidget *, gpointer);
static void image_scale_callback (GtkWidget *, gpointer);
static void image_cancel_callback (GtkWidget *, gpointer);
static gint image_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void gimage_mask_feather_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_border_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
@ -345,54 +345,69 @@ void
select_border_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Border Selection"),
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Border Selection"),
gimp_standard_help_func,
"dialogs/border_selection_dialog.html",
_("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_feather_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Feather Selection"),
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Feather Selection"),
gimp_standard_help_func,
"dialogs/feather_selection_dialog.html",
_("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
select_grow_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GtkWidget *qbox;
GDisplay *gdisp;
return_if_no_display (gdisp);
gtk_widget_show (query_size_box (_("Grow Selection"),
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage));
qbox = gimp_query_size_box (_("Grow Selection"),
gimp_standard_help_func,
"dialogs/grow_selection_dialog.html",
_("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
gtk_widget_show (qbox);
}
void
@ -405,15 +420,18 @@ select_shrink_cmd_callback (GtkWidget *widget,
GDisplay * gdisp;
return_if_no_display (gdisp);
shrink_dialog = query_size_box (N_("Shrink Selection"),
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
shrink_dialog =
gimp_query_size_box (N_("Shrink Selection"),
gimp_standard_help_func,
"dialogs/shrink_selection_dialog.html",
N_("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
/* eeek */
@ -810,7 +828,6 @@ image_resize_cmd_callback (GtkWidget *widget,
gdisp->dot_for_dot,
image_resize_callback,
image_cancel_callback,
image_delete_callback,
image_resize);
gtk_widget_show (image_resize->resize->resize_shell);
@ -842,7 +859,6 @@ image_scale_cmd_callback (GtkWidget *widget,
gdisp->dot_for_dot,
image_scale_callback,
image_cancel_callback,
image_delete_callback,
image_scale);
gtk_widget_show (image_scale->resize->resize_shell);
@ -1175,6 +1191,13 @@ about_dialog_cmd_callback (GtkWidget *widget,
about_dialog_create (FALSE);
}
void
gimp_help_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gimp_help ("");
}
void
tips_dialog_cmd_callback (GtkWidget *widget,
gpointer client_data)
@ -1284,17 +1307,6 @@ image_scale_callback (GtkWidget *widget,
g_free (image_scale);
}
static gint
image_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
image_cancel_callback (widget, client_data);
return TRUE;
}
static void
image_cancel_callback (GtkWidget *widget,
gpointer client_data)

View File

@ -109,6 +109,7 @@ void dialogs_error_console_cmd_callback (GtkWidget *, gpointer);
void dialogs_module_browser_cmd_callback (GtkWidget *, gpointer);
void dialogs_display_filters_cmd_callback (GtkWidget *, gpointer);
void about_dialog_cmd_callback (GtkWidget *, gpointer);
void gimp_help_cmd_callback (GtkWidget *, gpointer);
void tips_dialog_cmd_callback (GtkWidget *, gpointer);
#endif /* __COMMANDS_H__ */

View File

@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
@ -143,8 +142,10 @@ info_dialog_delete_callback (GtkWidget *widget,
}
static InfoDialog *
info_dialog_new_extended (gchar *title,
gboolean in_notebook)
info_dialog_new_extended (gchar *title,
GimpHelpFunc help_func,
gpointer help_data,
gboolean in_notebook)
{
InfoDialog *idialog;
GtkWidget *shell;
@ -171,7 +172,7 @@ info_dialog_new_extended (gchar *title,
info_table = gtk_table_new (2, 0, FALSE);
if( in_notebook)
if (in_notebook)
{
info_notebook = gtk_notebook_new ();
gtk_notebook_append_page (GTK_NOTEBOOK (info_notebook),
@ -196,21 +197,28 @@ info_dialog_new_extended (gchar *title,
gtk_widget_show (idialog->info_table);
gtk_widget_show (idialog->vbox);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (idialog->shell, help_func, help_data);
return idialog;
}
/* public functions */
InfoDialog *
info_dialog_notebook_new (gchar *title)
info_dialog_notebook_new (gchar *title,
GimpHelpFunc help_func,
gpointer help_data)
{
return info_dialog_new_extended (title, TRUE);
return info_dialog_new_extended (title, help_func, help_data, TRUE);
}
InfoDialog *
info_dialog_new (gchar *title)
info_dialog_new (gchar *title,
GimpHelpFunc help_func,
gpointer help_data)
{
return info_dialog_new_extended (title, FALSE);
return info_dialog_new_extended (title, help_func, help_data, FALSE);
}
void
@ -236,7 +244,6 @@ info_dialog_free (InfoDialog *idialog)
g_free (idialog);
}
void
info_dialog_popup (InfoDialog *idialog)
{

View File

@ -18,7 +18,9 @@
#ifndef __INFO_DIALOG_H__
#define __INFO_DIALOG_H__
#include "gtk/gtk.h"
#include <gtk/gtk.h>
#include "gimphelp.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimpunit.h"
@ -61,8 +63,12 @@ struct _InfoDialog
/* Info Dialog functions */
InfoDialog *info_dialog_new (gchar *title);
InfoDialog *info_dialog_notebook_new (gchar *title);
InfoDialog *info_dialog_new (gchar *title,
GimpHelpFunc help_func,
gpointer help_data);
InfoDialog *info_dialog_notebook_new (gchar *title,
GimpHelpFunc help_func,
gpointer help_data);
void info_dialog_free (InfoDialog *idialog);
void info_dialog_popup (InfoDialog *idialog);

View File

@ -15,8 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "appenv.h"
#include "actionarea.h"
#include "colormaps.h"
@ -283,10 +283,12 @@ info_window_create (void *gdisp_ptr)
/* create the info dialog */
title_buf = g_strdup_printf (_("%s: Window Info"), title);
info_win = info_dialog_notebook_new (title_buf);
info_win = info_dialog_notebook_new (title_buf,
gimp_standard_help_func,
"dialogs/info_window.html");
g_free (title_buf);
iwd = (InfoWinData *) g_malloc (sizeof (InfoWinData));
iwd = g_new (InfoWinData, 1);
info_win->user_data = iwd;
iwd->dimensions_str[0] = '\0';
iwd->resolution_str[0] = '\0';

View File

@ -15,19 +15,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include <string.h>
#include <stdio.h>
#include "appenv.h"
#include "actionarea.h"
#include "gimpcontextpreview.h"
#include "gimpdnd.h"
#include "devices.h"
#include "interface.h"
#include "gimprc.h"
#include "gimpui.h"
#include "palette.h"
#include "session.h"
#include "tools.h"
@ -63,7 +62,7 @@ struct _DeviceInfo {
GimpBrushP brush;
GPatternP pattern;
ToolType tool;
unsigned char foreground[3];
guchar foreground[3];
};
typedef struct _DeviceInfoDialog DeviceInfoDialog;
@ -115,13 +114,6 @@ static void device_status_drop_pattern (GtkWidget *,
/* Global data */
int current_device = GDK_CORE_POINTER;
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("Save"), (ActionCallback)devices_write_rc, NULL, NULL },
{ N_("Close"), devices_close_callback, NULL, NULL }
};
/* dnd stuff */
static GtkTargetEntry color_area_target_table[] =
{
@ -151,17 +143,17 @@ create_input_dialog (void)
if (!inputd)
{
inputd = gtk_input_dialog_new();
inputd = gtk_input_dialog_new ();
/* register this one only */
dialog_register(inputd);
dialog_register (inputd);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(inputd)->action_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX (hbbox), 4);
hbbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
@ -170,46 +162,52 @@ create_input_dialog (void)
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->save_button),
gtk_signal_connect (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->save_button),
"clicked",
GTK_SIGNAL_FUNC(devices_write_rc), NULL);
gtk_signal_connect (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button),
GTK_SIGNAL_FUNC (devices_write_rc), NULL);
gtk_signal_connect (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
"clicked",
GTK_SIGNAL_FUNC(devices_close_callback), inputd);
GTK_SIGNAL_FUNC (devices_close_callback), inputd);
gtk_signal_connect (GTK_OBJECT(inputd), "destroy",
(GtkSignalFunc)input_dialog_destroy_callback,
gtk_signal_connect (GTK_OBJECT (inputd), "destroy",
(GtkSignalFunc) input_dialog_destroy_callback,
&inputd);
gtk_signal_connect (GTK_OBJECT(inputd), "enable_device",
GTK_SIGNAL_FUNC(input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT(inputd), "disable_device",
GTK_SIGNAL_FUNC(input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT (inputd), "enable_device",
GTK_SIGNAL_FUNC (input_dialog_able_callback), NULL);
gtk_signal_connect (GTK_OBJECT (inputd), "disable_device",
GTK_SIGNAL_FUNC (input_dialog_able_callback), NULL);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (inputd,
gimp_standard_help_func,
"dialogs/input_devices_dialog.html");
gtk_widget_show (inputd);
}
else
{
if (!GTK_WIDGET_MAPPED(inputd))
gtk_widget_show(inputd);
if (!GTK_WIDGET_MAPPED (inputd))
gtk_widget_show (inputd);
else
gdk_window_raise(inputd->window);
gdk_window_raise (inputd->window);
}
}
void
input_dialog_able_callback (GtkWidget *w,
guint32 deviceid,
input_dialog_able_callback (GtkWidget *widget,
guint32 deviceid,
gpointer data)
{
device_status_update (deviceid);
}
static void
input_dialog_destroy_callback (GtkWidget *w,
input_dialog_destroy_callback (GtkWidget *widget,
gpointer call_data)
{
*((GtkWidget **)call_data) = NULL;
@ -223,7 +221,7 @@ devices_init (void)
/* Create device info structures for present devices */
tmp_list = gdk_input_list_devices ();
while (tmp_list)
{
GdkDeviceInfo *gdk_info = (GdkDeviceInfo *)tmp_list->data;
@ -528,7 +526,7 @@ devices_save_current_info (void)
device_info->is_init = TRUE;
device_info->device = current_device;
device_info->brush = get_active_brush ();
device_info->pattern = get_active_pattern();
device_info->pattern = get_active_pattern ();
if (active_tool)
device_info->tool = active_tool->type;
else
@ -539,7 +537,7 @@ devices_save_current_info (void)
}
static void
devices_write_rc_device (DeviceInfo *device_info,
devices_write_rc_device (DeviceInfo *device_info,
FILE *fp)
{
GdkDeviceInfo *gdk_info;
@ -552,7 +550,7 @@ devices_write_rc_device (DeviceInfo *device_info,
{
/* gdk_input_list_devices returns an internal list, so we shouldn't
free it afterwards */
tmp_list = gdk_input_list_devices();
tmp_list = gdk_input_list_devices ();
while (tmp_list)
{
GdkDeviceInfo *info = (GdkDeviceInfo *)tmp_list->data;
@ -566,7 +564,7 @@ devices_write_rc_device (DeviceInfo *device_info,
}
}
fprintf(fp, "(device \"%s\"",device_info->name);
fprintf (fp, "(device \"%s\"",device_info->name);
switch (gdk_info ? gdk_info->mode : device_info->mode)
{
@ -581,9 +579,10 @@ devices_write_rc_device (DeviceInfo *device_info,
break;
}
fprintf(fp, "\n (mode %s)",mode);
fprintf (fp, "\n (mode %s)", mode);
fprintf(fp, "\n (axes %d",gdk_info ? gdk_info->num_axes : device_info->num_axes);
fprintf (fp, "\n (axes %d",
gdk_info ? gdk_info->num_axes : device_info->num_axes);
for (i=0; i<(gdk_info ? gdk_info->num_axes : device_info->num_axes); i++)
{
@ -615,19 +614,20 @@ devices_write_rc_device (DeviceInfo *device_info,
break;
#endif /* GTK_HAVE_SIX_VALUATORS */
}
fprintf(fp, " %s",axis_type);
fprintf (fp, " %s",axis_type);
}
fprintf(fp,")");
fprintf (fp,")");
fprintf(fp, "\n (keys %d", gdk_info ? gdk_info->num_keys : device_info->num_keys);
fprintf (fp, "\n (keys %d",
gdk_info ? gdk_info->num_keys : device_info->num_keys);
for (i=0; i<(gdk_info ? gdk_info->num_keys : device_info->num_keys); i++)
for (i=0; i < (gdk_info ? gdk_info->num_keys : device_info->num_keys); i++)
{
GdkModifierType modifiers = gdk_info ? gdk_info->keys[i].modifiers :
device_info->keys[i].modifiers;
guint keyval = gdk_info ? gdk_info->keys[i].keyval :
device_info->keys[i].keyval;
if (keyval)
{
/* FIXME: integrate this back with menus_install_accelerator */
@ -650,22 +650,22 @@ devices_write_rc_device (DeviceInfo *device_info,
else
fprintf (fp, " \"\"");
}
fprintf(fp,")");
fprintf (fp,")");
if (device_info->is_init)
{
if (device_info->brush)
fprintf(fp, "\n (brush \"%s\")",device_info->brush->name);
fprintf (fp, "\n (brush \"%s\")",device_info->brush->name);
if (device_info->pattern)
fprintf(fp, "\n (pattern \"%s\")",device_info->pattern->name);
fprintf (fp, "\n (pattern \"%s\")",device_info->pattern->name);
/* Fixme: hard coded last tool.... see gimprc */
if (device_info->tool && device_info->tool <= LAST_TOOLBOX_TOOL)
fprintf(fp, "\n (tool \"%s\")",
tool_info[device_info->tool].tool_name);
fprintf(fp, "\n (foreground %d %d %d)",
device_info->foreground[0],
device_info->foreground[1],
device_info->foreground[2]);
fprintf (fp, "\n (tool \"%s\")",
tool_info[device_info->tool].tool_name);
fprintf (fp, "\n (foreground %d %d %d)",
device_info->foreground[0],
device_info->foreground[1],
device_info->foreground[2]);
}
fprintf(fp,")\n");
@ -702,18 +702,25 @@ create_device_status (void)
if (deviceD == NULL)
{
deviceD = g_new (DeviceInfoDialog, 1);
deviceD->shell = gtk_dialog_new ();
deviceD->shell =
gimp_dialog_new (_("Device Status"), "device_status",
gimp_standard_help_func,
"dialogs/device_status_dialog.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, TRUE,
_("Save"), (GtkSignalFunc) devices_write_rc,
NULL, NULL, FALSE, FALSE,
_("Close"), devices_close_callback,
NULL, NULL, TRUE, TRUE,
NULL);
/* register this one only */
dialog_register(deviceD->shell);
gtk_window_set_title (GTK_WINDOW(deviceD->shell), _("Device Status"));
gtk_window_set_policy (GTK_WINDOW (deviceD->shell), FALSE, FALSE, TRUE);
/* don't set the dialog's size, as the number of devices may have
* changed since the last session
*/
session_set_window_geometry (deviceD->shell,
&device_status_session_info, FALSE);
dialog_register (deviceD->shell);
session_set_window_geometry (deviceD->shell, &device_status_session_info,
FALSE);
deviceD->num_devices = 0;
tmp_list = devices_info;
@ -723,10 +730,10 @@ create_device_status (void)
deviceD->num_devices++;
tmp_list = tmp_list->next;
}
/* devices table */
/* devices table */
deviceD->table = gtk_table_new (deviceD->num_devices, 5, FALSE);
gtk_container_set_border_width (GTK_CONTAINER(deviceD->table), 3);
gtk_container_add (GTK_CONTAINER(GTK_DIALOG(deviceD->shell)->vbox),
gtk_container_set_border_width (GTK_CONTAINER (deviceD->table), 3);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (deviceD->shell)->vbox),
deviceD->table);
gtk_widget_realize (deviceD->table);
gtk_widget_show (deviceD->table);
@ -841,9 +848,6 @@ create_device_status (void)
i++;
}
action_items[1].user_data = deviceD->shell;
build_action_area (GTK_DIALOG (deviceD->shell), action_items, 2, 1);
deviceD->current = 0xffffffff; /* random, but doesn't matter */
device_status_update_current ();
@ -878,7 +882,7 @@ device_status_destroy_callback (void)
}
static void
devices_close_callback (GtkWidget *w,
devices_close_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (GTK_WIDGET(data));

View File

@ -18,7 +18,6 @@
#include <stdlib.h>
#include <string.h>
#include "gdk/gdkkeysyms.h"
#include "actionarea.h"
#include "appenv.h"
#include "buildmenu.h"
#include "colormaps.h"
@ -30,6 +29,7 @@
#include "gimage_mask.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "gimpui.h"
#include "image_render.h"
#include "interface.h"
#include "layers_dialog.h"
@ -3256,16 +3256,6 @@ new_layer_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
new_layer_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
new_layer_query_cancel_callback (widget, data);
return TRUE;
}
static void
new_layer_query_fill_type_callback (GtkWidget *widget,
gpointer data)
@ -3293,11 +3283,6 @@ layers_dialog_new_layer_query (GimpImage* gimage)
GSList *group;
gint i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), new_layer_query_ok_callback, NULL, NULL },
{ N_("Cancel"), new_layer_query_cancel_callback, NULL, NULL }
};
static gchar *button_names[] =
{
N_("Foreground"),
@ -3313,16 +3298,19 @@ layers_dialog_new_layer_query (GimpImage* gimage)
options->gimage = gimage;
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"new_layer_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box), _("New Layer Options"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("New Layer Options"), "new_layer_options",
gimp_standard_help_func,
"dialogs/layers_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (new_layer_query_delete_callback),
options);
_("OK"), new_layer_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), new_layer_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
@ -3439,10 +3427,6 @@ layers_dialog_new_layer_query (GimpImage* gimage)
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}
@ -3506,16 +3490,6 @@ edit_layer_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
edit_layer_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
edit_layer_query_cancel_callback (widget, data);
return TRUE;
}
static void
layers_dialog_edit_layer_query (LayerWidget *layer_widget)
{
@ -3524,29 +3498,25 @@ layers_dialog_edit_layer_query (LayerWidget *layer_widget)
GtkWidget *hbox;
GtkWidget *label;
static ActionAreaItem action_items[] =
{
{ N_("OK"), edit_layer_query_ok_callback, NULL, NULL },
{ N_("Cancel"), edit_layer_query_cancel_callback, NULL, NULL }
};
/* The new options structure */
options = g_new (EditLayerOptions, 1);
options->layer = layer_widget->layer;
options->gimage = layer_widget->gimage;
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"edit_layer_attrributes", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box),
_("Edit Layer Attributes"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Edit Layer Attributes"), "edit_layer_attributes",
gimp_standard_help_func,
"dialogs/layers_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (edit_layer_query_delete_callback),
options);
_("OK"), edit_layer_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), edit_layer_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
@ -3572,10 +3542,6 @@ layers_dialog_edit_layer_query (LayerWidget *layer_widget)
gtk_widget_show (hbox);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}
@ -3626,16 +3592,6 @@ add_mask_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
add_mask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
add_mask_query_cancel_callback (widget, data);
return TRUE;
}
static void
add_mask_query_fill_type_callback (GtkWidget *widget,
gpointer data)
@ -3659,11 +3615,6 @@ layers_dialog_add_mask_query (Layer *layer)
GSList *group = NULL;
gint i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), add_mask_query_ok_callback, NULL, NULL },
{ N_("Cancel"), add_mask_query_cancel_callback, NULL, NULL }
};
static gchar *button_names[] =
{
N_("White (Full Opacity)"),
@ -3678,15 +3629,19 @@ layers_dialog_add_mask_query (Layer *layer)
options->add_mask_type = ADD_WHITE_MASK;
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "add_mask_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box), _("Add Mask Options"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Add Mask Options"), "add_mask_options",
gimp_standard_help_func,
"dialogs/layers_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (add_mask_query_delete_callback),
options);
_("OK"), add_mask_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), add_mask_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
@ -3719,10 +3674,6 @@ layers_dialog_add_mask_query (Layer *layer)
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}
@ -3778,16 +3729,6 @@ apply_mask_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
apply_mask_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
apply_mask_query_cancel_callback (widget, data);
return TRUE;
}
static void
layers_dialog_apply_mask_query (Layer *layer)
{
@ -3795,27 +3736,26 @@ layers_dialog_apply_mask_query (Layer *layer)
GtkWidget *vbox;
GtkWidget *label;
static ActionAreaItem action_items[] =
{
{ N_("Apply"), apply_mask_query_apply_callback, NULL, NULL },
{ N_("Discard"), apply_mask_query_discard_callback, NULL, NULL },
{ N_("Cancel"), apply_mask_query_cancel_callback, NULL, NULL }
};
/* The new options structure */
options = g_new (ApplyMaskOptions, 1);
options->layer = layer;
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "layer_mask_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box), _("Layer Mask Options"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Layer Mask Options"), "layer_mask_options",
gimp_standard_help_func,
"dialogs/layers_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (apply_mask_query_delete_callback),
options);
_("Apply"), apply_mask_query_apply_callback,
options, NULL, TRUE, FALSE,
_("Discard"), apply_mask_query_discard_callback,
options, NULL, FALSE, FALSE,
_("Cancel"), apply_mask_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
@ -3828,11 +3768,6 @@ layers_dialog_apply_mask_query (Layer *layer)
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
action_items[0].user_data = options;
action_items[1].user_data = options;
action_items[2].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 3, 0);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}
@ -3898,16 +3833,6 @@ scale_layer_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
scale_layer_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
scale_layer_query_cancel_callback (widget, data);
return TRUE;
}
static void
layers_dialog_scale_layer_query (GImage *gimage,
Layer *layer)
@ -3928,7 +3853,6 @@ layers_dialog_scale_layer_query (GImage *gimage,
TRUE,
scale_layer_query_ok_callback,
scale_layer_query_cancel_callback,
scale_layer_query_delete_callback,
options);
gtk_widget_show (options->resize->resize_shell);
@ -3997,16 +3921,6 @@ resize_layer_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
resize_layer_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
resize_layer_query_cancel_callback (widget, data);
return TRUE;
}
static void
layers_dialog_resize_layer_query (GImage *gimage,
Layer *layer)
@ -4027,7 +3941,6 @@ layers_dialog_resize_layer_query (GImage *gimage,
TRUE,
resize_layer_query_ok_callback,
resize_layer_query_cancel_callback,
resize_layer_query_delete_callback,
options);
gtk_widget_show (options->resize->resize_shell);
@ -4077,16 +3990,6 @@ layer_merge_query_cancel_callback (GtkWidget *widget,
g_free (options);
}
static gint
layer_merge_query_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
layer_merge_query_cancel_callback (widget, data);
return TRUE;
}
static void
layer_merge_query_type_callback (GtkWidget *widget,
gpointer data)
@ -4112,11 +4015,6 @@ layers_dialog_layer_merge_query (GImage *gimage,
GSList *group = NULL;
gint i;
static ActionAreaItem action_items[] =
{
{ N_("OK"), layer_merge_query_ok_callback, NULL, NULL },
{ N_("Cancel"), layer_merge_query_cancel_callback, NULL, NULL }
};
static gchar *button_names[] =
{
N_("Expanded as necessary"),
@ -4132,15 +4030,19 @@ layers_dialog_layer_merge_query (GImage *gimage,
options->merge_type = EXPAND_AS_NECESSARY;
/* The dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "layer_merge_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box), _("Layer Merge Options"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
options->query_box =
gimp_dialog_new (_("Layer Merge Options"), "layer_merge_options",
gimp_standard_help_func,
"dialogs/layers_dialog.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
/* Handle the wm close signal */
gtk_signal_connect (GTK_OBJECT (options->query_box), "delete_event",
GTK_SIGNAL_FUNC (layer_merge_query_delete_callback),
options);
_("OK"), layer_merge_query_ok_callback,
options, NULL, TRUE, FALSE,
_("Cancel"), layer_merge_query_cancel_callback,
options, NULL, FALSE, TRUE,
NULL);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
@ -4176,10 +4078,6 @@ layers_dialog_layer_merge_query (GImage *gimage,
gtk_widget_show (radio_box);
gtk_widget_show (radio_frame);
action_items[0].user_data = options;
action_items[1].user_data = options;
build_action_area (GTK_DIALOG (options->query_box), action_items, 2, 0);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}

View File

@ -69,6 +69,7 @@ static GtkItemFactoryEntry toolbox_entries[] =
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
{ N_("/File/Acquire"), NULL, NULL, 0, "<Branch>" },
{ N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
{ N_("/File/Help..."), NULL, gimp_help_cmd_callback, 0 },
{ N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
{ N_("/File/Tip of the day"), NULL, tips_dialog_cmd_callback, 0 },

View File

@ -36,10 +36,10 @@
#include "gimpsignal.h"
#include "gimprc.h"
#include "datafiles.h"
#include "actionarea.h"
#include "gimpset.h"
#include "libgimp/gimpenv.h"
#include "gimpui.h"
#include "libgimp/gimpenv.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"
@ -258,19 +258,21 @@ module_db_browser_new (void)
GtkWidget *listbox;
GtkWidget *button;
browser_st *st;
ActionAreaItem action_items[] =
{
{ N_("OK"), browser_popdown_callback, NULL, NULL }
};
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
gimp_standard_help_func,
"dialogs/module_db_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (shell), "module_db_dialog", "Gimp");
gtk_window_set_title (GTK_WINDOW (shell), _("Module DB"));
_("OK"), browser_popdown_callback,
NULL, NULL, TRUE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
gtk_widget_show (vbox);
listbox = gtk_scrolled_window_new (NULL, NULL);
@ -333,12 +335,6 @@ module_db_browser_new (void)
gtk_signal_connect (GTK_OBJECT (shell), "destroy",
browser_destroy_callback, st);
action_items[0].user_data = shell;
build_action_area (GTK_DIALOG (shell),
action_items,
sizeof( action_items)/sizeof( ActionAreaItem),
0);
return shell;
}

View File

@ -31,7 +31,6 @@
#include <sys/stat.h>
#include <sys/types.h>
#include "appenv.h"
#include "actionarea.h"
#include "buildmenu.h"
#include "colormaps.h"
#include "color_area.h"
@ -41,9 +40,9 @@
#include "errors.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gradient_header.h"
#include "gradient.h"
#include "interface.h"
#include "palette.h"
#include "palette_entries.h"
#include "session.h"
@ -1075,11 +1074,16 @@ static void
palette_new_entries_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_show (query_string_box (_("New Palette"),
_("Enter a name for new palette"),
NULL,
NULL, NULL,
palette_add_entries_callback, data));
GtkWidget *qbox;
qbox = gimp_query_string_box (_("New Palette"),
gimp_standard_help_func,
"dialogs/color_palette_edit_dialog.html",
_("Enter a name for new palette"),
NULL,
NULL, NULL,
palette_add_entries_callback, data);
gtk_widget_show (qbox);
}
static void
@ -1375,17 +1379,6 @@ palette_close_callback (GtkWidget *widget,
}
}
static gint
palette_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
palette_close_callback (widget, data);
return TRUE;
}
static void
color_name_entry_changed (GtkWidget *widget,
gpointer data)
@ -2015,18 +2008,6 @@ create_palette_dialog (gint vert)
GdkPixmap *pixmap;
GdkBitmap *mask;
GtkStyle *style;
static ActionAreaItem vert_action_items[] =
{
{ N_("Edit"), palette_edit_palette_callback, NULL, NULL },
{ N_("Close"), palette_close_callback, NULL, NULL }
};
static ActionAreaItem horz_action_items[] =
{
{ N_("Save"), palette_save_palettes_callback, NULL, NULL },
{ N_("Refresh"), palette_refresh_callback, NULL, NULL },
{ N_("Close"), palette_close_callback, NULL, NULL }
};
palette = g_new (PaletteDialog, 1);
@ -2039,26 +2020,42 @@ create_palette_dialog (gint vert)
palette->columns_valid = TRUE;
palette->freeze_update = FALSE;
palette->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (palette->shell), "color_palette", "Gimp");
if (!vert)
{
palette->shell =
gimp_dialog_new (_("Color Palette Edit"), "color_palette_edit",
gimp_standard_help_func,
"dialogs/color_palette_edit_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("Save"), palette_save_palettes_callback,
palette, NULL, FALSE, FALSE,
_("Refresh"), palette_refresh_callback,
palette, NULL, FALSE, FALSE,
_("Close"), palette_close_callback,
palette, NULL, TRUE, TRUE,
NULL);
gtk_widget_set_usize (palette->shell, 615, 200);
gtk_window_set_title (GTK_WINDOW (palette->shell),
_("Color Palette Edit"));
}
else
{
gtk_widget_set_usize (palette->shell, 230, 300);
gtk_window_set_title (GTK_WINDOW (palette->shell),
_("Color Palette"));
}
palette->shell =
gimp_dialog_new (_("Color Palette"), "color_palette",
gimp_standard_help_func,
"dialogs/color_palette_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* Handle the wm delete event */
gtk_signal_connect (GTK_OBJECT (palette->shell), "delete_event",
GTK_SIGNAL_FUNC (palette_dialog_delete_callback),
palette);
_("Edit"), palette_edit_palette_callback,
palette, NULL, FALSE, FALSE,
_("Close"), palette_close_callback,
palette, NULL, TRUE, TRUE,
NULL);
gtk_widget_set_usize (palette->shell, 230, 300);
}
/* The main container widget */
if (vert)
@ -2260,20 +2257,6 @@ create_palette_dialog (gint vert)
gtk_widget_show (button);
}
if (!vert)
{
horz_action_items[0].user_data = palette;
horz_action_items[1].user_data = palette;
horz_action_items[2].user_data = palette;
build_action_area (GTK_DIALOG (palette->shell), horz_action_items, 3, 2);
}
else
{
vert_action_items[0].user_data = palette;
vert_action_items[1].user_data = palette;
build_action_area (GTK_DIALOG (palette->shell), vert_action_items, 2, 1);
}
palette->gc = gdk_gc_new (palette->shell->window);
palette_popup_menu (palette);
@ -2441,17 +2424,6 @@ import_dialog_import_callback (GtkWidget *widget,
}
}
static gint
import_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
import_dialog_close_callback (widget, data);
return TRUE;
}
static void
palette_merge_entries_callback (GtkWidget *widget,
gpointer data,
@ -2508,12 +2480,17 @@ static void
palette_merge_dialog_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_show (query_string_box (_("Merge Palette"),
_("Enter a name for merged palette"),
NULL,
NULL, NULL,
palette_merge_entries_callback,
data));
GtkWidget *qbox;
qbox = gimp_query_string_box (_("Merge Palette"),
gimp_standard_help_func,
"dialogs/color_palette_edit_dialog.html",
_("Enter a name for merged palette"),
NULL,
NULL, NULL,
palette_merge_entries_callback,
data);
gtk_widget_show (qbox);
}
static void
@ -2845,24 +2822,23 @@ palette_import_dialog (PaletteDialog *palette)
GtkWidget *image;
GtkWidget *hscale;
static ActionAreaItem action_items[] =
{
{ N_("Import"), import_dialog_import_callback, NULL, NULL },
{ N_("Close"), import_dialog_close_callback, NULL, NULL }
};
import_dialog = g_new (ImportDialog, 1);
import_dialog->image_list = NULL;
import_dialog->gimage = NULL;
import_dialog->dialog = dialog = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (dialog), "import_palette", "Gimp");
gtk_window_set_title (GTK_WINDOW (dialog), _("Import Palette"));
import_dialog->dialog = dialog =
gimp_dialog_new (_("Import Palette"), "import_palette",
gimp_standard_help_func,
"dialogs/import_palette_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
/* Handle the wm delete event */
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
GTK_SIGNAL_FUNC (import_dialog_delete_callback),
(gpointer)palette);
_("Import"), import_dialog_import_callback,
palette, NULL, FALSE, FALSE,
_("Close"), import_dialog_close_callback,
palette, NULL, TRUE, TRUE,
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
@ -2986,11 +2962,6 @@ palette_import_dialog (PaletteDialog *palette)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
/* The action area */
action_items[0].user_data = palette;
action_items[1].user_data = palette;
build_action_area (GTK_DIALOG (dialog), action_items, 2, 1);
/* Fill with the selected gradient */
palette_import_fill_grad_preview (image, curr_gradient);
import_dialog->import_type = GRAD_IMPORT;

View File

@ -16,7 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
@ -27,13 +26,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "actionarea.h"
#include "colormaps.h"
#include "color_area.h"
#include "color_select.h"
#include "datafiles.h"
#include "errors.h"
#include "gimprc.h"
#include "gimpui.h"
#include "interface.h"
#include "palette.h"
#include "palette_entries.h"
@ -49,12 +48,6 @@ static GSList *active_dialogs = NULL;
static void palette_select_close_callback (GtkWidget *, gpointer);
static void palette_select_edit_callback (GtkWidget *, gpointer);
static ActionAreaItem action_items[] =
{
{ N_("Edit"), palette_select_edit_callback, NULL, NULL },
{ N_("Close"), palette_select_close_callback, NULL, NULL }
};
void
palette_select_set_text_all (PaletteEntriesP entries)
{
@ -219,16 +212,6 @@ palette_select_close_callback (GtkWidget *widget,
/* } */
}
static gint
palette_select_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer client_data)
{
palette_select_close_callback (widget, client_data);
return TRUE;
}
PaletteSelectP
palette_new_selection (gchar *title,
gchar *initial_palette)
@ -244,29 +227,33 @@ palette_new_selection (gchar *title,
palette_select_palette_init ();
psp = g_malloc (sizeof (struct _PaletteSelect));
psp = g_new (struct _PaletteSelect, 1);
psp->callback_name = NULL;
/* The shell and main vbox */
psp->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (psp->shell), "paletteselection", "Gimp");
gtk_window_set_policy (GTK_WINDOW (psp->shell), FALSE, TRUE, FALSE);
psp->shell = gimp_dialog_new (title ? title : _("Palette Selection"),
"palette_selection",
gimp_standard_help_func,
"dialogs/palette_selection_dialog.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("Edit"), palette_select_edit_callback,
psp, NULL, TRUE, FALSE,
_("Close"), palette_select_close_callback,
psp, NULL, FALSE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (psp->shell)->vbox), vbox, TRUE, TRUE, 0);
/* handle the wm close event */
gtk_signal_connect (GTK_OBJECT (psp->shell), "delete_event",
GTK_SIGNAL_FUNC (palette_select_delete_callback),
psp);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox), vbox);
/* clist preview of gradients */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
psp->clist = gtk_clist_new (3);
gtk_clist_set_shadow_type (GTK_CLIST(psp->clist), GTK_SHADOW_IN);
gtk_clist_set_shadow_type (GTK_CLIST (psp->clist), GTK_SHADOW_IN);
gtk_clist_set_row_height (GTK_CLIST (psp->clist), SM_PREVIEW_HEIGHT + 2);
@ -275,10 +262,9 @@ palette_new_selection (gchar *title,
gtk_clist_set_column_title (GTK_CLIST (psp->clist), 1, _("Ncols"));
gtk_clist_set_column_title (GTK_CLIST (psp->clist), 2, _("Name"));
gtk_clist_column_titles_show (GTK_CLIST(psp->clist));
gtk_clist_set_column_width (GTK_CLIST (psp->clist), 0, SM_PREVIEW_WIDTH+2);
gtk_clist_set_column_width (GTK_CLIST (psp->clist), 0, SM_PREVIEW_WIDTH + 2);
hbox = gtk_hbox_new (FALSE, 8);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@ -295,19 +281,6 @@ palette_new_selection (gchar *title,
/* GTK_SIGNAL_FUNC(sel_list_item_update), */
/* (gpointer) gsp); */
action_items[0].user_data = psp;
action_items[1].user_data = psp;
build_action_area (GTK_DIALOG (psp->shell), action_items, 2, 0);
if (!title)
{
gtk_window_set_title (GTK_WINDOW (psp->shell), _("Palette Selection"));
}
else
{
gtk_window_set_title (GTK_WINDOW (psp->shell), title);
}
select_pos = -1;
if (initial_palette && strlen (initial_palette))
{

View File

@ -27,7 +27,6 @@
#include "appenv.h"
#include "draw_core.h"
#include "actionarea.h"
#include "colormaps.h"
#include "drawable.h"
#include "errors.h"
@ -39,7 +38,7 @@
#include "gdisplay.h"
#include "gimprc.h"
#include "gimpset.h"
#include "general.h"
#include "gimpui.h"
#include "image_render.h"
#include "interface.h"
#include "lc_dialogP.h"
@ -50,7 +49,6 @@
#include "pathsP.h"
#include "paths_dialog.h"
#include "paths_dialogP.h"
#include "resize.h"
#include "session.h"
#include "undo.h"
@ -1216,6 +1214,7 @@ do_rename_paths_callback(GtkWidget *widget, gpointer call_data, gpointer client_
static void
paths_dialog_edit_path_query (GtkWidget *widget)
{
GtkWidget *qbox;
GdkBitmap *mask;
gchar *text;
gint ret;
@ -1229,11 +1228,14 @@ paths_dialog_edit_path_query (GtkWidget *widget)
NULL,
&mask);
gtk_widget_show (query_string_box (_("Rename path"),
_("Enter a new name for the path"),
text,
NULL, NULL,
do_rename_paths_callback, widget));
qbox = gimp_query_string_box (_("Rename path"),
gimp_standard_help_func,
"dialogs/paths_dialog.html",
_("Enter a new name for the path"),
text,
NULL, NULL,
do_rename_paths_callback, widget);
gtk_widget_show (qbox);
}
static gint
@ -1275,7 +1277,7 @@ paths_list_events (GtkWidget *widget,
{
if(this_colunm == 1)
{
paths_dialog_edit_path_query(widget);
paths_dialog_edit_path_query (widget);
return TRUE;
}
else

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