[gimp/soc-2009-dynamics: 1/2] Further changes to make dynamics editor and its menu.



commit 8480477f9dc735bdab5837f5673de229e0f52b8d
Author: zhenfeng zhao <zhzzf_0808 hotmail com>
Date:   Thu Jul 30 11:55:17 2009 -0300

    Further changes to make dynamics editor and its menu.
    
       actions/Makefile.am
       actions/actions.c
       dialogs/dialogs-constructors.c
       dialogs/dialogs-constructors.h: further change on menu work.
    
       actions/dynamics-editor-actions.c
       actions/dynamics-editor-actions.h (new files): add actions for dynamics.

 app/actions/Makefile.am               |    6 ++-
 app/actions/actions.c                 |    5 +-
 app/actions/dynamics-editor-actions.c |   97 +++++++++++++++++++++++++++++++++
 app/actions/dynamics-editor-actions.h |   27 +++++++++
 app/dialogs/dialogs-constructors.c    |    5 +-
 app/dialogs/dialogs-constructors.h    |    3 +
 6 files changed, 138 insertions(+), 5 deletions(-)
---
diff --git a/app/actions/Makefile.am b/app/actions/Makefile.am
index 4321070..c61dd1f 100644
--- a/app/actions/Makefile.am
+++ b/app/actions/Makefile.am
@@ -23,6 +23,8 @@ libappactions_a_SOURCES = \
 	brush-editor-actions.h		\
 	brushes-actions.c		\
 	brushes-actions.h		\
+	dynamics-editor-actions.c		\
+	dynamics-editor-actions.h		\
 	buffers-actions.c		\
 	buffers-actions.h		\
 	buffers-commands.c		\
@@ -178,4 +180,6 @@ libappactions_a_SOURCES = \
 	windows-commands.c		\
 	windows-commands.h
 
-EXTRA_DIST = makefile.msc
+EXTRA_DIST = makefile.msc \
+	dynamics-editor-actions.c\
+	dynamics-editor-actions.h
diff --git a/app/actions/actions.c b/app/actions/actions.c
index 4a3a4b2..cdada3e 100644
--- a/app/actions/actions.c
+++ b/app/actions/actions.c
@@ -49,6 +49,7 @@
 
 #include "actions.h"
 #include "brush-editor-actions.h"
+#include "dynamics-editor-actions.h"
 #include "brushes-actions.h"
 #include "buffers-actions.h"
 #include "channels-actions.h"
@@ -104,8 +105,8 @@ static const GimpActionFactoryEntry action_groups[] =
     brush_editor_actions_setup,
     brush_editor_actions_update },
   { "dynamics-editor", N_("Dynamics Editor"), GIMP_STOCK_BRUSH,
-    brush_editor_actions_setup,
-    brush_editor_actions_update },
+    dynamics_editor_actions_setup,
+    dynamics_editor_actions_update },
   { "brushes", N_("Brushes"), GIMP_STOCK_BRUSH,
     brushes_actions_setup,
     brushes_actions_update },
diff --git a/app/actions/dynamics-editor-actions.c b/app/actions/dynamics-editor-actions.c
new file mode 100644
index 0000000..478a0f3
--- /dev/null
+++ b/app/actions/dynamics-editor-actions.c
@@ -0,0 +1,97 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "actions-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontext.h"
+
+#include "widgets/gimpactiongroup.h"
+#include "widgets/gimphelp-ids.h"
+#include "widgets/gimpbrusheditor.h"
+
+#include "dynamics-editor-actions.h"
+#include "data-editor-commands.h"
+
+#include "gimp-intl.h"
+
+
+static const GimpActionEntry dynamics_editor_actions[] =
+{
+  { "dynamics-editor-popup", GIMP_STOCK_BRUSH,
+    NC_("dynamics-editor-action", "Dynamics Editor Menu"), NULL, NULL, NULL,
+    GIMP_HELP_BRUSH_EDITOR_DIALOG }
+};
+
+static const GimpToggleActionEntry dynamics_editor_toggle_actions[] =
+{
+  { "dynamics-editor-edit-active", GIMP_STOCK_LINKED,
+    NC_("dynamics-editor-action", "Edit Brush Dynamics"), NULL, NULL,
+    G_CALLBACK (data_editor_edit_active_cmd_callback),
+    FALSE,
+    GIMP_HELP_BRUSH_EDITOR_EDIT_ACTIVE }
+};
+
+
+void
+dynamics_editor_actions_setup (GimpActionGroup *group)
+{
+  gimp_action_group_add_actions (group, "dynamics-editor-action",
+                                 dynamics_editor_actions,
+                                 G_N_ELEMENTS (dynamics_editor_actions));
+
+  gimp_action_group_add_toggle_actions (group, "dynamics-editor-action",
+                                        dynamics_editor_toggle_actions,
+                                        G_N_ELEMENTS (dynamics_editor_toggle_actions));
+}
+
+void
+dynamics_editor_actions_update (GimpActionGroup *group,
+                                gpointer         user_data)
+{
+  GimpDataEditor  *data_editor = GIMP_DATA_EDITOR (user_data);
+  GimpData        *data;
+  gboolean         editable    = FALSE;
+  gboolean         edit_active = FALSE;
+
+  data = data_editor->data;
+
+  if (data)
+    {
+      if (data_editor->data_editable)
+        editable = TRUE;
+    }
+
+  edit_active = gimp_data_editor_get_edit_active (data_editor);
+
+#define SET_SENSITIVE(action,condition) \
+        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
+#define SET_ACTIVE(action,condition) \
+        gimp_action_group_set_action_active (group, action, (condition) != 0)
+
+  SET_ACTIVE ("dynamics-editor-edit-active", edit_active);
+
+#undef SET_SENSITIVE
+#undef SET_ACTIVE
+}
+
diff --git a/app/actions/dynamics-editor-actions.h b/app/actions/dynamics-editor-actions.h
new file mode 100644
index 0000000..1f88f1a
--- /dev/null
+++ b/app/actions/dynamics-editor-actions.h
@@ -0,0 +1,27 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __DYNAMICS_EDITOR_ACTIONS_H__
+#define __DYNAMICS_EDITOR_ACTIONS_H__
+
+
+void   dynamics_editor_actions_setup  (GimpActionGroup *group);
+void   dynamics_editor_actions_update (GimpActionGroup *group,
+                                       gpointer         data);
+
+
+#endif /* __DYNAMICS_EDITOR_ACTIONS_H__ */
diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c
index 81df9a7..811d685 100644
--- a/app/dialogs/dialogs-constructors.c
+++ b/app/dialogs/dialogs-constructors.c
@@ -32,6 +32,7 @@
 #include "config/gimpguiconfig.h"
 
 #include "widgets/gimpbrusheditor.h"
+//#include "widgets/gimpdynamicseditor.h"
 #include "widgets/gimpbrushfactoryview.h"
 #include "widgets/gimpbufferview.h"
 #include "widgets/gimpchanneltreeview.h"
@@ -674,8 +675,8 @@ dialogs_dynamics_editor_get (GimpDialogFactory *factory,
                           GimpContext       *context,
                           gint               view_size)
 {
-  return gimp_brush_editor_new (context,
-                                factory->menu_factory);
+  //return gimp_dynamics_editor_new (context,
+  //                              factory->menu_factory);
 }
 
 GtkWidget *
diff --git a/app/dialogs/dialogs-constructors.h b/app/dialogs/dialogs-constructors.h
index 1c36024..55ba38a 100644
--- a/app/dialogs/dialogs-constructors.h
+++ b/app/dialogs/dialogs-constructors.h
@@ -190,6 +190,9 @@ GtkWidget * dialogs_color_editor_new       (GimpDialogFactory *factory,
 GtkWidget * dialogs_brush_editor_get       (GimpDialogFactory *factory,
                                             GimpContext       *context,
                                             gint               view_size);
+GtkWidget * dialogs_dynamics_editor_get    (GimpDialogFactory *factory,
+                                            GimpContext       *context,
+                                            gint               view_size);
 GtkWidget * dialogs_gradient_editor_get    (GimpDialogFactory *factory,
                                             GimpContext       *context,
                                             gint               view_size);



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