/** Used by the MacroInstaller class to install a set of macro tools. */ public void addMacroTool(String name, MacroInstaller macroInstaller, int id) { if (id==0) { resetTools(); if (name.startsWith("Unused")) return; } if (name.endsWith(" Built-in Tool")) { name = name.substring(0,name.length()-14); doNotSavePrefs = true; boolean ok = installBuiltinTool(name); if (!ok) { Hashtable commands = Menus.getCommands(); if (commands!=null && commands.get(name)!=null) IJ.run(name); } doNotSavePrefs = false; return; } this.macroInstaller = macroInstaller; int tool = addTool(name); this.macroInstaller = null; if (tool!=-1) tools[tool] = new MacroToolRunner(macroInstaller); }
/** Used by the MacroInstaller class to install a set of macro tools. */ public void addMacroTool(String name, MacroInstaller macroInstaller, int id) { if (id==0) { resetTools(); if (name.startsWith("Unused")) return; } if (name.endsWith(" Built-in Tool")) { name = name.substring(0,name.length()-14); doNotSavePrefs = true; boolean ok = installBuiltinTool(name); if (!ok) { Hashtable commands = Menus.getCommands(); if (commands!=null && commands.get(name)!=null) IJ.run(name); } doNotSavePrefs = false; return; } this.macroInstaller = macroInstaller; int tool = addTool(name); this.macroInstaller = null; if (tool!=-1) tools[tool] = new MacroToolRunner(macroInstaller); }
/** Used by the MacroInstaller class to add a macro tool to the toolbar. */ public void addMacroTool(String name, MacroInstaller macroInstaller) { String custom1Name = names[CUSTOM1]; this.macroInstaller = macroInstaller; addingSingleTool = true; int tool = addTool(name); addingSingleTool = false; this.macroInstaller = null; if (tool!=-1) { tools[tool] = new MacroToolRunner(macroInstaller); if (!name.contains(" Menu Tool")) { if (menus[tool]!=null) menus[tool].removeAll(); if (!installingStartupTool) setTool(tool); else installingStartupTool = false; } if ((tool-CUSTOM1)>0 || custom1Name==null) setPrefs(tool); } }
/** Used by the MacroInstaller class to add a macro tool to the toolbar. */ public void addMacroTool(String name, MacroInstaller macroInstaller) { String custom1Name = names[CUSTOM1]; this.macroInstaller = macroInstaller; addingSingleTool = true; int tool = addTool(name); addingSingleTool = false; this.macroInstaller = null; if (tool!=-1) { tools[tool] = new MacroToolRunner(macroInstaller); if (!name.contains(" Menu Tool")) { if (menus[tool]!=null) menus[tool].removeAll(); if (!installingStartupTool) setTool(tool); else installingStartupTool = false; } if ((tool-CUSTOM1)>0 || custom1Name==null) setPrefs(tool); } }
/** Adds a plugin tool to the first available toolbar slot, or to the last slot if the toolbar is full. */ public static void addPlugInTool(PlugInTool tool) { if (instance==null) return; String nameAndIcon = tool.getToolName()+" - "+tool.getToolIcon(); instance.addingSingleTool = true; int id = instance.addTool(nameAndIcon); instance.addingSingleTool = false; if (id!=-1) { instance.tools[id] = tool; if (instance.menus[id]!=null) instance.menus[id].removeAll(); instance.repaintTool(id); if (!instance.installingStartupTool) instance.setTool(id); else instance.installingStartupTool = false; instance.setPrefs(id); } }
/** Adds a plugin tool to the first available toolbar slot, or to the last slot if the toolbar is full. */ public static void addPlugInTool(PlugInTool tool) { if (instance==null) return; String nameAndIcon = tool.getToolName()+" - "+tool.getToolIcon(); instance.addingSingleTool = true; int id = instance.addTool(nameAndIcon); instance.addingSingleTool = false; if (id!=-1) { instance.tools[id] = tool; if (instance.menus[id]!=null) instance.menus[id].removeAll(); instance.repaintTool(id); if (!instance.installingStartupTool) instance.setTool(id); else instance.installingStartupTool = false; instance.setPrefs(id); } }
Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) );
Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) );
Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Select_a_Feature" ) );
Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Select_a_Feature" ) );
@Override public void run( final String arg ) { /* cleanup */ m.clear(); imp = IJ.getImage(); target = imp.getProcessor(); source = target.duplicate(); source.setInterpolationMethod( ImageProcessor.BILINEAR ); init(); createMapping(); painter = new MappingThread( imp, source, target, pleaseRepaint, mapping, interpolate ); painter.start(); Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) ); imp.getCanvas().addMouseListener( this ); imp.getCanvas().addMouseMotionListener( this ); imp.getCanvas().addKeyListener( this ); imp.getWindow().addKeyListener( this ); IJ.getInstance().addKeyListener( this ); }
Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Drag_the_handles." ) );
Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Drag_the_handles." ) );
@Override public void run( final String arg ) { /* cleanup */ m.clear(); imp = IJ.getImage(); target = imp.getProcessor(); source = target.duplicate(); source.setInterpolationMethod( ImageProcessor.BILINEAR ); init(); createMapping(); painter = new MappingThread( imp, source, target, pleaseRepaint, mapping, interpolate ); painter.start(); Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) ); imp.getCanvas().addMouseListener( this ); imp.getCanvas().addMouseMotionListener( this ); imp.getCanvas().addKeyListener( this ); imp.getWindow().addKeyListener( this ); IJ.getInstance().addKeyListener( this ); }
toolID = toolbar.addTool(getToolName() + " - " + getToolIcon()); if (toolID < 0 && clearToolsIfNecessary) { int previousID = toolbar.getToolId();