Skip to content

Commit

Permalink
2024.06.15 (1.54k3; RoiManager rename)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasband committed Jun 15, 2024
1 parent 8fa08fa commit af59443
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 17 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 = "1";
public static final String BUILD = "3";
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
11 changes: 8 additions & 3 deletions ij/gui/GenericDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -2027,17 +2027,23 @@ public BrowseButtonListener(String label, TextField textField, String mode) {

public void actionPerformed(ActionEvent e) {
String path = null;
String dialogTitle = label;
if (dialogTitle == null || dialogTitle.length() == 0)
dialogTitle = mode.equals("dir") ? "a Folder" : "a File";
else if (dialogTitle.endsWith(":")) //remove trailing colon
dialogTitle = dialogTitle.substring(0, dialogTitle.length() - 1);
dialogTitle = "Select " + dialogTitle;
if (mode.equals("dir")) {
String saveDefaultDir = OpenDialog.getDefaultDirectory();
String dir = this.textField.getText();
boolean setDefaultDir = dir!=null && !dir.equals("");
if (setDefaultDir)
OpenDialog.setDefaultDirectory(dir);
path = IJ.getDir("Select a Folder");
path = IJ.getDir(dialogTitle);
if (setDefaultDir)
OpenDialog.setDefaultDirectory(saveDefaultDir);
} else {
OpenDialog od = new OpenDialog("Select a File", null);
OpenDialog od = new OpenDialog(dialogTitle, null);
String directory = od.getDirectory();
String name = od.getFileName();
if (name!=null)
Expand All @@ -2049,7 +2055,6 @@ public void actionPerformed(ActionEvent e) {
this.textField.setText(path);
}
}

}

private class TrimmedTextField extends TextField {
Expand Down
2 changes: 2 additions & 0 deletions ij/io/DirectoryChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ public DirectoryChooser(String title) {
if (macroOptions!=null)
directory = Macro.getValue(macroOptions, title, null);
if (directory==null) {
IJ.showStatus(title);
if (EventQueue.isDispatchThread())
getDirectoryUsingJFileChooserOnThisThread(title);
else
getDirectoryUsingJFileChooser(title);
IJ.showStatus("");
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions ij/io/OpenDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ public OpenDialog(String title, String path) {
path = lookupPathVariable(path);
}
if (path==null || path.equals("")) {
IJ.showStatus(title);
if (Prefs.useJFileChooser)
jOpen(title, getDefaultDirectory(), null);
else
open(title, getDefaultDirectory(), null);
IJ.showStatus("");
if (name!=null)
setDefaultDirectory(dir);
this.title = title;
Expand Down
2 changes: 2 additions & 0 deletions ij/io/SaveDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ public SaveDialog(String title, String defaultName, String extension) {
return;
String defaultDir = OpenDialog.getDefaultDirectory();
defaultName = setExtension(defaultName, extension);
IJ.showStatus(title);
if (Prefs.useJFileChooser)
jSave(title, defaultDir, defaultName);
else
save(title, defaultDir, defaultName);
IJ.showStatus("");
if (name!=null && dir!=null)
OpenDialog.setDefaultDirectory(dir);
IJ.showStatus(title+": "+dir+name);
Expand Down
15 changes: 4 additions & 11 deletions ij/plugin/frame/RoiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class RoiManager extends PlugInFrame implements ActionListener, ItemListe
private static final int DRAW=0, FILL=1, LABEL=2;
private static final int SHOW_ALL=0, SHOW_NONE=1, LABELS=2, NO_LABELS=3;
private static final int MENU=0, COMMAND=1;
private static final int IGNORE_POSITION=-999; // ignore the ROI's built in position
private static final int CHANNEL=0, SLICE=1, FRAME=2, SHOW_DIALOG=3;
private static int rows = 15;
private static int lastNonShiftClick = -1;
Expand Down Expand Up @@ -362,7 +361,7 @@ public void addRoi(Roi roi) {
}

boolean addRoi(boolean promptForName) {
return addRoi(null, promptForName, null, IGNORE_POSITION);
return addRoi(null, promptForName, null, -1);
}

boolean addRoi(Roi roi, boolean promptForName, Color color, int lineWidth) {
Expand All @@ -384,18 +383,13 @@ boolean addRoi(Roi roi, boolean promptForName, Color color, int lineWidth) {
color = roi.getStrokeColor();
else if (color==null && defaultColor!=null)
color = defaultColor;
boolean ignorePosition = false;
if (lineWidth==IGNORE_POSITION) {
ignorePosition = true;
lineWidth = -1;
}
if (lineWidth<0) {
int sw = (int)roi.getStrokeWidth();
lineWidth = sw>1?sw:defaultLineWidth;
}
if (lineWidth>100) lineWidth = 1;
int n = getCount();
int position = imp!=null&&!ignorePosition?roi.getPosition():0;
int position = imp!=null?roi.getPosition():0;
int saveCurrentSlice = imp!=null?imp.getCurrentSlice():0;
if (position>0 && position!=saveCurrentSlice) {
if (imp.lock())
Expand Down Expand Up @@ -437,10 +431,9 @@ else if (color==null && defaultColor!=null)
listModel.addElement(label);
roi.setName(label);
Roi roiCopy = (Roi)roi.clone();
if (ignorePosition && imp!=null && imp.getStackSize()>1 && imp.getWindow()!=null && isVisible()) {
// set ROI position to current stack position if image and RoiManager are visible
// set ROI position to current stack position if image and RoiManager are visible
if (imp!=null && imp.getStackSize()>1 && imp.getWindow()!=null && isVisible())
roiCopy.setPosition(imp);
}
if (lineWidth>1)
roiCopy.setStrokeWidth(lineWidth);
if (color!=null)
Expand Down
10 changes: 8 additions & 2 deletions release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
</head>
<body>

<li> <u>1.54k1 13 June 2024</u>
<li> <u>1.54k3 15 June 2024</u>
<ul>
<li> Thanks to Michael Schmid, file dialogs show the
prompt in the status bar, a work around on Macs where
file dialogs do not have titles.
<li> Thanks to 'odinsbane', fixed bug with FolderOpener
(<i>File&gt;Import&gt;Image Sequence</i>) only using the
first FileInfo from tiff stacks.
first FileInfo from tiff stacks.
<li> Thanks to Michael Nonet and Guenter Pudmich, fixed bug
with the roiManager("rename",name) macro function causing the
stack position to be lost.
</ul>

<li> <u>1.54j 12 June 2024</u>
Expand Down

0 comments on commit af59443

Please sign in to comment.