// License: GPL. Copyright 2009 by Mike Nice and others
//package org.openstreetmap.josm.plugins.AddrInterpolation;
package simpleaddrinterpolation;

import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.gui.IconToggleButton;
import org.openstreetmap.josm.gui.MapFrame;
import org.openstreetmap.josm.plugins.Plugin;
import org.openstreetmap.josm.plugins.PluginInformation;

public class SimpleAddrInterpolationPlugin extends Plugin
{

    SimpleAddrInterpolationAction action;
//    private final IconToggleButton btn;

    public SimpleAddrInterpolationPlugin(PluginInformation info)
    {
        super(info);
        action = new SimpleAddrInterpolationAction();
        Main.main.menu.toolsMenu.add(action);
        action.setEnabled(true);

//        btn = new IconToggleButton(new SimpleAddrInterpolationMode(Main.map));
//        btn.setVisible(true);


    }
    
        @Override
    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
         if (oldFrame == null && newFrame != null) {
//            Main.map.addMapMode(btn);
//            Main.map.setVisible(true);
//            Main.map.mapView.repaint();
             Main.map.addMapMode(new IconToggleButton(new SimpleAddrInterpolationMode(Main.map)));
             Main.map.setVisible(true);
             Main.map.mapMode.setEnabled(true);
        }
    }

}