Commit dbc49d9a authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/widgets/Makefile.am new toolbox area which shows the active image.

2004-05-31  Michael Natterer  <mitch@gimp.org>

	* app/widgets/Makefile.am
	* app/widgets/gimptoolbox-image-area.[ch]: new toolbox area which
	shows the active image.

	* app/config/gimpguiconfig.[ch]
	* app/config/gimprc-blurbs.h: added config options to control the
	visibility of the toolbox' color, indicator and image areas.

	* app/widgets/gimptoolbox.[ch]: added the image area and honor the
	new config options. Put the various areas into their own wrap box.

	* app/widgets/gimptoolbox-dnd.c: changed accordingly.

	* app/widgets/gimphelp-ids.h: added a help ID for the image area.

	* app/widgets/gimptoolbox-indicator-area.c: made the previews
	a bit larger, cleanup.

	* app/gui/preferences-dialog.c: added a "Toolbox" page as GUI for
	the new config options.

	* themes/Default/images/preferences/Makefile.am
	* themes/Default/images/preferences/toolbox.png: a (wrong) icon
	for the "Toolbox" prefs page. Needs to be replaced.
parent 4c03f015
2004-05-31 Michael Natterer <mitch@gimp.org>
* app/widgets/Makefile.am
* app/widgets/gimptoolbox-image-area.[ch]: new toolbox area which
shows the active image.
* app/config/gimpguiconfig.[ch]
* app/config/gimprc-blurbs.h: added config options to control the
visibility of the toolbox' color, indicator and image areas.
* app/widgets/gimptoolbox.[ch]: added the image area and honor the
new config options. Put the various areas into their own wrap box.
* app/widgets/gimptoolbox-dnd.c: changed accordingly.
* app/widgets/gimphelp-ids.h: added a help ID for the image area.
* app/widgets/gimptoolbox-indicator-area.c: made the previews
a bit larger, cleanup.
* app/gui/preferences-dialog.c: added a "Toolbox" page as GUI for
the new config options.
* themes/Default/images/preferences/Makefile.am
* themes/Default/images/preferences/toolbox.png: a (wrong) icon
for the "Toolbox" prefs page. Needs to be replaced.
2004-05-31 Sven Neumann <sven@gimp.org>
* app/widgets/Makefile.am
......
......@@ -79,6 +79,9 @@ enum
PROP_RESTORE_ACCELS,
PROP_LAST_OPENED_SIZE,
PROP_MAX_NEW_IMAGE_SIZE,
PROP_TOOLBOX_COLOR_AREA,
PROP_TOOLBOX_FOO_AREA,
PROP_TOOLBOX_IMAGE_AREA,
PROP_THEME_PATH,
PROP_THEME,
PROP_USE_HELP,
......@@ -206,6 +209,21 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
MAX_NEW_IMAGE_SIZE_BLURB,
0, GIMP_MAX_MEMSIZE, 1 << 26,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TOOLBOX_COLOR_AREA,
"toolbox-color-area",
TOOLBOX_COLOR_AREA_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TOOLBOX_FOO_AREA,
"toolbox-foo-area",
TOOLBOX_FOO_AREA_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TOOLBOX_IMAGE_AREA,
"toolbox-image-area",
TOOLBOX_IMAGE_AREA_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_THEME_PATH,
"theme-path", THEME_PATH_BLURB,
GIMP_PARAM_PATH_DIR_LIST,
......@@ -321,6 +339,15 @@ gimp_gui_config_set_property (GObject *object,
case PROP_MAX_NEW_IMAGE_SIZE:
gui_config->max_new_image_size = g_value_get_uint64 (value);
break;
case PROP_TOOLBOX_COLOR_AREA:
gui_config->toolbox_color_area = g_value_get_boolean (value);
break;
case PROP_TOOLBOX_FOO_AREA:
gui_config->toolbox_foo_area = g_value_get_boolean (value);
break;
case PROP_TOOLBOX_IMAGE_AREA:
gui_config->toolbox_image_area = g_value_get_boolean (value);
break;
case PROP_THEME_PATH:
g_free (gui_config->theme_path);
gui_config->theme_path = g_value_dup_string (value);
......@@ -417,6 +444,15 @@ gimp_gui_config_get_property (GObject *object,
case PROP_MAX_NEW_IMAGE_SIZE:
g_value_set_uint64 (value, gui_config->max_new_image_size);
break;
case PROP_TOOLBOX_COLOR_AREA:
g_value_set_boolean (value, gui_config->toolbox_color_area);
break;
case PROP_TOOLBOX_FOO_AREA:
g_value_set_boolean (value, gui_config->toolbox_foo_area);
break;
case PROP_TOOLBOX_IMAGE_AREA:
g_value_set_boolean (value, gui_config->toolbox_image_area);
break;
case PROP_THEME_PATH:
g_value_set_string (value, gui_config->theme_path);
break;
......
......@@ -57,6 +57,9 @@ struct _GimpGuiConfig
gboolean restore_accels;
gint last_opened_size;
guint64 max_new_image_size;
gboolean toolbox_color_area;
gboolean toolbox_foo_area;
gboolean toolbox_image_area;
gchar *theme_path;
gchar *theme;
gboolean use_help;
......
......@@ -351,6 +351,10 @@ N_("The tile cache is used to make sure the GIMP doesn't thrash " \
"the GIMP to use more memory. Conversely, a smaller cache size " \
"causes the GIMP to use more swap space and less memory.")
#define TOOLBOX_COLOR_AREA_BLURB NULL
#define TOOLBOX_FOO_AREA_BLURB NULL
#define TOOLBOX_IMAGE_AREA_BLURB NULL
#define TOOLBOX_WINDOW_HINT_BLURB \
N_("The window type hint that is set on the toolbox. This may affect " \
"how your window manager decorates and handles the toolbox window.")
......
......@@ -1375,6 +1375,38 @@ prefs_dialog_new (Gimp *gimp,
size_group = NULL;
/*************************/
/* Interface / Toolbox */
/*************************/
vbox = prefs_notebook_append_page (gimp,
GTK_NOTEBOOK (notebook),
_("Toolbox"),
"toolbox.png",
GTK_TREE_STORE (tree),
_("Toolbox"),
GIMP_HELP_PREFS_TOOLBOX,
&top_iter,
&child_iter,
page_index++);
/* Appearance */
vbox2 = prefs_frame_new (_("Appearance"),
GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add_with_icon (object, "toolbox-color-area",
_("Show Foreground & Background _Color"),
GIMP_STOCK_DEFAULT_COLORS,
GTK_BOX (vbox2));
prefs_check_button_add_with_icon (object, "toolbox-foo-area",
_("Show Active _Brush, Pattern & Gradient"),
GIMP_STOCK_BRUSH,
GTK_BOX (vbox2));
prefs_check_button_add_with_icon (object, "toolbox-image-area",
_("Show Active _Image"),
GIMP_STOCK_IMAGE,
GTK_BOX (vbox2));
/*******************************/
/* Interface / Input Devices */
/*******************************/
......
......@@ -1375,6 +1375,38 @@ prefs_dialog_new (Gimp *gimp,
size_group = NULL;
/*************************/
/* Interface / Toolbox */
/*************************/
vbox = prefs_notebook_append_page (gimp,
GTK_NOTEBOOK (notebook),
_("Toolbox"),
"toolbox.png",
GTK_TREE_STORE (tree),
_("Toolbox"),
GIMP_HELP_PREFS_TOOLBOX,
&top_iter,
&child_iter,
page_index++);
/* Appearance */
vbox2 = prefs_frame_new (_("Appearance"),
GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add_with_icon (object, "toolbox-color-area",
_("Show Foreground & Background _Color"),
GIMP_STOCK_DEFAULT_COLORS,
GTK_BOX (vbox2));
prefs_check_button_add_with_icon (object, "toolbox-foo-area",
_("Show Active _Brush, Pattern & Gradient"),
GIMP_STOCK_BRUSH,
GTK_BOX (vbox2));
prefs_check_button_add_with_icon (object, "toolbox-image-area",
_("Show Active _Image"),
GIMP_STOCK_IMAGE,
GTK_BOX (vbox2));
/*******************************/
/* Interface / Input Devices */
/*******************************/
......
......@@ -200,6 +200,8 @@ libappwidgets_a_sources = \
gimptoolbox-color-area.h \
gimptoolbox-dnd.c \
gimptoolbox-dnd.h \
gimptoolbox-image-area.c \
gimptoolbox-image-area.h \
gimptoolbox-indicator-area.c \
gimptoolbox-indicator-area.h \
gimptooldialog.c \
......
......@@ -359,6 +359,7 @@
#define GIMP_HELP_PREFS_INTERFACE "gimp-prefs-interface"
#define GIMP_HELP_PREFS_HELP "gimp-prefs-help"
#define GIMP_HELP_PREFS_TOOL_OPTIONS "gimp-prefs-tool-options"
#define GIMP_HELP_PREFS_TOOLBOX "gimp-prefs-toolbox"
#define GIMP_HELP_PREFS_INPUT_DEVICES "gimp-prefs-input-devices"
#define GIMP_HELP_PREFS_IMAGE_WINDOW "gimp-prefs-image-window"
#define GIMP_HELP_PREFS_IMAGE_WINDOW_APPEARANCE "gimp-prefs-image-window-appearance"
......
......@@ -65,21 +65,21 @@ gimp_toolbox_dnd_init (GimpToolbox *toolbox)
gimp_dnd_file_dest_add (GTK_WIDGET (toolbox), gimp_dnd_open_files, NULL);
gimp_dnd_file_dest_add (toolbox->wbox, gimp_dnd_open_files, NULL);
gimp_dnd_file_dest_add (toolbox->tool_wbox, gimp_dnd_open_files, NULL);
gimp_dnd_viewable_dest_add (toolbox->wbox, GIMP_TYPE_LAYER,
gimp_dnd_viewable_dest_add (toolbox->tool_wbox, GIMP_TYPE_LAYER,
gimp_toolbox_drop_drawable,
dock->context);
gimp_dnd_viewable_dest_add (toolbox->wbox, GIMP_TYPE_LAYER_MASK,
gimp_dnd_viewable_dest_add (toolbox->tool_wbox, GIMP_TYPE_LAYER_MASK,
gimp_toolbox_drop_drawable,
dock->context);
gimp_dnd_viewable_dest_add (toolbox->wbox, GIMP_TYPE_CHANNEL,
gimp_dnd_viewable_dest_add (toolbox->tool_wbox, GIMP_TYPE_CHANNEL,
gimp_toolbox_drop_drawable,
dock->context);
gimp_dnd_viewable_dest_add (toolbox->wbox, GIMP_TYPE_TOOL_INFO,
gimp_dnd_viewable_dest_add (toolbox->tool_wbox, GIMP_TYPE_TOOL_INFO,
gimp_toolbox_drop_tool,
dock->context);
gimp_dnd_viewable_dest_add (toolbox->wbox, GIMP_TYPE_BUFFER,
gimp_dnd_viewable_dest_add (toolbox->tool_wbox, GIMP_TYPE_BUFFER,
gimp_toolbox_drop_buffer,
dock->context);
}
......
/* 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 <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "gimpdialogfactory.h"
#include "gimpdnd.h"
#include "gimppreview.h"
#include "gimptoolbox.h"
#include "gimptoolbox-image-area.h"
#include "gimp-intl.h"
#define CELL_WIDTH 48
#define CELL_HEIGHT 48
static void
image_preview_clicked (GtkWidget *widget,
GdkModifierType state,
GimpToolbox *toolbox)
{
gimp_dialog_factory_dialog_raise (GIMP_DOCK (toolbox)->dialog_factory,
gtk_widget_get_screen (widget),
"gimp-image-list|gimp-image-grid", -1);
}
static void
image_preview_drop_image (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContext *context = GIMP_CONTEXT (data);
gimp_context_set_image (context, GIMP_IMAGE (viewable));
}
/* public functions */
GtkWidget *
gimp_toolbox_image_area_create (GimpToolbox *toolbox,
gint width,
gint height)
{
GimpContext *context;
GtkWidget *image_preview;
g_return_val_if_fail (GIMP_IS_TOOLBOX (toolbox), NULL);
context = GIMP_DOCK (toolbox)->context;
image_preview =
gimp_preview_new_full_by_types (GIMP_TYPE_PREVIEW, GIMP_TYPE_IMAGE,
width, height, 0,
FALSE, TRUE, TRUE);
gimp_preview_set_viewable (GIMP_PREVIEW (image_preview),
(GimpViewable *) gimp_context_get_image (context));
gtk_widget_show (image_preview);
gimp_help_set_help_data (image_preview,
_("The active image.\n"
"Click to open the Image Dialog."), NULL);
g_signal_connect_object (context, "image_changed",
G_CALLBACK (gimp_preview_set_viewable),
image_preview,
G_CONNECT_SWAPPED);
g_signal_connect (image_preview, "clicked",
G_CALLBACK (image_preview_clicked),
toolbox);
gimp_dnd_viewable_dest_add (image_preview,
GIMP_TYPE_IMAGE,
image_preview_drop_image,
context);
return image_preview;
}
/* 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 __GIMP_TOOLBOX_IMAGE_AREA_H__
#define __GIMP_TOOLBOX_IMAGE_AREA_H__
GtkWidget * gimp_toolbox_image_area_create (GimpToolbox *toolbox,
gint width,
gint height);
#endif /* __GIMP_TOOLBOX_IMAGE_AREA_H__ */
......@@ -41,10 +41,10 @@
#include "gimp-intl.h"
#define CELL_SIZE 23 /* The size of the previews */
#define GRAD_CELL_WIDTH 48 /* The width of the gradient preview */
#define GRAD_CELL_HEIGHT 12 /* The height of the gradient preview */
#define CELL_PADDING 2 /* How much between brush and pattern cells */
#define CELL_SIZE 26 /* The size of the previews */
#define GRAD_CELL_WIDTH 54 /* The width of the gradient preview */
#define GRAD_CELL_HEIGHT 14 /* The height of the gradient preview */
#define CELL_SPACING 2 /* How much between brush and pattern cells */
static void
......@@ -62,9 +62,7 @@ brush_preview_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContext *context;
context = GIMP_CONTEXT (data);
GimpContext *context = GIMP_CONTEXT (data);
gimp_context_set_brush (context, GIMP_BRUSH (viewable));
}
......@@ -84,9 +82,7 @@ pattern_preview_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContext *context;
context = GIMP_CONTEXT (data);
GimpContext *context = GIMP_CONTEXT (data);
gimp_context_set_pattern (context, GIMP_PATTERN (viewable));
}
......@@ -106,9 +102,7 @@ gradient_preview_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContext *context;
context = GIMP_CONTEXT (data);
GimpContext *context = GIMP_CONTEXT (data);
gimp_context_set_gradient (context, GIMP_GRADIENT (viewable));
}
......@@ -130,8 +124,8 @@ gimp_toolbox_indicator_area_create (GimpToolbox *toolbox)
context = GIMP_DOCK (toolbox)->context;
indicator_table = gtk_table_new (2, 2, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (indicator_table), CELL_PADDING);
gtk_table_set_col_spacings (GTK_TABLE (indicator_table), CELL_PADDING);
gtk_table_set_row_spacings (GTK_TABLE (indicator_table), CELL_SPACING);
gtk_table_set_col_spacings (GTK_TABLE (indicator_table), CELL_SPACING);
/* brush preview */
......@@ -142,21 +136,21 @@ gimp_toolbox_indicator_area_create (GimpToolbox *toolbox)
gimp_preview_set_viewable (GIMP_PREVIEW (brush_preview),
GIMP_VIEWABLE (gimp_context_get_brush (context)));
gtk_table_attach_defaults (GTK_TABLE (indicator_table), brush_preview,
0, 1, 0, 1);
0, 1, 0, 1);
gtk_widget_show (brush_preview);
gimp_help_set_help_data (brush_preview,
_("The active brush.\n"
"Click to open the Brush Dialog."), NULL);
_("The active brush.\n"
"Click to open the Brush Dialog."), NULL);
g_signal_connect_object (context, "brush_changed",
G_CALLBACK (gimp_preview_set_viewable),
brush_preview,
G_CONNECT_SWAPPED);
G_CALLBACK (gimp_preview_set_viewable),
brush_preview,
G_CONNECT_SWAPPED);
g_signal_connect (brush_preview, "clicked",
G_CALLBACK (brush_preview_clicked),
toolbox);
G_CALLBACK (brush_preview_clicked),
toolbox);
gimp_dnd_viewable_dest_add (brush_preview,
GIMP_TYPE_BRUSH,
......@@ -173,21 +167,21 @@ gimp_toolbox_indicator_area_create (GimpToolbox *toolbox)
GIMP_VIEWABLE (gimp_context_get_pattern (context)));
gtk_table_attach_defaults (GTK_TABLE (indicator_table), pattern_preview,
1, 2, 0, 1);
1, 2, 0, 1);
gtk_widget_show (pattern_preview);
gimp_help_set_help_data (pattern_preview,
_("The active pattern.\n"
"Click to open the Pattern Dialog."), NULL);
_("The active pattern.\n"
"Click to open the Pattern Dialog."), NULL);
g_signal_connect_object (context, "pattern_changed",
G_CALLBACK (gimp_preview_set_viewable),
pattern_preview,
G_CONNECT_SWAPPED);
G_CALLBACK (gimp_preview_set_viewable),
pattern_preview,
G_CONNECT_SWAPPED);
g_signal_connect (pattern_preview, "clicked",
G_CALLBACK (pattern_preview_clicked),
toolbox);
G_CALLBACK (pattern_preview_clicked),
toolbox);
gimp_dnd_viewable_dest_add (pattern_preview,
GIMP_TYPE_PATTERN,
......@@ -204,21 +198,21 @@ gimp_toolbox_indicator_area_create (GimpToolbox *toolbox)
GIMP_VIEWABLE (gimp_context_get_gradient (context)));
gtk_table_attach_defaults (GTK_TABLE (indicator_table), gradient_preview,
0, 2, 1, 2);
0, 2, 1, 2);
gtk_widget_show (gradient_preview);
gimp_help_set_help_data (gradient_preview,
_("The active gradient.\n"
"Click to open the Gradient Dialog."), NULL);
_("The active gradient.\n"
"Click to open the Gradient Dialog."), NULL);
g_signal_connect_object (context, "gradient_changed",
G_CALLBACK (gimp_preview_set_viewable),
gradient_preview,
G_CONNECT_SWAPPED);
G_CALLBACK (gimp_preview_set_viewable),
gradient_preview,
G_CONNECT_SWAPPED);
g_signal_connect (gradient_preview, "clicked",
G_CALLBACK (gradient_preview_clicked),
toolbox);
G_CALLBACK (gradient_preview_clicked),
toolbox);
gimp_dnd_viewable_dest_add (gradient_preview,
GIMP_TYPE_GRADIENT,
......
This diff is collapsed.
......@@ -38,12 +38,16 @@ struct _GimpToolbox
GimpDock parent_instance;
GtkWidget *menu_bar;
GtkWidget *wbox;
GtkWidget *tool_wbox;
GtkWidget *area_wbox;
GtkWidget *color_area;
GtkWidget *indicator_area;
GtkWidget *foo_area;
GtkWidget *image_area;
gint tool_rows;
gint tool_columns;
gint area_rows;
gint area_columns;
};
struct _GimpToolboxClass
......
......@@ -27,6 +27,7 @@ PREFS_IMAGES = \
monitor.png \
new-image.png \
session.png \
toolbox.png \
tool-options.png \
window-management.png
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment