X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTImage.java;h=cd0ce96e0baf4523c64cb45527c01cbc4d1e1443;hb=12b90437b5f22c2ae6e9b9b14c3b62b60f6143e5;hp=d1707074f8951d5d2775b94ada20e650fe9a886e;hpb=b24414225ee8393f43c825453ac7043a5920f6e2;p=fanfix.git diff --git a/src/jexer/TImage.java b/src/jexer/TImage.java index d170707..cd0ce96 100644 --- a/src/jexer/TImage.java +++ b/src/jexer/TImage.java @@ -202,24 +202,12 @@ public class TImage extends TWidget { this.clickAction = clickAction; sizeToImage(true); - - getApplication().addImage(this); } // ------------------------------------------------------------------------ // Event handlers --------------------------------------------------------- // ------------------------------------------------------------------------ - /** - * Subclasses should override this method to cleanup resources. This is - * called by TWindow.onClose(). - */ - @Override - protected void close() { - getApplication().removeImage(this); - super.close(); - } - /** * Handle mouse press events. * @@ -228,7 +216,7 @@ public class TImage extends TWidget { @Override public void onMouseDown(final TMouseEvent mouse) { if (clickAction != null) { - clickAction.DO(); + clickAction.DO(this); return; } } @@ -378,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);