experimental 24-bit image protocol
[nikiroo-utils.git] / examples / JexerImageViewer.java
index b8424a5eb178d8b2d991a34d64af3835e40355b6..4839c238fd212370c82e5ee6005088fc9a274843 100644 (file)
@@ -31,9 +31,6 @@ public class JexerImageViewer extends TApplication {
      * Main entry point.
      */
     public static void main(String [] args) throws Exception {
-        // For this application, we must use ptypipe so that the tile shells
-        // can be aware of their size.
-
         JexerImageViewer app = new JexerImageViewer();
         (new Thread(app)).start();
     }
@@ -109,7 +106,7 @@ class ImageViewerDesktop extends TDesktop {
         setActive(true);
 
         // Add directory treeView
-        treeView = addTreeViewWidget(0, 0, getWidth() / 2, getHeight() - 1,
+        treeView = addTreeViewWidget(0, 0, getWidth() / 2, getHeight(),
             new TAction() {
                 public void DO() {
                     TTreeItem item = treeView.getSelected();
@@ -154,11 +151,6 @@ class ImageViewerDesktop extends TDesktop {
             },
             filters);
 
-        // This appears to be a bug.  If I pass keystrokes to the tree view,
-        // it will center correctly.
-        treeView.onKeypress(new TKeypressEvent(kbDown));
-        treeView.onKeypress(new TKeypressEvent(kbUp));
-
         if (directoryList.getList().size() > 0) {
             activate(directoryList);
             setThumbnail(directoryList.getPath());
@@ -310,12 +302,8 @@ class ImageViewerDesktop extends TDesktop {
         imageWidget = new TImage(this, getWidth() - width,
             getHeight() - height, width, height, image, 0, 0, null);
 
-        // Resize the image down until it can fit within the pane.
-        while ((imageWidget.getRows() > height)
-            || (imageWidget.getColumns() > width)
-        ) {
-            imageWidget.onKeypress(new TKeypressEvent(kbAltDown));
-        }
+        // Resize the image to fit within the pane.
+        imageWidget.setScaleType(TImage.Scale.SCALE);
 
         imageWidget.setActive(false);
         activate(directoryList);