Skip to content

Commit

Permalink
2024.07.11 (1.54k10; Recorder)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasband committed Jul 2, 2024
1 parent b9b7f93 commit 0abfe3e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ij/ImageJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class ImageJ extends Frame implements ActionListener,

/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
public static final String VERSION = "1.54k";
public static final String BUILD = "10";
public static final String BUILD = "11";
public static Color backgroundColor = new Color(237,237,237);
/** SansSerif, 12-point, plain font. */
public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);
Expand Down
14 changes: 9 additions & 5 deletions ij/plugin/frame/Recorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Recorder extends PlugInFrame implements PlugIn, ActionListener, Ima
private TextField fileName;
private static Vector<Thread> notRecordingThreads = new Vector<Thread>();
private String fitTypeStr = CurveFitter.fitList[0];
private static TextArea textArea = new TextArea(); //recorded code goes here (start with dummy to avoid NullPointerException)
private static TextArea textArea;
private static Recorder instance;
private static String commandName;
private static String commandOptions;
Expand Down Expand Up @@ -135,7 +135,8 @@ public static void resumeRecording() {
* whether the Macro Recorder is open and recording is not suspended
* for the current thread.*/
private static boolean recordingEnabled() {
if (getInstance() == null) return false;
if (getInstance()==null || textArea==null)
return false;
return !notRecordingThreads.contains(Thread.currentThread());
}

Expand Down Expand Up @@ -279,7 +280,8 @@ public static void record(String method, int a1, int a2, int a3) {
}

public static void record(String method, String a1, int a2) {
textArea.append(method+"(\""+a1+"\", "+a2+");\n");
if (recordingEnabled())
textArea.append(method+"(\""+a1+"\", "+a2+");\n");
}

public static void record(String method, String args, int a1, int a2) {
Expand Down Expand Up @@ -786,6 +788,8 @@ public static void resetCommandOptions() {
}

void createMacro() {
if (!recordingEnabled())
return;
String text = textArea.getText();
if (text==null || text.equals("")) {
IJ.showMessage("Recorder", "A macro cannot be created until at least\none command has been recorded.");
Expand Down Expand Up @@ -918,7 +922,7 @@ public void imageOpened(ImagePlus imp) { }
public void imageClosed(ImagePlus imp) { }

void runCode() {
if (instance==null)
if (instance==null || !recordingEnabled())
return;
String name = fileName.getText();
if (name==null)
Expand Down Expand Up @@ -991,7 +995,7 @@ record = false;
}

public String getText() {
return textArea.getText();
return recordingEnabled()?textArea.getText():"";
}

public static Recorder getInstance() {
Expand Down
2 changes: 1 addition & 1 deletion release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>

<li> <u>1.54k10 2 July 2024</u>
<li> <u>1.54k11 2 July 2024</u>
<ul>
<li> Thanks to Bram van den Broek, the <i>Image&gt;Duplicate</i>
command enables the "Ignore Selection" option when the ROI is
Expand Down

1 comment on commit 0abfe3e

@imagesc-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/headless-issue-since-imagej-1-54i12/98569/4

Please sign in to comment.