Ignore:
Timestamp:
2011-08-25T23:58:48+02:00 (13 years ago)
Author:
stoecker
Message:

fix #6720 - slippy map download not refreshed, improve resize handling for slippy map downloader

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java

    r4168 r4336  
    44
    55import static org.openstreetmap.josm.tools.I18n.tr;
     6
     7import java.awt.Dimension;
     8import java.awt.Graphics;
     9import java.awt.Toolkit;
    610
    711import java.beans.PropertyChangeEvent;
     
    2428    private DownloadDialog iGui;
    2529    private SlippyMapBBoxChooser pnlSlippyMapBBoxChooser;
     30    // standard dimension
     31    private Dimension iDownloadDialogDimension;
    2632
    2733    /**
     
    3541    public void addGui(final DownloadDialog gui) {
    3642        iGui = gui;
    37         pnlSlippyMapBBoxChooser.setGui(iGui);
    3843        iGui.addDownloadAreaSelector(pnlSlippyMapBBoxChooser, tr("Slippy map"));
    3944    }
     
    4146    public void setDownloadArea(Bounds area) {
    4247        pnlSlippyMapBBoxChooser.setBoundingBox(area);
     48        repaint();
    4349    }
    4450
     
    4854                iGui.boundingBoxChanged((Bounds)evt.getNewValue(), this);
    4955            }
     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();
    5080        }
    5181    }
Note: See TracChangeset for help on using the changeset viewer.