Add 'src/jexer/' from commit 'cf01c92f5809a0732409e280fb0f32f27393618d'
[nikiroo-utils.git] / src / jexer / TImage.java
index c3e75bed0fd3f39ed9aa265a64fdc50e2e69a6bf..cd0ce96e0baf4523c64cb45527c01cbc4d1e1443 100644 (file)
@@ -216,7 +216,7 @@ public class TImage extends TWidget {
     @Override
     public void onMouseDown(final TMouseEvent mouse) {
         if (clickAction != null) {
-            clickAction.DO();
+            clickAction.DO(this);
             return;
         }
     }
@@ -366,25 +366,8 @@ public class TImage extends TWidget {
      * @param always if true, always resize the cells
      */
     private void sizeToImage(final boolean always) {
-        int textWidth = 16;
-        int textHeight = 20;
-
-        if (getScreen() instanceof SwingTerminal) {
-            SwingTerminal terminal = (SwingTerminal) getScreen();
-
-            textWidth = terminal.getTextWidth();
-            textHeight = terminal.getTextHeight();
-        } if (getScreen() instanceof MultiScreen) {
-            MultiScreen terminal = (MultiScreen) getScreen();
-
-            textWidth = terminal.getTextWidth();
-            textHeight = terminal.getTextHeight();
-        } else if (getScreen() instanceof ECMA48Terminal) {
-            ECMA48Terminal terminal = (ECMA48Terminal) getScreen();
-
-            textWidth = terminal.getTextWidth();
-            textHeight = terminal.getTextHeight();
-        }
+        int textWidth = getScreen().getTextWidth();
+        int textHeight = getScreen().getTextHeight();
 
         if (image == null) {
             image = rotateImage(originalImage, clockwise);