MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / showDialog

Method showDialog

ij/src/main/java/ij/plugin/AVI_Reader.java:516–572  ·  view source on GitHub ↗

Parameters dialog, returns false on cancel

()

Source from the content-addressed store, hash-verified

514
515 /** Parameters dialog, returns false on cancel */
516 private boolean showDialog () {
517 if (lastFrame!=-1)
518 lastFrame = dwTotalFrames;
519 if (!IJ.isMacro()) {
520 convertToGray = staticConvertToGray;
521 flipVertical = staticFlipVertical;
522 isVirtual = staticIsVirtual;
523 }
524 String options = Macro.getOptions();
525 if (options!=null) { //macro
526 if (options.contains("open="))
527 Macro.setOptions(options.replace("open=", "avi="));
528 }
529 if (path==null || path.length()==0)
530 path = Prefs.get(PATH_KEY, IJ.getDir("downloads")+"movie.avi");
531 GenericDialog gd = new GenericDialog("AVI Reader");
532 gd.setInsets(5, 0, 0);
533 gd.addFileField("AVI:", path, 29);
534 gd.setInsets(2, 40, 5);
535 gd.addMessage("drag and drop target", IJ.font10, Color.darkGray);
536 gd.addCheckbox("Use Virtual Stack", isVirtual);
537 gd.addCheckbox("Convert to Grayscale", convertToGray);
538 gd.addCheckbox("Flip Vertical", flipVertical);
539 gd.setInsets(15, 0, 3);
540 gd.addNumericField("First:", firstFrame, 0);
541 gd.addNumericField("Last:", lastFrame, lastFrame, 6, "*");
542 TextField lastField = (TextField)(gd.getNumericFields().lastElement());
543 if (lastFrame == 0)
544 lastField.setText("");
545 gd.setInsets(0, 40, 5);
546 gd.addMessage("* Leave empty or set to 0 for reading to the end.\n Also accepts e.g. -5 to skip last 5 frames.", IJ.font10, Color.darkGray);
547 gd.showDialog();
548 if (gd.wasCanceled())
549 return false;
550 path = gd.getNextString();
551 Prefs.set(PATH_KEY, path);
552 File f = new File(path);
553 fileName = f.getName();
554 fileDir = IJ.addSeparator(f.getParent());
555 gd.setSmartRecording(true);
556 isVirtual = gd.getNextBoolean();
557 convertToGray = gd.getNextBoolean();
558 flipVertical = gd.getNextBoolean();
559 double first = gd.getNextNumber();
560 if (!Double.isNaN(first)) firstFrame = (int)first;
561 if (lastField.getText().length()==0)
562 lastField.setText("0");
563 double last = gd.getNextNumber();
564 if (!Double.isNaN(last)) lastFrame = (int)last;
565 if (!IJ.isMacro()) {
566 staticConvertToGray = convertToGray;
567 staticFlipVertical = flipVertical;
568 staticIsVirtual = isVirtual;
569 }
570 IJ.register(this.getClass());
571 return true;
572 }
573

Callers 1

runMethod · 0.95

Calls 15

isMacroMethod · 0.95
getOptionsMethod · 0.95
setOptionsMethod · 0.95
getMethod · 0.95
getDirMethod · 0.95
setInsetsMethod · 0.95
addFileFieldMethod · 0.95
addMessageMethod · 0.95
addCheckboxMethod · 0.95
addNumericFieldMethod · 0.95
getNumericFieldsMethod · 0.95
showDialogMethod · 0.95

Tested by

no test coverage detected