Statistics
| Branch: | Revision:

root / hope.h @ 0:3c15de202295

History | View | Annotate | Download (4.29 KB)

1

    
2
#include "common.h"
3
#include <unistd.h>
4
#include <glib.h>
5
#include <gdk/gdk.h>
6
#include <pthread.h>
7
#include <time.h>
8
#include <ctype.h>
9

    
10
#define MAX_STR_LEN 155
11
#define MAX_LEN 30
12
#define SLEN 30
13
#define CONFIG_FILE "aac.conf"
14
#define LOG_FILE_PREFIX "/logs/"
15
#define YES_IT_IS (1)
16
#define NO_IT_IS_NOT (0)
17

    
18
typedef struct
19
{
20
  GtkWidget *label;
21
  int what;
22
  int index;        
23
} yes_or_no_args;
24

    
25
static volatile int yes_or_no = YES_IT_IS;
26

    
27
extern int spell_mode;
28

    
29
extern int wait_time;
30

    
31
extern char label[9][6];
32

    
33

    
34
char icon[][30] = { "icons/strawberry.png", "icons/book.png", "icons/home1.png",
35
                  "icons/car.png", "icons/flower.png", "icons/banana.png",
36
                  "icons/pencil.png", "icons/smile_1.png", "icons/ice_cream.png","icons/sun.png"
37
                };
38
// for pridiction 17 apr 
39
char strpridict[50]="";
40
int flagpridict=0;
41

    
42

    
43
//Array containing the selected words
44
char text_array[MAX_LEN][MAX_STR_LEN];
45

    
46
//Index of the above array to know the last word and also to know where to append
47
int current_index = 0;
48
int spell_index = 0;
49

    
50
//The word to be concatenated to the selected list of words
51
char text_to_add [MAX_STR_LEN];
52

    
53
//The character/string for which the dictionary has to be searched
54
char query_string[MAX_LEN];
55

    
56
//Number of results after the grep operation
57
int no_of_results = 0;
58

    
59
//Config file pointer
60
FILE *fp;
61
   
62
//Window that contains the whole GUI
63
GtkWidget *window;
64

    
65
//Divided into table for even ordering of UI components
66
GtkWidget *table;
67

    
68
//Buttons for the first level with labels ABC, DEF etc
69
//button[0]  first button (default ABC) and so on...
70
GtkWidget *button[10];
71

    
72
//buttons for the 3 alphabets (single_button[0-2]
73
//BACK single_button[3]
74
//DONE single_button[4]
75
//ERASE single_button[5]
76
//single_button_label are the respective labels
77

    
78
GtkWidget *single_button[6];
79
GtkWidget *single_button_label[6];
80

    
81
//entry_label gives the components in the third level of scan
82
//MORE entry_label[5]
83
//BACK entry_label[6]
84
//predicted text contains the list of selected words
85
GtkWidget *entry_label[7], *sentence_box;
86
GtkWidget *morebutton, *backbutton;
87

    
88
//Colours being used for highlighting the buttons and labels
89
GdkColor colorRed;
90
GdkColor colorBlack = {1, 0x0000, 0x0000, 0x0000};
91
GdkColor colorGray = {1, 0xE600, 0xE600, 0xE600};
92
GdkColor blue =   { 0, 0,      0,      0xffff };
93
GdkColor green =   { 0, 0,      0xffff ,      0xffff };
94
GdkColor yellow =   { 0, 0xffff,      0xffff , 0};
95

    
96

    
97
//scan mode 1 scannning set of alphabets
98
//scan mode 2 scanning each alphabet with BACK facility 
99
//scan mode 3 scanning the words with BACK and MORE facilities
100
//scan mode 4 ERASE and DONE 
101
static guint scan_mode = 1;
102
static guint prev_scan_mode = 1;
103

    
104
//For concatenation of wav files and spell it out
105
static gchar selected_char[37];
106

    
107
//iterators for the first three scan modes
108
static guint iter1 = 1, iter2 = 0, iter3 = 1;
109

    
110
//flags set for many purposes
111
static guint is_selected = 0,  is_erase_selected = 0, stg3_back_selected = 0, is_back_selected = 0,  is_more_selected = 0,  is_word_selected = 0, is_done_selected = 0, change_mode = 0;
112

    
113
//to make sure that if there are not enough words, it will not scan the empty labels
114
static int mod_value = 7;
115

    
116
//Creating the topmost buttons
117
static void create_buttons ();
118
static GtkWidget *xpm_label_box(gchar *label_text,  gchar *xpm_filename);
119

    
120
//Creating the single buttons
121
static void create_single_button();
122

    
123
//Creating the labels for words
124
void create_labels(void);
125

    
126
//This method is invoked in a separate thread and runs on till the application is closed.
127
void *button_selection(void * args);
128

    
129
//The interpretation of each switch stroke
130
static void callback();
131

    
132
//Managing the selected word list addition/deletion
133
void enter_into_sentence_box(void);
134

    
135
//read out the string
136
void read_out(char *);
137

    
138
//spell out the string
139
void spell_out(char *);
140

    
141
//read out a sentence. in turn splits the sentence and then calls read_out
142
void read_sentence(char *);
143

    
144
//initialise the string to be searched for in the dictionary
145
int init_query(char *);
146

    
147
//clean up the datastructures that have previous query results
148
void clean_query(void);
149

    
150
//run the  query to get the results
151
void run_query(char *, int);
152
 
153
//external function call for checking the user input
154
extern int check_for_user_input();
155
extern int check();
156

    
157
//static int flagserial;
158
//external function call for reading the conf file
159
extern int read_conf_file (char *);
160

    
Redmine Appliance - Powered by TurnKey Linux