inkscape_tools: remove `mnit` support
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 12 Jan 2018 03:11:57 +0000 (22:11 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 25 Jan 2018 14:01:17 +0000 (09:01 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/inkscape_tools/src/svg_to_png_and_nit.nit

index 7b7530b..f660a31 100644 (file)
@@ -92,71 +92,6 @@ abstract class ImageSetSrc
        var images: Array[Image]
 end
 
-# Nit module targeting the MNit framework
-class MnitImageSetSrc
-       super ImageSetSrc
-
-       redef fun rendering
-       do
-               # Known array of images
-               var arrays_of_images = new Array[String]
-
-               # Attributes of the generated class
-               var attributes = new Array[String]
-
-               # Statements for the generated `load_all` method
-               var load_exprs = new Array[String]
-
-               # Add images to Nit source file
-               for image in images do
-                       # Adapt coordinates to new top left and scale
-                       var coordinates = document.coordinates(image)
-
-                       var nit_name = image.name
-                       var last_char = nit_name.chars.last
-                       if last_char.to_s.is_numeric then
-                               # Array of images
-                               # TODO support more than 10 images in an array
-
-                               nit_name = nit_name.substring(0, nit_name.length-1)
-                               if not arrays_of_images.has(nit_name) then
-                                       # Create class attribute to store Array
-                                       arrays_of_images.add(nit_name)
-                                       attributes.add "\tvar {nit_name} = new Array[Image]\n"
-                               end
-                               load_exprs.add "\t\t{nit_name}.add(main_image.subimage({coordinates}))\n"
-                       else
-                               # Single image
-                               attributes.add "\tvar {nit_name}: Image is noinit\n"
-                               load_exprs.add "\t\t{nit_name} = main_image.subimage({coordinates})\n"
-                       end
-               end
-
-               add """
-# File generated by svg_to_png_and_nit, do not modify, redef instead
-
-import mnit::image_set
-
-class {{{document.nit_class_name}}}
-       super ImageSet
-
-       private var main_image: Image is noinit
-"""
-               add_all attributes
-               add """
-
-       redef fun load_all(app: App)
-       do
-               main_image = app.load_image(\"images/{{{document.drawing_name}}}.png\")
-"""
-               add_all load_exprs
-               add """
-       end
-end
-"""
-       end
-end
-
 # Nit module targeting the Gamnit framework
 #
 # Gamnit's `Texture` already manage the lazy loading, no need to do it here.
@@ -256,7 +191,7 @@ end
 var opt_out_src = new OptionString("Path to output source file (folder or file)", "--src", "-s")
 var opt_assets = new OptionString("Path to assert dir where to put PNG files", "--assets", "-a")
 var opt_scale = new OptionFloat("Apply scaling to exported images (default at 1.0)", 1.0, "--scale", "-x")
-var opt_gamnit = new OptionBool("Target the Gamnit framework (by default it targets Mnit)", "--gamnit", "-g")
+var opt_gamnit = new OptionBool("Target the Gamnit framework (the default, kept for compatibility)", "--gamnit", "-g")
 var opt_pow2 = new OptionBool("Round the image size to the next power of 2", "--pow2")
 var opt_help = new OptionBool("Print this help message", "--help", "-h")
 
@@ -398,12 +333,7 @@ for drawing in drawings do
        var document = new Document(drawing_name, scale, min_x, max_x, min_y, max_y)
 
        # Nit class
-       var nit_src: ImageSetSrc
-       if opt_gamnit.value then
-               nit_src = new GamnitImageSetSrc(document, images)
-       else
-               nit_src = new MnitImageSetSrc(document, images)
-       end
+       var nit_src = new GamnitImageSetSrc(document, images)
 
        if not src_path.file_extension == "nit" then
                src_path = src_path/drawing_name+".nit"