mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
93ab387fb4
commit
06c1b290d0
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue