diff options
| author | Jules Aguillon | 2022-11-13 16:45:57 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2022-11-13 16:45:57 +0100 |
| commit | 2aa98de7aa9635a3deed1a64abe5d3ad421f50ff (patch) | |
| tree | 3a789837a6ff63a29995e639e8f3b92209c20900 /srcs/juloo.keyboard2/KeyValue.java | |
| parent | 078dbcd5ff7f0828f48d66d866ea49d3eb14cc6a (diff) | |
| download | unexpected-keyboard-2aa98de7aa9635a3deed1a64abe5d3ad421f50ff.tar.gz unexpected-keyboard-2aa98de7aa9635a3deed1a64abe5d3ad421f50ff.zip | |
Add editing keys: copy, paste, cut, select all
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index df0d290..7215736 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -52,9 +52,17 @@ final class KeyValue FN, // Must be placed last to be applied first } + public static enum Editing + { + COPY, + PASTE, + CUT, + SELECT_ALL, + } + public static enum Kind { - Char, String, Keyevent, Event, Modifier + Char, String, Keyevent, Event, Modifier, Editing } // Behavior flags. @@ -132,6 +140,12 @@ final class KeyValue return Modifier.values()[(_code & VALUE_BITS)]; } + /** Defined only when [getKind() == Kind.Editing]. */ + public Editing getEditing() + { + return Editing.values()[(_code & VALUE_BITS)]; + } + /* Update the char and the symbol. */ public KeyValue withChar(char c) { @@ -247,6 +261,12 @@ final class KeyValue addKeyeventKey(name, String.valueOf((char)symbol), code, flags | FLAG_KEY_FONT); } + private static void addEditingKey(String name, String symbol, Editing action) + { + addKey(name, symbol, Kind.Editing, action.ordinal(), + FLAG_SPECIAL | FLAG_SECONDARY | FLAG_SMALLER_FONT); + } + // Within VALUE_BITS private static int placeholder_unique_id = 0; @@ -332,6 +352,11 @@ final class KeyValue addPlaceholderKey("removed"); addPlaceholderKey("f11_placeholder"); addPlaceholderKey("f12_placeholder"); + + addEditingKey("copy", "copy", Editing.COPY); + addEditingKey("paste", "paste", Editing.PASTE); + addEditingKey("cut", "cut", Editing.CUT); + addEditingKey("select_all", "s. all", Editing.SELECT_ALL); } static final HashMap<String, String> keys_descr = new HashMap<String, String>(); |
