Changeset 8726


Ignore:
Timestamp:
03/06/05 19:31:08 (16 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/j/DescribeKeyDialog.java

    r8691 r8726  
    33 *
    44 * Copyright (C) 2000-2005 Peter Graves
    5  * $Id: DescribeKeyDialog.java,v 1.8 2005-03-03 19:12:46 piso Exp $
     5 * $Id: DescribeKeyDialog.java,v 1.9 2005-03-06 19:31:08 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4343    private boolean disposed;
    4444    private KeyMap requestedKeyMap;
     45    private EventSequence currentEventSequence;
    4546    private boolean local;
    4647
     
    7071        KeyMapping mapping = new KeyMapping(keycode, modifiers, null);
    7172        lastKeyText = mapping.getKeyText();
    72         Object command = describeKey(e.getKeyChar(), keycode, modifiers);
     73        Object command = describeKey(new JEvent(e));
    7374        if (eventHandled) {
    7475            if (keyStrokeText == null)
     
    100101                }
    101102            }
    102             Object command = describeKey(c, e.getKeyCode(), modifiers);
     103            Object command = describeKey(new JEvent(e));
    103104            if (command != null)
    104105                report(command);
     
    130131    }
    131132
    132     private Object describeKey(char keyChar, int keyCode, int modifiers)
     133    private Object describeKey(JEvent event)
    133134    {
    134135        if (disposed)
    135136            return null;
    136         // Mask off the bits we don't care about (Java 1.4).
    137         modifiers &= 0x0f;
     137        char keyChar = event.getKeyChar();
     138        int keyCode = event.getKeyCode();
     139        int modifiers = event.getModifiers() & 0x0f;
    138140        if (keyCode == 0 && modifiers == InputEvent.SHIFT_MASK) // Shift only.
    139141            modifiers = 0; // Ignore modifier.
     
    141143        if (requestedKeyMap != null) {
    142144            mapping = requestedKeyMap.lookup(keyChar, keyCode, modifiers);
     145            if (mapping == null && local) {
     146                // Not found in local keymap.
     147                EventSequence copy = currentEventSequence.copy();
     148                copy.addEvent(event);
     149                mapping = KeyMap.getGlobalKeyMap().lookupEventSequence(copy);
     150            }
    143151        } else {
    144152            final Mode mode = buffer.getMode();
     
    155163        Object command = mapping.getCommand();
    156164        if (command instanceof KeyMap) {
     165            if (currentEventSequence == null)
     166                currentEventSequence = new EventSequence();
     167            currentEventSequence.addEvent(event);
    157168            requestedKeyMap = (KeyMap) command;
    158169            return null;
Note: See TracChangeset for help on using the changeset viewer.