Commit bcd96047 authored by Simon Budig's avatar Simon Budig Committed by Simon Budig

Sort the plugin menu entries with the mnemonics stripped. Avoids weird

2004-03-17  Simon Budig  <simon@gimp.org>

	* app/gui/plug-in-menus.c: Sort the plugin menu entries with
	the mnemonics stripped. Avoids weird ordering in the "C" and
	"POSIX" locales.

	* app/widgets/gimpitemtreeview.c: make a simple click on the
	"New" Button use defaults and use shift-click for the new-dialog
	invocation.

	Some more useless button cleanup:

	* app/widgets/gimpdatafactoryview.c: only create an Edit button
	when the edit_function is set.

	* app/core/gimp.c: don't set an edit func for the patterns.

	* app/gui/patterns-menu.c: Don't create the "New", "Edit" and
	"Duplicate" Menu entries for the patterns.

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimppatternfactoryview.[ch]: New widget:
	gimp_pattern_factory_view. Necessary to be able to hide the
	"duplicate" button...

	* app/gui/dialogs-constructors.c: Use it.
parent ad3ec658
2004-03-17 Simon Budig <simon@gimp.org>
* app/gui/plug-in-menus.c: Sort the plugin menu entries with
the mnemonics stripped. Avoids weird ordering in the "C" and
"POSIX" locales.
* app/widgets/gimpitemtreeview.c: make a simple click on the
"New" Button use defaults and use shift-click for the new-dialog
invocation.
Some more useless button cleanup:
* app/widgets/gimpdatafactoryview.c: only create an Edit button
when the edit_function is set.
* app/core/gimp.c: don't set an edit func for the patterns.
* app/gui/patterns-menu.c: Don't create the "New", "Edit" and
"Duplicate" Menu entries for the patterns.
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimppatternfactoryview.[ch]: New widget:
gimp_pattern_factory_view. Necessary to be able to hide the
"duplicate" button...
* app/gui/dialogs-constructors.c: Use it.
2004-03-17 Sven Neumann <sven@gimp.org>
Changes for help i18n in the core, the rest will take place in the
......@@ -609,7 +609,7 @@ gimp_real_initialize (Gimp *gimp,
"pattern-path", "pattern-path-writable",
pattern_loader_entries,
G_N_ELEMENTS (pattern_loader_entries),
gimp_pattern_new,
NULL,
gimp_pattern_get_standard);
gimp_object_set_name (GIMP_OBJECT (gimp->pattern_factory), "pattern factory");
......
......@@ -57,6 +57,7 @@
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemtreeview.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimppatternfactoryview.h"
#include "widgets/gimpselectioneditor.h"
#include "widgets/gimptemplateview.h"
#include "widgets/gimptoolbox.h"
......@@ -287,12 +288,12 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory, "<Patterns>");
view = gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Patterns"), NULL,
......@@ -494,12 +495,12 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory, "<Patterns>");
view = gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Patterns"), NULL,
......
......@@ -57,6 +57,7 @@
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemtreeview.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimppatternfactoryview.h"
#include "widgets/gimpselectioneditor.h"
#include "widgets/gimptemplateview.h"
#include "widgets/gimptoolbox.h"
......@@ -287,12 +288,12 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory, "<Patterns>");
view = gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Patterns"), NULL,
......@@ -494,12 +495,12 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory, "<Patterns>");
view = gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Patterns"), NULL,
......
......@@ -42,6 +42,8 @@
GimpItemFactoryEntry patterns_menu_entries[] =
{
#if 0
/* disabled because they are useless now */
{ { N_("/_Edit Pattern..."), NULL,
data_edit_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
......@@ -60,6 +62,7 @@ GimpItemFactoryEntry patterns_menu_entries[] =
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
GIMP_HELP_PATTERN_DUPLICATE, NULL },
#endif
{ { N_("/_Delete Pattern..."), "",
data_delete_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
......@@ -96,10 +99,12 @@ patterns_menu_update (GtkItemFactory *factory,
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
#if 0
SET_SENSITIVE ("/Edit Pattern...",
pattern && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Duplicate Pattern",
pattern && GIMP_DATA_GET_CLASS (data)->duplicate);
#endif
SET_SENSITIVE ("/Delete Pattern...",
pattern && data->deletable);
......
......@@ -123,7 +123,7 @@ plug_in_menus_create (GimpItemFactory *item_factory,
g_return_if_fail (proc_defs != NULL);
menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL,
NULL, g_free);
g_free, g_free);
for (procs = proc_defs; procs; procs = procs->next)
{
......@@ -139,6 +139,7 @@ plug_in_menus_create (GimpItemFactory *item_factory,
const gchar *progname;
const gchar *locale_domain;
const gchar *help_domain;
gchar *key;
progname = plug_in_proc_def_get_progname (proc_def);
......@@ -153,9 +154,9 @@ plug_in_menus_create (GimpItemFactory *item_factory,
menu_entry->locale_domain = locale_domain;
menu_entry->help_domain = help_domain;
g_tree_insert (menu_entries,
dgettext (locale_domain, proc_def->menu_path),
menu_entry);
key = gimp_strip_uline (dgettext (locale_domain,
proc_def->menu_path));
g_tree_insert (menu_entries, key, menu_entry);
}
}
......
......@@ -123,7 +123,7 @@ plug_in_menus_create (GimpItemFactory *item_factory,
g_return_if_fail (proc_defs != NULL);
menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL,
NULL, g_free);
g_free, g_free);
for (procs = proc_defs; procs; procs = procs->next)
{
......@@ -139,6 +139,7 @@ plug_in_menus_create (GimpItemFactory *item_factory,
const gchar *progname;
const gchar *locale_domain;
const gchar *help_domain;
gchar *key;
progname = plug_in_proc_def_get_progname (proc_def);
......@@ -153,9 +154,9 @@ plug_in_menus_create (GimpItemFactory *item_factory,
menu_entry->locale_domain = locale_domain;
menu_entry->help_domain = help_domain;
g_tree_insert (menu_entries,
dgettext (locale_domain, proc_def->menu_path),
menu_entry);
key = gimp_strip_uline (dgettext (locale_domain,
proc_def->menu_path));
g_tree_insert (menu_entries, key, menu_entry);
}
}
......
......@@ -136,6 +136,8 @@ libappwidgets_a_sources = \
gimpnavigationpreview.h \
gimppaletteeditor.c \
gimppaletteeditor.h \
gimppatternfactoryview.c \
gimppatternfactoryview.h \
gimppreview.c \
gimppreview.h \
gimppreview-popup.c \
......
......@@ -210,7 +210,7 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
factory_view);
}
if (edit_func != NULL)
if (edit_func)
{
factory_view->edit_button =
gimp_editor_add_button (GIMP_EDITOR (editor->view),
......@@ -221,13 +221,16 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
editor);
}
factory_view->new_button =
gimp_editor_add_button (GIMP_EDITOR (editor->view),
GTK_STOCK_NEW,
_("New"), NULL,
G_CALLBACK (gimp_data_factory_view_new_clicked),
NULL,
editor);
if (factory_view->factory->data_new_func)
{
factory_view->new_button =
gimp_editor_add_button (GIMP_EDITOR (editor->view),
GTK_STOCK_NEW,
_("New"), NULL,
G_CALLBACK (gimp_data_factory_view_new_clicked),
NULL,
editor);
}
factory_view->duplicate_button =
gimp_editor_add_button (GIMP_EDITOR (editor->view),
......
......@@ -345,9 +345,10 @@ gimp_item_tree_view_init (GimpItemTreeView *view,
view);
str = g_strdup_printf (_("%s\n"
"%s use defaults"),
"%s %s Dialog"),
view_class->new_desc,
gimp_get_mod_name_shift ());
gimp_get_mod_name_shift (),
view_class->new_desc);
view->new_button =
gimp_editor_add_button (editor,
......@@ -1009,7 +1010,7 @@ static void
gimp_item_tree_view_new_clicked (GtkWidget *widget,
GimpItemTreeView *view)
{
view->new_item_func (view->gimage, NULL, TRUE, GTK_WIDGET (view));
view->new_item_func (view->gimage, NULL, FALSE, GTK_WIDGET (view));
}
static void
......@@ -1017,7 +1018,7 @@ gimp_item_tree_view_new_extended_clicked (GtkWidget *widget,
guint state,
GimpItemTreeView *view)
{
view->new_item_func (view->gimage, NULL, FALSE, GTK_WIDGET (view));
view->new_item_func (view->gimage, NULL, TRUE, GTK_WIDGET (view));
}
static void
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppatternfactoryview.c
* Copyright (C) 2001 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 "config.h"
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimppattern.h"
#include "core/gimpdatafactory.h"
#include "gimpcontainerview.h"
#include "gimppatternfactoryview.h"
#include "gimppreviewrenderer.h"
#include "gimp-intl.h"
static void gimp_pattern_factory_view_class_init (GimpPatternFactoryViewClass *klass);
static void gimp_pattern_factory_view_init (GimpPatternFactoryView *view);
static GimpDataFactoryViewClass *parent_class = NULL;
GType
gimp_pattern_factory_view_get_type (void)
{
static GType view_type = 0;
if (! view_type)
{
static const GTypeInfo view_info =
{
sizeof (GimpPatternFactoryViewClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_pattern_factory_view_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPatternFactoryView),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_pattern_factory_view_init,
};
view_type = g_type_register_static (GIMP_TYPE_DATA_FACTORY_VIEW,
"GimpPatternFactoryView",
&view_info, 0);
}
return view_type;
}
static void
gimp_pattern_factory_view_class_init (GimpPatternFactoryViewClass *klass)
{
parent_class = g_type_class_peek_parent (klass);
}
static void
gimp_pattern_factory_view_init (GimpPatternFactoryView *view)
{
}
GtkWidget *
gimp_pattern_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size,
gint preview_border_width,
GimpMenuFactory *menu_factory)
{
GimpPatternFactoryView *factory_view;
GimpContainerEditor *editor;
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (preview_size > 0 &&
preview_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
g_return_val_if_fail (preview_border_width >= 0 &&
preview_border_width <= GIMP_PREVIEW_MAX_BORDER_WIDTH,
NULL);
factory_view = g_object_new (GIMP_TYPE_PATTERN_FACTORY_VIEW, NULL);
if (! gimp_data_factory_view_construct (GIMP_DATA_FACTORY_VIEW (factory_view),
view_type,
factory,
edit_func,
context,
preview_size, preview_border_width,
menu_factory, "<Patterns>"))
{
g_object_unref (factory_view);
return NULL;
}
gtk_widget_hide (GIMP_DATA_FACTORY_VIEW (factory_view)->duplicate_button);
editor = GIMP_CONTAINER_EDITOR (factory_view);
return GTK_WIDGET (factory_view);
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppatternfactoryview.h
* Copyright (C) 2001 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_PATTERN_FACTORY_VIEW_H__
#define __GIMP_PATTERN_FACTORY_VIEW_H__
#include "gimpdatafactoryview.h"
#define GIMP_TYPE_PATTERN_FACTORY_VIEW (gimp_pattern_factory_view_get_type ())
#define GIMP_PATTERN_FACTORY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PATTERN_FACTORY_VIEW, GimpPatternFactoryView))
#define GIMP_PATTERN_FACTORY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATTERN_FACTORY_VIEW, GimpPatternFactoryViewClass))
#define GIMP_IS_PATTERN_FACTORY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PATTERN_FACTORY_VIEW))
#define GIMP_IS_PATTERN_FACTORY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATTERN_FACTORY_VIEW))
#define GIMP_PATTERN_FACTORY_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PATTERN_FACTORY_VIEW, GimpPatternFactoryViewClass))
typedef struct _GimpPatternFactoryViewClass GimpPatternFactoryViewClass;
struct _GimpPatternFactoryView
{
GimpDataFactoryView parent_instance;
};
struct _GimpPatternFactoryViewClass
{
GimpDataFactoryViewClass parent_class;
};
GType gimp_pattern_factory_view_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_pattern_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size,
gint preview_border_width,
GimpMenuFactory *menu_factory);
#endif /* __GIMP_PATTERN_FACTORY_VIEW_H__ */
......@@ -95,6 +95,7 @@ typedef struct _GimpImageView GimpImageView;
typedef struct _GimpTemplateView GimpTemplateView;
typedef struct _GimpDataFactoryView GimpDataFactoryView;
typedef struct _GimpBrushFactoryView GimpBrushFactoryView;
typedef struct _GimpPatternFactoryView GimpPatternFactoryView;
typedef struct _GimpDock GimpDock;
typedef struct _GimpToolbox GimpToolbox;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment