Commit 285b58de authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

use a GimpSizeEntry for the font size.

2004-03-13  Sven Neumann  <sven@gimp.org>

	* app/tools/gimptextoptions.[ch]: use a GimpSizeEntry for the
	font size.

	* app/tools/gimptexttool.c: set the size entry's resolution to the
	image resolution. Fixes bug #118356.
parent 07a92fe5
2004-03-13 Sven Neumann <sven@gimp.org>
* app/tools/gimptextoptions.[ch]: use a GimpSizeEntry for the
font size.
* app/tools/gimptexttool.c: set the size entry's resolution to the
image resolution. Fixes bug #118356.
2004-03-13 Sven Neumann <sven@gimp.org>
* app/tools/gimptexttool.[ch]: keep a pointer on the active text
......@@ -182,6 +182,7 @@ gimp_text_options_class_init (GimpTextOptionsClass *klass)
static void
gimp_text_options_init (GimpTextOptions *options)
{
options->size_entry = NULL;
}
static void
......@@ -372,10 +373,9 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
GtkWidget *button;
GimpDialogFactory *dialog_factory;
GtkWidget *auto_button;
GtkWidget *menu;
GtkWidget *entry;
GtkWidget *box;
GtkWidget *spinbutton;
gint digits;
gint row = 0;
options = GIMP_TEXT_OPTIONS (tool_options);
......@@ -403,20 +403,18 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
_("_Font:"), 1.0, 0.5,
button, 2, TRUE);
digits = gimp_unit_get_digits (options->unit);
spinbutton = gimp_prop_spin_button_new (config, "font-size",
1.0, 10.0, digits);
entry = gimp_prop_size_entry_new (config,
"font-size", "font-size-unit", "%a",
GIMP_SIZE_ENTRY_UPDATE_SIZE, 72.0);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row,
_("_Size:"), 1.0, 0.5,
spinbutton, 1, FALSE);
menu = gimp_prop_unit_menu_new (config, "font-size-unit", "%a");
g_object_set_data (G_OBJECT (menu), "set_digits", spinbutton);
gtk_table_attach (GTK_TABLE (table), menu, 2, 3, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (menu);
entry, 2, FALSE);
gtk_widget_show (entry);
row++;
options->size_entry = GIMP_SIZE_ENTRY (entry);
button = gimp_prop_check_button_new (config, "hinting", _("_Hinting"));
gtk_table_attach (GTK_TABLE (table), button, 1, 3, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
......
......@@ -48,6 +48,8 @@ struct _GimpTextOptions
GimpTextJustification justify;
gdouble indent;
gdouble line_spacing;
GimpSizeEntry *size_entry;
};
......
......@@ -84,8 +84,6 @@ static void gimp_text_tool_create_layer (GimpTextTool *text_tool);
static void gimp_text_tool_editor (GimpTextTool *text_tool);
static void gimp_text_tool_text_changed (GimpTextEditor *editor,
GimpTextTool *text_tool);
static void gimp_text_tool_layer_changed (GimpImage *image,
GimpTextTool *text_tool);
/* local variables */
......@@ -178,8 +176,6 @@ gimp_text_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
break;
case RESUME:
break;
......@@ -189,9 +185,6 @@ gimp_text_tool_control (GimpTool *tool,
gimp_text_tool_set_layer (text_tool, NULL);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
......@@ -255,8 +248,8 @@ gimp_text_tool_cursor_update (GimpTool *tool,
static void
gimp_text_tool_create_vectors (GimpTextTool *text_tool)
{
GimpTool *tool = GIMP_TOOL (text_tool);
GimpImage *gimage = tool->gdisp->gimage;
GimpTool *tool = GIMP_TOOL (text_tool);
GimpImage *image = tool->gdisp->gimage;
GimpVectors *vectors;
if (! text_tool->text)
......@@ -264,7 +257,7 @@ gimp_text_tool_create_vectors (GimpTextTool *text_tool)
gimp_tool_control_set_preserve (tool->control, TRUE);
vectors = gimp_text_vectors_new (gimage, text_tool->text);
vectors = gimp_text_vectors_new (image, text_tool->text);
if (text_tool->layer)
{
......@@ -274,11 +267,11 @@ gimp_text_tool_create_vectors (GimpTextTool *text_tool)
gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
}
gimp_image_add_vectors (gimage, vectors, -1);
gimp_image_add_vectors (image, vectors, -1);
gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_image_flush (gimage);
gimp_image_flush (image);
}
static void
......@@ -286,7 +279,7 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool)
{
GimpTool *tool = GIMP_TOOL (text_tool);
GimpTextOptions *options;
GimpImage *gimage;
GimpImage *image;
GimpText *text;
GimpLayer *layer;
......@@ -294,8 +287,6 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool)
options = GIMP_TEXT_OPTIONS (GIMP_TOOL (text_tool)->tool_info->tool_options);
gimage = tool->gdisp->gimage;
text = gimp_text_options_create_text (options);
g_object_set (text,
......@@ -303,7 +294,8 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool)
gimp_text_editor_get_text (GIMP_TEXT_EDITOR (text_tool->editor)),
NULL);
layer = gimp_text_layer_new (gimage, text);
image = tool->gdisp->gimage;
layer = gimp_text_layer_new (image, text);
g_object_unref (text);
if (! layer)
......@@ -313,22 +305,22 @@ gimp_text_tool_create_layer (GimpTextTool *text_tool)
gimp_tool_control_set_preserve (tool->control, TRUE);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TEXT,
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TEXT,
_("Add Text Layer"));
if (gimp_image_floating_sel (gimage))
floating_sel_anchor (gimp_image_floating_sel (gimage));
if (gimp_image_floating_sel (image))
floating_sel_anchor (gimp_image_floating_sel (image));
GIMP_ITEM (layer)->offset_x = text_tool->x1;
GIMP_ITEM (layer)->offset_y = text_tool->y1;
gimp_image_add_layer (gimage, layer, -1);
gimp_image_add_layer (image, layer, -1);
gimp_image_undo_group_end (gimage);
gimp_image_undo_group_end (image);
gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_image_flush (gimage);
gimp_image_flush (image);
gimp_text_tool_set_layer (text_tool, layer);
}
......@@ -449,14 +441,17 @@ void
gimp_text_tool_set_layer (GimpTextTool *text_tool,
GimpLayer *layer)
{
GimpImage *image;
g_return_if_fail (GIMP_IS_TEXT_TOOL (text_tool));
if (layer && GIMP_IS_TEXT_LAYER (layer) && GIMP_TEXT_LAYER (layer)->text)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
GimpToolOptions *options = GIMP_TOOL (text_tool)->tool_info->tool_options;
gimp_text_tool_connect (text_tool, GIMP_TEXT_LAYER (layer)->text);
gimp_size_entry_set_resolution (GIMP_TEXT_OPTIONS (options)->size_entry,
0, image->yresolution, FALSE);
if (text_tool->layer == layer)
return;
......@@ -470,7 +465,6 @@ gimp_text_tool_set_layer (GimpTextTool *text_tool,
text_tool->layer = layer;
image = gimp_item_get_image (GIMP_ITEM (text_tool->layer));
g_signal_connect_object (image, "active_layer_changed",
G_CALLBACK (gimp_text_tool_layer_changed),
text_tool, 0);
......@@ -481,10 +475,12 @@ gimp_text_tool_set_layer (GimpTextTool *text_tool,
if (text_tool->layer)
{
image = gimp_item_get_image (GIMP_ITEM (text_tool->layer));
GimpImage *image = gimp_item_get_image (GIMP_ITEM (text_tool->layer));
g_signal_handlers_disconnect_by_func (image,
gimp_text_tool_layer_changed,
text_tool);
text_tool->layer = NULL;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment