1 /* A library to output the right key shortcut in any common app.
2 Given a global variable babble_mode to show the environment and a
3 key that calls the paste macro, do the right type of paste.
5 Setting the bable_mode is done by another macro, or TBD interaction with the host.
7 Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
8 and jeebak & algernon's keymap
10 #ifndef _babblePaste_h_included__
11 #define _babblePaste_h_included__
12 #include "../MS_sculpt_mobile/config.h"
13 #include "action_layer.h"
14 #include "quantum_keycodes.h"
18 /* ***************************
20 // Uncomment any modes you want. Whatever mode = 0 will be the default on boot
21 // Expect to get errors if you comment a feature out and leave it in your keymap.
25 //#define MS_MODE 0 // Windows.
27 //#define LINUX_MODE 2 //aka gnome+KDE
28 //#define EMACS_MODE 3
30 //#define WORDSTAR_MODE 5
31 //#define READMUX 6 // Readline and tmux
33 // This removes everything but cursor movement
34 //#define BABL_MOVEMENTONLY
35 // and this just removes browser shortcuts
36 //#define BABL_NOBROWSER
37 ****************************/
40 // Uncomment if you need more free flash space
41 // It removes everything but cursor movement
42 //#define BABL_MOVEMENTONLY
45 // Define starting number for BABL macros in the macro range.
46 // Probably can start the default even lower
47 #define BABL_START_NUM 50
49 /* Macros handled by babblepaste. Most should be available for all platforms.
50 Whatever isn't defined will NOP */
54 BABL_GO_LEFT_1C= BABL_START_NUM,
67 // And the delete options
68 //BABL_DEL_LEFT_1C == backspace, so why bother.
69 BABL_DEL_RIGHT_1C, // usually = Del
72 BABL_DEL_TO_LINE_END, // delete from cursor to end of line
73 BABL_DEL_TO_LINE_START, // delete from cursor to begining line
74 #ifndef BABL_MOVEMENTONLY
82 /* not yet implemented
83 BABL_SWAP_LAST2C // swap last characters before the cursor
84 BABL_SWAP_LAST2W // Swap the last two words before the cursor
93 BABL_SWITCH_APP_LAST, // previous
97 #ifndef BABL_NOBROWSER
99 BABL_BROWSER_CLOSE_TAB,
100 BABL_BROWSER_REOPEN_LAST_TAB,
101 BABL_BROWSER_NEXT_TAB,
102 BABL_BROWSER_PREV_TAB,
103 BABL_BROWSER_URL_BAR,
104 BABL_BROWSER_FORWARD,
107 BABL_BROWSER_BOOKMARK,
108 BABL_BROWSER_DEV_TOOLS, // hard one to remember
110 BABL_BROWSER_FULLSCREEN,
111 BABL_BROWSER_ZOOM_IN,
112 BABL_BROWSER_ZOOM_OUT,
117 // Macros for mode switching
140 // BUG, used to jump to babble functiion. Surely there is a way to calculate size of enum?
141 #define BABL_NUM_MACROS 48+4 // 48 + # of defined modes.
143 /* And all the shorthand keymap ready versions */
144 // First the mode switching macros
146 #define B_WIN M(BABL_WINDOWS)
149 #define B_MAC M(BABL_MAC)
152 #define B_LNX M(BABL_LINUX)
155 #define B_EMAX M(BABL_EMACS)
158 #define B_VI M(BABL_VI)
161 #define B_READ M(BABL_READLINE)
164 // and all the movement & action.
166 #define B_L1C M(BABL_GO_LEFT_1C)
167 #define B_R1C M(BABL_GO_RIGHT_1C)
168 #define B_L1W M(BABL_GO_LEFT_WORD)
169 #define B_R1W M(BABL_GO_RIGHT_WORD)
170 #define B_GSOL M(BABL_GO_START_LINE)
171 #define B_GEOL M(BABL_GO_END_LINE)
172 #define B_GTOP M(BABL_GO_START_DOC)
173 #define B_GEND M(BABL_GO_END_DOC)
174 #define B_DOWN M(BABL_GO_NEXT_LINE)
175 #define B_UP M(BABL_GO_PREV_LINE)
176 #define B_PGDN M(BABL_PGDN)
177 #define B_PGUP M(BABL_PGUP)
178 //#define B_BKSP M(BABL_DEL_LEFT_1C) == backspace so why bother.
179 #define B_DEL M(BABL_DEL_RIGHT_1C) // usually = Del
180 #define B_DLW M(BABL_DEL_LEFT_WORD)
181 #define B_DRW M(BABL_DEL_RIGHT_WORD)
182 #define B_DEOL M(BABL_DEL_TO_LINE_END) // delete from cursor to end of line
183 #define B_DSOL M(BABL_DEL_TO_LINE_START) // delete from cursor to begining line
184 #define B_UNDO M(BABL_UNDO)
185 #define B_REDO M(BABL_REDO)
186 #define B_CUT M(BABL_CUT)
187 #define B_COPY M(BABL_COPY)
188 #define B_PAST M(BABL_PASTE)
189 #define B_SELA M(BABL_SELECT_ALL)
190 #define B_FIND M(BABL_FIND)
191 #define B_FINDN M(BABL_FIND_NEXT)
192 #define B_FINDR M(BABL_FIND_REPLACE)
193 #define B_RAPP M(BABL_RUNAPP)
194 #define B_NAPP M(BABL_SWITCH_APP_NEXT)
195 #define B_PAPP M(BABL_SWITCH_APP_LAST) // previous
196 #define B_CAPP M(BABL_CLOSE_APP)
197 #define B_HELP M(BABL_HELP)
198 #define B_NTAB M(BABL_BROWSER_NEW_TAB)
199 #define B_CTAB M(BABL_BROWSER_CLOSE_TAB)
200 #define B_ROTB M(BABL_BROWSER_REOPEN_LAST_TAB)
201 #define B_NXTB M(BABL_BROWSER_NEXT_TAB)
202 #define B_PTAB M(BABL_BROWSER_PREV_TAB)
203 #define B_NURL M(BABL_BROWSER_URL_BAR)
204 #define B_BFWD M(BABL_BROWSER_FORWARD)
205 #define B_BBAK M(BABL_BROWSER_BACK)
206 #define B_BFND M(BABL_BROWSER_FIND)
207 #define B_BOOK M(BABL_BROWSER_BOOKMARK)
208 #define B_BDEV M(BABL_BROWSER_DEV_TOOLS) // hard one to remember
209 #define B_BRLD M(BABL_BROWSER_RELOAD)
210 #define B_BFUlL M(BABL_BROWSER_FULLSCREEN)
211 #define B_ZMIN M(BABL_BROWSER_ZOOM_IN)
212 #define B_ZMOT M(BABL_BROWSER_ZOOM_OUT)
220 /* from action_macro.h
221 typedef uint8_t macro_t;
223 #define MACRO_NONE (macro_t*)0
224 #define MACRO(...) ({ static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; })
225 #define MACRO_GET(p) pgm_read_byte(p)
227 #define BABL_MSTART (entry, os, macro...) ( const macro_t bablDict[entry][os] PROGMEM = { macro... }; )
231 const macro_t *babblePaste(keyrecord_t *record, uint8_t shortcut);
233 macro_t* switch_babble_mode( uint8_t id);