public static void record(String command, final String... args) { command = "call(\"ij3d.ImageJ3DViewer." + command; for (int i = 0; i < args.length; i++) command += "\", \"" + args[i]; command += "\");\n"; if (Recorder.record) Recorder.recordString(command); }
public static void recordReset() { if(Recorder.record) { Recorder.setCommand(SHOW_TABLE_COMMAND); Recorder.recordOption(ACTION_KEY, RESET); Recorder.saveCommand(); } }
public void recordMacro() { if(Recorder.record) { String oldCommand = Recorder.getCommand(); Recorder.setCommand("Show results table"); Recorder.recordOption("action", getMacroName()); params.recordMacroOptions(); Recorder.saveCommand(); Recorder.setCommand(oldCommand); } }
private void record() { if (Recorder.record) { Boolean state = ImageConverter.getDoScaling(); if (Recorder.scriptMode()) Recorder.recordCall("ImageConverter.setDoScaling("+state+");", true); else Recorder. recordString("setOption(\"ScaleConversions\", "+state+");\n"); } }
protected void handleMouseUp(int screenX, int screenY) { nPoints = 4; state = NORMAL; if (Recorder.record) { double[] p = getParams(); if (Recorder.scriptMode()) Recorder.recordCall("imp.setRoi(new RotatedRectRoi("+(int)p[0]+","+(int)p[1]+","+(int)p[2]+","+(int)p[3]+","+(int)p[4]+"));"); else Recorder.record("makeRotatedRectangle", (int)p[0], (int)p[1], (int)p[2], (int)p[3], (int)p[4]); } }
void recordAdd(Color color, int lineWidth) { if (Recorder.scriptMode()) Recorder.recordCall("rm.addRoi(imp.getRoi());"); else if (color!=null && lineWidth==1) Recorder.recordString("roiManager(\"Add\", \""+getHex(color)+"\");\n"); else if (lineWidth>1) Recorder.recordString("roiManager(\"Add\", \""+getHex(color)+"\", "+lineWidth+");\n"); else Recorder.record("roiManager", "Add"); }
if (Recorder.scriptMode()) Recorder.recordString("IJ.deleteRows("+selStart+", "+selEnd+");\n"); else { if ("Results".equals(title)) Recorder.record("Table.deleteRows", selStart, selEnd); else Recorder.record("Table.deleteRows", selStart, selEnd, title);
/** Customizes macro recordings */ public static final void improveRecording() { if (Recorder.record) { String recordString = "// Recording Sholl Analysis version " + ShollUtils.version() + "\n" + "// Visit " + ShollUtils.URL + "#Batch_Processing for scripting tips\n"; final String cmd = Recorder.getCommand(); final String cmdOptions = Recorder.getCommandOptions(); if (cmd == null || cmdOptions == null) { recordString += "// NB: Commands dismissing prompts (such the ones in the \"More\u00bb\" dropdown menu) may not\n" + "// record properly. You may need to repeat recording if recorded instruction is invalid\n"; } Recorder.recordString(recordString); } }
void closeImage(ImagePlus imp) { if (imp==null) { IJ.noImage(); return; } imp.close(); if (Recorder.record && !IJ.isMacro()) { if (Recorder.scriptMode()) Recorder.recordCall("imp.close();"); else Recorder.record("close"); Recorder.setCommand(null); // don't record run("Close") } }
void runThresholdCommand() { Thresholder.setMethod(method); Thresholder.setBackground(darkBackground.getState()?"Dark":"Light"); if (Recorder.record) { Recorder.setCommand("Convert to Mask"); (new Thresholder()).run("mask"); Recorder.saveCommand(); } else (new Thresholder()).run("mask"); }
private void recordOption(Object component, String value) { String label = (String)labels.get(component); if (value.equals("")) value = "[]"; Recorder.recordOption(label, value); }
final String commandName = Recorder.getCommand(); final String commandOptions = Recorder.getCommandOptions(); if (commandName != null && commandOptions != null && commandOptions.contains("browse")) { Recorder.setCommand(commandName); return true;
/** Returns the contents of the next text area. */ public String getNextText() { String text = null; String key = "text1"; if (textAreaIndex==0 && textArea1!=null) { text = textArea1.getText(); if (macro) text = Macro.getValue(macroOptions, "text1", text); } else if (textAreaIndex==1 && textArea2!=null) { text = textArea2.getText(); if (macro) text = Macro.getValue(macroOptions, "text2", text); key = "text2"; } textAreaIndex++; if (recorderOn && text!=null) { String text2 = text; String cmd = Recorder.getCommand(); if (cmd!=null && cmd.equals("Calibrate...")) text2 = text2.replace('\n',' '); text2 = Recorder.fixString(text2); Recorder.recordOption(key, text2); } return text; }
if (s!=null&&s.length()>=3&&Character.isLetter(s.charAt(0))&&s.charAt(1)==':'&&s.charAt(2)=='\\') s = s.replaceAll("\\\\", "/"); // replace "\" with "/" in Windows file paths s = Recorder.fixString(s); if (!smartRecording || !s.equals((String)defaultStrings.elementAt(sfIndex))) recordOption(tf, s); else if (Recorder.getCommandOptions()==null) Recorder.recordOption(" ");
private void recordCheckboxOption(Checkbox cb) { String label = (String)labels.get((Object)cb); if (label!=null) { if (cb.getState()) // checked Recorder.recordOption(label); else if (Recorder.getCommandOptions()==null) Recorder.recordOption(" "); } }
public void mouseReleased(ImagePlus imp, MouseEvent e) { if (Recorder.record) { Roi roi = imp.getRoi(); int n = roi.getPolygon().npoints; if (n<=20 && roi.getType()!=Roi.LINE) Recorder.recordRoi(roi); else if (n>20) Recorder.recordString("// Selection has "+n+" points, too many to record.\n"); } }
public static void runNestedWithRecording(String command, String options){ String oldCommand = Recorder.getCommand(); Recorder.setCommand(command); Macro.setOptions(options); Executer ex = new Executer(command); ex.run(); Recorder.setCommand(oldCommand); } }
/** * Begins recording of a command. * * @see Recorder#setCommand(String) */ public void startRecording(final String command) { if (!Recorder.record) return; Recorder.setCommand(command); }
public static void setForegroundColor(Color c) { record("setForegroundColor", c.getRed(), c.getGreen(), c.getBlue()); fgColorSet = true; }
public DefaultOperation() { this.name = getName(); //dummy record the param options boolean oldRecording = Recorder.record; Recorder.record = true; params.recordMacroOptions(); options = Recorder.getCommandOptions(); if(!oldRecording) Recorder.saveCommand(); // remove from macro recorder if not recording! Recorder.record = oldRecording; }