Index: graph/lib/apichanges.xml =================================================================== RCS file: /cvs/graph/lib/apichanges.xml,v retrieving revision 1.15 diff -u -r1.15 apichanges.xml --- graph/lib/apichanges.xml 5 Jun 2007 08:43:24 -0000 1.15 +++ graph/lib/apichanges.xml 5 Jun 2007 09:51:08 -0000 @@ -239,6 +239,22 @@ + + + + Zoom actions are using Ctrl key modifier of invocation + + + + + + All built-in zoom actions are using modifiers from Scene.getInputBindings().getZoomActionModifiers() method. + Default value has been changed from nothing to Ctrl key which backward-incompatible change affecting all users. + A part of the change InputBindings class has been introduces and assigned to a Scene. + + + + Index: graph/lib/manifest.mf =================================================================== RCS file: /cvs/graph/lib/manifest.mf,v retrieving revision 1.11 diff -u -r1.11 manifest.mf --- graph/lib/manifest.mf 5 Jun 2007 08:34:44 -0000 1.11 +++ graph/lib/manifest.mf 5 Jun 2007 09:51:08 -0000 @@ -1,4 +1,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.api.visual OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visual/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 2.3 +OpenIDE-Module-Specification-Version: 2.4 Index: graph/lib/src/org/netbeans/api/visual/laf/InputBindings.java =================================================================== RCS file: graph/lib/src/org/netbeans/api/visual/laf/InputBindings.java diff -N graph/lib/src/org/netbeans/api/visual/laf/InputBindings.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ graph/lib/src/org/netbeans/api/visual/laf/InputBindings.java 5 Jun 2007 09:51:08 -0000 @@ -0,0 +1,64 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.api.visual.laf; + +import java.awt.event.KeyEvent; + +/** + * This represents input bindings e.g. manages modifiers of actions. + * + * @author David Kaspar + * @since 2.4 + */ +public final class InputBindings { + + private int zoomActionModifiers = KeyEvent.CTRL_MASK; + + private InputBindings () { + } + + /** + * Returns InputEvent modifiers of all zoom actions. + * @return the modifiers + * @since 2.4 + */ + public int getZoomActionModifiers () { + return zoomActionModifiers; + } + + /** + * Sets InputEvent modifiers for all zoom actions. + * @param zoomActionModifiers the modifiers + * @since 2.4 + */ + public void setZoomActionModifiers (int zoomActionModifiers) { + this.zoomActionModifiers = zoomActionModifiers; + } + + /** + * Creates a new input bindings. This is usually used by the Scene class only. + * @return the input bindings + * @since 2.4 + */ + public static InputBindings create () { + return new InputBindings (); + } + +} Index: graph/lib/src/org/netbeans/api/visual/widget/Scene.java =================================================================== RCS file: /cvs/graph/lib/src/org/netbeans/api/visual/widget/Scene.java,v retrieving revision 1.44 diff -u -r1.44 Scene.java --- graph/lib/src/org/netbeans/api/visual/widget/Scene.java 13 Feb 2007 07:31:28 -0000 1.44 +++ graph/lib/src/org/netbeans/api/visual/widget/Scene.java 5 Jun 2007 09:51:08 -0000 @@ -23,6 +23,7 @@ import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.animator.SceneAnimator; import org.netbeans.api.visual.laf.LookFeel; +import org.netbeans.api.visual.laf.InputBindings; import org.netbeans.modules.visual.util.GeomUtil; import org.netbeans.modules.visual.widget.SatelliteComponent; @@ -68,6 +69,7 @@ private Font defaultFont; private LookFeel lookFeel = LookFeel.createDefaultLookFeel (); + private InputBindings inputBindings = InputBindings.create (); private String activeTool = null; private Rectangle maximumBounds = new Rectangle (Integer.MIN_VALUE / 2, Integer.MIN_VALUE / 2, Integer.MAX_VALUE, Integer.MAX_VALUE); @@ -472,6 +474,15 @@ public final void setLookFeel (LookFeel lookFeel) { assert lookFeel != null; this.lookFeel = lookFeel; + } + + /** + * Returns input bindings of the scene. + * @return the input bindings + * @since 2.4 + */ + public final InputBindings getInputBindings () { + return inputBindings; } /** Index: graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html =================================================================== RCS file: /cvs/graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html,v retrieving revision 1.14 diff -u -r1.14 documentation.html --- graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html 5 Jun 2007 08:43:25 -0000 1.14 +++ graph/lib/src/org/netbeans/api/visual/widget/doc-files/documentation.html 5 Jun 2007 09:51:08 -0000 @@ -532,6 +532,9 @@ getLookFeel
setLookFeel Controls the scene look and feel. LookFeel.createDefaultLookFeel by default. See Look and Feel section. +getInputBindinds +Returns input bindings used by the scene. See Look and Feel section. + getActiveTool
setActiveTool Controls the active action tool of the scene. See Action Tools section. @@ -1834,6 +1837,9 @@

The library contains a preliminary look&feel support defined by LookFeel abstract class. Almost every method is dependent on ObjectState parameter. Usually the interface should be used in Widget.notifyStateChanged method implementation. The Scene.getLookFeel and Scene.setLookFeel methods allows manipulation with a look&feel assigned to a scene. The default LookFeel implementation can be obtained using LookFeel.createDefaultLookFeel method. + +

+There is also an InputBindings class which is assigned to a scene. It allows to manage action-related scene options e.g. InputEvent modifier of zoom actions used in the scene.

Animator

Index: graph/lib/src/org/netbeans/modules/visual/action/CenteredZoomAction.java =================================================================== RCS file: /cvs/graph/lib/src/org/netbeans/modules/visual/action/CenteredZoomAction.java,v retrieving revision 1.2 diff -u -r1.2 CenteredZoomAction.java --- graph/lib/src/org/netbeans/modules/visual/action/CenteredZoomAction.java 18 Jan 2007 21:25:55 -0000 1.2 +++ graph/lib/src/org/netbeans/modules/visual/action/CenteredZoomAction.java 5 Jun 2007 09:51:08 -0000 @@ -39,6 +39,11 @@ public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) { Scene scene = widget.getScene (); + + int modifiers = scene.getInputBindings ().getZoomActionModifiers (); + if ((event.getModifiers () & modifiers) != modifiers) + return State.REJECTED; + int amount = event.getWheelRotation (); double scale = 1.0; Index: graph/lib/src/org/netbeans/modules/visual/action/MouseCenteredZoomAction.java =================================================================== RCS file: /cvs/graph/lib/src/org/netbeans/modules/visual/action/MouseCenteredZoomAction.java,v retrieving revision 1.1 diff -u -r1.1 MouseCenteredZoomAction.java --- graph/lib/src/org/netbeans/modules/visual/action/MouseCenteredZoomAction.java 5 Jun 2007 08:44:17 -0000 1.1 +++ graph/lib/src/org/netbeans/modules/visual/action/MouseCenteredZoomAction.java 5 Jun 2007 09:51:08 -0000 @@ -38,6 +38,11 @@ public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) { Scene scene = widget.getScene (); + + int modifiers = scene.getInputBindings ().getZoomActionModifiers (); + if ((event.getModifiers () & modifiers) != modifiers) + return State.REJECTED; + int amount = event.getWheelRotation (); double scale = 1.0; Index: graph/lib/src/org/netbeans/modules/visual/action/ZoomAction.java =================================================================== RCS file: /cvs/graph/lib/src/org/netbeans/modules/visual/action/ZoomAction.java,v retrieving revision 1.2 diff -u -r1.2 ZoomAction.java --- graph/lib/src/org/netbeans/modules/visual/action/ZoomAction.java 14 Nov 2006 10:04:23 -0000 1.2 +++ graph/lib/src/org/netbeans/modules/visual/action/ZoomAction.java 5 Jun 2007 09:51:08 -0000 @@ -38,6 +38,11 @@ public State mouseWheelMoved (Widget widget, WidgetMouseWheelEvent event) { Scene scene = widget.getScene (); + + int modifiers = scene.getInputBindings ().getZoomActionModifiers (); + if ((event.getModifiers () & modifiers) != modifiers) + return State.REJECTED; + int amount = event.getWheelRotation (); if (useAnimator) {