[gimp] app: connect the MyPaint brush core with the new brush container
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: connect the MyPaint brush core with the new brush container
- Date: Mon, 21 Dec 2015 11:30:02 +0000 (UTC)
commit ccd8ec5dee728041cef9ddf050b6ca087a1f5afa
Author: Michael Natterer <mitch gimp org>
Date: Mon Dec 21 12:28:46 2015 +0100
app: connect the MyPaint brush core with the new brush container
and remove all hackish temp code that did the same. Remove quite
some #ifdefs around code that doesn't depend on libmypaint.
app/core/Makefile.am | 1 +
app/core/gimpmybrush.c | 114 +++++++++++++++++++++++++++-
app/core/gimpmybrush.h | 14 +++-
app/paint/gimpmybrushcore.c | 58 ++++++++++----
app/paint/gimpmybrushcore.h | 8 +--
app/paint/gimpmybrushoptions.c | 129 ++++++++-----------------------
app/paint/gimpmybrushoptions.h | 7 --
app/tools/gimpmybrushoptions-gui.c | 149 +-----------------------------------
app/tools/gimpmybrushoptions-gui.h | 4 -
app/tools/gimpmybrushtool.c | 6 +-
app/tools/gimpmybrushtool.h | 4 -
11 files changed, 204 insertions(+), 290 deletions(-)
---
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 8448ff9..eb78fdb 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -16,6 +16,7 @@ AM_CPPFLAGS = \
$(CAIRO_CFLAGS) \
$(GEGL_CFLAGS) \
$(GDK_PIXBUF_CFLAGS) \
+ $(LIBMYPAINTGEGL_CFLAGS) \
$(GEXIV2_CFLAGS) \
$(LCMS_CFLAGS) \
-I$(includedir) \
diff --git a/app/core/gimpmybrush.c b/app/core/gimpmybrush.c
index 68a8fbb..04c0c62 100644
--- a/app/core/gimpmybrush.c
+++ b/app/core/gimpmybrush.c
@@ -21,6 +21,10 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
+#ifdef HAVE_LIBMYPAINT
+#include <mypaint-brush.h>
+#endif
+
#include "core-types.h"
#include "gimpmybrush.h"
@@ -32,7 +36,12 @@
struct _GimpMybrushPrivate
{
- gpointer dummy;
+ gboolean json_loaded;
+
+ gchar *brush_json;
+ gdouble radius;
+ gdouble opaque;
+ gdouble hardness;
};
@@ -102,6 +111,10 @@ gimp_mybrush_init (GimpMybrush *brush)
brush->priv = G_TYPE_INSTANCE_GET_PRIVATE (brush,
GIMP_TYPE_MYBRUSH,
GimpMybrushPrivate);
+
+ brush->priv->radius = 1.0;
+ brush->priv->opaque = 1.0;
+ brush->priv->hardness = 1.0;
}
static void
@@ -109,6 +122,12 @@ gimp_mybrush_finalize (GObject *object)
{
GimpMybrush *brush = GIMP_MYBRUSH (object);
+ if (brush->priv->brush_json)
+ {
+ g_free (brush->priv->brush_json);
+ brush->priv->brush_json = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -220,3 +239,96 @@ gimp_mybrush_get_standard (GimpContext *context)
return standard_mybrush;
}
+
+static void
+gimp_mybrush_load_json (GimpMybrush *brush)
+{
+#ifdef HAVE_LIBMYPAINT
+
+ GFile *file = gimp_data_get_file (GIMP_DATA (brush));
+ MyPaintBrush *mypaint_brush = mypaint_brush_new ();
+
+ mypaint_brush_from_defaults (mypaint_brush);
+
+ if (file)
+ {
+ gchar *path = g_file_get_path (file);
+
+ if (g_file_get_contents (path, &brush->priv->brush_json, NULL, NULL))
+ {
+ if (! mypaint_brush_from_string (mypaint_brush,
+ brush->priv->brush_json))
+ {
+ g_printerr ("Failed to deserialize MyPaint brush\n");
+ g_free (brush->priv->brush_json);
+ brush->priv->brush_json = NULL;
+ }
+ }
+ else
+ {
+ g_printerr ("Failed to load MyPaint brush\n");
+ }
+ }
+
+ brush->priv->radius =
+ mypaint_brush_get_base_value (mypaint_brush,
+ MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC);
+
+ brush->priv->opaque =
+ mypaint_brush_get_base_value (mypaint_brush,
+ MYPAINT_BRUSH_SETTING_OPAQUE);
+
+ brush->priv->hardness =
+ mypaint_brush_get_base_value (mypaint_brush,
+ MYPAINT_BRUSH_SETTING_HARDNESS);
+
+ mypaint_brush_unref (mypaint_brush);
+
+#endif
+
+ brush->priv->json_loaded = TRUE;
+}
+
+const gchar *
+gimp_mybrush_get_brush_json (GimpMybrush *brush)
+{
+ g_return_val_if_fail (GIMP_IS_MYBRUSH (brush), NULL);
+
+ if (! brush->priv->json_loaded)
+ gimp_mybrush_load_json (brush);
+
+ return brush->priv->brush_json;
+}
+
+gdouble
+gimp_mybrush_get_radius (GimpMybrush *brush)
+{
+ g_return_val_if_fail (GIMP_IS_MYBRUSH (brush), 1.0);
+
+ if (! brush->priv->json_loaded)
+ gimp_mybrush_load_json (brush);
+
+ return brush->priv->radius;
+}
+
+gdouble
+gimp_mybrush_get_opaque (GimpMybrush *brush)
+{
+ g_return_val_if_fail (GIMP_IS_MYBRUSH (brush), 1.0);
+
+ if (! brush->priv->json_loaded)
+ gimp_mybrush_load_json (brush);
+
+ return brush->priv->opaque;
+}
+
+gdouble
+gimp_mybrush_get_hardness (GimpMybrush *brush)
+{
+ g_return_val_if_fail (GIMP_IS_MYBRUSH (brush), 1.0);
+
+ if (! brush->priv->json_loaded)
+ gimp_mybrush_load_json (brush);
+
+ return brush->priv->hardness;
+}
diff --git a/app/core/gimpmybrush.h b/app/core/gimpmybrush.h
index b01f023..252e576 100644
--- a/app/core/gimpmybrush.h
+++ b/app/core/gimpmybrush.h
@@ -46,11 +46,17 @@ struct _GimpMybrushClass
};
-GType gimp_mybrush_get_type (void) G_GNUC_CONST;
+GType gimp_mybrush_get_type (void) G_GNUC_CONST;
-GimpData * gimp_mybrush_new (GimpContext *context,
- const gchar *name);
-GimpData * gimp_mybrush_get_standard (GimpContext *context);
+GimpData * gimp_mybrush_new (GimpContext *context,
+ const gchar *name);
+GimpData * gimp_mybrush_get_standard (GimpContext *context);
+
+const gchar * gimp_mybrush_get_brush_json (GimpMybrush *brush);
+
+gdouble gimp_mybrush_get_radius (GimpMybrush *brush);
+gdouble gimp_mybrush_get_opaque (GimpMybrush *brush);
+gdouble gimp_mybrush_get_hardness (GimpMybrush *brush);
#endif /* __GIMP_MYBRUSH_H__ */
diff --git a/app/paint/gimpmybrushcore.c b/app/paint/gimpmybrushcore.c
index 7bf951d..47aeb6e 100644
--- a/app/paint/gimpmybrushcore.c
+++ b/app/paint/gimpmybrushcore.c
@@ -43,9 +43,8 @@
#include "core/gimp.h"
#include "core/gimp-palettes.h"
#include "core/gimpdrawable.h"
-#include "core/gimpimage.h"
-#include "core/gimpimage-undo.h"
-#include "core/gimptempbuf.h"
+#include "core/gimperror.h"
+#include "core/gimpmybrush.h"
#include "gimpmybrushcore.h"
#include "gimpmybrushsurface.h"
@@ -56,6 +55,7 @@
struct _GimpMybrushCorePrivate
{
+ GimpMybrush *mybrush;
#if 0
MyPaintGeglTiledSurface *surface;
#else
@@ -68,17 +68,22 @@ struct _GimpMybrushCorePrivate
/* local function prototypes */
-static void gimp_mybrush_core_paint (GimpPaintCore *paint_core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- GimpPaintState paint_state,
- guint32 time);
-static void gimp_mybrush_core_motion (GimpPaintCore *paint_core,
- GimpDrawable *drawable,
- GimpPaintOptions *paint_options,
- const GimpCoords *coords,
- guint32 time);
+static gboolean gimp_mybrush_core_start (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ GError **error);
+static void gimp_mybrush_core_paint (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ GimpPaintState paint_state,
+ guint32 time);
+static void gimp_mybrush_core_motion (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ guint32 time);
G_DEFINE_TYPE (GimpMybrushCore, gimp_mybrush_core, GIMP_TYPE_PAINT_CORE)
@@ -104,6 +109,7 @@ gimp_mybrush_core_class_init (GimpMybrushCoreClass *klass)
{
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
+ paint_core_class->start = gimp_mybrush_core_start;
paint_core_class->paint = gimp_mybrush_core_paint;
g_type_class_add_private (klass, sizeof (GimpMybrushCorePrivate));
@@ -117,6 +123,28 @@ gimp_mybrush_core_init (GimpMybrushCore *mybrush)
GimpMybrushCorePrivate);
}
+static gboolean
+gimp_mybrush_core_start (GimpPaintCore *paint_core,
+ GimpDrawable *drawable,
+ GimpPaintOptions *paint_options,
+ const GimpCoords *coords,
+ GError **error)
+{
+ GimpMybrushCore *core = GIMP_MYBRUSH_CORE (paint_core);
+ GimpContext *context = GIMP_CONTEXT (paint_options);
+
+ core->private->mybrush = gimp_context_get_mybrush (context);
+
+ if (! core->private->mybrush)
+ {
+ g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
+ _("No MyPaint brushes available for use with this tool."));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
gimp_mybrush_core_paint (GimpPaintCore *paint_core,
GimpDrawable *drawable,
@@ -162,7 +190,7 @@ gimp_mybrush_core_paint (GimpPaintCore *paint_core,
mybrush->private->brush = mypaint_brush_new ();
mypaint_brush_from_defaults (mybrush->private->brush);
- brush_data = gimp_mybrush_options_get_brush_data (options);
+ brush_data = gimp_mybrush_get_brush_json (mybrush->private->mybrush);
if (brush_data)
mypaint_brush_from_string (mybrush->private->brush, brush_data);
diff --git a/app/paint/gimpmybrushcore.h b/app/paint/gimpmybrushcore.h
index eba2eab..90b56d2 100644
--- a/app/paint/gimpmybrushcore.h
+++ b/app/paint/gimpmybrushcore.h
@@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef HAVE_LIBMYPAINT
-
#ifndef __GIMP_MYBRUSH_CORE_H__
#define __GIMP_MYBRUSH_CORE_H__
@@ -27,8 +25,8 @@
#define GIMP_TYPE_MYBRUSH_CORE (gimp_mybrush_core_get_type ())
#define GIMP_MYBRUSH_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MYBRUSH_CORE,
GimpMybrushCore))
#define GIMP_MYBRUSH_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MYBRUSH_CORE,
GimpMybrushCoreClass))
-#define GIMP_IS_MYBRUSH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MYBRUSH_CORE))
-#define GIMP_IS_MYBRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MYBRUSH_CORE))
+#define GIMP_IS_MYBRUSH_CORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MYBRUSH_CORE))
+#define GIMP_IS_MYBRUSH_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MYBRUSH_CORE))
#define GIMP_MYBRUSH_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MYBRUSH_CORE,
GimpMybrushCoreClass))
@@ -55,5 +53,3 @@ GType gimp_mybrush_core_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_MYBRUSH_CORE_H__ */
-
-#endif
diff --git a/app/paint/gimpmybrushoptions.c b/app/paint/gimpmybrushoptions.c
index a089b08..bd6ba0d 100644
--- a/app/paint/gimpmybrushoptions.c
+++ b/app/paint/gimpmybrushoptions.c
@@ -17,8 +17,6 @@
#include "config.h"
-#ifdef HAVE_LIBMYPAINT
-
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
@@ -28,59 +26,50 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
+#include "core/gimpmybrush.h"
#include "core/gimppaintinfo.h"
#include "gimpmybrushoptions.h"
#include "gimp-intl.h"
-#include <mypaint-brush.h>
enum
{
PROP_0,
PROP_RADIUS,
PROP_OPAQUE,
- PROP_HARDNESS,
- PROP_MYBRUSH
+ PROP_HARDNESS
};
-typedef struct
-{
- gdouble radius;
- gdouble opaque;
- gdouble hardness;
- gchar *brush_json;
-} OptionsState;
-
-static GHashTable *loaded_myb;
-
-static void gimp_mybrush_options_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_mybrush_options_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void options_state_free (gpointer options)
-{
- OptionsState *state = options;
- g_free (state->brush_json);
- g_free (state);
-}
+
+static void gimp_mybrush_options_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_mybrush_options_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_mybrush_options_mybrush_changed (GimpContext *context,
+ GimpMybrush *brush);
-G_DEFINE_TYPE (GimpMybrushOptions, gimp_mybrush_options, GIMP_TYPE_PAINT_OPTIONS)
+G_DEFINE_TYPE (GimpMybrushOptions, gimp_mybrush_options,
+ GIMP_TYPE_PAINT_OPTIONS)
static void
gimp_mybrush_options_class_init (GimpMybrushOptionsClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpContextClass *context_class = GIMP_CONTEXT_CLASS (klass);
- object_class->set_property = gimp_mybrush_options_set_property;
- object_class->get_property = gimp_mybrush_options_get_property;
+ object_class->set_property = gimp_mybrush_options_set_property;
+ object_class->get_property = gimp_mybrush_options_get_property;
+
+ context_class->mybrush_changed = gimp_mybrush_options_mybrush_changed;
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_RADIUS,
"radius", _("Radius"),
@@ -94,54 +83,6 @@ gimp_mybrush_options_class_init (GimpMybrushOptionsClass *klass)
"hardness", NULL,
0.0, 1.0, 1.0,
GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_MYBRUSH,
- "mybrush", NULL,
- NULL,
- GIMP_PARAM_STATIC_STRINGS);
-
- loaded_myb = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, options_state_free);
-}
-
-static void
-gimp_mybrush_options_load_path (GObject *object,
- gchar *path)
-{
- GimpMybrushOptions *options = GIMP_MYBRUSH_OPTIONS (object);
-
- OptionsState *state = g_hash_table_lookup (loaded_myb, path);
- if (!state)
- {
- gchar *brush_json = NULL;
- MyPaintBrush *brush = mypaint_brush_new ();
-
- state = g_new0 (OptionsState, 1);
- mypaint_brush_from_defaults (brush);
-
- if (g_file_get_contents (path, &brush_json, NULL, NULL))
- {
- if (! mypaint_brush_from_string (brush, brush_json))
- {
- g_printerr ("Failed to deserialize MyPaint brush\n");
- g_free (brush_json);
- brush_json = NULL;
- }
- }
-
- state->brush_json = brush_json;
- state->radius = mypaint_brush_get_base_value (brush, MYPAINT_BRUSH_SETTING_RADIUS_LOGARITHMIC);
- state->opaque = mypaint_brush_get_base_value (brush, MYPAINT_BRUSH_SETTING_OPAQUE);
- state->hardness = mypaint_brush_get_base_value (brush, MYPAINT_BRUSH_SETTING_HARDNESS);
-
- g_hash_table_insert (loaded_myb, g_strdup(path), state);
- }
-
- options->radius = state->radius;
- options->opaque = state->opaque;
- options->hardness = state->hardness;
-
- g_object_notify (object, "radius");
- g_object_notify (object, "opaque");
- g_object_notify (object, "hardness");
}
static void
@@ -168,12 +109,6 @@ gimp_mybrush_options_set_property (GObject *object,
case PROP_OPAQUE:
options->opaque = g_value_get_double (value);
break;
- case PROP_MYBRUSH:
- g_free (options->mybrush);
- options->mybrush = g_value_dup_string (value);
- if (options->mybrush)
- gimp_mybrush_options_load_path (object, options->mybrush);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -200,9 +135,6 @@ gimp_mybrush_options_get_property (GObject *object,
case PROP_HARDNESS:
g_value_set_double (value, options->hardness);
break;
- case PROP_MYBRUSH:
- g_value_set_string (value, options->mybrush);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -210,13 +142,14 @@ gimp_mybrush_options_get_property (GObject *object,
}
}
-const gchar *
-gimp_mybrush_options_get_brush_data (GimpMybrushOptions *options)
+static void
+gimp_mybrush_options_mybrush_changed (GimpContext *context,
+ GimpMybrush *brush)
{
- OptionsState *state = g_hash_table_lookup (loaded_myb, options->mybrush);
- if (state)
- return state->brush_json;
- return NULL;
+ if (brush)
+ g_object_set (context,
+ "radius", gimp_mybrush_get_radius (brush),
+ "opaque", gimp_mybrush_get_opaque (brush),
+ "hardness", gimp_mybrush_get_hardness (brush),
+ NULL);
}
-
-#endif
diff --git a/app/paint/gimpmybrushoptions.h b/app/paint/gimpmybrushoptions.h
index a7bea73..12d8aed 100644
--- a/app/paint/gimpmybrushoptions.h
+++ b/app/paint/gimpmybrushoptions.h
@@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef HAVE_LIBMYPAINT
-
#ifndef __GIMP_MYBRUSH_OPTIONS_H__
#define __GIMP_MYBRUSH_OPTIONS_H__
@@ -41,7 +39,6 @@ struct _GimpMybrushOptions
gdouble radius;
gdouble opaque;
gdouble hardness;
- gchar *mybrush;
};
struct _GimpMybrushOptionsClass
@@ -52,9 +49,5 @@ struct _GimpMybrushOptionsClass
GType gimp_mybrush_options_get_type (void) G_GNUC_CONST;
-const gchar *
-gimp_mybrush_options_get_brush_data (GimpMybrushOptions *options);
#endif /* __GIMP_MYBRUSH_OPTIONS_H__ */
-
-#endif
diff --git a/app/tools/gimpmybrushoptions-gui.c b/app/tools/gimpmybrushoptions-gui.c
index b37fce7..ac78765 100644
--- a/app/tools/gimpmybrushoptions-gui.c
+++ b/app/tools/gimpmybrushoptions-gui.c
@@ -17,8 +17,6 @@
#include "config.h"
-#ifdef HAVE_LIBMYPAINT
-
#include <gegl.h>
#include <gtk/gtk.h>
@@ -42,124 +40,12 @@
#include "gimp-intl.h"
-static void
-gimp_mybrush_options_load_brush (GFile *file,
- GtkTreeModel *model)
-{
- GtkListStore *store = GTK_LIST_STORE (model);
- GtkTreeIter iter = { 0, };
- GdkPixbuf *pixbuf = NULL;
- gchar *filename;
- gchar *basename;
- gchar *preview_filename;
-
- filename = g_file_get_path (file);
- g_object_weak_ref (G_OBJECT (store), (GWeakNotify) g_free, filename);
-
- basename = g_strndup (filename, strlen (filename) - 4);
- preview_filename = g_strconcat (basename, "_prev.png", NULL);
- g_free (basename);
-
- pixbuf = gdk_pixbuf_new_from_file_at_size (preview_filename,
- 48, 48, NULL);
- g_free (preview_filename);
-
- basename = g_file_get_basename (file);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- GIMP_INT_STORE_LABEL, gimp_filename_to_utf8 (basename),
- GIMP_INT_STORE_PIXBUF, pixbuf,
- GIMP_INT_STORE_USER_DATA, filename,
- -1);
-
- g_free (basename);
-
- if (pixbuf)
- g_object_unref (pixbuf);
-}
-
-static void
-gimp_mybrush_options_load_recursive (GFile *dir,
- GtkTreeModel *model)
-{
- GFileEnumerator *enumerator;
-
- enumerator = g_file_enumerate_children (dir,
- G_FILE_ATTRIBUTE_STANDARD_NAME ","
- G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN ","
- G_FILE_ATTRIBUTE_STANDARD_TYPE,
- G_FILE_QUERY_INFO_NONE,
- NULL, NULL);
-
- if (enumerator)
- {
- GFileInfo *info;
-
- while ((info = g_file_enumerator_next_file (enumerator,
- NULL, NULL)))
- {
- if (! g_file_info_get_is_hidden (info))
- {
- GFile *file = g_file_enumerator_get_child (enumerator, info);
-
- switch (g_file_info_get_file_type (info))
- {
- case G_FILE_TYPE_DIRECTORY:
- gimp_mybrush_options_load_recursive (file, model);
- break;
-
- case G_FILE_TYPE_REGULAR:
- if (gimp_file_has_extension (file, ".myb"))
- gimp_mybrush_options_load_brush (file, model);
- break;
-
- default:
- break;
- }
-
- g_object_unref (file);
- }
-
- g_object_unref (info);
- }
-
- g_object_unref (enumerator);
- }
-}
-
-static void
-gimp_mybrush_options_brush_changed (GtkComboBox *combo,
- GObject *config)
-{
- GtkTreeIter iter;
-
- if (gtk_combo_box_get_active_iter (combo, &iter))
- {
- GtkTreeModel *model = gtk_combo_box_get_model (combo);
- const gchar *brush;
-
- gtk_tree_model_get (model, &iter,
- GIMP_INT_STORE_USER_DATA, &brush,
- -1);
-
- if (brush)
- g_object_set (config,
- "mybrush", brush,
- NULL);
- }
-}
-
GtkWidget *
gimp_mybrush_options_gui (GimpToolOptions *tool_options)
{
- GObject *config = G_OBJECT (tool_options);
- GtkWidget *vbox = gimp_paint_options_gui (tool_options);
- GtkWidget *scale;
- GtkWidget *combo;
- GtkTreeModel *model;
- GList *path;
- GList *list;
+ GObject *config = G_OBJECT (tool_options);
+ GtkWidget *vbox = gimp_paint_options_gui (tool_options);
+ GtkWidget *scale;
/* radius */
scale = gimp_prop_spin_scale_new (config, "radius",
@@ -182,34 +68,5 @@ gimp_mybrush_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);
- /* brushes */
- combo = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
- "label", _("Brush"),
- "ellipsize", PANGO_ELLIPSIZE_END,
- NULL);
- gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
- gtk_widget_show (combo);
-
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
-
- path = gimp_config_path_expand_to_files (GIMP_CONTEXT (config)->gimp->config->mypaint_brush_path, NULL);
-
- for (list = path; list; list = g_list_next (list))
- {
- GFile *dir = list->data;
-
- gimp_mybrush_options_load_recursive (dir, model);
- }
-
- g_list_free_full (path, (GDestroyNotify) g_object_unref);
-
- g_signal_connect (combo, "changed",
- G_CALLBACK (gimp_mybrush_options_brush_changed),
- config);
-
- gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), 0);
-
return vbox;
}
-
-#endif
diff --git a/app/tools/gimpmybrushoptions-gui.h b/app/tools/gimpmybrushoptions-gui.h
index a6ff94c..59618a2 100644
--- a/app/tools/gimpmybrushoptions-gui.h
+++ b/app/tools/gimpmybrushoptions-gui.h
@@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef HAVE_LIBMYPAINT
-
#ifndef __GIMP_MYBRUSH_OPTIONS_GUI_H__
#define __GIMP_MYBRUSH_OPTIONS_GUI_H__
@@ -25,5 +23,3 @@ GtkWidget * gimp_mybrush_options_gui (GimpToolOptions *tool_options);
#endif /* __GIMP_MYBRUSH_OPTIONS_GUI_H__ */
-
-#endif
diff --git a/app/tools/gimpmybrushtool.c b/app/tools/gimpmybrushtool.c
index 3e2c578..34ce335 100644
--- a/app/tools/gimpmybrushtool.c
+++ b/app/tools/gimpmybrushtool.c
@@ -17,8 +17,6 @@
#include "config.h"
-#ifdef HAVE_LIBMYPAINT
-
#include <gegl.h>
#include <gtk/gtk.h>
@@ -72,7 +70,7 @@ gimp_mybrush_tool_register (GimpToolRegisterCallback callback,
GIMP_CONTEXT_PROP_MASK_BACKGROUND |
GIMP_CONTEXT_PROP_MASK_OPACITY |
GIMP_CONTEXT_PROP_MASK_PAINT_MODE |
- GIMP_CONTEXT_PROP_MYBRUSH,
+ GIMP_CONTEXT_PROP_MASK_MYBRUSH,
"gimp-mybrush-tool",
_("MyPaint Brush"),
_("MyPaint Brush Tool: Use MyPaint brushes in GIMP"),
@@ -133,5 +131,3 @@ gimp_mybrush_tool_get_outline (GimpPaintTool *paint_tool,
return NULL;
}
-
-#endif
diff --git a/app/tools/gimpmybrushtool.h b/app/tools/gimpmybrushtool.h
index c0df54c..15ed40f 100644
--- a/app/tools/gimpmybrushtool.h
+++ b/app/tools/gimpmybrushtool.h
@@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef HAVE_LIBMYPAINT
-
#ifndef __GIMP_MYBRUSH_TOOL_H__
#define __GIMP_MYBRUSH_TOOL_H__
@@ -55,5 +53,3 @@ GType gimp_mybrush_tool_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_MYBRUSH_TOOL_H__ */
-
-#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]