2001-04-14 23:21:45 +08:00
|
|
|
/* 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"
|
|
|
|
|
2001-11-24 00:25:01 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2001-04-14 23:21:45 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2003-11-10 08:24:33 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "actions-types.h"
|
2001-04-14 23:21:45 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
#include "core/gimp.h"
|
|
|
|
|
2001-04-15 00:37:28 +08:00
|
|
|
#include "widgets/gimpdialogfactory.h"
|
2001-04-17 02:49:29 +08:00
|
|
|
#include "widgets/gimpdockable.h"
|
2001-04-14 23:21:45 +08:00
|
|
|
#include "widgets/gimpdockbook.h"
|
2005-05-12 04:26:12 +08:00
|
|
|
#include "widgets/gimpmenudock.h"
|
2001-04-14 23:21:45 +08:00
|
|
|
|
2004-09-13 23:15:23 +08:00
|
|
|
#include "dialogs/dialogs.h"
|
2001-04-14 23:21:45 +08:00
|
|
|
|
2004-05-03 22:46:29 +08:00
|
|
|
#include "actions.h"
|
|
|
|
#include "dialogs-commands.h"
|
2004-04-29 20:52:29 +08:00
|
|
|
|
|
|
|
|
2003-06-06 20:16:13 +08:00
|
|
|
/* local function prototypes */
|
|
|
|
|
2006-04-24 23:26:08 +08:00
|
|
|
static void dialogs_create_dock (GdkScreen *screen,
|
|
|
|
gboolean show_image_menu,
|
|
|
|
const gchar * const tabs[],
|
|
|
|
gint n_tabs);
|
2003-06-06 20:16:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
dialogs_show_toolbox_cmd_callback (GtkAction *action,
|
2004-04-19 22:54:24 +08:00
|
|
|
gpointer data)
|
2002-03-15 01:07:02 +08:00
|
|
|
{
|
|
|
|
dialogs_show_toolbox ();
|
|
|
|
}
|
|
|
|
|
2001-04-18 00:00:27 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
dialogs_create_toplevel_cmd_callback (GtkAction *action,
|
|
|
|
const gchar *value,
|
2006-04-12 20:49:29 +08:00
|
|
|
gpointer data)
|
2001-04-18 00:00:27 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GtkWidget *widget;
|
|
|
|
return_if_no_widget (widget, data);
|
2001-06-30 03:25:03 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
if (value)
|
|
|
|
gimp_dialog_factory_dialog_new (global_dialog_factory,
|
|
|
|
gtk_widget_get_screen (widget),
|
2004-09-01 06:41:15 +08:00
|
|
|
value, -1, TRUE);
|
2001-04-18 00:00:27 +08:00
|
|
|
}
|
|
|
|
|
2001-07-15 22:32:44 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
dialogs_create_dockable_cmd_callback (GtkAction *action,
|
|
|
|
const gchar *value,
|
2006-04-12 20:49:29 +08:00
|
|
|
gpointer data)
|
2001-07-15 22:32:44 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GtkWidget *widget;
|
|
|
|
return_if_no_widget (widget, data);
|
2003-09-30 23:48:14 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
if (value)
|
|
|
|
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
|
|
|
gtk_widget_get_screen (widget),
|
|
|
|
value, -1);
|
2001-07-15 22:32:44 +08:00
|
|
|
}
|
|
|
|
|
2001-05-12 01:02:30 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
dialogs_create_lc_cmd_callback (GtkAction *action,
|
2004-04-19 22:54:24 +08:00
|
|
|
gpointer data)
|
2001-05-12 01:02:30 +08:00
|
|
|
{
|
2006-04-18 18:08:10 +08:00
|
|
|
static const gchar * const tabs[] =
|
2001-11-30 02:11:31 +08:00
|
|
|
{
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-layer-list",
|
|
|
|
"gimp-channel-list",
|
|
|
|
"gimp-vectors-list",
|
2004-01-22 07:48:38 +08:00
|
|
|
"gimp-undo-history"
|
2001-11-30 02:11:31 +08:00
|
|
|
};
|
2001-05-12 01:02:30 +08:00
|
|
|
|
2004-10-14 22:12:40 +08:00
|
|
|
GtkWidget *widget;
|
2004-07-05 05:27:09 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2004-01-22 06:35:07 +08:00
|
|
|
dialogs_create_dock (gtk_widget_get_screen (widget), TRUE,
|
2003-11-08 23:29:47 +08:00
|
|
|
tabs, G_N_ELEMENTS (tabs));
|
2003-06-06 20:16:13 +08:00
|
|
|
}
|
2001-11-24 00:25:01 +08:00
|
|
|
|
2003-06-06 20:16:13 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
dialogs_create_data_cmd_callback (GtkAction *action,
|
2004-04-19 22:54:24 +08:00
|
|
|
gpointer data)
|
2003-06-06 20:16:13 +08:00
|
|
|
{
|
2006-04-18 18:08:10 +08:00
|
|
|
static const gchar * const tabs[] =
|
2003-06-06 20:16:13 +08:00
|
|
|
{
|
|
|
|
"gimp-brush-grid",
|
|
|
|
"gimp-pattern-grid",
|
|
|
|
"gimp-gradient-list",
|
|
|
|
"gimp-palette-list",
|
|
|
|
"gimp-font-list"
|
|
|
|
};
|
2001-05-12 01:02:30 +08:00
|
|
|
|
2004-10-14 22:12:40 +08:00
|
|
|
GtkWidget *widget;
|
2004-07-05 05:27:09 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2004-01-22 06:35:07 +08:00
|
|
|
dialogs_create_dock (gtk_widget_get_screen (widget), FALSE,
|
2003-11-08 23:29:47 +08:00
|
|
|
tabs, G_N_ELEMENTS (tabs));
|
2001-11-30 02:11:31 +08:00
|
|
|
}
|
2001-11-24 00:25:01 +08:00
|
|
|
|
2001-11-30 02:11:31 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
dialogs_create_stuff_cmd_callback (GtkAction *action,
|
2004-04-19 22:54:24 +08:00
|
|
|
gpointer data)
|
2001-11-30 02:11:31 +08:00
|
|
|
{
|
2006-04-18 18:08:10 +08:00
|
|
|
static const gchar * const tabs[] =
|
2001-11-30 02:11:31 +08:00
|
|
|
{
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-buffer-list",
|
|
|
|
"gimp-image-list",
|
2003-06-06 20:16:13 +08:00
|
|
|
"gimp-document-list",
|
|
|
|
"gimp-template-list"
|
2001-11-30 02:11:31 +08:00
|
|
|
};
|
2001-05-12 01:02:30 +08:00
|
|
|
|
2004-10-14 22:12:40 +08:00
|
|
|
GtkWidget *widget;
|
2004-07-05 05:27:09 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2004-01-22 06:35:07 +08:00
|
|
|
dialogs_create_dock (gtk_widget_get_screen (widget), FALSE,
|
2003-11-08 23:29:47 +08:00
|
|
|
tabs, G_N_ELEMENTS (tabs));
|
2001-05-12 01:02:30 +08:00
|
|
|
}
|
2001-11-30 22:41:56 +08:00
|
|
|
|
2002-03-15 01:07:02 +08:00
|
|
|
void
|
|
|
|
dialogs_show_toolbox (void)
|
|
|
|
{
|
|
|
|
if (! global_toolbox_factory->open_dialogs)
|
|
|
|
{
|
|
|
|
GtkWidget *toolbox;
|
|
|
|
|
2003-11-08 23:29:47 +08:00
|
|
|
toolbox = gimp_dialog_factory_dock_new (global_toolbox_factory,
|
|
|
|
gdk_screen_get_default ());
|
2002-03-15 01:07:02 +08:00
|
|
|
|
|
|
|
gtk_widget_show (toolbox);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-12-30 04:47:29 +08:00
|
|
|
gimp_dialog_factory_show_toolbox (global_toolbox_factory);
|
2002-03-15 01:07:02 +08:00
|
|
|
}
|
|
|
|
}
|
2003-06-06 20:16:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
2006-04-24 23:26:08 +08:00
|
|
|
dialogs_create_dock (GdkScreen *screen,
|
|
|
|
gboolean show_image_menu,
|
|
|
|
const gchar * const tabs[],
|
|
|
|
gint n_tabs)
|
2003-06-06 20:16:13 +08:00
|
|
|
{
|
|
|
|
GtkWidget *dock;
|
|
|
|
GtkWidget *dockbook;
|
|
|
|
GtkWidget *dockable;
|
|
|
|
gint i;
|
|
|
|
|
2003-11-08 23:29:47 +08:00
|
|
|
dock = gimp_dialog_factory_dock_new (global_dock_factory, screen);
|
2003-06-06 20:16:13 +08:00
|
|
|
|
2005-05-12 04:26:12 +08:00
|
|
|
gimp_menu_dock_set_show_image_menu (GIMP_MENU_DOCK (dock), show_image_menu);
|
2004-01-22 06:35:07 +08:00
|
|
|
|
2003-06-06 20:16:13 +08:00
|
|
|
dockbook = gimp_dockbook_new (global_dock_factory->menu_factory);
|
|
|
|
|
|
|
|
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
|
|
|
|
|
|
|
|
for (i = 0; i < n_tabs; i++)
|
|
|
|
{
|
|
|
|
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
|
2003-11-08 23:29:47 +08:00
|
|
|
screen,
|
2004-09-01 06:41:15 +08:00
|
|
|
tabs[i], -1, TRUE);
|
2003-06-06 20:16:13 +08:00
|
|
|
|
|
|
|
if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook)
|
|
|
|
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show (dock);
|
|
|
|
}
|