|
From: Dhananjay J. <ds...@us...> - 2003-06-09 19:26:53
|
Update of /cvsroot/indlinux/dvtyping-0.9/src
In directory sc8-pr-cvs1:/tmp/cvs-serv10090/src
Modified Files:
callbacks.c callbacks.h dvtyping_ds.c dvtyping_ds.h
Log Message:
The ui keyboard buttons will show the local alphabet after loading a lesson; this is a commit message.
Index: callbacks.c
===================================================================
RCS file: /cvsroot/indlinux/dvtyping-0.9/src/callbacks.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** callbacks.c 6 Jun 2003 17:10:40 -0000 1.1.1.1
--- callbacks.c 9 Jun 2003 19:26:47 -0000 1.2
***************
*** 13,16 ****
--- 13,17 ----
#define PAGES 16
#define MAX_NUMBER_OF_EXCEPTION_ELEMENTS 10
+ #define NUMBER_OF_BUTTONS 128
#define DVTYPING_NEWLINE_WORKAROUND
***************
*** 62,65 ****
--- 63,69 ----
guint32 IDENTIFIER;
+ /*whether keyboard buttons show local alphabet*/
+ gboolean whether_local_alphabet_set = FALSE;
+
***************
*** 100,104 ****
/* allocate memory for lookup_table*/
/* number of keys on a keyboard is 128 at the max*/
! my_lookup_table = g_malloc(128*sizeof(LOOKUP_TABLE));
add_to_lookup_table(my_lookup_table, 10, (gpointer) lookup_widget(widget,"btn1"));
--- 104,108 ----
/* allocate memory for lookup_table*/
/* number of keys on a keyboard is 128 at the max*/
! my_lookup_table = g_malloc(NUMBER_OF_BUTTONS*sizeof(LOOKUP_TABLE));
add_to_lookup_table(my_lookup_table, 10, (gpointer) lookup_widget(widget,"btn1"));
***************
*** 189,192 ****
--- 193,198 ----
+
+
/*temp*/
guint32 temp_exceptions[3] = {0x0919,0x91e,0x0923};
***************
*** 238,242 ****
}
!
/*buffer to store file contents*/
--- 244,248 ----
}
!
/*buffer to store file contents*/
***************
*** 316,324 ****
{
g_free(keys);
/*intimate user that the no valid keymap was found and he has to load a keymap
(inscript or custom) before he/she can proceed*/
return NO_VALID_XMODMAP;
}
!
g_free(keys);
--- 322,338 ----
{
g_free(keys);
+ whether_local_alphabet_set = FALSE;
+
/*intimate user that the no valid keymap was found and he has to load a keymap
(inscript or custom) before he/she can proceed*/
return NO_VALID_XMODMAP;
}
!
! if(!whether_local_alphabet_set)
! {
! set_local_alphabet();
! whether_local_alphabet_set = TRUE;
! }
!
g_free(keys);
***************
*** 705,709 ****
{
GtkWidget *about = create_about_dialog();
! gtk_widget_modify_font(lookup_widget(about,"about_dialog_text"),pango_font_description_from_string("Raghindi 15"));
gtk_widget_show(about);
}
--- 719,723 ----
{
GtkWidget *about = create_about_dialog();
! gtk_widget_modify_font(lookup_widget(about,"about_dialog_text"),pango_font_description_from_string("15"));
gtk_widget_show(about);
}
***************
*** 966,968 ****
--- 980,1037 ----
}
+ /***********************************************************************************************************************/
+ /*set the local alphabet to the keyboard widgets****************/
+ /********************************************************************************************************************/
+ void
+ set_local_alphabet()
+ {
+ int counter;
+
+ GtkWidget *tempWidget;
+ GdkKeymapKey *keys = g_malloc(4*sizeof(GdkKeymapKey));;
+ guint *keyvals = g_malloc(4*sizeof(guint));
+ gint n_entries;
+ GString *tempString;
+
+ for(counter = 0; counter < NUMBER_OF_BUTTONS; counter++)
+ {
+ tempWidget = lookup_button(my_lookup_table,counter);
+ if(tempWidget)
+ {
+ gdk_keymap_get_entries_for_keycode(myKeymap,counter,&keys,&keyvals,&n_entries);
+ /*in inscript keyboard layouts the first group is always for normal ascii keys
+ so we get the keyvals for the next group only or n_entries ==2 and n_entries==3*/
+
+ if(n_entries > 2)
+ {
+ /*get the characters corresponding to the keyvals and concatenate them to render on the button*/
+ //g_print("%x\t%x\n",*(keyvals+2),*(keyvals+3));
+
+
+ tempString = g_string_new(NULL);
+
+
+ if(*(keyvals+3) > 255)
+ tempString = g_string_append_unichar(tempString,(*(keyvals+3)-0x1000000));
+
+ tempString = g_string_append_c(tempString,(gchar) 0xa);
+
+ if(*(keyvals+2) > 255) /* not standard ascii*/
+ tempString = g_string_append_unichar(tempString,(*(keyvals+2)-0x1000000));
+
+
+ //now set the string to the button*/
+ gtk_button_set_label(GTK_BUTTON(tempWidget),tempString->str);
+
+ }
+ //only get keyvals for group 1
+ }
+ }
+
+ g_free(keys);
+ g_free(keyvals);
+
+
+
+ }
Index: callbacks.h
===================================================================
RCS file: /cvsroot/indlinux/dvtyping-0.9/src/callbacks.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** callbacks.h 6 Jun 2003 17:10:40 -0000 1.1.1.1
--- callbacks.h 9 Jun 2003 19:26:48 -0000 1.2
***************
*** 60,64 ****
void
! process_newline ();
void
--- 60,64 ----
void
! process_newline (void);
void
***************
*** 77,78 ****
--- 77,81 ----
gboolean
load_language_data (char* filename);
+
+ void
+ set_local_alphabet (void);
Index: dvtyping_ds.c
===================================================================
RCS file: /cvsroot/indlinux/dvtyping-0.9/src/dvtyping_ds.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** dvtyping_ds.c 6 Jun 2003 17:10:40 -0000 1.1.1.1
--- dvtyping_ds.c 9 Jun 2003 19:26:49 -0000 1.2
***************
*** 10,13 ****
--- 10,14 ----
{
(*(lookup_table+keycode)).button = button;
+ (*(lookup_table+keycode)).whether_set = TRUE;
}
***************
*** 17,20 ****
guint keycode)
{
! return (*(lookup_table+keycode)).button ;
}
--- 18,26 ----
guint keycode)
{
!
! if((*(lookup_table+keycode)).whether_set==TRUE)
! {
! return (*(lookup_table+keycode)).button ;
! }
! else return NULL;
}
Index: dvtyping_ds.h
===================================================================
RCS file: /cvsroot/indlinux/dvtyping-0.9/src/dvtyping_ds.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** dvtyping_ds.h 6 Jun 2003 17:10:40 -0000 1.1.1.1
--- dvtyping_ds.h 9 Jun 2003 19:26:49 -0000 1.2
***************
*** 33,36 ****
--- 33,37 ----
guint32 keycode;
gpointer *button;
+ gboolean whether_set;
} LOOKUP_TABLE; /* mapping of hardware keycode - 'character button' on ui*/
|