static bool lcd_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
#ifdef CONFIG_BACKLIGHT
        { ID2P(LANG_BACKLIGHT),       backlight_timer },
#ifdef HAVE_CHARGING
        { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
#endif
        { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
#if CONFIG_BACKLIGHT == BL_IRIVER
        { ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in },
        { ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out },
#endif
#endif /* CONFIG_BACKLIGHT */
        { ID2P(LANG_CONTRAST),        contrast },
#ifdef HAVE_LCD_BITMAP
        { ID2P(LANG_INVERT),          invert },
        { ID2P(LANG_FLIP_DISPLAY),    flip_display },
        { ID2P(LANG_INVERT_CURSOR),   invert_cursor },
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
static bool system_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_BATTERY_MENU),     battery_settings_menu },
#ifndef HAVE_MMC
        { ID2P(LANG_DISK_MENU),        disk_settings_menu     },
#endif
#ifdef HAVE_RTC
        { ID2P(LANG_TIME_MENU),        time_settings_menu     },
#endif
        { ID2P(LANG_POWEROFF_IDLE),    poweroff_idle_timer    },
        { ID2P(LANG_SLEEP_TIMER),      sleeptimer_screen      },
#ifdef HAVE_ALARM_MOD
        { ID2P(LANG_ALARM_MOD_ALARM_MENU), alarm_screen       },
#endif
        { ID2P(LANG_LIMITS_MENU),      limits_settings_menu   },
#if CONFIG_CODEC == MAS3507D
        { ID2P(LANG_LINE_IN),          line_in                },
#endif
#ifdef HAVE_CHARGING
        { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode       },
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
static bool display_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
#ifdef HAVE_LCD_BITMAP
        { ID2P(LANG_CUSTOM_FONT),     font_browse },
#endif
        { ID2P(LANG_WHILE_PLAYING),   custom_wps_browse },
        { ID2P(LANG_LCD_MENU),        lcd_settings_menu },
#ifdef HAVE_REMOTE_LCD
        { ID2P(LANG_LCD_REMOTE_MENU), lcd_remote_settings_menu },
#endif
        { ID2P(LANG_SCROLL_MENU),     scroll_settings_menu },
#ifdef HAVE_LCD_BITMAP
        { ID2P(LANG_BARS_MENU),       bars_settings_menu },
        { ID2P(LANG_PM_MENU),         peak_meter_menu },
        { ID2P(LANG_BIDI_SUPPORT),    bidi_support },
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#4
0
bool sound_menu(void)
{
    int m;
    bool result;
    static const struct menu_item items[] = {
        { ID2P(LANG_VOLUME), volume },
        { ID2P(LANG_BASS), bass },
        { ID2P(LANG_TREBLE), treble },
        { ID2P(LANG_BALANCE), balance },
        { ID2P(LANG_CHANNEL_MENU), chanconf },
        { ID2P(LANG_STEREO_WIDTH), stereo_width },
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
        { ID2P(LANG_LOUDNESS), loudness },
        { ID2P(LANG_AUTOVOL), avc },
        { ID2P(LANG_SUPERBASS), superbass },
        { ID2P(LANG_MDB_ENABLE), mdb_enable },
        { ID2P(LANG_MDB_STRENGTH), mdb_strength },
        { ID2P(LANG_MDB_HARMONICS), mdb_harmonics },
        { ID2P(LANG_MDB_CENTER), mdb_center },
        { ID2P(LANG_MDB_SHAPE), mdb_shape },
#endif
    };
    
    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);

    return result;
}
示例#5
0
// Gekuerzte Main-Funktion
int main(void) {
	while (1) { 	// In Endlosschleife wechseln
		wdt_reset();	// Watchdog zuruecksetzen
		if (get_key_press(1 << KEY1))	// 1 - Zurueck
			menu_exit(&menu_context);
		if( get_key_press(1 << KEY2))	// 2 - Hoch
			menu_prev_entry(&menu_context);
		if (get_key_press(1 << KEY3))	// 3 - Runter
			menu_next_entry(&menu_context);
		if (get_key_press(1 << KEY4))	// 4 - Ok
			menu_select(&menu_context);
	}
}
static bool playback_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_SHUFFLE), shuffle },
        { ID2P(LANG_REPEAT), repeat_mode },
        { ID2P(LANG_PLAY_SELECTED), play_selected },
        { ID2P(LANG_RESUME), resume },
        { ID2P(LANG_WIND_MENU), ff_rewind_settings_menu },
        { ID2P(LANG_MP3BUFFER_MARGIN), buffer_margin },
        { ID2P(LANG_FADE_ON_STOP), set_fade_on_stop },
#if CONFIG_CODEC == SWCODEC
        { ID2P(LANG_CROSSFADE), crossfade },
        { ID2P(LANG_CROSSFADE_DURATION), crossfade_duration },
        { ID2P(LANG_REPLAYGAIN), replaygain_settings_menu },
        { ID2P(LANG_BEEP), beep },
#endif
#ifdef HAVE_SPDIF_POWER
        { ID2P(LANG_SPDIF_ENABLE), spdif },
#endif
        { ID2P(LANG_ID3_ORDER), id3_order },
        { ID2P(LANG_NEXT_FOLDER), next_folder },
        { ID2P(LANG_RUNTIMEDB_ACTIVE), runtimedb },
    };

    bool old_shuffle = global_settings.playlist_shuffle;

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);

    if ((old_shuffle != global_settings.playlist_shuffle) 
        && (audio_status() & AUDIO_STATUS_PLAY))
    {
        if (global_settings.playlist_shuffle)
        {
            playlist_randomise(NULL, current_tick, true);
        }
        else
        {
            playlist_sort(NULL, true);
        }
    }
    return result;
}
static bool time_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_TIME),        timedate_set    },
        { ID2P(LANG_TIMEFORMAT),  timeformat_set  },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
static bool limits_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_MAX_FILES_IN_DIR),    max_files_in_dir        },
        { ID2P(LANG_MAX_FILES_IN_PLAYLIST),    max_files_in_playlist        },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
static bool ff_rewind_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_FFRW_STEP), ff_rewind_min_step },
        { ID2P(LANG_FFRW_ACCEL), ff_rewind_accel },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);

    return result;
}
示例#10
0
static bool voice_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_VOICE_MENU), voice_menus },
        { ID2P(LANG_VOICE_DIR),  voice_dirs  },
        { ID2P(LANG_VOICE_FILE),  voice_files }
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#11
0
static bool disk_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_SPINDOWN),    spindown        },
#ifdef HAVE_ATA_POWER_OFF
        { ID2P(LANG_POWEROFF),    poweroff        },
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#12
0
static bool lcd_remote_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_BACKLIGHT),       remote_backlight_timer },
        { ID2P(LANG_CONTRAST),        remote_contrast },
        { ID2P(LANG_INVERT),          remote_invert },
        { ID2P(LANG_FLIP_DISPLAY),    remote_flip_display },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#13
0
static bool bookmark_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_BOOKMARK_SETTINGS_AUTOCREATE), autocreatebookmark},
        { ID2P(LANG_BOOKMARK_SETTINGS_AUTOLOAD), autoloadbookmark},
        { ID2P(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS), useMRB},
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);

    return result;
}
示例#14
0
static bool replaygain_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_REPLAYGAIN_ENABLE), replaygain },
        { ID2P(LANG_REPLAYGAIN_NOCLIP), replaygain_noclip },
        { ID2P(LANG_REPLAYGAIN_MODE), replaygain_mode },
        { ID2P(LANG_REPLAYGAIN_PREAMP), replaygain_preamp },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#15
0
bool manage_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_CUSTOM_CFG),      custom_cfg_browse },
        { ID2P(LANG_FIRMWARE),        firmware_browse },
        { ID2P(LANG_RESET),           reset_settings },
        { ID2P(LANG_SAVE_SETTINGS),   settings_save_config },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#16
0
static bool fileview_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_SORT_CASE),    sort_case           },
        { ID2P(LANG_SORT_DIR),     sort_dir            },
        { ID2P(LANG_SORT_FILE),    sort_file           },
        { ID2P(LANG_FILTER),       dir_filter          },
        { ID2P(LANG_FOLLOW),       browse_current      },
        { ID2P(LANG_SHOW_ICONS),   show_icons          },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#17
0
/**
 * Menu to configure the peak meter
 */
static bool peak_meter_menu(void) 
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_PM_RELEASE)  , peak_meter_release   },  
        { ID2P(LANG_PM_PEAK_HOLD), peak_meter_hold      },  
        { ID2P(LANG_PM_CLIP_HOLD), peak_meter_clip_hold },
        { ID2P(LANG_PM_SCALE)    , peak_meter_scale     },
        { ID2P(LANG_PM_MIN)      , peak_meter_min       },
        { ID2P(LANG_PM_MAX)      , peak_meter_max       },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL );
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#18
0
static bool bars_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_SCROLL_BAR),      scroll_bar },
        { ID2P(LANG_STATUS_BAR),      status_bar },
#if CONFIG_KEYPAD == RECORDER_PAD
        { ID2P(LANG_BUTTON_BAR),      button_bar },
#endif
        { ID2P(LANG_VOLUME_DISPLAY),  volume_type },
        { ID2P(LANG_BATTERY_DISPLAY), battery_display },
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#19
0
bool settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_PLAYBACK),         playback_settings_menu },
        { ID2P(LANG_FILE),             fileview_settings_menu },
        { ID2P(LANG_DISPLAY),          display_settings_menu  },
        { ID2P(LANG_SYSTEM),           system_settings_menu   },
        { ID2P(LANG_BOOKMARK_SETTINGS),bookmark_settings_menu },
        { ID2P(LANG_LANGUAGE),         language_browse        },
        { ID2P(LANG_VOICE),            voice_menu             },
    };
    
    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#20
0
static bool scroll_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_SCROLL_SPEED),     scroll_speed    },
        { ID2P(LANG_SCROLL_DELAY),    scroll_delay    },  
#ifdef HAVE_LCD_BITMAP
        { ID2P(LANG_SCROLL_STEP),     scroll_step     },  
#endif
        { ID2P(LANG_BIDIR_SCROLL),    bidir_limit    },
#ifdef HAVE_LCD_CHARCELLS
        { ID2P(LANG_JUMP_SCROLL),    jump_scroll    },
        { ID2P(LANG_JUMP_SCROLL_DELAY),    jump_scroll_delay    },
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#21
0
static bool battery_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
#ifndef SIMULATOR
        { ID2P(LANG_BATTERY_CAPACITY), battery_capacity },
#if BATTERY_TYPES_COUNT > 1
        { ID2P(LANG_BATTERY_TYPE),     battery_type },
#endif
#else
#ifndef HAVE_CHARGE_CTRL
        { "Dummy", NULL }, /* to have an entry at all, in the simulator */
#endif
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
示例#22
0
文件: menu.c 项目: Arakash/naev
/**
 * @brief Main menu closing prompt.
 */
static void main_menu_promptClose( unsigned int wid, char *unused )
{
   if (dialogue_YesNo( "Quit", "Are you sure you want to quit?" ))
      menu_exit( wid, unused );
}
示例#23
0
void flat(void)
{
char iroom[80],iphone[80],add_quit;
char option,sortopt,exit_opt;
int phone_check,room_check,delete_check,sort_check,list_check;
int iroom_search,iroom_del;
int int_iroom,total_entries;
int error_iphone,error_iroom;
long int longint_iphone;
long int iphone_search;
long int iphone_del;


strcpy(dbload, "DATABASE ERROR...");

do
 {
  do
   { option = menu_flat();
     if (option == '1')
     {  current_e_add=0;
	for (i=total_entry; i < MAXDB; i++)
	{   clrscr();
	    remakescreen();
	    screen_draw_flat();
	    gotoxy(1,4);
	    printf("## ADD NEW ENTRY ##");
	    gotoxy(1,25);
	    cprintf("Please Add Your Entry, leave blank to reach to Main Menu..");
	    gotoxy(1,6);
	    printf("Enter Room  Number[%3d]: ",i+1);
	    gets(iroom);

	    if (iroom[0] == '\0' )
	    {  gotoxy(1,25);
	       cprintf("You chose to quit: Entry %d was not added to the database.",i+1);
	       getch();
	       break;
	    }
	    printf("Enter Phone Number[%3d]: ",i+1);
	    gets(iphone);

	    if (iphone[0] == '\0')
	    {  gotoxy(1,25);
	       cprintf("You chose to quit: Entry %d was not added to the database.",i+1);
	       getch();
	       break;
	    }

	    error_iroom = chkdig(iroom,4);
	    error_iphone = chkdig(iphone,8);

	    while(error_iroom != 0)
	    {	if (error_iroom == -1)
		{  clrscr();
		   remakescreen();
		   screen_draw_flat();
		   gotoxy(1,4);
		   printf("## ADD NEW ENTRY ##");
		   gotoxy(1,25);
		   cprintf("Error: Room  Number - out of Range, Your entry was greater than 4 digits. ");
		   gotoxy(1,6);
		   printf("Renter Room  Number[%3d]: ",i+1);
		   gets(iroom);
		}
		if (error_iroom == -2)
		{  clrscr();
		   remakescreen();
		   screen_draw_flat();
		   gotoxy(1,4);
		   printf("*** Add Entry ***");
		   gotoxy(1,25);
		   cprintf("Error: Room  Number - Character(s) detected, character(s) are not allowed.");
		   gotoxy(1,6);
		   printf("Renter Room  Number[%3d]: ",i+1);
		   gets(iroom);
		}
		error_iroom = chkdig(iroom,4);
	    }
	    while(error_iphone !=0)
		{	if (error_iphone == -1)
		{  clrscr();
		   remakescreen();
		   screen_draw_flat();
		   gotoxy(1,4);
		   printf("## ADD NEW ENTRY ##");
		   gotoxy(1,25);
		   cprintf("Error: Phone Number - out of Range, Your entry was greater than 8 digits. ");
		   gotoxy(1,6);
		   printf("Room  Number[%3d] Entry: %s",i+1,iroom);
		   gotoxy(1,7);
		   printf("Renter Phone Number[%3d]: ",i+1);
		   gets(iphone);
		}
		if (error_iphone == -2)
		{  clrscr();
		   remakescreen();
		   screen_draw_flat();
		   gotoxy(1,4);
		   printf("## ADD NEW ENTRY ##");
		   gotoxy(1,25);
		   cprintf("Error: Phone Number - Character(s) detected, character(s) are not allowed.");
		   gotoxy(1,6);
		   printf("Room  Number[%3d] Entry: %s",i+1,iroom);
		   gotoxy(1,7);
		   printf("Renter Phone Number[%3d]: ",i+1);
		   gets(iphone);
		}
		error_iphone = chkdig(iphone,8);
	    }
	    if (error_iroom == 0 && error_iphone == 0)
	    {  int_iroom = atoi(iroom);
	       longint_iphone = atol(iphone);

	       current_e_add++;
	       add_entry(int_iroom,longint_iphone);
	    }
	}
	if (total_entry == MAXDB)
	{  gotoxy(1,25);
	   cprintf("\aDatabase is full!: %d entries were added, ",total_entry);
	   cprintf("that is the Maximum No. I can hold.");
	   getch();
	}
     }
     else
     if (option == '2')
     {  del_entry = 0; 	clrscr();
	remakescreen();
	screen_draw_flat();
	gotoxy(1,4);
	printf("## Delete Entry ##");
	gotoxy(1,6);
	printf("Enter room  number to delete: ");
	scanf("%d",&iroom_del);
	flushall();

	printf("Enter phone number to delete: ");
	scanf("%ld",&iphone_del);
	flushall();

	delete_check = delete_entry(iroom_del,iphone_del);

	if (delete_check == 0)
	{  gotoxy(1,25);
	   cprintf("Successful: There are presently %d entries in the database, ",total_entry);
	   cprintf("deleted %d.",del_entry);
	   getch();
	}
	if (delete_check == -1) 
	{  gotoxy(1,25);
	   cprintf("Error: The Room No./Phone No. Your looking for was Not Found.                  ");
	   getch();
	}

     }
     else
     if (option == '3')
     {  phone_found = 0;
	clrscr();
	remakescreen();
	screen_draw_flat();
	gotoxy(1,4);
	printf("## Find Room Number ##");

	gotoxy(1,6);
	printf("Enter the phone number to search for: ");
	scanf("%ld",&iphone_search);
	flushall(); 

	phone_check = find_phone_number(iphone_search);

	if (phone_check == 0)
	{  gotoxy(1,25);
	   cprintf("Successful: There are presently %d entries in the database, ",total_entry);

	   printf("found %d.",phone_found);
	   getch();
	}
	if (phone_check == -1) 
	{  gotoxy(1,25);
	   cprintf("Error: The Phone No. Your looking for was Not Found.");
	   getch();
	}
     }
     else
     if (option == '4')
     {  room_found = 0;
	clrscr();
	remakescreen();
	screen_draw_flat();
	gotoxy(1,4);
	printf("## Find Phone Number ##");

	gotoxy(1,6);
	printf("Enter the room number to search for: ");
	scanf("%d",&iroom_search);
	flushall();

	room_check = FindRoom(iroom_search);

	if (room_check == 0) 
	{  gotoxy(1,25);
	   cprintf("Successful: There are presently %d entries in the database, ",total_entry);
	   cprintf("found %d.",room_found);
	   getch();
	}
	if (room_check == -1) 
	{  gotoxy(1,25);
	   cprintf("Error: The Room No. Your looking for was Not Found.");
	   getch();
	}

     }
     else
     if (option == '5')
     {  clrscr();
	remakescreen();
	screen_draw_flat();
	gotoxy(1,4);
	printf("## ListAll ##\n\n");

	list_check = ListAll();

	if (list_check == 0)
	{  gotoxy(1,25);
	   cprintf("List Sucuessful");
	   getch();
	}
	if (list_check == -1)
	{
	   gotoxy(1,25);
	   cprintf("Empty List");
	   getch();
	}
     }
     else
     if (option == '6')
     {  total_entries = GeTotalEntries();
	gotoxy(1,25);
	cprintf("There are presently %d entries stored in the Database.",total_entries);
	getch();
     }
     else
     if (option == '7') 
   {  clrscr();
	remakescreen();
	screen_draw_flat();
	gotoxy(1,4);
	printf("## Sort All Entries ##");
	gotoxy(1,6);
	printf("Press 'A' to sort database in [A]scending order");
	gotoxy(1,7);
	printf("Press 'D' to sort database in [D]escending order.");
	gotoxy(1,9);
	printf("Note: Database is sorted by phone no. entries.");
	sortopt = getch();
	flushall();

	sort_check = sort_entries(sortopt);
	getch();
	if (sort_check == 0)
	{  gotoxy(1,25);
	   cprintf("Database was successfully Sorted.                                      ");
	   getch();
	}
	if (sort_check == -1)
	{  gotoxy(1,25);
	   cprintf("Database was not sorted - Database is empty!");
	   getch();
	}
     }
     else
     if (option == '8') 
     {  clrscr();
	remakescreen();
	screen_draw_flat();
	gotoxy(1,4);
	printf("## Load Database ##");
	loaddatabase();
     }
     else
     if (option == '9')
     {  gotoxy(1,25);
	cprintf("Do you really want to exit?, Press 'Y' to confirm, anykey to cancel");
	exit_opt = getch();
	flushall();
	if (exit_opt == 'y' || exit_opt == 'Y')
	{  clrscr();
	   remakescreen();
	   screen_draw_flat();
	   gotoxy(1,4);
	   printf("## Exit To system ##\n\n");
	   menu_exit();
	}
     }
     else 
     {  gotoxy(1,25);
	cprintf("Error: Invalid option! Select an option between 1 and 9");
	getch();
	flushall();
     }
   }while  (option > '9' || option < '1' );
 }while (option != '`'); 
}
示例#24
0
int
main(int argc, char **argv)
{
	int ch;
	const char *conffile;

	conffile = CONFFILE;

	while ((ch = getopt(argc, argv, "f:v")) != -1) {
		switch (ch) {
			case 'f':
				conffile = optarg;
				break;
			case 'v':
				verbose++;
				break;
			default:
				usage();
				/* NOTREACHED */
		}
	}

	bzero(&config, sizeof(config));
	config.print.feedlines = -1;
	config.print.cchide_customer = 1;
	config.print.ccsig_customer = 1;
	bzero(&header, sizeof(header));
	if (parse_config(conffile))
		exit(1);

	/* set database files */
	if (config.database.custdb == NULL)
		if ((config.database.custdb = strdup(config.database.alldb
				? config.database.alldb : CUSTDBFILE)) == NULL)
			err(1, "cannot set customer database file");
	if (config.database.menudb == NULL)
		if ((config.database.menudb = strdup(config.database.alldb
				? config.database.alldb : MENUDBFILE)) == NULL)
			err(1, "cannot set menu database file");
	if (config.database.orderdb == NULL)
		if ((config.database.orderdb = strdup(config.database.alldb
				? config.database.alldb : ORDERDBFILE)) == NULL)
			err(1, "cannot set order database file");
	if (config.print.feedlines < 0)
		config.print.feedlines = PRINT_FEED_LINES;

	if (licence_init() == -1)
		errx(1, "cannot proceed without licence");

	event_init();

	module_init();
	rule_init();

	input_init();
	print_init();
	form_init();
	display_init();
	status_init();
	menu_init();
	customer_init();
	special_init();
	payment_init();
	window_init();
	order_init();

	display_refresh();

	signal(SIGPIPE, SIG_IGN);
	if (event_dispatch() == -1)
		err(1, "terminated abnormally");

	if (exitcode != 0 && exitmsg == NULL)
		exitmsg = strdup(status.status);

	order_exit();
	window_exit();
	payment_exit();
	special_exit();
	customer_exit();
	menu_exit();
	status_exit();
	display_exit();
	form_exit();
	print_exit();
	input_exit();

	rule_exit();
	module_exit();

	if (exitcode && exitmsg != NULL)
		errx(exitcode, "%s", exitmsg);
	else
		fprintf(stdout, "exiting normally\n");

	exit(0);
}
示例#25
0
文件: main.c 项目: odrevet/Chess-Wii
int main(int argc, char **argv) {

  GRRLIB_Init();	
	
  // Initialise the attached controllers
  WPAD_Init();
  WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
	
  // Initialise the audio subsystem
  AESND_Init(NULL);
	
  MODPlay_Init(&play);
  MODPlay_SetMOD(&play,bg_music);
  MODPlay_SetVolume(&play,63,63);
  MODPlay_Start(&play);

  cui_cursor cursor;
  cursor.tex[0]=GRRLIB_LoadTexture(player1_point_png);
  cursor.tex[1]=GRRLIB_LoadTexture(player1_grab_png);
  cursor.is_grabbing=false; 
	
  cui_board board;
	
  ENGINE engine = FIRSTCHESS;
  if(engine == TSCP){
    int i;
    for (i=0; i < CUI_TILE_NB; i++) {
      board.piece[i]=init_piece[i];
      if(init_color[i] == 1){
	board.color[i]=CUI_BLACK;
      }else if (init_color[i] == 6){
	board.color[i]=CUI_EMPTY;
      }else if (init_color[i] == 0){
	board.color[i]=CUI_WHITE;
      }
    }
			
    init_hash();
    init_board();
    open_book();
    gen();
  }


  cui_board_read_core(&board, engine);

  GRRLIB_SetBackgroundColour(0x030, 0x30, 0x42, 0xFF);
	
  board.tile_color1 = 0xAAAAAAFF;
  board.tile_color2 = 0x444444FF;
  board.piece_color1 = 0xAAAAAAFF;
  board.piece_color2 = 0x444444FF;
	
  cui_board_init(&board);

  cui_game game;
  game.board = &board;
  game.engine = engine; 
  game.cursor = &cursor;
  game.is_mute = false;
  GRRLIB_texImg *tex_wallpaper = GRRLIB_LoadTexture(wall_jpg);
  game.tex_wallpaper = tex_wallpaper;
			
	
  voice = AESND_AllocateVoice(aesnd_callback);
  AESND_SetVoiceVolume(voice, 0xFF, 0xFF);
  AESND_SetVoiceStream(voice, true);

  cui_menu current_state = CUI_MENU_MAIN;
	 
  while(current_state != CUI_MENU_EXIT) {
    switch(current_state){
    case CUI_MENU_MAIN:	current_state=menu_main(&game);break;
    case CUI_MENU_PLAY:	current_state=menu_play(&game);break;
    case CUI_MENU_OPTION:current_state=menu_option(&game);break;
    case CUI_MENU_OPTION_GENERAL:current_state=menu_option_general(&game);break;
    case CUI_MENU_OPTION_GFX:current_state=menu_option_gfx(&game);break;
    case CUI_MENU_OPTION_SND:current_state=menu_option_snd(&game);break;
    case CUI_MENU_CREDITS:current_state=menu_credits(&game);break;
    case CUI_MENU_PAUSE:current_state=menu_pause(&game);break;
    case CUI_MENU_HOME:current_state=menu_home(&game);break;
    case CUI_MENU_EXIT:current_state=menu_exit(&game);break;
    default:break;
    }
  }
	
  GRRLIB_FreeTexture(tex_wallpaper);
  GRRLIB_FreeTexture(cursor.tex[0]);
  GRRLIB_FreeTexture(cursor.tex[1]);
  GRRLIB_Exit();
  return 0;
}