Ignore:
Timestamp:
2013-03-27T20:56:51+01:00 (12 years ago)
Author:
zverik
Message:

iodb: save last layer offset, update min josm version, reduce max button count

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java

    r29408 r29412  
    55import javax.swing.JMenu;
    66import org.openstreetmap.josm.Main;
     7import org.openstreetmap.josm.data.Version;
    78import org.openstreetmap.josm.plugins.Plugin;
    89import org.openstreetmap.josm.plugins.PluginInformation;
     
    3132        storeAction = new StoreImageryOffsetAction();
    3233       
    33         JMenu offsetMenu = Main.main.menu.addMenu(marktr("Offset"), KeyEvent.VK_O, 6, "help");
     34        // before 5803 imagery menu was constantly regenerated, erasing extra items
     35        // before 5729 it was regenerated only when the imagery list was modified (also bad)
     36        int version = Version.getInstance().getVersion();
     37        JMenu offsetMenu = version < 5803
     38                ? Main.main.menu.addMenu(marktr("Offset"), KeyEvent.VK_O, 6, "help")
     39                : Main.main.menu.imageryMenu;
    3440        offsetMenu.add(getAction);
    3541        offsetMenu.add(storeAction);
     42        if( version >= 5803 ) // todo: check if this is needed
     43            offsetMenu.addSeparator();
    3644
    3745        // an ugly hack to add this plugin to the toolbar
    38         Collection<String> toolbar = new LinkedList<String>(Main.toolbar.getToolString());
    39         if( !toolbar.contains("getoffset") && Main.pref.getBoolean("iodb.modify.toolbar", true) ) {
    40             toolbar.add("getoffset");
    41             Main.pref.putCollection("toolbar", toolbar);
     46        if( Main.pref.getBoolean("iodb.modify.toolbar", true) ) {
     47            Collection<String> toolbar = new LinkedList<String>(Main.toolbar.getToolString());
     48            if( !toolbar.contains("getoffset") ) {
     49                toolbar.add("getoffset");
     50                Main.pref.putCollection("toolbar", toolbar);
     51                Main.toolbar.refreshToolbarControl();
     52            }
    4253            Main.pref.put("iodb.modify.toolbar", false);
    43             Main.toolbar.refreshToolbarControl();
    4454        }
    4555    }
Note: See TracChangeset for help on using the changeset viewer.