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 #ifndef TUTOR_H 15 # define TUTOR_H 16 17 /* 18 * Special colors 19 */ 20 # define TUTOR_RED "#ff0044" 21 # define TUTOR_RED_LITE "#eeddbb" 22 # define TUTOR_GREEN "#228822" 23 # define TUTOR_BLUE "#0000cc" 24 # define TUTOR_BLUE_LITE "#3377dd" 25 # define TUTOR_YELLOW "#ffff00" 26 # define TUTOR_BROWN "#886600" 27 # define TUTOR_BLACK "#000000" 28 # define TUTOR_GRAY "#dddddd" 29 # define TUTOR_GRAY_LITE "#eeece8" 30 # define TUTOR_CREAM "#f8f4f2" /* "#f0f2ca" <== "#faf8f8" before */ 31 # define TUTOR_WHITE "#fffefe" 32 33 typedef enum 34 { 35 TT_BASIC, 36 TT_ADAPT, 37 TT_VELO, 38 TT_FLUID 39 } TutorType; 40 41 typedef enum 42 { 43 QUERY_INTRO, 44 QUERY_START, 45 QUERY_PROCESS_TOUCHS, 46 QUERY_END 47 } TutorQuery; 48 49 #define MAX_ALPHABET_LEN 50 50 typedef struct CHAR_DISTRIBUTION 51 { 52 struct CHARS 53 { 54 gunichar letter; 55 guint count; 56 gfloat freq; 57 } ch[MAX_ALPHABET_LEN]; 58 guint size; 59 guint total; 60 } Char_Distribution; 61 62 /* 63 * Interface functions 64 */ 65 TutorType tutor_get_type (void); 66 67 gchar *tutor_get_type_name (void); 68 69 gboolean tutor_is_tibetan (void); 70 71 TutorQuery tutor_get_query (void); 72 73 void tutor_set_query (TutorQuery); 74 75 gint tutor_get_correcting (void); 76 77 void tutor_init_timers (void); 78 79 void tutor_init_goals (void); 80 81 gdouble tutor_goal_accuracy (void); 82 83 gdouble tutor_goal_speed (void); 84 85 gdouble tutor_goal_fluidity (void); 86 87 gdouble tutor_goal_level (guint n); 88 89 /* 90 * Auxiliar functions 91 */ 92 void tutor_init (TutorType tutor_type); 93 94 void tutor_update (void); 95 96 void tutor_update_intro (void); 97 98 void tutor_update_start (void); 99 100 void tutor_process_touch (gunichar user_chr); 101 102 gboolean tutor_eval_forward (gunichar chr); 103 104 gboolean tutor_eval_forward_backward (gunichar chr); 105 106 void tutor_calc_stats (void); 107 108 gboolean tutor_char_distribution_approved (void); 109 110 void tutor_char_distribution_count (gchar * text, Char_Distribution * dist); 111 112 void tutor_draw_paragraph (gchar * text); 113 114 void tutor_load_list_other (gchar * file_name_end, GtkListStore * list); 115 116 void tutor_other_rename (const gchar *new_tx, const gchar *old_tx); 117 118 void tutor_message (gchar * mesg); 119 120 void tutor_beep (void); 121 122 gboolean tutor_delayed_finger_tip (gpointer unich); 123 124 void tutor_speak_string (gchar *string, gboolean wait); 125 126 void tutor_speak_char (); 127 128 void tutor_speak_word (); 129 130 #endif 131