1 /**************************************************************************/
2 /*  Klavaro - a flexible touch typing tutor                               */
3 /*  Copyright (C) from 2005 until 2008 Felipe Castro                      */
4 /*  Copyright (C) from 2009 until 2019 The Free Software Foundation       */
5 /*                                                                        */
6 /*  This program is free software, licensed under the terms of the GNU    */
7 /*  General Public License as published by the Free Software Foundation,  */
8 /*  either version 3 of the License, or (at your option) any later        */
9 /*  version. You should have received a copy of the GNU General Public    */
10 /*  License along with this program. If not,                              */
11 /*  see <https://www.gnu.org/licenses/>.                                  */
12 /**************************************************************************/
13 
14 #define KEYB_AUTO_SAVE "tmp_auto"
15 
16 #define MAX_KEYBOARDS 200
17 #define KEY_LINE_LEN (14 + 1)	/* 14 keys + 1 NULL char */
18 
19 #define UPSYM ((gunichar) 182)
20 #define URDU_STOP ((gunichar) 0x06D4)
21 #define URDU_COMMA ((gunichar) 0x060C)
22 #define DEVANAGARI_STOP ((gunichar) 0x0964)
23 #define TIBETAN_WORD_DELIMITER ((gunichar) 0x0F0B)
24 #define TIBETAN_STOP ((gunichar) 0x0F0D)
25 #define TIBETAN_COMMA ((gunichar) L' ')
26 #define BO_NARO ((gunichar) 0x0F7C)
27 
28 /* Pretty colors
29  */
30 #define KEYB_GREEN "#aaeebb"
31 #define KEYB_RED "#eeaaaa"
32 #define KEYB_BLUE "#bbbbff"
33 #define KEYB_YELLOW "#eeee88"
34 #define KEYB_ORANGE "#ffcc77" /* "#ffdd88" */
35 #define KEYB_PURPLE "#ccaacc"
36 #define KEYB_BLACK "#000000"
37 
38 typedef struct _KEYBLAYOUT
39 {
40 	gchar *name;
41 	gchar *country;
42 	gchar *variant;
43 } KeybLayout;
44 
45 /*
46  * Interface
47  */
48 gchar *keyb_get_name (void);
49 
50 gchar * keyb_get_name_last (void);
51 
52 void keyb_set_name (const gchar * name);
53 
54 void keyb_init_name (const gchar * name);
55 
56 gunichar keyb_get_lochars (gint i, gint j);
57 
58 gunichar keyb_get_upchars (gint i, gint j);
59 
60 gboolean keyb_get_modified_status (void);
61 
62 void keyb_set_modified_status (gboolean new_status);
63 
64 /*
65  * Auxiliar
66  */
67 void keyb_create_virtual_keys (void);
68 
69 void keyb_set_chars (void);
70 
71 gboolean keyb_is_vowel (gunichar chr);
72 
73 gboolean keyb_is_diacritic (gunichar chr);
74 
75 gboolean keyb_is_inset (gunichar chr);
76 
77 gint keyb_get_vowels (gunichar * vows);
78 
79 gint keyb_get_consonants (gunichar * consonants);
80 
81 gint keyb_get_symbols (gunichar * symbols);
82 
83 gint keyb_get_altnums (gunichar * altnums);
84 
85 gunichar keyb_unichar_toupper (gunichar uchar);
86 
87 void keyb_save_new_layout (void);
88 
89 void keyb_remove_user_layout (void);
90 
91 void keyb_update_virtual_layout (void);
92 
93 gchar * keyb_get_country_code (const gchar *kbd);
94 
95 gchar * keyb_get_country (const gchar *kbd);
96 
97 gchar * keyb_get_variant (const gchar *kbd);
98 
99 void keyb_set_keyboard_layouts (void);
100 
101 void keyb_update_from_variant (gchar *cmb_country, gchar *cmb_variant);
102 
103 void keyb_set_combo_kbd_variant (gchar *cmb_country, gchar *cmb_variant);
104 
105 void keyb_set_combo_kbd (gchar *cmb_country, gchar *cmb_variant);
106 
107 void keyb_update_combos (gchar *cmb_country, gchar *cmb_variant);
108 
109 void keyb_intro_step_next (void);
110 
111 void keyb_intro_step_previous (void);
112 
113 void keyb_intro_step (gint step);
114 
115 gchar * keyb_mode_get_name (void);
116 
117 void keyb_mode_intro (void);
118 
119 void keyb_mode_hint (void);
120 
121 void keyb_mode_edit (void);
122 
123 void keyb_set_sensitive (gboolean state);
124 
125 gboolean keyb_button_match (GtkButton * button);
126 
127 void keyb_edit_button (GtkButton * button);
128 
129 void keyb_edit_none (void);
130 
131 gboolean keyb_edit_next (void);
132 
133 void keyb_change_key (gunichar real_key);
134 
135 gchar *keyb_get_utf8_paragraph_symbol (void);
136 
137 gboolean keyb_force_edit_tab (gpointer data);
138 
139 /*
140  * Hints
141  */
142 void hints_init (void);
143 
144 gchar * hints_color_from_charcode (gchar charcode);
145 
146 gchar * hints_string_from_charcode (gchar charcode);
147 
148 void hints_set_tips (void);
149 
150 void hints_set_colors (void);
151 
152 void hints_get_from_char (gchar *file_name, gunichar character);
153 
154 void hints_update_from_char (gunichar character);
155 
156 void hints_update_from_button (GtkButton * button);
157 
158 gboolean hints_demo_fingers_move (gpointer data);
159 
160 void hints_demo_fingers (guint msec);
161 
162 gchar * hints_finger_name_from_char (gunichar uch);
163