From: Daniel Caujolle-B. <f1...@us...> - 2002-06-04 22:26:23
|
Update of /cvsroot/xine/xine-ui/src/xitk In directory usw-pr-cvs1:/tmp/cvs-serv20884 Modified Files: kbindings.c Log Message: Add shortcut in action entries list. Index: kbindings.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/kbindings.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- kbindings.c 4 Jun 2002 19:49:02 -0000 1.33 +++ kbindings.c 4 Jun 2002 22:26:18 -0000 1.34 @@ -1185,7 +1185,7 @@ } static void kbedit_create_browser_entries(void) { - int i; + int i, j; if(kbedit->num_entries) { for(i = 0; i < kbedit->num_entries; i++) @@ -1199,11 +1199,43 @@ for(i = 0; i < kbedit->num_entries; i++) { char buf[256]; - memset(&buf, 0, 256); + char shortcut[256]; + + memset(&buf, 0, sizeof(buf)); + memset(&shortcut, 0, sizeof(shortcut)); + if(kbedit->kbt->entry[i]->is_alias) - sprintf(buf, "@{%s}", kbedit->kbt->entry[i]->comment); + sprintf(buf, "@{%s} ", kbedit->kbt->entry[i]->comment); else sprintf(buf, "%s", kbedit->kbt->entry[i]->comment); + + sprintf(shortcut, "%2s", "[ "); + + if(kbedit->kbt->entry[i]->modifier != KEYMOD_NOMOD) { + + if(kbedit->kbt->entry[i]->modifier & KEYMOD_CONTROL) + sprintf(shortcut, "%s%c", shortcut, 'C'); + if(kbedit->kbt->entry[i]->modifier & KEYMOD_META) + sprintf(shortcut, "%s%c", shortcut, 'M'); + if(kbedit->kbt->entry[i]->modifier & KEYMOD_MOD3) + sprintf(shortcut, "%s%2s", shortcut, "M3"); + if(kbedit->kbt->entry[i]->modifier & KEYMOD_MOD4) + sprintf(shortcut, "%s%2s", shortcut, "M4"); + if(kbedit->kbt->entry[i]->modifier & KEYMOD_MOD5) + sprintf(shortcut, "%s%2s", shortcut, "M5"); + + sprintf(shortcut, "%s%c", shortcut, '-'); + } + + sprintf(shortcut, "%s%s ]", shortcut, kbedit->kbt->entry[i]->key); + + /* Right align shotcuts */ + j = 78 - (strlen(buf) + strlen(shortcut)); + while((j--)) + sprintf(buf, "%s%c", buf, ' '); + + sprintf(buf, "%s%s", buf, shortcut); + kbedit->entries[i] = strdup(buf); } kbedit->entries[i] = NULL; @@ -1593,7 +1625,6 @@ kbedit->kbt->num_entries++; kbedit_create_browser_entries(); - xitk_browser_update_list(kbedit->browser, kbedit->entries, kbedit->num_entries, 0); break; @@ -1601,6 +1632,9 @@ kbedit->ksel->key = (char *) realloc(kbedit->ksel->key, sizeof(char *) * (strlen(kbe.key) + 1)); sprintf(kbedit->ksel->key, "%s", kbe.key); kbedit->ksel->modifier = kbe.modifier; + + kbedit_create_browser_entries(); + xitk_browser_update_list(kbedit->browser, kbedit->entries, kbedit->num_entries, 0); break; } |