double isKeyDown() { double value = 0.0; String key = getStringArg().toLowerCase(Locale.US); if (key.indexOf("alt")!=-1) value = IJ.altKeyDown()==true?1.0:0.0; else if (key.indexOf("shift")!=-1) value = IJ.shiftKeyDown()==true?1.0:0.0; else if (key.indexOf("space")!=-1) value = IJ.spaceBarDown()==true?1.0:0.0; else interp.error("Invalid key"); return value; }
double isKeyDown() { double value = 0.0; String key = getStringArg().toLowerCase(Locale.US); if (key.indexOf("alt")!=-1) value = IJ.altKeyDown()==true?1.0:0.0; else if (key.indexOf("shift")!=-1) value = IJ.shiftKeyDown()==true?1.0:0.0; else if (key.indexOf("space")!=-1) value = IJ.spaceBarDown()==true?1.0:0.0; else interp.error("Invalid key"); return value; }
@Override public void mouseEntered(final MouseEvent e) { super.mouseEntered(e); if (!IJ.spaceBarDown() | Toolbar.getToolId() != Toolbar.MAGNIFIER | Toolbar.getToolId() != Toolbar.HAND) setCursor(Cursor .getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); }
public void mouseDragged(MouseEvent e) { int x = e.getX(); int y = e.getY(); xMouse = offScreenX(x); yMouse = offScreenY(y); flags = e.getModifiers(); mousePressedX = mousePressedY = -1; //IJ.log("mouseDragged: "+flags); if (flags==0) // workaround for Mac OS 9 bug flags = InputEvent.BUTTON1_MASK; if (Toolbar.getToolId()==Toolbar.HAND || IJ.spaceBarDown()) scroll(x, y); else { PlugInTool tool = Toolbar.getPlugInTool(); if (tool!=null) { tool.mouseDragged(imp, e); if (e.isConsumed()) return; } IJ.setInputEvent(e); Roi roi = imp.getRoi(); if (roi != null) roi.handleMouseDrag(x, y, flags); } }
public void mouseDragged(MouseEvent e) { int x = e.getX(); int y = e.getY(); xMouse = offScreenX(x); yMouse = offScreenY(y); flags = e.getModifiers(); mousePressedX = mousePressedY = -1; //IJ.log("mouseDragged: "+flags); if (flags==0) // workaround for Mac OS 9 bug flags = InputEvent.BUTTON1_MASK; if (Toolbar.getToolId()==Toolbar.HAND || IJ.spaceBarDown()) scroll(x, y); else { PlugInTool tool = Toolbar.getPlugInTool(); if (tool!=null) { tool.mouseDragged(imp, e); if (e.isConsumed()) return; } IJ.setInputEvent(e); Roi roi = imp.getRoi(); if (roi != null) roi.handleMouseDrag(x, y, flags); } }
/** Mouse wheel: zooms when shift or ctrl is pressed, scrolls in x if space bar down, in y otherwise. */ public synchronized void mouseWheelMoved(MouseWheelEvent e) { if (plot.isFrozen() || !(ic instanceof PlotCanvas)) { //frozen plots are like normal images super.mouseWheelMoved(e); return; } int rotation = e.getWheelRotation(); int amount = e.getScrollAmount(); if (e.getX() < plot.leftMargin || e.getX() > plot.leftMargin + plot.frameWidth)//n__ return; if (e.getY() < plot.topMargin || e.getY() > plot.topMargin + plot.frameHeight) return; boolean ctrl = (e.getModifiers()&Event.CTRL_MASK)!=0; if (amount<1) amount=1; if (rotation==0) return; if (ctrl||IJ.shiftKeyDown()) { double zoomFactor = rotation<0 ? Math.pow(2, 0.2) : Math.pow(0.5, 0.2); Point loc = ic.getCursorLoc(); int x = ic.screenX(loc.x); int y = ic.screenY(loc.y); ((PlotCanvas)ic).zoom(x, y, zoomFactor); } else if (IJ.spaceBarDown()) plot.scroll(rotation*amount*Math.max(ic.imageWidth/50, 1), 0); else plot.scroll(0, rotation*amount*Math.max(ic.imageHeight/50, 1)); }
/** Mouse wheel: zooms when shift or ctrl is pressed, scrolls in x if space bar down, in y otherwise. */ public synchronized void mouseWheelMoved(MouseWheelEvent e) { if (plot.isFrozen() || !(ic instanceof PlotCanvas)) { //frozen plots are like normal images super.mouseWheelMoved(e); return; } int rotation = e.getWheelRotation(); int amount = e.getScrollAmount(); if (e.getX() < plot.leftMargin || e.getX() > plot.leftMargin + plot.frameWidth)//n__ return; if (e.getY() < plot.topMargin || e.getY() > plot.topMargin + plot.frameHeight) return; boolean ctrl = (e.getModifiers()&Event.CTRL_MASK)!=0; if (amount<1) amount=1; if (rotation==0) return; if (ctrl||IJ.shiftKeyDown()) { double zoomFactor = rotation<0 ? Math.pow(2, 0.2) : Math.pow(0.5, 0.2); Point loc = ic.getCursorLoc(); int x = ic.screenX(loc.x); int y = ic.screenY(loc.y); ((PlotCanvas)ic).zoom(x, y, zoomFactor); } else if (IJ.spaceBarDown()) plot.scroll(rotation*amount*Math.max(ic.imageWidth/50, 1), 0); else plot.scroll(0, rotation*amount*Math.max(ic.imageHeight/50, 1)); }
@Override public void mousePressed(final MouseEvent e) { if (IJ.spaceBarDown() || Toolbar.getToolId() == Toolbar.MAGNIFIER || Toolbar.getToolId() == Toolbar.HAND) { super.mousePressed(e); return; } if (currentMarkerVector == null) { IJ.error("Select a counter type first!"); return; } final int x = super.offScreenX(e.getX()); final int y = super.offScreenY(e.getY()); if (!delmode) { final CellCntrMarker m = new CellCntrMarker(x, y, img.getCurrentSlice()); currentMarkerVector.addMarker(m); } else { final CellCntrMarker m = currentMarkerVector.getMarkerFromPosition(new Point(x, y), img .getCurrentSlice()); currentMarkerVector.remove(m); } repaint(); cc.populateTxtFields(); }
public void mouseDragged(MouseEvent e) { if (IJ.spaceBarDown()) // scrolling? return; if (e.getSource().equals(canvas)) {
public void mouseDragged(MouseEvent e) { if (IJ.spaceBarDown()) // scrolling? return; if (e.getSource().equals(canvas)) {
if(hyperstack){ int c=imp.getChannel(); int z=imp.getSlice(); int t=imp.getFrame(); if (frames>1 && !((slices>1||channels>1)&&(IJ.controlKeyDown()||IJ.spaceBarDown()||IJ.altKeyDown()) || swin.getAnimate())){ t += pn; if (t>frames) t = frames; if (t<1) t = 1; } else if (slices>1 && !(channels>1&& (IJ.altKeyDown() || IJ.spaceBarDown()) || ((swin.getAnimate()|| IJ.controlKeyDown()) && frames==1)) ) { z += pn; if (z>slices) z = slices;
if(hyperstack){ int c=imp.getChannel(); int z=imp.getSlice(); int t=imp.getFrame(); if (frames>1 && !((slices>1||channels>1)&&(IJ.controlKeyDown()||IJ.spaceBarDown()||IJ.altKeyDown()) || swin.getAnimate())){ t += pn; if (t>frames) t = frames; if (t<1) t = 1; } else if (slices>1 && !(channels>1&& (IJ.altKeyDown() || IJ.spaceBarDown()) || ((swin.getAnimate()|| IJ.controlKeyDown()) && frames==1)) ) { z += pn; if (z>slices) z = slices;
ic.zoomOut(x, y); return; } else if (IJ.spaceBarDown() || srcRect.height==height) { srcRect.x += rotation*amount*Math.max(width/200, 1); if (srcRect.x<0) srcRect.x = 0;
if (win==null) return; if (IJ.spaceBarDown()) { setCursor(handCursor); return;
if (IJ.spaceBarDown()) { setCursor(handCursor); return;
else Roi.setColor(Color.yellow); if (Toolbar.getToolId()!=Toolbar.WAND || IJ.spaceBarDown()) return; if (IJ.shiftKeyDown()) {
void nextSlice() { boolean hyperstack = imp.isDisplayedHyperStack(); int channels = imp.getNChannels(); int slices = imp.getNSlices(); int frames = imp.getNFrames(); if (hyperstack && channels>1 && !((slices>1||frames>1)&&(IJ.controlKeyDown()||IJ.spaceBarDown()||IJ.altKeyDown()))) { int c = imp.getChannel() + 1; if (c>channels) c = channels; swin.setPosition(c, imp.getSlice(), imp.getFrame()); } else if (hyperstack && slices>1 && !(frames>1&&IJ.altKeyDown())) { int z = imp.getSlice() + 1; if (z>slices) z = slices; swin.setPosition(imp.getChannel(), z, imp.getFrame()); } else if (hyperstack && frames>1) { int t = imp.getFrame() + 1; if (t>frames) t = frames; swin.setPosition(imp.getChannel(), imp.getSlice(), t); } else { if (IJ.altKeyDown()) slice += 10; else slice++; if (slice>nSlices) slice = nSlices; swin.showSlice(slice); } imp.updateStatusbarValue(); }
void previousSlice() { boolean hyperstack = imp.isDisplayedHyperStack(); int channels = imp.getNChannels(); int slices = imp.getNSlices(); int frames = imp.getNFrames(); if (hyperstack && channels>1 && !((slices>1||frames>1)&&(IJ.controlKeyDown()||IJ.spaceBarDown()||IJ.altKeyDown()))) { int c = imp.getChannel() - 1; if (c<1) c = 1; swin.setPosition(c, imp.getSlice(), imp.getFrame()); } else if (hyperstack && slices>1 && !(frames>1&&IJ.altKeyDown())) { int z = imp.getSlice() - 1; if (z<1) z = 1; swin.setPosition(imp.getChannel(), z, imp.getFrame()); } else if (hyperstack && frames>1) { int t = imp.getFrame() - 1; if (t<1) t = 1; swin.setPosition(imp.getChannel(), imp.getSlice(), t); } else { if (IJ.altKeyDown()) slice -= 10; else slice--; if (slice<1) slice = 1; swin.showSlice(slice); } imp.updateStatusbarValue(); }
void previousSlice() { boolean hyperstack = imp.isDisplayedHyperStack(); int channels = imp.getNChannels(); int slices = imp.getNSlices(); int frames = imp.getNFrames(); if (hyperstack && channels>1 && !((slices>1||frames>1)&&(IJ.controlKeyDown()||IJ.spaceBarDown()||IJ.altKeyDown()))) { int c = imp.getChannel() - 1; if (c<1) c = 1; swin.setPosition(c, imp.getSlice(), imp.getFrame()); } else if (hyperstack && slices>1 && !(frames>1&&IJ.altKeyDown())) { int z = imp.getSlice() - 1; if (z<1) z = 1; swin.setPosition(imp.getChannel(), z, imp.getFrame()); } else if (hyperstack && frames>1) { int t = imp.getFrame() - 1; if (t<1) t = 1; swin.setPosition(imp.getChannel(), imp.getSlice(), t); } else { if (IJ.altKeyDown()) slice -= 10; else slice--; if (slice<1) slice = 1; swin.showSlice(slice); } imp.updateStatusbarValue(); }
void nextSlice() { boolean hyperstack = imp.isDisplayedHyperStack(); int channels = imp.getNChannels(); int slices = imp.getNSlices(); int frames = imp.getNFrames(); if (hyperstack && channels>1 && !((slices>1||frames>1)&&(IJ.controlKeyDown()||IJ.spaceBarDown()||IJ.altKeyDown()))) { int c = imp.getChannel() + 1; if (c>channels) c = channels; swin.setPosition(c, imp.getSlice(), imp.getFrame()); } else if (hyperstack && slices>1 && !(frames>1&&IJ.altKeyDown())) { int z = imp.getSlice() + 1; if (z>slices) z = slices; swin.setPosition(imp.getChannel(), z, imp.getFrame()); } else if (hyperstack && frames>1) { int t = imp.getFrame() + 1; if (t>frames) t = frames; swin.setPosition(imp.getChannel(), imp.getSlice(), t); } else { if (IJ.altKeyDown()) slice += 10; else slice++; if (slice>nSlices) slice = nSlices; swin.showSlice(slice); } imp.updateStatusbarValue(); }