92
90
GimpContext *context);
95
static GimpToolOptionsClass *parent_class = NULL;
99
gimp_text_options_get_type (void)
101
static GType type = 0;
105
static const GTypeInfo info =
107
sizeof (GimpTextOptionsClass),
108
(GBaseInitFunc) NULL,
109
(GBaseFinalizeFunc) NULL,
110
(GClassInitFunc) gimp_text_options_class_init,
111
NULL, /* class_finalize */
112
NULL, /* class_data */
113
sizeof (GimpTextOptions),
115
(GInstanceInitFunc) gimp_text_options_init
118
type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS,
93
G_DEFINE_TYPE (GimpTextOptions, gimp_text_options, GIMP_TYPE_TOOL_OPTIONS)
127
97
gimp_text_options_class_init (GimpTextOptionsClass *klass)
129
99
GObjectClass *object_class = G_OBJECT_CLASS (klass);
131
parent_class = g_type_class_peek_parent (klass);
133
101
object_class->set_property = gimp_text_options_set_property;
134
102
object_class->get_property = gimp_text_options_get_property;
136
104
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_UNIT,
137
105
"font-size-unit", NULL,
138
106
TRUE, FALSE, GIMP_UNIT_PIXEL,
107
GIMP_PARAM_STATIC_STRINGS);
140
108
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FONT_SIZE,
141
109
"font-size", NULL,
142
110
0.0, 8192.0, 18.0,
111
GIMP_PARAM_STATIC_STRINGS);
144
112
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HINTING,
146
114
N_("Hinting alters the font outline to "
147
115
"produce a crisp bitmap at small "
118
GIMP_PARAM_STATIC_STRINGS);
151
119
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_AUTOHINT,
153
121
N_("If available, hints from the font are "
154
122
"used but you may prefer to always use "
155
123
"the automatic hinter"),
125
GIMP_PARAM_STATIC_STRINGS);
158
126
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
159
127
"antialias", NULL,
129
GIMP_PARAM_STATIC_STRINGS);
162
130
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_LANGUAGE,
163
131
"language", NULL,
164
132
(const gchar *) gtk_get_default_language (),
133
GIMP_PARAM_STATIC_STRINGS);
166
134
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_BASE_DIR,
167
135
"base-direction", NULL,
168
136
GIMP_TYPE_TEXT_DIRECTION,
169
137
GIMP_TEXT_DIRECTION_LTR,
138
GIMP_PARAM_STATIC_STRINGS);
171
139
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_JUSTIFICATION,
173
141
GIMP_TYPE_TEXT_JUSTIFICATION,
174
142
GIMP_TEXT_JUSTIFY_LEFT,
143
GIMP_PARAM_STATIC_STRINGS);
176
144
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_INDENTATION,
178
146
N_("Indentation of the first line"),
179
147
-8192.0, 8192.0, 0.0,
180
GIMP_PARAM_DEFAULTS);
148
GIMP_PARAM_STATIC_STRINGS |
149
GIMP_CONFIG_PARAM_DEFAULTS);
181
150
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LINE_SPACING,
183
N_("Modify line spacing"),
184
-8192.0, 8192.0, 0.0,
185
GIMP_PARAM_DEFAULTS);
152
N_("Adjust line spacing"),
153
-8192.0, 8192.0, 0.0,
154
GIMP_PARAM_STATIC_STRINGS |
155
GIMP_CONFIG_PARAM_DEFAULTS);
156
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LETTER_SPACING,
158
N_("Adjust letter spacing"),
159
-8192.0, 8192.0, 0.0,
160
GIMP_PARAM_STATIC_STRINGS |
161
GIMP_CONFIG_PARAM_DEFAULTS);
163
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_FONT_VIEW_TYPE,
164
"font-view-type", NULL,
167
GIMP_PARAM_STATIC_STRINGS);
168
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_FONT_VIEW_SIZE,
169
"font-view-size", NULL,
171
GIMP_VIEWABLE_MAX_BUTTON_SIZE,
172
GIMP_VIEW_SIZE_SMALL,
173
GIMP_PARAM_STATIC_STRINGS);
189
177
gimp_text_options_init (GimpTextOptions *options)
191
options->size_entry = NULL;
179
options->size_entry = NULL;
180
options->to_vectors_button = NULL;
181
options->along_vectors_button = NULL;
393
405
gimp_text_options_gui (GimpToolOptions *tool_options)
395
GObject *config = G_OBJECT (tool_options);
396
GimpTextOptions *options = GIMP_TEXT_OPTIONS (tool_options);
401
GtkWidget *auto_button;
404
GtkWidget *spinbutton;
407
vbox = gimp_tool_options_gui (tool_options);
409
g_object_set_data (G_OBJECT (tool_options), "tool-options-vbox", vbox);
411
table = gtk_table_new (9, 3, FALSE);
407
GObject *config = G_OBJECT (tool_options);
408
GimpTextOptions *options = GIMP_TEXT_OPTIONS (tool_options);
409
GtkWidget *vbox = gimp_tool_options_gui (tool_options);
413
GtkWidget *auto_button;
416
GtkWidget *spinbutton;
419
table = gtk_table_new (10, 3, FALSE);
412
420
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
413
421
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
414
422
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
415
423
gtk_widget_show (table);
417
hbox = gimp_font_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
425
hbox = gimp_prop_font_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
426
"font-view-type", "font-view-size");
418
427
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
419
428
_("Font:"), 0.0, 0.5,
466
475
spinbutton = gimp_prop_spin_button_new (config, "indent", 1.0, 10.0, 1);
467
476
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
468
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
469
_("Indent:"), 0.0, 0.5,
470
spinbutton, 1, FALSE);
477
gimp_table_attach_stock (GTK_TABLE (table), row++,
478
GTK_STOCK_INDENT, spinbutton, 1, TRUE);
472
480
spinbutton = gimp_prop_spin_button_new (config, "line-spacing", 1.0, 10.0, 1);
473
481
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
474
482
gimp_table_attach_stock (GTK_TABLE (table), row++,
475
_("Line\nspacing:"), 0.0,
476
spinbutton, 1, GIMP_STOCK_LINE_SPACING);
478
button = gtk_button_new_with_label (_("Create path from text"));
479
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
480
gtk_widget_set_sensitive (button, FALSE);
481
gtk_widget_show (button);
483
g_object_set_data (G_OBJECT (tool_options),
484
"gimp-text-to-vectors", button);
483
GIMP_STOCK_LINE_SPACING, spinbutton, 1, TRUE);
485
spinbutton = gimp_prop_spin_button_new (config,
486
"letter-spacing", 1.0, 10.0, 1);
487
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
488
gimp_table_attach_stock (GTK_TABLE (table), row++,
489
GIMP_STOCK_LETTER_SPACING, spinbutton, 1, TRUE);
491
button = gtk_button_new_with_label (_("Create Path from Text"));
492
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
493
gtk_widget_set_sensitive (button, FALSE);
494
gtk_widget_show (button);
496
options->to_vectors_button = button;
498
button = gtk_button_new_with_label (_("Text along Path"));
499
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
500
gtk_widget_set_sensitive (button, FALSE);
501
gtk_widget_show (button);
503
options->along_vectors_button = button;
490
gimp_text_options_dir_changed (GimpTextEditor *editor,
491
GimpTextOptions *options)
509
gimp_text_options_editor_dir_changed (GimpTextEditor *editor,
510
GimpTextOptions *options)
493
512
g_object_set (options,
494
513
"base-direction", editor->base_dir,
509
528
gimp_text_editor_set_direction (editor, dir);
532
gimp_text_options_editor_notify_font (GimpTextOptions *options,
534
GimpTextEditor *editor)
536
const gchar *font_name;
538
font_name = gimp_context_get_font_name (GIMP_CONTEXT (options));
540
gimp_text_editor_set_font_name (editor, font_name);
513
gimp_text_options_editor_new (GimpTextOptions *options,
544
gimp_text_options_editor_new (GtkWindow *parent,
545
GimpTextOptions *options,
514
546
GimpMenuFactory *menu_factory,
515
547
const gchar *title)
550
const gchar *font_name;
519
552
g_return_val_if_fail (GIMP_IS_TEXT_OPTIONS (options), NULL);
520
553
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
521
554
g_return_val_if_fail (title != NULL, NULL);
523
editor = gimp_text_editor_new (title, menu_factory);
556
editor = gimp_text_editor_new (title, parent, menu_factory);
558
font_name = gimp_context_get_font_name (GIMP_CONTEXT (options));
525
560
gimp_text_editor_set_direction (GIMP_TEXT_EDITOR (editor),
526
561
options->base_dir);
562
gimp_text_editor_set_font_name (GIMP_TEXT_EDITOR (editor),
528
g_signal_connect_object (editor, "dir_changed",
529
G_CALLBACK (gimp_text_options_dir_changed),
565
g_signal_connect_object (editor, "dir-changed",
566
G_CALLBACK (gimp_text_options_editor_dir_changed),
531
568
g_signal_connect_object (options, "notify::base-direction",
532
G_CALLBACK (gimp_text_options_notify_dir),
569
G_CALLBACK (gimp_text_options_editor_notify_dir),
571
g_signal_connect_object (options, "notify::font",
572
G_CALLBACK (gimp_text_options_editor_notify_font),