Ejemplo n.º 1
0
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);
}
Ejemplo n.º 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);
}
Ejemplo n.º 3
0
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();
}
Ejemplo n.º 4
0
static void about_draw_const(void)
{
        char buf[81];

        if (status.current_page == PAGE_ABOUT) {
                /* redraw outer part */
                draw_box(11,16, 68, 34, BOX_THIN | BOX_OUTER | BOX_FLAT_DARK);
        }

        if (status.flags & CLASSIC_MODE) {
                draw_box(25,25, 56, 30, BOX_THIN | BOX_OUTER | BOX_FLAT_DARK);

                draw_text("Sound Card Setup", 32, 26, 0, 2);

                if (strcasecmp(song_audio_driver(), "dummy") == 0) {
                        draw_text("No sound card detected", 29, 28, 0, 2);
                } else {
                        switch (fake_driver) {
                        case 0:
                                draw_text("Sound Blaster 16 detected", 26, 28, 0, 2);
                                draw_text("Port 220h, IRQ 7, DMA 5", 26, 29, 0, 2);
                                break;
                        case 1:
                                /* FIXME: The GUS driver displays the memory settings a bit
                                differently from the SB. If we're "supporting" it, we should
                                probably keep the rest of the UI consistent with our choice.
                                (Also: no love for the AWE cards?)

                                Alternately, it would be totally awesome to probe the system
                                for the actual name and parameters of the card in use :) */
                                draw_text("Gravis UltraSound detected", 26, 28, 0, 2);
                                draw_text("Port 240h, IRQ 5, 1024k RAM", 26, 29, 0, 2);
                                break;
                        };
                }
        } else {
                snprintf(buf, 80, "Using %s on %s", song_audio_driver(), video_driver_name());
                buf[80] = 0;
                draw_text(buf, (80 - strlen(buf)) / 2, 25, 0, 2);
                /* build date? */
                draw_text(ver_short_copyright, 15, 27, 1, 2);
                draw_text(ver_short_based_on, 15, 28, 1, 2);
                /* XXX if we allow key remapping, need to reflect the *real* help key here */
                draw_text("Press F1 for copyright and full credits", 15, 29, 1, 2);
        }
        vgamem_ovl_apply(&logo_image);
}
Ejemplo n.º 5
0
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;
}