home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / aix-rs6000 / elm2.3.11.AIX3.1.5.Z / elm2.3.11.AIX3.1.5 / src / softkeys.c < prev    next >
C/C++ Source or Header  |  1990-04-28  |  3KB  |  138 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: softkeys.c,v 4.1 90/04/28 22:44:11 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 4.1 $   $State: Exp $
  6.  *
  7.  *             Copyright (c) 1986, 1987 Dave Taylor
  8.  *             Copyright (c) 1988, 1989, 1990 USENET Community Trust
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log:    softkeys.c,v $
  17.  * Revision 4.1  90/04/28  22:44:11  syd
  18.  * checkin of Elm 2.3 as of Release PL0
  19.  * 
  20.  *
  21.  *******************************************************************************
  22.  */
  23.  
  24. #include "headers.h"
  25.  
  26. define_softkeys(level)
  27. int level;
  28. {
  29.     if (! hp_softkeys) return;
  30.  
  31.     if (level == MAIN) {
  32.  
  33.       define_key(f1, " Display   Msg",   "\r");
  34.       define_key(f2, "  Mail     Msg",   "m");
  35.       define_key(f3, "  Reply  to Msg",  "r");
  36.  
  37.       if (user_level == 0) {
  38.         define_key(f4, "  Save     Msg",   "s");
  39.         define_key(f5, " Delete    Msg",   "d");
  40.         define_key(f6, "Undelete   Msg",   "u");
  41.          }
  42.       else {
  43.         define_key(f4, " Change  Folder", "c");
  44.         define_key(f5, "  Save     Msg",   "s");
  45.         define_key(f6, " Delete/Undelete", "^");
  46.       }
  47.  
  48.       define_key(f7, " Print     Msg",   "p");
  49.       define_key(f8, "  Quit     ELM",   "q");
  50.     }
  51.     else if (level == ALIAS) {
  52.       define_key(f1, " Alias  Current",  "a");
  53.       define_key(f2, " Check  Person",   "p");
  54.       define_key(f3, " Check  System",   "s");
  55.       define_key(f4, " Make    Alias",   "m");
  56.       clear_key(f5);
  57.       clear_key(f6);
  58.       clear_key(f7);
  59.       define_key(f8, " Return  to ELM",  "r");
  60.     }
  61.     else if (level == YESNO) {
  62.       define_key(f1, "  Yes",  "y");
  63.       clear_key(f2);
  64.       clear_key(f3);
  65.       clear_key(f4);
  66.       clear_key(f5);
  67.       clear_key(f6);
  68.       clear_key(f7);
  69.       define_key(f8, "   No",  "n");
  70.     }
  71.     else if (level == READ) {
  72.       define_key(f1, "  Next    Page  ", " ");
  73.       clear_key(f2);
  74.       define_key(f3, "  Next    Msg   ", "j");
  75.       define_key(f4, "  Prev    Msg   ", "k");
  76.       define_key(f5, "  Reply  to Msg ", "r");
  77.       define_key(f6, " Delete   Msg   ", "d");
  78.       define_key(f7, "  Send    Msg   ", "m");
  79.       define_key(f8, " Return  to ELM ", "q");
  80.     }
  81.     else if (level == CHANGE) {
  82.       define_key(f1, "  Mail  Directry", "=/");
  83.       define_key(f2, "  Home  Directry", "~/");
  84.       clear_key(f3);
  85.       define_key(f4, "Incoming Mailbox", "!\n");
  86.       define_key(f5, "\"Received\" Folder", ">\n");
  87.       define_key(f6, "\"Sent\"   Folder ", "<\n");
  88.       clear_key(f7);
  89.       define_key(f8, " Cancel", "\n");
  90.     }
  91.  
  92.     softkeys_on();
  93. }
  94.  
  95. define_key(key, display, send)
  96. int key;
  97. char *display, *send;
  98. {
  99.  
  100.     char buffer[30];
  101.  
  102.     sprintf(buffer,"%s%s", display, send);
  103.  
  104.     fprintf(stderr, "%c&f%dk%dd%dL%s", ESCAPE, key,
  105.         strlen(display), strlen(send), buffer);
  106.     fflush(stdout);
  107. }
  108.  
  109. softkeys_on()    
  110.     /* enable (esc&s1A) turn on softkeys (esc&jB) and turn on MENU 
  111.        and USER/SYSTEM options. */
  112.  
  113.     if (hp_softkeys) {
  114.       fprintf(stderr, "%c&s1A%c&jB%c&jR", ESCAPE, ESCAPE, ESCAPE); 
  115.       fflush(stdout);
  116.     }
  117.     
  118. }
  119.  
  120. softkeys_off()    
  121.     /* turn off softkeys (esc&j@) */
  122.  
  123.     if (hp_softkeys) {
  124.       fprintf(stderr, "%c&s0A%c&j@", ESCAPE, ESCAPE); 
  125.       fflush(stdout);
  126.     }
  127. }
  128.  
  129. clear_key(key)  
  130. {     
  131.     /** set a key to nothing... **/
  132.  
  133.     if (hp_softkeys) 
  134.        define_key(key, "                ", ""); 
  135. }
  136.