app: Toggle on-canvas text editor visibility
This adds a new boolean to text options, "Show on-canvas editor". When toggled, it immediately hides (or re-shows) the current text layer's on-canvas text editor. It uses the same signal and function as the "use-editor" property.
This commit is contained in:
parent
b48ce94e6a
commit
59cb3e36e1
3 changed files with 31 additions and 2 deletions
|
|
@ -84,6 +84,7 @@ enum
|
|||
PROP_OUTLINE_DASH_OFFSET,
|
||||
PROP_OUTLINE_DASH_INFO,
|
||||
PROP_USE_EDITOR,
|
||||
PROP_SHOW_ON_CANVAS_EDITOR,
|
||||
|
||||
PROP_FONT_VIEW_TYPE,
|
||||
PROP_FONT_VIEW_SIZE
|
||||
|
|
@ -245,11 +246,18 @@ gimp_text_options_class_init (GimpTextOptionsClass *klass)
|
|||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_USE_EDITOR,
|
||||
"use-editor",
|
||||
_("Use editor"),
|
||||
_("Use editor window"),
|
||||
_("Use an external editor window for text entry"),
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SHOW_ON_CANVAS_EDITOR,
|
||||
"show-on-canvas",
|
||||
_("Show on-canvas editor"),
|
||||
_("Show on-canvas text editor"),
|
||||
TRUE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_FONT_VIEW_TYPE,
|
||||
"font-view-type",
|
||||
NULL, NULL,
|
||||
|
|
@ -457,6 +465,9 @@ gimp_text_options_get_property (GObject *object,
|
|||
case PROP_USE_EDITOR:
|
||||
g_value_set_boolean (value, options->use_editor);
|
||||
break;
|
||||
case PROP_SHOW_ON_CANVAS_EDITOR:
|
||||
g_value_set_boolean (value, options->show_on_canvas);
|
||||
break;
|
||||
|
||||
case PROP_FONT_VIEW_TYPE:
|
||||
g_value_set_enum (value, options->font_view_type);
|
||||
|
|
@ -571,6 +582,9 @@ gimp_text_options_set_property (GObject *object,
|
|||
case PROP_USE_EDITOR:
|
||||
options->use_editor = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_ON_CANVAS_EDITOR:
|
||||
options->show_on_canvas = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_FONT_VIEW_TYPE:
|
||||
options->font_view_type = g_value_get_enum (value);
|
||||
|
|
@ -626,6 +640,7 @@ gimp_text_options_reset (GimpConfig *config)
|
|||
gimp_config_reset_property (object, "outline-dash-info");
|
||||
|
||||
gimp_config_reset_property (object, "use-editor");
|
||||
gimp_config_reset_property (object, "use-on-canvas");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -803,6 +818,9 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
|
|||
button = gimp_prop_check_button_new (config, "use-editor", NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
button = gimp_prop_check_button_new (config, "show-on-canvas", NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
button = gimp_prop_check_button_new (config, "antialias", NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ struct _GimpTextOptions
|
|||
GimpViewSize font_view_size;
|
||||
|
||||
gboolean use_editor;
|
||||
gboolean show_on_canvas;
|
||||
|
||||
/* options gui */
|
||||
GtkWidget *size_entry;
|
||||
|
|
|
|||
|
|
@ -193,6 +193,9 @@ gimp_text_tool_editor_start (GimpTextTool *text_tool)
|
|||
g_signal_connect (options, "notify::use-editor",
|
||||
G_CALLBACK (gimp_text_tool_options_notify),
|
||||
text_tool);
|
||||
g_signal_connect (options, "notify::show-on-canvas",
|
||||
G_CALLBACK (gimp_text_tool_options_notify),
|
||||
text_tool);
|
||||
|
||||
if (! text_tool->style_overlay)
|
||||
{
|
||||
|
|
@ -223,7 +226,9 @@ gimp_text_tool_editor_start (GimpTextTool *text_tool)
|
|||
xres, yres);
|
||||
gtk_container_add (GTK_CONTAINER (text_tool->style_overlay),
|
||||
text_tool->style_editor);
|
||||
gtk_widget_show (text_tool->style_editor);
|
||||
|
||||
if (options->show_on_canvas)
|
||||
gtk_widget_show (text_tool->style_editor);
|
||||
}
|
||||
|
||||
gimp_text_tool_editor_position (text_tool);
|
||||
|
|
@ -1328,6 +1333,11 @@ gimp_text_tool_options_notify (GimpTextOptions *options,
|
|||
gtk_widget_destroy (text_tool->editor_dialog);
|
||||
}
|
||||
}
|
||||
else if (! strcmp (param_name, "show-on-canvas"))
|
||||
{
|
||||
gtk_widget_set_visible (text_tool->style_editor,
|
||||
options->show_on_canvas);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Reference in a new issue