Changeset 4883 in josm


Ignore:
Timestamp:
2012-02-01T19:39:19+01:00 (8 years ago)
Author:
simon04
Message:

fix #5920 - remotecontrol: add option for "new layer" to preference dialog

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

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

    r4310 r4883  
    5252    private JCheckBox permissionChangeViewport = new JCheckBox(tr("Change the viewport"));
    5353    private JCheckBox permissionReadProtocolversion = new JCheckBox(tr("Read protocol version"));
     54    private JCheckBox loadInNewLayer = new JCheckBox(tr("Download objects to new layer"));
    5455    private JCheckBox alwaysAskUserConfirm = new JCheckBox(tr("Confirm all Remote Control actions manually"));
    5556
     
    8485        wrapper.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL).insets(15, 5, 15, 5));
    8586
     87        wrapper.add(loadInNewLayer, GBC.eol().fill(GBC.HORIZONTAL));
     88
    8689        wrapper.add(alwaysAskUserConfirm, GBC.eol().fill(GBC.HORIZONTAL));
    8790
     
    101104        permissionCreateObjects.setSelected(Main.pref.getBoolean(AddNodeHandler.permissionKey, AddNodeHandler.permissionDefault));
    102105        permissionReadProtocolversion.setSelected(Main.pref.getBoolean(VersionHandler.permissionKey, VersionHandler.permissionDefault));
     106        loadInNewLayer.setSelected(Main.pref.getBoolean(RequestHandler.loadInNewLayerKey, RequestHandler.loadInNewLayerDefault));
    103107        alwaysAskUserConfirm.setSelected(Main.pref.getBoolean(RequestHandler.globalConfirmationKey, RequestHandler.globalConfirmationDefault));
    104108
     
    128132            Main.pref.put(AddNodeHandler.permissionKey, permissionCreateObjects.isSelected());
    129133            Main.pref.put(VersionHandler.permissionKey, permissionReadProtocolversion.isSelected());
     134            Main.pref.put(RequestHandler.loadInNewLayerKey, loadInNewLayer.isSelected());
    130135            Main.pref.put(RequestHandler.globalConfirmationKey, alwaysAskUserConfirm.isSelected());
    131136        }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r4858 r4883  
    6868            minlon = Double.parseDouble(args.get("left"));
    6969            maxlon = Double.parseDouble(args.get("right"));
    70             boolean newLayer = Boolean.parseBoolean(args.get("new_layer"));
     70            boolean newLayer = isLoadInNewLayer();
    7171
    7272            if(command.equals(myCommand))
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java

    r4834 r4883  
    3333            ps.add(SimplePrimitiveId.fromString(i));
    3434        }
    35         boolean newLayer = Boolean.parseBoolean(args.get("new_layer"));
     35        boolean newLayer = isLoadInNewLayer();
    3636        boolean relationMembers = Boolean.parseBoolean(args.get("relation_members"));
    3737        DownloadPrimitiveAction.processItems(newLayer, ps, true, relationMembers);
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r4834 r4883  
    2424    public static final String globalConfirmationKey = "remotecontrol.always-confirm";
    2525    public static final boolean globalConfirmationDefault = false;
     26    public static final String loadInNewLayerKey = "remotecontrol.new-layer";
     27    public static final boolean loadInNewLayerDefault = false;
    2628
    2729    /** The GET request arguments */
     
    210212    }
    211213
     214    protected boolean isLoadInNewLayer() {
     215        return args.get("new_layer") != null && !args.get("new_layer").isEmpty()
     216                ? Boolean.parseBoolean(args.get("new_layer"))
     217                : Main.pref.getBoolean(loadInNewLayerKey, loadInNewLayerDefault);
     218    }
     219
    212220    public static class RequestHandlerException extends Exception {
    213221
Note: See TracChangeset for help on using the changeset viewer.