Ignore:
Timestamp:
2009-12-05T17:54:49+01:00 (12 years ago)
Author:
bastiK
Message:

Adjusted toggle dialog behavior for geoimage:

  • When click on a thumbnail, show the detached dialog unless the side dialog is already open.
  • When closing the detached dialog do not open it in the side dialog again, just close.
  • When the toggle button is clicked, always open the side dialog.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java

    r2566 r2577  
    2121import org.openstreetmap.josm.Main;
    2222import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
     23import org.openstreetmap.josm.gui.dialogs.DialogsPanel.Action;
    2324import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer.ImageEntry;
    2425import org.openstreetmap.josm.tools.ImageProvider;
     
    4546        return INSTANCE;
    4647    }
    47    
     48
    4849    private JButton btnNext;
    4950    private JButton btnPrevious;
     
    5253        super(tr("Geotagged Images"), "geoimage", tr("Display geotagged images"), Shortcut.registerShortcut("tools:geotagged", tr("Tool: {0}", tr("Display geotagged images")), KeyEvent.VK_Y, Shortcut.GROUP_EDIT), 200);
    5354
     55        /* Don't show a detached dialog right from the start. */
     56        if (isShowing && !isDocked) {
     57            setIsShowing(false);
     58        }
     59
    5460        if (INSTANCE != null) {
    5561            throw new IllegalStateException("Image viewer dialog should not be instanciated twice !");
     
    5763
    5864        INSTANCE = this;
    59        
     65
    6066        JPanel content = new JPanel();
    6167        content.setLayout(new BorderLayout());
     
    188194            imgDisplay.setOsdText("");
    189195        }
    190     }
    191    
     196        if (! isDialogShowing()) {
     197            setIsDocked(false);     // always open a detached window when an image is clicked and dialog is closed
     198            showDialog();
     199        } else {
     200            if (isDocked && isCollapsed) {
     201                expand();
     202                dialogsPanel.reconstruct(Action.COLLAPSED_TO_DEFAULT, this);
     203            }
     204        }
     205
     206    }
     207
     208    /**
     209     * When pressing the Toggle button always show the docked dialog.
     210     */
     211    @Override
     212    protected void toggleButtonHook() {
     213        if (! isShowing) {
     214            setIsDocked(true);
     215            setIsCollapsed(false);
     216        }
     217    }
     218
     219    /**
     220     * When an image is closed, really close it and do not pop
     221     * up the side dialog.
     222     */
     223    @Override
     224    protected boolean dockWhenClosingDetachedDlg() {
     225        return false;
     226    }
     227
    192228    /**
    193229     * Returns whether an image is currently displayed
Note: See TracChangeset for help on using the changeset viewer.