Ticket #7438: bothTabAndA.patch
| File bothTabAndA.patch, 2.5 KB (added by , 14 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
11 11 import java.awt.AWTEvent; 12 12 import java.awt.BasicStroke; 13 13 import java.awt.Color; 14 import java.awt.Component; 14 15 import java.awt.Cursor; 15 16 import java.awt.Graphics2D; 17 import java.awt.KeyboardFocusManager; 16 18 import java.awt.MenuItem; 17 19 import java.awt.Point; 18 20 import java.awt.Stroke; … … 39 41 40 42 import java.util.TreeSet; 41 43 import javax.swing.AbstractAction; 44 import javax.swing.JFrame; 42 45 import javax.swing.JOptionPane; 43 46 44 47 import javax.swing.JPopupMenu; 48 import javax.swing.SwingUtilities; 45 49 import javax.swing.Timer; 46 50 import org.openstreetmap.josm.Main; 47 51 import org.openstreetmap.josm.actions.JosmAction; … … 223 227 if(Main.map == null || Main.map.mapView == null || !Main.map.mapView.isActiveLayerDrawable()) 224 228 return; 225 229 if (event instanceof KeyEvent) { 230 Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); 231 Component wantedFocus = Main.map.mapView.getParent(); 232 boolean foundMapViewAncestor=false; 233 while (focused!=null) { 234 if (focused==wantedFocus) { 235 foundMapViewAncestor=true; 236 } 237 focused = focused.getParent(); 238 } 239 // we accept only events that come from map or toggle dialogs, not from menu and dialogs 240 if (!foundMapViewAncestor) return; 226 241 processKeyEvent((KeyEvent) event); 227 242 } // toggle angle snapping 228 243 updateKeyModifiers((InputEvent) event); … … 237 252 private KeyEvent releaseEvent; 238 253 private Timer timer; 239 254 void processKeyEvent(KeyEvent e) { 240 if (!snappingShortcut.isEvent(e) )255 if (!snappingShortcut.isEvent(e) && !getShortcut().isEvent(e)) 241 256 return; 242 257 243 258 if (e.getID() == KeyEvent.KEY_PRESSED) { … … 260 275 } 261 276 262 277 private void doKeyPressEvent(KeyEvent e) { 263 if (!snappingShortcut.isEvent(e))264 return;265 278 snapHelper.setFixedMode(); 266 279 computeHelperLine(); 267 280 redrawIfRequired(); 268 281 } 269 282 private void doKeyReleaseEvent(KeyEvent e) { 270 if (!snappingShortcut.isEvent(e))271 return;272 283 snapHelper.unFixOrTurnOff(); 273 284 computeHelperLine(); 274 285 redrawIfRequired();
