Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ignoring progess bar and status line updates. #203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ij/IJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class IJ {
public static boolean debugMode;

public static boolean hideProcessStackDialog;

/** Turn off all status and progress bar updates **/
public static boolean ignoreStatusAndProgressUpdates = false;

public static final char micronSymbol = '\u00B5';
public static final char angstromSymbol = '\u00C5';
Expand Down Expand Up @@ -145,6 +148,12 @@ public static void setDebugMode(boolean b) {
LogStream.redirectSystem(debugMode);
}

/** Turn on/off ignoring of status and progress bar updates.*/
public static void setIgnoreStatusAndProgressUpdates(boolean b) {
ignoreStatusAndProgressUpdates = b;
LogStream.redirectSystem(ignoreStatusAndProgressUpdates);
}

/** Runs the macro contained in the string <code>macro</code>
on the current thread. Returns any string value returned by
the macro, null if the macro does not return a value, or
Expand Down Expand Up @@ -450,6 +459,7 @@ public static java.applet.Applet getApplet() {
with '!', subsequent showStatus() calls in the current
thread (without "!" in the message) are suppressed. */
public static void showStatus(String s) {
if (ignoreStatusAndProgressUpdates) return;
if ((Interpreter.getInstance()==null&&statusBarThread==null)
|| (statusBarThread!=null&&Thread.currentThread()!=statusBarThread))
protectStatusBar(false);
Expand All @@ -474,6 +484,7 @@ public static void showStatus(String s) {
* See: http://wsr.imagej.net/macros/FlashingStatusMessages.txt
*/
public static void showStatus(String message, String options) {
if (ignoreStatusAndProgressUpdates) return;
showStatus(message);
if (options==null)
return;
Expand Down Expand Up @@ -772,6 +783,7 @@ public static void outOfMemory(String name) {
updated only if more than 90 ms have passes since the last call. Does nothing
if the ImageJ window is not present. */
public static void showProgress(double progress) {
if (ignoreStatusAndProgressUpdates) return;
if (progressBar!=null) progressBar.show(progress, false);
}

Expand All @@ -783,6 +795,7 @@ public static void showProgress(double progress) {
* 'currentIndex' is negative (example: Plugins/Utilities/Benchmark).
*/
public static void showProgress(int currentIndex, int finalIndex) {
if (ignoreStatusAndProgressUpdates) return;
if (progressBar!=null) {
progressBar.show(currentIndex, finalIndex);
if (currentIndex==finalIndex)
Expand Down