Skip to content

Commit 0abfe3e

Browse files
committed
2024.07.11 (1.54k10; Recorder)
1 parent b9b7f93 commit 0abfe3e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

ij/ImageJ.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class ImageJ extends Frame implements ActionListener,
7979

8080
/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
8181
public static final String VERSION = "1.54k";
82-
public static final String BUILD = "10";
82+
public static final String BUILD = "11";
8383
public static Color backgroundColor = new Color(237,237,237);
8484
/** SansSerif, 12-point, plain font. */
8585
public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);

ij/plugin/frame/Recorder.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class Recorder extends PlugInFrame implements PlugIn, ActionListener, Ima
3030
private TextField fileName;
3131
private static Vector<Thread> notRecordingThreads = new Vector<Thread>();
3232
private String fitTypeStr = CurveFitter.fitList[0];
33-
private static TextArea textArea = new TextArea(); //recorded code goes here (start with dummy to avoid NullPointerException)
33+
private static TextArea textArea;
3434
private static Recorder instance;
3535
private static String commandName;
3636
private static String commandOptions;
@@ -135,7 +135,8 @@ public static void resumeRecording() {
135135
* whether the Macro Recorder is open and recording is not suspended
136136
* for the current thread.*/
137137
private static boolean recordingEnabled() {
138-
if (getInstance() == null) return false;
138+
if (getInstance()==null || textArea==null)
139+
return false;
139140
return !notRecordingThreads.contains(Thread.currentThread());
140141
}
141142

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

281282
public static void record(String method, String a1, int a2) {
282-
textArea.append(method+"(\""+a1+"\", "+a2+");\n");
283+
if (recordingEnabled())
284+
textArea.append(method+"(\""+a1+"\", "+a2+");\n");
283285
}
284286

285287
public static void record(String method, String args, int a1, int a2) {
@@ -786,6 +788,8 @@ public static void resetCommandOptions() {
786788
}
787789

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

920924
void runCode() {
921-
if (instance==null)
925+
if (instance==null || !recordingEnabled())
922926
return;
923927
String name = fileName.getText();
924928
if (name==null)
@@ -991,7 +995,7 @@ record = false;
991995
}
992996

993997
public String getText() {
994-
return textArea.getText();
998+
return recordingEnabled()?textArea.getText():"";
995999
}
9961000

9971001
public static Recorder getInstance() {

release-notes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</head>
66
<body>
77

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

0 commit comments

Comments
 (0)