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

Method showDialog

ij/src/main/java/ij/plugin/Grid.java:148–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146 }
147
148 private boolean showDialog() {
149 isMacro = Macro.getOptions()!=null;
150 if (!isMacro)
151 getSettings();
152 int width = imp.getWidth();
153 int height = imp.getHeight();
154 Calibration cal = imp.getCalibration();
155 int places;
156 if (cal.scaled()) {
157 pixelWidth = cal.pixelWidth;
158 pixelHeight = cal.pixelHeight;
159 units = cal.getUnits();
160 places = 2;
161 } else {
162 pixelWidth = 1.0;
163 pixelHeight = 1.0;
164 units = "pixels";
165 places = 0;
166 }
167 if (areaPerPoint==0.0)
168 areaPerPoint = (width*cal.pixelWidth*height*cal.pixelHeight)/81.0; // default to 9x9 grid
169 GenericDialog gd = new GenericDialog("Grid...");
170 gd.addChoice("Grid type:", types, type);
171 gd.addNumericField("Area per point:", areaPerPoint, places, 6, units+"^2");
172 gd.addChoice("Color:", colors, color);
173 gd.addCheckbox("Bold", bold);
174 gd.addCheckbox("Center grid on image", centered);
175 gd.addCheckbox("Random offset", randomOffset);
176 gd.addDialogListener(this);
177 if (!isMacro) {
178 Vector v = gd.getCheckboxes();
179 centerCheckbox = (Checkbox)v.elementAt(1);
180 randomCheckbox = (Checkbox)v.elementAt(2);
181 }
182 dialogItemChanged(gd, null);
183 gd.showDialog();
184 if (gd.wasCanceled()) {
185 Overlay overlay = imp.getOverlay();
186 if (overlay!=null && gridOnEntry!=null) {
187 overlay.remove(GRID);
188 overlay.add(gridOnEntry);
189 imp.draw();
190 } else
191 drawGrid(null);
192 return false;
193 } else
194 return true;
195 }
196
197 public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
198 int width = imp.getWidth();

Callers 1

runMethod · 0.95

Calls 15

getOptionsMethod · 0.95
getSettingsMethod · 0.95
scaledMethod · 0.95
getUnitsMethod · 0.95
addChoiceMethod · 0.95
addNumericFieldMethod · 0.95
addCheckboxMethod · 0.95
addDialogListenerMethod · 0.95
getCheckboxesMethod · 0.95
dialogItemChangedMethod · 0.95
showDialogMethod · 0.95
wasCanceledMethod · 0.95

Tested by

no test coverage detected