Add more warnings source to 1.6) and fix warnings
[jvcard.git] / src / be / nikiroo / jvcard / tui / ImageTextControl.java
index 33773b2dc280a2962e1d66c2312ca827d9621143..6a0a5ea2cf39da99e542186e47c3bfcd87565555 100644 (file)
@@ -1,8 +1,11 @@
 package be.nikiroo.jvcard.tui;
 
+import java.awt.Dimension;
 import java.awt.Image;
 
-import be.nikiroo.jvcard.tui.ImageText.Mode;
+import be.nikiroo.jvcard.launcher.Main;
+import be.nikiroo.utils.ImageText;
+import be.nikiroo.utils.ImageText.Mode;
 
 import com.googlecode.lanterna.TerminalSize;
 import com.googlecode.lanterna.gui2.BorderLayout;
@@ -13,7 +16,7 @@ import com.googlecode.lanterna.gui2.TextBox;
  * A {@link Panel} containing an {@link ImageText} rendering.
  * 
  * @author niki
- *
+ * 
  */
 public class ImageTextControl extends Panel {
        private ImageText image;
@@ -31,7 +34,7 @@ public class ImageTextControl extends Panel {
         */
        public ImageTextControl(Image image, TerminalSize size) {
                Mode mode = Mode.DOUBLE_DITHERING;
-               if (!UiColors.getInstance().isUnicode()) {
+               if (!Main.isUnicode()) {
                        mode = Mode.ASCII;
                }
 
@@ -43,7 +46,8 @@ public class ImageTextControl extends Panel {
 
                this.setLayoutManager(new BorderLayout());
                setSize(size);
-               setImage(new ImageText(image, size, mode, false));
+               setImage(new ImageText(image, new Dimension(size.getColumns(),
+                               size.getRows()), mode, false));
        }
 
        /**
@@ -52,7 +56,7 @@ public class ImageTextControl extends Panel {
         * @return TRUE if it was possible to switch modes
         */
        public boolean switchMode() {
-               if (image == null || !UiColors.getInstance().isUnicode())
+               if (image == null || !Main.isUnicode())
                        return false;
 
                Mode[] modes = Mode.values();
@@ -79,14 +83,14 @@ public class ImageTextControl extends Panel {
        @Override
        public synchronized Panel setSize(TerminalSize size) {
                if (image != null)
-                       image.setSize(size);
+                       image.setSize(new Dimension(size.getColumns(), size.getRows()));
 
                super.setSize(size);
 
                setImage(image);
 
                return this;
-       };
+       }
 
        /**
         * Set/reset the {@link ImageText} to render.