/[projet1]/public/oric/hardware/cumulus/fw_dbug/UI.c
Defence Force logotype

Diff of /public/oric/hardware/cumulus/fw_dbug/UI.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1083 by dbug, Sun Jan 19 12:41:46 2014 UTC revision 1084 by dbug, Sun Jan 19 15:34:29 2014 UTC
# Line 51  typedef enum Line 51  typedef enum
51    
52  typedef enum  typedef enum
53  {  {
54    ui_main_reset=0,    ui_main_style =0,
55      ui_main_reset ,
56    ui_main_command_log,    ui_main_command_log,
57    ui_main_about,    ui_main_about,
   ui_main_continue,  
58    ui_main_count    ui_main_count
59  } ui_main_item;  } ui_main_item;
60    
# Line 64  typedef enum Line 64  typedef enum
64  far rom char str_cumulus[] = "Cumulus";  far rom char str_cumulus[] = "Cumulus";
65  far rom char str_version[] = SETUP_VERSION_NUMBER;  far rom char str_version[] = SETUP_VERSION_NUMBER;
66  #ifdef SETUP_VERSION_NAME  #ifdef SETUP_VERSION_NAME
67  far rom char str_version_name[] =SETUP_VERSION_NAME;  far rom char str_version_name[] = SETUP_VERSION_NAME;
68  #endif  #endif
69  far rom char str_about_1[] = "Oric Microdisc";  far rom char str_about_1[] = "Oric Microdisc";
70  far rom char str_about_2[] = "compatible";  far rom char str_about_2[] = "compatible";
# Line 73  far rom char str_by_retromaster[] = "by Line 73  far rom char str_by_retromaster[] = "by
73  far rom char str_and_metadata[] = "and metadata";  far rom char str_and_metadata[] = "and metadata";
74  far rom char str_empty[] = "-- Empty --";  far rom char str_empty[] = "-- Empty --";
75  far rom char str_about[] = "About";  far rom char str_about[] = "About";
76    far rom char str_change_style[] = "Change Style";
77  far rom char str_reset_oric[] = "Reset Oric";  far rom char str_reset_oric[] = "Reset Oric";
78  far rom char str_continue[] = "Continue";  far rom char str_continue[] = "Continue";
79  far rom char str_main[] = "Main";  far rom char str_main[] = "Main";
# Line 95  far rom char* str_status[ui_status_count Line 96  far rom char* str_status[ui_status_count
96    (far rom char*) "Disk Write-Protected!",    (far rom char*) "Disk Write-Protected!",
97    (far rom char*) "Drive Not Ready!",    (far rom char*) "Drive Not Ready!",
98  };  };
99  static rom char hex_lookup[16] ={  static rom char hex_lookup[16] = {
100    '0', '1', '2', '3',    '0', '1', '2', '3',
101    '4', '5', '6', '7',    '4', '5', '6', '7',
102    '8', '9', 'A', 'B',    '8', '9', 'A', 'B',
# Line 271  static void enter_emulation(void) Line 272  static void enter_emulation(void)
272  static void draw_main_menu_item(ui_main_item item, uint8_t selected)  static void draw_main_menu_item(ui_main_item item, uint8_t selected)
273  {  {
274    if (selected)    if (selected)
275      n6610_use_color(element_menu_entry_selected); //n6610_set_color(0xF, 0xF, 0xF, 0x8, 0x0, 0x0);      n6610_use_color(element_menu_entry_selected);
276    else    else
277      n6610_use_color(element_menu_entry); //n6610_set_color(0xF, 0xF, 0xF, 0x0, 0x0, 0x8);      n6610_use_color(element_menu_entry);
278    
279    switch (item)    switch (item)
280    {    {
281      case ui_main_style:
282        n6610_fill_area(0, 16, 130, 8);
283        n6610_draw_rom_str(0, 16, str_change_style);
284        break;
285    
286    case ui_main_reset:    case ui_main_reset:
287      n6610_fill_area(0, 24, 130, 8);      n6610_fill_area(0, 24, 130, 8);
288      n6610_draw_rom_str(0, 24, str_reset_oric);      n6610_draw_rom_str(0, 24, str_reset_oric);
# Line 289  static void draw_main_menu_item(ui_main_ Line 295  static void draw_main_menu_item(ui_main_
295      n6610_fill_area(0, 48, 130, 8);      n6610_fill_area(0, 48, 130, 8);
296      n6610_draw_rom_str(0, 48, str_about);      n6610_draw_rom_str(0, 48, str_about);
297      break;      break;
   case ui_main_continue:  
     n6610_fill_area(0, 104, 130, 8);  
     n6610_draw_rom_str(0, 104, str_continue);  
     break;  
298    }    }
299  }  }
300    
# Line 302  static void enter_main_menu(void) Line 304  static void enter_main_menu(void)
304    uint8_t i;    uint8_t i;
305    
306    prep_screen();    prep_screen();
307      
308    draw_main_menu_item(0, 1);    draw_main_menu_item(0, 1);
309    for (i = 1; i < ui_main_count; i++)    for (i = 1; i < ui_main_count; i++)
310      draw_main_menu_item(i, 0);      draw_main_menu_item(i, 0);
311    
312    n6610_use_color(element_header_footer); //n6610_set_color(0x0, 0x0, 0x0, 0xF, 0xF, 0xF);    n6610_use_color(element_header_footer);
313    n6610_draw_rom_str(1, 123, str_main);    n6610_draw_rom_str(1, 123, str_main);
314    
315    selection = 0;    selection = 0;
# Line 317  static void enter_main_menu(void) Line 319  static void enter_main_menu(void)
319  /* Draws yes or no. */  /* Draws yes or no. */
320  static void draw_reset_oric_items(void)  static void draw_reset_oric_items(void)
321  {  {
   /*  
    if (selection == 0)  
            n6610_set_color(0xF, 0xF, 0xF, 0x8, 0x0, 0x0);  
    else  
            n6610_set_color(0xF, 0xF, 0xF, 0x0, 0x0, 0x8);  
    */  
322    if (selection == 0)    if (selection == 0)
323      n6610_use_color(element_menu_entry_selected); //n6610_set_color(0xF, 0xF, 0xF, 0x8, 0x0, 0x0);      n6610_use_color(element_menu_entry_selected);
324    else    else
325      n6610_use_color(element_menu_entry); //n6610_set_color(0xF, 0xF, 0xF, 0x0, 0x0, 0x8);      n6610_use_color(element_menu_entry);
326    
327    n6610_fill_area(0, 16, 130, 8);    n6610_fill_area(0, 16, 130, 8);
328    n6610_draw_rom_str(0, 16, str_yes);    n6610_draw_rom_str(0, 16, str_yes);
329    
   /*  
   if (selection == 1)  
           n6610_set_color(0xF, 0xF, 0xF, 0x8, 0x0, 0x0);  
   else  
           n6610_set_color(0xF, 0xF, 0xF, 0x0, 0x0, 0x8);  
    */  
330    if (selection == 1)    if (selection == 1)
331      n6610_use_color(element_menu_entry_selected); //n6610_set_color(0xF, 0xF, 0xF, 0x8, 0x0, 0x0);      n6610_use_color(element_menu_entry_selected);
332    else    else
333      n6610_use_color(element_menu_entry); //n6610_set_color(0xF, 0xF, 0xF, 0x0, 0x0, 0x8);      n6610_use_color(element_menu_entry);
334    
335    n6610_fill_area(0, 24, 130, 8);    n6610_fill_area(0, 24, 130, 8);
336    n6610_draw_rom_str(0, 24, str_no);    n6610_draw_rom_str(0, 24, str_no);
# Line 432  static void io_error(void) Line 422  static void io_error(void)
422    n6610_use_color(element_text);    n6610_use_color(element_text);
423    n6610_draw_rom_str(8, 16, str_card_io_error);    n6610_draw_rom_str(8, 16, str_card_io_error);
424    
   n6610_use_color(element_text);  
   n6610_fill_area(0, 104, 130, 8);  
   n6610_draw_rom_str(0, 104, str_continue);  
   
425    state = ui_state_io_error;    state = ui_state_io_error;
426  }  }
427    
# Line 451  static void draw_image_select_menu_item( Line 437  static void draw_image_select_menu_item(
437    if (item < file_count)    if (item < file_count)
438    {    {
439      int y = 13 + item * 8;      int y = 13 + item * 8;
440      n6610_fill_area(0,y, 130, 8);      n6610_fill_area(0, y, 130, 8);
441      if (file_list[item].dir)      if (file_list[item].dir)
442      {      {
443        n6610_draw_char(0,y, '/');        n6610_draw_char(0, y, '/');
444        n6610_draw_ram_str(8,y, file_list[item].name);        n6610_draw_ram_str(8, y, file_list[item].name);
445      }      }
446      else      else
447      {      {
448        n6610_draw_ram_str(0,y, file_list[item].name);        n6610_draw_ram_str(0, y, file_list[item].name);
449      }      }
450    }    }
451    else if (item == FILE_LIST_SIZE)    else if (item == FILE_LIST_SIZE)
# Line 710  static void handle_emulation(void) Line 696  static void handle_emulation(void)
696    {    {
697      // This used to be to switch the write protection, but I don't really care.      // This used to be to switch the write protection, but I don't really care.
698      // So the new behavior is going to be 'Reload the currently mounted floppy and reboot the Oric'      // So the new behavior is going to be 'Reload the currently mounted floppy and reboot the Oric'
699      int8_t old_selection=selection;      int8_t old_selection = selection;
700      uint16_t old_dir_page=dir_page;      uint16_t old_dir_page = dir_page;
701      if (!change_card())      if (!change_card())
702      {      {
703        if (!change_card())        if (!change_card())
# Line 719  static void handle_emulation(void) Line 705  static void handle_emulation(void)
705          io_error();          io_error();
706        }        }
707      }      }
708      selection=old_selection;      selection = old_selection;
709      dir_page=old_dir_page;      dir_page = old_dir_page;
710    
711      enter_reset_oric();      enter_reset_oric();
712    }    }
# Line 730  static void handle_emulation(void) Line 716  static void handle_emulation(void)
716    
717  static void handle_main_menu(void)  static void handle_main_menu(void)
718  {  {
719    if (pressed_button == BUTTON_LEFT_TOP)    switch (pressed_button)
720    {    {
721      case BUTTON_LEFT_TOP:
722      draw_main_menu_item(selection, 0);      draw_main_menu_item(selection, 0);
723      selection--;      selection--;
724      if (selection < 0)      if (selection < 0)
725        selection = ui_main_count - 1;        selection = ui_main_count - 1;
726      draw_main_menu_item(selection, 1);      draw_main_menu_item(selection, 1);
727    }      break;
728    if (pressed_button == BUTTON_LEFT_BOTTOM)  
729    {    case BUTTON_LEFT_BOTTOM:
730      draw_main_menu_item(selection, 0);      draw_main_menu_item(selection, 0);
731      selection++;      selection++;
732      if (selection >= ui_main_count)      if (selection >= ui_main_count)
733        selection = 0;        selection = 0;
734      draw_main_menu_item(selection, 1);      draw_main_menu_item(selection, 1);
735    }      break;
736    if (pressed_button == BUTTON_RIGHT_TOP)  
737    {    case BUTTON_RIGHT_TOP:
738      /* Go somewhere else */      /* Go somewhere else */
739      switch (selection)      switch (selection)
740      {      {
741      case ui_main_continue:      case ui_main_style:
742        enter_emulation();        n6610_cycle_style();
743          enter_main_menu();
744        break;        break;
745      case ui_main_command_log:      case ui_main_command_log:
746        enter_command_log();        enter_command_log();
# Line 764  static void handle_main_menu(void) Line 752  static void handle_main_menu(void)
752        enter_about();        enter_about();
753        break;        break;
754      }      }
755        break;
756    
757      case BUTTON_RIGHT_BOTTOM:
758        // Back to the main page
759        enter_emulation();
760        break;
761    }    }
762  }  }
763    
# Line 780  static void handle_image_select(void) Line 774  static void handle_image_select(void)
774        selection = FILE_LIST_SIZE;        selection = FILE_LIST_SIZE;
775      draw_image_select_menu_item(selection, 1);      draw_image_select_menu_item(selection, 1);
776      break;      break;
777      
778    case BUTTON_LEFT_BOTTOM:    case BUTTON_LEFT_BOTTOM:
779      draw_image_select_menu_item(selection, 0);      draw_image_select_menu_item(selection, 0);
780      selection++;      selection++;
# Line 796  static void handle_image_select(void) Line 790  static void handle_image_select(void)
790      enter_emulation();      enter_emulation();
791      break;      break;
792    
793    case  BUTTON_RIGHT_CENTER:    case BUTTON_RIGHT_CENTER:
794      dir_page++;      dir_page++;
795      enter_image_select(); /* This will automatically handle end of directory */      enter_image_select(); /* This will automatically handle end of directory */
796      break;      break;

Legend:
Removed from v.1083  
changed lines
  Added in v.1084

  ViewVC Help
Powered by ViewVC 1.1.26