2
0

babblePaste.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.
  4. Setting the bable_mode is done by another macro, or TBD interaction with the host.
  5. Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
  6. and jeebak & algernon's keymap
  7. */
  8. #ifndef _babblePaste_h_included__
  9. #define _babblePaste_h_included__
  10. #include "action_layer.h"
  11. #ifdef USE_BABLPASTE
  12. /* ***************************
  13. // Uncomment any modes you want. Whatever mode = 0 will be the default on boot
  14. //#define MS_MODE 0 // Windows.
  15. //#define MAC_MODE 1
  16. //#define LINUX_MODE 2 //aka gnome+KDE
  17. //#define EMACS_MODE 3
  18. //#define VI_MODE 4
  19. //#define WORDSTAR_MODE 5
  20. //#define READMUX 6 // Readline and tmux
  21. ****************************/
  22. // Uncomment if you need more free flash space
  23. // It removes everything but cursor movement
  24. //#define BABL_MOVEMENTONLY
  25. // Define starting number for BABL macros in the macro range.
  26. // Probably can start the default even lower
  27. #define BABL_START_NUM 50
  28. /* Macros handled by babblepaste. Most should be available for all platforms.
  29. Whatever isn't defined will NOP */
  30. enum {
  31. // Movement
  32. BABL_DEL_RIGHT_1C= BABL_START_NUM,
  33. BABL_DEL_LEFT_WORD,
  34. BABL_DEL_RIGHT_WORD,
  35. BABL_GO_LEFT_1C,
  36. BABL_GO_RIGHT_1C,
  37. BABL_GO_LEFT_WORD,
  38. BABL_GO_RIGHT_WORD,
  39. BABL_GO_START_LINE,
  40. BABL_GO_END_LINE,
  41. BABL_GO_START_DOC,
  42. BABL_GO_END_DOC,
  43. BABL_GO_NEXT_LINE,
  44. BABL_GO_PREV_LINE,
  45. BABL_PGDN,
  46. BABL_PGUP,
  47. #ifndef BABL_MOVEMENTONLY
  48. // Cut & Paste
  49. BABL_UNDO,
  50. BABL_REDO,
  51. BABL_CUT,
  52. BABL_COPY,
  53. BABL_PASTE,
  54. BABL_SELECT_ALL,
  55. // GUI or app
  56. BABL_FIND,
  57. BABL_FIND_NEXT,
  58. BABL_FIND_REPLACE,
  59. BABL_RUNAPP,
  60. BABL_SWITCH_APP_NEXT,
  61. BABL_SWITCH_APP_LAST, // previous
  62. BABL_CLOSE_APP,
  63. BABL_HELP
  64. #endif
  65. };
  66. // How many macros/ how many array elements?
  67. #define BABL_NUM_MACROS 28
  68. /* from action_macro.h
  69. typedef uint8_t macro_t;
  70. #define MACRO_NONE (macro_t*)0
  71. #define MACRO(...) ({ static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; })
  72. #define MACRO_GET(p) pgm_read_byte(p)
  73. #define BABL_MSTART (entry, os, macro...) ( const macro_t bablDict[entry][os] PROGMEM = { macro... }; )
  74. */
  75. const macro_t *babblePaste(keyrecord_t *record, uint8_t shortcut);
  76. macro_t* switch_babble_mode( uint8_t id);
  77. #endif
  78. #endif