home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / nut-os2.zip / src / menu.c < prev    next >
Text File  |  1998-09-11  |  3KB  |  106 lines

  1. /* menu.c */
  2.  
  3. /*
  4.     Nut nutrition software 
  5.     Copyright (C) 1998 Jim Jozwiak.
  6.  
  7.     This program is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation; either version 2 of the License, or
  10.     (at your option) any later version.
  11.  
  12.     This program is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU General Public License
  18.     along with this program; if not, write to the Free Software
  19.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. #include "menu.h"
  23. #include "util.h"
  24. #include "recmeal.h"
  25. #include "anameal.h"
  26. #include "remmeal.h"
  27. #include "viewfood.h"
  28. #include "addreci.h"
  29. #include "viewrdi.h"
  30. #include "options.h"
  31. #include "prtmenu.h"
  32. #include <stdio.h>
  33.  
  34. void menu()
  35. {
  36. int menu_choice;
  37. for ( ; ; )
  38.  {
  39.  header("NUT :  Main Menu");
  40.  printf("                       1  --  Record Meals\n\n");
  41.  printf("                       2  --  Analyze Meals and Food Suggestions\n\n");
  42.  printf("                       3  --  Remove Meals\n\n");
  43.  printf("                       4  --  View Foods\n\n");
  44.  printf("                       5  --  Add Recipes\n\n");
  45.  printf("                       6  --  View RDI and Rank Foods\n\n");
  46.  printf("                       7  --  Set Personal Calorie Level\n\n");
  47.  printf("                       8  --  Automatic Deletion of Meals\n\n");
  48.  printf("                       9  --  Print Menus from Meal Database\n\n");
  49.  printf("                       Q  --  Quit NUT\n\n");
  50.  spacer(19);
  51.  printf("Enter your choice:  ");
  52.  menu_choice = get_char();
  53.  switch (menu_choice)
  54.   {
  55.   case 'Q' :
  56.   case 'q' : printf("\033[2JNUT has ended.\n\n");
  57.              exit(0);
  58.              break;
  59.   case '1' : record_meals();
  60.              break; 
  61.   case '2' : analyze_meals();
  62.              break; 
  63.   case '3' : remove_meals();
  64.              break; 
  65.   case '4' : view_foods();
  66.              break; 
  67.   case '5' : add_recipes();
  68.              break; 
  69.   case '6' : view_rdis_menu();
  70.              break; 
  71.   case '7' : personal_cal();
  72.              break; 
  73.   case '8' : auto_del();
  74.              break; 
  75.   case '9' : print_menus();
  76.              break; 
  77.   default  : break;
  78.   }
  79.  }
  80. }
  81.  
  82. void view_rdis_menu()
  83. {
  84. int menu_choice;
  85. for ( ; ; )
  86.  {
  87.  header("NUT:  View RDIs and Rank Foods");
  88.  printf("\n\n                              1  --  Per 100 Grams\n\n");
  89.  printf("                              2  --  Per 100 Calories\n\n");
  90.  printf("                              3  --  Per Serving\n\n");
  91.  spacer(8);
  92.  printf("\nEnter your choice (just <enter> to quit):  ");
  93.  menu_choice = get_char();
  94.  switch (menu_choice)
  95.   {
  96.   case '1' : view_rdis(1);
  97.              break; 
  98.   case '2' : view_rdis(0);
  99.              break; 
  100.   case '3' : view_rdis(2);
  101.              break; 
  102.   default  : return;
  103.   }
  104.  }
  105. }
  106.