Changeset 4906 in josm for trunk/src/org


Ignore:
Timestamp:
2012-02-07T15:13:18+01:00 (8 years ago)
Author:
akks
Message:

See #7303: Added option to run Download dialog on startup and help line in non-expert mode

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

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

    r4789 r4906  
    77import java.awt.Image;
    88import java.awt.Toolkit;
     9import java.awt.event.ActionEvent;
    910import java.awt.event.WindowAdapter;
    1011import java.awt.event.WindowEvent;
     
    3233import org.openstreetmap.josm.data.Preferences;
    3334import org.openstreetmap.josm.data.Version;
     35import org.openstreetmap.josm.gui.download.DownloadDialog;
    3436import org.openstreetmap.josm.gui.preferences.server.OAuthAccessTokenHolder;
    3537import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     
    304306                main.postConstructorProcessCmdLine(args);
    305307
     308                DownloadDialog.autostartIfNeeded();
    306309            }
    307310        });
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java

    r4699 r4906  
    1515import java.awt.GridBagLayout;
    1616import java.awt.event.ActionEvent;
     17import java.awt.event.ActionListener;
    1718import java.awt.event.InputEvent;
    1819import java.awt.event.KeyEvent;
     
    3334
    3435import org.openstreetmap.josm.Main;
     36import org.openstreetmap.josm.actions.ExpertToggleAction;
    3537import org.openstreetmap.josm.data.Bounds;
    3638import org.openstreetmap.josm.gui.MapView;
     
    6769    private final JTabbedPane tpDownloadAreaSelectors = new JTabbedPane();
    6870    private JCheckBox cbNewLayer;
     71    private JCheckBox cbStartup;
    6972    private final JLabel sizeCheck = new JLabel();
    7073    private Bounds currentBounds = null;
     
    130133                +"Unselect to download into the currently active data layer.</html>"));
    131134
     135        cbStartup = new JCheckBox(tr("Open this dialog on startup"));
     136        cbStartup.setToolTipText(tr("<html>Autostart Download from OSM dialog every time JOSM is started.<br>You can open it manually from File menu or by Ctrl-Shift-D</html>"));
     137        cbStartup.addActionListener(new ActionListener() {
     138            public void actionPerformed(ActionEvent e) {
     139                 Main.pref.put("download.autorun", cbStartup.isSelected());
     140            }});
     141
    132142        pnl.add(cbNewLayer, GBC.std().anchor(GBC.WEST).insets(5,5,5,5));
    133         pnl.add(sizeCheck,  GBC.eol().anchor(GBC.EAST).insets(5,5,5,5));
    134 
     143        pnl.add(cbStartup, GBC.std().anchor(GBC.WEST).insets(15,5,5,5));
     144
     145        pnl.add(sizeCheck,  GBC.eol().anchor(GBC.EAST).insets(5,5,5,2));
     146       
     147        if (!ExpertToggleAction.isExpert()) {
     148            JLabel infoLabel  = new JLabel(tr("Use left click&drag to select area, arrows or right mouse button to scroll map, wheel or +/- to zoom"));
     149            pnl.add(infoLabel,GBC.eol().anchor(GBC.SOUTH).insets(0,0,0,0));
     150        }
    135151        return pnl;
    136152    }
     
    297313        cbDownloadGpxData.setSelected(Main.pref.getBoolean("download.gps", false));
    298314        cbNewLayer.setSelected(Main.pref.getBoolean("download.newlayer", false));
     315        cbStartup.setSelected( isAutorunEnabled() );
    299316        int idx = Main.pref.getInteger("download.tab", 0);
    300317        if (idx < 0 || idx > tpDownloadAreaSelectors.getTabCount()) {
     
    320337                e.printStackTrace();
    321338            }
     339        }
     340    }
     341
     342    public static boolean isAutorunEnabled() {
     343        //String autorun=Main.pref.get("download.autorun",null);
     344        //boolean expert=ExpertToggleAction.isExpert();
     345        //return (autorun==null && !expert) || "true".equals(autorun) ;
     346        return Main.pref.getBoolean("download.autorun",false);
     347    }
     348
     349    public static void autostartIfNeeded() {
     350        if (isAutorunEnabled()) {
     351            Main.main.menu.download.actionPerformed(null);
    322352        }
    323353    }
Note: See TracChangeset for help on using the changeset viewer.