[gimp] app: rename "spacing" to "kerning" because that's what it does



commit bbd2d521f12f771d7a1064b59e00e0720ba3a36b
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 3 10:48:42 2010 +0100

    app: rename "spacing" to "kerning" because that's what it does

 app/tools/gimptexttool-editor.c        |   10 ++--
 app/widgets/gimptextbuffer-serialize.c |    4 +-
 app/widgets/gimptextbuffer.c           |   91 ++++++++++++++------------------
 app/widgets/gimptextbuffer.h           |    8 ++--
 app/widgets/gimptextproxy.c            |   12 ++--
 app/widgets/gimptextproxy.h            |    2 +-
 6 files changed, 58 insertions(+), 69 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index 29ddf1b..d55fdd1 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -73,7 +73,7 @@ static void   gimp_text_tool_select_all         (GimpTextTool    *text_tool,
                                                  gboolean         select);
 static void   gimp_text_tool_change_baseline    (GimpTextTool    *text_tool,
                                                  gint             count);
-static void   gimp_text_tool_change_spacing     (GimpTextTool    *text_tool,
+static void   gimp_text_tool_change_kerning     (GimpTextTool    *text_tool,
                                                  gint             count);
 
 static void   gimp_text_tool_options_notify     (GimpTextOptions *options,
@@ -619,8 +619,8 @@ gimp_text_tool_ensure_proxy (GimpTextTool *text_tool)
       g_signal_connect_swapped (text_tool->proxy_text_view, "change-baseline",
                                 G_CALLBACK (gimp_text_tool_change_baseline),
                                 text_tool);
-      g_signal_connect_swapped (text_tool->proxy_text_view, "change-spacing",
-                                G_CALLBACK (gimp_text_tool_change_spacing),
+      g_signal_connect_swapped (text_tool->proxy_text_view, "change-kerning",
+                                G_CALLBACK (gimp_text_tool_change_kerning),
                                 text_tool);
     }
 }
@@ -1058,7 +1058,7 @@ gimp_text_tool_change_baseline (GimpTextTool *text_tool,
 }
 
 static void
-gimp_text_tool_change_spacing (GimpTextTool *text_tool,
+gimp_text_tool_change_kerning (GimpTextTool *text_tool,
                                gint          count)
 {
   GtkTextBuffer *buffer = GTK_TEXT_BUFFER (text_tool->buffer);
@@ -1076,7 +1076,7 @@ gimp_text_tool_change_spacing (GimpTextTool *text_tool,
   gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
 
   gtk_text_iter_order (&start, &end);
-  gimp_text_buffer_change_spacing (text_tool->buffer, &start, &end,
+  gimp_text_buffer_change_kerning (text_tool->buffer, &start, &end,
                                    count * PANGO_SCALE);
 
   gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
diff --git a/app/widgets/gimptextbuffer-serialize.c b/app/widgets/gimptextbuffer-serialize.c
index 372416f..b7879ec 100644
--- a/app/widgets/gimptextbuffer-serialize.c
+++ b/app/widgets/gimptextbuffer-serialize.c
@@ -663,7 +663,7 @@ gimp_text_buffer_pre_serialize (GimpTextBuffer *buffer,
         {
           GtkTextTag *tag = list->data;
 
-          if (g_list_find (buffer->spacing_tags, tag))
+          if (g_list_find (buffer->kerning_tags, tag))
             {
               GtkTextIter end;
 
@@ -704,7 +704,7 @@ gimp_text_buffer_post_deserialize (GimpTextBuffer *buffer,
         {
           GtkTextTag *tag = list->data;
 
-          if (g_list_find (buffer->spacing_tags, tag))
+          if (g_list_find (buffer->kerning_tags, tag))
             {
               GtkTextIter end;
 
diff --git a/app/widgets/gimptextbuffer.c b/app/widgets/gimptextbuffer.c
index cefb480..2979ccf 100644
--- a/app/widgets/gimptextbuffer.c
+++ b/app/widgets/gimptextbuffer.c
@@ -51,9 +51,6 @@
 #include "gimp-intl.h"
 
 
-#define ENABLE_SPACING
-
-
 /*  local function prototypes  */
 
 static GObject * gimp_text_buffer_constructor (GType                  type,
@@ -156,10 +153,10 @@ gimp_text_buffer_finalize (GObject *object)
       buffer->baseline_tags = NULL;
     }
 
-  if (buffer->spacing_tags)
+  if (buffer->kerning_tags)
     {
-      g_list_free (buffer->spacing_tags);
-      buffer->spacing_tags = NULL;
+      g_list_free (buffer->kerning_tags);
+      buffer->kerning_tags = NULL;
     }
 
   if (buffer->font_tags)
@@ -251,9 +248,7 @@ gimp_text_buffer_set_markup (GimpTextBuffer *buffer,
         {
           GtkTextIter start, end;
 
-#ifdef ENABLE_SPACING
           gimp_text_buffer_post_deserialize (buffer, content);
-#endif
 
           gtk_text_buffer_get_bounds (content, &start, &end);
           gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &insert);
@@ -286,9 +281,7 @@ gimp_text_buffer_get_markup (GimpTextBuffer *buffer)
 
   gtk_text_buffer_insert_range (content, &insert, &start, &end);
 
-#ifdef ENABLE_SPACING
   gimp_text_buffer_pre_serialize (buffer, content);
-#endif
 
   gtk_text_buffer_get_bounds (content, &start, &end);
 
@@ -460,69 +453,69 @@ gimp_text_buffer_change_baseline (GimpTextBuffer    *buffer,
 }
 
 GtkTextTag *
-gimp_text_buffer_get_iter_spacing (GimpTextBuffer    *buffer,
+gimp_text_buffer_get_iter_kerning (GimpTextBuffer    *buffer,
                                    const GtkTextIter *iter,
-                                   gint              *spacing)
+                                   gint              *kerning)
 {
   GList *list;
 
-  for (list = buffer->spacing_tags; list; list = g_list_next (list))
+  for (list = buffer->kerning_tags; list; list = g_list_next (list))
     {
       GtkTextTag *tag = list->data;
 
       if (gtk_text_iter_has_tag (iter, tag))
         {
-          if (spacing)
+          if (kerning)
             g_object_get (tag,
-                          "rise", spacing, /* FIXME */
+                          "rise", kerning, /* FIXME */
                           NULL);
 
           return tag;
         }
     }
 
-  if (spacing)
-    *spacing = 0;
+  if (kerning)
+    *kerning = 0;
 
   return NULL;
 }
 
 static GtkTextTag *
-gimp_text_buffer_get_spacing_tag (GimpTextBuffer *buffer,
-                                  gint            spacing)
+gimp_text_buffer_get_kerning_tag (GimpTextBuffer *buffer,
+                                  gint            kerning)
 {
   GList      *list;
   GtkTextTag *tag;
   gchar       name[32];
 
-  for (list = buffer->spacing_tags; list; list = g_list_next (list))
+  for (list = buffer->kerning_tags; list; list = g_list_next (list))
     {
-      gint tag_spacing;
+      gint tag_kerning;
 
       tag = list->data;
 
       g_object_get (tag,
-                    "rise", &tag_spacing, /* FIXME */
+                    "rise", &tag_kerning, /* FIXME */
                     NULL);
 
-      if (tag_spacing == spacing)
+      if (tag_kerning == kerning)
         return tag;
     }
 
-  g_snprintf (name, sizeof (name), "spacing-%d", spacing);
+  g_snprintf (name, sizeof (name), "kerning-%d", kerning);
 
   tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (buffer),
                                     name,
-                                    "rise", spacing, /* FIXME */
+                                    "rise", kerning, /* FIXME */
                                     NULL);
 
-  buffer->spacing_tags = g_list_prepend (buffer->spacing_tags, tag);
+  buffer->kerning_tags = g_list_prepend (buffer->kerning_tags, tag);
 
   return tag;
 }
 
 void
-gimp_text_buffer_change_spacing (GimpTextBuffer    *buffer,
+gimp_text_buffer_change_kerning (GimpTextBuffer    *buffer,
                                  const GtkTextIter *start,
                                  const GtkTextIter *end,
                                  gint               count)
@@ -531,7 +524,7 @@ gimp_text_buffer_change_spacing (GimpTextBuffer    *buffer,
   GtkTextIter  span_start;
   GtkTextIter  span_end;
   GtkTextTag  *span_tag;
-  gint         span_spacing;
+  gint         span_kerning;
 
   g_return_if_fail (GIMP_IS_TEXT_BUFFER (buffer));
   g_return_if_fail (start != NULL);
@@ -542,43 +535,43 @@ gimp_text_buffer_change_spacing (GimpTextBuffer    *buffer,
 
   iter       = *start;
   span_start = *start;
-  span_tag   = gimp_text_buffer_get_iter_spacing (buffer, &iter,
-                                                  &span_spacing);
+  span_tag   = gimp_text_buffer_get_iter_kerning (buffer, &iter,
+                                                  &span_kerning);
 
   gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (buffer));
 
   do
     {
       GtkTextTag *iter_tag;
-      gint        iter_spacing;
+      gint        iter_kerning;
 
       gtk_text_iter_forward_char (&iter);
 
-      iter_tag = gimp_text_buffer_get_iter_spacing (buffer, &iter,
-                                                    &iter_spacing);
+      iter_tag = gimp_text_buffer_get_iter_kerning (buffer, &iter,
+                                                    &iter_kerning);
 
       span_end = iter;
 
-      if (iter_spacing != span_spacing ||
+      if (iter_kerning != span_kerning ||
           gtk_text_iter_compare (&iter, end) >= 0)
         {
-          if (span_spacing != 0)
+          if (span_kerning != 0)
             {
               gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (buffer), span_tag,
                                           &span_start, &span_end);
             }
 
-          if (span_spacing + count != 0)
+          if (span_kerning + count != 0)
             {
-              span_tag = gimp_text_buffer_get_spacing_tag (buffer,
-                                                           span_spacing + count);
+              span_tag = gimp_text_buffer_get_kerning_tag (buffer,
+                                                           span_kerning + count);
 
               gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (buffer), span_tag,
                                          &span_start, &span_end);
             }
 
           span_start   = iter;
-          span_spacing = iter_spacing;
+          span_kerning = iter_kerning;
           span_tag     = iter_tag;
         }
 
@@ -741,20 +734,20 @@ gimp_text_buffer_tag_to_name (GimpTextBuffer  *buffer,
 
       return "span";
     }
-  else if (g_list_find (buffer->spacing_tags, tag))
+  else if (g_list_find (buffer->kerning_tags, tag))
     {
       if (attribute)
         *attribute = "letter_spacing";
 
       if (value)
         {
-          gint spacing;
+          gint kerning;
 
           g_object_get (tag,
-                        "rise", &spacing, /* FIXME */
+                        "rise", &kerning, /* FIXME */
                         NULL);
 
-          *value = g_strdup_printf ("%d", spacing);
+          *value = g_strdup_printf ("%d", kerning);
         }
 
       return "span";
@@ -812,7 +805,7 @@ gimp_text_buffer_name_to_tag (GimpTextBuffer *buffer,
         }
       else if (! strcmp (attribute, "letter_spacing"))
         {
-          return gimp_text_buffer_get_spacing_tag (buffer, atoi (value));
+          return gimp_text_buffer_get_kerning_tag (buffer, atoi (value));
         }
       else if (! strcmp (attribute, "font"))
         {
@@ -916,7 +909,7 @@ gimp_text_buffer_insert (GimpTextBuffer *buffer,
           GtkTextTag *tag = slist->data;
 
           if (! g_list_find (remove_tags, tag) &&
-              ! g_list_find (buffer->spacing_tags, tag))
+              ! g_list_find (buffer->kerning_tags, tag))
             {
               gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (buffer), tag,
                                          &start, &iter);
@@ -950,7 +943,6 @@ gimp_text_buffer_get_iter_index (GimpTextBuffer *buffer,
   index = strlen (string);
   g_free (string);
 
-#ifdef ENABLE_SPACING
   if (layout_index)
     {
       do
@@ -962,7 +954,7 @@ gimp_text_buffer_get_iter_index (GimpTextBuffer *buffer,
             {
               GtkTextTag *tag = list->data;
 
-              if (g_list_find (buffer->spacing_tags, tag))
+              if (g_list_find (buffer->kerning_tags, tag))
                 {
                   index += WORD_JOINER_LENGTH;
 
@@ -980,7 +972,6 @@ gimp_text_buffer_get_iter_index (GimpTextBuffer *buffer,
         }
       while (! gtk_text_iter_equal (&start, iter));
     }
-#endif
 
   return index;
 }
@@ -1002,7 +993,6 @@ gimp_text_buffer_get_iter_at_index (GimpTextBuffer *buffer,
   string = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (buffer),
                                      &start, &end, TRUE);
 
-#ifdef ENABLE_SPACING
   if (layout_index)
     {
       gchar *my_string = string;
@@ -1022,7 +1012,7 @@ gimp_text_buffer_get_iter_at_index (GimpTextBuffer *buffer,
             {
               GtkTextTag *tag = list->data;
 
-              if (g_list_find (buffer->spacing_tags, tag))
+              if (g_list_find (buffer->kerning_tags, tag))
                 {
                   index -= WORD_JOINER_LENGTH;
 
@@ -1041,7 +1031,6 @@ gimp_text_buffer_get_iter_at_index (GimpTextBuffer *buffer,
       while (my_index < index &&
              ! gtk_text_iter_equal (&start, &end));
     }
-#endif
 
   string[index] = '\0';
 
diff --git a/app/widgets/gimptextbuffer.h b/app/widgets/gimptextbuffer.h
index 34db1d4..ac3abf7 100644
--- a/app/widgets/gimptextbuffer.h
+++ b/app/widgets/gimptextbuffer.h
@@ -41,7 +41,7 @@ struct _GimpTextBuffer
   GtkTextTag    *strikethrough_tag;
 
   GList         *baseline_tags;
-  GList         *spacing_tags;
+  GList         *kerning_tags;
   GList         *font_tags;
 
   gboolean       insert_tags_set;
@@ -79,10 +79,10 @@ void             gimp_text_buffer_change_baseline   (GimpTextBuffer    *buffer,
                                                      const GtkTextIter *end,
                                                      gint               count);
 
-GtkTextTag     * gimp_text_buffer_get_iter_spacing  (GimpTextBuffer    *buffer,
+GtkTextTag     * gimp_text_buffer_get_iter_kerning  (GimpTextBuffer    *buffer,
                                                      const GtkTextIter *iter,
-                                                     gint              *spacing);
-void             gimp_text_buffer_change_spacing    (GimpTextBuffer    *buffer,
+                                                     gint              *kerning);
+void             gimp_text_buffer_change_kerning    (GimpTextBuffer    *buffer,
                                                      const GtkTextIter *start,
                                                      const GtkTextIter *end,
                                                      gint               count);
diff --git a/app/widgets/gimptextproxy.c b/app/widgets/gimptextproxy.c
index b7dab8e..1fab27e 100644
--- a/app/widgets/gimptextproxy.c
+++ b/app/widgets/gimptextproxy.c
@@ -31,7 +31,7 @@
 enum
 {
   CHANGE_BASELINE,
-  CHANGE_SPACING,
+  CHANGE_KERNING,
   LAST_SIGNAL
 };
 
@@ -82,11 +82,11 @@ gimp_text_proxy_class_init (GimpTextProxyClass *klass)
 		  G_TYPE_NONE, 1,
 		  G_TYPE_INT);
 
-  proxy_signals[CHANGE_SPACING] =
-    g_signal_new ("change-spacing",
+  proxy_signals[CHANGE_KERNING] =
+    g_signal_new ("change-kerning",
 		  G_TYPE_FROM_CLASS (klass),
 		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-		  G_STRUCT_OFFSET (GimpTextProxyClass, change_spacing),
+		  G_STRUCT_OFFSET (GimpTextProxyClass, change_kerning),
 		  NULL, NULL,
 		  gimp_marshal_VOID__INT,
 		  G_TYPE_NONE, 1,
@@ -102,10 +102,10 @@ gimp_text_proxy_class_init (GimpTextProxyClass *klass)
                                 G_TYPE_INT, -1);
 
   gtk_binding_entry_add_signal (binding_set, GDK_Left, GDK_MOD1_MASK,
-				"change-spacing", 1,
+				"change-kerning", 1,
                                 G_TYPE_INT, -1);
   gtk_binding_entry_add_signal (binding_set, GDK_Right, GDK_MOD1_MASK,
-				"change-spacing", 1,
+				"change-kerning", 1,
                                 G_TYPE_INT, 1);
 }
 
diff --git a/app/widgets/gimptextproxy.h b/app/widgets/gimptextproxy.h
index 554840f..ffa0564 100644
--- a/app/widgets/gimptextproxy.h
+++ b/app/widgets/gimptextproxy.h
@@ -43,7 +43,7 @@ struct _GimpTextProxyClass
 
   void (* change_baseline) (GimpTextProxy *proxy,
                             gint           count);
-  void (* change_spacing)  (GimpTextProxy *proxy,
+  void (* change_kerning)  (GimpTextProxy *proxy,
                             gint           count);
 };
 



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