PageRenderTime 24ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/zmail/config/menudefs.awk

https://gitlab.com/BGCX261/zmail-2009-svn-to-git
AWK | 70 lines | 69 code | 1 blank | 0 comment | 0 complexity | 48d61c0c9df634743363583d3e5d977e MD5 | raw file
Possible License(s): LGPL-2.0
  1. BEGIN {
  2. menucontext = "main";
  3. buttoncontext = "main";
  4. specialSyms["Home"] = "osfBeginLine";
  5. specialSyms["End"] = "osfEndLine";
  6. specialSyms["Up"] = "osfUp";
  7. specialSyms["Down"] = "osfDown";
  8. specialSyms["Slash"] = "slash";
  9. }
  10. /^menu -W/ { menucontext = $3; window = $3 "_window*menu_bar*"; next; }
  11. /^button -W/ { buttoncontext = $3; next; }
  12. /^menu -B/ {
  13. menucontext = $3;
  14. if ($3 ~ /^Main*/) window = "main_window*menu_bar*";
  15. else if ($3 ~ /^Message*/) window = "message_window*menu_bar*";
  16. else if ($3 ~ /^Compose*/) window = "compose_window*menu_bar*";
  17. else window = "";
  18. next;
  19. }
  20. /^menu.*popup.*main-summaries/ {
  21. window = "message_summaries*popup_menu*";
  22. next;
  23. }
  24. /^menu.*popup.*output-statictext/ {
  25. window = "main_output_text*popup_menu*";
  26. next;
  27. }
  28. /^menu.*popup.*read-message-body/ {
  29. window = "message_text*popup_menu*";
  30. next;
  31. }
  32. /^menu.*popup.*commandline-af/ {
  33. window = "command_area*popup_menu*";
  34. next;
  35. }
  36. /^menu.*popup.*compose-body/ {
  37. window = "compose_window.body*popup_menu*";
  38. next;
  39. }
  40. /^menu.*-name/ {
  41. match($0, /-name [^ ][^ ]*/);
  42. name = "*" window substr($0, RSTART+6, RLENGTH-6);
  43. if (match($0, /-label '[^']*'/) || match($0, /-label "[^"]*"/))
  44. printf "%s.labelString: %s\n", name, substr($0, RSTART+8, RLENGTH-9);
  45. else if (match($0, /-label [^ ]*/))
  46. printf "%s.labelString: %s\n", name, substr($0, RSTART+7, RLENGTH-7);
  47. if (match($0, /-mnemonic ./))
  48. printf "%s.mnemonic: %s\n", name, substr($0, RSTART+RLENGTH-1, 1);
  49. if (match($0, /-M ./))
  50. printf "%s.mnemonic: %s\n", name, substr($0, RSTART+RLENGTH-1, 1);
  51. if (match($0, /-accelerator '[^']*'/) || match($0, /-accelerator "[^"]*"/)) {
  52. printf "%s.acceleratorText: %s\n", name,
  53. acc = substr($0, RSTART+14, RLENGTH-15);
  54. gsub(/\+/, " ", acc);
  55. m = match(acc, / [^ ]*$/);
  56. keymod = substr(acc, 1, m-1);
  57. keysym = substr(acc, m+1);
  58. if (keysym in specialSyms) keysym = specialSyms[keysym];
  59. printf "%s.accelerator: %s<Key>%s\n", name, keymod, keysym;
  60. } else if (match($0, /-accelerator/))
  61. print "ERROR:no quotes around -accelerator:" NR;
  62. next;
  63. }
  64. /^menu.*separator/ { next; }
  65. /^menu/ { print "ERROR:no -name:" NR; }
  66. END {
  67. if (menucontext !~ "main") print "ERROR:menucontext != main:" NR;
  68. if (buttoncontext !~ "main") print "ERROR:buttoncontext != main:" NR;
  69. }