Ignore:
Timestamp:
2009-11-01T13:19:59+01:00 (15 years ago)
Author:
stoecker
Message:

updated some stuff to current JOSM

Location:
applications/editors/josm/plugins/piclayer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/piclayer/build.xml

    r17323 r18404  
    8181                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    8282                <attribute name="Plugin-Description" value="This plugin allows to display any picture as a background in the editor and align it with the map."/>
    83                 <attribute name="Plugin-Mainversion" value="1728"/>
     83                <attribute name="Plugin-Mainversion" value="2323"/>
    8484                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    8585            </manifest>
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java

    r17321 r18404  
    2121package org.openstreetmap.josm.plugins.piclayer;
    2222
     23import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
     24import static org.openstreetmap.josm.tools.I18n.tr;
     25
    2326import java.awt.event.KeyEvent;
    2427import javax.swing.JMenu;
     
    3538 */
    3639public class PicLayerPlugin extends Plugin implements LayerChangeListener {
    37        
    38         // Plugin menu
    39         private JMenu m_menu = null;
    40        
    41         // Toolbar buttons
    42         private IconToggleButton m_movePictureButton = null;
    43         private IconToggleButton m_rotatePictureButton = null;
    44         private IconToggleButton m_scalexPictureButton = null;
    45         private IconToggleButton m_scaleyPictureButton = null;
    46         private IconToggleButton m_scalexyPictureButton = null;
    47        
    48         // Menu actions
    49         private NewLayerFromFileAction          m_newFromFileAction = null; 
    50         private NewLayerFromClipboardAction m_newFromClipAction = null;
    5140
    52         /**
    53          * Constructor...
    54          */
    55         public PicLayerPlugin() {
    56                
    57                 // Create menu entry
    58                 if ( Main.main.menu != null ) {
    59                         m_menu = Main.main.menu.addMenu( "PicLayer" , KeyEvent.VK_I, Main.main.menu.defaultMenuPos );
    60                 }
    61                
    62                 // Add menu items
    63                 if ( m_menu != null ) {
    64                         m_menu.add( m_newFromFileAction = new NewLayerFromFileAction() );
    65                         m_menu.add( m_newFromClipAction = new NewLayerFromClipboardAction() );
    66                         m_menu.addSeparator();
    67                         m_menu.add( new HelpAction() );
    68                         m_newFromFileAction.setEnabled( false );
    69                         m_newFromClipAction.setEnabled( false );
    70                 }
    71                
    72                 // Listen to layers
    73                 Layer.listeners.add( this );
    74                
    75         }
    76        
     41    // Plugin menu
     42    private JMenu m_menu = null;
     43
     44    // Toolbar buttons
     45    private IconToggleButton m_movePictureButton = null;
     46    private IconToggleButton m_rotatePictureButton = null;
     47    private IconToggleButton m_scalexPictureButton = null;
     48    private IconToggleButton m_scaleyPictureButton = null;
     49    private IconToggleButton m_scalexyPictureButton = null;
     50
     51    // Menu actions
     52    private NewLayerFromFileAction      m_newFromFileAction = null;
     53    private NewLayerFromClipboardAction m_newFromClipAction = null;
     54
     55    /**
     56     * Constructor...
     57     */
     58    public PicLayerPlugin() {
     59
     60        // Create menu entry
     61        if ( Main.main.menu != null ) {
     62            m_menu = Main.main.menu.addMenu(tr("PicLayer") , KeyEvent.VK_I, Main.main.menu.defaultMenuPos, ht("/Plugin/PicLayer"));
     63        }
     64
     65        // Add menu items
     66        if ( m_menu != null ) {
     67            m_menu.add( m_newFromFileAction = new NewLayerFromFileAction() );
     68            m_menu.add( m_newFromClipAction = new NewLayerFromClipboardAction() );
     69            m_menu.addSeparator();
     70            m_menu.add( new HelpAction() );
     71            m_newFromFileAction.setEnabled( false );
     72            m_newFromClipAction.setEnabled( false );
     73        }
     74
     75        // Listen to layers
     76        Layer.listeners.add( this );
     77
     78    }
     79
    7780    /**
    7881     * Called when the map is created. Creates the toolbar buttons.
     
    8083    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    8184        if(newFrame != null) {
    82                 // Create plugin map modes
    83                 MovePictureAction movePictureAction = new MovePictureAction(newFrame);
    84                 RotatePictureAction rotatePictureAction = new RotatePictureAction(newFrame);
    85                 ScaleXYPictureAction scaleXYPictureAction = new ScaleXYPictureAction(newFrame);
    86                 ScaleXPictureAction scaleXPictureAction = new ScaleXPictureAction(newFrame);
    87                 ScaleYPictureAction scaleYPictureAction = new ScaleYPictureAction(newFrame);
    88                 // Create plugin buttons and add them to the toolbar
    89                 m_movePictureButton = new IconToggleButton(movePictureAction);
     85            // Create plugin map modes
     86            MovePictureAction movePictureAction = new MovePictureAction(newFrame);
     87            RotatePictureAction rotatePictureAction = new RotatePictureAction(newFrame);
     88            ScaleXYPictureAction scaleXYPictureAction = new ScaleXYPictureAction(newFrame);
     89            ScaleXPictureAction scaleXPictureAction = new ScaleXPictureAction(newFrame);
     90            ScaleYPictureAction scaleYPictureAction = new ScaleYPictureAction(newFrame);
     91            // Create plugin buttons and add them to the toolbar
     92            m_movePictureButton = new IconToggleButton(movePictureAction);
    9093            m_rotatePictureButton = new IconToggleButton(rotatePictureAction);
    9194            m_scalexyPictureButton = new IconToggleButton(scaleXYPictureAction);
     
    109112    }
    110113
    111         /**
    112         * The toolbar buttons shall be active only when the PicLayer is active.
    113         */
    114         public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    115         }
     114    /**
     115    * The toolbar buttons shall be active only when the PicLayer is active.
     116    */
     117    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
     118    }
    116119
    117         /**
    118         * The menu is enabled once another layer is first created. This is needed
    119         * because the picture must be positioned based on the current mapview (so
    120         * one must exist first). User should not be able to load a picture too early.
    121         */
    122         public void layerAdded(Layer arg0) {
    123                 m_newFromFileAction.setEnabled( true );
    124                 m_newFromClipAction.setEnabled( true );
    125         }
     120    /**
     121    * The menu is enabled once another layer is first created. This is needed
     122    * because the picture must be positioned based on the current mapview (so
     123    * one must exist first). User should not be able to load a picture too early.
     124    */
     125    public void layerAdded(Layer arg0) {
     126        m_newFromFileAction.setEnabled( true );
     127        m_newFromClipAction.setEnabled( true );
     128    }
    126129
    127         /**
    128          * When all layers are gone - the menu is gone too.
    129          */
    130         public void layerRemoved(Layer arg0) {
    131                 boolean enable = Main.map.mapView.getAllLayers().size() != 0;
    132                 m_newFromFileAction.setEnabled( enable );
    133                 m_newFromClipAction.setEnabled( enable );
    134         }       
    135        
     130    /**
     131     * When all layers are gone - the menu is gone too.
     132     */
     133    public void layerRemoved(Layer arg0) {
     134        boolean enable = Main.map.mapView.getAllLayers().size() != 0;
     135        m_newFromFileAction.setEnabled( enable );
     136        m_newFromClipAction.setEnabled( enable );
     137    }
    136138};
Note: See TracChangeset for help on using the changeset viewer.