static void config_set_page(void)
{
	const char *nn;

	widgets_config[0].d.thumbbar.value = audio_settings.channel_limit;
	widgets_config[1].d.numentry.value = audio_settings.sample_rate;
	widgets_config[2].d.menutoggle.state = !!(audio_settings.bits == 16);
	widgets_config[3].d.menutoggle.state = audio_settings.channels-1;

	widgets_config[4].d.menutoggle.state = status.vis_style;
	widgets_config[5].d.toggle.state = !!(status.flags & CLASSIC_MODE);
	widgets_config[6].d.menutoggle.state = !!(status.flags & ACCIDENTALS_AS_FLATS);
	widgets_config[7].d.menutoggle.state = status.time_display;

	widgets_config[8].d.toggle.state = !!(status.flags & MIDI_LIKE_TRACKER);

	widgets_config[9].d.togglebutton.state = video_is_fullscreen();
	widgets_config[10].d.togglebutton.state = !video_is_fullscreen();

	nn = video_driver_name();
	widgets_config[11].d.togglebutton.state = (strcasecmp(nn,"sdl") == 0);
	widgets_config[12].d.togglebutton.state = (strcasecmp(nn,"yuv") == 0);
	widgets_config[13].d.togglebutton.state = (strcasecmp(nn,"opengl") == 0);
	widgets_config[14].d.togglebutton.state = (strcasecmp(nn,"directdraw") == 0);
}
Exemple #2
0
void cfg_atexit_save(void)
{
        char *ptr;
        cfg_file_t cfg;

        ptr = dmoz_path_concat(cfg_dir_dotschism, "config");
        cfg_init(&cfg, ptr);
        free(ptr);

        cfg_atexit_save_audio(&cfg);

        /* TODO: move these config options to video.c, this is lame :)
        Or put everything here, which is what the note in audio_loadsave.cc
        says. Very well, I contradict myself. */
        cfg_set_string(&cfg, "Video", "driver", video_driver_name());
        cfg_set_number(&cfg, "Video", "fullscreen", !!(video_is_fullscreen()));
        cfg_set_number(&cfg, "Video", "mouse_cursor", video_mousecursor_visible());
        cfg_set_number(&cfg, "Video", "lazy_redraw", !!(status.flags & LAZY_REDRAW));

        cfg_set_number(&cfg, "General", "vis_style", status.vis_style);
        cfg_set_number(&cfg, "General", "time_display", status.time_display);
        cfg_set_number(&cfg, "General", "classic_mode", !!(status.flags & CLASSIC_MODE));
        cfg_set_number(&cfg, "General", "make_backups", !!(status.flags & MAKE_BACKUPS));
        cfg_set_number(&cfg, "General", "numbered_backups", !!(status.flags & NUMBERED_BACKUPS));

        cfg_set_number(&cfg, "General", "accidentals_as_flats", !!(status.flags & ACCIDENTALS_AS_FLATS));
        cfg_set_number(&cfg, "General", "meta_is_ctrl", !!(status.flags & META_IS_CTRL));
        cfg_set_number(&cfg, "General", "altgr_is_alt", !!(status.flags & ALTGR_IS_ALT));

        cfg_set_number(&cfg, "General", "midi_like_tracker", !!(status.flags & MIDI_LIKE_TRACKER));
        /* Say, whose bright idea was it to make this a string setting?
        The config file is human editable but that's mostly for developer convenience and debugging
        purposes. These sorts of things really really need to be options in the GUI so that people
        don't HAVE to touch the settings. Then we can just use an enum (and we *could* in theory
        include comments to the config by default listing what the numbers are, but that shouldn't
        be necessary in most cases. */
        switch (status.fix_numlock_setting) {
        case NUMLOCK_ALWAYS_ON:
                cfg_set_string(&cfg, "General", "numlock_setting", "on");
                break;
        case NUMLOCK_ALWAYS_OFF:
                cfg_set_string(&cfg, "General", "numlock_setting", "off");
                break;
        case NUMLOCK_HONOR:
                cfg_set_string(&cfg, "General", "numlock_setting", "system");
                break;
        case NUMLOCK_GUESS:
                /* leave empty */
                break;
        };

        /* hm... most of the time probably nothing's different, so saving the
        config file here just serves to make the backup useless. maybe add a
        'dirty' flag to the config parser that checks if any settings are
        actually *different* from those in the file? */

        cfg_write(&cfg);
        cfg_free(&cfg);
}
static void change_video_settings(void)
{
	const char *new_video_driver;
	int new_fs_flag;

	if (widgets_config[11].d.togglebutton.state) {
		new_video_driver = "sdl";
	} else if (widgets_config[12].d.togglebutton.state) {
		new_video_driver = "yuv";
	} else if (widgets_config[13].d.togglebutton.state) {
		new_video_driver = "gl";
	} else if (widgets_config[14].d.togglebutton.state) {
		new_video_driver = "directdraw";
	} else {
		new_video_driver = "sdl";
	}

	if (widgets_config[9].d.togglebutton.state) {
		new_fs_flag = 1;
	} else {
		new_fs_flag = 0;
	}

	if (!strcasecmp(new_video_driver, video_driver_name())
	&& new_fs_flag == video_is_fullscreen()) {
		return;
	}

	video_change_dialog();
	if (strcasecmp(new_video_driver, video_driver_name())) {
		video_setup(new_video_driver);
		video_startup();
	}
	if (new_fs_flag != video_is_fullscreen())
		video_fullscreen(new_fs_flag);
	palette_apply();
	font_init();
}
Exemple #4
0
static void video_update_mode_settings(void) {
	SDL_ShowCursor(false);
	video_update_vsync();
	SDL_GL_GetDrawableSize(video.window, &video.current.width, &video.current.height);
	video.real.width = video.current.width;
	video.real.height = video.current.height;
	video_set_viewport();
	video_update_quality();
	events_emit(TE_VIDEO_MODE_CHANGED, 0, NULL, NULL);

	if(video_is_fullscreen() && !config_get_int(CONFIG_FULLSCREEN_DESKTOP)) {
		video_check_fullscreen_sanity();
	}
}
static void video_change_dialog(void)
{
	struct dialog *d;

	video_revert_driver = video_driver_name();
	video_revert_fs = video_is_fullscreen();

	countdown = 10;
	time(&started);

	create_button(video_dialog_widgets+0, 28,28,8, 0, 0, 0, 1, 1,
					dialog_yes_NULL, "OK", 4);
	create_button(video_dialog_widgets+1, 42,28,8, 1, 1, 0, 1, 0,
					dialog_cancel_NULL, "Cancel", 2);
	d = dialog_create_custom(20, 17, 40, 14,
			video_dialog_widgets,
			2, 1,
			video_dialog_draw_const, NULL);
	d->action_yes = video_mode_keep;
	d->action_no = video_mode_cancel;
	d->action_cancel = video_mode_cancel;
}
Exemple #6
0
static int moonbase_video_is_fullscreen( lua_State *s )
{
	lua_pushboolean( s, video_is_fullscreen() );
	return 1;
}