/** Scrolling a PlotCanvas is updating the plot, not viewing part of the plot, unless the plot is frozen */ public void setSourceRect(Rectangle r) { if (plot.isFrozen()) super.setSourceRect(r); else resetMagnification(); }
/** The image of a PlotCanvas is always shown at 100% magnification unless the plot is frozen */ public void setMagnification(double magnification) { if (plot == null || plot.isFrozen()) super.setMagnification(magnification); else resetMagnification(); }
/** Scrolling a PlotCanvas is updating the plot, not viewing part of the plot, unless the plot is frozen */ public void setSourceRect(Rectangle r) { if (plot.isFrozen()) super.setSourceRect(r); else resetMagnification(); }
/** The image of a PlotCanvas is always shown at 100% magnification unless the plot is frozen */ public void setMagnification(double magnification) { if (plot == null || plot.isFrozen()) super.setMagnification(magnification); else resetMagnification(); }
/** Implements the Image/Zoom/Original Scale command. * Sets the original range of the x, y axes (unless the plot is frozen) */ public void unzoom() { if (plot == null || plot.isFrozen()) { super.unzoom(); return; } resetMagnification(); plot.setLimitsToDefaults(true); }
/** Implements the Image/Zoom/View 100% command: Sets the original frame size as specified * in Edit/Options/Plots (unless the plot is frozen) */ public void zoom100Percent() { if (plot == null || plot.isFrozen()) { super.zoom100Percent(); return; } resetMagnification(); plot.setFrameSize(PlotWindow.plotWidth, PlotWindow.plotHeight); }
/** Implements the Image/Zoom/View 100% command: Sets the original frame size as specified * in Edit/Options/Plots (unless the plot is frozen) */ public void zoom100Percent() { if (plot == null || plot.isFrozen()) { super.zoom100Percent(); return; } resetMagnification(); plot.setFrameSize(PlotWindow.plotWidth, PlotWindow.plotHeight); }
/** Implements the Image/Zoom/Original Scale command. * Sets the original range of the x, y axes (unless the plot is frozen) */ public void unzoom() { if (plot == null || plot.isFrozen()) { super.unzoom(); return; } resetMagnification(); plot.setLimitsToDefaults(true); }
/** Freezes or unfreezes the plot. In the frozen state, the plot cannot be resized or updated, * and the Plot class does no modifications to the ImageProcessor. * Changes are recorded nevertheless and become effective with <code>setFrozen(false)</code>. */ public void setFrozen(boolean frozen) { pp.isFrozen = frozen; if (!pp.isFrozen) { // unfreeze operations ... if (imp != null && ip != null) { ImageCanvas ic = imp.getCanvas(); if (ic instanceof PlotCanvas) { ((PlotCanvas)ic).resetMagnification(); imp.setTitle(imp.getTitle()); //update magnification in title } Undo.setup(Undo.TRANSFORM, imp); } updateImage(); ImageWindow win = imp == null ? null : imp.getWindow(); if (win != null) win.updateImage(imp); //show any changes made during the frozen state } }
/** Freezes or unfreezes the plot. In the frozen state, the plot cannot be resized or updated, * and the Plot class does no modifications to the ImageProcessor. * Changes are recorded nevertheless and become effective with <code>setFrozen(false)</code>. */ public void setFrozen(boolean frozen) { pp.isFrozen = frozen; if (!pp.isFrozen) { // unfreeze operations ... if (imp != null && ip != null) { ImageCanvas ic = imp.getCanvas(); if (ic instanceof PlotCanvas) { ((PlotCanvas)ic).resetMagnification(); imp.setTitle(imp.getTitle()); //update magnification in title } Undo.setup(Undo.TRANSFORM, imp); } updateImage(); ImageWindow win = imp == null ? null : imp.getWindow(); if (win != null) win.updateImage(imp); //show any changes made during the frozen state } }
/** Resizes the canvas when the user resizes the window. To avoid a race condition while creating * a new window, this is ignored if no window exists or the window has not been activated yet. */ void resizeCanvas(int width, int height) { if (plot == null || plot.isFrozen()) { super.resizeCanvas(width, height); return; } resetMagnification(); if (width == oldWidth && height == oldHeight) return; if (plot == null) return; ImageWindow win = imp.getWindow(); if (win==null || !(win instanceof PlotWindow)) return; if (!win.isVisible()) return; if (!((PlotWindow)win).wasActivated) return; // window layout not finished yet? Dimension minSize = plot.getMinimumSize(); int plotWidth = width < minSize.width ? minSize.width : width; int plotHeight = height < minSize.height ? minSize.height : height; plot.setSize(plotWidth, plotHeight); setSize(width, height); oldWidth = width; oldHeight = height; }
/** Resizes the canvas when the user resizes the window. To avoid a race condition while creating * a new window, this is ignored if no window exists or the window has not been activated yet. */ void resizeCanvas(int width, int height) { if (plot == null || plot.isFrozen()) { super.resizeCanvas(width, height); return; } resetMagnification(); if (width == oldWidth && height == oldHeight) return; if (plot == null) return; ImageWindow win = imp.getWindow(); if (win==null || !(win instanceof PlotWindow)) return; if (!win.isVisible()) return; if (!((PlotWindow)win).wasActivated) return; // window layout not finished yet? Dimension minSize = plot.getMinimumSize(); int plotWidth = width < minSize.width ? minSize.width : width; int plotHeight = height < minSize.height ? minSize.height : height; plot.setSize(plotWidth, plotHeight); setSize(width, height); oldWidth = width; oldHeight = height; }