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 */
......
......@@ -40,6 +40,7 @@
#include "gimptoolbox.h"
#include "gimptoolbox-color-area.h"
#include "gimptoolbox-dnd.h"
#include "gimptoolbox-image-area.h"
#include "gimptoolbox-indicator-area.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
......@@ -78,11 +79,16 @@ static void gimp_toolbox_set_geometry (GimpToolbox *toolbox);
static void toolbox_create_tools (GimpToolbox *toolbox,
GimpContext *context);
static void toolbox_create_color_area (GimpToolbox *toolbox,
static GtkWidget * toolbox_create_color_area (GimpToolbox *toolbox,
GimpContext *context);
static void toolbox_create_indicator_area (GimpToolbox *toolbox,
static GtkWidget * toolbox_create_foo_area (GimpToolbox *toolbox,
GimpContext *context);
static GtkWidget * toolbox_create_image_area (GimpToolbox *toolbox,
GimpContext *context);
static void toolbox_area_notify (GimpGuiConfig *config,
GParamSpec *pspec,
GtkWidget *area);
static void toolbox_tool_changed (GimpContext *context,
GimpToolInfo *tool_info,
gpointer data);
......@@ -221,14 +227,23 @@ gimp_toolbox_constructor (GType type,
gtk_window_add_accel_group (GTK_WINDOW (toolbox),
gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (manager)));
toolbox->wbox = gtk_hwrap_box_new (FALSE);
gtk_wrap_box_set_justify (GTK_WRAP_BOX (toolbox->wbox), GTK_JUSTIFY_TOP);
gtk_wrap_box_set_line_justify (GTK_WRAP_BOX (toolbox->wbox),
toolbox->tool_wbox = gtk_hwrap_box_new (FALSE);
gtk_wrap_box_set_justify (GTK_WRAP_BOX (toolbox->tool_wbox), GTK_JUSTIFY_TOP);
gtk_wrap_box_set_line_justify (GTK_WRAP_BOX (toolbox->tool_wbox),
GTK_JUSTIFY_LEFT);
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (toolbox->tool_wbox), 5.0 / 6.0);
gtk_box_pack_start (GTK_BOX (vbox), toolbox->tool_wbox, FALSE, FALSE, 0);
gtk_widget_show (toolbox->tool_wbox);
toolbox->area_wbox = gtk_hwrap_box_new (FALSE);
gtk_wrap_box_set_justify (GTK_WRAP_BOX (toolbox->area_wbox), GTK_JUSTIFY_TOP);
gtk_wrap_box_set_line_justify (GTK_WRAP_BOX (toolbox->area_wbox),
GTK_JUSTIFY_LEFT);
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (toolbox->wbox), 5.0 / 6.0);
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (toolbox->area_wbox), 5.0 / 6.0);
gtk_box_pack_start (GTK_BOX (vbox), toolbox->wbox, FALSE, FALSE, 0);
gtk_widget_show (toolbox->wbox);
gtk_box_pack_start (GTK_BOX (vbox), toolbox->area_wbox, FALSE, FALSE, 0);
gtk_widget_show (toolbox->area_wbox);
/* We need to know when the current device changes, so we can update
* the correct tool - to do this we connect to motion events.
......@@ -256,12 +271,41 @@ gimp_toolbox_constructor (GType type,
}
toolbox_create_tools (toolbox, context);
toolbox_create_color_area (toolbox, context);
toolbox_create_indicator_area (toolbox, context);
g_signal_connect_object (context, "tool_changed",
toolbox->color_area = toolbox_create_color_area (toolbox, context);
gtk_wrap_box_pack_wrapped (GTK_WRAP_BOX (toolbox->area_wbox),
toolbox->color_area,
TRUE, TRUE, FALSE, TRUE, TRUE);
if (config->toolbox_color_area)
gtk_widget_show (toolbox->color_area);
g_signal_connect_object (config, "notify::toolbox-color-area",
G_CALLBACK (toolbox_area_notify),
toolbox->color_area, 0);
toolbox->foo_area = toolbox_create_foo_area (toolbox, context);
gtk_wrap_box_pack (GTK_WRAP_BOX (toolbox->area_wbox), toolbox->foo_area,
TRUE, TRUE, FALSE, TRUE);
if (config->toolbox_foo_area)
gtk_widget_show (toolbox->foo_area);
g_signal_connect_object (config, "notify::toolbox-foo-area",
G_CALLBACK (toolbox_area_notify),
toolbox->foo_area, 0);
toolbox->image_area = toolbox_create_image_area (toolbox, context);
gtk_wrap_box_pack (GTK_WRAP_BOX (toolbox->area_wbox), toolbox->image_area,
TRUE, TRUE, FALSE, TRUE);
if (config->toolbox_image_area)
gtk_widget_show (toolbox->image_area);
g_signal_connect_object (config, "notify::toolbox-image-area",
G_CALLBACK (toolbox_area_notify),
toolbox->image_area, 0);
g_signal_connect_object (context, "tool-changed",
G_CALLBACK (toolbox_tool_changed),
toolbox->wbox,
toolbox->tool_wbox,
0);
gimp_toolbox_dnd_init (GIMP_TOOLBOX (toolbox));
......@@ -284,7 +328,9 @@ static void
gimp_toolbox_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GimpToolbox *toolbox = GIMP_TOOLBOX (widget);
Gimp *gimp;
GimpGuiConfig *config;
GimpToolInfo *tool_info;
GtkWidget *tool_button;
......@@ -296,6 +342,8 @@ gimp_toolbox_size_allocate (GtkWidget *widget,
gimp = GIMP_DOCK (widget)->context->gimp;
config = GIMP_GUI_CONFIG (gimp->config);
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (gimp->tool_info_list,
"gimp-rect-select-tool");
......@@ -303,20 +351,13 @@ gimp_toolbox_size_allocate (GtkWidget *widget,
if (tool_button)
{
GimpToolbox *toolbox;
GtkRequisition button_requisition;
GtkRequisition color_requisition;
GtkRequisition indicator_requisition;
GList *list;
gint n_tools;
gint tool_rows;
gint tool_columns;
toolbox = GIMP_TOOLBOX (widget);
gtk_widget_size_request (tool_button, &button_requisition);
gtk_widget_size_request (toolbox->color_area, &color_requisition);
gtk_widget_size_request (toolbox->indicator_area, &indicator_requisition);
for (list = GIMP_LIST (gimp->tool_info_list)->list, n_tools = 0;
list;
......@@ -340,23 +381,53 @@ gimp_toolbox_size_allocate (GtkWidget *widget,
toolbox->tool_rows = tool_rows;
toolbox->tool_columns = tool_columns;
if ((tool_columns * button_requisition.width) >=
(color_requisition.width + indicator_requisition.width))
{
gtk_widget_set_size_request (toolbox->wbox, -1,
tool_rows *
button_requisition.height +
MAX (color_requisition.height,
indicator_requisition.height));
gtk_widget_set_size_request (toolbox->tool_wbox, -1,
tool_rows * button_requisition.height);
}
else
{
gtk_widget_set_size_request (toolbox->wbox, -1,
tool_rows *
button_requisition.height +
color_requisition.height +
indicator_requisition.height);
}
{
GtkRequisition color_requisition;
GtkRequisition foo_requisition;
GtkRequisition image_requisition;
gint width;
gint height;
gint n_areas;
gint area_rows;
gint area_columns;
gtk_widget_get_child_requisition (toolbox->color_area,
&color_requisition);
gtk_widget_get_child_requisition (toolbox->foo_area,
&foo_requisition);
gtk_widget_get_child_requisition (toolbox->image_area,
&image_requisition);
width = MAX (color_requisition.width,
MAX (foo_requisition.width,
image_requisition.width));
height = MAX (color_requisition.height,
MAX (foo_requisition.height,
image_requisition.height));
n_areas = (config->toolbox_color_area +
config->toolbox_foo_area +
config->toolbox_image_area);
area_columns = MAX (1, (allocation->width / width));
area_rows = n_areas / area_columns;
if (n_areas % area_columns)
area_rows++;
if (toolbox->area_rows != area_rows ||
toolbox->area_columns != area_columns)
{
toolbox->area_rows = area_rows;
toolbox->area_columns = area_columns;
gtk_widget_set_size_request (toolbox->area_wbox, -1,
area_rows * height);
}