Mercurial > hg > Applications > TreeVNC
comparison src/viewer_swing/java/com/glavsoft/viewer/UiSettings.java @ 309:31d86f0ee977
create fit screen button
author | oc |
---|---|
date | Thu, 22 Jan 2015 11:17:50 +0900 |
parents | 61938de1dd06 |
children | 9b70bfdef8bd |
comparison
equal
deleted
inserted
replaced
308:d1d6c7306281 | 309:31d86f0ee977 |
---|---|
106 } | 106 } |
107 setScalePercent(scaleFactor); | 107 setScalePercent(scaleFactor); |
108 fireListeners(); | 108 fireListeners(); |
109 } | 109 } |
110 | 110 |
111 public void adjustHdSize(int width) { | 111 public void adjustHdSize(int singleWidth) { |
112 double hdWidth = 1920.0; | 112 double hdWidth = 1920.0; |
113 double defaultScaleFactor = 100.0; | 113 double defaultScaleFactor = 100.0; |
114 double scaleFactor = (hdWidth / width) * defaultScaleFactor; | 114 double scaleFactor = (hdWidth / singleWidth) * defaultScaleFactor; |
115 if (scaleFactor > MAX_SCALE_PERCENT) { | 115 if (scaleFactor > MAX_SCALE_PERCENT) { |
116 scaleFactor = MAX_SCALE_PERCENT; | 116 scaleFactor = MAX_SCALE_PERCENT; |
117 } | 117 } |
118 setScalePercent(scaleFactor); | 118 setScalePercent(scaleFactor); |
119 fireListeners(); | 119 fireListeners(); |
195 ", fullScreen=" + uiSettingsData.isFullScreen() + | 195 ", fullScreen=" + uiSettingsData.isFullScreen() + |
196 ", mouseCursorShape=" + uiSettingsData.getMouseCursorShape() + | 196 ", mouseCursorShape=" + uiSettingsData.getMouseCursorShape() + |
197 '}'; | 197 '}'; |
198 } | 198 } |
199 | 199 |
200 public void fitScreen(int thisScreenWidth, int thisScreenHeight, int singleWidth, int singleHeight) { | |
201 double doubleThisWidth = (double) thisScreenWidth; | |
202 double doubleThisHeight = (double) thisScreenHeight; | |
203 | |
204 double widthScale = (doubleThisWidth/singleWidth); | |
205 double heightScale = (doubleThisHeight/singleHeight); | |
206 double defaultScaleFactor = 100.0; | |
207 double scaleFactor = 100.0; | |
208 | |
209 double diff = widthScale - heightScale; | |
210 | |
211 if(diff == 0) { | |
212 scaleFactor = defaultScaleFactor * widthScale; | |
213 setScalePercent(scaleFactor); | |
214 } else if(diff > 0) { | |
215 scaleFactor = defaultScaleFactor * heightScale; | |
216 } | |
217 if (scaleFactor > MAX_SCALE_PERCENT) { | |
218 scaleFactor = MAX_SCALE_PERCENT; | |
219 } | |
220 setScalePercent(scaleFactor); | |
221 fireListeners(); | |
222 } | |
200 } | 223 } |