Make the toggle grid insensitive when the dynamics are read-only

This commit is contained in:
Michael Natterer 2009-10-18 13:24:59 +02:00
parent 387ec40214
commit 0ce426cc79
2 changed files with 21 additions and 21 deletions

View File

@ -95,7 +95,6 @@ gimp_dynamics_editor_init (GimpDynamicsEditor *editor)
{ {
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor); GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
GimpDynamics *dynamics; GimpDynamics *dynamics;
GtkWidget *table;
GtkWidget *fixed; GtkWidget *fixed;
GtkWidget *input_labels[6]; GtkWidget *input_labels[6];
gint n_inputs = G_N_ELEMENTS (input_labels); gint n_inputs = G_N_ELEMENTS (input_labels);
@ -107,9 +106,9 @@ gimp_dynamics_editor_init (GimpDynamicsEditor *editor)
G_CALLBACK (gimp_dynamics_editor_notify_model), G_CALLBACK (gimp_dynamics_editor_notify_model),
editor); editor);
table = gtk_table_new (9, n_inputs + 2, FALSE); editor->table = gtk_table_new (9, n_inputs + 2, FALSE);
gtk_box_pack_start (GTK_BOX (data_editor), table, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (data_editor), editor->table, TRUE, TRUE, 0);
gtk_widget_show (table); gtk_widget_show (editor->table);
input_labels[0] = gtk_label_new (_("Pressure")); input_labels[0] = gtk_label_new (_("Pressure"));
input_labels[1] = gtk_label_new (_("Velocity")); input_labels[1] = gtk_label_new (_("Velocity"));
@ -120,46 +119,46 @@ gimp_dynamics_editor_init (GimpDynamicsEditor *editor)
gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->opacity_output), gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->opacity_output),
_("Opacity"), _("Opacity"),
GTK_TABLE (table), GTK_TABLE (editor->table),
1, input_labels); 1, input_labels);
gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->hardness_output), gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->hardness_output),
_("Hardness"), _("Hardness"),
GTK_TABLE (table), GTK_TABLE (editor->table),
2, NULL); 2, NULL);
gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->rate_output), gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->rate_output),
_("Rate"), _("Rate"),
GTK_TABLE (table), GTK_TABLE (editor->table),
3, NULL); 3, NULL);
gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->size_output), gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->size_output),
_("Size"), _("Size"),
GTK_TABLE (table), GTK_TABLE (editor->table),
4, NULL); 4, NULL);
gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->aspect_ratio_output), gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->aspect_ratio_output),
_("Aspect ratio"), _("Aspect ratio"),
GTK_TABLE (table), GTK_TABLE (editor->table),
5, NULL); 5, NULL);
gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->color_output), gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->color_output),
_("Color"), _("Color"),
GTK_TABLE (table), GTK_TABLE (editor->table),
6, NULL); 6, NULL);
gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->angle_output), gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->angle_output),
_("Angle"), _("Angle"),
GTK_TABLE (table), GTK_TABLE (editor->table),
7, NULL); 7, NULL);
gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->jitter_output), gimp_dynamics_editor_add_output_row (G_OBJECT (dynamics->jitter_output),
_("Jitter"), _("Jitter"),
GTK_TABLE (table), GTK_TABLE (editor->table),
8, NULL); 8, NULL);
fixed = gtk_fixed_new (); fixed = gtk_fixed_new ();
gtk_table_attach (GTK_TABLE (table), fixed, 0, n_inputs + 2, 0, 1, gtk_table_attach (GTK_TABLE (editor->table), fixed, 0, n_inputs + 2, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (fixed); gtk_widget_show (fixed);
@ -218,6 +217,9 @@ gimp_dynamics_editor_set_data (GimpDataEditor *editor,
G_CALLBACK (gimp_dynamics_editor_notify_data), G_CALLBACK (gimp_dynamics_editor_notify_data),
editor); editor);
} }
gtk_widget_set_sensitive (dynamics_editor->table,
editor->data_editable);
} }

View File

@ -18,6 +18,7 @@
#ifndef __GIMP_DYNAMICS_EDITOR_H__ #ifndef __GIMP_DYNAMICS_EDITOR_H__
#define __GIMP_DYNAMICS_EDITOR_H__ #define __GIMP_DYNAMICS_EDITOR_H__
#include "gimpdataeditor.h" #include "gimpdataeditor.h"
@ -28,18 +29,16 @@
#define GIMP_IS_DYNAMICS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DYNAMICS_EDITOR)) #define GIMP_IS_DYNAMICS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DYNAMICS_EDITOR))
#define GIMP_DYNAMICS_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DYNAMICS_EDITOR, GimpDynamicsEditorClass)) #define GIMP_DYNAMICS_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DYNAMICS_EDITOR, GimpDynamicsEditorClass))
typedef struct _GimpDynamicsEditorClass GimpDynamicsEditorClass;
typedef struct _GimpDynamicsEditorClass GimpDynamicsEditorClass;
struct _GimpDynamicsEditor struct _GimpDynamicsEditor
{ {
GimpDataEditor parent_instance; GimpDataEditor parent_instance;
GimpDynamics *dynamics_model; GimpDynamics *dynamics_model;
GtkWidget *options_vbox; GtkWidget *table;
}; };
struct _GimpDynamicsEditorClass struct _GimpDynamicsEditorClass
@ -50,9 +49,8 @@ struct _GimpDynamicsEditorClass
GType gimp_dynamics_editor_get_type (void) G_GNUC_CONST; GType gimp_dynamics_editor_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_dynamics_editor_new (GimpContext *context, GtkWidget * gimp_dynamics_editor_new (GimpContext *context,
GimpMenuFactory *menu_factory); GimpMenuFactory *menu_factory);
//GObject * get_config_value (GimpDynamics *options);
#endif /* __GIMP_DYNAMICS_EDITOR_H__ */ #endif /* __GIMP_DYNAMICS_EDITOR_H__ */