removed the recently added utility functions again.

2004-10-12  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimptooloptions-gui.[ch]: removed the recently added
	utility functions again.

	* app/widgets/Makefile.am
	* app/widgets/gimpviewablebox.[ch]
	* app/widgets/gimpwidgets-utils.[ch]: and added cleaned up
	versions here.

	* app/tools/gimpbucketfilloptions.c
	* app/tools/gimpclonetool.c
	* app/tools/gimppaintoptions-gui.c
	* app/tools/gimptextoptions.c: changed accordingly.

	* app/dialogs/convert-dialog.c: use gimp_palette_box_new() instead
	of reinventing the wheel.
This commit is contained in:
Michael Natterer 2004-10-12 12:06:50 +00:00 committed by Michael Natterer
parent b09225b1a1
commit eb8ef9fe90
14 changed files with 439 additions and 302 deletions

View File

@ -1,3 +1,21 @@
2004-10-12 Michael Natterer <mitch@gimp.org>
* app/tools/gimptooloptions-gui.[ch]: removed the recently added
utility functions again.
* app/widgets/Makefile.am
* app/widgets/gimpviewablebox.[ch]
* app/widgets/gimpwidgets-utils.[ch]: and added cleaned up
versions here.
* app/tools/gimpbucketfilloptions.c
* app/tools/gimpclonetool.c
* app/tools/gimppaintoptions-gui.c
* app/tools/gimptextoptions.c: changed accordingly.
* app/dialogs/convert-dialog.c: use gimp_palette_box_new() instead
of reinventing the wheel.
2004-10-12 Sven Neumann <sven@gimp.org>
* app/widgets/gimpaction.c (gimp_action_set_proxy): use a larger

View File

@ -34,11 +34,9 @@
#include "core/gimppalette.h"
#include "core/gimpprogress.h"
#include "widgets/gimpcontainerentry.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpenumwidgets.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpviewablebutton.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gimpviewabledialog.h"
#include "gimp-intl.h"
@ -448,31 +446,7 @@ convert_dialog_palette_box (IndexedDialog *dialog)
G_CALLBACK (convert_dialog_palette_changed),
dialog);
{
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
hbox = gtk_hbox_new (FALSE, 4);
button = gimp_viewable_button_new (dialog->container,
dialog->context,
GIMP_VIEW_SIZE_MEDIUM, 1,
gimp_dialog_factory_from_name ("dock"),
"gimp-palette-list|gimp-palette-grid",
GIMP_STOCK_PALETTE,
_("Open the palette selection dialog"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
entry = gimp_container_entry_new (dialog->container,
dialog->context,
GIMP_VIEW_SIZE_MEDIUM, 1);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
return hbox;
}
return gimp_palette_box_new (dialog->container, dialog->context, 4);
}
static gboolean

View File

@ -34,11 +34,11 @@
#include "display/gimpdisplay.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpbucketfilloptions.h"
#include "gimppaintoptions-gui.h"
#include "gimptooloptions-gui.h"
#include "gimp-intl.h"
@ -243,8 +243,8 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
hbox = gimp_tool_options_pattern_box_new (tool_options);
gimp_tool_options_radio_frame_add_box (frame, hbox, GIMP_PATTERN_BUCKET_FILL);
hbox = gimp_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_BUCKET_FILL);
/* fill selection */
str = g_strdup_printf (_("Affected Area %s"),

View File

@ -33,6 +33,8 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
@ -256,6 +258,7 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *hbox;
vbox = gimp_paint_options_gui (tool_options);
@ -265,6 +268,9 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
hbox = gimp_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_CLONE);
frame = gimp_prop_enum_radio_frame_new (config, "align-mode",
_("Alignment"),
0, 0);

View File

@ -33,6 +33,7 @@
#include "paint/gimppaintoptions.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gtkhwrapbox.h"
#include "gimpairbrushtool.h"
@ -119,7 +120,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
tool_type != GIMP_TYPE_BLEND_TOOL &&
tool_type != GIMP_TYPE_INK_TOOL)
{
button = gimp_tool_options_brush_box_new (tool_options);
button = gimp_brush_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
_("Brush:"), 0.0, 0.5,
button, 2, FALSE);
@ -127,7 +128,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
if (tool_type == GIMP_TYPE_BLEND_TOOL)
{
button = gimp_tool_options_gradient_box_new (tool_options);
button = gimp_gradient_box_new (NULL, GIMP_CONTEXT (tool_options),
"gradient-reverse", 2);
gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
_("Gradient:"), 0.0, 0.5,
button, 2, TRUE);
@ -377,7 +379,8 @@ gradient_options_gui (GimpGradientOptions *gradient,
incremental_toggle);
/* the gradient view */
button = gimp_tool_options_gradient_box_new (GIMP_TOOL_OPTIONS (config));
button = gimp_gradient_box_new (NULL, GIMP_CONTEXT (config),
"gradient-reverse", 2);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Gradient:"), 0.0, 0.5,
button, 2, TRUE);

View File

@ -33,6 +33,8 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
@ -256,6 +258,7 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *hbox;
vbox = gimp_paint_options_gui (tool_options);
@ -265,6 +268,9 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
hbox = gimp_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_CLONE);
frame = gimp_prop_enum_radio_frame_new (config, "align-mode",
_("Alignment"),
0, 0);

View File

@ -38,6 +38,7 @@
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimptexteditor.h"
#include "widgets/gimpviewablebox.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimptextoptions.h"
@ -408,7 +409,7 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
hbox = gimp_tool_options_font_box_new (tool_options);
hbox = gimp_font_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("_Font:"), 0.0, 0.5,
hbox, 2, FALSE);

View File

@ -20,32 +20,12 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpdatafactory.h"
#include "core/gimptooloptions.h"
#include "widgets/gimpcontainerentry.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpview.h"
#include "widgets/gimpviewablebutton.h"
#include "widgets/gimpviewrenderergradient.h"
#include "gimptooloptions-gui.h"
#include "gimp-intl.h"
/* local function prototypes */
static void gimp_tool_options_gradient_reverse_notify (GimpToolOptions *tool_options,
GParamSpec *pspec,
GimpView *view);
/* public functions */
@ -60,240 +40,3 @@ gimp_tool_options_gui (GimpToolOptions *tool_options)
return vbox;
}
GtkWidget *
gimp_tool_options_brush_box_new (GimpToolOptions *tool_options)
{
GimpContext *context = GIMP_CONTEXT (tool_options);
GimpDialogFactory *dialog_factory;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
g_return_val_if_fail (GIMP_IS_TOOL_OPTIONS (tool_options), NULL);
dialog_factory = gimp_dialog_factory_from_name ("dock");
hbox = gtk_hbox_new (FALSE, 2);
button = gimp_viewable_button_new (context->gimp->brush_factory->container,
context,
GIMP_VIEW_SIZE_SMALL, 1,
dialog_factory,
"gimp-brush-grid|gimp-brush-list",
GIMP_STOCK_BRUSH,
_("Open the brush selection dialog"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
entry = gimp_container_entry_new (context->gimp->brush_factory->container,
context,
GIMP_VIEW_SIZE_SMALL, 1);
/* set a silly smally size request on the entry to disable
* GtkEntry's minimal width of 150 pixels.
*/
gtk_widget_set_size_request (entry, 10, -1);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
return hbox;
}
GtkWidget *
gimp_tool_options_pattern_box_new (GimpToolOptions *tool_options)
{
GimpContext *context = GIMP_CONTEXT (tool_options);
GimpDialogFactory *dialog_factory;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
g_return_val_if_fail (GIMP_IS_TOOL_OPTIONS (tool_options), NULL);
dialog_factory = gimp_dialog_factory_from_name ("dock");
hbox = gtk_hbox_new (FALSE, 2);
button = gimp_viewable_button_new (context->gimp->pattern_factory->container,
context,
GIMP_VIEW_SIZE_SMALL, 1,
dialog_factory,
"gimp-pattern-grid|gimp-pattern-list",
GIMP_STOCK_PATTERN,
_("Open the pattern selection dialog"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
entry = gimp_container_entry_new (context->gimp->pattern_factory->container,
context,
GIMP_VIEW_SIZE_SMALL, 1);
/* set a silly smally size request on the entry to disable
* GtkEntry's minimal width of 150 pixels.
*/
gtk_widget_set_size_request (entry, 10, -1);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
return hbox;
}
GtkWidget *
gimp_tool_options_gradient_box_new (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GimpContext *context = GIMP_CONTEXT (tool_options);
GimpDialogFactory *dialog_factory;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *toggle;
GtkWidget *preview;
g_return_val_if_fail (GIMP_IS_TOOL_OPTIONS (tool_options), NULL);
dialog_factory = gimp_dialog_factory_from_name ("dock");
hbox = gtk_hbox_new (FALSE, 2);
button = gimp_viewable_button_new (context->gimp->gradient_factory->container,
context,
GIMP_VIEW_SIZE_LARGE, 1,
dialog_factory,
"gimp-gradient-list|gimp-gradient-grid",
GIMP_STOCK_GRADIENT,
_("Open the gradient selection dialog"));
GIMP_VIEWABLE_BUTTON (button)->preview_size = GIMP_VIEW_SIZE_SMALL;
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
toggle = gimp_prop_check_button_new (config, "gradient-reverse",
_("Reverse"));
gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
gtk_widget_show (toggle);
preview = GTK_BIN (button)->child;
g_signal_connect_object (config, "notify::gradient-reverse",
G_CALLBACK (gimp_tool_options_gradient_reverse_notify),
G_OBJECT (preview), 0);
gimp_tool_options_gradient_reverse_notify (tool_options,
NULL,
GIMP_VIEW (preview));
return hbox;
}
GtkWidget *
gimp_tool_options_font_box_new (GimpToolOptions *tool_options)
{
GimpContext *context = GIMP_CONTEXT (tool_options);
GimpDialogFactory *dialog_factory;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
g_return_val_if_fail (GIMP_IS_TOOL_OPTIONS (tool_options), NULL);
dialog_factory = gimp_dialog_factory_from_name ("dock");
hbox = gtk_hbox_new (FALSE, 2);
button = gimp_viewable_button_new (context->gimp->fonts,
context,
GIMP_VIEW_SIZE_SMALL, 1,
dialog_factory,
"gimp-font-list|gimp-font-grid",
GIMP_STOCK_FONT,
_("Open the font selection dialog"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
entry = gimp_container_entry_new (context->gimp->fonts,
context,
GIMP_VIEW_SIZE_SMALL, 1);
/* set a silly smally size request on the entry to disable
* GtkEntry's minimal width of 150 pixels.
*/
gtk_widget_set_size_request (entry, 10, -1);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
return hbox;
}
void
gimp_tool_options_radio_frame_add_box (GtkWidget *frame,
GtkWidget *hbox,
gint enum_value)
{
GtkWidget *radio;
GtkWidget *spacer;
gint indicator_size;
gint indicator_spacing;
gint focus_width;
gint focus_padding;
GSList *list;
radio = g_object_get_data (G_OBJECT (frame), "radio-button");
gtk_widget_style_get (radio,
"indicator-size", &indicator_size,
"indicator-spacing", &indicator_spacing,
"focus-line-width", &focus_width,
"focus-padding", &focus_padding,
NULL);
spacer = gtk_vbox_new (FALSE, 0);
gtk_widget_set_size_request (spacer,
indicator_size +
3 * indicator_spacing +
focus_width +
focus_padding +
GTK_CONTAINER (radio)->border_width -
gtk_box_get_spacing (GTK_BOX (hbox)),
-1);
gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (hbox), spacer, 0);
gtk_widget_show (spacer);
for (list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
list;
list = g_slist_next (list))
{
if (GPOINTER_TO_INT (g_object_get_data (list->data, "gimp-item-data")) ==
enum_value)
{
g_object_set_data (list->data, "set_sensitive", hbox);
g_signal_connect (list->data, "toggled",
G_CALLBACK (gimp_toggle_button_sensitive_update),
NULL);
gtk_widget_set_sensitive (hbox,
GTK_TOGGLE_BUTTON (list->data)->active);
break;
}
}
gtk_box_pack_start (GTK_BOX (GTK_BIN (frame)->child), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
}
/* private functions */
static void
gimp_tool_options_gradient_reverse_notify (GimpToolOptions *tool_options,
GParamSpec *pspec,
GimpView *view)
{
GimpViewRendererGradient *rendergrad;
gboolean reverse;
rendergrad = GIMP_VIEW_RENDERER_GRADIENT (view->renderer);
g_object_get (tool_options, "gradient-reverse", &reverse, NULL);
gimp_view_renderer_gradient_set_reverse (rendergrad, reverse);
}

View File

@ -20,16 +20,7 @@
#define __GIMP_TOOL_OPTIONS_GUI_H__
GtkWidget * gimp_tool_options_gui (GimpToolOptions *tool_options);
GtkWidget * gimp_tool_options_brush_box_new (GimpToolOptions *tool_options);
GtkWidget * gimp_tool_options_pattern_box_new (GimpToolOptions *tool_options);
GtkWidget * gimp_tool_options_gradient_box_new (GimpToolOptions *tool_options);
GtkWidget * gimp_tool_options_font_box_new (GimpToolOptions *tool_options);
void gimp_tool_options_radio_frame_add_box (GtkWidget *frame,
GtkWidget *hbox,
gint enum_value);
GtkWidget * gimp_tool_options_gui (GimpToolOptions *tool_options);
#endif /* __GIMP_TOOL_OPTIONS_GUI_H__ */

View File

@ -242,6 +242,8 @@ libappwidgets_a_sources = \
gimpview.h \
gimpview-popup.c \
gimpview-popup.h \
gimpviewablebox.c \
gimpviewablebox.h \
gimpviewablebutton.c \
gimpviewablebutton.h \
gimpviewabledialog.c \

View File

@ -0,0 +1,282 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 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 "widgets-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "gimpcontainerentry.h"
#include "gimpdialogfactory.h"
#include "gimppropwidgets.h"
#include "gimpview.h"
#include "gimpviewablebutton.h"
#include "gimpviewablebox.h"
#include "gimpviewrenderergradient.h"
#include "gimp-intl.h"
/* local function prototypes */
static void gimp_gradient_box_reverse_notify (GObject *object,
GParamSpec *pspec,
GimpView *view);
/* public functions */
GtkWidget *
gimp_brush_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
{
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
g_return_val_if_fail (container == NULL ||
GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! container)
container = context->gimp->brush_factory->container;
hbox = gtk_hbox_new (FALSE, spacing);
button = gimp_viewable_button_new (container, context,
GIMP_VIEW_SIZE_SMALL, 1,
gimp_dialog_factory_from_name ("dock"),
"gimp-brush-grid|gimp-brush-list",
GIMP_STOCK_BRUSH,
_("Open the brush selection dialog"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
entry = gimp_container_entry_new (container, context,
GIMP_VIEW_SIZE_SMALL, 1);
/* set a silly smally size request on the entry to disable
* GtkEntry's minimal width of 150 pixels.
*/
gtk_widget_set_size_request (entry, 10, -1);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
return hbox;
}
GtkWidget *
gimp_pattern_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
{
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
g_return_val_if_fail (container == NULL ||
GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! container)
container = context->gimp->pattern_factory->container;
hbox = gtk_hbox_new (FALSE, spacing);
button = gimp_viewable_button_new (container, context,
GIMP_VIEW_SIZE_SMALL, 1,
gimp_dialog_factory_from_name ("dock"),
"gimp-pattern-grid|gimp-pattern-list",
GIMP_STOCK_PATTERN,
_("Open the pattern selection dialog"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
entry = gimp_container_entry_new (container, context,
GIMP_VIEW_SIZE_SMALL, 1);
/* set a silly smally size request on the entry to disable
* GtkEntry's minimal width of 150 pixels.
*/
gtk_widget_set_size_request (entry, 10, -1);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
return hbox;
}
GtkWidget *
gimp_gradient_box_new (GimpContainer *container,
GimpContext *context,
const gchar *reverse_prop,
gint spacing)
{
GtkWidget *hbox;
GtkWidget *button;
g_return_val_if_fail (container == NULL ||
GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! container)
container = context->gimp->gradient_factory->container;
hbox = gtk_hbox_new (FALSE, spacing);
button = gimp_viewable_button_new (container, context,
GIMP_VIEW_SIZE_LARGE, 1,
gimp_dialog_factory_from_name ("dock"),
"gimp-gradient-list|gimp-gradient-grid",
GIMP_STOCK_GRADIENT,
_("Open the gradient selection dialog"));
GIMP_VIEWABLE_BUTTON (button)->preview_size = GIMP_VIEW_SIZE_SMALL;
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
if (reverse_prop)
{
GtkWidget *toggle;
GtkWidget *preview;
gchar *signal_name;
toggle = gimp_prop_check_button_new (G_OBJECT (context), reverse_prop,
_("Reverse"));
gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
gtk_widget_show (toggle);
preview = GTK_BIN (button)->child;
signal_name = g_strconcat ("notify::", reverse_prop, NULL);
g_signal_connect_object (context, signal_name,
G_CALLBACK (gimp_gradient_box_reverse_notify),
G_OBJECT (preview), 0);
g_free (signal_name);
gimp_gradient_box_reverse_notify (G_OBJECT (context),
NULL,
GIMP_VIEW (preview));
}
return hbox;
}
GtkWidget *
gimp_palette_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
{
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
g_return_val_if_fail (container == NULL ||
GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! container)
container = context->gimp->palette_factory->container;
hbox = gtk_hbox_new (FALSE, spacing);
button = gimp_viewable_button_new (container, context,
GIMP_VIEW_SIZE_MEDIUM, 1,
gimp_dialog_factory_from_name ("dock"),
"gimp-palette-list|gimp-palette-grid",
GIMP_STOCK_PALETTE,
_("Open the palette selection dialog"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
entry = gimp_container_entry_new (container, context,
GIMP_VIEW_SIZE_MEDIUM, 1);
/* set a silly smally size request on the entry to disable
* GtkEntry's minimal width of 150 pixels.
*/
gtk_widget_set_size_request (entry, 10, -1);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
return hbox;
}
GtkWidget *
gimp_font_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
{
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
g_return_val_if_fail (container == NULL ||
GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! container)
container = context->gimp->fonts;
hbox = gtk_hbox_new (FALSE, spacing);
button = gimp_viewable_button_new (container, context,
GIMP_VIEW_SIZE_SMALL, 1,
gimp_dialog_factory_from_name ("dock"),
"gimp-font-list|gimp-font-grid",
GIMP_STOCK_FONT,
_("Open the font selection dialog"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
entry = gimp_container_entry_new (container, context,
GIMP_VIEW_SIZE_SMALL, 1);
/* set a silly smally size request on the entry to disable
* GtkEntry's minimal width of 150 pixels.
*/
gtk_widget_set_size_request (entry, 10, -1);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
return hbox;
}
/* private functions */
static void
gimp_gradient_box_reverse_notify (GObject *object,
GParamSpec *pspec,
GimpView *view)
{
GimpViewRendererGradient *rendergrad;
gboolean reverse;
rendergrad = GIMP_VIEW_RENDERER_GRADIENT (view->renderer);
g_object_get (object, "gradient-reverse", &reverse, NULL);
gimp_view_renderer_gradient_set_reverse (rendergrad, reverse);
}

View File

@ -0,0 +1,41 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1999 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_VIEWABLE_BOX_H__
#define __GIMP_VIEWABLE_BOX_H__
GtkWidget * gimp_brush_box_new (GimpContainer *container,
GimpContext *context,
gint spacing);
GtkWidget * gimp_pattern_box_new (GimpContainer *container,
GimpContext *context,
gint spacing);
GtkWidget * gimp_gradient_box_new (GimpContainer *container,
GimpContext *context,
const gchar *reverse_prop,
gint scacing);
GtkWidget * gimp_palette_box_new (GimpContainer *container,
GimpContext *context,
gint spacing);
GtkWidget * gimp_font_box_new (GimpContainer *container,
GimpContext *context,
gint spacing);
#endif /* __GIMP_VIEWABLE_BOX_H__ */

View File

@ -224,6 +224,73 @@ gimp_table_attach_stock (GtkTable *table,
}
}
void
gimp_enum_radio_frame_add (GtkFrame *frame,
GtkWidget *widget,
gint enum_value)
{
GtkWidget *radio;
GtkWidget *hbox;
GtkWidget *spacer;
gint indicator_size;
gint indicator_spacing;
gint focus_width;
gint focus_padding;
GSList *list;
g_return_if_fail (GTK_IS_FRAME (frame));
g_return_if_fail (GTK_IS_WIDGET (widget));
radio = g_object_get_data (G_OBJECT (frame), "radio-button");
g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
gtk_widget_style_get (radio,
"indicator-size", &indicator_size,
"indicator-spacing", &indicator_spacing,
"focus-line-width", &focus_width,
"focus-padding", &focus_padding,
NULL);
hbox = gtk_hbox_new (FALSE, 0);
spacer = gtk_vbox_new (FALSE, 0);
gtk_widget_set_size_request (spacer,
indicator_size +
3 * indicator_spacing +
focus_width +
focus_padding +
GTK_CONTAINER (radio)->border_width,
-1);
gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0);
gtk_widget_show (spacer);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
for (list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
list;
list = g_slist_next (list))
{
if (GPOINTER_TO_INT (g_object_get_data (list->data, "gimp-item-data")) ==
enum_value)
{
g_object_set_data (list->data, "set_sensitive", hbox);
g_signal_connect (list->data, "toggled",
G_CALLBACK (gimp_toggle_button_sensitive_update),
NULL);
gtk_widget_set_sensitive (hbox,
GTK_TOGGLE_BUTTON (list->data)->active);
break;
}
}
gtk_box_pack_start (GTK_BOX (GTK_BIN (frame)->child), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
}
GtkIconSize
gimp_get_icon_size (GtkWidget *widget,
const gchar *stock_id,

View File

@ -39,6 +39,9 @@ void gimp_table_attach_stock (GtkTable *table,
GtkWidget *widget,
gint colspan,
const gchar *stock_id);
void gimp_enum_radio_frame_add (GtkFrame *frame,
GtkWidget *widget,
gint enum_value);
GtkIconSize gimp_get_icon_size (GtkWidget *widget,
const gchar *stock_id,