Changeset 4336 in josm for trunk/src/org
- Timestamp:
- 2011-08-25T23:58:48+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/bbox/SizeButton.java
r3094 r4336 26 26 } 27 27 28 public void paint(Graphics g){ 29 if(isEnlarged){ 28 public void paint(Graphics g) { 29 if(isEnlarged) { 30 30 if(shrinkImage != null) 31 31 g.drawImage(shrinkImage.getImage(),x,y, null); 32 } else{32 } else { 33 33 if(enlargeImage != null) 34 34 g.drawImage(enlargeImage.getImage(),x,y, null); … … 36 36 } 37 37 38 public void toggle(){ 38 public void toggle() { 39 39 isEnlarged = !isEnlarged; 40 40 } 41 41 42 public boolean hit(Point point){ 43 if(x < point.x && point.x < x + enlargeImage.getIconWidth()){ 44 if(y < point.y && point.y < y + enlargeImage.getIconHeight() ){ 42 public boolean isEnlarged() { 43 return isEnlarged; 44 } 45 46 public boolean hit(Point point) { 47 if(x < point.x && point.x < x + enlargeImage.getIconWidth()) { 48 if(y < point.y && point.y < y + enlargeImage.getIconHeight()) { 45 49 return true; 46 50 } -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r4202 r4336 10 10 import java.awt.Point; 11 11 import java.awt.Rectangle; 12 import java.awt.Toolkit;13 12 import java.io.File; 14 13 import java.io.IOException; … … 40 39 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 41 40 import org.openstreetmap.josm.data.preferences.StringProperty; 42 import org.openstreetmap.josm.gui.download.DownloadDialog;43 41 import org.openstreetmap.josm.gui.layer.TMSLayer; 44 42 … … 153 151 154 152 private static final StringProperty PROP_MAPSTYLE = new StringProperty("slippy_map_chooser.mapstyle", "Mapnik"); 155 156 // standard dimension 157 private Dimension iDownloadDialogDimension; 153 public static final String RESIZE_PROP = SlippyMapBBoxChooser.class.getName() + ".resize"; 158 154 159 155 private TileLoader cachedLoader; … … 341 337 Bounds oldValue = this.bbox; 342 338 this.bbox = b; 339 repaint(); 343 340 firePropertyChange(BBOX_PROP, oldValue, this.bbox); 344 repaint();345 }346 347 private DownloadDialog iGui;348 349 public void setGui(final DownloadDialog gui) {350 iGui = gui;351 341 } 352 342 … … 356 346 */ 357 347 public void resizeSlippyMap() { 358 int w, h; 359 360 // retrieve the size of the display 361 Dimension iScreenSize = Toolkit.getDefaultToolkit().getScreenSize(); 362 363 // enlarge 364 if(iDownloadDialogDimension == null) { 365 // make the each dimension 90% of the absolute display size 366 w = iScreenSize.width * 90 / 100; 367 h = iScreenSize.height * 90 / 100; 368 iDownloadDialogDimension = iGui.getSize(); 369 } 370 // shrink 371 else { 372 // set the size back to the initial dimensions 373 w = iDownloadDialogDimension.width; 374 h = iDownloadDialogDimension.height; 375 iDownloadDialogDimension = null; 376 } 377 378 // resize and center the DownloadDialog 379 iGui.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h); 380 repaint(); 348 boolean large = iSizeButton.isEnlarged(); 349 firePropertyChange(RESIZE_PROP, !large, large); 381 350 } 382 351 … … 398 367 */ 399 368 public void setBoundingBox(Bounds bbox) { 400 if (bbox == null) { 369 if (bbox == null || (bbox.getMin().lat() == 0.0 && bbox.getMin().lon() == 0.0 370 && bbox.getMax().lat() == 0.0 && bbox.getMax().lon() == 0.0)) { 401 371 this.bbox = null; 372 iSelectionRectStart = null; 373 iSelectionRectEnd = null; 374 repaint(); 402 375 return; 403 376 } 404 // test if a bounding box has been set 405 if (bbox.getMin().lat() == 0.0 && bbox.getMin().lon() == 0.0 && bbox.getMax().lat() == 0.0 && bbox.getMax().lon() == 0.0) { 406 this.bbox = null; 407 } 408 377 378 this.bbox = bbox; 409 379 int y1 = OsmMercator.LatToY(bbox.getMin().lat(), MAX_ZOOM); 410 380 int y2 = OsmMercator.LatToY(bbox.getMax().lat(), MAX_ZOOM); … … 425 395 setDisplayToFitMapMarkers(); 426 396 zoomOut(); 427 this.bbox = bbox;428 397 } 429 398 } -
trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java
r4168 r4336 4 4 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 7 import java.awt.Dimension; 8 import java.awt.Graphics; 9 import java.awt.Toolkit; 6 10 7 11 import java.beans.PropertyChangeEvent; … … 24 28 private DownloadDialog iGui; 25 29 private SlippyMapBBoxChooser pnlSlippyMapBBoxChooser; 30 // standard dimension 31 private Dimension iDownloadDialogDimension; 26 32 27 33 /** … … 35 41 public void addGui(final DownloadDialog gui) { 36 42 iGui = gui; 37 pnlSlippyMapBBoxChooser.setGui(iGui);38 43 iGui.addDownloadAreaSelector(pnlSlippyMapBBoxChooser, tr("Slippy map")); 39 44 } … … 41 46 public void setDownloadArea(Bounds area) { 42 47 pnlSlippyMapBBoxChooser.setBoundingBox(area); 48 repaint(); 43 49 } 44 50 … … 48 54 iGui.boundingBoxChanged((Bounds)evt.getNewValue(), this); 49 55 } 56 } else if(evt.getPropertyName().equals(SlippyMapBBoxChooser.RESIZE_PROP)) { 57 int w, h; 58 59 // retrieve the size of the display 60 Dimension iScreenSize = Toolkit.getDefaultToolkit().getScreenSize(); 61 62 // enlarge 63 if(iDownloadDialogDimension == null) { 64 // make the each dimension 90% of the absolute display size 65 w = iScreenSize.width * 90 / 100; 66 h = iScreenSize.height * 90 / 100; 67 iDownloadDialogDimension = iGui.getSize(); 68 } 69 // shrink 70 else { 71 // set the size back to the initial dimensions 72 w = iDownloadDialogDimension.width; 73 h = iDownloadDialogDimension.height; 74 iDownloadDialogDimension = null; 75 } 76 77 // resize and center the DownloadDialog 78 iGui.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h); 79 repaint(); 50 80 } 51 81 }
Note:
See TracChangeset
for help on using the changeset viewer.