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.

90 lines
3.6 KiB

  1. #pragma once
  2. #include "quantum.h"
  3. #include "action_layer.h"
  4. #define EECONFIG_EDVORAK (uint8_t *)20
  5. // clang-format off
  6. #define __EDVORAKJP_BASE_L1__ KC_QUOTE, KC_COMMA, KC_DOT, KC_Y, KC_Q
  7. #define __EDVORAKJP_BASE_L2__ KC_A, LALT_T(KC_O), LGUI_T(KC_E), LCTL_T(KC_I), KC_U
  8. #define __EDVORAKJP_BASE_L3__ KC_SCOLON, KC_X, KC_C, KC_V, KC_Z
  9. #define __EDVORAKJP_BASE_R1__ KC_F, KC_G, KC_R, KC_W, KC_P
  10. #define __EDVORAKJP_BASE_R2__ KC_D, RSFT_T(KC_T), RGUI_T(KC_N), RALT_T(KC_S), KC_M
  11. #define __EDVORAKJP_BASE_R3__ KC_H, KC_J, KC_K, KC_L, KC_B
  12. #define __EDVORAKJP_NUMBER_L__ KC_1, LALT_T(KC_2), LGUI_T(KC_3), LCTL_T(KC_4), KC_5
  13. #define __EDVORAKJP_NUMBER_R__ KC_6, RSFT_T(KC_7), RGUI_T(KC_8), RALT_T(KC_9), KC_0
  14. #define __EDVORAKJP_FUNCTION_L__ KC_F1, KC_F2, LALT_T(KC_F3), LGUI_T(KC_F4), LCTL_T(KC_F5), KC_F6
  15. #define __EDVORAKJP_FUNCTION_R__ KC_F7, RSFT_T(KC_F8), RGUI_T(KC_F9), RALT_T(KC_F10), KC_F11, KC_F12
  16. #define __EDVORAKJP_SYMBOL_L__ KC_EXCLAIM, KC_AT, KC_HASH, KC_DOLLAR
  17. #define __EDVORAKJP_SYMBOL_R__ KC_PERCENT, KC_CIRCUMFLEX, KC_AMPERSAND, KC_ASTERISK
  18. #define __EDVORAKJP_BRACKET_L__ KC_LEFT_CURLY_BRACE, KC_LBRACKET, KC_LEFT_PAREN
  19. #define __EDVORAKJP_BRACKET_R__ KC_RIGHT_PAREN, KC_RBRACKET, KC_RIGHT_CURLY_BRACE
  20. #define __EDVORAKJP_PAGE__ KC_HOME, KC_PGDOWN, KC_PGUP, KC_END
  21. #define __EDVORAKJP_CURSOR__ KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT
  22. #define LA_TAB LALT_T(KC_TAB)
  23. #define LS_SPC LSFT_T(KC_SPACE)
  24. #define RC_BSPC RCTL_T(KC_BSPACE)
  25. #define RC_DEL RCTL_T(KC_DELETE)
  26. #define RG_ENT RGUI_T(KC_ENTER)
  27. #define LOWER_TD TD(TD_EDVORAKJP_LOWER)
  28. #define RAISE_TD TD(TD_EDVORAKJP_RAISE)
  29. // clang-format on
  30. extern keymap_config_t keymap_config;
  31. enum edvorakjp_layers {
  32. L_EDVORAKJP_BASE = 0,
  33. L_EDVORAKJP_LOWER,
  34. L_EDVORAKJP_RAISE,
  35. L_EDVORAKJP_ADJUST,
  36. L_EDVORAKJP_EXTRA,
  37. };
  38. enum edvorakjp_keycodes {
  39. KC_EDVORAKJP_LOWER = SAFE_RANGE,
  40. KC_EDVORAKJP_RAISE,
  41. KC_MAC,
  42. KC_WIN,
  43. KC_JPN,
  44. KC_ENG,
  45. NEW_SAFE_RANGE,
  46. };
  47. enum tap_dance_code {
  48. TD_EDVORAKJP_LOWER = 0,
  49. TD_EDVORAKJP_RAISE,
  50. };
  51. // base
  52. void matrix_init_user(void);
  53. void matrix_init_keymap(void);
  54. layer_state_t layer_state_set_user(layer_state_t state);
  55. uint32_t layer_state_set_keymap(uint32_t state);
  56. bool process_record_user(uint16_t keycode, keyrecord_t *record);
  57. bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
  58. // status
  59. void edvorakjp_status_init(void);
  60. bool get_enable_kc_lang(void);
  61. void set_enable_kc_lang(bool new_state);
  62. bool get_japanese_mode(void);
  63. void set_japanese_mode(bool new_state);
  64. /*
  65. * Each process_record_* methods defined here are
  66. * return false if processed, or return true if not processed.
  67. * You can add your original macros in process_record_keymap() in keymap.c.
  68. */
  69. bool process_record_edvorakjp_swap_scln(uint16_t keycode, keyrecord_t *record);
  70. bool process_record_edvorakjp_config(uint16_t keycode, keyrecord_t *record);
  71. bool process_record_layer(uint16_t keycode, keyrecord_t *record);
  72. bool process_record_ime(uint16_t keycode, keyrecord_t *record);