mirror of https://github.com/GNOME/gimp.git
app: add a brush selector to the MyPaint brush options
This commit is contained in:
parent
35936f4992
commit
8fa6e261d0
|
@ -33,6 +33,7 @@
|
|||
#include "paint/gimpmybrushoptions.h"
|
||||
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpviewablebox.h"
|
||||
|
||||
#include "gimpmybrushoptions-gui.h"
|
||||
#include "gimppaintoptions-gui.h"
|
||||
|
@ -45,8 +46,16 @@ gimp_mybrush_options_gui (GimpToolOptions *tool_options)
|
|||
{
|
||||
GObject *config = G_OBJECT (tool_options);
|
||||
GtkWidget *vbox = gimp_paint_options_gui (tool_options);
|
||||
GtkWidget *button;
|
||||
GtkWidget *scale;
|
||||
|
||||
/* the brush */
|
||||
button = gimp_prop_mybrush_box_new (NULL, GIMP_CONTEXT (tool_options),
|
||||
_("Brush"), 2,
|
||||
NULL, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* radius */
|
||||
scale = gimp_prop_spin_scale_new (config, "radius",
|
||||
_("Radius"),
|
||||
|
|
|
@ -133,6 +133,7 @@ gimp_prop_brush_box_new (GimpContainer *container,
|
|||
view_type_prop, view_size_prop);
|
||||
}
|
||||
|
||||
|
||||
/* dynamics boxes */
|
||||
|
||||
static GtkWidget *
|
||||
|
@ -198,6 +199,69 @@ gimp_prop_dynamics_box_new (GimpContainer *container,
|
|||
}
|
||||
|
||||
|
||||
/* brush boxes */
|
||||
|
||||
static GtkWidget *
|
||||
mybrush_box_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
const gchar *label,
|
||||
gint spacing,
|
||||
GimpViewType view_type,
|
||||
GimpViewSize view_size)
|
||||
{
|
||||
if (! container)
|
||||
container = gimp_data_factory_get_container (context->gimp->mybrush_factory);
|
||||
|
||||
return gimp_viewable_box_new (container, context, label, spacing,
|
||||
view_type, GIMP_VIEW_SIZE_LARGE, view_size,
|
||||
"gimp-mypaint-brush-grid|gimp-mypaint-brush-list",
|
||||
GIMP_STOCK_BRUSH,
|
||||
_("Open the MyPaint brush selection dialog"),
|
||||
NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_mybrush_box_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
const gchar *label,
|
||||
gint spacing)
|
||||
{
|
||||
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
|
||||
NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
|
||||
return mybrush_box_new (container, context, label, spacing,
|
||||
GIMP_VIEW_TYPE_GRID, GIMP_VIEW_SIZE_LARGE);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_mybrush_box_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
const gchar *label,
|
||||
gint spacing,
|
||||
const gchar *view_type_prop,
|
||||
const gchar *view_size_prop)
|
||||
{
|
||||
GimpViewType view_type = GIMP_VIEW_TYPE_GRID;
|
||||
GimpViewSize view_size = GIMP_VIEW_SIZE_LARGE;
|
||||
|
||||
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
|
||||
NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
|
||||
if (view_type_prop && view_size_prop)
|
||||
g_object_get (context,
|
||||
view_type_prop, &view_type,
|
||||
view_size_prop, &view_size,
|
||||
NULL);
|
||||
|
||||
return view_props_connect (mybrush_box_new (container, context, label, spacing,
|
||||
view_type, view_size),
|
||||
context,
|
||||
view_type_prop, view_size_prop);
|
||||
}
|
||||
|
||||
|
||||
/* pattern boxes */
|
||||
|
||||
static GtkWidget *
|
||||
|
@ -614,10 +678,13 @@ view_props_connect (GtkWidget *box,
|
|||
{
|
||||
GtkWidget *button = g_object_get_data (G_OBJECT (box), "viewable-button");
|
||||
|
||||
gimp_config_connect_full (G_OBJECT (context), G_OBJECT (button),
|
||||
view_type_prop, "popup-view-type");
|
||||
gimp_config_connect_full (G_OBJECT (context), G_OBJECT (button),
|
||||
view_size_prop, "popup-view-size");
|
||||
if (view_type_prop)
|
||||
gimp_config_connect_full (G_OBJECT (context), G_OBJECT (button),
|
||||
view_type_prop, "popup-view-type");
|
||||
|
||||
if (view_size_prop)
|
||||
gimp_config_connect_full (G_OBJECT (context), G_OBJECT (button),
|
||||
view_size_prop, "popup-view-size");
|
||||
|
||||
return box;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,17 @@ GtkWidget * gimp_prop_dynamics_box_new (GimpContainer *container,
|
|||
const gchar *view_size_prop,
|
||||
const gchar *editor_id);
|
||||
|
||||
GtkWidget * gimp_mybrush_box_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
const gchar *label,
|
||||
gint spacing);
|
||||
GtkWidget * gimp_prop_mybrush_box_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
const gchar *label,
|
||||
gint spacing,
|
||||
const gchar *view_type_prop,
|
||||
const gchar *view_size_prop);
|
||||
|
||||
GtkWidget * gimp_pattern_box_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
const gchar *label,
|
||||
|
|
Loading…
Reference in New Issue