mirror of https://github.com/GNOME/gimp.git
use GimpButton and connect to extended_clicked.
2001-05-14 Sven Neumann <sven@gimp.org> * app/ops_buttons.[ch]: use GimpButton and connect to extended_clicked. * app/docindex.c * app/gui/paths-dialog.c: changed accordingly.
This commit is contained in:
parent
fdbdb390ab
commit
1f17b12681
|
@ -1,3 +1,10 @@
|
|||
2001-05-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/ops_buttons.[ch]: use GimpButton and connect to extended_clicked.
|
||||
|
||||
* app/docindex.c
|
||||
* app/gui/paths-dialog.c: changed accordingly.
|
||||
|
||||
2001-05-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/Makefile.am
|
||||
|
|
|
@ -122,19 +122,19 @@ static OpsButton ops_buttons[] =
|
|||
N_("Open the selected entry\n"
|
||||
"<Shift> Raise window if already open\n"
|
||||
"<Ctrl> Load Image dialog"), NULL,
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ raise_xpm, idea_up_callback, raise_ext_callbacks,
|
||||
N_("Move the selected entry up in the index\n"
|
||||
"<Shift> To top"), NULL,
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ lower_xpm, idea_down_callback, lower_ext_callbacks,
|
||||
N_("Move the selected entry down in the index\n"
|
||||
"<Shift> To bottom"), NULL,
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ delete_xpm, idea_remove_callback, NULL,
|
||||
N_("Remove the selected entry from the index"), NULL,
|
||||
NULL, 0 },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, 0 }
|
||||
NULL },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -155,28 +155,28 @@ static OpsButton paths_ops_buttons[] =
|
|||
{ new_xpm, paths_dialog_new_path_callback, NULL,
|
||||
N_("New Path"),
|
||||
"paths/new_path.html",
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ duplicate_xpm, paths_dialog_dup_path_callback, NULL,
|
||||
N_("Duplicate Path"),
|
||||
"paths/duplicate_path.html",
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ toselection_xpm, paths_dialog_path_to_sel_callback, NULL,
|
||||
N_("Path to Selection"),
|
||||
"paths/path_to_selection.html",
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ topath_xpm, paths_dialog_sel_to_path_callback, to_path_ext_callbacks,
|
||||
N_("Selection to Path"),
|
||||
"filters/sel2path.html",
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ penstroke_xpm, paths_dialog_stroke_path_callback, NULL,
|
||||
N_("Stroke Path"),
|
||||
"paths/stroke_path.html",
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ delete_xpm, paths_dialog_delete_path_callback, NULL,
|
||||
N_("Delete Path"),
|
||||
"paths/delete_path.html",
|
||||
NULL, 0 },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, 0 }
|
||||
NULL },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static OpsButton point_ops_buttons[] =
|
||||
|
@ -184,20 +184,20 @@ static OpsButton point_ops_buttons[] =
|
|||
{ pennorm_xpm, paths_dialog_new_point_callback, NULL,
|
||||
N_("New Point"),
|
||||
"#new_point_button",
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ penadd_xpm, paths_dialog_add_point_callback, NULL,
|
||||
N_("Add Point"),
|
||||
"#add_point_button",
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ pendel_xpm, paths_dialog_delete_point_callback, NULL,
|
||||
N_("Delete Point"),
|
||||
"#delete_point_button",
|
||||
NULL, 0 },
|
||||
NULL },
|
||||
{ penedit_xpm, paths_dialog_edit_point_callback, NULL,
|
||||
N_("Edit Point"),
|
||||
"#edit_point_button",
|
||||
NULL, 0 },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, 0 }
|
||||
NULL },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
@ -22,17 +22,24 @@
|
|||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "ops_buttons.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void ops_button_pressed_callback (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
gpointer data);
|
||||
static void ops_button_extended_callback (GtkWidget *widget,
|
||||
typedef enum
|
||||
{
|
||||
OPS_BUTTON_MODIFIER_NONE,
|
||||
OPS_BUTTON_MODIFIER_SHIFT,
|
||||
OPS_BUTTON_MODIFIER_CTRL,
|
||||
OPS_BUTTON_MODIFIER_ALT,
|
||||
OPS_BUTTON_MODIFIER_SHIFT_CTRL,
|
||||
OPS_BUTTON_MODIFIER_LAST
|
||||
} OpsButtonModifier;
|
||||
|
||||
|
||||
static void ops_button_extended_clicked (GtkWidget *widget,
|
||||
guint modifier_state,
|
||||
gpointer data);
|
||||
|
||||
|
||||
|
@ -54,7 +61,7 @@ ops_button_box_new (OpsButton *ops_button,
|
|||
switch (ops_type)
|
||||
{
|
||||
case OPS_BUTTON_NORMAL:
|
||||
button = gtk_button_new ();
|
||||
button = gimp_button_new ();
|
||||
break;
|
||||
|
||||
case OPS_BUTTON_RADIO:
|
||||
|
@ -78,11 +85,8 @@ ops_button_box_new (OpsButton *ops_button,
|
|||
}
|
||||
else
|
||||
{
|
||||
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (ops_button_pressed_callback),
|
||||
ops_button);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ops_button_extended_callback),
|
||||
gtk_signal_connect (GTK_OBJECT (button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (ops_button_extended_clicked),
|
||||
ops_button);
|
||||
}
|
||||
|
||||
|
@ -96,7 +100,6 @@ ops_button_box_new (OpsButton *ops_button,
|
|||
gtk_widget_show (button);
|
||||
|
||||
ops_button->widget = button;
|
||||
ops_button->modifier = OPS_BUTTON_MODIFIER_NONE;
|
||||
|
||||
ops_button++;
|
||||
}
|
||||
|
@ -105,49 +108,38 @@ ops_button_box_new (OpsButton *ops_button,
|
|||
}
|
||||
|
||||
static void
|
||||
ops_button_pressed_callback (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
ops_button_extended_clicked (GtkWidget *widget,
|
||||
guint modifier_state,
|
||||
gpointer data)
|
||||
{
|
||||
OpsButton *ops_button;
|
||||
OpsButtonModifier modifier;
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
ops_button = (OpsButton *) data;
|
||||
|
||||
if (bevent->state & GDK_SHIFT_MASK)
|
||||
if (modifier_state & GDK_SHIFT_MASK)
|
||||
{
|
||||
if (bevent->state & GDK_CONTROL_MASK)
|
||||
ops_button->modifier = OPS_BUTTON_MODIFIER_SHIFT_CTRL;
|
||||
if (modifier_state & GDK_CONTROL_MASK)
|
||||
modifier = OPS_BUTTON_MODIFIER_SHIFT_CTRL;
|
||||
else
|
||||
ops_button->modifier = OPS_BUTTON_MODIFIER_SHIFT;
|
||||
modifier = OPS_BUTTON_MODIFIER_SHIFT;
|
||||
}
|
||||
else if (bevent->state & GDK_CONTROL_MASK)
|
||||
ops_button->modifier = OPS_BUTTON_MODIFIER_CTRL;
|
||||
else if (bevent->state & GDK_MOD1_MASK)
|
||||
ops_button->modifier = OPS_BUTTON_MODIFIER_ALT;
|
||||
else if (modifier_state & GDK_CONTROL_MASK)
|
||||
modifier = OPS_BUTTON_MODIFIER_CTRL;
|
||||
else if (modifier_state & GDK_MOD1_MASK)
|
||||
modifier = OPS_BUTTON_MODIFIER_ALT;
|
||||
else
|
||||
ops_button->modifier = OPS_BUTTON_MODIFIER_NONE;
|
||||
}
|
||||
modifier = OPS_BUTTON_MODIFIER_NONE;
|
||||
|
||||
static void
|
||||
ops_button_extended_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
OpsButton *ops_button;
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
ops_button = (OpsButton *) data;
|
||||
|
||||
if (ops_button->modifier > OPS_BUTTON_MODIFIER_NONE &&
|
||||
ops_button->modifier < OPS_BUTTON_MODIFIER_LAST)
|
||||
if (modifier > OPS_BUTTON_MODIFIER_NONE &&
|
||||
modifier < OPS_BUTTON_MODIFIER_LAST)
|
||||
{
|
||||
if (ops_button->ext_callbacks[ops_button->modifier - 1] != NULL)
|
||||
(ops_button->ext_callbacks[ops_button->modifier - 1]) (widget, NULL);
|
||||
if (ops_button->ext_callbacks[modifier - 1] != NULL)
|
||||
(ops_button->ext_callbacks[modifier - 1]) (widget, NULL);
|
||||
else
|
||||
(ops_button->callback) (widget, NULL);
|
||||
}
|
||||
else
|
||||
(ops_button->callback) (widget, NULL);
|
||||
|
||||
ops_button->modifier = OPS_BUTTON_MODIFIER_NONE;
|
||||
}
|
||||
|
|
|
@ -20,16 +20,6 @@
|
|||
#define __OPS_BUTTONS_H__
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OPS_BUTTON_MODIFIER_NONE,
|
||||
OPS_BUTTON_MODIFIER_SHIFT,
|
||||
OPS_BUTTON_MODIFIER_CTRL,
|
||||
OPS_BUTTON_MODIFIER_ALT,
|
||||
OPS_BUTTON_MODIFIER_SHIFT_CTRL,
|
||||
OPS_BUTTON_MODIFIER_LAST
|
||||
} OpsButtonModifier;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OPS_BUTTON_NORMAL,
|
||||
|
@ -47,7 +37,6 @@ struct _OpsButton
|
|||
gchar *tooltip;
|
||||
gchar *private_tip;
|
||||
GtkWidget *widget; /* the button widget */
|
||||
gint modifier;
|
||||
};
|
||||
|
||||
/* Function declarations */
|
||||
|
|
Loading…
Reference in New Issue