static void menu_key (KeySym i, int state)
{
    int cmd, ch;
    if (edit_translate_key (0, i, state, &cmd, &ch)) {
	if (cmd > 0)
	    menu_cmd (cmd);
    }
}
void menu_date_cmd (void)		{ menu_cmd (CK_Date); }
void menu_end_record_cmd (void)		{ menu_cmd (CK_End_Record_Macro); }
void menu_replace_cmd (void)		{ menu_cmd (CK_Replace); }
void menu_search_cmd (void)		{ menu_cmd (CK_Find); }
void menu_delete_cmd (void)		{ menu_cmd (CK_Remove); }
void menu_copy_cmd (void)		{ menu_cmd (CK_Copy); }
void menu_markcol_cmd (void)		{ menu_cmd (CK_Column_Mark); }
void CEditMenuCommand (int i)
{
    menu_cmd ((unsigned long) i);
}
void menu_format_paragraph (void)	{ menu_cmd (CK_Paragraph_Format); }
void menu_goto_line (void)		{ menu_cmd (CK_Goto); }
void menu_refresh_cmd (void)		{ menu_cmd (CK_Refresh); }
void menu_end_cmd (void)		{ menu_cmd (CK_End_Of_Text); }
void menu_beginning_cmd (void)		{ menu_cmd (CK_Beginning_Of_Text); }
void menu_undo_cmd (void)		{ menu_cmd (CK_Undo); }
void menu_quit_cmd (void)		{ menu_cmd (CK_Exit); }
void menu_mark_cmd (void)		{ menu_cmd (CK_Mark); }
void menu_mail_cmd (void)		{ menu_cmd (CK_Mail); }
void menu_ins_cmd (void)		{ menu_cmd (CK_Toggle_Insert); }
void menu_load_cmd (void)		{ menu_cmd (CK_Load); }
void menu_move_cmd (void)		{ menu_cmd (CK_Move); }
void menu_new_cmd (void)		{ menu_cmd (CK_New); }
void menu_cut_cmd (void)		{ menu_cmd (CK_Save_Block); }
void menu_save_cmd (void)		{ menu_cmd (CK_Save); }
void menu_search_again_cmd (void)	{ menu_cmd (CK_Find_Again); }
void menu_save_as_cmd (void)		{ menu_cmd (CK_Save_As); }
void menu_begin_record_cmd (void)	{ menu_cmd (CK_Begin_Record_Macro); }
void menu_insert_file_cmd (void)	{ menu_cmd (CK_Insert_File); }
示例#29
0
//
//
// System setup menu
//
//
void misc_setup(u08 force_menu)
{
#ifdef MENU_CODE
u08 bl;
u08 sound;
u08 invert;
u08 clock;

   // load backlight value in EEPROM
   bl = eeprom_read_byte((uint8_t *) EE_BACKLIGHT);

   // validate the sound value in EEPROM
   sound = eeprom_read_byte((uint8_t *) EE_SOUND);
   if(sound == 'N') sound = 1;
   else if(sound == 'F') sound = 0;
   else {
      force_menu = 1;
      sound = 1;
   }

   // validate the time value in EEPROM
   clock = eeprom_read_byte((uint8_t *) EE_SET_TIME);
   if(clock == 'N') clock = 1;
   else if(clock == 'F') clock = 0;
   else {
      force_menu = 1;
      clock = 0;
   }

   // validate the button color value in EEPROM
   invert = eeprom_read_byte((uint8_t *) EE_INVERT_BUT);
   if((invert != 0x00) && (invert != 0xFF)) {
      force_menu = 1;
      invert = 0xFF;
   }


   time_not_set = 1;
   if(force_menu == 0) goto use_params;

   MENU_INIT

   do {
      MENU_CONTROLS


      if((COLS < 160) || (ROWS < 80)) {
         menu_label    (0,0,   PS("Misc Setup")); 
         menu_checkbox (1*CHAR_WIDTH-4,  (CHAR_HEIGHT+CHAR_HEIGHT/2)*1, PS("Backlight"),  bl, 1);
         menu_checkbox (1*CHAR_WIDTH-4,  (CHAR_HEIGHT+CHAR_HEIGHT/2)*2, PS("Beeper"),  sound, 2);
         menu_checkbox (1*CHAR_WIDTH-4,  (CHAR_HEIGHT+CHAR_HEIGHT/2)*3, PS("Invert buttons"), invert, 3);
         #ifdef TIME_CLOCK
            menu_checkbox (1*CHAR_WIDTH-4,  (CHAR_HEIGHT+CHAR_HEIGHT/2)*4, PS("Set clock"), clock, 4);
         #endif
         menu_exitbutton();
      }
      else {
         menu_label    (0,0,   PS("Misc Setup Menu")); 
         menu_checkbox (4*CHAR_WIDTH,  CHAR_HEIGHT*2, PS("Backlight"),  bl, 1);
         menu_checkbox (4*CHAR_WIDTH,  CHAR_HEIGHT*4, PS("Beeper"),  sound, 2);
         menu_checkbox (4*CHAR_WIDTH,  CHAR_HEIGHT*6, PS("Invert buttons"), invert, 3);
         #ifdef TIME_CLOCK
            menu_checkbox (4*CHAR_WIDTH,  CHAR_HEIGHT*8, PS("Set clock"), clock, 4);
         #endif
         menu_exitbutton();
      }

      MENU_COMMANDS

      // menu button/control responses

      switch(menu_cmd()) {
         case 1: 
            break;

         case 2: 
            break;

         case 3: 
            break;

         case 4: 
            #ifdef TIME_CLOCK
               if(clock) {
                  menu_call(set_time);
                  time_not_set = 0;
               }
            #endif
            break;
      }
   } while(menu_cmd() != MENU_EXITCODE) ;  // repeat until exit command

   wait_while_touched();

   if(bl) bl = 0xFF;  //!!!  
   eeprom_write_byte((uint8_t *) EE_BACKLIGHT,  bl);

   if(sound)  eeprom_write_byte((uint8_t *) EE_SOUND,  (uint8_t) 'N');
   else       eeprom_write_byte((uint8_t *) EE_SOUND,  (uint8_t) 'F');

   if(invert)  eeprom_write_byte((uint8_t *) EE_INVERT_BUT,  (uint8_t) 0xFF);
   else        eeprom_write_byte((uint8_t *) EE_INVERT_BUT,  (uint8_t) 0x00);

   if(clock)   eeprom_write_byte((uint8_t *) EE_SET_TIME,  (uint8_t) 'N');
   else        eeprom_write_byte((uint8_t *) EE_SET_TIME,  (uint8_t) 'F');

   

   use_params:
   lcd_backlight(bl);

   #ifdef TIME_CLOCK
      if(eeprom_read_byte((uint8_t *) EE_SET_TIME) == 'N') {
         if(time_not_set) set_time();
      }
   #endif

   if(sound) beep_disabled = 0;
   else      beep_disabled = 1;

   if(invert) invert_buttons = WHITE;
   else       invert_buttons = 0x00;
#endif
}
void menu_sort_cmd (void)		{ menu_cmd (CK_Sort); }