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



Author: weskaggs
Date: Tue Oct 14 20:01:30 2008
New Revision: 27279
URL: http://svn.gnome.org/viewvc/gimp?rev=27279&view=rev

Log:
Bill Skaggs <weskaggs gmail com>

	* app/text/gimptext-vectors.c
	* app/tools/gimptoolcontrol.h
	* app/tools/gimptexttool.c
	* app/tools/gimptexttool.h
	* app/tools/gimptoolcontrol.c
	* app/text/gimptextlayout.c: fixes requested by Sven and Mitch
	in bug #554736.


Modified:
   branches/soc-2008-text/ChangeLog
   branches/soc-2008-text/app/text/gimptext-vectors.c
   branches/soc-2008-text/app/text/gimptextlayout.c
   branches/soc-2008-text/app/tools/gimptexttool.c
   branches/soc-2008-text/app/tools/gimptexttool.h
   branches/soc-2008-text/app/tools/gimptoolcontrol.c
   branches/soc-2008-text/app/tools/gimptoolcontrol.h

Modified: branches/soc-2008-text/app/text/gimptext-vectors.c
==============================================================================
--- branches/soc-2008-text/app/text/gimptext-vectors.c	(original)
+++ branches/soc-2008-text/app/text/gimptext-vectors.c	Tue Oct 14 20:01:30 2008
@@ -105,10 +105,10 @@
 
 
 static inline void
-gimp_text_vector_coords (RenderContext   *context,
-                         const double x,
-                         const double y,
-                         GimpCoords      *coords)
+gimp_text_vector_coords (RenderContext *context,
+                         gdouble        x,
+                         gdouble        y,
+                         GimpCoords    *coords)
 {
   coords->x        = context->offset_x + (gdouble) x;
   coords->y        = context->offset_y + (gdouble) y;
@@ -120,8 +120,8 @@
 
 static gint
 moveto (RenderContext *context,
-        const double x,
-        const double y)
+        gdouble        x,
+        gdouble        y)
 {
   GimpCoords     start;
 
@@ -144,8 +144,8 @@
 
 static gint
 lineto (RenderContext *context,
-        const double x,
-        const double y)
+        gdouble        x,
+        gdouble        y)
 {
   GimpCoords     end;
 
@@ -164,13 +164,13 @@
 }
 
 static gint
-cubicto (RenderContext* context,
-         const double x1,
-         const double y1,
-         const double x2,
-         const double y2,
-         const double x3,
-         const double y3)
+cubicto (RenderContext *context,
+         gdouble        x1,
+         gdouble        y1,
+         gdouble        x2,
+         gdouble        y2,
+         gdouble        x3,
+         gdouble        y3)
 {
   GimpCoords     control1;
   GimpCoords     control2;
@@ -234,10 +234,10 @@
   cglyph.x =     0;
   cglyph.y =     0;
   cglyph.index = pango_glyph;
-    
+
   /* A cairo_t needs an image surface to function, so "surface" is created
    * temporarily for this purpose. Nothing is drawn to "surface", but it is
-   * still needed to be connected to "cr" for "cr" to execute 
+   * still needed to be connected to "cr" for "cr" to execute
    * cr_glyph_path(). The size of surface is therefore irrelevant.
    */
   surface = cairo_image_surface_create ( CAIRO_FORMAT_A8, 2, 2);
@@ -246,7 +246,7 @@
   cfont = pango_cairo_font_get_scaled_font ( (PangoCairoFont*) font);
 
   cairo_set_scaled_font (cr, cfont);
-  
+
   cairo_set_font_options (cr, options);
 
   cairo_transform (cr, matrix);

Modified: branches/soc-2008-text/app/text/gimptextlayout.c
==============================================================================
--- branches/soc-2008-text/app/text/gimptextlayout.c	(original)
+++ branches/soc-2008-text/app/text/gimptextlayout.c	Tue Oct 14 20:01:30 2008
@@ -313,7 +313,7 @@
 
   fontmap = PANGO_CAIRO_FONT_MAP (pango_cairo_font_map_new ());
 
-  pango_cairo_font_map_set_resolution (fontmap, xres);
+  pango_cairo_font_map_set_resolution (fontmap, yres);
 
   context = pango_cairo_font_map_create_context (fontmap);
   g_object_unref (fontmap);

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	Tue Oct 14 20:01:30 2008
@@ -46,6 +46,8 @@
 #include "core/gimpundostack.h"
 
 #include "display/gimpcanvas.h"
+#include "display/gimpdisplay.h"
+#include "display/gimpdisplayshell.h"
 
 #include "text/gimptext.h"
 #include "text/gimptext-vectors.h"
@@ -62,9 +64,6 @@
 #include "widgets/gimptexteditor.h"
 #include "widgets/gimpviewabledialog.h"
 
-#include "display/gimpdisplay.h"
-#include "display/gimpdisplayshell.h"
-
 #include "gimpeditselectiontool.h"
 #include "gimprectangletool.h"
 #include "gimprectangleoptions.h"
@@ -276,18 +275,22 @@
   gtk_text_buffer_set_text (text_tool->text_buffer, "", -1);
 
   g_signal_connect (text_tool->text_buffer, "changed",
-                    G_CALLBACK (gimp_text_tool_text_buffer_changed), text_tool);
+                    G_CALLBACK (gimp_text_tool_text_buffer_changed),
+                    text_tool);
   g_signal_connect (text_tool->text_buffer, "mark-set",
-                    G_CALLBACK (gimp_text_tool_text_buffer_mark_set), text_tool);
+                    G_CALLBACK (gimp_text_tool_text_buffer_mark_set),
+                    text_tool);
 
   text_tool->im_context = gtk_im_multicontext_new ();
 
   text_tool->preedit_string = NULL;
 
   g_signal_connect (text_tool->im_context, "commit",
-                    G_CALLBACK (gimp_text_tool_commit_cb), text_tool);
+                    G_CALLBACK (gimp_text_tool_commit_cb),
+                    text_tool);
   g_signal_connect (text_tool->im_context, "preedit_changed",
-                    G_CALLBACK (gimp_text_tool_preedit_changed_cb), text_tool);
+                    G_CALLBACK (gimp_text_tool_preedit_changed_cb),
+                    text_tool);
 
   gimp_tool_control_set_scroll_lock (tool->control, TRUE);
   gimp_tool_control_set_tool_cursor (tool->control,
@@ -344,9 +347,6 @@
   if (text_tool->editor)
     gtk_widget_destroy (text_tool->editor);
 
-  gimp_tool_control_set_wants_all_key_events (tool->control, FALSE);
-  gimp_tool_control_set_show_context_menu (tool->control, FALSE);
-
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
@@ -441,16 +441,16 @@
   cy = coords->y;
 
   if (x1 <= cx && x2 >= cx && y1 <= cy && y2 >= cy)
-  {
-    text_tool->text_cursor_changing = TRUE;
-    gimp_rectangle_tool_set_function (rect_tool, GIMP_RECTANGLE_TOOL_DEAD);
-    gimp_tool_control_activate (tool->control);
-  }
+    {
+      text_tool->text_cursor_changing = TRUE;
+      gimp_rectangle_tool_set_function (rect_tool, GIMP_RECTANGLE_TOOL_DEAD);
+      gimp_tool_control_activate (tool->control);
+    }
   else
-  {
-    text_tool->text_cursor_changing = FALSE;
-    gimp_rectangle_tool_button_press (tool, coords, time, state, display);
-  }
+    {
+      text_tool->text_cursor_changing = FALSE;
+      gimp_rectangle_tool_button_press (tool, coords, time, state, display);
+    }
 
 
   /* bail out now if the rectangle is narrow and the button
@@ -463,10 +463,10 @@
       gdouble   y    = coords->y - item->offset_y;
 
       if (x < 0 || x > item->width || y < 0 || y > item->height)
-      {
-        gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
-        return;
-      }
+        {
+          gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
+          return;
+        }
     }
 
   gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
@@ -494,13 +494,13 @@
 
               gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
               if (text && text_tool->text == text)
-              {
-                gimp_text_tool_canvas_editor (text_tool);
-                gtk_text_buffer_set_text (text_tool->text_buffer,
-                                          text_tool->text->text, -1);
+                {
+                  gimp_text_tool_canvas_editor (text_tool);
+                  gtk_text_buffer_set_text (text_tool->text_buffer,
+                                            text_tool->text->text, -1);
 
-                gimp_text_tool_update_layout (text_tool);
-              }
+                  gimp_text_tool_update_layout (text_tool);
+                }
 
               if (text_tool->layout)
                 {
@@ -612,6 +612,7 @@
         {
           /* user has modified shape of an existing text layer */
           gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
+
           if (text_tool->layout && text_tool->text_cursor_changing)
             {
               GimpItem   *item = GIMP_ITEM (text_tool->layer);
@@ -674,9 +675,9 @@
                        GdkModifierType  state,
                        GimpDisplay     *display)
 {
-  gdouble                      snapped_x;
-  gdouble                      snapped_y;
-  gint                         snap_x, snap_y;
+  gdouble snapped_x;
+  gdouble snapped_y;
+  gint    snap_x, snap_y;
 
   GimpTextTool *text_tool = GIMP_TEXT_TOOL (tool);
   if (text_tool->text_cursor_changing)
@@ -2165,7 +2166,9 @@
       gtk_text_buffer_delete_selection (text_tool->text_buffer, TRUE, TRUE);
     }
   else
-    gtk_text_buffer_backspace (text_tool->text_buffer, &cursor, TRUE, TRUE);
+    {
+      gtk_text_buffer_backspace (text_tool->text_buffer, &cursor, TRUE, TRUE);
+    }
 }
 
 static void
@@ -2276,12 +2279,13 @@
 }
 
 void
-gimp_text_tool_clipboard_copy (GimpTextTool *text_tool, gboolean use_CLIPBOARD)
+gimp_text_tool_clipboard_copy (GimpTextTool *text_tool,
+                               gboolean      use_clipboard)
 {
-  GimpTool *tool = GIMP_TOOL (text_tool);
+  GimpTool     *tool = GIMP_TOOL (text_tool);
   GtkClipboard *clipboard;
 
-  if (use_CLIPBOARD)
+  if (use_clipboard)
     clipboard = gtk_widget_get_clipboard (tool->display->shell,
                                           GDK_SELECTION_CLIPBOARD);
   else
@@ -2292,12 +2296,13 @@
 }
 
 void
-gimp_text_tool_clipboard_paste (GimpTextTool *text_tool, gboolean use_CLIPBOARD)
+gimp_text_tool_clipboard_paste (GimpTextTool *text_tool,
+                                gboolean      use_clipboard)
 {
   GimpTool *tool = GIMP_TOOL (text_tool);
   GtkClipboard *clipboard;
 
-  if (use_CLIPBOARD)
+  if (use_clipboard)
     clipboard = gtk_widget_get_clipboard (tool->display->shell,
                                           GDK_SELECTION_CLIPBOARD);
   else

Modified: branches/soc-2008-text/app/tools/gimptexttool.h
==============================================================================
--- branches/soc-2008-text/app/tools/gimptexttool.h	(original)
+++ branches/soc-2008-text/app/tools/gimptexttool.h	Tue Oct 14 20:01:30 2008
@@ -79,15 +79,17 @@
 void    gimp_text_tool_register  (GimpToolRegisterCallback  callback,
                                   gpointer                  data);
 
-GType   gimp_text_tool_get_type  (void) G_GNUC_CONST;
+GType   gimp_text_tool_get_type                (void) G_GNUC_CONST;
 
-void    gimp_text_tool_set_layer (GimpTextTool *text_tool,
-                                  GimpLayer    *layer);
+void    gimp_text_tool_set_layer               (GimpTextTool *text_tool,
+                                                GimpLayer    *layer);
 
-void    gimp_text_tool_delete_text     (GimpTextTool *text_tool);
-void    gimp_text_tool_clipboard_cut   (GimpTextTool *text_tool);
-void    gimp_text_tool_clipboard_copy  (GimpTextTool *text_tool, gboolean use_CLIPBOARD);
-void    gimp_text_tool_clipboard_paste (GimpTextTool *text_tool, gboolean use_CLIPBOARD);
+void    gimp_text_tool_delete_text             (GimpTextTool *text_tool);
+void    gimp_text_tool_clipboard_cut           (GimpTextTool *text_tool);
+void    gimp_text_tool_clipboard_copy          (GimpTextTool *text_tool,
+                                                gboolean      use_clipboard);
+void    gimp_text_tool_clipboard_paste         (GimpTextTool *text_tool,
+                                                gboolean      use_clipboard);
 
 gboolean gimp_text_tool_get_has_text_selection (GimpTextTool *text_tool);
 void     gimp_text_tool_create_vectors         (GimpTextTool *text_tool);

Modified: branches/soc-2008-text/app/tools/gimptoolcontrol.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimptoolcontrol.c	(original)
+++ branches/soc-2008-text/app/tools/gimptoolcontrol.c	Tue Oct 14 20:01:30 2008
@@ -278,7 +278,7 @@
 
 void
 gimp_tool_control_set_wants_all_key_events (GimpToolControl *control,
-                                   gboolean         wants_keyboard)
+                                            gboolean         wants_keyboard)
 {
   g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
 
@@ -295,9 +295,9 @@
 
 void
 gimp_tool_control_set_show_context_menu  (GimpToolControl *control,
-                                          gboolean show_context_menu)
+                                          gboolean         show_context_menu)
 {
-  g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
+  g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
   control->show_context_menu = show_context_menu;
 }
 
@@ -305,7 +305,7 @@
 gimp_tool_control_get_show_context_menu  (GimpToolControl *control)
 {
   g_return_val_if_fail (GIMP_IS_TOOL_CONTROL (control), FALSE);
-  return control->show_context_menu; 
+  return control->show_context_menu;
 }
 
 void

Modified: branches/soc-2008-text/app/tools/gimptoolcontrol.h
==============================================================================
--- branches/soc-2008-text/app/tools/gimptoolcontrol.h	(original)
+++ branches/soc-2008-text/app/tools/gimptoolcontrol.h	Tue Oct 14 20:01:30 2008
@@ -125,13 +125,13 @@
                                                    gboolean         snap_to);
 gboolean       gimp_tool_control_get_snap_to      (GimpToolControl *control);
 
-void           gimp_tool_control_set_wants_all_key_events  (GimpToolControl *control,
+void  gimp_tool_control_set_wants_all_key_events  (GimpToolControl *control,
                                                    gboolean         snap_to);
-gboolean       gimp_tool_control_get_wants_all_key_events  (GimpToolControl *control);
+gboolean gimp_tool_control_get_wants_all_key_events  (GimpToolControl *control);
 
-void           gimp_tool_control_set_show_context_menu  (GimpToolControl *control,
-                                                         gboolean show_context_menu);
-gboolean       gimp_tool_control_get_show_context_menu  (GimpToolControl *control);
+void     gimp_tool_control_set_show_context_menu  (GimpToolControl *control,
+                                                   gboolean         show_context_menu);
+gboolean gimp_tool_control_get_show_context_menu  (GimpToolControl *control);
 
 void           gimp_tool_control_set_snap_offsets (GimpToolControl *control,
                                                    gint             offset_x,



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