Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
- Timestamp:
- 2015-06-20T23:42:21+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r8443 r8510 72 72 } 73 73 if (reference == null) 74 return new WindowGeometry(new Point(0, 0), extent);75 parentWindow = (Window) reference;74 return new WindowGeometry(new Point(0, 0), extent); 75 parentWindow = (Window) reference; 76 76 Point topLeft = new Point( 77 77 Math.max(0, (parentWindow.getSize().width - extent.width) /2), … … 139 139 Rectangle oldScreen = getScreenInfo(getRectangle()); 140 140 Rectangle newScreen = getScreenInfo(new Rectangle(window.getLocationOnScreen(), window.getSize())); 141 if (oldScreen.x != newScreen.x) {141 if (oldScreen.x != newScreen.x) { 142 142 this.topLeft.x += newScreen.x - oldScreen.x; 143 143 } 144 if (oldScreen.y != newScreen.y) {144 if (oldScreen.y != newScreen.y) { 145 145 this.topLeft.y += newScreen.y - oldScreen.y; 146 146 } … … 150 150 String v = ""; 151 151 try { 152 Pattern p = Pattern.compile(field + "=(-?\\d+)", Pattern.CASE_INSENSITIVE);152 Pattern p = Pattern.compile(field + "=(-?\\d+)", Pattern.CASE_INSENSITIVE); 153 153 Matcher m = p.matcher(preferenceValue); 154 154 if (!m.find()) … … 158 158 v = m.group(1); 159 159 return Integer.parseInt(v); 160 } catch (WindowGeometryException e) {160 } catch (WindowGeometryException e) { 161 161 throw e; 162 } catch (NumberFormatException e) {162 } catch (NumberFormatException e) { 163 163 throw new WindowGeometryException( 164 tr("Preference with key ''{0}'' does not provide an int value for ''{1}''. Got {2}. Cannot restore window geometry from preferences.", 164 tr("Preference with key ''{0}'' does not provide an int value for ''{1}''. Got {2}. " + 165 "Cannot restore window geometry from preferences.", 165 166 preferenceKey, field, v), e); 166 } catch (Exception e) {167 } catch (Exception e) { 167 168 throw new WindowGeometryException( 168 tr("Failed to parse field ''{1}'' in preference with key ''{0}''. Exception was: {2}. Cannot restore window geometry from preferences.", 169 tr("Failed to parse field ''{1}'' in preference with key ''{0}''. Exception was: {2}. " + 170 "Cannot restore window geometry from preferences.", 169 171 preferenceKey, field, e.toString()), e); 170 172 } … … 207 209 } 208 210 } 209 return new WindowGeometry(new Point(x, y), new Dimension(w,h));211 return new WindowGeometry(new Point(x, y), new Dimension(w, h)); 210 212 } else { 211 213 Main.warn(tr("Ignoring malformed geometry: {0}", arg)); … … 213 215 } 214 216 WindowGeometry def; 215 if (maximize) {217 if (maximize) { 216 218 def = new WindowGeometry(screenDimension); 217 219 } else { … … 248 250 try { 249 251 initFromPreferences(preferenceKey); 250 } catch (WindowGeometryException e) {252 } catch (WindowGeometryException e) { 251 253 initFromWindowGeometry(defaultGeometry); 252 254 } … … 413 415 Rectangle g = new WindowGeometry(preferenceKey, 414 416 /* default: something on screen 1 */ 415 new WindowGeometry(new Point(0, 0), new Dimension(10,10))).getRectangle();417 new WindowGeometry(new Point(0, 0), new Dimension(10, 10))).getRectangle(); 416 418 return getScreenInfo(g); 417 419 } … … 467 469 */ 468 470 public static Rectangle getFullScreenInfo() { 469 return new Rectangle(new Point(0, 0), Toolkit.getDefaultToolkit().getScreenSize());471 return new Rectangle(new Point(0, 0), Toolkit.getDefaultToolkit().getScreenSize()); 470 472 } 471 473
Note:
See TracChangeset
for help on using the changeset viewer.