Skip to content

Commit 7257bdd

Browse files
committed
2024.12.05 (1.54m; Release version)
1 parent af2a85e commit 7257bdd

File tree

12 files changed

+48
-51
lines changed

12 files changed

+48
-51
lines changed

functions.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3642,6 +3642,13 @@ <h1>Built-in Macro Functions</h1>
36423642
Sets the selection stroke width.
36433643
<br>
36443644

3645+
<a name="Roi.setMinStrokeWidth"></a>
3646+
<b>Roi.setMinStrokeWidth(minWidth)</b><br>
3647+
Sets the minimum scaled stroke width
3648+
(<a href="http://wsr.imagej.net/macros/Polygons.ijm">example</a>).
3649+
Requires 1.54m.
3650+
<br>
3651+
36453652
<a name="Roi.setUnscalableStrokeWidth"></a>
36463653
<b>Roi.setUnscalableStrokeWidth(width)</b><br>
36473654
Sets the width of the line used to draw this
@@ -4595,6 +4602,11 @@ <h1>Built-in Macro Functions</h1>
45954602
to 8-bit and 16-bit are density calibrated when this
45964603
option is enabled, so results from measurements stay the same.
45974604
<br>
4605+
<a name="setOption_SetIJMenuBar"></a>
4606+
<b>setOption("SetIJMenuBar", boolean)</b><br>
4607+
Set the ImageJ menu bar on image window activation on Macs.
4608+
Requires 1.54m.
4609+
<br>
45984610
<a name="setOption_Show_All"></a>
45994611
<b>setOption("Show All", boolean)</b><br>
46004612
Enables/disables the the "Show All" mode in the ROI Manager.

ij/ImageJ.java

Lines changed: 2 additions & 2 deletions
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.54m";
82-
public static final String BUILD = "28";
82+
public static final String BUILD = ""; //37
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);
@@ -675,7 +675,7 @@ public void windowActivated(WindowEvent e) {
675675
if (IJ.isMacintosh() && !quitting) {
676676
IJ.wait(10); // may be needed for Java 1.4 on OS X
677677
MenuBar mb = Menus.getMenuBar();
678-
if (mb!=null && mb!=getMenuBar()) {
678+
if (mb!=null && mb!=getMenuBar() && !IJ.isMacro()) {
679679
setMenuBar(mb);
680680
Menus.setMenuBarCount++;
681681
//if (IJ.debugMode) IJ.log("setMenuBar: "+Menus.setMenuBarCount);

ij/Prefs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public class Prefs {
166166
public static boolean autoRunExamples = true;
167167
/** Ignore stack positions when displaying points. */
168168
public static boolean showAllPoints;
169-
/** Set MenuBar on Macs running Java 8. */
169+
/** Set ImageJ menu bar on image window activation on Macs. */
170170
public static boolean setIJMenuBar = IJ.isMacOSX();
171171
/** "ImageJ" window is always on top. */
172172
public static boolean alwaysOnTop;

ij/gui/ImageWindow.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ public void focusGained(FocusEvent e) {
601601

602602
public void windowActivated(WindowEvent e) {
603603
if (IJ.debugMode) IJ.log("windowActivated: "+imp.getTitle());
604-
if (IJ.isMacOSX())
604+
if (IJ.isMacOSX() && Prefs.setIJMenuBar && !IJ.isMacro())
605605
setImageJMenuBar(this);
606606
if (imp==null)
607607
return;
@@ -753,14 +753,13 @@ public static void setImageJMenuBar(ImageWindow win) {
753753
if (mb!=null && mb==win.getMenuBar())
754754
setMenuBar = false;
755755
setMenuBarTime = 0L;
756-
if (setMenuBar && ij!=null && !ij.quitting() && !Interpreter.nonBatchMacroRunning()) {
756+
if (setMenuBar && ij!=null && !ij.quitting()) {
757757
IJ.wait(10); // may be needed for Java 1.4 on OS X
758758
long t0 = System.currentTimeMillis();
759759
win.setMenuBar(mb);
760760
long time = System.currentTimeMillis()-t0;
761761
setMenuBarTime = time;
762762
Menus.setMenuBarCount++;
763-
//if (IJ.debugMode) IJ.log("setMenuBar: "+time+"ms ("+Menus.setMenuBarCount+")");
764763
if (time>2000L)
765764
Prefs.setIJMenuBar = false;
766765
}

ij/macro/Functions.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,6 @@ private void selectWindow() {
715715
}
716716
IJ.selectWindow(title);
717717
resetImage();
718-
interp.selectCount++;
719718
}
720719

721720
void setForegroundColor() {
@@ -3234,7 +3233,6 @@ void selectImage() {
32343233
interp.getRightParen();
32353234
}
32363235
resetImage();
3237-
interp.selectCount++;
32383236
}
32393237

32403238
void selectImage(String title) {

ij/macro/Interpreter.java

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public class Interpreter implements MacroConstants {
6363
int loopDepth;
6464
static boolean tempShowMode;
6565
boolean waitingForUser;
66-
int selectCount;
6766

6867
static TextWindow arrayWindow;
6968
int inspectStkIndex = -1;
@@ -1975,8 +1974,6 @@ private String runStringFunction(String str) {
19751974
str = ""+str.length();
19761975
} else if (tokenString.equals("contains")) {
19771976
str = ""+str.contains(func.getStringArg());
1978-
} else if (tokenString.equals("charAt")) {
1979-
str = ""+str.charAt((int)func.getArg());
19801977
} else if (tokenString.equals("replaceAll")) {
19811978
str = func.replace(str);
19821979
} else
@@ -2000,6 +1997,11 @@ private String runStringFunction(String str) {
20001997
case TO_UPPER_CASE: getParens(); str = str.toUpperCase(Locale.US); break;
20011998
case REPLACE: str = func.replace(str); break;
20021999
case TRIM: getParens(); str = str.trim(); break;
2000+
case CHARAT:
2001+
int index = (int)func.getArg();
2002+
func.checkIndex(index, 0, str.length()-1);
2003+
str = ""+str.charAt(index);
2004+
break;
20032005
default:
20042006
str = null;
20052007
}
@@ -2094,11 +2096,6 @@ void finishUp() {
20942096
}
20952097
if (func.unUpdatedTable!=null)
20962098
func.unUpdatedTable.show(func.unUpdatedTable.getTitle());
2097-
if (IJ.isMacOSX() && selectCount>0 && debugger==null) {
2098-
Frame frame = WindowManager.getFrontWindow();
2099-
if (frame!=null && (frame instanceof ImageWindow))
2100-
ImageWindow.setImageJMenuBar((ImageWindow)frame);
2101-
}
21022099
}
21032100

21042101
/** Aborts currently running macro. */
@@ -2519,18 +2516,7 @@ static void setTempShowMode(boolean mode) {
25192516
}
25202517

25212518
private static Interpreter lastInterp;
2522-
2523-
public static boolean nonBatchMacroRunning() {
2524-
Interpreter interp = getInstance();
2525-
if (interp==null)
2526-
return false;
2527-
int count = interp.selectCount;
2528-
if (interp==lastInterp)
2529-
interp.selectCount++;
2530-
lastInterp = interp;
2531-
return !interp.waitingForUser && interp.debugger==null && count>0 && !isBatchMode();
2532-
}
2533-
2519+
25342520
public void setApplyMacroTable(ResultsTable rt) {
25352521
applyMacroTable = rt;
25362522
}

ij/macro/MacroConstants.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,20 @@ public interface MacroConstants {
112112
TO_LOWER_CASE=2011, TO_UPPER_CASE=2012, RUN_MACRO=2013, EVAL=2014, TO_STRING=2015, REPLACE=2016,
113113
DIALOG=2017, GET_METADATA=2018, FILE=2019, SELECTION_NAME=2020, GET_VERSION=2021, GET_RESULT_LABEL=2022,
114114
CALL=2023, STRING=2024, EXT=2025, EXEC=2026, LIST=2027, DEBUG=2028, IJ_CALL=2029, GET_RESULT_STRING=2030,
115-
GET_DIR=2031, TRIM=2032;
115+
GET_DIR=2031, TRIM=2032, CHARAT=2033;
116116

117117
static final String[] stringFunctions = {"d2s", "toHex", "toBinary", "getTitle", "getString", "substring",
118118
"fromCharCode", "getInfo", "getDirectory", "getArgument", "getImageInfo",
119119
"toLowerCase", "toUpperCase", "runMacro", "eval", "toString", "replace",
120120
"Dialog", "getMetadata", "File", "selectionName", "getVersion", "getResultLabel",
121121
"call", "String", "Ext", "exec", "List", "debug", "IJ", "getResultString",
122-
"getDir", "trim"};
122+
"getDir", "trim", "charAt"};
123123
static final int[] stringFunctionIDs = {D2S, TO_HEX, TO_BINARY, GET_TITLE, GET_STRING, SUBSTRING,
124124
FROM_CHAR_CODE, GET_INFO, GET_DIRECTORY, GET_ARGUMENT, GET_IMAGE_INFO,
125125
TO_LOWER_CASE, TO_UPPER_CASE, RUN_MACRO, EVAL, TO_STRING, REPLACE,
126126
DIALOG, GET_METADATA, FILE, SELECTION_NAME, GET_VERSION, GET_RESULT_LABEL,
127127
CALL, STRING, EXT, EXEC, LIST, DEBUG, IJ_CALL, GET_RESULT_STRING,
128-
GET_DIR, TRIM};
128+
GET_DIR, TRIM, CHARAT};
129129

130130
// Array functions
131131
static final int GET_PROFILE=3000, NEW_ARRAY=3001, SPLIT=3002, GET_FILE_LIST=3003,

ij/plugin/BatchProcessor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import ij.process.*;
44
import ij.gui.*;
55
import ij.util.Tools;
6+
import ij.util.StringSorter;
67
import ij.io.*;
78
import ij.macro.Interpreter;
89
import java.awt.*;
@@ -189,6 +190,7 @@ void processFolder(String inputPath, String outputPath) {
189190
list = FolderOpener.getFilteredList(list, filter, "Batch Processor");
190191
if (list==null)
191192
return;
193+
StringSorter.sort(list);
192194
int index = 0;
193195
int startingCount = WindowManager.getImageCount();
194196
for (int i=0; i<list.length; i++) {

ij/plugin/CommandFinder.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,15 @@ public void mouseClicked(MouseEvent e) {
163163
long now = System.currentTimeMillis();
164164
int row = table.getSelectedRow();
165165
int col = table.getSelectedColumn();
166+
IJ.wait(10);
166167
// Display cell contents in status bar
167168
if (tableModel==null)
168169
return;
169-
String value = tableModel.getValueAt(row, col).toString();
170-
IJ.showStatus(value);
170+
String value = (String)tableModel.getValueAt(row, col);
171+
if (value!=null)
172+
IJ.showStatus(value);
173+
else
174+
IJ.showStatus("");
171175
// Is this fast enough to be a double-click?
172176
long thisClickInterval = now - lastClickTime;
173177
if (thisClickInterval < multiClickInterval) {
@@ -636,8 +640,6 @@ private void closeWindow() {
636640
}
637641

638642
public void windowActivated(WindowEvent e) {
639-
if (IJ.isMacOSX() && frame != null && Prefs.setIJMenuBar)
640-
frame.setMenuBar(Menus.getMenuBar());
641643
}
642644

643645
public void windowDeactivated(WindowEvent e) {

ij/plugin/frame/PlugInFrame.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ public void close() {
4343
}
4444

4545
public void windowActivated(WindowEvent e) {
46-
if (Prefs.setIJMenuBar) {
47-
this.setMenuBar(Menus.getMenuBar());
48-
Menus.setMenuBarCount++;
49-
}
5046
WindowManager.setWindow(this);
5147
}
5248

0 commit comments

Comments
 (0)