1 /*
2  * Copyright (C) 2020 The HIME team, Taiwan
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation version 2.1
7  * of the License.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 
19 #ifndef HIME_CONF_H
20 #define HIME_CONF_H
21 
22 #define CHANGE_FONT_SIZE "change font size"
23 #define GB_OUTPUT_TOGGLE "gb output toggle"
24 #define SIM_OUTPUT_TOGGLE "gb output sim"
25 #define TRAD_OUTPUT_TOGGLE "gb output trad"
26 #define KBM_TOGGLE "kbm toggle"
27 #define UPDATE_TRAY "update tray"
28 #define RELOAD_TSIN_DB "reload tsin db"
29 #define HIME_EXIT_MESSAGE "hime exit"
30 
31 #define HIME_SETUP_WINDOW_TYPE_UTILITY "hime-setup-window-type-utility"
32 #define HIME_FONT_SIZE "hime-font-size"
33 #define HIME_FONT_NAME "hime-font-name"
34 #define HIME_FONT_SIZE_TSIN_PRESEL "hime-font-size-tsin-presel"
35 #define HIME_FONT_SIZE_SYMBOL "hime-font-size-symbol"
36 #define HIME_FONT_SIZE_TSIN_PHO_IN "hime-font-size-tsin-pho-in"
37 #define HIME_FONT_SIZE_GTAB_IN "hime-font-size-gtab-in"
38 #define HIME_FONT_SIZE_PHO_NEAR "hime-font-size-pho-near"
39 #define HIME_FONT_SIZE_WIN_KBM "hime-font-size-win-kbm"
40 #define HIME_FONT_SIZE_WIN_KBM_EN "hime-font-size-win-kbm-en"
41 #define HIME_INPUT_STYLE "hime-input-style"
42 #define HIME_ROOT_X "hime-root-x"
43 #define HIME_ROOT_Y "hime-root-y"
44 #define HIME_POP_UP_WIN "hime-pop-up-win"
45 #define HIME_ICON_DIR "hime-icon-dir"
46 #define HIME_INNER_FRAME "hime-inner-frame"
47 #define HIME_INIT_IM_ENABLED "hime-init-im-enabled"
48 #define HIME_INIT_FULL_MODE "hime-init-full-mode"
49 #define HIME_BELL_VOLUME "hime-bell-volume"
50 #define HIME_SOUND_PLAY_OVERLAP "hime-sound-play-overlap"
51 #define HIME_ENABLE_CTRL_ALT_SWITCH "hime-enable-ctrl-alt-switch"
52 #define HIME_EDIT_DISPLAY "hime-edit-display"
53 #define HIME_BELL_OFF "hime-bell-off"
54 #define HIME_ON_THE_SPOT_KEY "hime-on-the-spot-key"
55 #define HIME_TRAY_HF_WIN_KBM "hime-tray-hf-win-kbm"
56 #define HIME_SINGLE_STATE "hime-single-state"
57 #define HIME_PUNC_AUTO_SEND "hime-punc-auto-send"
58 
59 #define HIME_IM_TOGGLE_KEYS "hime-im-toggle-keys"
60 #define DEFAULT_INPUT_METHOD "default-input-method"
61 // #define LEFT_RIGHT_BUTTON_TIPS "left-right-button-tips"
62 #define HIME_STR_IM_CYCLE "hime-str-im-cycle"
63 #define HIME_REMOTE_CLIENT "hime-remote-client"
64 #define HIME_SHIFT_SPACE_ENG_FULL "hime-shift-space-eng-full"
65 #define HIME_STATUS_TRAY "hime-status-tray"
66 #define HIME_WIN_COLOR_FG "hime-win-color-fg"
67 #define HIME_WIN_COLOR_BG "hime-win-color-bg"
68 #define HIME_WIN_COLOR_USE "hime-win-color-use"
69 #define HIME_CAPSLOCK_LOWER "hime-capslock-lower"
70 #define HIME_ENG_PHRASE_ENABLED "hime-eng-phrase-enabled"
71 #define HIME_WIN_SYM_CLICK_CLOSE "hime-win-sym-click-close"
72 #define HIME_SEL_KEY_COLOR "hime-sel-key-color"
73 #define HIME_TRAY_DISPLAY "hime-tray-display"
74 
75 #define GTAB_DUP_SELECT_BELL "gtab-dup-select-bell"
76 #define GTAB_SPACE_AUTO_FIRST "gtab-space-auto-first"
77 #define GTAB_AUTO_SELECT_BY_PHRASE "gtab-auto-select-by_phrase"
78 #define GTAB_PRE_SELECT "gtab-pre-select"
79 #define GTAB_PHRASE_PRE_SELECT "gtab-phrase-pre-select"
80 #define GTAB_PRESS_FULL_AUTO_SEND "gtab-press-full-auto-send"
81 #define GTAB_DISP_PARTIAL_MATCH "gtab-disp-partial-match"
82 #define GTAB_DISP_KEY_CODES "gtab-disp-key-codes"
83 #define GTAB_DISP_IM_NAME "gtab-disp-im-name"
84 #define GTAB_INVALID_KEY_IN "gtab-invalid-key-in"
85 #define GTAB_SHIFT_PHRASE_KEY "gtab-shift-phrase-key"
86 #define GTAB_HIDE_ROW2 "gtab-hide-row2"
87 #define GTAB_IN_ROW1 "gtab-in-row1"
88 #define GTAB_VERTICAL_SELECT "gtab-vertical-select"
89 #define GTAB_UNIQUE_AUTO_SEND "gtab-unique-auto-send"
90 #define GTAB_QUE_WILD_CARD "gtab-que-wild-card"
91 #define GTAB_QUE_WILD_CARD_ASTERISK "gtab-que-wild-card-asterisk"
92 #define GTAB_PHO_QUERY "gtab-pho-query"
93 #define GTAB_PHRASE_PRE_SELECT "gtab-phrase-pre-select"
94 #define GTAB_IN_AREA_BUTTON "gtab-in-area-button"
95 
96 #define TSIN_PHRASE_PRE_SELECT "tsin-phrase-pre-select"
97 #define TSIN_CHINESE_ENGLISH_TOGGLE_KEY "tsin-chinese-english-toggle_key"
98 #define TSIN_SPACE_OPT "tsin-space-opt"
99 #define TSIN_BUFFER_SIZE "tsin-buffer-size"
100 #define TSIN_PHRASE_LINE_COLOR "tsin-phrase-line-color"
101 #define TSIN_CURSOR_COLOR "tsin-cursor-color"
102 #define TSIN_TONE_CHAR_INPUT "tsin-tone-char-input"
103 #define TSIN_TAB_PHRASE_END "tsin-tab-phrase-end"
104 #define TSIN_TAIL_SELECT_KEY "tsin-tail-select-key"
105 #define TSIN_BUFFER_EDITING_MODE "tsin-buffer-editing-mode"
106 #define TSIN_USE_PHO_NEAR "tsin-use-pho-near"
107 
108 #define PHO_HIDE_ROW2 "pho-hide-row2"
109 #define PHO_IN_ROW1 "pho-in-row1"
110 
111 #define PHONETIC_KEYBOARD "phonetic-keyboard2"
112 #define PHONETIC_KEYBOARD_BAK "phonetic-keyboard-bak"
113 
114 #define PHONETIC_CHAR_DYNAMIC_SEQUENCE "phonetic-char-dynamic-sequence"
115 #define PHONETIC_HUGE_TAB "phonetic-huge-tab"
116 #define PHONETIC_SPEAK "phonetic-speak"
117 #define PHONETIC_SPEAK_SEL "phonetic-speak-sel"
118 
119 extern int hime_setup_window_type_utility,
120     hime_font_size, hime_font_size_tsin_presel, hime_font_size_symbol,
121     hime_font_size_tsin_pho_in, hime_font_size_pho_near,
122     hime_font_size_gtab_in, hime_font_size_win_kbm, hime_font_size_win_kbm_en,
123     hime_inner_frame, hime_single_state,
124     hime_remote_client,
125     gtab_disp_key_codes, gtab_disp_im_name, hime_shift_space_eng_full,
126     gtab_invalid_key_in, gtab_hide_row2, gtab_in_row1,
127     hime_capslock_lower, pho_hide_row2, pho_in_row1,
128     hime_eng_phrase_enabled, hime_win_sym_click_close,
129     gtab_que_wild_card, gtab_que_wild_card_asterisk, gtab_pho_query,
130     hime_bell_volume, hime_sound_play_overlap, hime_enable_ctrl_alt_switch, hime_on_the_spot_key;
131 
132 extern int default_input_method;
133 // extern int left_right_button_tips;
134 extern int gtab_dup_select_bell;
135 extern int gtab_space_auto_first;
136 extern int gtab_auto_select_by_phrase;
137 extern int hime_im_toggle_keys;
138 extern int gtab_pre_select, gtab_phrase_pre_select;
139 extern int gtab_press_full_auto_send;
140 extern int gtab_disp_partial_match;
141 extern int gtab_shift_phrase_key, gtab_in_area_button;
142 extern int gtab_vertical_select, gtab_unique_auto_send;
143 extern int tsin_buffer_size;
144 extern int hime_input_style, hime_root_x, hime_root_y, hime_pop_up_win;
145 extern int hime_status_tray, hime_show_win_kbm, hime_tray_hf_win_kbm;
146 extern int hime_punc_auto_send;
147 
148 extern int tsin_phrase_pre_select;
149 extern int tsin_chinese_english_toggle_key;
150 extern int tsin_tab_phrase_end, tsin_tail_select_key;
151 extern int tsin_buffer_editing_mode;
152 extern int tsin_use_pho_near;
153 
154 extern int phonetic_char_dynamic_sequence;
155 extern int phonetic_huge_tab, phonetic_speak;
156 extern char *phonetic_speak_sel;
157 extern int tsin_space_opt, tsin_tone_char_input;
158 
159 extern char *tsin_phrase_line_color, *tsin_cursor_color, *hime_font_name, *hime_sel_key_color, *hime_icon_dir;
160 extern unich_t eng_full_str[], eng_half_str[], cht_full_str[];
161 extern char *eng_color_full_str, *eng_color_half_str, *cht_color_full_str;
162 extern char *hime_win_color_fg, *hime_win_color_bg;
163 extern int hime_win_color_use, hime_bell_off;
164 extern int hime_init_im_enabled, hime_init_full_mode;
165 extern int hime_edit_display, hime_tray_display;
166 extern char *pho_kbm_name, *pho_selkey, *hime_str_im_cycle;
167 extern int pho_candidate_col_N, pho_candidate_R2L;
168 
169 // hime-conf.c
170 void init_TableDir (void);
171 void get_hime_dir (char *tt);
172 void init_omni_config (void);
173 void free_omni_config (void);
174 void save_omni_config (void);
175 gboolean get_hime_user_fname (char *name, char fname[]);
176 void get_hime_conf_fname (char *name, char fname[]);
177 void get_hime_user_or_sys_fname (char *name, char fname[]);
178 void get_hime_conf_str (char *name, char **rstr, char *default_str);
179 void get_hime_conf_fstr (char *name, char rstr[], char *default_str);
180 int get_hime_conf_int (char *name, int default_value);
181 void save_hime_conf_str (char *name, char *str);
182 void save_hime_conf_int (char *name, int val);
183 void get_sys_table_file_name (char *name, char *fname);
184 char *get_hime_xim_name (void);
185 Atom get_hime_atom (Display *display);
186 
187 #endif /* HIME_CONF_H */
188