[gimp] Bug 581338 - Layer size does not change using the pdb 'gimp-text-layer-resize'



commit 40be8ad0894f256721600265353eac47f0ef4c34
Author: Michael Natterer <mitch gimp org>
Date:   Sun Feb 13 21:27:34 2011 +0100

    Bug 581338 - Layer size does not change using the pdb 'gimp-text-layer-resize'
    
    Set the text box mode to "fixed", and convert the passed in pixels to
    the text layer's unit when setting the text box' width and height.
    Spotted by Massimo.

 app/pdb/text-layer-cmds.c       |   14 ++++++++++++--
 tools/pdbgen/pdb/text_layer.pdb |   14 ++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/app/pdb/text-layer-cmds.c b/app/pdb/text-layer-cmds.c
index f56fb51..aaa9f23 100644
--- a/app/pdb/text-layer-cmds.c
+++ b/app/pdb/text-layer-cmds.c
@@ -1102,10 +1102,20 @@ text_layer_resize_invoker (GimpProcedure      *procedure,
     {
       if (gimp_pdb_layer_is_text_layer (layer, TRUE, error))
         {
+          gdouble  xres, yres;
+
+          gimp_image_get_resolution (gimp_item_get_image (GIMP_ITEM (layer)),
+                                     &xres, &yres);
+
           gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
                                _("Set text layer attribute"),
-                               "box-width",  width,
-                               "box-height", height,
+                               "box-mode",   GIMP_TEXT_BOX_FIXED,
+                               "box-width",  gimp_pixels_to_units (width,
+                                                                   GIMP_UNIT_PIXEL,
+                                                                   xres),
+                               "box-height", gimp_pixels_to_units (height,
+                                                                   GIMP_UNIT_PIXEL,
+                                                                   yres),
                                NULL);
         }
       else
diff --git a/tools/pdbgen/pdb/text_layer.pdb b/tools/pdbgen/pdb/text_layer.pdb
index 8ed045d..d482945 100644
--- a/tools/pdbgen/pdb/text_layer.pdb
+++ b/tools/pdbgen/pdb/text_layer.pdb
@@ -1175,10 +1175,20 @@ HELP
 {
   if (gimp_pdb_layer_is_text_layer (layer, TRUE, error))
     {
+      gdouble  xres, yres;
+
+      gimp_image_get_resolution (gimp_item_get_image (GIMP_ITEM (layer)),
+                                 &xres, &yres);
+
       gimp_text_layer_set (GIMP_TEXT_LAYER (layer),
                            _("Set text layer attribute"),
-                           "box-width",  width,
-                           "box-height", height,
+                           "box-mode",   GIMP_TEXT_BOX_FIXED,
+                           "box-width",  gimp_pixels_to_units (width,
+                                                               GIMP_UNIT_PIXEL,
+                                                               xres),
+                           "box-height", gimp_pixels_to_units (height,
+                                                               GIMP_UNIT_PIXEL,
+                                                               yres),
                            NULL);
     }
   else



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