Xcos toolbox builder: use the Java renderer to generate palette images 11/10911/2
Clément DAVID [Wed, 20 Mar 2013 09:06:07 +0000 (10:06 +0100)]
Change-Id: I25e907ff67f7f09314eaa42b7c6232023204b2e2

scilab/modules/modules_manager/macros/tbx_build_blocks.sci
scilab/modules/xcos/macros/generateBlockImage.sci

index 414afb0..8568210 100644 (file)
@@ -89,26 +89,24 @@ function tbx_build_blocks(module, names, macros_path)
             error(msprintf(gettext("%s: Unable to export %s to %s.\n"),"tbx_build_blocks",names(i), h5Files(i)));
         end
 
-        block = scs_m;
-
-        // export an image file if it doesn't exist
-        files = gif_tlbx + "/" + names(i) + [".png" ".jpg" ".gif"];
-        files = files(isfile(files));
-        if files == [] then
-            filename = gif_tlbx + "/" + names(i) + ".gif";
-            if ~generateBlockImage(block, gif_tlbx, names(i), "gif", %t) then
-                error(msprintf(gettext("%s: Unable to export %s to %s.\n"),"tbx_build_blocks",names(i), filename));
-            end
-        end
+        blk = scs_m;
 
         // export a schema file if it doesn't exist
         files = svg_tlbx + "/" + names(i) + [".svg" ".png" ".jpg" ".gif"];
         files = files(isfile(files));
         if files == [] then
             filename = svg_tlbx + "/" + names(i) + ".svg";
-            if ~generateBlockImage(block, svg_tlbx, names(i), "svg", %f) then
+            if ~generateBlockImage(blk, svg_tlbx, names(i), "svg", %f) then
                 error(msprintf(gettext("%s: Unable to export %s to %s .\n"),"tbx_build_blocks",names(i), filename));
             end
         end
+
+        // export an image file if it doesn't exist
+        files = gif_tlbx + "/" + names(i) + [".png" ".jpg" ".gif"];
+        files = files(isfile(files));
+        if files == [] then
+            filename = gif_tlbx + "/" + names(i) + ".gif";
+            xcosPalGenerateIcon(filename);
+        end
     end
 endfunction
index 4d43b87..6c8a759 100644 (file)
@@ -63,6 +63,13 @@ function status = generateBlockImage(block, path, filename, imageType, withPort)
         outFile = path + "/" + filename + "." + imageType;
     end
     
+    // if the gr_i value of a bloc is empty, return
+    if (block.graphics.gr_i(1) == []) then
+      mputl("<svg/>", outFile);
+      status = %t;
+      return
+    end
+
     // set export properties before creating any graphic object (including any figure)
     previous_driver = driver(imageType);
     xinit(outFile);