added "in_toolbox"; defaults to TRUE.

2003-06-06  Sven Neumann  <sven@gimp.org>

	* app/core/gimptoolinfo.[ch]: added "in_toolbox"; defaults to TRUE.

	* app/tools/tool_manager.c: set "in_toolbox" to FALSE for tools
	derived from GimpImageTool.

	* app/widgets/gimptoolbox.c: respect the new flag when constructing
	the toolbox.
This commit is contained in:
Sven Neumann 2003-06-06 14:58:20 +00:00 committed by Sven Neumann
parent 2cdaaf38b1
commit bc93e4a041
5 changed files with 49 additions and 16 deletions

View File

@ -1,8 +1,18 @@
2003-06-06 Sven Neumann <sven@gimp.org>
* app/core/gimptoolinfo.[ch]: added "in_toolbox"; defaults to TRUE.
* app/tools/tool_manager.c: set "in_toolbox" to FALSE for tools
derived from GimpImageTool.
* app/widgets/gimptoolbox.c: respect the new flag when constructing
the toolbox.
2003-06-06 Jakub Steiner <jimmac@ximian.com>
* M themes/Default/images/tools/stock-tool-smudge-16.png
* themes/Default/images/tools/stock-tool-smudge-16.png
* themes/Default/images/tools/stock-tool-smudge-22.png: make it
more clear it's a smudge tool, not a path tool
more clear it's a smudge tool, not a path tool.
2003-06-06 Sven Neumann <sven@gimp.org>

View File

@ -103,6 +103,8 @@ gimp_tool_info_init (GimpToolInfo *tool_info)
tool_info->help_domain = NULL;
tool_info->help_data = NULL;
tool_info->in_toolbox = TRUE;
tool_info->use_context = FALSE;
tool_info->tool_options = NULL;
tool_info->paint_info = NULL;
}

View File

@ -51,6 +51,7 @@ struct _GimpToolInfo
gchar *help_domain;
gchar *help_data;
gboolean in_toolbox;
gboolean use_context;
GimpToolOptions *tool_options;
GimpPaintInfo *paint_info;

View File

@ -38,6 +38,7 @@
#include "gimpconvolvetool.h"
#include "gimpdodgeburntool.h"
#include "gimperasertool.h"
#include "gimpimagemaptool.h"
#include "gimppaintbrushtool.h"
#include "gimppenciltool.h"
#include "gimprectselecttool.h"
@ -597,6 +598,9 @@ tool_manager_register_tool (GType tool_type,
paint_core_name,
stock_id);
if (g_type_is_a (tool_type, GIMP_TYPE_IMAGE_MAP_TOOL))
tool_info->in_toolbox = FALSE;
g_object_set_data (G_OBJECT (tool_info), "gimp-tool-options-gui-func",
options_gui_func);

View File

@ -209,7 +209,8 @@ gimp_toolbox_init (GimpToolbox *toolbox)
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), GTK_JUSTIFY_LEFT);
gtk_wrap_box_set_line_justify (GTK_WRAP_BOX (toolbox->wbox),
GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (vbox), toolbox->wbox, FALSE, FALSE, 0);
gtk_widget_show (toolbox->wbox);
@ -251,6 +252,7 @@ gimp_toolbox_size_allocate (GtkWidget *widget,
GtkRequisition button_requisition;
GtkRequisition color_requisition;
GtkRequisition indicator_requisition;
GList *list;
gint n_tools;
gint tool_rows;
gint tool_columns;
@ -261,12 +263,18 @@ gimp_toolbox_size_allocate (GtkWidget *widget,
gtk_widget_size_request (toolbox->color_area, &color_requisition);
gtk_widget_size_request (toolbox->indicator_area, &indicator_requisition);
n_tools = gimp_container_num_children (gimp->tool_info_list);
for (list = GIMP_LIST (gimp->tool_info_list)->list, n_tools = 0;
list;
list = list->next)
{
tool_info = (GimpToolInfo *) list->data;
tool_columns = MAX (1, (allocation->width /
button_requisition.width));
if (tool_info->in_toolbox)
n_tools++;
}
tool_rows = n_tools / tool_columns;
tool_columns = MAX (1, (allocation->width / button_requisition.width));
tool_rows = n_tools / tool_columns;
if (n_tools % tool_columns)
tool_rows++;
@ -328,7 +336,11 @@ gimp_toolbox_style_set (GtkWidget *widget,
{
tool_info = GIMP_TOOL_INFO (list->data);
tool_button = g_object_get_data (G_OBJECT (tool_info), "toolbox-button");
if (! tool_info->in_toolbox)
continue;
tool_button = g_object_get_data (G_OBJECT (tool_info),
"toolbox-button");
if (tool_button)
{
@ -647,18 +659,22 @@ toolbox_create_tools (GimpToolbox *toolbox,
button = gtk_radio_button_new (group);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
gtk_wrap_box_pack (GTK_WRAP_BOX (toolbox->wbox), button,
FALSE, FALSE, FALSE, FALSE);
gtk_widget_show (button);
if (tool_info->in_toolbox)
{
gtk_wrap_box_pack (GTK_WRAP_BOX (toolbox->wbox), button,
FALSE, FALSE, FALSE, FALSE);
gtk_widget_show (button);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
}
g_object_set_data (G_OBJECT (tool_info), "toolbox-button", button);
g_object_set_data (G_OBJECT (button), "tool-info", tool_info);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
if (tool_info == active_tool)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);