mirror of https://github.com/GNOME/gimp.git
Reorder all menu items under <Image>/Filters which were created by
1999-12-04 Michael Natterer <mitch@gimp.org> * app/menus.c: Reorder all menu items under <Image>/Filters which were created by plugins, so they appear after <Image>/Filters/Web. (this way <Image>/Filters/Toys is always the last submenu) * app/palette.c: My last change caused both the normal _and_ the small menu to pop up on right mouse click on an already existing color. Thanks to Nick for pointing this out. Now there is only one menu with "Edit" and "Delete" greyed out if the click was outside a valid color square. I also moved "New" to the top of the menu because that's how other gimp menus look like.
This commit is contained in:
parent
7c96774bd4
commit
6e637d6eb4
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
1999-12-04 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/menus.c: Reorder all menu items under <Image>/Filters which
|
||||
were created by plugins, so they appear after <Image>/Filters/Web.
|
||||
(this way <Image>/Filters/Toys is always the last submenu)
|
||||
|
||||
* app/palette.c: My last change caused both the normal _and_ the
|
||||
small menu to pop up on right mouse click on an already existing
|
||||
color. Thanks to Nick for pointing this out.
|
||||
|
||||
Now there is only one menu with "Edit" and "Delete" greyed out if
|
||||
the click was outside a valid color square.
|
||||
I also moved "New" to the top of the menu because that's how other
|
||||
gimp menus look like.
|
||||
|
||||
Sat Dec 4 05:30:38 GMT 1999 Nick Lamb <njl195@zepler.org.uk>
|
||||
|
||||
* libgimp/gimpunitmenu.c: Move mitch's change so now it
|
||||
|
|
|
@ -1039,10 +1039,6 @@ menus_reorder_plugins (void)
|
|||
static gint n_reorder_subsubmenus = (sizeof (reorder_subsubmenus) /
|
||||
sizeof (reorder_subsubmenus[0]));
|
||||
|
||||
static gchar *reorder_if_exists[] = { "/Filters/Misc" };
|
||||
static gint n_reorder_if_exists = (sizeof (reorder_if_exists) /
|
||||
sizeof (reorder_if_exists[0]));
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
GtkWidget *menu;
|
||||
|
@ -1050,7 +1046,7 @@ menus_reorder_plugins (void)
|
|||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
/* Beautify <Toolbox>/Xtns */
|
||||
/* Beautify "<Toolbox>/Xtns" */
|
||||
pos = 2;
|
||||
for (i = 0; i < n_xtns_plugins; i++)
|
||||
{
|
||||
|
@ -1065,7 +1061,7 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Move "Filter all Layers..." before the separator */
|
||||
/* Move "<Image>/Filters/Filter all Layers..." before the separator */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/Filter all Layers...");
|
||||
if (menu_item && menu_item->parent)
|
||||
|
@ -1100,7 +1096,7 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reorder <Image>/File */
|
||||
/* Reorder "<Image>/File" */
|
||||
for (i = 0; i < n_image_file_entries; i++)
|
||||
{
|
||||
path = g_strconcat ("/File/", image_file_entries[i], NULL);
|
||||
|
@ -1145,7 +1141,9 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reorder submenus of <Image>/Filters which only exist sometimes */
|
||||
/* Move all submenus which registered after "<Image>/Filters/Toys"
|
||||
* before the separator after "<Image>/Filters/Web"
|
||||
*/
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/---INSERT");
|
||||
|
||||
|
@ -1154,28 +1152,30 @@ menus_reorder_plugins (void)
|
|||
menu = menu_item->parent;
|
||||
pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item);
|
||||
|
||||
for (i = 0; i < n_reorder_if_exists; i++)
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/Toys");
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
{
|
||||
GList *list;
|
||||
gint index = 1;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
reorder_if_exists[i]);
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
}
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
|
||||
if (list)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu),
|
||||
GTK_WIDGET (list->data), pos);
|
||||
pos++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
while ((menu_item = g_list_nth_data (GTK_MENU_SHELL (menu)->children,
|
||||
index)))
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu), menu_item, pos);
|
||||
|
||||
pos++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,17 +105,23 @@ typedef struct _PaletteDialog PaletteDialog;
|
|||
struct _PaletteDialog
|
||||
{
|
||||
GtkWidget *shell;
|
||||
|
||||
GtkWidget *color_area;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *color_name;
|
||||
GtkWidget *clist;
|
||||
|
||||
GtkWidget *popup_menu;
|
||||
GtkWidget *popup_small_menu;
|
||||
GtkWidget *delete_menu_item;
|
||||
GtkWidget *edit_menu_item;
|
||||
|
||||
ColorNotebookP color_notebook;
|
||||
gboolean color_notebook_active;
|
||||
|
||||
PaletteEntries *entries;
|
||||
PaletteEntry *color;
|
||||
PaletteEntry *dnd_color;
|
||||
|
||||
GdkGC *gc;
|
||||
guint entry_sig_id;
|
||||
gfloat zoom_factor; /* range from 0.1 to 4.0 */
|
||||
|
@ -1175,40 +1181,35 @@ static void
|
|||
palette_dialog_create_popup_menu (PaletteDialog *palette)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_items;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
menu_items = gtk_menu_item_new_with_label (_("Edit"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
palette->popup_menu = menu = gtk_menu_new ();
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
menu_item = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label (_("Edit"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_edit_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
menu_items = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
palette->edit_menu_item = menu_item;
|
||||
|
||||
menu_items = gtk_menu_item_new_with_label (_("Delete"));
|
||||
gtk_signal_connect (GTK_OBJECT(menu_items), "activate",
|
||||
menu_item = gtk_menu_item_new_with_label (_("Delete"));
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_delete_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_widget_show (menu_items);
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
palette->popup_menu = menu;
|
||||
|
||||
palette->popup_small_menu = menu = gtk_menu_new ();
|
||||
menu_items = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
palette->delete_menu_item = menu_item;
|
||||
}
|
||||
|
||||
/* the color area event callbacks ******************************************/
|
||||
|
@ -1218,16 +1219,23 @@ palette_dialog_eventbox_button_press (GtkWidget *widget,
|
|||
GdkEventButton *bevent,
|
||||
PaletteDialog *palette)
|
||||
{
|
||||
if (gtk_get_event_widget ((GdkEvent *) bevent) == palette->color_area)
|
||||
return FALSE;
|
||||
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the small new menu */
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_small_menu),
|
||||
NULL, NULL,
|
||||
if (GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, FALSE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
bevent->time);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -1237,11 +1245,11 @@ palette_dialog_color_area_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventButton *bevent;
|
||||
GSList *tmp_link;
|
||||
int r, g, b;
|
||||
int entry_width;
|
||||
int entry_height;
|
||||
int row, col;
|
||||
int pos;
|
||||
gint r, g, b;
|
||||
gint entry_width;
|
||||
gint entry_height;
|
||||
gint row, col;
|
||||
gint pos;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -1308,21 +1316,30 @@ palette_dialog_color_area_events (GtkWidget *widget,
|
|||
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the edit menu */
|
||||
if (! GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, TRUE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, TRUE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
((GdkEventButton *)event)->time);
|
||||
bevent->time);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the small new menu */
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_small_menu),
|
||||
NULL, NULL,
|
||||
if (GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, FALSE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
((GdkEventButton *)event)->time);
|
||||
bevent->time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
50
app/menus.c
50
app/menus.c
|
@ -1039,10 +1039,6 @@ menus_reorder_plugins (void)
|
|||
static gint n_reorder_subsubmenus = (sizeof (reorder_subsubmenus) /
|
||||
sizeof (reorder_subsubmenus[0]));
|
||||
|
||||
static gchar *reorder_if_exists[] = { "/Filters/Misc" };
|
||||
static gint n_reorder_if_exists = (sizeof (reorder_if_exists) /
|
||||
sizeof (reorder_if_exists[0]));
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
GtkWidget *menu;
|
||||
|
@ -1050,7 +1046,7 @@ menus_reorder_plugins (void)
|
|||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
/* Beautify <Toolbox>/Xtns */
|
||||
/* Beautify "<Toolbox>/Xtns" */
|
||||
pos = 2;
|
||||
for (i = 0; i < n_xtns_plugins; i++)
|
||||
{
|
||||
|
@ -1065,7 +1061,7 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Move "Filter all Layers..." before the separator */
|
||||
/* Move "<Image>/Filters/Filter all Layers..." before the separator */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/Filter all Layers...");
|
||||
if (menu_item && menu_item->parent)
|
||||
|
@ -1100,7 +1096,7 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reorder <Image>/File */
|
||||
/* Reorder "<Image>/File" */
|
||||
for (i = 0; i < n_image_file_entries; i++)
|
||||
{
|
||||
path = g_strconcat ("/File/", image_file_entries[i], NULL);
|
||||
|
@ -1145,7 +1141,9 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reorder submenus of <Image>/Filters which only exist sometimes */
|
||||
/* Move all submenus which registered after "<Image>/Filters/Toys"
|
||||
* before the separator after "<Image>/Filters/Web"
|
||||
*/
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/---INSERT");
|
||||
|
||||
|
@ -1154,28 +1152,30 @@ menus_reorder_plugins (void)
|
|||
menu = menu_item->parent;
|
||||
pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item);
|
||||
|
||||
for (i = 0; i < n_reorder_if_exists; i++)
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/Toys");
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
{
|
||||
GList *list;
|
||||
gint index = 1;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
reorder_if_exists[i]);
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
}
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
|
||||
if (list)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu),
|
||||
GTK_WIDGET (list->data), pos);
|
||||
pos++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
while ((menu_item = g_list_nth_data (GTK_MENU_SHELL (menu)->children,
|
||||
index)))
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu), menu_item, pos);
|
||||
|
||||
pos++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1039,10 +1039,6 @@ menus_reorder_plugins (void)
|
|||
static gint n_reorder_subsubmenus = (sizeof (reorder_subsubmenus) /
|
||||
sizeof (reorder_subsubmenus[0]));
|
||||
|
||||
static gchar *reorder_if_exists[] = { "/Filters/Misc" };
|
||||
static gint n_reorder_if_exists = (sizeof (reorder_if_exists) /
|
||||
sizeof (reorder_if_exists[0]));
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
GtkWidget *menu;
|
||||
|
@ -1050,7 +1046,7 @@ menus_reorder_plugins (void)
|
|||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
/* Beautify <Toolbox>/Xtns */
|
||||
/* Beautify "<Toolbox>/Xtns" */
|
||||
pos = 2;
|
||||
for (i = 0; i < n_xtns_plugins; i++)
|
||||
{
|
||||
|
@ -1065,7 +1061,7 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Move "Filter all Layers..." before the separator */
|
||||
/* Move "<Image>/Filters/Filter all Layers..." before the separator */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/Filter all Layers...");
|
||||
if (menu_item && menu_item->parent)
|
||||
|
@ -1100,7 +1096,7 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reorder <Image>/File */
|
||||
/* Reorder "<Image>/File" */
|
||||
for (i = 0; i < n_image_file_entries; i++)
|
||||
{
|
||||
path = g_strconcat ("/File/", image_file_entries[i], NULL);
|
||||
|
@ -1145,7 +1141,9 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reorder submenus of <Image>/Filters which only exist sometimes */
|
||||
/* Move all submenus which registered after "<Image>/Filters/Toys"
|
||||
* before the separator after "<Image>/Filters/Web"
|
||||
*/
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/---INSERT");
|
||||
|
||||
|
@ -1154,28 +1152,30 @@ menus_reorder_plugins (void)
|
|||
menu = menu_item->parent;
|
||||
pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item);
|
||||
|
||||
for (i = 0; i < n_reorder_if_exists; i++)
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/Toys");
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
{
|
||||
GList *list;
|
||||
gint index = 1;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
reorder_if_exists[i]);
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
}
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
|
||||
if (list)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu),
|
||||
GTK_WIDGET (list->data), pos);
|
||||
pos++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
while ((menu_item = g_list_nth_data (GTK_MENU_SHELL (menu)->children,
|
||||
index)))
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu), menu_item, pos);
|
||||
|
||||
pos++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,17 +105,23 @@ typedef struct _PaletteDialog PaletteDialog;
|
|||
struct _PaletteDialog
|
||||
{
|
||||
GtkWidget *shell;
|
||||
|
||||
GtkWidget *color_area;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *color_name;
|
||||
GtkWidget *clist;
|
||||
|
||||
GtkWidget *popup_menu;
|
||||
GtkWidget *popup_small_menu;
|
||||
GtkWidget *delete_menu_item;
|
||||
GtkWidget *edit_menu_item;
|
||||
|
||||
ColorNotebookP color_notebook;
|
||||
gboolean color_notebook_active;
|
||||
|
||||
PaletteEntries *entries;
|
||||
PaletteEntry *color;
|
||||
PaletteEntry *dnd_color;
|
||||
|
||||
GdkGC *gc;
|
||||
guint entry_sig_id;
|
||||
gfloat zoom_factor; /* range from 0.1 to 4.0 */
|
||||
|
@ -1175,40 +1181,35 @@ static void
|
|||
palette_dialog_create_popup_menu (PaletteDialog *palette)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_items;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
menu_items = gtk_menu_item_new_with_label (_("Edit"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
palette->popup_menu = menu = gtk_menu_new ();
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
menu_item = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label (_("Edit"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_edit_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
menu_items = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
palette->edit_menu_item = menu_item;
|
||||
|
||||
menu_items = gtk_menu_item_new_with_label (_("Delete"));
|
||||
gtk_signal_connect (GTK_OBJECT(menu_items), "activate",
|
||||
menu_item = gtk_menu_item_new_with_label (_("Delete"));
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_delete_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_widget_show (menu_items);
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
palette->popup_menu = menu;
|
||||
|
||||
palette->popup_small_menu = menu = gtk_menu_new ();
|
||||
menu_items = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
palette->delete_menu_item = menu_item;
|
||||
}
|
||||
|
||||
/* the color area event callbacks ******************************************/
|
||||
|
@ -1218,16 +1219,23 @@ palette_dialog_eventbox_button_press (GtkWidget *widget,
|
|||
GdkEventButton *bevent,
|
||||
PaletteDialog *palette)
|
||||
{
|
||||
if (gtk_get_event_widget ((GdkEvent *) bevent) == palette->color_area)
|
||||
return FALSE;
|
||||
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the small new menu */
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_small_menu),
|
||||
NULL, NULL,
|
||||
if (GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, FALSE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
bevent->time);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -1237,11 +1245,11 @@ palette_dialog_color_area_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventButton *bevent;
|
||||
GSList *tmp_link;
|
||||
int r, g, b;
|
||||
int entry_width;
|
||||
int entry_height;
|
||||
int row, col;
|
||||
int pos;
|
||||
gint r, g, b;
|
||||
gint entry_width;
|
||||
gint entry_height;
|
||||
gint row, col;
|
||||
gint pos;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -1308,21 +1316,30 @@ palette_dialog_color_area_events (GtkWidget *widget,
|
|||
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the edit menu */
|
||||
if (! GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, TRUE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, TRUE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
((GdkEventButton *)event)->time);
|
||||
bevent->time);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the small new menu */
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_small_menu),
|
||||
NULL, NULL,
|
||||
if (GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, FALSE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
((GdkEventButton *)event)->time);
|
||||
bevent->time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1039,10 +1039,6 @@ menus_reorder_plugins (void)
|
|||
static gint n_reorder_subsubmenus = (sizeof (reorder_subsubmenus) /
|
||||
sizeof (reorder_subsubmenus[0]));
|
||||
|
||||
static gchar *reorder_if_exists[] = { "/Filters/Misc" };
|
||||
static gint n_reorder_if_exists = (sizeof (reorder_if_exists) /
|
||||
sizeof (reorder_if_exists[0]));
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menu_item;
|
||||
GtkWidget *menu;
|
||||
|
@ -1050,7 +1046,7 @@ menus_reorder_plugins (void)
|
|||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
/* Beautify <Toolbox>/Xtns */
|
||||
/* Beautify "<Toolbox>/Xtns" */
|
||||
pos = 2;
|
||||
for (i = 0; i < n_xtns_plugins; i++)
|
||||
{
|
||||
|
@ -1065,7 +1061,7 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Move "Filter all Layers..." before the separator */
|
||||
/* Move "<Image>/Filters/Filter all Layers..." before the separator */
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/Filter all Layers...");
|
||||
if (menu_item && menu_item->parent)
|
||||
|
@ -1100,7 +1096,7 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reorder <Image>/File */
|
||||
/* Reorder "<Image>/File" */
|
||||
for (i = 0; i < n_image_file_entries; i++)
|
||||
{
|
||||
path = g_strconcat ("/File/", image_file_entries[i], NULL);
|
||||
|
@ -1145,7 +1141,9 @@ menus_reorder_plugins (void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Reorder submenus of <Image>/Filters which only exist sometimes */
|
||||
/* Move all submenus which registered after "<Image>/Filters/Toys"
|
||||
* before the separator after "<Image>/Filters/Web"
|
||||
*/
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/---INSERT");
|
||||
|
||||
|
@ -1154,28 +1152,30 @@ menus_reorder_plugins (void)
|
|||
menu = menu_item->parent;
|
||||
pos = g_list_index (GTK_MENU_SHELL (menu)->children, menu_item);
|
||||
|
||||
for (i = 0; i < n_reorder_if_exists; i++)
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
"/Filters/Toys");
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
{
|
||||
GList *list;
|
||||
gint index = 1;
|
||||
|
||||
menu_item = gtk_item_factory_get_widget (image_factory,
|
||||
reorder_if_exists[i]);
|
||||
|
||||
if (menu_item && GTK_IS_MENU (menu_item))
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
for (list = GTK_MENU_SHELL (menu)->children; list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
}
|
||||
if (GTK_MENU_ITEM (list->data)->submenu == menu_item)
|
||||
break;
|
||||
|
||||
if (list)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu),
|
||||
GTK_WIDGET (list->data), pos);
|
||||
pos++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
while ((menu_item = g_list_nth_data (GTK_MENU_SHELL (menu)->children,
|
||||
index)))
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu), menu_item, pos);
|
||||
|
||||
pos++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,17 +105,23 @@ typedef struct _PaletteDialog PaletteDialog;
|
|||
struct _PaletteDialog
|
||||
{
|
||||
GtkWidget *shell;
|
||||
|
||||
GtkWidget *color_area;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *color_name;
|
||||
GtkWidget *clist;
|
||||
|
||||
GtkWidget *popup_menu;
|
||||
GtkWidget *popup_small_menu;
|
||||
GtkWidget *delete_menu_item;
|
||||
GtkWidget *edit_menu_item;
|
||||
|
||||
ColorNotebookP color_notebook;
|
||||
gboolean color_notebook_active;
|
||||
|
||||
PaletteEntries *entries;
|
||||
PaletteEntry *color;
|
||||
PaletteEntry *dnd_color;
|
||||
|
||||
GdkGC *gc;
|
||||
guint entry_sig_id;
|
||||
gfloat zoom_factor; /* range from 0.1 to 4.0 */
|
||||
|
@ -1175,40 +1181,35 @@ static void
|
|||
palette_dialog_create_popup_menu (PaletteDialog *palette)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_items;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
menu_items = gtk_menu_item_new_with_label (_("Edit"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
palette->popup_menu = menu = gtk_menu_new ();
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
menu_item = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label (_("Edit"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_edit_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
menu_items = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
palette->edit_menu_item = menu_item;
|
||||
|
||||
menu_items = gtk_menu_item_new_with_label (_("Delete"));
|
||||
gtk_signal_connect (GTK_OBJECT(menu_items), "activate",
|
||||
menu_item = gtk_menu_item_new_with_label (_("Delete"));
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_delete_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_widget_show (menu_items);
|
||||
gtk_menu_append (GTK_MENU (menu), menu_item);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
palette->popup_menu = menu;
|
||||
|
||||
palette->popup_small_menu = menu = gtk_menu_new ();
|
||||
menu_items = gtk_menu_item_new_with_label (_("New"));
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_new_entry_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (menu_items);
|
||||
palette->delete_menu_item = menu_item;
|
||||
}
|
||||
|
||||
/* the color area event callbacks ******************************************/
|
||||
|
@ -1218,16 +1219,23 @@ palette_dialog_eventbox_button_press (GtkWidget *widget,
|
|||
GdkEventButton *bevent,
|
||||
PaletteDialog *palette)
|
||||
{
|
||||
if (gtk_get_event_widget ((GdkEvent *) bevent) == palette->color_area)
|
||||
return FALSE;
|
||||
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the small new menu */
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_small_menu),
|
||||
NULL, NULL,
|
||||
if (GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, FALSE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
bevent->time);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -1237,11 +1245,11 @@ palette_dialog_color_area_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventButton *bevent;
|
||||
GSList *tmp_link;
|
||||
int r, g, b;
|
||||
int entry_width;
|
||||
int entry_height;
|
||||
int row, col;
|
||||
int pos;
|
||||
gint r, g, b;
|
||||
gint entry_width;
|
||||
gint entry_height;
|
||||
gint row, col;
|
||||
gint pos;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -1308,21 +1316,30 @@ palette_dialog_color_area_events (GtkWidget *widget,
|
|||
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the edit menu */
|
||||
if (! GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, TRUE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, TRUE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
((GdkEventButton *)event)->time);
|
||||
bevent->time);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
/* Popup the small new menu */
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_small_menu),
|
||||
NULL, NULL,
|
||||
if (GTK_WIDGET_SENSITIVE (palette->edit_menu_item))
|
||||
{
|
||||
gtk_widget_set_sensitive (palette->edit_menu_item, FALSE);
|
||||
gtk_widget_set_sensitive (palette->delete_menu_item, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (palette->popup_menu), NULL, NULL,
|
||||
NULL, NULL, 3,
|
||||
((GdkEventButton *)event)->time);
|
||||
bevent->time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue