mod_layer.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #pragma once
  2. /*
  3. Copyright 2018 Eric Gebhart <e.a.gebhart@gmail.com>
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. // define our rows for the mod layer
  16. // takes 5 keycodes, adds mods, and left and right edge keys.
  17. // So we get keycodes in groups of 6.
  18. //
  19. // #define LANG_IS BEPO // to get Bepo substititions for keys and LTs.
  20. // #define NO_EDGE_COL // for 5 column keyboards with no sixth column.
  21. //
  22. // wrap layers that have alternates for other locales with LANG_N
  23. // this will change the name, from _SYMB to _SYMB_BP as needed.
  24. //
  25. // Home Row mods and other things like that go here.
  26. #include "keycodes.h"
  27. #include "alt_mods.h"
  28. #include "hrm_sacg.h"
  29. #include "hrm_gacs.h"
  30. #include "hrm_gacs_miryoku.h"
  31. #include "hrm_gasc.h"
  32. #include "hrs_nav.h"
  33. #include "trns_mods.h"
  34. // redefined by the map as needed.
  35. //#base_cols_in_out 5_6 // 5, 5_6, 6
  36. // MOD_ROW
  37. // variants.
  38. // input 5 get six, left and right language specific outer edge keys.
  39. // no edge keys.
  40. // input 5 get 5 with mods applied.
  41. // input 6 get 6 with mods applied.
  42. // base cols in out. 5, 5_6, 6.
  43. // input column count, output column count, if different.
  44. #define CONCATENATER(a, ...) a ## __VA_ARGS__
  45. #define CATR(a, ...) CONCATENATER(a, __VA_ARGS__)
  46. #define CONCATENATER2(a, ...) a ## __VA_ARGS__
  47. #define CATR2(a, ...) CONCATENATER2(a, __VA_ARGS__)
  48. #define CONCATENATER3(a, ...) a ## __VA_ARGS__
  49. #define CATR3(a, ...) CONCATENATER3(a, __VA_ARGS__)
  50. // mod layer name construction. add new layer extensions here.
  51. // TRNS, ALT, HRM_GACS, HRM_SCAG, HRM_GASC, MIRYOKU_HRM_GASC
  52. #define MOD_EXT CATR3(MODS_ARE, _MOD)
  53. #define TRNS_MOD _trns
  54. #define HRM_SCAG_MOD _hrm_scag
  55. #define HRM_GACS_MOD _hrm_gacs
  56. #define HRM_GASC_MOD _hrm_gasc
  57. #define MIRYOKU_HRM_GACS_MOD _miryoku_hrm_gacs
  58. #define ALT_MOD _alt
  59. #define HRS_NAV_MOD _hrs_nav
  60. // MOD_COL_NAME(ROW0L) -- > ROW0L_5, ROW0L_6, ROW0L_5_6
  61. #define MOD_COL_NAME(NAME) CATR2(CATR(NAME, _), BASE_COLS_IN_OUT)
  62. // MOD_ROW(ROW0L) -- > ROW0L_5_alt, ROW0L_6_alt, ROW0L_5_6_alt
  63. #define MOD_ROW(NAME) CATR3(MOD_COL_NAME(NAME), MOD_EXT)
  64. // change the columns in/out according to the map and the keyboard.
  65. //#define BASE_COLS_IN_OUT 5_6 // 5, 5_6, 6
  66. // These make it easier to create base layer layouts.
  67. // They take 3x10, or 3x12 and make a 3x12 with mods.
  68. // this isnt always useful, sometimes rows need to be
  69. // specified explicitly in the layout. ie. layouts with
  70. // extra keys in the middle.
  71. #define MOD_CORE_3x5( \
  72. K01, K02, K03, K04, K05, \
  73. K06, K07, K08, K09, K0A, \
  74. K11, K12, K13, K14, K15, \
  75. K16, K17, K18, K19, K1A, \
  76. K21, K22, K23, K24, K25, \
  77. K26, K27, K28, K29, K2A) \
  78. MOD_ROW(ROW1L)(K01, K02, K03, K04, K05), \
  79. MOD_ROW(ROW1R)(K06, K07, K08, K09, K0A), \
  80. MOD_ROW(ROW2L)(K11, K12, K13, K14, K15), \
  81. MOD_ROW(ROW2R)(K16, K17, K18, K19, K1A), \
  82. MOD_ROW(ROW3L)(K21, K22, K23, K24, K25), \
  83. MOD_ROW(ROW3R)(K26, K27, K28, K29, K2A)
  84. #define MOD_CORE_3x6(K01, K02, K03, K04, K05, K06, \
  85. K07, K08, K09, K0A, K0B, K0C, \
  86. K11, K12, K13, K14, K15, K16, \
  87. K17, K18, K19, K1A, K1B, K1C, \
  88. K21, K22, K23, K24, K25, K26, \
  89. K27, K28, K29, K2A, K2B, K2C) \
  90. MOD_ROW(ROW1L)(K01, K02, K03, K04, K05, K06), \
  91. MOD_ROW(ROW1R)(K07, K08, K09, K0A, K0B, K0C), \
  92. MOD_ROW(ROW2L)(K11, K12, K13, K14, K15, K16), \
  93. MOD_ROW(ROW2R)(K17, K18, K19, K1A, K1B, K1C), \
  94. MOD_ROW(ROW3L)(K21, K22, K23, K24, K25, K26), \
  95. MOD_ROW(ROW3R)(K27, K28, K29, K2A, K2B, K2C)
  96. /// 4 rows for keyboards with number rows.
  97. #define MOD_CORE_4x5( \
  98. K01, K02, K03, K04, K05, \
  99. K06, K07, K08, K09, K0A, \
  100. K11, K12, K13, K14, K15, \
  101. K16, K17, K18, K19, K1A, \
  102. K21, K22, K23, K24, K25, \
  103. K26, K27, K28, K29, K2A, \
  104. K31, K32, K33, K34, K35, \
  105. K36, K37, K38, K39, K3A) \
  106. MOD_ROW(ROW0L)(K01, K02, K03, K04, K05), \
  107. MOD_ROW(ROW0R)(K06, K07, K08, K09, K0A), \
  108. MOD_CORE_3x5(K11, K12, K13, K14, K15, \
  109. K16, K17, K18, K19, K1A, \
  110. K21, K22, K23, K24, K25, \
  111. K26, K27, K28, K29, K2A, \
  112. K31, K32, K33, K34, K35, \
  113. K36, K37, K38, K39, K3A)
  114. #define MOD_CORE_4x6(K01, K02, K03, K04, K05, K06, \
  115. K07, K08, K09, K0A, K0B, K0C, \
  116. K11, K12, K13, K14, K15, K16, \
  117. K17, K18, K19, K1A, K1B, K1C, \
  118. K21, K22, K23, K24, K25, K26, \
  119. K27, K28, K29, K2A, K2B, K2C, \
  120. K31, K32, K33, K34, K35, K36, \
  121. K37, K38, K39, K3A, K3B, K3C \
  122. ) \
  123. MOD_ROW(ROW0L)(K01, K02, K03, K04, K05, K06), \
  124. MOD_ROW(ROW0R)(K07, K08, K09, K0A, K0B, K0C), \
  125. MOD_CORE_3x6(K11, K12, K13, K14, K15, K16, \
  126. K17, K18, K19, K1A, K1B, K1C, \
  127. K21, K22, K23, K24, K25, K26, \
  128. K27, K28, K29, K2A, K2B, K2C, \
  129. K31, K32, K33, K34, K35, K36, \
  130. K37, K38, K39, K3A, K3B, K3C)