Ignore:
Timestamp:
2009-03-18T15:55:16+01:00 (16 years ago)
Author:
stoecker
Message:

fix the menu changes in JOSM

Location:
applications/editors/josm/plugins/cadastre-fr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/build.xml

    r14015 r14120  
    2626                <attribute name="Plugin-Description" value="A special handler for the french land registry WMS server."/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/FR:JOSM/Fr:Plugin/Cadastre"/>
    28                 <attribute name="Plugin-Mainversion" value="1465"/>
     28                <attribute name="Plugin-Mainversion" value="1498"/>
    2929                <attribute name="Plugin-Stage" value="60"/>
    3030                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java

    r13784 r14120  
    11package cadastre_fr;
    22
     3import static org.openstreetmap.josm.tools.I18n.marktr;
    34import static org.openstreetmap.josm.tools.I18n.tr;
    45
     
    1011import javax.swing.JCheckBoxMenuItem;
    1112import javax.swing.JMenu;
    12 import javax.swing.JMenuBar;
    1313import javax.swing.JMenuItem;
    1414import javax.swing.JOptionPane;
     
    2020import org.openstreetmap.josm.actions.UploadAction.UploadHook;
    2121import org.openstreetmap.josm.gui.IconToggleButton;
     22import org.openstreetmap.josm.gui.MainMenu;
    2223import org.openstreetmap.josm.gui.MapFrame;
    2324import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     
    2627
    2728/**
    28  * 
     29 *
    2930 * Plugin to access the french Cadastre WMS server at www.cadastre.gouv.fr This
    3031 * WMS server requires some specific handling like retrieving a cookie for a
    3132 * limitation in case of no activity, or the request to the server shall provide
    3233 * a city/town/village code.
    33  * 
    34  * @author Pieren <pieren3@gmail.com>, 
     34 *
     35 * @author Pieren <pieren3@gmail.com>,
    3536 * @author <matthieu.lochegnies@gmail.com> for the extension to codeCommune
    3637 * @version 0.8
    37  * History: 
    38  * 0.1 17-Jun-2008 first prototype using a first Lambert projection impl. in core 
     38 * History:
     39 * 0.1 17-Jun-2008 first prototype using a first Lambert projection impl. in core
    3940 * 0.2 22-Jun-2008 first stable version
    4041 * 0.3 24-Jun-2008 add code departement
     
    4344 *                 - add option to force a Lambert zone (for median locations)
    4445 *                 - add auto-sourcing
    45  * 0.5 16-Aug-2008 - add transparency in layer (allowing multiple wms layers displayed together) 
     46 * 0.5 16-Aug-2008 - add transparency in layer (allowing multiple wms layers displayed together)
    4647 *                 - no overlapping of grabbed images if transparency is enabled
    4748 *                 - set one layer per location
     
    6162 *                 - validate projection name by Lambert.toString() method
    6263 * 0.8 25-Jan-2009 - display returned list of communes if direct name is not recognized by server
    63  *                 - new possible grab factor of 100 square meters fixed size                     
     64 *                 - new possible grab factor of 100 square meters fixed size
    6465 *                 - minor fixes due to changes in JOSM core classes
    65  *                 - first draft of raster image support 
     66 *                 - first draft of raster image support
    6667 * 0.9 05-Feb-2009 - grab vectorized full commune bbox, save in file, convert to OSM way
    6768 *                   and simplify
    68  * 1.0 18-Feb-2009 - fix various bugs in color management and preference dialog 
     69 * 1.0 18-Feb-2009 - fix various bugs in color management and preference dialog
    6970 *                 - increase PNG picture size requested to WMS (800x1000)
    70  *                 - set 4th grab scale fixed size configurable (from 25 to 1000 meters) 
     71 *                 - set 4th grab scale fixed size configurable (from 25 to 1000 meters)
    7172 */
    7273public class CadastrePlugin extends Plugin {
     
    7879
    7980    public static String source = "";
    80    
     81
    8182    // true if the checkbox "auto-sourcing" is set in the plugin menu
    8283    public static boolean autoSourcing = false;
    83    
     84
    8485    // true when the plugin is first used, e.g. grab from WMS or download cache file
    8586    public static boolean pluginUsed = false;
    86    
     87
    8788    public static String cacheDir = null;
    88    
     89
    8990    public static boolean alterColors = false;
    90    
     91
    9192    public static boolean backgroundTransparent = false;
    92    
     93
    9394    public static float transparency = 1.0f;
    94    
     95
    9596    public static boolean drawBoundaries = false;
    96    
     97
    9798    static private boolean menuEnabled = false;
    9899
    99100    /**
    100101     * Creates the plugin and setup the default settings if necessary
    101      * 
     102     *
    102103     * @throws Exception
    103104     */
     
    123124    public void refreshMenu() throws Exception {
    124125        boolean isLambertProjection = Main.proj.toString().equals(new Lambert().toString());
    125         JMenuBar menu = Main.main.menu;
     126        MainMenu menu = Main.main.menu;
    126127
    127128        if (cadastreJMenu == null) {
    128             cadastreJMenu = new JMenu(tr("Cadastre"));
    129             cadastreJMenu.setMnemonic(KeyEvent.VK_C);
    130             menu.add(cadastreJMenu, menu.getMenuCount()-2);
     129            cadastreJMenu = menu.addMenu(marktr("Cadastre"), KeyEvent.VK_C, menu.defaultMenuPos);
    131130            if (isLambertProjection) {
    132131                JosmAction grab = new MenuActionGrab();
     
    138137                JMenuItem menuSettings = new JMenuItem(new MenuActionNewLocation());
    139138                final JCheckBoxMenuItem menuSource = new JCheckBoxMenuItem(tr("Auto sourcing"));
    140                 menuSource.setSelected(autoSourcing);     
     139                menuSource.setSelected(autoSourcing);
    141140                menuSource.addActionListener(new ActionListener() {
    142141                    public void actionPerformed(ActionEvent ev) {
     
    145144                    }
    146145                });
    147    
     146
    148147                JMenuItem menuResetCookie = new JMenuItem(new MenuActionResetCookie());
    149148                JMenuItem menuLambertZone = new JMenuItem(new MenuActionLambertZone());
     
    151150                //JMenuItem menuActionBoundaries = new JMenuItem(new MenuActionBoundaries());
    152151                //JMenuItem menuActionBuildings = new JMenuItem(new MenuActionBuildings());
    153                
     152
    154153                cadastreJMenu.add(menuGrab);
    155154                cadastreJMenu.add(menuSettings);
     
    159158                cadastreJMenu.add(menuLoadFromCache);
    160159                // all SVG features disabled until official WMS is released
    161                 //cadastreJMenu.add(menuActionBoundaries); 
     160                //cadastreJMenu.add(menuActionBoundaries);
    162161                //cadastreJMenu.add(menuActionBuildings);
    163162            } else {
Note: See TracChangeset for help on using the changeset viewer.