[gimp] app: Add tool preset editor to controll what elements get applied



commit 06c1b290d0c22c5576efe1144c36d30e6069840f
Author: Alexia Death <alexiadeath gmail com>
Date:   Sat Apr 24 17:55:54 2010 +0300

    app: Add tool preset editor to controll what elements get applied
    
    I had to remove the asserrt in tool preset constructor, because with it
    it wasnt possible to initalize an empty model object for the editor.
    At init time the gimp object passed to the constructor is not yet available.

 app/core/gimptoolpreset.c          |    4 +--
 app/tools/tool_manager.c           |    4 +++
 app/widgets/gimptoolpreseteditor.c |   51 +++++++++++++++++++++++++++++++++---
 3 files changed, 52 insertions(+), 7 deletions(-)
---
diff --git a/app/core/gimptoolpreset.c b/app/core/gimptoolpreset.c
index 69f4967..2e5e5c8 100644
--- a/app/core/gimptoolpreset.c
+++ b/app/core/gimptoolpreset.c
@@ -33,7 +33,7 @@
 
 #include "gimp-intl.h"
 
-#define DEFAULT_USE_FG_BG    TRUE
+#define DEFAULT_USE_FG_BG    FALSE
 #define DEFAULT_USE_BRUSH    TRUE
 #define DEFAULT_USE_DYNAMICS TRUE
 #define DEFAULT_USE_GRADIENT TRUE
@@ -180,8 +180,6 @@ gimp_tool_preset_constructor (GType                  type,
 
   preset = GIMP_TOOL_PRESET (object);
 
-  g_assert (GIMP_IS_GIMP (preset->gimp));
-
   return object;
 }
 
diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c
index 35160ae..5bbc23f 100644
--- a/app/tools/tool_manager.c
+++ b/app/tools/tool_manager.c
@@ -638,6 +638,10 @@ tool_manager_preset_changed (GimpContext     *user_context,
     gimp_context_set_tool (user_context, preset_tool);
   else
     tool_manager_connect_options (user_context, preset_tool);
+
+  gimp_context_copy_properties (GIMP_CONTEXT (preset->tool_options),
+                                user_context,
+                                gimp_tool_preset_get_prop_mask (preset));
 }
 
 static void
diff --git a/app/widgets/gimptoolpreseteditor.c b/app/widgets/gimptoolpreseteditor.c
index cdb6916..cbfcdb5 100644
--- a/app/widgets/gimptoolpreseteditor.c
+++ b/app/widgets/gimptoolpreseteditor.c
@@ -78,6 +78,53 @@ gimp_tool_preset_editor_class_init (GimpToolPresetEditorClass *klass)
 static void
 gimp_tool_preset_editor_init (GimpToolPresetEditor *editor)
 {
+  GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
+  GimpToolPreset *preset;
+  GtkWidget      *button;
+
+  preset = editor->tool_preset_model = g_object_new (GIMP_TYPE_TOOL_PRESET,
+                                                     //"gimp", data_editor->context->gimp,
+                                                     NULL);
+
+  g_signal_connect (preset, "notify",
+                    G_CALLBACK (gimp_tool_preset_editor_notify_model),
+                    editor);
+
+  button = gimp_prop_check_button_new (G_OBJECT (preset), "use-fg-bg", _("Apply stored FG/BG"));
+  gtk_box_pack_start (GTK_BOX (data_editor), button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  button = gimp_prop_check_button_new (G_OBJECT (preset), "use-brush", _("Apply stored brush"));
+  gtk_box_pack_start (GTK_BOX (data_editor), button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  button = gimp_prop_check_button_new (G_OBJECT (preset), "use-dynamics", _("Apply stored dynamics"));
+  gtk_box_pack_start (GTK_BOX (data_editor), button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  button = gimp_prop_check_button_new (G_OBJECT (preset), "use-gradient", _("Apply stored gradient"));
+  gtk_box_pack_start (GTK_BOX (data_editor), button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  button = gimp_prop_check_button_new (G_OBJECT (preset), "use-pattern", _("Apply stored pattern"));
+  gtk_box_pack_start (GTK_BOX (data_editor), button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  button = gimp_prop_check_button_new (G_OBJECT (preset), "use-palette", _("Apply stored pallete"));
+  gtk_box_pack_start (GTK_BOX (data_editor), button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  button = gimp_prop_check_button_new (G_OBJECT (preset), "use-font", _("Apply stored font"));
+  gtk_box_pack_start (GTK_BOX (data_editor), button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
 }
 
 static GObject *
@@ -94,10 +141,6 @@ gimp_tool_preset_editor_constructor (GType                  type,
   editor      = GIMP_TOOL_PRESET_EDITOR (object);
   data_editor = GIMP_DATA_EDITOR (editor);
 
-  editor->tool_preset_model = g_object_new (GIMP_TYPE_TOOL_PRESET,
-                                            "gimp", data_editor->context->gimp,
-                                            NULL);
-
   gimp_docked_set_show_button_bar (GIMP_DOCKED (object), FALSE);
 
   return object;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]