1 /++ 2 The "keyboard palette widget" is a thing for visually representing hotkeys. 3 4 It lays out a bunch of clickable buttons similar to the ascii latter keys on a qwerty keyboard. Each one has an icon and a letter associated with it. If you hold shift, it can change to a second page of items. 5 6 The intention is that input would be layered through some redirects. Normally, ctrl+letters are shortcuts for menu items. Alt+letters are for menu opening. Logo+letters are reserved for the window manager. So this leaves unshifted and shifted keys for you to use. 7 8 My convention is that F-keys are shortcuts for either tabs or menu items. 9 10 Numbers are for switching other things like your brush. 11 12 Letters are thus your main interaction, and symbols can be secondary tool changes. 13 You could be in one of three modes: 14 1) Pick a tool, pick a color, and place with a thing (really mouse interaction mode) 15 2) Pick a tool, place colors directly on press (keyboard interaction?) 16 3) Pick a color, use a tool 17 4) vi style sentences 18 19 It will emit a selection changed event when the user changes the selection. (what about right click? want separate selections for different buttons?) 20 It will emit a rebind request event when the user tries to rebind it (typically a double click) 21 22 LETTERS (26 total plus shifts) 23 NUMBERS / NUMPAD (10 total plus shifts) 24 OTHER KEYS (11 total plus shifts) 25 ` - = 26 [ ] \ 27 ; ' 28 , . / 29 30 Leaves: tab, space, enter, backspace and of course: arrows, the six pak insert etc. and the F-keys 31 32 Each thing has: Icon / Label / Hotkey / Code or Associated Object. 33 34 USAGE: 35 36 Create a container widget 37 Put the keyboard palette widget in the container 38 Put your other content in the container 39 Make the container get the actual keyboard focus, let this hook into its parent events. 40 41 TOOLS: 42 place, stamp, select (circle, rectangle, free-form, path) 43 flood fill 44 move selection.. move selected contents 45 scroll (click and drag on the map scrolls the view) 46 47 So really you'd first select tool then select subthing of tool. 48 49 1 = pen. letters = what thing you're placing 50 2 = select. letters = shape or operation of selection 51 r = rectangle 52 p = path 53 c = circle 54 e = ellipse 55 q = freeform 56 a = all 57 n = none 58 z = fuzzy (select similar things) 59 f = flood fill <convenience operator>, then letter to pick a color/tile. fill whole selection, fill zone inside selection 60 m = move 61 62 select wants add, replace, subtract, intersect. 63 64 2 = replace selection 65 3 = add to selection 66 4 = remove from selection 67 5 = intersect selection 68 69 save/recall selection 70 save/goto marked scroll place. it can be an icon of a minimap with a highlight: 3x pixel, black/white/black, pointing to it from each edge then a 7x7 px highlight of the thing 71 +/ 72 module arsd.minigui_addons.keyboard_palette_widget; 73 74 import arsd.minigui; 75 76 enum KeyGroups { 77 letters, 78 numbers, 79 symbols, 80 fkeys 81 } 82 83 struct PaletteItem { 84 string label; 85 MemoryImage icon; 86 Key hotkey; 87 Object obj; 88 } 89 90 class KeyboardPaletteWidget : Widget { 91 this(Widget parent) { 92 super(parent); 93 } 94 }