Posted by
Michael Schmid on
Feb 05, 2014; 5:25pm
URL: http://imagej.273.s1.nabble.com/Re-Fiji-Wiki-upgrade-tp5006404p5006430.html
Hi everyone,
the phenomenon of the zoom shortcuts sometimes not active after a while of working with ImageJ seems to be a more common one.
Occasionally, it also happens to me (Mac OS X 10.6, Java 1.6.0.65; all ImageJ versions since years). I have not found a specific action that triggers it.
It is interesting that in this case also a macro that I have for zooming in stops working. The macro moves the image up on the screen to allow ImageJ use a larger area for the image:
//shifts the image if this would allow to have a larger area
macro "Zoom In [n+]" {
zoom = getZoom();
getLocationAndSize(x, y, width, height);
if (width*1.01>getWidth()*zoom && (height-screenTop)*1.01>getHeight()*zoom && width*1.33<screenWidth && height*1.33<screenHeight) {
if (x+1.51*width > screenWidth)
x = maxOf(0, screenWidth-1.51*width);
if (y+1.51*height > screenHeight)
y = maxOf(screenTop, screenHeight-1.51*height);
setBatchMode(true);
setLocation(x, y, width+1, height+1); //'+1' avoids rounding-down errors
}
run("In");
setBatchMode(false);
}
Would be great if someone could find out why this happens (so one can fix it).
Michael
________________________________________________________________
On Feb 5, 2014, at 16:54, Mark Bentley wrote:
> Greetings,
>
> I am experiencing an unexpected failure of the Zoom>In and Zoom>Out default keyboard mapping as described here,
http://rsb.info.nih.gov/ij/docs/shortcuts.html , when extending a ij.gui.StackWindow in a Plugin. Why is it being extended, you ask? The plugin features several awt.Button objects added to a Panel that is then added to the window. So, the custom StackWindow also implements ActionListener. There are two sets of Buttons, each representing a menu, each menu has a Button designed to switch back to the other menu. The code looks something like this...
>
> void actionPerformed(ActionEvent e) {
> if (e.getSource() == currentPanelsSwitchMenuButton) {
> remove(theCurrentPanel); //remove the panel currently displayed
> add(theOtherPanel); //add the other panel, both panels have already had the buttons, listeners, etc. added.
> pack();
> }
> }
>
> The plugin operates as expected, and the buttons within each menu carry out their correct functions, including the 'menu switching' mentioned above, BUT upon switching menus the keyboard shortcuts for zoom stop working.
>
> Now, AFTER doing a menu switch and thus breaking the zoom shortcuts, the shortcuts can be restored by manually clicking the magnification tool in the ImageJ main window. Once that has been clicked everything is back to normal; the shortcuts work as they should even when the mag tool is no longer selected. BUT a 'menu switch' will break the zoom keys again until the Magnification tool is manually selected again. The users of the plugin switch menus frequently, and this problem is really slowing them down.
>
> I have already tried including a 'dirty fix' like the one below:
>
> private void fixZoom() {
> String currentTool = IJ.getToolName();
> IJ.setTool(Toolbar.MAGNIFIER);
> IJ.setTool(currentTool);
> } /* end fixZoom() */
>
> where fixZoom() is called after pack() in actionPerformed. Also, just calling IJ.setTool(Toolbar.MAGNIFIER) and then expecting the user to select their desired tool afterwards, an even simpler 'half fix,' does not work. It seems that the user must actually CLICK ON the mag tool or CLICK WITH it at least once to restore the keyboard shortcuts.
>
> Any suggestions?
>
> Thank you all,
>
> Mark Bentley
>
[hidden email]
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html