Пример #1
0
 public void keyReleased(KeyEvent e) {
   int keyCode = e.getKeyCode();
   IJ.setKeyUp(keyCode);
   int flags = e.getModifiers();
   boolean control = (flags & KeyEvent.CTRL_MASK) != 0;
   boolean meta = (flags & KeyEvent.META_MASK) != 0;
   boolean shift = (flags & e.SHIFT_MASK) != 0;
   if (keyCode == KeyEvent.VK_G && shift && (control || meta)) new ScreenGrabber().run("");
 }
Пример #2
0
 void zoomToSelection(int x, int y) {
   IJ.setKeyUp(IJ.ALL_KEYS);
   String macro =
       "args = split(getArgument);\n"
           + "x1=parseInt(args[0]); y1=parseInt(args[1]); flags=20;\n"
           + "while (flags&20!=0) {\n"
           + "getCursorLoc(x2, y2, z, flags);\n"
           + "if (x2>=x1) x=x1; else x=x2;\n"
           + "if (y2>=y1) y=y1; else y=y2;\n"
           + "makeRectangle(x, y, abs(x2-x1), abs(y2-y1));\n"
           + "wait(10);\n"
           + "}\n"
           + "run('To Selection');\n";
   new MacroRunner(macro, x + " " + y);
 }