Revision: 4873
          http://sourceforge.net/p/vexi/code/4873
Author:   mkpg2
Date:     2016-07-15 01:16:46 +0000 (Fri, 15 Jul 2016)
Log Message:
-----------
Remove obselete/never used platform implementations.
- Only supporting Java 7 in anycase (or at very least java 1.4).
Added build version generation (previously always reporting unknown).

Modified Paths:
--------------
    branches/vexi3/org.vexi-core.main/meta/module-build.xml
    branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Platform.java
    branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Swing.java

Removed Paths:
-------------
    branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/AWT.java
    branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Java2.java

Modified: branches/vexi3/org.vexi-core.main/meta/module-build.xml
===================================================================
--- branches/vexi3/org.vexi-core.main/meta/module-build.xml     2016-06-28 
16:46:33 UTC (rev 4872)
+++ branches/vexi3/org.vexi-core.main/meta/module-build.xml     2016-07-15 
01:16:46 UTC (rev 4873)
@@ -4,6 +4,7 @@
        <builders>
                <builder source="local"      name="build.jpp"     
branch="trunk"  />
                <builder source="local"      name="build.jencode" 
branch="trunk"  />
+               <builder source="ebuild"     name="build.java.versionclass"  />
                <builder refid="javac">
                    <property key="source.javaversion" value="1.6"/>
                </builder>

Deleted: branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/AWT.java
===================================================================
--- branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/AWT.java      
2016-06-28 16:46:33 UTC (rev 4872)
+++ branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/AWT.java      
2016-07-15 01:16:46 UTC (rev 4873)
@@ -1,572 +0,0 @@
-// Copyright 2000-2008 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.vexi.plat;
-
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.Toolkit;
-import java.awt.Window;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseWheelEvent;
-import java.awt.event.MouseWheelListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.awt.im.InputMethodRequests;
-
-import javax.swing.ImageIcon;
-
-import org.ibex.util.Callable;
-import org.vexi.core.Box;
-import org.vexi.core.Main;
-import org.vexi.core.Surface;
-import org.vexi.graphics.Picture;
-import org.vexi.graphics.PixelBuffer;
-import org.vexi.util.Log;
-
-/** Platform subclass for all VM's providing AWT 1.4 functionality */
-public class AWT extends AWTBase {
-
-    protected String getDescriptiveName() {
-        return "Generic JDK 1.2+ with AWT";
-    }
-
-    //////// Platform Implementation //////////////////////////////////
-
-    protected Surface _createSurface(Box b, boolean framed) { return new 
AWTSurface(b, framed); }
-
-    protected static class AWTSurface extends Surface.DoubleBufferedSurface
-        implements MouseListener, MouseMotionListener, MouseWheelListener, 
KeyListener, ComponentListener, WindowListener {
-        
-        public Picture toPicture() { return new 
AWTPicture(((AWTPixelBuffer)backbuffer).i); }
-
-        /** synchronized as otherwise it is possible to blit before images 
have been rendered to the backbuffer */
-        public synchronized void blit(PixelBuffer s, int sx, int sy, int dx, 
int dy, int dx2, int dy2) {
-            discoverInsets();
-            try {
-                window.getGraphics().drawImage(((AWTPixelBuffer)s).i,
-                                  dx + leftInset, dy + topInset,     // 
destination topleft corner
-                                  dx2 + leftInset, dy2 + topInset,   // 
destination bottomright corner
-                                  sx, sy,                            // source 
topleft corner
-                                  sx + (dx2 - dx), sy + (dy2 - dy),  // source 
bottomright corner
-                                  null);
-            } catch (NullPointerException npe) { /* FIXME: handle this 
gracefully */ }
-        }
-        
-        /** if (component instanceof Frame) then frame == window else frame == 
null */
-        Frame frame = null;
-        Window window = null;
-        
-        /** our component's insets */
-        //protected Insets insets = new Insets(0, 0, 0, 0);
-        
-        /** some JDKs let us recycle a single Dimension object when calling 
getSize() */
-        Dimension singleSize = new Dimension();
-        
-        public void _toBack() { if (window != null) window.toBack(); }
-        public void _toFront() {
-            // window.toFront() does not work well
-            //if (window != null) window.toFront();
-            if (window != null) { window.setVisible(false); 
window.setVisible(true); }
-        }
-        public void _requestFocus() { if (window != null) 
window.requestFocus(); }
-        public void _setLocation(int x, int y) { if (window != null) 
window.setLocation(x, y); }
-        public void _setTitleBarText(String s) { if (frame != null) 
frame.setTitle(s); }
-        public void setInvisible(boolean b) { window.setVisible(!b); }
-        public void _setIcon(final Picture i) { 
-            if (frame == null) {
-                return;
-            }
-            if (i==null) {
-                frame.setIconImage(new ImageIcon(Surface.vexiIcon).getImage());
-            } else {
-                if (i.isLoaded) {
-                    // must init() otherwise ((AWTPicture)i).i is null
-                    ((AWTPicture)i).init();
-                    frame.setIconImage(((AWTPicture)i).i);
-                } else {
-                    Main.SCHEDULER.add(new Callable() {
-                        public Object run(Object o) throws Exception {
-                            if (i.isLoaded) {
-                                // must init() otherwise ((AWTPicture)i).i is 
null
-                                ((AWTPicture)i).init();
-                                frame.setIconImage(((AWTPicture)i).i);
-                            } else {
-                                Main.SCHEDULER.add(this);
-                            }
-                            return null;
-                        }
-                    });
-                }
-            }
-        }
-        public void _setSize(int width, int height) {
-            discoverInsets();
-            window.setSize(width + (leftInset + rightInset), height + 
(topInset + bottomInset));
-        }
-        public void _setMinimized(boolean b) {
-            Log.warn(this, "JDK 1.1 platforms cannot minimize or unminimize 
windows");
-        }
-        public void _setMaximized(boolean b) {
-            if (!b) {
-                Log.warn(this, "JDK 1.1 platforms cannot unmaximize windows");
-                return;
-            }
-            window.setLocation(new Point(0, 0));
-            window.setSize(Toolkit.getDefaultToolkit().getScreenSize());
-        }
-
-        class InnerFrame extends Frame {
-            public InnerFrame() throws java.lang.UnsupportedOperationException 
{ }
-            /** overrides the native Frame method to enforce a minimum size */
-            private Dimension minimumSize = new Dimension(0, 0);
-            public void setMinimumDimensions(int w, int h) { minimumSize = new 
Dimension(w, h); }
-            public Dimension getMinimumSize() { return minimumSize; }
-            
-            public java.awt.event.ComponentAdapter enforceMinSize = new 
java.awt.event.ComponentAdapter() {
-                public void componentResized(ComponentEvent event) {
-                    Dimension newDim = frame.getSize();
-                    if (newDim.height < minimumSize.height + topInset + 
bottomInset) {
-                        newDim.height = minimumSize.height + topInset + 
bottomInset;
-                    }
-                    if (newDim.width < minimumSize.width + leftInset + 
rightInset) {
-                        newDim.width = minimumSize.width + leftInset + 
rightInset;
-                    }
-                    frame.setSize(newDim);
-                    blit(backbuffer, leftInset, topInset, leftInset, topInset, 
root.width + leftInset, root.height + topInset);
-//                    frame.repaint();
-                }
-            };
-            
-            public void update(Graphics gr) { paint(gr); }
-            public void paint(Graphics gr) {
-                Rectangle r = gr.getClipBounds();
-
-                // ugly hack for Java1.4 dynamicLayout on Win32 -- this 
catches expansions during smooth resize
-                int newwidth = Math.max(r.x - leftInset + r.width, root.width);
-                int newheight = Math.max(r.y - topInset + r.height, 
root.height);
-                if (newwidth > root.width || newheight > root.height) {
-                    int w = window.getWidth() - leftInset - rightInset;
-                    int h = window.getHeight() - topInset - bottomInset;
-                    AWTSurface.this.componentResized(w, h);
-                }
-                
-                refreshFromBackbuffer(r.x - leftInset, r.y - topInset, 
r.width, r.height);
-            }
-            public InputMethodRequests getInputMethodRequests() {
-                // REMARK - makes us a passive client FOOTNOTE1
-                return null;
-            }
-        }
-
-        class InnerWindow extends Window {
-            public InnerWindow() throws 
java.lang.UnsupportedOperationException {
-                super(new Frame());
-            }
-            /** overrides the native Window method to enforce a minimum size */
-            private Dimension minimumSize = new Dimension(0, 0);
-            public void setMinimumDimensions(int w, int h) { minimumSize = new 
Dimension(w, h); }
-            public Dimension getMinimumSize() { return minimumSize; }
-            public void update(Graphics gr) { paint(gr); }
-            public void paint(Graphics gr) {
-                Rectangle r = gr.getClipBounds();
-                refreshFromBackbuffer(r.x - leftInset, r.y - topInset, 
r.width, r.height);
-            }
-            public InputMethodRequests getInputMethodRequests() {
-                // REMARK - makes us a passive client FOOTNOTE1
-                return null;
-            }
-        }
-
-        /** establish the size of the frame decorations */
-        private void discoverInsets() {
-            Insets i = window.getInsets();
-            if (leftInset == i.left && topInset == i.top && bottomInset == 
i.bottom && rightInset == i.right) {
-                return;
-            }
-            leftInset = i.left;
-            topInset = i.top;
-            bottomInset = i.bottom;
-            rightInset = i.right;
-            // respect the size of the root box
-            window.setSize(pendingWidth + (leftInset + rightInset), 
pendingHeight + (topInset + bottomInset));
-        }
-        
-        /** sets the maximum size of the frame */
-        public void _setMaximumSize(int maxw, int maxh) {
-            
-        }
-
-        /** note that the minimum size is handled by getMinimumSize in 
InnerFrame/InnerWindow */
-        public void _setMinimumSize(int minw, int minh) {
-            if (frame != null) {
-                ((InnerFrame)frame).setMinimumDimensions(minw, minh);
-            } else if (window != null) {
-                ((InnerWindow)window).setMinimumDimensions(minw, minh);
-            }
-            // FEATURE: Java 1.5
-            //window.setMinimumSize(new 
Dimension(root.minwidth+leftInset+rightInset, 
root.minheight+topInset+bottomInset));
-        }
-        
-        /** set whether a frame can be resized by the user */
-        public void _setResizable(boolean resizable) {
-            if (frame != null) {
-                frame.setResizable(resizable);
-                if (!resizable) {
-                    Dimension min = frame.getMinimumSize();
-                    frame.setSize(min.width, min.height);
-                }
-            }
-        }
-
-        private int rootfill = 0x0;
-        private Color rootcolor = null;
-        private final void setBackgroundColor() {
-            rootfill = root.getIntFillcolor();
-            rootcolor = org.vexi.graphics.Color.intToColor(rootfill);
-            window.setBackground(rootcolor);
-        }
-
-        // FIXME: this hack is to cover up a race condition whereby the 
backbuffer
-        // and the window image get somehow out of sync under 
tough-to-reproduce
-        // circumstances i.e. fairly complex applications.  The backbuffer is 
valid,
-        // it is actually correctly (briefly) painted to the window before the
-        // _previous_ state of the backbuffer is then painted back over it (!!)
-        // because asynchronous blits seem to occur first-in last-out - that 
is,
-        // blit from render is called after a refresh, but refresh happens 
last.
-        private boolean blithack = true;
-        
-        public RenderedRegions render() {
-            // useful optimisation;
-            if (rootfill != root.getIntFillcolor()) {
-                setBackgroundColor();
-            }
-            // REMARK: it is entirely possible that our initial estimation
-            // for the maximum window size is exceeded, so here we check for
-            // this condition and resize the backbuffer as necessary - and
-            // only do so during render to avoid rapid repeats during resize
-            AWTPixelBuffer buf = (AWTPixelBuffer)backbuffer;
-            if (buf.getWidth() < pendingWidth || buf.getHeight() < 
pendingHeight) {
-               int h = buf.getWidth() < pendingWidth ? pendingWidth : 
buf.getWidth();
-               int w = buf.getHeight() < pendingHeight ? pendingHeight : 
buf.getHeight();
-               AWTPixelBuffer new_backbuffer = 
(AWTPixelBuffer)Platform.createPixelBuffer(w, h, this);
-               new_backbuffer.i.getGraphics().drawImage(buf.i, 0, 0, null);
-               backbuffer = new_backbuffer;
-               // dirty() is implicit due to SizeChange
-               //dirty();
-            }
-            buf.initGraphics();
-            RenderedRegions r = super.render();
-            buf.cleanupGraphics();
-            if (r==null) {
-                if (blithack) {
-                    blithack = false;
-                    blit(backbuffer, 0, 0, 0, 0, root.width, root.height);
-                }
-                return null;
-            }
-            blithack = true;
-            return r;
-        }
-
-        AWTSurface(Box root, boolean framed) {
-            super(root);
-            
-            try {
-                if (!framed) {
-                    window = new InnerWindow();
-                } else {
-                    window = frame = new InnerFrame();
-                    // ensures user cannot resize frame to be smaller than 
contents
-                    // FIXME: this does not work on Linux
-                    
frame.addComponentListener(((InnerFrame)frame).enforceMinSize);
-                }
-            } catch (java.lang.UnsupportedOperationException e) {
-                // this is here to catch HeadlessException on jdk1.4
-                Log.system.error(this, "Exception thrown creating Surface 
"+(framed?"frame":"window"));
-                Log.system.error(this, e);
-            }
-            
-            // Theoretically pack causes the insets to be calculated.
-            //
-            // AWT Bug - (Linux X11 at least)
-            // The insets calculated are not always exact. It seems 
-            // that only a guess is returned.
-            window.pack();
-            
-            // initialise the backbuffer and window with the root colour
-            // REMARK - this is for nicer initial rendering
-            setBackgroundColor();
-            AWTPixelBuffer buf = (AWTPixelBuffer)backbuffer;
-            Graphics g = buf.i.getGraphics();
-            g.setColor(rootcolor);
-            g.fillRect(0, 0, pendingWidth, pendingHeight);
-            g.dispose();
-
-            window.addMouseListener(this);
-            window.addKeyListener(this);
-            window.addComponentListener(this);
-            window.addMouseMotionListener(this);
-            window.addMouseWheelListener(this);
-            window.addWindowListener(this);
-            // workaround for an OS X limitation
-            try {
-                window.getInputContext().setCompositionEnabled(false);
-            } catch (UnsupportedOperationException e) {
-                Log.system.warn(this, "setCompositionEnabled() failed. Are you 
running OS X?");
-            }
-        }
-
-        // IMPORTANT: makeVisible must be called before render()
-        // to ensure that our peer has been created
-        public void _makeVisible(boolean b) {
-            window.setVisible(b);
-            // respect a frame's requested maximized state
-            // NB must be called after setVisible(true)
-            if (b && frame!=null) {
-                frame.setExtendedState(maximized ? Frame.MAXIMIZED_BOTH : 
Frame.NORMAL);
-            }
-        }
-        
-        public void _dispose() {
-            window.removeMouseListener(this);
-            window.removeMouseWheelListener(this);
-            window.removeKeyListener(this); // previously removed to work 
around a jdk1.3 bug
-            window.removeComponentListener(this);
-            window.removeMouseMotionListener(this);
-            window.removeWindowListener(this);
-            window.dispose();
-        }
-
-        public void _updateCursor(String cursor) {
-            if (cursor.equals("crosshair")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
-            else if (cursor.equals("east")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
-            else if (cursor.equals("move")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
-            else if (cursor.equals("north")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
-            else if (cursor.equals("northeast")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
-            else if (cursor.equals("northwest")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR));
-            else if (cursor.equals("south")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
-            else if (cursor.equals("southeast")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
-            else if (cursor.equals("southwest")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR));
-            else if (cursor.equals("text")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
-            else if (cursor.equals("west")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
-            else if (cursor.equals("wait")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-            else if (cursor.equals("hand")) 
window.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-            else 
window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-        }
-        
-        // AWT Message translation 
////////////////////////////////////////////////////////////////
-        
-        // these functions are all executed in the AWT thread, not the
-        // MessageQueue thread. As a result, they must be *extremely*
-        // careful about invoking methods on instances of Box. Currently,
-        // they should only enqueue messages, use Box.whoIs()
-        // (unsynchronised but thought to be safe), and modify members of
-        // Surface.
-        
-        public void componentHidden(ComponentEvent e) { }
-        public void componentShown(ComponentEvent e) { }
-        public void windowOpened(WindowEvent e) { }
-        public void windowClosed(WindowEvent e) { }
-        public void windowClosing(WindowEvent e) { Close(); }
-        public void windowIconified(WindowEvent e) { Minimized(true); }
-        public void windowDeiconified(WindowEvent e) { window.repaint(0, 0, 
root.width, root.height); Minimized(false); }
-        public void windowActivated(WindowEvent e) { Focused(true); }
-        public void windowDeactivated(WindowEvent e) { Focused(false); }
-        public void componentMoved(ComponentEvent e) { 
PosChange(window.getLocation().x, window.getLocation().y); }
-
-        public void componentResized(ComponentEvent e) {
-            // Insets first known exactly on first componentResized event
-            // Before being set visible (AWT on top of XWindows at least) 
-            // after pack it seems AWT guesses what the insets will be
-            // Take every time in case they change(?!)
-            discoverInsets();
-            componentResized(window.getWidth() - leftInset - rightInset, 
window.getHeight() - topInset - bottomInset);
-        }
-
-        /** frame/window resize notification with newwidth and newheight
-         *  in relation to the backbuffer i.e. insets already subtracted
-         **/
-        public void componentResized(int newwidth, int newheight) {
-            // First we fill the expanded part of the buffer before
-            // an old (dirty) copy of that buffer part gets painted
-            // REMARK - synchronized so we won't fill during render
-            synchronized (this) {
-                discoverInsets();
-                AWTPixelBuffer buf = (AWTPixelBuffer)backbuffer;
-                //int rootfill = root.getIntFillcolor();
-                Graphics g = buf.i.getGraphics();
-                g.setColor(new java.awt.Color((rootfill >> 16) & 0xff,
-                        (rootfill >> 8) & 0xff,
-                        (rootfill) & 0xff));
-                if (pendingWidth < newwidth) {
-                    //  ______
-                    // |    | |
-                    // |    | |
-                    // '----'-'
-                    g.fillRect(pendingWidth, 0, newwidth, newheight);
-                }
-                if (pendingHeight < newheight) {
-                    //  ______
-                    // |      |
-                    // |______|
-                    // '------'
-                    g.fillRect(0, pendingHeight, newwidth, newheight);
-                }
-                g.dispose();
-                SizeChange(newwidth, newheight);
-            }
-        }
-        
-        private void checkEvent(InputEvent e) {
-            alt = e.isAltDown();
-            control = e.isControlDown();
-            shift = e.isShiftDown();
-        }
-
-        public void keyTyped(KeyEvent k) {
-            // REMARK - we are a so called 'passive Input Method' client.
-            // We receive composed text (e.g. Asian characters) as key events
-            // where we want to convert them into a KeyPressed/KeyReleased
-            // Vexi event. Unfortunately we need a way to distinguish between 
-            // events due to inputMethods (which we want) and those from the
-            // keyboard which are already handled via keyPressed/keyReleased.
-            // HACK - simplest is to just except non-ascii chars.
-            int unicode = (int)k.getKeyChar();
-            if (255 >= unicode) {
-                return;
-            }
-            checkEvent(k); 
-            KeyPressed(""+k.getKeyChar());
-            KeyReleased(""+k.getKeyChar());
-        }
-        public void keyPressed(KeyEvent k) { checkEvent(k); 
KeyPressed(translateKey(k)); }
-        public void keyReleased(KeyEvent k) { checkEvent(k); 
KeyReleased(translateKey(k)); }
-        public void mouseExited(MouseEvent m) { mouseMoved(m); }
-        public void mouseEntered(MouseEvent m) { mouseMoved(m); }
-        public void mouseDragged(MouseEvent m) { mouseMoved(m); }
-        public void mouseMoved(MouseEvent m) {
-            checkEvent(m);
-
-            // ugly hack for Java1.4 dynamicLayout on Win32 -- this catches 
contractions during smooth resize
-            int newwidth = window.getWidth() - leftInset - rightInset;
-            int newheight = window.getHeight() - topInset - bottomInset;
-            if (newwidth != root.width || newheight != root.height) {
-                componentResized(newwidth, newheight);
-            }
-            
-            Move(m.getX() - leftInset, m.getY() - topInset);
-        }
-        public void mousePressed(MouseEvent m) { checkEvent(m); 
Press(modifiersToButtonNumber(m.getModifiers())); }
-        public void mouseReleased(MouseEvent m) { checkEvent(m); 
Release(modifiersToButtonNumber(m.getModifiers())); }
-        public void mouseClicked(MouseEvent m) {
-            checkEvent(m);
-            if (m.getClickCount() == 2) {
-                DoubleClick(modifiersToButtonNumber(m.getModifiers()));
-            } else {
-                Click(modifiersToButtonNumber(m.getModifiers()));
-            }
-        }
-        public void mouseWheelMoved(MouseWheelEvent e) {
-            checkEvent(e);
-            int notches = e.getWheelRotation();
-            // FIXME: take into account WHEEL_BLOCK_SCROLL / WHEEL_UNIT_SCROLL
-            VScroll(notches);
-        }
-        public boolean _isLockingKeyOn(int key) {
-            // AWT's support for getLockingKeyState is minimal at best and
-            // more often than not throws an UnsupportedOperationException
-            int eventkeyid = -1;
-            switch (key) {
-            case Surface.CAPS_LOCK: eventkeyid = KeyEvent.VK_CAPS_LOCK; break;
-            case Surface.KANA_LOCK: eventkeyid = KeyEvent.VK_KANA_LOCK; break;
-            case Surface.NUM_LOCK: eventkeyid = KeyEvent.VK_NUM_LOCK; break;
-            case Surface.SCROLL_LOCK: eventkeyid = KeyEvent.VK_SCROLL_LOCK; 
break;
-            }
-            if (eventkeyid == -1) {
-                return false;
-            }
-            return window.getToolkit().getLockingKeyState(eventkeyid);
-        }
-        
-        String translateKey(KeyEvent k) {
-            switch (k.getKeyCode()) {
-            case KeyEvent.VK_ALT: return "alt";
-            case KeyEvent.VK_BACK_SPACE: return "back_space";
-            case KeyEvent.VK_CONTROL: return "control";
-            case KeyEvent.VK_DELETE: return "delete";
-            case KeyEvent.VK_DOWN: return "down";
-            case KeyEvent.VK_END: return "end";
-            case KeyEvent.VK_ENTER: return "enter";
-            case KeyEvent.VK_ESCAPE: return "escape";
-            case KeyEvent.VK_F1: return "f1";
-            case KeyEvent.VK_F10: return "f10";
-            case KeyEvent.VK_F11: return "f11";
-            case KeyEvent.VK_F12: return "f12";
-            case KeyEvent.VK_F2: return "f2";
-            case KeyEvent.VK_F3: return "f3";
-            case KeyEvent.VK_F4: return "f4";
-            case KeyEvent.VK_F5: return "f5";
-            case KeyEvent.VK_F6: return "f6"; 
-            case KeyEvent.VK_F7: return "f7";
-            case KeyEvent.VK_F8: return "f8";
-            case KeyEvent.VK_F9: return "f9";
-            case KeyEvent.VK_HOME: return "home";
-            case KeyEvent.VK_INSERT: return "insert";
-            case KeyEvent.VK_LEFT: return "left";
-            case KeyEvent.VK_META: return "alt";
-            case KeyEvent.VK_PAGE_DOWN: return "page_down";
-            case KeyEvent.VK_PAGE_UP: return "page_up";
-            case KeyEvent.VK_PAUSE: return "pause";
-            case KeyEvent.VK_PRINTSCREEN: return "printscreen";
-            case KeyEvent.VK_RIGHT: return "right";
-            case KeyEvent.VK_SHIFT: return "shift";
-            case KeyEvent.VK_TAB: return "tab";
-            case KeyEvent.VK_UP: return "up";
-            case KeyEvent.VK_CAPS_LOCK: return "caps_lock";
-            case KeyEvent.VK_KANA_LOCK: return "kana_lock";
-            case KeyEvent.VK_NUM_LOCK: return "num_lock";
-            case KeyEvent.VK_SCROLL_LOCK: return "scroll_lock";
-            case KeyEvent.VK_UNDEFINED: return "unknown";
-            // VK_ entries not defined for Java 1.4
-            case 524: return "windows_key";
-            case 525: return "context_menu";
-            // usually only single / known characters
-            default:
-                char c = k.getKeyChar();
-                if (c >= 1 && c <= 26) {
-                    c = (char)('a' + c - 1);
-                }
-                // WORKAROUND shift+ctrl+6 (i.e. C-^) returning empty character
-                if (k.getKeyCode() == 54 && k.isControlDown() && 
k.isShiftDown()) {
-                    c = '^';
-                }
-                //System.out.println(c+": "+k.getKeyCode());
-                return String.valueOf(c);
-            }
-        }
-    }
-}
-/* FOOTNOTES
- * 1. Passive InputMethod Client - means: we only handle committed text. 
- * 
- * The alternative to be an 'Active InputMethod Client' would mean we have 
- * in place composition, this presents quite a lot of complexity. We would 
need to 
- * interface with the text widgets and get it to render uncommitted text, move 
the
- * caret ... etc.
- * 
- */

Deleted: 
branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Java2.java
===================================================================
--- branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Java2.java    
2016-06-28 16:46:33 UTC (rev 4872)
+++ branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Java2.java    
2016-07-15 01:16:46 UTC (rev 4873)
@@ -1,296 +0,0 @@
-// Copyright 2000-2008 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.vexi.plat;
-
-import java.awt.AlphaComposite;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Frame;
-import java.awt.Graphics2D;
-import java.awt.Point;
-import java.awt.Toolkit;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseWheelEvent;
-import java.awt.event.MouseWheelListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowStateListener;
-import java.awt.image.BufferedImage;
-import java.awt.image.ColorModel;
-import java.awt.image.DataBuffer;
-import java.awt.image.DataBufferByte;
-import java.awt.image.DataBufferInt;
-import java.awt.image.DataBufferUShort;
-import java.awt.image.Raster;
-import java.awt.image.SampleModel;
-import java.awt.image.WritableRaster;
-import java.io.File;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-
-import org.ibex.js.Fountain;
-import org.ibex.js.JS;
-import org.ibex.js.JSExn;
-import org.ibex.js.JSU;
-import org.vexi.core.Box;
-import org.vexi.core.Surface;
-import org.vexi.graphics.Font;
-import org.vexi.graphics.PixelBuffer;
-import org.vexi.util.Log;
-
-/** Platform class for most reasonable Java1.2+ Java2s */
-public class Java2 extends AWT {
-    {
-        Platform.systemfonts = new JS.Immutable() {
-            File dir = null;
-            {
-                String osname = System.getProperty("os.name");
-                Log.info(Java2.class, osname);
-                if (osname.indexOf("Windows")!=-1) {
-                    dir = new File("c:/Windows/Fonts");
-                }
-            }
-            public JS get(JS key) throws JSExn {
-                if (dir!=null) {
-                    String s = JSU.toString(key);
-                    File f = new File(dir, s + ".ttf");
-                    if (f.exists()) {
-                        return new Fountain.File(f.getPath());
-                    }
-                    f = new File(dir, s + ".ttc");
-                    if (f.exists()) {
-                        return new Fountain.File(f.getPath());
-                    }
-                }
-                return super.get(key);
-            }
-        };
-    }
-
-    private boolean isJava14 = false;
-
-    public Java2() {
-        // disable the focus manager so we can intercept the tab key
-        String versionString = System.getProperty("java.version", "");
-        int secondDecimal = versionString.substring(versionString.indexOf('.') 
+ 1).indexOf('.');
-        if (secondDecimal != -1) {
-            versionString = versionString.substring(0, 
versionString.indexOf('.') + 1 + secondDecimal);
-        }
-        double version = Double.parseDouble(versionString);
-        if (version >= 1.4) {
-            isJava14 = true;
-            try {
-                Toolkit t = java.awt.Toolkit.getDefaultToolkit();
-                Method m = 
java.awt.Toolkit.class.getMethod("setDynamicLayout", new Class[] { Boolean.TYPE 
});
-                m.invoke(t, new Object[] { Boolean.TRUE });
-            } catch (Exception e) {
-                Log.system.warn(this, "Exception while trying to enable AWT 
Dynamic Layout");
-                Log.system.warn(this, e);
-            }
-        }
-        javax.swing.FocusManager.setCurrentManager(new 
javax.swing.FocusManager() {
-                public void processKeyEvent(Component focusedComponent, 
KeyEvent anEvent) { }
-                public void focusPreviousComponent(Component aComponent) { }
-                public void focusNextComponent(Component aComponent) { }
-            });
-    }
-
-    protected PixelBuffer _createPixelBuffer(int w, int h, Surface owner) { 
return new Java2PixelBuffer(w, h); }
-    protected Surface _createSurface(final Box root, final boolean framed) {
-        return (Surface)java.security.AccessController.doPrivileged(new 
java.security.PrivilegedAction() {
-                public Object run() {
-                    if (isJava14) {
-                        try {
-                            // weaken the binding here to avoid link errors on 
1.3.x
-                            Class java14SurfaceClass = 
Class.forName(Java2.class.getName() + "$Java14Surface");
-                            Constructor ctor = 
java14SurfaceClass.getConstructor(new Class[] { Box.class, Boolean.TYPE });
-                            return ctor.newInstance(new Object[] { root, 
Boolean.valueOf(framed) });
-                        } catch (Exception e) {
-                            Log.system.error(this, e);
-                            throw new LinkageError("error: " + e);
-                        }
-                    }
-                    // else
-                    return new Java2Surface(root, framed);
-                }
-            });
-    }
-
-    // Inner Classes 
//////////////////////////////////////////////////////////////////
-
-    private static Cursor invisibleCursor =
-        Toolkit.getDefaultToolkit().createCustomCursor(new BufferedImage(2, 2, 
BufferedImage.TYPE_INT_ARGB),
-                                                       new Point(1, 1), 
"invisible");
-
-    protected static class Java2Surface extends AWTSurface {
-
-        public Java2Surface(Box root, boolean framed) { super(root, framed); }
-
-        public void _setMinimized(boolean b) {
-            if (frame == null) {
-                Log.info(this, "JDK 1.2 can only minimize frames, not 
windows");
-            } else if (b) {
-                frame.setState(java.awt.Frame.ICONIFIED);
-            } else {
-                frame.setState(java.awt.Frame.NORMAL);
-            }
-        }
-
-        public void _updateMouseCursor() {
-            if (getCursor().equals("invisible")) {
-                window.setCursor(invisibleCursor);
-            } else {
-                super._updateCursor("default");
-            }
-        }
-    }
-
-    protected static class Java14Surface extends Java2Surface implements 
WindowStateListener, MouseWheelListener {
-        public Java14Surface(Box root, boolean framed) {
-            super(root, framed);
-            // JDK1.4 doesn't like java.lang.Window's...
-            // Is this dead code? TODO - verify that 
-            // (!framed && window instance Frame) can ever be true
-            try {
-                if (!framed && window instanceof Frame) {
-                    ((Frame)window).setUndecorated(true);
-                }
-            } catch(Exception e){
-                Log.system.warn(Java2.class, e);
-            }
-            window.addWindowStateListener(this);
-            window.addMouseWheelListener(this);
-        }
-
-        public void _makeVisible(boolean b) { window.setVisible(b); }
-        
-        public void _setMaximized(boolean m) {
-            if (frame == null) {
-                Log.warn(this, "JDK 1.4 can only maximize frames, not 
windows");
-                return;
-            }
-            frame.setExtendedState(m ? Frame.MAXIMIZED_BOTH : (minimized ? 
Frame.ICONIFIED : Frame.NORMAL));
-        }
-        public void _setMinimized(boolean m) {
-            if (frame == null) {
-                Log.warn(this, "JDK 1.4 can only minimize frames, not 
windows");
-                return;
-            }
-            frame.setExtendedState(m ? Frame.ICONIFIED : (maximized ? 
Frame.MAXIMIZED_BOTH : Frame.NORMAL));
-        }
-        public void windowStateChanged(WindowEvent e) {
-            if (e.getOldState() != e.getNewState()) {
-                if ((e.getNewState() & Frame.MAXIMIZED_BOTH) != 0) {
-                    Maximized(true);
-                } else if (((e.getOldState() & Frame.MAXIMIZED_BOTH) != 0) && 
(e.getNewState() & Frame.MAXIMIZED_BOTH) == 0) {
-                    Maximized(false);
-                }
-            }
-        }
-
-        public void mouseWheelMoved(MouseWheelEvent m) {
-            if (m.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
-                VScroll(m.getUnitsToScroll());
-            }
-        }
-    }
-    
-    /** Allow for caching the buffered images to optimise repeated creations */
-    protected Font.Glyph _createGlyph(Font f, char c) { return new 
Java2Glyph(f, c); }
-    protected static class Java2Glyph extends AWTGlyph {
-        private BufferedImage i2 = null;
-        int lastcolor = 0;
-        Graphics2D g = null;
-        public Java2Glyph(Font f, char c) { super(f, c); }
-        BufferedImage getBufferedImage() {
-            if (i2 == null) {
-                i2 = new BufferedImage(width, height, 
BufferedImage.TYPE_INT_ARGB);
-            }
-            return i2;
-        }
-    }
-
-    protected static class Java2PixelBuffer extends AWTPixelBuffer {
-        private static ColorModel cm = 
Toolkit.getDefaultToolkit().getColorModel();
-        private static Hashtable emptyHashtable = new Hashtable();
-        private static short[] sbank = null;
-        private static int[] ibank = null;
-        private static byte[] bbank = null;
-        private static int bank_start = 0;
-        private WritableRaster raster = null;
-        private SampleModel sm = null;
-        private DataBuffer buf = null;
-
-        public void drawGlyph(org.vexi.graphics.Font.Glyph glyph, int dx, int 
dy, int cx1, int cy1, int cx2, int cy2, int argb) {
-            if (glyph.width == 0 || glyph.height == 0 || argb == 0) {
-                return;
-            }
-            int w = cx2 - cx1;
-            int h = cy2 - cy1;
-            Java2Glyph j2g = ((Java2Glyph)glyph);
-            BufferedImage g = j2g.getBufferedImage();
-            if (j2g.lastcolor!=argb) {
-                j2g.lastcolor = argb;
-                Graphics2D src = (Graphics2D)g.getGraphics();
-                src.setClip(0, 0, glyph.width, glyph.height);
-                src.setComposite(AlphaComposite.Src);
-                src.setColor(new Color((argb & 0x00ff0000) >> 16, (argb & 
0x0000ff00) >> 8, argb & 0x000000ff, (argb >> 24) & 0x000000ff));
-                src.drawImage(j2g.getImage(), 0, 0, null);
-                src.setComposite(AlphaComposite.SrcIn);
-                src.fillRect(0, 0, glyph.width, glyph.height);
-            }
-            Graphics2D dst = (Graphics2D)i.getGraphics();
-            dst.setClip(cx1, cy1, w, h);
-            dst.setComposite(AlphaComposite.SrcOver);
-            dst.drawImage(g, dx, dy, null);
-            dst.setClip(0, 0, i.getWidth(null), i.getHeight(null));
-        }
-
-        public Java2PixelBuffer(int w, int h) {
-            sm = cm.createCompatibleSampleModel(w, h);
-            int numSamples = w * h * sm.getNumDataElements();
-            if (sm.getDataType() == DataBuffer.TYPE_USHORT) {
-                if (sbank == null || numSamples > 512 * 512 / 3) {
-                    buf = new DataBufferUShort(numSamples);
-                } else {
-                    if (numSamples > sbank.length - bank_start) {
-                        bank_start = 0;
-                        sbank = new short[512 * 512];
-                    }
-                    buf = new DataBufferUShort(sbank, numSamples, bank_start);
-                    bank_start += numSamples;
-                }
-            } else if (sm.getDataType() == DataBuffer.TYPE_BYTE) {
-                if (bbank == null || numSamples > 512 * 512 / 3) {
-                    buf = new DataBufferByte(numSamples);
-                } else {
-                    if (numSamples > bbank.length - bank_start) {
-                        bank_start = 0;
-                        bbank = new byte[512 * 512];
-                    }
-                    buf = new DataBufferByte(bbank, numSamples, bank_start);
-                    bank_start += numSamples;
-                }
-            } else if (sm.getDataType() == DataBuffer.TYPE_INT) {
-                if (ibank == null || numSamples > 512 * 512 / 3) {
-                    buf = new DataBufferInt(numSamples);
-                } else {
-                    if (numSamples > ibank.length - bank_start) {
-                        bank_start = 0;
-                        ibank = new int[512 * 512];
-                    }
-                    buf = new DataBufferInt(ibank, numSamples, bank_start);
-                    bank_start += numSamples;
-                }
-            }
-            raster = Raster.createWritableRaster(sm, buf, null);
-            i = new BufferedImage(cm, raster, false,  emptyHashtable);
-        }
-    }
-
-    protected String getDescriptiveName() { return isJava14 ? "Java 1.4+ JVM" 
: "Java 1.2+ JVM"; }
-
-}

Modified: 
branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Platform.java
===================================================================
--- branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Platform.java 
2016-06-28 16:46:33 UTC (rev 4872)
+++ branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Platform.java 
2016-07-15 01:16:46 UTC (rev 4873)
@@ -18,6 +18,7 @@
 import org.vexi.core.Box;
 import org.vexi.core.Constants;
 import org.vexi.core.Surface;
+import org.vexi.core.main.ModuleVersion;
 import org.vexi.graphics.Font;
 import org.vexi.graphics.Picture;
 import org.vexi.graphics.PixelBuffer;
@@ -57,53 +58,20 @@
             String version = System.getProperty("java.version", "");
             String os_name = System.getProperty("os.name", "");
             String os_version = System.getProperty("os.version", "");
-            String platform_class = null;
             
-            boolean hasJOGL = false;
-            try {
-                Class.forName("org.vexi.plat.JOGL");
-                hasJOGL = true;
-            } catch (ClassNotFoundException cnfe) {
-                hasJOGL = false;
+            String platform_class;
+            int secondDecimal = version.substring(version.indexOf('.') + 
1).indexOf('.');
+            if (secondDecimal != -1) {
+                version = version.substring(0, version.indexOf('.') + 1 + 
secondDecimal);
             }
-            if (hasJOGL) {
-                // OpenGL is cross-platform and as such must be detected first
-                platform_class = "JOGL";
-            } else if (vendor.startsWith("Free Software Foundation")) {
-                // compiled natively with GCJ
-                if (os_name.startsWith("Window")) {
-                    platform_class = "Win32";
-                } else if (os_name.startsWith("Linux")) {
-                    platform_class = "Linux";
-                } else if (os_name.startsWith("SunOS")) {
-                    platform_class = "Solaris";
-                } else if (os_name.startsWith("Solaris")) {
-                    platform_class = "Solaris";
-                } else if (os_name.startsWith("Darwin")) {
-                    platform_class = "Darwin";
-                } else {
-                    platform_class = "X11";
-                }
+            double versionNumber = Double.parseDouble(version);
+            if (versionNumber >= 1.4) {
+                platform_class = "Swing";
             } else {
-                int secondDecimal = version.substring(version.indexOf('.') + 
1).indexOf('.');
-                if (secondDecimal != -1) {
-                    version = version.substring(0, version.indexOf('.') + 1 + 
secondDecimal);
-                }
-                double versionNumber = Double.parseDouble(version);
-                if (versionNumber >= 1.4) {
-                    platform_class = "Swing";
-                } else if (versionNumber >= 1.1) {
-                    platform_class = "AWT";
-                } else {
-                    criticalAbort(vendor+" "+version+" is currently 
unsupported");
-                }
+                criticalAbort(vendor+" "+version+" is currently unsupported");
+                return;
             }
-
-            if (platform_class == null) {
-                ulog.error(Platform.class, "Unable to detect JVM");
-                criticalAbort("Unable to detect JVM");
-            }
-            
+                        
             if (slog.isInfo()) {
                 slog.info(Platform.class, "Detecting JVM..." + os_name + " ==> 
org.vexi.plat." + platform_class);
             }
@@ -118,17 +86,8 @@
 
             //Log.color = term != null && term.length() != 0 && 
!term.equals("cygwin");
             
-            try {
-                // FIXME org.ibex.Build is not a class
-                build = 
(String)Class.forName("org.ibex.Build").getField("build").get(null);
-                ulog.info(Platform.class, "Vexi build: " + build);
-            } catch (ClassNotFoundException cnfe) {
-                ulog.info(Platform.class, "Vexi build: unknown");
-            } catch (Exception e) {
-                slog.warn(Platform.class, "exception while detecting build:");
-                slog.warn(Platform.class, e);
-            }
-
+            ulog.info(Platform.class, "Vexi build: " +ModuleVersion.STRING);
+            
             slog.diag(Platform.class, "Vexi VM detection:  vendor = " + 
vendor);
             slog.diag(Platform.class, "                   version = " + 
version);
             slog.diag(Platform.class, "                        os = " + 
os_name + " [version " + os_version + "]");

Modified: 
branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Swing.java
===================================================================
--- branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Swing.java    
2016-06-28 16:46:33 UTC (rev 4872)
+++ branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Swing.java    
2016-07-15 01:16:46 UTC (rev 4873)
@@ -197,8 +197,6 @@
                 frame.setExtendedState(b
                         ? (Frame.ICONIFIED | (maximized ? 
JFrame.MAXIMIZED_BOTH : 0))
                         : (maximized ? JFrame.MAXIMIZED_BOTH : JFrame.NORMAL));
-            } else {
-                Log.warn(this, "JDK 1.1 platforms cannot minimize or 
unminimize windows");
             }
         }
         

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to