gimp r26915 - in branches/soc-2008-text: . app/tools



Author: weskaggs
Date: Wed Sep 10 18:11:27 2008
New Revision: 26915
URL: http://svn.gnome.org/viewvc/gimp?rev=26915&view=rev

Log:
Bill Skaggs <weskaggs gmail com>

	* app/tools/gimptexttool.c: Fix nasty bug that showed up when
	starting a new layer by click&drag outside existing layer.
	Also a few minor tweaks.


Modified:
   branches/soc-2008-text/ChangeLog
   branches/soc-2008-text/app/tools/gimptexttool.c

Modified: branches/soc-2008-text/app/tools/gimptexttool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimptexttool.c	(original)
+++ branches/soc-2008-text/app/tools/gimptexttool.c	Wed Sep 10 18:11:27 2008
@@ -324,6 +324,10 @@
                            G_CALLBACK (gimp_text_tool_use_editor_notify),
                            text_tool, 0);
 
+  g_object_set (options,
+                "highlight", FALSE,
+                NULL);
+
   return object;
 }
 
@@ -421,11 +425,6 @@
                                    G_CALLBACK (gimp_text_tool_text_buffer_mark_set),
                                    text_tool);
 
-  /* FIXME: this should certainly be done elsewhere */
-  g_object_set (options,
-                "highlight", FALSE,
-                NULL);
-
   text_tool->x1 = coords->x;
   text_tool->y1 = coords->y;
 
@@ -487,7 +486,6 @@
           y > 0 && y < gimp_item_height (item))
         {
           /*  did the user click on a text layer?  */
-
           if (gimp_text_tool_set_drawable (text_tool, drawable, TRUE))
             {
               /*enable keyboard-handling for the text*/
@@ -535,13 +533,19 @@
 
   /*  create a new text layer  */
   text_tool->text_box_fixed = FALSE;
+  if (text_tool->text)
+    {
+      g_object_unref (text_tool->text);
+      text_tool->text = NULL;
+    }
+  gtk_text_buffer_set_text (text_tool->text_buffer, "", -1);
   gimp_text_tool_connect (text_tool, NULL, NULL);
   gimp_text_tool_canvas_editor (text_tool);
-  if (text_tool->text)
-    gtk_text_buffer_set_text (text_tool->text_buffer,
-                              text_tool->text->text, -1);
-  else
-    gtk_text_buffer_set_text (text_tool->text_buffer, "", -1);
+/*   if (text_tool->text) */
+/*     gtk_text_buffer_set_text (text_tool->text_buffer, */
+/*                               text_tool->text->text, -1); */
+/*   else */
+/*     gtk_text_buffer_set_text (text_tool->text_buffer, "", -1); */
 }
 
 #define MIN_LAYER_WIDTH 20
@@ -943,7 +947,7 @@
 {
   if (options->use_editor)
     {
-      if (text_tool->text_buffer)
+      if (text_tool->text && text_tool->text_buffer)
         gimp_text_tool_editor (text_tool);
     }
   else
@@ -1247,6 +1251,7 @@
 
       g_object_set (text_tool->proxy,
                     "text", str,
+                    "box-mode", GIMP_TEXT_BOX_DYNAMIC,
                     NULL);
 
       g_free (str);
@@ -1734,7 +1739,7 @@
 
       text_tool->text_box_fixed = TRUE;
 
-      if (! text)
+      if (! text || ! text->text || (text->text[0] == NULL))
         {
           /*
            * we can't set properties for the text layer, because
@@ -2135,8 +2140,6 @@
     gtk_text_buffer_delete_selection (text_tool->text_buffer, TRUE, TRUE);
   else
     gtk_text_buffer_backspace (text_tool->text_buffer, &cursor, TRUE, TRUE);
-
-/*   gimp_text_tool_update_proxy (text_tool); */
 }
 
 static void
@@ -2146,7 +2149,6 @@
   if (gtk_text_buffer_get_has_selection (text_tool->text_buffer))
     gtk_text_buffer_delete_selection (text_tool->text_buffer, TRUE, TRUE);
   gtk_text_buffer_insert_at_cursor (text_tool->text_buffer, str, -1);
-/*   gimp_text_tool_update_proxy (text_tool); */
 }
 
 static void
@@ -2242,7 +2244,6 @@
 
   clipboard = gtk_widget_get_clipboard (tool->display->shell, GDK_SELECTION_CLIPBOARD);
   gtk_text_buffer_cut_clipboard (text_tool->text_buffer, clipboard, TRUE);
-  gimp_text_tool_update_proxy (text_tool);
 }
 
 void
@@ -2275,5 +2276,4 @@
                                           GDK_SELECTION_PRIMARY);
 
   gtk_text_buffer_paste_clipboard (text_tool->text_buffer, clipboard, NULL, TRUE);
-  gimp_text_tool_update_proxy (text_tool);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]