// This is a tool macro for drawing straight lines.
// Double click on the tool icon to set the line width.

  var lineWidth=2;

 macro "Line Tool -C00bL1de0L1ee1" {
        requires("1.30l");
        getCursorLoc(x, y, z, flags);
        xstart = x; ystart = y;
        x2=x; y2=y;        
        while (true) {
            getCursorLoc(x, y, z, flags);
            if (flags&16==0) {
                setLineWidth(lineWidth);
                drawLine(xstart, ystart, x, y);
                run("Select None");
                exit;
            }
            if (x!=x2 || y!=y2)
                makeLine(xstart, ystart, x, y);
            x2=x; y2=y;
            wait(10);
        };
    }

  // ImageJ runs this macro when user double-clicks on the tool icon
  macro "Line Tool Options" {
      lineWidth = getNumber("Line Width:", lineWidth);
 }
