Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 225:5e3594021e79
fix --width --height mode.
author | oc |
---|---|
date | Tue, 15 Jul 2014 07:18:13 +0900 |
parents | ccbc3a951961 |
children | b7247e31b5ba |
files | src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindowFactory.java |
diffstat | 6 files changed, 58 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Sun Jul 06 17:50:00 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Tue Jul 15 07:18:13 2014 +0900 @@ -37,6 +37,8 @@ protected TreeRFBProto myRfb; private boolean cuiVersion; private boolean showTree = false; + public int width; + public int height; public static void main(String[] args) { Parser parser = new Parser(); @@ -280,5 +282,15 @@ return showTree; } + @Override + public void setWidth(int w) { + width = w; + } + + @Override + public void setHeight(int h) { + height = h; + } + }
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Sun Jul 06 17:50:00 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Tue Jul 15 07:18:13 2014 +0900 @@ -27,6 +27,7 @@ } if (viewer) { ViewerInterface v = cui ? new CuiViewer() : new Viewer(); + setWidthAndHeight(v); if (treeProxy) { // this viewer also works as tree root ( display mode -d flag ) // start with no connection waiting server change request @@ -36,6 +37,7 @@ } } + } public void rootStart(String[] args, ViewerInterface v) { @@ -105,17 +107,12 @@ } } - public boolean setWidthAndHeight(String[] args, int i) { - if(isInteger(args[++i])&&isInteger(args[++i])) { - width = Integer.parseInt(args[--i]); - height = Integer.parseInt(args[++i]); - return true; - } else { - width = 1920; - height = 1080; - return false; - } - } + public void setWidthAndHeight(ViewerInterface v) { + if(width != 0 || height != 0) { + v.setWidth(width); + v.setHeight(height); + } + } private boolean isInteger(String num) { try {
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jul 06 17:50:00 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Tue Jul 15 07:18:13 2014 +0900 @@ -70,6 +70,9 @@ public int vncport = ConnectionParams.DEFAULT_RFB_PORT; private int fbWidth; private boolean showTree = false; + public int width; + public int height; + public static void main(String[] args) { Parser parser = new Parser(); @@ -235,7 +238,7 @@ }); } - SwingViewerWindowFactory viewerWindowFactory = new SwingViewerWindowFactory(isSeparateFrame, isApplet, this); + SwingViewerWindowFactory viewerWindowFactory = new SwingViewerWindowFactory(isSeparateFrame, isApplet, this, width, height); connectionPresenter.setConnectionWorkerFactory( new SwingConnectionWorkerFactory(connectionView.getFrame(), passwordFromParams, connectionPresenter, viewerWindowFactory, myRfb)); @@ -414,4 +417,14 @@ return showTree; } + @Override + public void setWidth(int w) { + width = w; + } + + @Override + public void setHeight(int h) { + height = h; + } + }
--- a/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java Sun Jul 06 17:50:00 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java Tue Jul 15 07:18:13 2014 +0900 @@ -7,7 +7,7 @@ public interface ViewerInterface extends Runnable { - public boolean getCuiVersion(); + public boolean getCuiVersion(); public TreeRFBProto getRfb(); @@ -39,4 +39,8 @@ public boolean getShowTree(); + public void setWidth(int width); + + public void setHeight(int height); + }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Sun Jul 06 17:50:00 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Tue Jul 15 07:18:13 2014 +0900 @@ -82,13 +82,15 @@ private ProtocolSettings rfbSettings; private UiSettings uiSettings; private Protocol workingProtocol; + public int width; + public int height; private boolean isZoomToFitSelected; private List<JComponent> kbdButtons; public SwingViewerWindow(Protocol workingProtocol, ProtocolSettings rfbSettings, UiSettings uiSettings, Surface surface, boolean isSeparateFrame, boolean isApplet, ViewerInterface viewer, String connectionString, - ConnectionPresenter presenter) { + ConnectionPresenter presenter, int w, int h) { this.workingProtocol = workingProtocol; this.rfbSettings = rfbSettings; this.uiSettings = uiSettings; @@ -98,6 +100,8 @@ this.viewer = viewer; this.connectionString = connectionString; this.presenter = presenter; + this.width = w; + this.height = h; if(viewer instanceof Viewer) createContainer(surface, isApplet, (Viewer)viewer); @@ -327,8 +331,14 @@ screenBounds.x += screenInsets.left; screenBounds.y += screenInsets.top; - screenBounds.width -= screenInsets.left + screenInsets.right; - screenBounds.height -= screenInsets.top + screenInsets.bottom; + if (width != 0) { + screenBounds.width = width; + screenBounds.height = height; + } else { + screenBounds.width -= screenInsets.left + screenInsets.right; + screenBounds.height -= screenInsets.top + screenInsets.bottom; + } + return screenBounds; }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindowFactory.java Sun Jul 06 17:50:00 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindowFactory.java Tue Jul 15 07:18:13 2014 +0900 @@ -14,11 +14,15 @@ private boolean isSeparateFrame; private boolean isApplet; private ViewerInterface viewer; + public int width; + public int height; - public SwingViewerWindowFactory(boolean isSeparateFrame, boolean isApplet, ViewerInterface viewer) { + public SwingViewerWindowFactory(boolean isSeparateFrame, boolean isApplet, ViewerInterface viewer, int w, int h) { this.isSeparateFrame = isSeparateFrame; this.isApplet = isApplet; this.viewer = viewer; + width = w; + height = h; } public SwingViewerWindow createViewerWindow(Protocol workingProtocol, @@ -26,7 +30,7 @@ String connectionString, ConnectionPresenter presenter) { Surface surface = new Surface(workingProtocol, uiSettings.getScaleFactor(), uiSettings.getMouseCursorShape()); final SwingViewerWindow viewerWindow = new SwingViewerWindow(workingProtocol, rfbSettings, uiSettings, - surface, isSeparateFrame, isApplet, viewer, connectionString, presenter); + surface, isSeparateFrame, isApplet, viewer, connectionString, presenter, width, height); surface.setViewerWindow(viewerWindow); viewerWindow.setRemoteDesktopName(workingProtocol.getRemoteDesktopName()); rfbSettings.addListener(viewerWindow);