Skip to content

Commit

Permalink
integrate changes from 1.53g3
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Oct 28, 2020
1 parent ba0a59c commit 47556f9
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 41 deletions.
5 changes: 3 additions & 2 deletions compile-js-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

set -e

IJ_JAR="ij-1.53e.jar"
IJ_JAR="ij-1.53f.jar"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

mvn clean
mvn install:install-file -Dfile=${CHEERPJ_DIR}/cheerpj-dom.jar -DgroupId=com.learningtech -DartifactId=cheerpj-dom -Dversion=1.0 -Dpackaging=jar
mvn -Pdeps package
mvn package
cp target/${IJ_JAR} ${IJ_DIR}/

cd ${IJ_DIR}
Expand Down
4 changes: 2 additions & 2 deletions compile-js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ fi

# compile imagej
mvn install:install-file -Dfile=${CHEERPJ_DIR}/cheerpj-dom.jar -DgroupId=com.learningtech -DartifactId=cheerpj-dom -Dversion=1.0 -Dpackaging=jar
mvn -Pdeps package
mvn package


mkdir -p imagej-js-dist
cd imagej-js-dist

# download ij153 from imagej.net
export IJ1_VERSION=ij153
export IJ_JAR=ij-1.53e.jar
export IJ_JAR=ij-1.53f.jar

curl http://wsr.imagej.net/distros/cross-platform/${IJ1_VERSION}.zip -LO
unzip -q -o ${IJ1_VERSION}.zip
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@
<!-- compile everything to ensure module-info contains right entries -->
<!-- required when JAVA_HOME is JDK 8 or below -->
<jdkToolchain>
<version>9</version>
<version>8</version>
</jdkToolchain>
<!-- Exclude MacAdapter because it requires internal packages -->
<excludes>
<exclude>**/MacAdapter.java</exclude>
</excludes>
<release>9</release>
</configuration>
</execution>
<execution>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ij/IJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ retrieved in the called macro using the getArgument() macro
function. Returns any string value returned by the macro, null
if the macro does not return a value, or "[aborted]" if the
macro was aborted due to an error. */
public static String runMacro(String macro, String arg) {
public static String runMacro(final String macro, final String arg) {
if(EventQueue.isDispatchThread()){
Macro_Runner mr = new Macro_Runner();
return mr.runMacro(macro, arg);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ij/ImagePlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ public void setTitle(String title) {
if (title==null)
return;
if (win!=null) {
if (ij!=null)
if (ij!=null && !title.equals(this.title))
Menus.updateWindowMenuItem(this, this.title, title);
String virtual = stack!=null && stack.isVirtual()?" (V)":"";
String global = getGlobalCalibration()!=null?" (G)":"";
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/ij/Menus.java
Original file line number Diff line number Diff line change
Expand Up @@ -1423,12 +1423,13 @@ public static synchronized void updateWindowMenuItem(ImagePlus imp, String oldLa
for (int i=first; i<count; i++) {
MenuItem item = window.getItem(i);
String label = item.getLabel();
String cmd = item.getActionCommand();
if (imp!=null) { //remove size (e.g. " 24MB")
int index = label.lastIndexOf(" ");
if (index>-1)
label = label.substring(0, index);
}
if (item!=null && label.equals(oldLabel)) {
if (item!=null && label.equals(oldLabel) && (imp==null||(""+imp.getID()).equals(cmd))) {
String size = "";
if (imp!=null)
size = " " + ImageWindow.getImageSize(imp);
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/ij/gui/ImageCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/** This is a Canvas used to display images in a Window. */
public class ImageCanvas extends Canvas implements MouseListener, MouseMotionListener, Cloneable {

private static final int LONG_PRESS_THRESHOLD = 750; //ms
private static final int LONG_CLICK_THRESHOLD = 750; //ms
protected static Cursor defaultCursor = new Cursor(Cursor.DEFAULT_CURSOR);
protected static Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
protected static Cursor moveCursor = new Cursor(Cursor.MOVE_CURSOR);
Expand Down Expand Up @@ -1230,7 +1230,8 @@ else if (!e.isAltDown()) {
}

if (pressTimer==null)
pressTimer = new java.util.Timer();
pressTimer = new java.util.Timer();
final Point cursorLoc = getCursorLoc();
pressTimer.schedule(new TimerTask() {
public void run() {
if (pressTimer != null) {
Expand All @@ -1245,13 +1246,14 @@ public void run() {
boolean unchanged = state!=Roi.MOVING_HANDLE && r1!=null && r2!=null && r2.x==r1.x
&& r2.y==r1.y && r2.width==r1.width && r2.height==r1.height && size2==size1
&& !(size2>1&&state==Roi.CONSTRUCTING);
boolean cursorMoved = !getCursorLoc().equals(cursorLoc);
//IJ.log(size2+" "+empty+" "+unchanged+" "+state+" "+roi1+" "+roi2);
if ((roi1==null && (size2<=1||empty)) || unchanged) {
if (roi1==null) imp.deleteRoi();
handlePopupMenu(e);
if (!cursorMoved) handlePopupMenu(e);
}
}
}, LONG_PRESS_THRESHOLD);
}, LONG_CLICK_THRESHOLD);

}

Expand Down
16 changes: 9 additions & 7 deletions src/main/java/ij/gui/Toolbar.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import java.awt.event.*;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.JPopupMenu;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
import java.io.File;
import java.util.*;
import ij.*;
Expand Down Expand Up @@ -42,7 +44,7 @@ public class Toolbar extends Canvas implements MouseListener, MouseMotionListene
public static final int CUSTOM7 = 21;

public static final int DOUBLE_CLICK_THRESHOLD = 650; //ms
private static final int LONG_PRESS_THRESHOLD = 500; //ms
private static final int LONG_CLICK_THRESHOLD = 500; //ms

public static final int RECT_ROI=0, ROUNDED_RECT_ROI=1, ROTATED_RECT_ROI=2;
public static final int OVAL_ROI=0, ELLIPSE_ROI=1, BRUSH_ROI=2;
Expand Down Expand Up @@ -626,8 +628,8 @@ private void showMessage(int tool) {
IJ.showStatus(name);
return;
}
String hint = " (long press to switch)";
String hint2 = " (long press to switch; double click to configure)";
String hint = " (alt or long click to switch)";
String hint2 = " (alt or long click to switch; double click to configure)";
switch (tool) {
case RECTANGLE:
if (rectType==ROUNDED_RECT_ROI)
Expand Down Expand Up @@ -676,15 +678,15 @@ else if (ovalType==ELLIPSE_ROI)
IJ.showStatus("Text tool (double-click to configure)");
return;
case MAGNIFIER:
IJ.showStatus("Magnifying glass (or \"+\" and \"-\" keys; long press for menu)");
IJ.showStatus("Magnifying glass (or \"+\" and \"-\" keys; alt or long click for menu)");
return;
case HAND:
IJ.showStatus("Scrolling tool (or press space bar and drag)");
return;
case DROPPER:
String fg = foregroundColor.getRed() + "," + foregroundColor.getGreen() + "," + foregroundColor.getBlue();
String bg = backgroundColor.getRed() + "," + backgroundColor.getGreen() + "," + backgroundColor.getBlue();
IJ.showStatus("Color picker " + fg + "/"+ bg + " (long press for menu)");
IJ.showStatus("Color picker " + fg + "/"+ bg + " (long click for menu)");
return;
case ANGLE:
IJ.showStatus("Angle tool");
Expand Down Expand Up @@ -1249,7 +1251,7 @@ public void run() {
}
triggerPopupMenu(newTool, e, true, true);
}
}, LONG_PRESS_THRESHOLD);
}, LONG_CLICK_THRESHOLD);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ij/io/Opener.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void open() {
* @see ij.IJ#open(String)
* @see ij.IJ#openImage(String)
*/
public void open(String path) {
public void open(final String path) {
if(!path.startsWith("http") || EventQueue.isDispatchThread()){
openPath(path);
}
Expand Down
18 changes: 0 additions & 18 deletions src/main/java/ij/module-info.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/ij/plugin/SimpleCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ private void showDirectory(String arg) {
IJ.error("Folder not found: " + arg);
return;
}
if (arg.equals("image")&& IJ.getImage() != null) {
File imgPath = new File(dir + File.separator + IJ.getImage().getTitle());
if (arg.equals("image")&& IJ.getImage()!=null) {
File imgPath = new File(IJ.getDir("image"));
if (!imgPath.exists()) {
IJ.error("Image not found");
return;
Expand Down

0 comments on commit 47556f9

Please sign in to comment.