removed most functions. Show the help page in an idle function to avoid
2000-01-05 Michael Natterer <mitch@gimp.org> * app/gimphelp.[ch]: removed most functions. Show the help page in an idle function to avoid confusion with calling the temporary help browser procedure in the middle of the "gimp_help" PDB call. (I beleive this should work, so this is maybe a workaround for some other bug). * app/gimpui.[ch]: removed the dialog functions. * libgimp/Makefile.am * libgimp/gimpdialog.[ch] * libgimp/gimphelp.c * libgimp/gimphelpui.[ch]: new files. Moved most of the help functions and the dialog constructors to libgimp and libgimpui. * libgimp/gimp.h: declaration of the "gimp_help*" functions. * libgimp/gimpui.h: include "gimpdialog.h" and "gimphelpui.h". * plug-ins/common/grid.c: use the dialog constructor. It's now possible to show the plugin's help with "F1".
This commit is contained in:
committed by
Michael Natterer
parent
43136b7cfb
commit
ee6ad0e212
@ -30,237 +30,6 @@
|
||||
* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
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],
|
||||
gimp_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,
|
||||
gchar *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 *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,
|
||||
gchar *help_data,
|
||||
GtkWindowPosition position,
|
||||
gint allow_shrink,
|
||||
gint allow_grow,
|
||||
gint auto_shrink,
|
||||
va_list args)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
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 */
|
||||
gimp_dialog_create_action_areav (GTK_DIALOG (dialog), args);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dialog_create_action_area (GtkDialog *dialog,
|
||||
|
||||
/* specify action area buttons as va_list:
|
||||
* gchar *label,
|
||||
* GtkSignalFunc callback,
|
||||
* gpointer data,
|
||||
* GtkWidget **widget_ptr,
|
||||
* gboolean default_action,
|
||||
* gboolean connect_delete,
|
||||
*/
|
||||
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, dialog);
|
||||
|
||||
gimp_dialog_create_action_areav (dialog, args);
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dialog_create_action_areav (GtkDialog *dialog,
|
||||
va_list args)
|
||||
{
|
||||
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_if_fail (dialog != NULL);
|
||||
g_return_if_fail (GTK_IS_DIALOG (dialog));
|
||||
|
||||
/* prepare the action_area */
|
||||
label = va_arg (args, gchar*);
|
||||
|
||||
if (label)
|
||||
{
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (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 (dialog->action_area), hbbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
}
|
||||
|
||||
/* the action_area buttons */
|
||||
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*);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_option_menu_new (GtkSignalFunc menu_item_callback,
|
||||
gpointer initial, /* user_data */
|
||||
|
||||
Reference in New Issue
Block a user