mirror of https://github.com/GNOME/gimp.git
configure.in app/Makefile.am new directory which will contain all gui code
2001-04-14 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am * app/gui/Makefile.am: new directory which will contain all gui code except widgets (I was tired off adding new files to app/). * app/apptypes.h * app/gui/gimpdialogfactory.[ch]: factory which produces dialogs from string descriptions. Should maybe go to widgets/. * app/gui/dialogs-commands.[ch]: callbacks for the new menu factory below. * app/gui/dialogs-constructors.[ch]: dialog constructors which are registered with the dialog factory. * app/gui/dialogs.[ch]: register the dialogs with the factory. * app/app_procs.c: call dialogs_register(). * app/menus.[ch]: a new item factory for creating dialogs. * app/test_commands.c * app/widgets/gimpdock.[ch]: added a dialog factory pointer to the GimpDock struct. * app/widgets/gimpdockbook.[ch]: badly (badly!) fiddle around with GtkNotebook's menu to get it integrated in the GtkItemFactory which produces new dialogs.
This commit is contained in:
parent
86dc60045c
commit
517de92aa7
31
ChangeLog
31
ChangeLog
|
@ -1,3 +1,34 @@
|
|||
2001-04-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* configure.in
|
||||
* app/Makefile.am
|
||||
* app/gui/Makefile.am: new directory which will contain all gui code
|
||||
except widgets (I was tired off adding new files to app/).
|
||||
|
||||
* app/apptypes.h
|
||||
* app/gui/gimpdialogfactory.[ch]: factory which produces dialogs
|
||||
from string descriptions. Should maybe go to widgets/.
|
||||
|
||||
* app/gui/dialogs-commands.[ch]: callbacks for the new menu
|
||||
factory below.
|
||||
|
||||
* app/gui/dialogs-constructors.[ch]: dialog constructors which are
|
||||
registered with the dialog factory.
|
||||
|
||||
* app/gui/dialogs.[ch]: register the dialogs with the factory.
|
||||
|
||||
* app/app_procs.c: call dialogs_register().
|
||||
|
||||
* app/menus.[ch]: a new item factory for creating dialogs.
|
||||
|
||||
* app/test_commands.c
|
||||
* app/widgets/gimpdock.[ch]: added a dialog factory pointer to the
|
||||
GimpDock struct.
|
||||
|
||||
* app/widgets/gimpdockbook.[ch]: badly (badly!) fiddle around with
|
||||
GtkNotebook's menu to get it integrated in the GtkItemFactory
|
||||
which produces new dialogs.
|
||||
|
||||
2001-04-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/pdb/procedural_db.[ch]: removed the ID system from the pdb/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = paint-funcs pdb tools widgets
|
||||
SUBDIRS = paint-funcs pdb tools widgets gui
|
||||
|
||||
scriptdata =
|
||||
|
||||
|
@ -334,6 +334,7 @@ INCLUDES = \
|
|||
-I$(includedir)
|
||||
|
||||
gimp_LDADD = \
|
||||
gui/libappgui.la \
|
||||
paint-funcs/libapppaint-funcs.la \
|
||||
pdb/libapppdb.la \
|
||||
tools/libapptools.la \
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 "apptypes.h"
|
||||
|
||||
#include "widgets/gimpdock.h"
|
||||
#include "widgets/gimpdockbook.h"
|
||||
|
||||
#include "dialogs-commands.h"
|
||||
#include "dialogs-constructors.h"
|
||||
#include "gimpdialogfactory.h"
|
||||
|
||||
|
||||
void
|
||||
dialogs_add_tab_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpDockbook *dockbook;
|
||||
|
||||
dockbook = (GimpDockbook *) gtk_item_factory_popup_data_from_widget (widget);
|
||||
|
||||
if (dockbook && action)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
|
||||
dockable = gimp_dialog_factory_dialog_new (dockbook->dock->factory,
|
||||
GUINT_TO_POINTER (action));
|
||||
|
||||
if (dockable)
|
||||
gimp_dockbook_add (dockbook, dockable, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_remove_tab_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpDockbook *dockbook;
|
||||
|
||||
dockbook = (GimpDockbook *) gtk_item_factory_popup_data_from_widget (widget);
|
||||
|
||||
if (dockbook)
|
||||
{
|
||||
g_print ("remove\n");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 __DIALOGS_COMMANDS_H__
|
||||
#define __DIALOGS_COMMANDS_H__
|
||||
|
||||
|
||||
void dialogs_add_tab_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void dialogs_remove_tab_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
|
||||
#endif /* __DIALOGS_COMMANDS_H__ */
|
|
@ -44,6 +44,8 @@
|
|||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/dialogs.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "pdb/internal_procs.h"
|
||||
|
@ -619,6 +621,8 @@ app_init (void)
|
|||
gximage_init ();
|
||||
render_setup (transparency_type, transparency_size);
|
||||
|
||||
dialogs_register ();
|
||||
|
||||
devices_init ();
|
||||
session_init ();
|
||||
|
||||
|
|
|
@ -91,6 +91,11 @@ typedef struct _GimpUndo GimpUndo;
|
|||
typedef struct _GimpUndoStack GimpUndoStack;
|
||||
|
||||
|
||||
/* gui objects */
|
||||
|
||||
typedef struct _GimpDialogFactory GimpDialogFactory;
|
||||
|
||||
|
||||
/* widgets */
|
||||
|
||||
typedef struct _GimpPreview GimpPreview;
|
||||
|
|
|
@ -0,0 +1,371 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "widgets/gimpcontainerlistview.h"
|
||||
#include "widgets/gimpcontainergridview.h"
|
||||
#include "widgets/gimpdatafactoryview.h"
|
||||
#include "widgets/gimpdockable.h"
|
||||
#include "widgets/gimppreview.h"
|
||||
|
||||
#include "context_manager.h"
|
||||
#include "gradient_editor.h"
|
||||
#include "gimpcontainer.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpdatafactory.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimprc.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static GtkWidget * dialogs_brush_tab_func (GimpDockable *dockable,
|
||||
gint size);
|
||||
static GtkWidget * dialogs_pattern_tab_func (GimpDockable *dockable,
|
||||
gint size);
|
||||
static GtkWidget * dialogs_gradient_tab_func (GimpDockable *dockable,
|
||||
gint size);
|
||||
static GtkWidget * dialogs_palette_tab_func (GimpDockable *dockable,
|
||||
gint size);
|
||||
|
||||
static GimpDockable * dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *short_name,
|
||||
GimpDockableGetTabFunc get_tab_func);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GimpDockable *
|
||||
dialogs_image_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_container_list_view_new (image_context,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Image List", "Images",
|
||||
NULL);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_brush_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
global_brush_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Brush List", "Brushes",
|
||||
dialogs_brush_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_pattern_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
global_pattern_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Pattern List", "Patterns",
|
||||
dialogs_pattern_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_gradient_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
global_gradient_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Gradient List", "Gradients",
|
||||
dialogs_gradient_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_palette_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
global_palette_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Palette List", "Palettes",
|
||||
dialogs_palette_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_tool_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_container_list_view_new (global_tool_info_list,
|
||||
gimp_context_get_user (),
|
||||
22,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Tool List", "Tools",
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
GimpDockable *
|
||||
dialogs_image_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_container_grid_view_new (image_context,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Image Grid", "Images",
|
||||
NULL);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_brush_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
global_brush_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Brush Grid", "Brushes",
|
||||
dialogs_brush_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_pattern_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
global_pattern_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Pattern Grid", "Patterns",
|
||||
dialogs_pattern_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_gradient_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
global_gradient_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Gradient Grid", "Gradients",
|
||||
dialogs_gradient_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_palette_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
global_palette_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Palette Grid", "Palettes",
|
||||
dialogs_palette_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_tool_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_container_grid_view_new (global_tool_info_list,
|
||||
gimp_context_get_user (),
|
||||
22,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Tool Grid", "Tools",
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_brush_tab_func (GimpDockable *dockable,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_brush (context)),
|
||||
size, size, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect_object_while_alive
|
||||
(GTK_OBJECT (context),
|
||||
"brush_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
|
||||
GTK_OBJECT (preview));
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_pattern_tab_func (GimpDockable *dockable,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_pattern (context)),
|
||||
size, size, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect_object_while_alive
|
||||
(GTK_OBJECT (context),
|
||||
"pattern_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
|
||||
GTK_OBJECT (preview));
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_gradient_tab_func (GimpDockable *dockable,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_gradient (context)),
|
||||
size, size, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect_object_while_alive
|
||||
(GTK_OBJECT (context),
|
||||
"gradient_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
|
||||
GTK_OBJECT (preview));
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_palette_tab_func (GimpDockable *dockable,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_palette (context)),
|
||||
size, size, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect_object_while_alive
|
||||
(GTK_OBJECT (context),
|
||||
"palette_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
|
||||
GTK_OBJECT (preview));
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *short_name,
|
||||
GimpDockableGetTabFunc get_tab_func)
|
||||
|
||||
{
|
||||
GtkWidget *dockable;
|
||||
|
||||
dockable = gimp_dockable_new (name,
|
||||
short_name,
|
||||
get_tab_func);
|
||||
gtk_container_add (GTK_CONTAINER (dockable), widget);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
return GIMP_DOCKABLE (dockable);
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 __DIALOGS_CONSTRUCTORS_H__
|
||||
#define __DIALOGS_CONSTRUCTORS_H__
|
||||
|
||||
|
||||
GimpDockable * dialogs_image_list_view_new (void);
|
||||
GimpDockable * dialogs_brush_list_view_new (void);
|
||||
GimpDockable * dialogs_pattern_list_view_new (void);
|
||||
GimpDockable * dialogs_gradient_list_view_new (void);
|
||||
GimpDockable * dialogs_palette_list_view_new (void);
|
||||
GimpDockable * dialogs_tool_list_view_new (void);
|
||||
|
||||
GimpDockable * dialogs_image_grid_view_new (void);
|
||||
GimpDockable * dialogs_brush_grid_view_new (void);
|
||||
GimpDockable * dialogs_pattern_grid_view_new (void);
|
||||
GimpDockable * dialogs_gradient_grid_view_new (void);
|
||||
GimpDockable * dialogs_palette_grid_view_new (void);
|
||||
GimpDockable * dialogs_tool_grid_view_new (void);
|
||||
|
||||
|
||||
#endif /* __DIALOGS_CONSTRUCTORS_H__ */
|
|
@ -0,0 +1,80 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 "apptypes.h"
|
||||
|
||||
#include "dialogs.h"
|
||||
#include "dialogs-constructors.h"
|
||||
#include "gimpdialogfactory.h"
|
||||
#include "menus.h"
|
||||
|
||||
|
||||
GimpDialogFactory *global_dialog_factory = NULL;
|
||||
|
||||
|
||||
void
|
||||
dialogs_register (void)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
|
||||
item_factory = menus_get_dialogs_factory ();
|
||||
|
||||
global_dialog_factory = gimp_dialog_factory_new (item_factory);
|
||||
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:image_list",
|
||||
dialogs_image_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:brush_list",
|
||||
dialogs_brush_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:pattern_list",
|
||||
dialogs_pattern_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:gradient_list",
|
||||
dialogs_gradient_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:palette_list",
|
||||
dialogs_palette_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:tool_list",
|
||||
dialogs_tool_list_view_new);
|
||||
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:image_grid",
|
||||
dialogs_image_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:brush_grid",
|
||||
dialogs_brush_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:pattern_grid",
|
||||
dialogs_pattern_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:gradient_grid",
|
||||
dialogs_gradient_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:palette_grid",
|
||||
dialogs_palette_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:tool_grid",
|
||||
dialogs_tool_grid_view_new);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 __DIALOGS_H__
|
||||
#define __DISLOGS_H__
|
||||
|
||||
|
||||
extern GimpDialogFactory *global_dialog_factory;
|
||||
|
||||
|
||||
void dialogs_register (void);
|
||||
|
||||
|
||||
#endif /* __DIALOGS_H__ */
|
|
@ -0,0 +1,6 @@
|
|||
Makefile
|
||||
Makefile.in
|
||||
.deps
|
||||
.libs
|
||||
*.lo
|
||||
libappgui.la
|
|
@ -0,0 +1,29 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
noinst_LTLIBRARIES = libappgui.la
|
||||
|
||||
libappgui_la_SOURCES = \
|
||||
dialogs.c \
|
||||
dialogs.h \
|
||||
dialogs-commands.c \
|
||||
dialogs-commands.h \
|
||||
dialogs-constructors.c \
|
||||
dialogs-constructors.h \
|
||||
gimpdialogfactory.c \
|
||||
gimpdialogfactory.h
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gimp-GUI\"
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/app \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
|
@ -0,0 +1,67 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 "apptypes.h"
|
||||
|
||||
#include "widgets/gimpdock.h"
|
||||
#include "widgets/gimpdockbook.h"
|
||||
|
||||
#include "dialogs-commands.h"
|
||||
#include "dialogs-constructors.h"
|
||||
#include "gimpdialogfactory.h"
|
||||
|
||||
|
||||
void
|
||||
dialogs_add_tab_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpDockbook *dockbook;
|
||||
|
||||
dockbook = (GimpDockbook *) gtk_item_factory_popup_data_from_widget (widget);
|
||||
|
||||
if (dockbook && action)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
|
||||
dockable = gimp_dialog_factory_dialog_new (dockbook->dock->factory,
|
||||
GUINT_TO_POINTER (action));
|
||||
|
||||
if (dockable)
|
||||
gimp_dockbook_add (dockbook, dockable, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_remove_tab_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpDockbook *dockbook;
|
||||
|
||||
dockbook = (GimpDockbook *) gtk_item_factory_popup_data_from_widget (widget);
|
||||
|
||||
if (dockbook)
|
||||
{
|
||||
g_print ("remove\n");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 __DIALOGS_COMMANDS_H__
|
||||
#define __DIALOGS_COMMANDS_H__
|
||||
|
||||
|
||||
void dialogs_add_tab_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void dialogs_remove_tab_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
|
||||
#endif /* __DIALOGS_COMMANDS_H__ */
|
|
@ -0,0 +1,371 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "widgets/gimpcontainerlistview.h"
|
||||
#include "widgets/gimpcontainergridview.h"
|
||||
#include "widgets/gimpdatafactoryview.h"
|
||||
#include "widgets/gimpdockable.h"
|
||||
#include "widgets/gimppreview.h"
|
||||
|
||||
#include "context_manager.h"
|
||||
#include "gradient_editor.h"
|
||||
#include "gimpcontainer.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpdatafactory.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimprc.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static GtkWidget * dialogs_brush_tab_func (GimpDockable *dockable,
|
||||
gint size);
|
||||
static GtkWidget * dialogs_pattern_tab_func (GimpDockable *dockable,
|
||||
gint size);
|
||||
static GtkWidget * dialogs_gradient_tab_func (GimpDockable *dockable,
|
||||
gint size);
|
||||
static GtkWidget * dialogs_palette_tab_func (GimpDockable *dockable,
|
||||
gint size);
|
||||
|
||||
static GimpDockable * dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *short_name,
|
||||
GimpDockableGetTabFunc get_tab_func);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GimpDockable *
|
||||
dialogs_image_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_container_list_view_new (image_context,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Image List", "Images",
|
||||
NULL);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_brush_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
global_brush_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Brush List", "Brushes",
|
||||
dialogs_brush_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_pattern_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
global_pattern_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Pattern List", "Patterns",
|
||||
dialogs_pattern_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_gradient_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
global_gradient_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Gradient List", "Gradients",
|
||||
dialogs_gradient_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_palette_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
global_palette_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Palette List", "Palettes",
|
||||
dialogs_palette_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_tool_list_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_container_list_view_new (global_tool_info_list,
|
||||
gimp_context_get_user (),
|
||||
22,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Tool List", "Tools",
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
GimpDockable *
|
||||
dialogs_image_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_container_grid_view_new (image_context,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Image Grid", "Images",
|
||||
NULL);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_brush_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
global_brush_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Brush Grid", "Brushes",
|
||||
dialogs_brush_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_pattern_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
global_pattern_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Pattern Grid", "Patterns",
|
||||
dialogs_pattern_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_gradient_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
global_gradient_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Gradient Grid", "Gradients",
|
||||
dialogs_gradient_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_palette_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
global_palette_factory,
|
||||
NULL,
|
||||
gimp_context_get_user (),
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Palette Grid", "Palettes",
|
||||
dialogs_palette_tab_func);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_tool_grid_view_new (void)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_container_grid_view_new (global_tool_info_list,
|
||||
gimp_context_get_user (),
|
||||
22,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Tool Grid", "Tools",
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_brush_tab_func (GimpDockable *dockable,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_brush (context)),
|
||||
size, size, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect_object_while_alive
|
||||
(GTK_OBJECT (context),
|
||||
"brush_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
|
||||
GTK_OBJECT (preview));
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_pattern_tab_func (GimpDockable *dockable,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_pattern (context)),
|
||||
size, size, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect_object_while_alive
|
||||
(GTK_OBJECT (context),
|
||||
"pattern_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
|
||||
GTK_OBJECT (preview));
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_gradient_tab_func (GimpDockable *dockable,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_gradient (context)),
|
||||
size, size, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect_object_while_alive
|
||||
(GTK_OBJECT (context),
|
||||
"gradient_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
|
||||
GTK_OBJECT (preview));
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialogs_palette_tab_func (GimpDockable *dockable,
|
||||
gint size)
|
||||
{
|
||||
GimpContext *context;
|
||||
GtkWidget *preview;
|
||||
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
preview =
|
||||
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_palette (context)),
|
||||
size, size, 1,
|
||||
FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect_object_while_alive
|
||||
(GTK_OBJECT (context),
|
||||
"palette_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
|
||||
GTK_OBJECT (preview));
|
||||
|
||||
return preview;
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
dialogs_dockable_new (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const gchar *short_name,
|
||||
GimpDockableGetTabFunc get_tab_func)
|
||||
|
||||
{
|
||||
GtkWidget *dockable;
|
||||
|
||||
dockable = gimp_dockable_new (name,
|
||||
short_name,
|
||||
get_tab_func);
|
||||
gtk_container_add (GTK_CONTAINER (dockable), widget);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
return GIMP_DOCKABLE (dockable);
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 __DIALOGS_CONSTRUCTORS_H__
|
||||
#define __DIALOGS_CONSTRUCTORS_H__
|
||||
|
||||
|
||||
GimpDockable * dialogs_image_list_view_new (void);
|
||||
GimpDockable * dialogs_brush_list_view_new (void);
|
||||
GimpDockable * dialogs_pattern_list_view_new (void);
|
||||
GimpDockable * dialogs_gradient_list_view_new (void);
|
||||
GimpDockable * dialogs_palette_list_view_new (void);
|
||||
GimpDockable * dialogs_tool_list_view_new (void);
|
||||
|
||||
GimpDockable * dialogs_image_grid_view_new (void);
|
||||
GimpDockable * dialogs_brush_grid_view_new (void);
|
||||
GimpDockable * dialogs_pattern_grid_view_new (void);
|
||||
GimpDockable * dialogs_gradient_grid_view_new (void);
|
||||
GimpDockable * dialogs_palette_grid_view_new (void);
|
||||
GimpDockable * dialogs_tool_grid_view_new (void);
|
||||
|
||||
|
||||
#endif /* __DIALOGS_CONSTRUCTORS_H__ */
|
|
@ -0,0 +1,80 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 "apptypes.h"
|
||||
|
||||
#include "dialogs.h"
|
||||
#include "dialogs-constructors.h"
|
||||
#include "gimpdialogfactory.h"
|
||||
#include "menus.h"
|
||||
|
||||
|
||||
GimpDialogFactory *global_dialog_factory = NULL;
|
||||
|
||||
|
||||
void
|
||||
dialogs_register (void)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
|
||||
item_factory = menus_get_dialogs_factory ();
|
||||
|
||||
global_dialog_factory = gimp_dialog_factory_new (item_factory);
|
||||
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:image_list",
|
||||
dialogs_image_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:brush_list",
|
||||
dialogs_brush_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:pattern_list",
|
||||
dialogs_pattern_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:gradient_list",
|
||||
dialogs_gradient_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:palette_list",
|
||||
dialogs_palette_list_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:tool_list",
|
||||
dialogs_tool_list_view_new);
|
||||
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:image_grid",
|
||||
dialogs_image_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:brush_grid",
|
||||
dialogs_brush_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:pattern_grid",
|
||||
dialogs_pattern_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:gradient_grid",
|
||||
dialogs_gradient_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:palette_grid",
|
||||
dialogs_palette_grid_view_new);
|
||||
gimp_dialog_factory_register (global_dialog_factory,
|
||||
"gimp:tool_grid",
|
||||
dialogs_tool_grid_view_new);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 __DIALOGS_H__
|
||||
#define __DISLOGS_H__
|
||||
|
||||
|
||||
extern GimpDialogFactory *global_dialog_factory;
|
||||
|
||||
|
||||
void dialogs_register (void);
|
||||
|
||||
|
||||
#endif /* __DIALOGS_H__ */
|
|
@ -0,0 +1,175 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gimpdialogfactory.h"
|
||||
|
||||
|
||||
typedef struct _GimpDialogFactoryEntry GimpDialogFactoryEntry;
|
||||
|
||||
struct _GimpDialogFactoryEntry
|
||||
{
|
||||
gchar *identifier;
|
||||
GimpDialogNewFunc new_func;
|
||||
};
|
||||
|
||||
|
||||
static void gimp_dialog_factory_class_init (GimpDialogFactoryClass *klass);
|
||||
static void gimp_dialog_factory_init (GimpDialogFactory *factory);
|
||||
|
||||
static void gimp_dialog_factory_destroy (GtkObject *object);
|
||||
|
||||
|
||||
static GimpObjectClass *parent_class = NULL;
|
||||
|
||||
|
||||
GtkType
|
||||
gimp_dialog_factory_get_type (void)
|
||||
{
|
||||
static guint factory_type = 0;
|
||||
|
||||
if (! factory_type)
|
||||
{
|
||||
GtkTypeInfo factory_info =
|
||||
{
|
||||
"GimpDialogFactory",
|
||||
sizeof (GimpDialogFactory),
|
||||
sizeof (GimpDialogFactoryClass),
|
||||
(GtkClassInitFunc) gimp_dialog_factory_class_init,
|
||||
(GtkObjectInitFunc) gimp_dialog_factory_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
factory_type = gtk_type_unique (GIMP_TYPE_OBJECT, &factory_info);
|
||||
}
|
||||
|
||||
return factory_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_factory_class_init (GimpDialogFactoryClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GTK_TYPE_VBOX);
|
||||
|
||||
object_class->destroy = gimp_dialog_factory_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_factory_init (GimpDialogFactory *factory)
|
||||
{
|
||||
factory->item_factory = NULL;
|
||||
factory->registered_dialogs = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_factory_destroy (GtkObject *object)
|
||||
{
|
||||
GimpDialogFactory *factory;
|
||||
GList *list;
|
||||
|
||||
factory = GIMP_DIALOG_FACTORY (object);
|
||||
|
||||
for (list = factory->registered_dialogs; list; list = g_list_next (list))
|
||||
{
|
||||
GimpDialogFactoryEntry *entry;
|
||||
|
||||
entry = (GimpDialogFactoryEntry *) list->data;
|
||||
|
||||
g_free (entry->identifier);
|
||||
g_free (entry);
|
||||
}
|
||||
|
||||
g_list_free (factory->registered_dialogs);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
GimpDialogFactory *
|
||||
gimp_dialog_factory_new (GtkItemFactory *item_factory)
|
||||
{
|
||||
GimpDialogFactory *factory;
|
||||
|
||||
g_return_val_if_fail (item_factory != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_ITEM_FACTORY (item_factory), NULL);
|
||||
|
||||
factory = gtk_type_new (GIMP_TYPE_DIALOG_FACTORY);
|
||||
|
||||
factory->item_factory = item_factory;
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dialog_factory_register (GimpDialogFactory *factory,
|
||||
const gchar *identifier,
|
||||
GimpDialogNewFunc new_func)
|
||||
{
|
||||
GimpDialogFactoryEntry *entry;
|
||||
|
||||
g_return_if_fail (factory != NULL);
|
||||
g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
|
||||
g_return_if_fail (identifier != NULL);
|
||||
g_return_if_fail (new_func != NULL);
|
||||
|
||||
entry = g_new0 (GimpDialogFactoryEntry, 1);
|
||||
|
||||
entry->identifier = g_strdup (identifier);
|
||||
entry->new_func = new_func;
|
||||
|
||||
factory->registered_dialogs = g_list_prepend (factory->registered_dialogs,
|
||||
entry);
|
||||
}
|
||||
|
||||
GimpDockable *
|
||||
gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
|
||||
const gchar *identifier)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (factory != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
|
||||
g_return_val_if_fail (identifier != NULL, NULL);
|
||||
|
||||
for (list = factory->registered_dialogs; list; list = g_list_next (list))
|
||||
{
|
||||
GimpDialogFactoryEntry *entry;
|
||||
|
||||
entry = (GimpDialogFactoryEntry *) list->data;
|
||||
|
||||
if (! strcmp (identifier, entry->identifier))
|
||||
{
|
||||
return entry->new_func ();
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdialogfactory.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_DIALOG_FACTORY_H__
|
||||
#define __GIMP_DIALOG_FACTORY_H__
|
||||
|
||||
|
||||
#include "gimpobject.h"
|
||||
|
||||
|
||||
typedef GimpDockable * (* GimpDialogNewFunc) (void);
|
||||
|
||||
|
||||
#define GIMP_TYPE_DIALOG_FACTORY (gimp_dialog_factory_get_type ())
|
||||
#define GIMP_DIALOG_FACTORY(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DIALOG_FACTORY, GimpDialogFactory))
|
||||
#define GIMP_DIALOG_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DIALOG_FACTORY, GimpDialogFactoryClass))
|
||||
#define GIMP_IS_DIALOG_FACTORY(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DIALOG_FACTORY))
|
||||
#define GIMP_IS_DIALOG_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DIALOG_FACTORY))
|
||||
|
||||
|
||||
typedef struct _GimpDialogFactoryClass GimpDialogFactoryClass;
|
||||
|
||||
struct _GimpDialogFactory
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
|
||||
GtkItemFactory *item_factory;
|
||||
|
||||
GList *registered_dialogs;
|
||||
};
|
||||
|
||||
struct _GimpDialogFactoryClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gimp_dialog_factory_get_type (void);
|
||||
GimpDialogFactory * gimp_dialog_factory_new (GtkItemFactory *item_factory);
|
||||
|
||||
void gimp_dialog_factory_register (GimpDialogFactory *factory,
|
||||
const gchar *identifier,
|
||||
GimpDialogNewFunc new_func);
|
||||
|
||||
GimpDockable * gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
|
||||
const gchar *identifier);
|
||||
|
||||
|
||||
#endif /* __GIMP_DIALOG_FACTORY_H__ */
|
|
@ -24,10 +24,13 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/dialogs-commands.h"
|
||||
|
||||
#include "tools/gimptoolinfo.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
|
@ -47,8 +50,6 @@
|
|||
/* test dialogs */
|
||||
#include "test_commands.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
|
@ -253,11 +254,11 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
NULL, NULL }
|
||||
#endif
|
||||
};
|
||||
|
||||
static guint n_toolbox_entries = (sizeof (toolbox_entries) /
|
||||
sizeof (toolbox_entries[0]));
|
||||
static GtkItemFactory *toolbox_factory = NULL;
|
||||
|
||||
|
||||
/***** <Image> *****/
|
||||
|
||||
static GimpItemFactoryEntry image_entries[] =
|
||||
|
@ -584,7 +585,6 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
{ { N_("/Dialogs/Undo History..."), NULL, dialogs_undo_history_cmd_callback, 0},
|
||||
"dialogs/undo_history.html", NULL },
|
||||
|
||||
|
||||
{ { "/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
|
@ -643,6 +643,7 @@ static guint n_image_entries = (sizeof (image_entries) /
|
|||
sizeof (image_entries[0]));
|
||||
static GtkItemFactory *image_factory = NULL;
|
||||
|
||||
|
||||
/***** <Load> *****/
|
||||
|
||||
static GimpItemFactoryEntry load_entries[] =
|
||||
|
@ -656,6 +657,7 @@ static GimpItemFactoryEntry load_entries[] =
|
|||
static guint n_load_entries = (sizeof (load_entries) /
|
||||
sizeof (load_entries[0]));
|
||||
static GtkItemFactory *load_factory = NULL;
|
||||
|
||||
|
||||
/***** <Save> *****/
|
||||
|
||||
|
@ -671,6 +673,7 @@ static guint n_save_entries = (sizeof (save_entries) /
|
|||
sizeof (save_entries[0]));
|
||||
static GtkItemFactory *save_factory = NULL;
|
||||
|
||||
|
||||
/***** <Layers> *****/
|
||||
|
||||
static GimpItemFactoryEntry layers_entries[] =
|
||||
|
@ -741,6 +744,7 @@ static guint n_layers_entries = (sizeof (layers_entries) /
|
|||
sizeof (layers_entries[0]));
|
||||
static GtkItemFactory *layers_factory = NULL;
|
||||
|
||||
|
||||
/***** <Channels> *****/
|
||||
|
||||
static GimpItemFactoryEntry channels_entries[] =
|
||||
|
@ -779,6 +783,7 @@ static guint n_channels_entries = (sizeof (channels_entries) /
|
|||
sizeof (channels_entries[0]));
|
||||
static GtkItemFactory *channels_factory = NULL;
|
||||
|
||||
|
||||
/***** <Paths> *****/
|
||||
|
||||
static GimpItemFactoryEntry paths_entries[] =
|
||||
|
@ -816,6 +821,50 @@ static guint n_paths_entries = (sizeof (paths_entries) /
|
|||
sizeof (paths_entries[0]));
|
||||
static GtkItemFactory *paths_factory = NULL;
|
||||
|
||||
|
||||
/***** <Dialogs> *****/
|
||||
|
||||
static GimpItemFactoryEntry dialogs_entries[] =
|
||||
{
|
||||
{ { "/Select Tab", NULL, NULL, 0 },
|
||||
NULL, NULL },
|
||||
{ { "/Remove Tab", NULL, dialogs_remove_tab_cmd_callback, 0 },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/Brush List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:brush_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Pattern List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:pattern_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Gradient List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:gradient_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Palette List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:palette_list") },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/Brush Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:brush_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Pattern Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:pattern_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Gradient Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:gradient_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Palette Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:palette_grid") },
|
||||
NULL, NULL },
|
||||
};
|
||||
static guint n_dialogs_entries = (sizeof (dialogs_entries) /
|
||||
sizeof (dialogs_entries[0]));
|
||||
static GtkItemFactory *dialogs_factory = NULL;
|
||||
|
||||
|
||||
static gboolean menus_initialized = FALSE;
|
||||
|
||||
void
|
||||
|
@ -909,6 +958,16 @@ menus_get_paths_menu (GtkWidget **menu,
|
|||
*accel_group = paths_factory->accel_group;
|
||||
}
|
||||
|
||||
GtkItemFactory *
|
||||
menus_get_dialogs_factory (void)
|
||||
{
|
||||
if (!menus_initialized)
|
||||
menus_init ();
|
||||
|
||||
return dialogs_factory;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
|
||||
gchar *domain_name,
|
||||
|
@ -1349,6 +1408,7 @@ menus_quit (void)
|
|||
gtk_object_unref (GTK_OBJECT (layers_factory));
|
||||
gtk_object_unref (GTK_OBJECT (channels_factory));
|
||||
gtk_object_unref (GTK_OBJECT (paths_factory));
|
||||
gtk_object_unref (GTK_OBJECT (dialogs_factory));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1792,6 +1852,16 @@ menus_init (void)
|
|||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
dialogs_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Dialogs>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
|
||||
(gpointer) "dialogs");
|
||||
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
|
||||
"<Dialogs>", NULL);
|
||||
menus_create_items (dialogs_factory,
|
||||
n_dialogs_entries,
|
||||
dialogs_entries,
|
||||
NULL, 2);
|
||||
|
||||
|
||||
for (list = GIMP_LIST (global_tool_info_list)->list;
|
||||
list;
|
||||
|
|
|
@ -46,6 +46,11 @@ void menus_get_channels_menu (GtkWidget **menu,
|
|||
void menus_get_paths_menu (GtkWidget **menu,
|
||||
GtkAccelGroup **accel_group);
|
||||
|
||||
/* finally, all above functions will return the factory
|
||||
*/
|
||||
GtkItemFactory * menus_get_dialogs_factory (void);
|
||||
|
||||
|
||||
void menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
|
||||
gchar *domain_name,
|
||||
gpointer callback_data);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/dialogs.h"
|
||||
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "widgets/gimpcontainerlistview.h"
|
||||
|
@ -696,7 +698,7 @@ test_dock_new (GimpViewType view_type,
|
|||
GtkWidget *dockable;
|
||||
GtkWidget *view;
|
||||
|
||||
dock = gimp_dock_new ();
|
||||
dock = gimp_dock_new (global_dialog_factory);
|
||||
|
||||
dockbook = gimp_dockbook_new ();
|
||||
|
||||
|
|
78
app/menus.c
78
app/menus.c
|
@ -24,10 +24,13 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/dialogs-commands.h"
|
||||
|
||||
#include "tools/gimptoolinfo.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
|
@ -47,8 +50,6 @@
|
|||
/* test dialogs */
|
||||
#include "test_commands.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
|
@ -253,11 +254,11 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
NULL, NULL }
|
||||
#endif
|
||||
};
|
||||
|
||||
static guint n_toolbox_entries = (sizeof (toolbox_entries) /
|
||||
sizeof (toolbox_entries[0]));
|
||||
static GtkItemFactory *toolbox_factory = NULL;
|
||||
|
||||
|
||||
/***** <Image> *****/
|
||||
|
||||
static GimpItemFactoryEntry image_entries[] =
|
||||
|
@ -584,7 +585,6 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
{ { N_("/Dialogs/Undo History..."), NULL, dialogs_undo_history_cmd_callback, 0},
|
||||
"dialogs/undo_history.html", NULL },
|
||||
|
||||
|
||||
{ { "/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
|
@ -643,6 +643,7 @@ static guint n_image_entries = (sizeof (image_entries) /
|
|||
sizeof (image_entries[0]));
|
||||
static GtkItemFactory *image_factory = NULL;
|
||||
|
||||
|
||||
/***** <Load> *****/
|
||||
|
||||
static GimpItemFactoryEntry load_entries[] =
|
||||
|
@ -656,6 +657,7 @@ static GimpItemFactoryEntry load_entries[] =
|
|||
static guint n_load_entries = (sizeof (load_entries) /
|
||||
sizeof (load_entries[0]));
|
||||
static GtkItemFactory *load_factory = NULL;
|
||||
|
||||
|
||||
/***** <Save> *****/
|
||||
|
||||
|
@ -671,6 +673,7 @@ static guint n_save_entries = (sizeof (save_entries) /
|
|||
sizeof (save_entries[0]));
|
||||
static GtkItemFactory *save_factory = NULL;
|
||||
|
||||
|
||||
/***** <Layers> *****/
|
||||
|
||||
static GimpItemFactoryEntry layers_entries[] =
|
||||
|
@ -741,6 +744,7 @@ static guint n_layers_entries = (sizeof (layers_entries) /
|
|||
sizeof (layers_entries[0]));
|
||||
static GtkItemFactory *layers_factory = NULL;
|
||||
|
||||
|
||||
/***** <Channels> *****/
|
||||
|
||||
static GimpItemFactoryEntry channels_entries[] =
|
||||
|
@ -779,6 +783,7 @@ static guint n_channels_entries = (sizeof (channels_entries) /
|
|||
sizeof (channels_entries[0]));
|
||||
static GtkItemFactory *channels_factory = NULL;
|
||||
|
||||
|
||||
/***** <Paths> *****/
|
||||
|
||||
static GimpItemFactoryEntry paths_entries[] =
|
||||
|
@ -816,6 +821,50 @@ static guint n_paths_entries = (sizeof (paths_entries) /
|
|||
sizeof (paths_entries[0]));
|
||||
static GtkItemFactory *paths_factory = NULL;
|
||||
|
||||
|
||||
/***** <Dialogs> *****/
|
||||
|
||||
static GimpItemFactoryEntry dialogs_entries[] =
|
||||
{
|
||||
{ { "/Select Tab", NULL, NULL, 0 },
|
||||
NULL, NULL },
|
||||
{ { "/Remove Tab", NULL, dialogs_remove_tab_cmd_callback, 0 },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/Brush List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:brush_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Pattern List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:pattern_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Gradient List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:gradient_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Palette List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:palette_list") },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/Brush Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:brush_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Pattern Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:pattern_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Gradient Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:gradient_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Palette Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:palette_grid") },
|
||||
NULL, NULL },
|
||||
};
|
||||
static guint n_dialogs_entries = (sizeof (dialogs_entries) /
|
||||
sizeof (dialogs_entries[0]));
|
||||
static GtkItemFactory *dialogs_factory = NULL;
|
||||
|
||||
|
||||
static gboolean menus_initialized = FALSE;
|
||||
|
||||
void
|
||||
|
@ -909,6 +958,16 @@ menus_get_paths_menu (GtkWidget **menu,
|
|||
*accel_group = paths_factory->accel_group;
|
||||
}
|
||||
|
||||
GtkItemFactory *
|
||||
menus_get_dialogs_factory (void)
|
||||
{
|
||||
if (!menus_initialized)
|
||||
menus_init ();
|
||||
|
||||
return dialogs_factory;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
|
||||
gchar *domain_name,
|
||||
|
@ -1349,6 +1408,7 @@ menus_quit (void)
|
|||
gtk_object_unref (GTK_OBJECT (layers_factory));
|
||||
gtk_object_unref (GTK_OBJECT (channels_factory));
|
||||
gtk_object_unref (GTK_OBJECT (paths_factory));
|
||||
gtk_object_unref (GTK_OBJECT (dialogs_factory));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1792,6 +1852,16 @@ menus_init (void)
|
|||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
dialogs_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Dialogs>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
|
||||
(gpointer) "dialogs");
|
||||
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
|
||||
"<Dialogs>", NULL);
|
||||
menus_create_items (dialogs_factory,
|
||||
n_dialogs_entries,
|
||||
dialogs_entries,
|
||||
NULL, 2);
|
||||
|
||||
|
||||
for (list = GIMP_LIST (global_tool_info_list)->list;
|
||||
list;
|
||||
|
|
|
@ -46,6 +46,11 @@ void menus_get_channels_menu (GtkWidget **menu,
|
|||
void menus_get_paths_menu (GtkWidget **menu,
|
||||
GtkAccelGroup **accel_group);
|
||||
|
||||
/* finally, all above functions will return the factory
|
||||
*/
|
||||
GtkItemFactory * menus_get_dialogs_factory (void);
|
||||
|
||||
|
||||
void menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
|
||||
gchar *domain_name,
|
||||
gpointer callback_data);
|
||||
|
|
|
@ -24,10 +24,13 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/dialogs-commands.h"
|
||||
|
||||
#include "tools/gimptoolinfo.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
|
@ -47,8 +50,6 @@
|
|||
/* test dialogs */
|
||||
#include "test_commands.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
|
@ -253,11 +254,11 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
NULL, NULL }
|
||||
#endif
|
||||
};
|
||||
|
||||
static guint n_toolbox_entries = (sizeof (toolbox_entries) /
|
||||
sizeof (toolbox_entries[0]));
|
||||
static GtkItemFactory *toolbox_factory = NULL;
|
||||
|
||||
|
||||
/***** <Image> *****/
|
||||
|
||||
static GimpItemFactoryEntry image_entries[] =
|
||||
|
@ -584,7 +585,6 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
{ { N_("/Dialogs/Undo History..."), NULL, dialogs_undo_history_cmd_callback, 0},
|
||||
"dialogs/undo_history.html", NULL },
|
||||
|
||||
|
||||
{ { "/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
|
@ -643,6 +643,7 @@ static guint n_image_entries = (sizeof (image_entries) /
|
|||
sizeof (image_entries[0]));
|
||||
static GtkItemFactory *image_factory = NULL;
|
||||
|
||||
|
||||
/***** <Load> *****/
|
||||
|
||||
static GimpItemFactoryEntry load_entries[] =
|
||||
|
@ -656,6 +657,7 @@ static GimpItemFactoryEntry load_entries[] =
|
|||
static guint n_load_entries = (sizeof (load_entries) /
|
||||
sizeof (load_entries[0]));
|
||||
static GtkItemFactory *load_factory = NULL;
|
||||
|
||||
|
||||
/***** <Save> *****/
|
||||
|
||||
|
@ -671,6 +673,7 @@ static guint n_save_entries = (sizeof (save_entries) /
|
|||
sizeof (save_entries[0]));
|
||||
static GtkItemFactory *save_factory = NULL;
|
||||
|
||||
|
||||
/***** <Layers> *****/
|
||||
|
||||
static GimpItemFactoryEntry layers_entries[] =
|
||||
|
@ -741,6 +744,7 @@ static guint n_layers_entries = (sizeof (layers_entries) /
|
|||
sizeof (layers_entries[0]));
|
||||
static GtkItemFactory *layers_factory = NULL;
|
||||
|
||||
|
||||
/***** <Channels> *****/
|
||||
|
||||
static GimpItemFactoryEntry channels_entries[] =
|
||||
|
@ -779,6 +783,7 @@ static guint n_channels_entries = (sizeof (channels_entries) /
|
|||
sizeof (channels_entries[0]));
|
||||
static GtkItemFactory *channels_factory = NULL;
|
||||
|
||||
|
||||
/***** <Paths> *****/
|
||||
|
||||
static GimpItemFactoryEntry paths_entries[] =
|
||||
|
@ -816,6 +821,50 @@ static guint n_paths_entries = (sizeof (paths_entries) /
|
|||
sizeof (paths_entries[0]));
|
||||
static GtkItemFactory *paths_factory = NULL;
|
||||
|
||||
|
||||
/***** <Dialogs> *****/
|
||||
|
||||
static GimpItemFactoryEntry dialogs_entries[] =
|
||||
{
|
||||
{ { "/Select Tab", NULL, NULL, 0 },
|
||||
NULL, NULL },
|
||||
{ { "/Remove Tab", NULL, dialogs_remove_tab_cmd_callback, 0 },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/Brush List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:brush_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Pattern List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:pattern_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Gradient List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:gradient_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Palette List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:palette_list") },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/Brush Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:brush_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Pattern Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:pattern_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Gradient Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:gradient_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Palette Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:palette_grid") },
|
||||
NULL, NULL },
|
||||
};
|
||||
static guint n_dialogs_entries = (sizeof (dialogs_entries) /
|
||||
sizeof (dialogs_entries[0]));
|
||||
static GtkItemFactory *dialogs_factory = NULL;
|
||||
|
||||
|
||||
static gboolean menus_initialized = FALSE;
|
||||
|
||||
void
|
||||
|
@ -909,6 +958,16 @@ menus_get_paths_menu (GtkWidget **menu,
|
|||
*accel_group = paths_factory->accel_group;
|
||||
}
|
||||
|
||||
GtkItemFactory *
|
||||
menus_get_dialogs_factory (void)
|
||||
{
|
||||
if (!menus_initialized)
|
||||
menus_init ();
|
||||
|
||||
return dialogs_factory;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
|
||||
gchar *domain_name,
|
||||
|
@ -1349,6 +1408,7 @@ menus_quit (void)
|
|||
gtk_object_unref (GTK_OBJECT (layers_factory));
|
||||
gtk_object_unref (GTK_OBJECT (channels_factory));
|
||||
gtk_object_unref (GTK_OBJECT (paths_factory));
|
||||
gtk_object_unref (GTK_OBJECT (dialogs_factory));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1792,6 +1852,16 @@ menus_init (void)
|
|||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
dialogs_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Dialogs>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
|
||||
(gpointer) "dialogs");
|
||||
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
|
||||
"<Dialogs>", NULL);
|
||||
menus_create_items (dialogs_factory,
|
||||
n_dialogs_entries,
|
||||
dialogs_entries,
|
||||
NULL, 2);
|
||||
|
||||
|
||||
for (list = GIMP_LIST (global_tool_info_list)->list;
|
||||
list;
|
||||
|
|
|
@ -46,6 +46,11 @@ void menus_get_channels_menu (GtkWidget **menu,
|
|||
void menus_get_paths_menu (GtkWidget **menu,
|
||||
GtkAccelGroup **accel_group);
|
||||
|
||||
/* finally, all above functions will return the factory
|
||||
*/
|
||||
GtkItemFactory * menus_get_dialogs_factory (void);
|
||||
|
||||
|
||||
void menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
|
||||
gchar *domain_name,
|
||||
gpointer callback_data);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/dialogs.h"
|
||||
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "widgets/gimpcontainerlistview.h"
|
||||
|
@ -696,7 +698,7 @@ test_dock_new (GimpViewType view_type,
|
|||
GtkWidget *dockable;
|
||||
GtkWidget *view;
|
||||
|
||||
dock = gimp_dock_new ();
|
||||
dock = gimp_dock_new (global_dialog_factory);
|
||||
|
||||
dockbook = gimp_dockbook_new ();
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/gimpdialogfactory.h" /* hm, maybe this should live here? */
|
||||
|
||||
#include "gimpdnd.h"
|
||||
#include "gimpdock.h"
|
||||
#include "gimpdockable.h"
|
||||
|
@ -141,9 +143,18 @@ gimp_dock_destroy (GtkObject *object)
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_dock_new (void)
|
||||
gimp_dock_new (GimpDialogFactory *factory)
|
||||
{
|
||||
return GTK_WIDGET (gtk_type_new (GIMP_TYPE_DOCK));
|
||||
GimpDock *dock;
|
||||
|
||||
g_return_val_if_fail (factory != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
|
||||
|
||||
dock = gtk_type_new (GIMP_TYPE_DOCK);
|
||||
|
||||
dock->factory = factory;
|
||||
|
||||
return GTK_WIDGET (dock);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
|
|
@ -38,11 +38,13 @@ typedef struct _GimpDockClass GimpDockClass;
|
|||
|
||||
struct _GimpDock
|
||||
{
|
||||
GtkWindow parent_instance;
|
||||
GtkWindow parent_instance;
|
||||
|
||||
GtkWidget *vbox;
|
||||
GimpDialogFactory *factory;
|
||||
|
||||
GList *dockbooks;
|
||||
GtkWidget *vbox;
|
||||
|
||||
GList *dockbooks;
|
||||
};
|
||||
|
||||
struct _GimpDockClass
|
||||
|
@ -52,20 +54,20 @@ struct _GimpDockClass
|
|||
|
||||
|
||||
GtkType gimp_dock_get_type (void);
|
||||
GtkWidget * gimp_dock_new (void);
|
||||
GtkWidget * gimp_dock_new (GimpDialogFactory *factory);
|
||||
|
||||
void gimp_dock_add (GimpDock *dock,
|
||||
GimpDockable *dockable,
|
||||
gint book,
|
||||
gint index);
|
||||
void gimp_dock_remove (GimpDock *dock,
|
||||
GimpDockable *dockable);
|
||||
void gimp_dock_add (GimpDock *dock,
|
||||
GimpDockable *dockable,
|
||||
gint book,
|
||||
gint index);
|
||||
void gimp_dock_remove (GimpDock *dock,
|
||||
GimpDockable *dockable);
|
||||
|
||||
void gimp_dock_add_book (GimpDock *dock,
|
||||
GimpDockbook *dockbook,
|
||||
gint index);
|
||||
void gimp_dock_remove_book (GimpDock *dock,
|
||||
GimpDockbook *dockbook);
|
||||
void gimp_dock_add_book (GimpDock *dock,
|
||||
GimpDockbook *dockbook,
|
||||
gint index);
|
||||
void gimp_dock_remove_book (GimpDock *dock,
|
||||
GimpDockbook *dockbook);
|
||||
|
||||
|
||||
#endif /* __GIMP_DOCK_H__ */
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/gimpdialogfactory.h"
|
||||
|
||||
#include "gimpdock.h"
|
||||
#include "gimpdockable.h"
|
||||
#include "gimpdockbook.h"
|
||||
|
@ -115,9 +117,7 @@ gimp_dockbook_class_init (GimpDockbookClass *klass)
|
|||
static void
|
||||
gimp_dockbook_init (GimpDockbook *dockbook)
|
||||
{
|
||||
dockbook->dock = NULL;
|
||||
dockbook->remove_item = NULL;
|
||||
dockbook->add_item = NULL;
|
||||
dockbook->dock = NULL;
|
||||
|
||||
gtk_notebook_set_tab_border (GTK_NOTEBOOK (dockbook), 0);
|
||||
gtk_notebook_popup_enable (GTK_NOTEBOOK (dockbook));
|
||||
|
@ -182,6 +182,18 @@ gimp_dockbook_drag_drop (GtkWidget *widget,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dockbook_menu_switch_page (GtkWidget *widget,
|
||||
GimpDockable *dockable)
|
||||
{
|
||||
gint page_num;
|
||||
|
||||
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (dockable->dockbook),
|
||||
GTK_WIDGET (dockable));
|
||||
|
||||
gtk_notebook_set_page (GTK_NOTEBOOK (dockable->dockbook), page_num);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dockbook_add (GimpDockbook *dockbook,
|
||||
GimpDockable *dockable,
|
||||
|
@ -261,6 +273,33 @@ gimp_dockbook_add (GimpDockbook *dockbook,
|
|||
position);
|
||||
}
|
||||
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
GList *list;
|
||||
|
||||
menu_item = menu_widget->parent;
|
||||
|
||||
for (list = GTK_NOTEBOOK (dockbook)->children;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GtkNotebookPage *page;
|
||||
|
||||
page = (GtkNotebookPage *) list->data;
|
||||
|
||||
if (page->child == (GtkWidget *) dockable)
|
||||
{
|
||||
gtk_signal_disconnect_by_data (GTK_OBJECT (menu_item), page);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (gimp_dockbook_menu_switch_page),
|
||||
dockable);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (dockable));
|
||||
|
||||
gtk_drag_source_set (GTK_WIDGET (tab_widget),
|
||||
|
@ -283,26 +322,6 @@ gimp_dockbook_add (GimpDockbook *dockbook,
|
|||
dockbook);
|
||||
|
||||
dockable->dockbook = dockbook;
|
||||
|
||||
if (g_list_length (gtk_container_children (GTK_CONTAINER (dockbook))) == 1)
|
||||
{
|
||||
GtkWidget *item;
|
||||
|
||||
item = gtk_menu_item_new ();
|
||||
gtk_menu_append (GTK_MENU (GTK_NOTEBOOK (dockbook)->menu), item);
|
||||
gtk_widget_set_sensitive (item, FALSE);
|
||||
gtk_widget_show (item);
|
||||
|
||||
dockbook->remove_item = gtk_menu_item_new_with_label ("Remove Tab");
|
||||
gtk_menu_append (GTK_MENU (GTK_NOTEBOOK (dockbook)->menu),
|
||||
dockbook->remove_item);
|
||||
gtk_widget_show (dockbook->remove_item);
|
||||
|
||||
dockbook->add_item = gtk_menu_item_new_with_label ("Add Tab");
|
||||
gtk_menu_append (GTK_MENU (GTK_NOTEBOOK (dockbook)->menu),
|
||||
dockbook->add_item);
|
||||
gtk_widget_show (dockbook->add_item);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -318,15 +337,6 @@ gimp_dockbook_remove (GimpDockbook *dockbook,
|
|||
g_return_if_fail (dockable->dockbook != NULL);
|
||||
g_return_if_fail (dockable->dockbook == dockbook);
|
||||
|
||||
if (g_list_length (gtk_container_children (GTK_CONTAINER (dockbook))) == 1)
|
||||
{
|
||||
while (GTK_MENU_SHELL (GTK_NOTEBOOK (dockbook)->menu)->children->next)
|
||||
gtk_widget_destroy (GTK_WIDGET (GTK_MENU_SHELL (GTK_NOTEBOOK (dockbook)->menu)->children->next->data));
|
||||
|
||||
dockbook->remove_item = NULL;
|
||||
dockbook->add_item = NULL;
|
||||
}
|
||||
|
||||
dockable->dockbook = NULL;
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (dockbook), GTK_WIDGET (dockable));
|
||||
|
@ -337,23 +347,87 @@ gimp_dockbook_remove (GimpDockbook *dockbook,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dockbook_menu_detacher (GtkWidget *widget,
|
||||
GtkMenu *menu)
|
||||
{
|
||||
GtkNotebook *notebook;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_NOTEBOOK (widget));
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
g_return_if_fail (notebook->menu == (GtkWidget*) menu);
|
||||
|
||||
notebook->menu = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dockbook_tab_menu_end (GimpDockbook *dockbook)
|
||||
{
|
||||
GtkItemFactory *ifactory;
|
||||
GtkWidget *add_widget;
|
||||
GtkWidget *notebook_menu;
|
||||
|
||||
ifactory = GTK_ITEM_FACTORY (dockbook->dock->factory->item_factory);
|
||||
add_widget = gtk_item_factory_get_widget (ifactory, "/Select Tab");
|
||||
notebook_menu = GTK_NOTEBOOK (dockbook)->menu;
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (notebook_menu));
|
||||
gtk_menu_detach (GTK_MENU (notebook_menu));
|
||||
|
||||
gtk_menu_attach_to_widget (GTK_MENU (notebook_menu),
|
||||
GTK_WIDGET (dockbook),
|
||||
gimp_dockbook_menu_detacher);
|
||||
|
||||
gtk_object_unref (GTK_OBJECT (notebook_menu));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dockbook_tab_button_press (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
gpointer data)
|
||||
{
|
||||
GimpDockable *dockable;
|
||||
GimpDockbook *dockbook;
|
||||
gint page_num;
|
||||
|
||||
dockable = GIMP_DOCKABLE (data);
|
||||
dockbook = dockable->dockbook;
|
||||
|
||||
switch (bevent->button)
|
||||
{
|
||||
case 3:
|
||||
gtk_menu_popup (GTK_MENU (GTK_NOTEBOOK (dockable->dockbook)->menu),
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
3, bevent->time);
|
||||
{
|
||||
GtkItemFactory *ifactory;
|
||||
GtkWidget *add_widget;
|
||||
GtkWidget *notebook_menu;
|
||||
gint origin_x;
|
||||
gint origin_y;
|
||||
|
||||
ifactory = GTK_ITEM_FACTORY (dockbook->dock->factory->item_factory);
|
||||
add_widget = gtk_item_factory_get_widget (ifactory, "/Select Tab");
|
||||
notebook_menu = GTK_NOTEBOOK (dockbook)->menu;
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (notebook_menu));
|
||||
gtk_menu_detach (GTK_MENU (notebook_menu));
|
||||
|
||||
GTK_NOTEBOOK (dockbook)->menu = notebook_menu;
|
||||
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_widget),
|
||||
notebook_menu);
|
||||
|
||||
gtk_object_unref (GTK_OBJECT (notebook_menu));
|
||||
|
||||
gdk_window_get_origin (widget->window, &origin_x, &origin_y);
|
||||
|
||||
gtk_item_factory_popup_with_data (ifactory,
|
||||
dockbook,
|
||||
(GtkDestroyNotify) gimp_dockbook_tab_menu_end,
|
||||
bevent->x + origin_x,
|
||||
bevent->y + origin_y,
|
||||
3, bevent->time);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -446,7 +520,7 @@ gimp_dockbook_tab_drag_end (GtkWidget *widget,
|
|||
|
||||
gtk_object_set_data (GTK_OBJECT (dockable), "gimp_dock_drag_widget", NULL);
|
||||
|
||||
dock = gimp_dock_new ();
|
||||
dock = gimp_dock_new (dockable->dockbook->dock->factory);
|
||||
|
||||
gtk_window_set_position (GTK_WINDOW (dock), GTK_WIN_POS_MOUSE);
|
||||
|
||||
|
|
|
@ -40,10 +40,6 @@ struct _GimpDockbook
|
|||
GtkNotebook parent_instance;
|
||||
|
||||
GimpDock *dock;
|
||||
|
||||
/*< private >*/
|
||||
GtkWidget *remove_item;
|
||||
GtkWidget *add_item;
|
||||
};
|
||||
|
||||
struct _GimpDockbookClass
|
||||
|
|
|
@ -24,10 +24,13 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/dialogs-commands.h"
|
||||
|
||||
#include "tools/gimptoolinfo.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
|
@ -47,8 +50,6 @@
|
|||
/* test dialogs */
|
||||
#include "test_commands.h"
|
||||
|
||||
#include "libgimp/gimpenv.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
|
@ -253,11 +254,11 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
NULL, NULL }
|
||||
#endif
|
||||
};
|
||||
|
||||
static guint n_toolbox_entries = (sizeof (toolbox_entries) /
|
||||
sizeof (toolbox_entries[0]));
|
||||
static GtkItemFactory *toolbox_factory = NULL;
|
||||
|
||||
|
||||
/***** <Image> *****/
|
||||
|
||||
static GimpItemFactoryEntry image_entries[] =
|
||||
|
@ -584,7 +585,6 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
{ { N_("/Dialogs/Undo History..."), NULL, dialogs_undo_history_cmd_callback, 0},
|
||||
"dialogs/undo_history.html", NULL },
|
||||
|
||||
|
||||
{ { "/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
|
@ -643,6 +643,7 @@ static guint n_image_entries = (sizeof (image_entries) /
|
|||
sizeof (image_entries[0]));
|
||||
static GtkItemFactory *image_factory = NULL;
|
||||
|
||||
|
||||
/***** <Load> *****/
|
||||
|
||||
static GimpItemFactoryEntry load_entries[] =
|
||||
|
@ -656,6 +657,7 @@ static GimpItemFactoryEntry load_entries[] =
|
|||
static guint n_load_entries = (sizeof (load_entries) /
|
||||
sizeof (load_entries[0]));
|
||||
static GtkItemFactory *load_factory = NULL;
|
||||
|
||||
|
||||
/***** <Save> *****/
|
||||
|
||||
|
@ -671,6 +673,7 @@ static guint n_save_entries = (sizeof (save_entries) /
|
|||
sizeof (save_entries[0]));
|
||||
static GtkItemFactory *save_factory = NULL;
|
||||
|
||||
|
||||
/***** <Layers> *****/
|
||||
|
||||
static GimpItemFactoryEntry layers_entries[] =
|
||||
|
@ -741,6 +744,7 @@ static guint n_layers_entries = (sizeof (layers_entries) /
|
|||
sizeof (layers_entries[0]));
|
||||
static GtkItemFactory *layers_factory = NULL;
|
||||
|
||||
|
||||
/***** <Channels> *****/
|
||||
|
||||
static GimpItemFactoryEntry channels_entries[] =
|
||||
|
@ -779,6 +783,7 @@ static guint n_channels_entries = (sizeof (channels_entries) /
|
|||
sizeof (channels_entries[0]));
|
||||
static GtkItemFactory *channels_factory = NULL;
|
||||
|
||||
|
||||
/***** <Paths> *****/
|
||||
|
||||
static GimpItemFactoryEntry paths_entries[] =
|
||||
|
@ -816,6 +821,50 @@ static guint n_paths_entries = (sizeof (paths_entries) /
|
|||
sizeof (paths_entries[0]));
|
||||
static GtkItemFactory *paths_factory = NULL;
|
||||
|
||||
|
||||
/***** <Dialogs> *****/
|
||||
|
||||
static GimpItemFactoryEntry dialogs_entries[] =
|
||||
{
|
||||
{ { "/Select Tab", NULL, NULL, 0 },
|
||||
NULL, NULL },
|
||||
{ { "/Remove Tab", NULL, dialogs_remove_tab_cmd_callback, 0 },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/Brush List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:brush_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Pattern List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:pattern_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Gradient List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:gradient_list") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Palette List...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:palette_list") },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/Brush Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:brush_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Pattern Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:pattern_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Gradient Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:gradient_grid") },
|
||||
NULL, NULL },
|
||||
{ { "/Add Tab/Palette Grid...", NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:palette_grid") },
|
||||
NULL, NULL },
|
||||
};
|
||||
static guint n_dialogs_entries = (sizeof (dialogs_entries) /
|
||||
sizeof (dialogs_entries[0]));
|
||||
static GtkItemFactory *dialogs_factory = NULL;
|
||||
|
||||
|
||||
static gboolean menus_initialized = FALSE;
|
||||
|
||||
void
|
||||
|
@ -909,6 +958,16 @@ menus_get_paths_menu (GtkWidget **menu,
|
|||
*accel_group = paths_factory->accel_group;
|
||||
}
|
||||
|
||||
GtkItemFactory *
|
||||
menus_get_dialogs_factory (void)
|
||||
{
|
||||
if (!menus_initialized)
|
||||
menus_init ();
|
||||
|
||||
return dialogs_factory;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
|
||||
gchar *domain_name,
|
||||
|
@ -1349,6 +1408,7 @@ menus_quit (void)
|
|||
gtk_object_unref (GTK_OBJECT (layers_factory));
|
||||
gtk_object_unref (GTK_OBJECT (channels_factory));
|
||||
gtk_object_unref (GTK_OBJECT (paths_factory));
|
||||
gtk_object_unref (GTK_OBJECT (dialogs_factory));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1792,6 +1852,16 @@ menus_init (void)
|
|||
paths_entries,
|
||||
NULL, 2);
|
||||
|
||||
dialogs_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Dialogs>", NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
|
||||
(gpointer) "dialogs");
|
||||
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
|
||||
"<Dialogs>", NULL);
|
||||
menus_create_items (dialogs_factory,
|
||||
n_dialogs_entries,
|
||||
dialogs_entries,
|
||||
NULL, 2);
|
||||
|
||||
|
||||
for (list = GIMP_LIST (global_tool_info_list)->list;
|
||||
list;
|
||||
|
|
|
@ -46,6 +46,11 @@ void menus_get_channels_menu (GtkWidget **menu,
|
|||
void menus_get_paths_menu (GtkWidget **menu,
|
||||
GtkAccelGroup **accel_group);
|
||||
|
||||
/* finally, all above functions will return the factory
|
||||
*/
|
||||
GtkItemFactory * menus_get_dialogs_factory (void);
|
||||
|
||||
|
||||
void menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
|
||||
gchar *domain_name,
|
||||
gpointer callback_data);
|
||||
|
|
|
@ -782,6 +782,7 @@ libgimpwidgets/Makefile
|
|||
libgimpwidgets/makefile.mingw
|
||||
app/Makefile
|
||||
app/makefile.mingw
|
||||
app/gui/Makefile
|
||||
app/paint-funcs/Makefile
|
||||
app/pdb/Makefile
|
||||
app/tools/Makefile
|
||||
|
|
Loading…
Reference in New Issue