You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
3.3 KiB

  1. /*
  2. Copyright 2011 Jun Wako <wakojun@gmail.com>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #pragma once
  15. /* FIXME: Add doxygen comments for the behavioral defines in here. */
  16. /* TODO: Refactoring */
  17. typedef enum { ONESHOT, CONSOLE, MOUSEKEY } command_state_t;
  18. extern command_state_t command_state;
  19. /* This allows to extend commands. Return false when command is not processed. */
  20. bool command_extra(uint8_t code);
  21. bool command_console_extra(uint8_t code);
  22. #ifdef COMMAND_ENABLE
  23. bool command_proc(uint8_t code);
  24. #else
  25. # define command_proc(code) false
  26. #endif
  27. #ifndef IS_COMMAND
  28. # define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)
  29. #endif
  30. #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
  31. # define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
  32. #endif
  33. #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
  34. # define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
  35. #endif
  36. #ifndef MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
  37. # define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
  38. #endif
  39. #ifndef MAGIC_KEY_HELP
  40. # define MAGIC_KEY_HELP H
  41. #endif
  42. #ifndef MAGIC_KEY_HELP_ALT
  43. # define MAGIC_KEY_HELP_ALT SLASH
  44. #endif
  45. #ifndef MAGIC_KEY_DEBUG
  46. # define MAGIC_KEY_DEBUG D
  47. #endif
  48. #ifndef MAGIC_KEY_DEBUG_MATRIX
  49. # define MAGIC_KEY_DEBUG_MATRIX X
  50. #endif
  51. #ifndef MAGIC_KEY_DEBUG_KBD
  52. # define MAGIC_KEY_DEBUG_KBD K
  53. #endif
  54. #ifndef MAGIC_KEY_DEBUG_MOUSE
  55. # define MAGIC_KEY_DEBUG_MOUSE M
  56. #endif
  57. #ifndef MAGIC_KEY_VERSION
  58. # define MAGIC_KEY_VERSION V
  59. #endif
  60. #ifndef MAGIC_KEY_STATUS
  61. # define MAGIC_KEY_STATUS S
  62. #endif
  63. #ifndef MAGIC_KEY_CONSOLE
  64. # define MAGIC_KEY_CONSOLE C
  65. #endif
  66. #ifndef MAGIC_KEY_LAYER0
  67. # define MAGIC_KEY_LAYER0 0
  68. #endif
  69. #ifndef MAGIC_KEY_LAYER0_ALT
  70. # define MAGIC_KEY_LAYER0_ALT GRAVE
  71. #endif
  72. #ifndef MAGIC_KEY_LAYER1
  73. # define MAGIC_KEY_LAYER1 1
  74. #endif
  75. #ifndef MAGIC_KEY_LAYER2
  76. # define MAGIC_KEY_LAYER2 2
  77. #endif
  78. #ifndef MAGIC_KEY_LAYER3
  79. # define MAGIC_KEY_LAYER3 3
  80. #endif
  81. #ifndef MAGIC_KEY_LAYER4
  82. # define MAGIC_KEY_LAYER4 4
  83. #endif
  84. #ifndef MAGIC_KEY_LAYER5
  85. # define MAGIC_KEY_LAYER5 5
  86. #endif
  87. #ifndef MAGIC_KEY_LAYER6
  88. # define MAGIC_KEY_LAYER6 6
  89. #endif
  90. #ifndef MAGIC_KEY_LAYER7
  91. # define MAGIC_KEY_LAYER7 7
  92. #endif
  93. #ifndef MAGIC_KEY_LAYER8
  94. # define MAGIC_KEY_LAYER8 8
  95. #endif
  96. #ifndef MAGIC_KEY_LAYER9
  97. # define MAGIC_KEY_LAYER9 9
  98. #endif
  99. #ifndef MAGIC_KEY_BOOTLOADER
  100. # define MAGIC_KEY_BOOTLOADER B
  101. #endif
  102. #ifndef MAGIC_KEY_BOOTLOADER_ALT
  103. # define MAGIC_KEY_BOOTLOADER_ALT ESC
  104. #endif
  105. #ifndef MAGIC_KEY_LOCK
  106. # define MAGIC_KEY_LOCK CAPS
  107. #endif
  108. #ifndef MAGIC_KEY_EEPROM
  109. # define MAGIC_KEY_EEPROM E
  110. #endif
  111. #ifndef MAGIC_KEY_EEPROM_CLEAR
  112. # define MAGIC_KEY_EEPROM_CLEAR BACKSPACE
  113. #endif
  114. #ifndef MAGIC_KEY_NKRO
  115. # define MAGIC_KEY_NKRO N
  116. #endif
  117. #ifndef MAGIC_KEY_SLEEP_LED
  118. # define MAGIC_KEY_SLEEP_LED Z
  119. #endif
  120. #define XMAGIC_KC(key) KC_##key
  121. #define MAGIC_KC(key) XMAGIC_KC(key)