[gimp] Port stuff to gimp_item_is_text_layer()



commit cc7755f87666023bc523d582d0da39f45e160d73
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue Oct 5 07:39:00 2010 +0200

    Port stuff to gimp_item_is_text_layer()
    
    Port stuff to gimp_item_is_text_layer() instead of
    gimp_drawable_is_text_layer(). Nevermind the previous commit, it
    should never have been pushed...

 app/actions/layers-actions.c        |    2 +-
 app/actions/layers-commands.c       |    4 ++--
 app/actions/text-tool-actions.c     |    2 +-
 app/dialogs/layer-options-dialog.c  |    4 ++--
 app/display/gimpdisplayshell-dnd.c  |    2 +-
 app/gimpcore.def                    |    2 +-
 app/pdb/gimppdb-utils.c             |    2 +-
 app/pdb/item-cmds.c                 |    3 +--
 app/text/gimptextlayer.c            |   10 +++++-----
 app/text/gimptextlayer.h            |    2 +-
 app/widgets/gimplayertreeview.c     |    2 +-
 app/widgets/gimpviewrendererlayer.c |    2 +-
 plug-ins/common/file-pdf-save.c     |    2 +-
 tools/pdbgen/pdb/item.pdb           |    3 +--
 14 files changed, 20 insertions(+), 22 deletions(-)
---
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index 764c3e6..a433142 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -572,7 +572,7 @@ layers_actions_update (GimpActionGroup *group,
                 }
             }
 
-          text_layer = gimp_item_is_text_layer (GIMP_DRAWABLE (layer));
+          text_layer = gimp_item_is_text_layer (GIMP_ITEM (layer));
         }
     }
 
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 82a171b..0e72a69 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -159,7 +159,7 @@ layers_text_tool_cmd_callback (GtkAction *action,
   return_if_no_layer (image, layer, data);
   return_if_no_widget (widget, data);
 
-  if (! gimp_item_is_text_layer (GIMP_DRAWABLE (layer)))
+  if (! gimp_item_is_text_layer (GIMP_ITEM (layer)))
     {
       layers_edit_attributes_cmd_callback (action, data);
       return;
@@ -1049,7 +1049,7 @@ layers_edit_layer_response (GtkWidget          *widget,
         }
 
       if (dialog->rename_toggle &&
-          gimp_item_is_text_layer (GIMP_DRAWABLE (layer)))
+          gimp_item_is_text_layer (GIMP_ITEM (layer)))
         {
           g_object_set (layer,
                         "auto-rename",
diff --git a/app/actions/text-tool-actions.c b/app/actions/text-tool-actions.c
index 952b828..5930852 100644
--- a/app/actions/text-tool-actions.c
+++ b/app/actions/text-tool-actions.c
@@ -157,7 +157,7 @@ text_tool_actions_update (GimpActionGroup *group,
   layer = gimp_image_get_active_layer (image);
 
   if (layer)
-    text_layer = gimp_item_is_text_layer (GIMP_DRAWABLE (layer));
+    text_layer = gimp_item_is_text_layer (GIMP_ITEM (layer));
 
   vectors = gimp_image_get_active_vectors (image);
 
diff --git a/app/dialogs/layer-options-dialog.c b/app/dialogs/layer-options-dialog.c
index aa6e29e..c0b8c4e 100644
--- a/app/dialogs/layer-options-dialog.c
+++ b/app/dialogs/layer-options-dialog.c
@@ -211,7 +211,7 @@ layer_options_dialog_new (GimpImage    *image,
   else
     {
       /*  For text layers add a toggle to control "auto-rename"  */
-      if (gimp_item_is_text_layer (GIMP_DRAWABLE (layer)))
+      if (gimp_item_is_text_layer (GIMP_ITEM (layer)))
         {
           options->rename_toggle =
             gtk_check_button_new_with_mnemonic (_("Set name from _text"));
@@ -240,7 +240,7 @@ layer_options_dialog_toggle_rename (GtkWidget          *widget,
                                     LayerOptionsDialog *options)
 {
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) &&
-      gimp_item_is_text_layer (GIMP_DRAWABLE (options->layer)))
+      gimp_item_is_text_layer (GIMP_ITEM (options->layer)))
     {
       GimpTextLayer *text_layer = GIMP_TEXT_LAYER (options->layer);
       GimpText      *text       = gimp_text_layer_get_text (text_layer);
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index abaaf9a..23d90e4 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -359,7 +359,7 @@ gimp_display_shell_dnd_bucket_fill (GimpDisplayShell   *shell,
   /* FIXME: there should be a virtual method for this that the
    *        GimpTextLayer can override.
    */
-  if (color && gimp_item_is_text_layer (drawable))
+  if (color && gimp_item_is_text_layer (GIMP_ITEM (drawable)))
     {
       gimp_text_layer_set (GIMP_TEXT_LAYER (drawable), NULL,
                            "color", color,
diff --git a/app/gimpcore.def b/app/gimpcore.def
index ec0ee64..128a1fc 100644
--- a/app/gimpcore.def
+++ b/app/gimpcore.def
@@ -201,7 +201,6 @@ EXPORTS
 	gimp_drawable_invert
 	gimp_drawable_is_indexed
 	gimp_drawable_is_rgb
-	gimp_drawable_is_text_layer
 	gimp_drawable_mask_bounds
 	gimp_drawable_offset
 	gimp_drawable_set_tiles
@@ -399,6 +398,7 @@ EXPORTS
 	gimp_item_get_type
 	gimp_item_get_visible
 	gimp_item_height
+	gimp_item_is_text_layer
 	gimp_item_linked_flip
 	gimp_item_linked_rotate
 	gimp_item_linked_transform
diff --git a/app/pdb/gimppdb-utils.c b/app/pdb/gimppdb-utils.c
index ee43716..1f87938 100644
--- a/app/pdb/gimppdb-utils.c
+++ b/app/pdb/gimppdb-utils.c
@@ -516,7 +516,7 @@ gimp_pdb_layer_is_text_layer (GimpLayer  *layer,
   g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-  if (! gimp_item_is_text_layer (GIMP_DRAWABLE (layer)))
+  if (! gimp_item_is_text_layer (GIMP_ITEM (layer)))
     {
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
                    _("Layer '%s' (%d) cannot be used because it is not "
diff --git a/app/pdb/item-cmds.c b/app/pdb/item-cmds.c
index 637824b..cf2dc3f 100644
--- a/app/pdb/item-cmds.c
+++ b/app/pdb/item-cmds.c
@@ -196,8 +196,7 @@ item_is_text_layer_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      text_layer = (GIMP_IS_DRAWABLE (item) &&
-                    gimp_item_is_text_layer (GIMP_DRAWABLE (item)));
+      text_layer = gimp_item_is_text_layer (item);
     }
 
   return_vals = gimp_procedure_get_return_values (procedure, success,
diff --git a/app/text/gimptextlayer.c b/app/text/gimptextlayer.c
index a7ad2ee..365f003 100644
--- a/app/text/gimptextlayer.c
+++ b/app/text/gimptextlayer.c
@@ -446,7 +446,7 @@ gimp_text_layer_set (GimpTextLayer *layer,
   GimpText  *text;
   va_list    var_args;
 
-  g_return_if_fail (gimp_item_is_text_layer ((GimpDrawable *) layer));
+  g_return_if_fail (gimp_item_is_text_layer (GIMP_ITEM (layer)));
   g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)));
 
   text = gimp_text_layer_get_text (layer);
@@ -513,11 +513,11 @@ gimp_text_layer_discard (GimpTextLayer *layer)
 }
 
 gboolean
-gimp_item_is_text_layer (GimpDrawable *drawable)
+gimp_item_is_text_layer (GimpItem *item)
 {
-  return (GIMP_IS_TEXT_LAYER (drawable)    &&
-          GIMP_TEXT_LAYER (drawable)->text &&
-          GIMP_TEXT_LAYER (drawable)->modified == FALSE);
+  return (GIMP_IS_TEXT_LAYER (item)    &&
+          GIMP_TEXT_LAYER (item)->text &&
+          GIMP_TEXT_LAYER (item)->modified == FALSE);
 }
 
 
diff --git a/app/text/gimptextlayer.h b/app/text/gimptextlayer.h
index 876ac59..6d6e504 100644
--- a/app/text/gimptextlayer.h
+++ b/app/text/gimptextlayer.h
@@ -67,7 +67,7 @@ void        gimp_text_layer_set         (GimpTextLayer *layer,
                                          const gchar   *first_property_name,
                                          ...) G_GNUC_NULL_TERMINATED;
 
-gboolean    gimp_item_is_text_layer     (GimpDrawable  *drawable);
+gboolean    gimp_item_is_text_layer     (GimpItem      *item);
 
 
 #endif /* __GIMP_TEXT_LAYER_H__ */
diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c
index 9e33c86..50caebe 100644
--- a/app/widgets/gimplayertreeview.c
+++ b/app/widgets/gimplayertreeview.c
@@ -680,7 +680,7 @@ gimp_layer_tree_view_drop_color (GimpContainerTreeView   *view,
                                  GimpViewable            *dest_viewable,
                                  GtkTreeViewDropPosition  drop_pos)
 {
-  if (gimp_item_is_text_layer (GIMP_DRAWABLE (dest_viewable)))
+  if (gimp_item_is_text_layer (GIMP_ITEM (dest_viewable)))
     {
       gimp_text_layer_set (GIMP_TEXT_LAYER (dest_viewable), NULL,
                            "color", color,
diff --git a/app/widgets/gimpviewrendererlayer.c b/app/widgets/gimpviewrendererlayer.c
index 155cecb..1ca7533 100644
--- a/app/widgets/gimpviewrendererlayer.c
+++ b/app/widgets/gimpviewrendererlayer.c
@@ -67,7 +67,7 @@ gimp_view_renderer_layer_render (GimpViewRenderer *renderer,
     {
       stock_id = GIMP_STOCK_FLOATING_SELECTION;
     }
-  else if (gimp_item_is_text_layer (GIMP_DRAWABLE (renderer->viewable)))
+  else if (gimp_item_is_text_layer (GIMP_ITEM (renderer->viewable)))
     {
       stock_id = gimp_viewable_get_stock_id (renderer->viewable);
     }
diff --git a/plug-ins/common/file-pdf-save.c b/plug-ins/common/file-pdf-save.c
index 59cbf4d..d66a7fc 100644
--- a/plug-ins/common/file-pdf-save.c
+++ b/plug-ins/common/file-pdf-save.c
@@ -478,7 +478,7 @@ run (const gchar      *name,
               gimp_drawable_offsets (layer->drawable_id, &x, &y);
 
               /* For raster layers */
-              if (!gimp_drawable_is_text_layer (layer->drawable_id))
+              if (!gimp_item_is_text_layer (layer->drawable_id))
                 {
                   layer_color = get_layer_color (layer, &single_color);
                   cairo_rectangle (cr, x, y, layer->width, layer->height);
diff --git a/tools/pdbgen/pdb/item.pdb b/tools/pdbgen/pdb/item.pdb
index 1ea0fa4..ddba7e5 100644
--- a/tools/pdbgen/pdb/item.pdb
+++ b/tools/pdbgen/pdb/item.pdb
@@ -187,8 +187,7 @@ HELP
     %invoke = (
         code => <<'CODE'
 {
-  text_layer = (GIMP_IS_DRAWABLE (item) &&
-                gimp_drawable_is_text_layer (GIMP_DRAWABLE (item)));
+  text_layer = gimp_item_is_text_layer (item);
 }
 CODE
     );



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