⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settings_menu.c

📁 编译后直接运行的MP3播放器全部C语言源代码 一个包含FAT文件系统、系统引导 Boot、FLASH Driver等内容的
💻 C
📖 第 1 页 / 共 3 页
字号:
static bool shuffle(void){    return set_bool( str(LANG_SHUFFLE), &global_settings.playlist_shuffle );}static bool repeat_mode(void){    bool result;    char* names[] = { str(LANG_OFF),                       str(LANG_REPEAT_ALL),                      str(LANG_REPEAT_ONE) };    int old_repeat = global_settings.repeat_mode;    result = set_option( str(LANG_REPEAT), &global_settings.repeat_mode,                         INT, names, 3, NULL );    if (old_repeat != global_settings.repeat_mode)        mpeg_flush_and_reload_tracks();    return result;}static bool play_selected(void){    return set_bool( str(LANG_PLAY_SELECTED), &global_settings.play_selected );}static bool dir_filter(void){    char* names[] = { str(LANG_FILTER_ALL),                      str(LANG_FILTER_SUPPORTED),                      str(LANG_FILTER_MUSIC),                      str(LANG_FILTER_PLAYLIST) };    return set_option( str(LANG_FILTER), &global_settings.dirfilter, INT,                       names, 4, NULL );}static bool sort_case(void){    return set_bool( str(LANG_SORT_CASE), &global_settings.sort_case );}static bool resume(void){    char* names[] = { str(LANG_SET_BOOL_NO),                       str(LANG_RESUME_SETTING_ASK),                      str(LANG_RESUME_SETTING_ASK_ONCE),                      str(LANG_SET_BOOL_YES) };    return set_option( str(LANG_RESUME), &global_settings.resume, INT,                       names, 4, NULL );}static bool autocreatebookmark(void){    char* names[] = { str(LANG_SET_BOOL_NO),                      str(LANG_SET_BOOL_YES),                      str(LANG_RESUME_SETTING_ASK),                      str(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES),                      str(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_ASK) };    return set_option( str(LANG_BOOKMARK_SETTINGS_AUTOCREATE),                       &global_settings.autocreatebookmark, INT,                       names, 5, NULL );}static bool autoloadbookmark(void){    char* names[] = { str(LANG_SET_BOOL_NO),                      str(LANG_SET_BOOL_YES),                      str(LANG_RESUME_SETTING_ASK) };    return set_option( str(LANG_BOOKMARK_SETTINGS_AUTOLOAD),                       &global_settings.autoloadbookmark, INT,                       names, 3, NULL );}static bool useMRB(void){    char* names[] = { str(LANG_SET_BOOL_NO),                      str(LANG_SET_BOOL_YES),                      str(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY)};    return set_option( str(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS),                       &global_settings.usemrb, INT,                       names, 3, NULL );}static bool backlight_on_when_charging(void){    bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),                           &global_settings.backlight_on_when_charging);    backlight_set_on_when_charging(global_settings.backlight_on_when_charging);    return result;}static bool backlight_timer(void){    char* names[] = { str(LANG_OFF), str(LANG_ON),                      "1s ", "2s ", "3s ", "4s ", "5s ",                      "6s ", "7s ", "8s ", "9s ", "10s",                      "15s", "20s", "25s", "30s", "45s",                      "60s", "90s"};    return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout,                      INT, names, 19, backlight_set_timeout );}static bool poweroff_idle_timer(void){    char* names[] = { str(LANG_OFF),                      "1m ", "2m ", "3m ", "4m ", "5m ",                      "6m ", "7m ", "8m ", "9m ", "10m",                      "15m", "30m", "45m", "60m"};    return set_option(str(LANG_POWEROFF_IDLE), &global_settings.poweroff,                      INT, names, 15, set_poweroff_timeout);}static bool scroll_speed(void){    return set_int(str(LANG_SCROLL), "Hz", &global_settings.scroll_speed,                    &lcd_scroll_speed, 1, 1, 10 );}static bool scroll_delay(void){    int dummy = global_settings.scroll_delay * (HZ/10);    int rc = set_int(str(LANG_SCROLL_DELAY), "ms", &dummy,                      &lcd_scroll_delay, 100, 0, 2500 );    global_settings.scroll_delay = dummy / (HZ/10);    return rc;}#ifdef HAVE_LCD_BITMAPstatic bool scroll_step(void){    return set_int(str(LANG_SCROLL_STEP_EXAMPLE), "pixels",                   &global_settings.scroll_step,                   &lcd_scroll_step, 1, 1, LCD_WIDTH );}#endifstatic bool bidir_limit(void){    return set_int(str(LANG_BIDIR_SCROLL), "%", &global_settings.bidir_limit,                    &lcd_bidir_scroll, 25, 0, 200 );}#ifdef HAVE_LCD_CHARCELLSstatic bool jump_scroll(void){    char* names[] = { str(LANG_OFF), str(LANG_ONE_TIME), "2",                      "3", "4", str(LANG_ALWAYS)};    bool ret;    ret=set_option(str(LANG_JUMP_SCROLL), &global_settings.jump_scroll,                   INT, names, 6, lcd_jump_scroll);    return ret;}static bool jump_scroll_delay(void){    int dummy = global_settings.jump_scroll_delay * (HZ/10);    int rc = set_int(str(LANG_JUMP_SCROLL_DELAY), "ms", &dummy,                      &lcd_jump_scroll_delay, 100, 0, 2500 );    global_settings.jump_scroll_delay = dummy / (HZ/10);    return rc;}#endif#ifndef SIMULATOR/** * Menu to set the battery capacity */static bool battery_capacity(void){    return set_int(str(LANG_BATTERY_CAPACITY), "mAh", &global_settings.battery_capacity,                    &set_battery_capacity, 50, 1500, BATTERY_CAPACITY_MAX );}#endif#ifdef HAVE_CHARGE_CTRLstatic bool deep_discharge(void){    bool result;    result = set_bool( str(LANG_DISCHARGE), &global_settings.discharge );    charge_restart_level = global_settings.discharge ?         CHARGE_RESTART_LO : CHARGE_RESTART_HI;    return result;}static bool trickle_charge(void){    bool result;    result = set_bool( str(LANG_TRICKLE_CHARGE), &global_settings.trickle_charge );    enable_trickle_charge(global_settings.trickle_charge);    return result;}#endif#ifdef HAVE_RTCstatic bool timedate_set(void){    int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */    bool result;    timedate[0] = rtc_read(0x03); /* hour   */    timedate[1] = rtc_read(0x02); /* minute */    timedate[2] = rtc_read(0x01); /* second */    timedate[3] = rtc_read(0x07); /* year   */    timedate[4] = rtc_read(0x06); /* month  */    timedate[5] = rtc_read(0x05); /* day    */    /* day of week not read, calculated in set_time() */    /* hour   */    timedate[0] = ((timedate[0] & 0x30) >> 4) * 10 + (timedate[0] & 0x0f);     /* minute */    timedate[1] = ((timedate[1] & 0x70) >> 4) * 10 + (timedate[1] & 0x0f);     /* second */    timedate[2] = ((timedate[2] & 0x70) >> 4) * 10 + (timedate[2] & 0x0f);     /* year   */    timedate[3] = ((timedate[3] & 0xf0) >> 4) * 10 + (timedate[3] & 0x0f);     /* month  */    timedate[4] = ((timedate[4] & 0x10) >> 4) * 10 + (timedate[4] & 0x0f);     /* day    */    timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f);    /* do some range checks */    /* This prevents problems with time/date setting after a power loss */    if (timedate[0] < 0 || timedate[0] > 23 ||        timedate[1] < 0 || timedate[1] > 59 ||         timedate[2] < 0 || timedate[2] > 59 ||        timedate[3] < 0 || timedate[3] > 99 ||        timedate[4] < 1 || timedate[4] > 12 ||        timedate[5] < 1 || timedate[5] > 31)    {        /* hour   */        timedate[0] = 0;        /* minute */        timedate[1] = 0;        /* second */        timedate[2] = 0;        /* year   */        timedate[3] = 3;        /* month  */        timedate[4] = 1;        /* day    */        timedate[5] = 1;    }    result = set_time(str(LANG_TIME),timedate);    if(timedate[0] != -1) {        /* hour   */        timedate[0] = ((timedate[0]/10) << 4 | timedate[0]%10) & 0x3f;         /* minute */        timedate[1] = ((timedate[1]/10) << 4 | timedate[1]%10) & 0x7f;         /* second */        timedate[2] = ((timedate[2]/10) << 4 | timedate[2]%10) & 0x7f;         /* year   */        timedate[3] = ((timedate[3]/10) << 4 | timedate[3]%10) & 0xff;         /* month  */        timedate[4] = ((timedate[4]/10) << 4 | timedate[4]%10) & 0x1f;         /* day    */        timedate[5] = ((timedate[5]/10) << 4 | timedate[5]%10) & 0x3f;         rtc_write(0x03, timedate[0] | (rtc_read(0x03) & 0xc0)); /* hour */        rtc_write(0x02, timedate[1] | (rtc_read(0x02) & 0x80)); /* minute */        rtc_write(0x01, timedate[2] | (rtc_read(0x01) & 0x80)); /* second */        rtc_write(0x07, timedate[3]);                           /* year */        rtc_write(0x06, timedate[4] | (rtc_read(0x06) & 0xe0)); /* month */        rtc_write(0x05, timedate[5] | (rtc_read(0x05) & 0xc0)); /* day */        rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */        rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */    }    return result;}static bool timeformat_set(void){    char* names[] = { str(LANG_24_HOUR_CLOCK),                      str(LANG_12_HOUR_CLOCK) };    return set_option(str(LANG_TIMEFORMAT), &global_settings.timeformat,                       INT, names, 2, NULL);}#endifstatic bool spindown(void){    return set_int(str(LANG_SPINDOWN), "s", &global_settings.disk_spindown,                   ata_spindown, 1, 3, 254 );}#ifdef HAVE_MAS3507Dstatic bool line_in(void){    bool rc = set_bool(str(LANG_LINE_IN), &global_settings.line_in);    dac_line_in(global_settings.line_in);    return rc;}#endif#ifdef HAVE_ATA_POWER_OFFstatic bool poweroff(void){    bool rc = set_bool(str(LANG_POWEROFF), &global_settings.disk_poweroff);    ata_poweroff(global_settings.disk_poweroff);    return rc;}#endifstatic bool max_files_in_dir(void){    return set_int(str(LANG_MAX_FILES_IN_DIR), "",                   &global_settings.max_files_in_dir,                   NULL, 50, 50, 10000 );}static bool max_files_in_playlist(void){    return set_int(str(LANG_MAX_FILES_IN_PLAYLIST), "",                   &global_settings.max_files_in_playlist,                   NULL, 1000, 1000, 20000 );}static bool buffer_margin(void){    return set_int(str(LANG_MP3BUFFER_MARGIN), "s",                   &global_settings.buffer_margin,                   mpeg_set_buffer_margin, 1, 0, 7 );}static bool ff_rewind_min_step(void){     char* names[] = { "1s", "2s", "3s", "4s",                      "5s", "6s", "8s", "10s",                      "15s", "20s", "25s", "30s",                      "45s", "60s" };    return set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step,                      INT, names, 14, NULL ); } static bool set_fade_on_stop(void){    return set_bool( str(LANG_FADE_ON_STOP), &global_settings.fade_on_stop );}static bool ff_rewind_accel(void) {     char* names[] = { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s",                       "2x/4s", "2x/5s", "2x/6s", "2x/7s",                       "2x/8s", "2x/9s", "2x/10s", "2x/11s",                      "2x/12s", "2x/13s", "2x/14s", "2x/15s", };    return set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel,                       INT, names, 16, NULL ); } static bool browse_current(void){    return set_bool( str(LANG_FOLLOW), &global_settings.browse_current );}static bool custom_wps_browse(void){    return rockbox_browse(ROCKBOX_DIR, SHOW_WPS);}static bool custom_cfg_browse(void){    return rockbox_browse(ROCKBOX_DIR, SHOW_CFG);}static bool language_browse(void){    return rockbox_browse(ROCKBOX_DIR LANG_DIR, SHOW_LNG);}#ifdef HAVE_LCD_BITMAPstatic bool font_browse(void){    return rockbox_browse(ROCKBOX_DIR FONT_DIR, SHOW_FONT);}static bool scroll_bar(void){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -