added paint_options_container_scrolled() utility function which
2003-04-09 Michael Natterer <mitch@gimp.org> * app/tools/paint_options.[ch]: added paint_options_container_scrolled() utility function which wheel-scrolls a container. Use it for the brush and pattern previews. Added a gradient preview. * app/tools/gimpblendoptions.c: removed the gradient preview here. * app/tools/gimptextoptions.c: use the new function to scroll the font list.
This commit is contained in:

committed by
Michael Natterer

parent
bfe98456e4
commit
d2fbc95c43
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2003-04-09 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/paint_options.[ch]: added
|
||||
paint_options_container_scrolled() utility function which
|
||||
wheel-scrolls a container. Use it for the brush and pattern
|
||||
previews. Added a gradient preview.
|
||||
|
||||
* app/tools/gimpblendoptions.c: removed the gradient preview here.
|
||||
|
||||
* app/tools/gimptextoptions.c: use the new function to scroll
|
||||
the font list.
|
||||
|
||||
2003-04-08 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimpbucketfilloptions.c: removed the pattern preview...
|
||||
|
@ -30,9 +30,6 @@
|
||||
#include "core/gimpdatafactory.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpcontainerpopup.h"
|
||||
#include "widgets/gimpdock.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimpenummenu.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
|
||||
@ -66,8 +63,6 @@ static void gimp_blend_options_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void blend_options_gradient_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static void blend_options_gradient_type_notify (GimpBlendOptions *options,
|
||||
GParamSpec *pspec,
|
||||
GtkWidget *repeat_menu);
|
||||
@ -235,7 +230,6 @@ gimp_blend_options_gui (GimpToolOptions *tool_options)
|
||||
GtkWidget *frame;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *button;
|
||||
GtkWidget *preview;
|
||||
|
||||
config = G_OBJECT (tool_options);
|
||||
|
||||
@ -243,20 +237,6 @@ gimp_blend_options_gui (GimpToolOptions *tool_options)
|
||||
|
||||
table = g_object_get_data (G_OBJECT (vbox), GIMP_PAINT_OPTIONS_TABLE_KEY);
|
||||
|
||||
/* the gradient preview */
|
||||
button = gtk_button_new ();
|
||||
preview = gimp_prop_preview_new (config, "gradient", 32);
|
||||
gtk_container_add (GTK_CONTAINER (button), preview);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
||||
_("Gradient:"), 1.0, 0.5,
|
||||
button, 2, TRUE);
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (blend_options_gradient_clicked),
|
||||
tool_options);
|
||||
|
||||
/* the offset scale */
|
||||
gimp_prop_scale_entry_new (config, "offset",
|
||||
GTK_TABLE (table), 0, 3,
|
||||
@ -322,24 +302,6 @@ gimp_blend_options_gui (GimpToolOptions *tool_options)
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static void
|
||||
blend_options_gradient_clicked (GtkWidget *widget,
|
||||
GimpContext *context)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *popup;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
popup = gimp_container_popup_new (context->gimp->gradient_factory->container,
|
||||
context,
|
||||
GIMP_DOCK (toplevel)->dialog_factory,
|
||||
"gimp-gradient-list",
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
_("Open the gradient selection dialog"));
|
||||
gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget);
|
||||
}
|
||||
|
||||
static void
|
||||
blend_options_gradient_type_notify (GimpBlendOptions *options,
|
||||
GParamSpec *pspec,
|
||||
|
@ -28,7 +28,11 @@
|
||||
#include "config/gimpconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpbrush.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpdatafactory.h"
|
||||
#include "core/gimpgradient.h"
|
||||
#include "core/gimppattern.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "paint/gimppaintoptions.h"
|
||||
@ -67,10 +71,21 @@ static GtkWidget * gradient_options_gui (GimpGradientOptions *gradient,
|
||||
GType tool_type,
|
||||
GtkWidget *incremental_toggle);
|
||||
|
||||
static void paint_options_brush_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static void paint_options_pattern_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static void paint_options_brush_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static gboolean paint_options_brush_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context);
|
||||
static void paint_options_pattern_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static gboolean paint_options_pattern_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context);
|
||||
static void paint_options_gradient_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static gboolean paint_options_gradient_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context);
|
||||
|
||||
|
||||
GtkWidget *
|
||||
@ -142,6 +157,9 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (paint_options_brush_clicked),
|
||||
context);
|
||||
g_signal_connect (button, "scroll_event",
|
||||
G_CALLBACK (paint_options_brush_scrolled),
|
||||
context);
|
||||
}
|
||||
|
||||
/* the pattern preview */
|
||||
@ -163,6 +181,32 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (paint_options_pattern_clicked),
|
||||
context);
|
||||
g_signal_connect (button, "scroll_event",
|
||||
G_CALLBACK (paint_options_pattern_scrolled),
|
||||
context);
|
||||
}
|
||||
|
||||
/* the gradient preview */
|
||||
if (tool_options->tool_info->tool_type == GIMP_TYPE_BLEND_TOOL)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *preview;
|
||||
|
||||
button = gtk_button_new ();
|
||||
preview = gimp_prop_preview_new (config, "gradient", 32);
|
||||
gtk_container_add (GTK_CONTAINER (button), preview);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
|
||||
_("Gradient:"), 1.0, 0.5,
|
||||
button, 2, TRUE);
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (paint_options_gradient_clicked),
|
||||
context);
|
||||
g_signal_connect (button, "scroll_event",
|
||||
G_CALLBACK (paint_options_gradient_scrolled),
|
||||
context);
|
||||
}
|
||||
|
||||
/* the "incremental" toggle */
|
||||
@ -431,6 +475,51 @@ gradient_options_gui (GimpGradientOptions *gradient,
|
||||
return frame;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_container_scrolled (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
GType type,
|
||||
GdkEventScroll *sevent)
|
||||
{
|
||||
GimpObject *object;
|
||||
gint index;
|
||||
|
||||
object = gimp_context_get_by_type (context, type);
|
||||
|
||||
index = gimp_container_get_child_index (container, object);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
gint n_children;
|
||||
gint new_index = index;
|
||||
|
||||
n_children = gimp_container_num_children (container);
|
||||
|
||||
if (sevent->direction == GDK_SCROLL_UP)
|
||||
{
|
||||
if (index > 0)
|
||||
new_index--;
|
||||
else
|
||||
new_index = n_children - 1;
|
||||
}
|
||||
else if (sevent->direction == GDK_SCROLL_DOWN)
|
||||
{
|
||||
if (index == (n_children - 1))
|
||||
new_index = 0;
|
||||
else
|
||||
new_index++;
|
||||
}
|
||||
|
||||
if (new_index != index)
|
||||
{
|
||||
object = gimp_container_get_child_by_index (container, new_index);
|
||||
|
||||
if (object)
|
||||
gimp_context_set_by_type (context, type, object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
paint_options_brush_clicked (GtkWidget *widget,
|
||||
GimpContext *context)
|
||||
@ -449,6 +538,17 @@ paint_options_brush_clicked (GtkWidget *widget,
|
||||
gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
paint_options_brush_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context)
|
||||
{
|
||||
paint_options_container_scrolled (context->gimp->brush_factory->container,
|
||||
context, GIMP_TYPE_BRUSH, sevent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
paint_options_pattern_clicked (GtkWidget *widget,
|
||||
GimpContext *context)
|
||||
@ -466,3 +566,43 @@ paint_options_pattern_clicked (GtkWidget *widget,
|
||||
_("Open the pattern selection dialog"));
|
||||
gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
paint_options_pattern_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context)
|
||||
{
|
||||
paint_options_container_scrolled (context->gimp->pattern_factory->container,
|
||||
context, GIMP_TYPE_PATTERN, sevent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
paint_options_gradient_clicked (GtkWidget *widget,
|
||||
GimpContext *context)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *popup;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
popup = gimp_container_popup_new (context->gimp->gradient_factory->container,
|
||||
context,
|
||||
GIMP_DOCK (toplevel)->dialog_factory,
|
||||
"gimp-gradient-list",
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
_("Open the gradient selection dialog"));
|
||||
gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
paint_options_gradient_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context)
|
||||
{
|
||||
paint_options_container_scrolled (context->gimp->gradient_factory->container,
|
||||
context, GIMP_TYPE_GRADIENT, sevent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -26,4 +26,12 @@
|
||||
GtkWidget * gimp_paint_options_gui (GimpToolOptions *tool_options);
|
||||
|
||||
|
||||
/* utility function -- will become a widget soon */
|
||||
|
||||
void paint_options_container_scrolled (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
GType type,
|
||||
GdkEventScroll *sevent);
|
||||
|
||||
|
||||
#endif /* __PAINT_OPTIONS_H__ */
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "text/gimpfont.h"
|
||||
#include "text/gimptext.h"
|
||||
|
||||
#include "widgets/gimpcolorpanel.h"
|
||||
@ -44,6 +45,7 @@
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "gimptextoptions.h"
|
||||
#include "paint_options.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
@ -70,8 +72,11 @@ static void gimp_text_notify_font (GimpText *text,
|
||||
GParamSpec *pspec,
|
||||
GimpContext *context);
|
||||
|
||||
static void gimp_text_options_font_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static void gimp_text_options_font_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static gboolean gimp_text_options_font_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context);
|
||||
|
||||
|
||||
static GimpToolOptionsClass *parent_class = NULL;
|
||||
@ -249,6 +254,9 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gimp_text_options_font_clicked),
|
||||
options);
|
||||
g_signal_connect (button, "scroll_event",
|
||||
G_CALLBACK (gimp_text_options_font_scrolled),
|
||||
options);
|
||||
|
||||
font_selection = gimp_prop_font_selection_new (config, "font");
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
@ -363,7 +371,6 @@ gimp_text_options_editor_new (GimpTextOptions *options,
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gimp_text_options_font_clicked (GtkWidget *widget,
|
||||
GimpContext *context)
|
||||
@ -380,3 +387,14 @@ gimp_text_options_font_clicked (GtkWidget *widget,
|
||||
_("Open the font selection dialog"));
|
||||
gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_text_options_font_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context)
|
||||
{
|
||||
paint_options_container_scrolled (context->gimp->fonts,
|
||||
context, GIMP_TYPE_FONT, sevent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -28,7 +28,11 @@
|
||||
#include "config/gimpconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpbrush.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpdatafactory.h"
|
||||
#include "core/gimpgradient.h"
|
||||
#include "core/gimppattern.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "paint/gimppaintoptions.h"
|
||||
@ -67,10 +71,21 @@ static GtkWidget * gradient_options_gui (GimpGradientOptions *gradient,
|
||||
GType tool_type,
|
||||
GtkWidget *incremental_toggle);
|
||||
|
||||
static void paint_options_brush_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static void paint_options_pattern_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static void paint_options_brush_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static gboolean paint_options_brush_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context);
|
||||
static void paint_options_pattern_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static gboolean paint_options_pattern_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context);
|
||||
static void paint_options_gradient_clicked (GtkWidget *widget,
|
||||
GimpContext *context);
|
||||
static gboolean paint_options_gradient_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context);
|
||||
|
||||
|
||||
GtkWidget *
|
||||
@ -142,6 +157,9 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (paint_options_brush_clicked),
|
||||
context);
|
||||
g_signal_connect (button, "scroll_event",
|
||||
G_CALLBACK (paint_options_brush_scrolled),
|
||||
context);
|
||||
}
|
||||
|
||||
/* the pattern preview */
|
||||
@ -163,6 +181,32 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (paint_options_pattern_clicked),
|
||||
context);
|
||||
g_signal_connect (button, "scroll_event",
|
||||
G_CALLBACK (paint_options_pattern_scrolled),
|
||||
context);
|
||||
}
|
||||
|
||||
/* the gradient preview */
|
||||
if (tool_options->tool_info->tool_type == GIMP_TYPE_BLEND_TOOL)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *preview;
|
||||
|
||||
button = gtk_button_new ();
|
||||
preview = gimp_prop_preview_new (config, "gradient", 32);
|
||||
gtk_container_add (GTK_CONTAINER (button), preview);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
|
||||
_("Gradient:"), 1.0, 0.5,
|
||||
button, 2, TRUE);
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (paint_options_gradient_clicked),
|
||||
context);
|
||||
g_signal_connect (button, "scroll_event",
|
||||
G_CALLBACK (paint_options_gradient_scrolled),
|
||||
context);
|
||||
}
|
||||
|
||||
/* the "incremental" toggle */
|
||||
@ -431,6 +475,51 @@ gradient_options_gui (GimpGradientOptions *gradient,
|
||||
return frame;
|
||||
}
|
||||
|
||||
void
|
||||
paint_options_container_scrolled (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
GType type,
|
||||
GdkEventScroll *sevent)
|
||||
{
|
||||
GimpObject *object;
|
||||
gint index;
|
||||
|
||||
object = gimp_context_get_by_type (context, type);
|
||||
|
||||
index = gimp_container_get_child_index (container, object);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
gint n_children;
|
||||
gint new_index = index;
|
||||
|
||||
n_children = gimp_container_num_children (container);
|
||||
|
||||
if (sevent->direction == GDK_SCROLL_UP)
|
||||
{
|
||||
if (index > 0)
|
||||
new_index--;
|
||||
else
|
||||
new_index = n_children - 1;
|
||||
}
|
||||
else if (sevent->direction == GDK_SCROLL_DOWN)
|
||||
{
|
||||
if (index == (n_children - 1))
|
||||
new_index = 0;
|
||||
else
|
||||
new_index++;
|
||||
}
|
||||
|
||||
if (new_index != index)
|
||||
{
|
||||
object = gimp_container_get_child_by_index (container, new_index);
|
||||
|
||||
if (object)
|
||||
gimp_context_set_by_type (context, type, object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
paint_options_brush_clicked (GtkWidget *widget,
|
||||
GimpContext *context)
|
||||
@ -449,6 +538,17 @@ paint_options_brush_clicked (GtkWidget *widget,
|
||||
gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
paint_options_brush_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context)
|
||||
{
|
||||
paint_options_container_scrolled (context->gimp->brush_factory->container,
|
||||
context, GIMP_TYPE_BRUSH, sevent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
paint_options_pattern_clicked (GtkWidget *widget,
|
||||
GimpContext *context)
|
||||
@ -466,3 +566,43 @@ paint_options_pattern_clicked (GtkWidget *widget,
|
||||
_("Open the pattern selection dialog"));
|
||||
gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
paint_options_pattern_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context)
|
||||
{
|
||||
paint_options_container_scrolled (context->gimp->pattern_factory->container,
|
||||
context, GIMP_TYPE_PATTERN, sevent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
paint_options_gradient_clicked (GtkWidget *widget,
|
||||
GimpContext *context)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *popup;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
popup = gimp_container_popup_new (context->gimp->gradient_factory->container,
|
||||
context,
|
||||
GIMP_DOCK (toplevel)->dialog_factory,
|
||||
"gimp-gradient-list",
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
_("Open the gradient selection dialog"));
|
||||
gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
paint_options_gradient_scrolled (GtkWidget *widget,
|
||||
GdkEventScroll *sevent,
|
||||
GimpContext *context)
|
||||
{
|
||||
paint_options_container_scrolled (context->gimp->gradient_factory->container,
|
||||
context, GIMP_TYPE_GRADIENT, sevent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -26,4 +26,12 @@
|
||||
GtkWidget * gimp_paint_options_gui (GimpToolOptions *tool_options);
|
||||
|
||||
|
||||
/* utility function -- will become a widget soon */
|
||||
|
||||
void paint_options_container_scrolled (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
GType type,
|
||||
GdkEventScroll *sevent);
|
||||
|
||||
|
||||
#endif /* __PAINT_OPTIONS_H__ */
|
||||
|
Reference in New Issue
Block a user