mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 11:29:24 +01:00
More dead code
This commit is contained in:
parent
88f7c29254
commit
b5fad7ebda
@ -1,320 +0,0 @@
|
||||
/*
|
||||
* C64_x.h - Put the pieces together, X specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2004 Christian Bauer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
||||
static struct timeval tv_start;
|
||||
|
||||
#ifndef HAVE_USLEEP
|
||||
/*
|
||||
* NAME:
|
||||
* usleep -- This is the precision timer for Test Set
|
||||
* Automation. It uses the select(2) system
|
||||
* call to delay for the desired number of
|
||||
* micro-seconds. This call returns ZERO
|
||||
* (which is usually ignored) on successful
|
||||
* completion, -1 otherwise.
|
||||
*
|
||||
* ALGORITHM:
|
||||
* 1) We range check the passed in microseconds and log a
|
||||
* warning message if appropriate. We then return without
|
||||
* delay, flagging an error.
|
||||
* 2) Load the Seconds and micro-seconds portion of the
|
||||
* interval timer structure.
|
||||
* 3) Call select(2) with no file descriptors set, just the
|
||||
* timer, this results in either delaying the proper
|
||||
* ammount of time or being interupted early by a signal.
|
||||
*
|
||||
* HISTORY:
|
||||
* Added when the need for a subsecond timer was evident.
|
||||
*
|
||||
* AUTHOR:
|
||||
* Michael J. Dyer Telephone: AT&T 414.647.4044
|
||||
* General Electric Medical Systems GE DialComm 8 *767.4044
|
||||
* P.O. Box 414 Mail Stop 12-27 Sect'y AT&T 414.647.4584
|
||||
* Milwaukee, Wisconsin USA 53201 8 *767.4584
|
||||
* internet: mike@sherlock.med.ge.com GEMS WIZARD e-mail: DYER
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int usleep(unsigned long int microSeconds)
|
||||
{
|
||||
unsigned int Seconds, uSec;
|
||||
int nfds, readfds, writefds, exceptfds;
|
||||
struct timeval Timer;
|
||||
|
||||
nfds = readfds = writefds = exceptfds = 0;
|
||||
|
||||
if( (microSeconds == (unsigned long) 0)
|
||||
|| microSeconds > (unsigned long) 4000000 )
|
||||
{
|
||||
errno = ERANGE; /* value out of range */
|
||||
perror( "usleep time out of range ( 0 -> 4000000 ) " );
|
||||
return -1;
|
||||
}
|
||||
|
||||
Seconds = microSeconds / (unsigned long) 1000000;
|
||||
uSec = microSeconds % (unsigned long) 1000000;
|
||||
|
||||
Timer.tv_sec = Seconds;
|
||||
Timer.tv_usec = uSec;
|
||||
|
||||
if( select( nfds, &readfds, &writefds, &exceptfds, &Timer ) < 0 )
|
||||
{
|
||||
perror( "usleep (select) failed" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
// select() timing is much more accurate under Linux
|
||||
static void Delay_usec(unsigned long usec)
|
||||
{
|
||||
int was_error;
|
||||
struct timeval tv;
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = usec;
|
||||
do {
|
||||
errno = 0;
|
||||
was_error = select(0, NULL, NULL, NULL, &tv);
|
||||
} while (was_error && (errno == EINTR));
|
||||
}
|
||||
#else
|
||||
static void Delay_usec(unsigned long usec)
|
||||
{
|
||||
usleep(usec);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Constructor, system-dependent things
|
||||
*/
|
||||
|
||||
void C64::c64_ctor1(void)
|
||||
{
|
||||
// Initialize joystick variables
|
||||
joy_minx[0] = joy_miny[0] = 32767;
|
||||
joy_maxx[0] = joy_maxy[0] = -32768;
|
||||
joy_minx[1] = joy_miny[1] = 32767;
|
||||
joy_maxx[1] = joy_maxy[1] = -32768;
|
||||
}
|
||||
|
||||
void C64::c64_ctor2(void)
|
||||
{
|
||||
gettimeofday(&tv_start, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destructor, system-dependent things
|
||||
*/
|
||||
|
||||
void C64::c64_dtor(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Start main emulation thread
|
||||
*/
|
||||
|
||||
void C64::Run(void)
|
||||
{
|
||||
// Reset chips
|
||||
TheCPU->Reset();
|
||||
TheSID->Reset();
|
||||
TheCIA1->Reset();
|
||||
TheCIA2->Reset();
|
||||
TheCPU1541->Reset();
|
||||
|
||||
// Patch kernal IEC routines
|
||||
orig_kernal_1d84 = Kernal[0x1d84];
|
||||
orig_kernal_1d85 = Kernal[0x1d85];
|
||||
PatchKernal(ThePrefs.FastReset, ThePrefs.Emul1541Proc);
|
||||
|
||||
quit_thyself = false;
|
||||
thread_func();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Vertical blank: Poll keyboard and joysticks, update window
|
||||
*/
|
||||
|
||||
void C64::VBlank(bool draw_frame)
|
||||
{
|
||||
// Poll keyboard
|
||||
TheDisplay->PollKeyboard(TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey);
|
||||
if (TheDisplay->quit_requested)
|
||||
quit_thyself = true;
|
||||
|
||||
// Poll joysticks
|
||||
TheCIA1->Joystick1 = poll_joystick(0);
|
||||
TheCIA1->Joystick2 = poll_joystick(1);
|
||||
|
||||
if (ThePrefs.JoystickSwap) {
|
||||
uint8 tmp = TheCIA1->Joystick1;
|
||||
TheCIA1->Joystick1 = TheCIA1->Joystick2;
|
||||
TheCIA1->Joystick2 = tmp;
|
||||
}
|
||||
|
||||
// Joystick keyboard emulation
|
||||
if (TheDisplay->NumLock())
|
||||
TheCIA1->Joystick1 &= joykey;
|
||||
else
|
||||
TheCIA1->Joystick2 &= joykey;
|
||||
|
||||
// Count TOD clocks
|
||||
TheCIA1->CountTOD();
|
||||
TheCIA2->CountTOD();
|
||||
|
||||
// Update window if needed
|
||||
if (draw_frame) {
|
||||
TheDisplay->Update();
|
||||
|
||||
// Calculate time between VBlanks, display speedometer
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
if ((tv.tv_usec -= tv_start.tv_usec) < 0) {
|
||||
tv.tv_usec += 1000000;
|
||||
tv.tv_sec -= 1;
|
||||
}
|
||||
tv.tv_sec -= tv_start.tv_sec;
|
||||
double elapsed_time = (double)tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
speed_index = 20000 / (elapsed_time + 1) * ThePrefs.SkipFrames * 100;
|
||||
|
||||
// Limit speed to 100% if desired
|
||||
if ((speed_index > 100) && ThePrefs.LimitSpeed) {
|
||||
Delay_usec((unsigned long)(ThePrefs.SkipFrames * 20000 - elapsed_time));
|
||||
speed_index = 100;
|
||||
}
|
||||
|
||||
gettimeofday(&tv_start, NULL);
|
||||
|
||||
TheDisplay->Speedometer((int)speed_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The emulation's main loop
|
||||
*/
|
||||
|
||||
void C64::thread_func(void)
|
||||
{
|
||||
int linecnt = 0;
|
||||
|
||||
#ifdef FRODO_SC
|
||||
while (!quit_thyself) {
|
||||
|
||||
// The order of calls is important here
|
||||
if (TheVIC->EmulateCycle())
|
||||
TheSID->EmulateLine();
|
||||
TheCIA1->CheckIRQs();
|
||||
TheCIA2->CheckIRQs();
|
||||
TheCIA1->EmulateCycle();
|
||||
TheCIA2->EmulateCycle();
|
||||
TheCPU->EmulateCycle();
|
||||
|
||||
if (ThePrefs.Emul1541Proc) {
|
||||
TheCPU1541->CountVIATimers(1);
|
||||
if (!TheCPU1541->Idle)
|
||||
TheCPU1541->EmulateCycle();
|
||||
}
|
||||
CycleCounter++;
|
||||
#else
|
||||
while (!quit_thyself) {
|
||||
|
||||
// The order of calls is important here
|
||||
int cycles = TheVIC->EmulateLine();
|
||||
TheSID->EmulateLine();
|
||||
#if !PRECISE_CIA_CYCLES
|
||||
TheCIA1->EmulateLine(ThePrefs.CIACycles);
|
||||
TheCIA2->EmulateLine(ThePrefs.CIACycles);
|
||||
#endif
|
||||
|
||||
if (ThePrefs.Emul1541Proc) {
|
||||
int cycles_1541 = ThePrefs.FloppyCycles;
|
||||
TheCPU1541->CountVIATimers(cycles_1541);
|
||||
|
||||
if (!TheCPU1541->Idle) {
|
||||
// 1541 processor active, alternately execute
|
||||
// 6502 and 6510 instructions until both have
|
||||
// used up their cycles
|
||||
while (cycles >= 0 || cycles_1541 >= 0)
|
||||
if (cycles > cycles_1541)
|
||||
cycles -= TheCPU->EmulateLine(1);
|
||||
else
|
||||
cycles_1541 -= TheCPU1541->EmulateLine(1);
|
||||
} else
|
||||
TheCPU->EmulateLine(cycles);
|
||||
} else
|
||||
// 1541 processor disabled, only emulate 6510
|
||||
TheCPU->EmulateLine(cycles);
|
||||
#endif
|
||||
linecnt++;
|
||||
#if !defined(__svgalib__)
|
||||
if ((linecnt & 0xfff) == 0 && gui) {
|
||||
|
||||
// check for command from GUI process
|
||||
// fprintf(stderr,":");
|
||||
while (gui->probe()) {
|
||||
char c;
|
||||
if (gui->eread(&c, 1) != 1) {
|
||||
delete gui;
|
||||
gui = 0;
|
||||
fprintf(stderr,"Oops, GUI process died...\n");
|
||||
} else {
|
||||
// fprintf(stderr,"%c",c);
|
||||
switch (c) {
|
||||
case 'q':
|
||||
quit_thyself = true;
|
||||
break;
|
||||
case 'r':
|
||||
Reset();
|
||||
break;
|
||||
case 'p':{
|
||||
Prefs *np = Frodo::reload_prefs();
|
||||
NewPrefs(np);
|
||||
ThePrefs = *np;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,250 +0,0 @@
|
||||
/*
|
||||
* Prefs_glade.h - Global preferences, Glade/Gnome/Gtk+ specific stuff
|
||||
*
|
||||
* Frodo (C) 1994-1997,2002-2005 Christian Bauer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <gnome.h>
|
||||
#include <glade/glade.h>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
|
||||
// Glade XML tree
|
||||
static GladeXML *xml = NULL;
|
||||
|
||||
// Result of ShowEditor()
|
||||
static bool result = false;
|
||||
|
||||
// Pointer to preferences being edited
|
||||
static Prefs *prefs = NULL;
|
||||
|
||||
// Prefs file name
|
||||
static char *prefs_path = NULL;
|
||||
|
||||
// Prototypes
|
||||
static void set_values();
|
||||
static void get_values();
|
||||
static void ghost_widgets();
|
||||
|
||||
|
||||
/*
|
||||
* Show preferences editor (synchronously)
|
||||
* prefs_name points to the file name of the preferences (which may be changed)
|
||||
*/
|
||||
|
||||
bool Prefs::ShowEditor(bool startup, char *path)
|
||||
{
|
||||
prefs = this;
|
||||
prefs_path = path;
|
||||
|
||||
// Load XML user interface file on startup
|
||||
if (startup) {
|
||||
xml = glade_xml_new(DATADIR "Frodo.glade", NULL, NULL);
|
||||
if (xml) {
|
||||
glade_xml_signal_autoconnect(xml);
|
||||
set_values();
|
||||
}
|
||||
}
|
||||
|
||||
// No XML means no prefs editor
|
||||
if (!xml)
|
||||
return startup;
|
||||
|
||||
// Run editor
|
||||
result = false;
|
||||
gtk_main();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the values of the widgets
|
||||
*/
|
||||
|
||||
static void create_joystick_menu(const char *widget_name)
|
||||
{
|
||||
GtkWidget *w = glade_xml_get_widget(xml, widget_name);
|
||||
gtk_option_menu_remove_menu(GTK_OPTION_MENU(w));
|
||||
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
|
||||
for (int i = -1; i < SDL_NumJoysticks(); ++i) {
|
||||
GtkWidget *item = gtk_menu_item_new_with_label(i < 0 ? "None" : SDL_JoystickName(i));
|
||||
gtk_widget_show(item);
|
||||
gtk_menu_append(GTK_MENU(menu), item);
|
||||
}
|
||||
|
||||
gtk_option_menu_set_menu(GTK_OPTION_MENU(w), menu);
|
||||
}
|
||||
|
||||
static void set_values()
|
||||
{
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "emul1541_proc")), prefs->Emul1541Proc);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "map_slash")), prefs->MapSlash);
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(glade_xml_get_widget(xml, "drive8_path")))), prefs->DrivePath[0]);
|
||||
gtk_entry_set_text(GTK_ENTRY(gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(glade_xml_get_widget(xml, "drive9_path")))), prefs->DrivePath[1]);
|
||||
gtk_entry_set_text(GTK_ENTRY(gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(glade_xml_get_widget(xml, "drive10_path")))), prefs->DrivePath[2]);
|
||||
gtk_entry_set_text(GTK_ENTRY(gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(glade_xml_get_widget(xml, "drive11_path")))), prefs->DrivePath[3]);
|
||||
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "display_type")), prefs->DisplayType);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "sprites_on")), prefs->SpritesOn);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "sprite_collisions")), prefs->SpriteCollisions);
|
||||
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "sid_type")), prefs->SIDType);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "sid_filters")), prefs->SIDFilters);
|
||||
|
||||
create_joystick_menu("joystick1_port");
|
||||
create_joystick_menu("joystick2_port");
|
||||
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "joystick1_port")), prefs->Joystick1Port);
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "joystick2_port")), prefs->Joystick2Port);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "joystick_swap")), prefs->JoystickSwap);
|
||||
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "skip_frames")), prefs->SkipFrames);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "limit_speed")), prefs->LimitSpeed);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "fast_reset")), prefs->FastReset);
|
||||
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "reu_size")), prefs->REUSize);
|
||||
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "normal_cycles")), prefs->NormalCycles);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "bad_line_cycles")), prefs->BadLineCycles);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "cia_cycles")), prefs->CIACycles);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "floppy_cycles")), prefs->FloppyCycles);
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "cia_irq_hack")), prefs->CIAIRQHack);
|
||||
|
||||
ghost_widgets();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the values of the widgets
|
||||
*/
|
||||
|
||||
static void get_drive_path(int num, const char *widget_name)
|
||||
{
|
||||
prefs->DrivePath[num][0] = 0;
|
||||
const char *path = gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(glade_xml_get_widget(xml, widget_name)), false);
|
||||
if (path)
|
||||
strncpy(prefs->DrivePath[num], path, 255);
|
||||
prefs->DrivePath[num][255] = 0;
|
||||
}
|
||||
|
||||
static void get_values()
|
||||
{
|
||||
prefs->Emul1541Proc = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "emul1541_proc")));
|
||||
prefs->MapSlash = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "map_slash")));
|
||||
|
||||
get_drive_path(0, "drive8_path");
|
||||
get_drive_path(1, "drive9_path");
|
||||
get_drive_path(2, "drive10_path");
|
||||
get_drive_path(3, "drive11_path");
|
||||
|
||||
prefs->DisplayType = gtk_option_menu_get_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "display_type")));
|
||||
prefs->SpritesOn = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "sprites_on")));
|
||||
prefs->SpriteCollisions = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "sprite_collisions")));
|
||||
|
||||
prefs->SIDType = gtk_option_menu_get_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "sid_type")));
|
||||
prefs->SIDFilters = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "sid_filters")));
|
||||
|
||||
prefs->Joystick1Port = gtk_option_menu_get_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "joystick1_port")));
|
||||
prefs->Joystick2Port = gtk_option_menu_get_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "joystick2_port")));
|
||||
prefs->JoystickSwap = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "joystick_swap")));
|
||||
|
||||
prefs->SkipFrames = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "skip_frames")));
|
||||
prefs->LimitSpeed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "limit_speed")));
|
||||
prefs->FastReset = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "fast_reset")));
|
||||
|
||||
prefs->REUSize = gtk_option_menu_get_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "reu_size")));
|
||||
|
||||
prefs->NormalCycles = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "normal_cycles")));
|
||||
prefs->BadLineCycles = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "bad_line_cycles")));
|
||||
prefs->CIACycles = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "cia_cycles")));
|
||||
prefs->FloppyCycles = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "floppy_cycles")));
|
||||
|
||||
prefs->CIAIRQHack = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "cia_irq_hack")));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ghost/unghost widgets
|
||||
*/
|
||||
|
||||
static void ghost_widget(const char *name, bool ghosted)
|
||||
{
|
||||
gtk_widget_set_sensitive(glade_xml_get_widget(xml, name), !ghosted);
|
||||
}
|
||||
|
||||
static void ghost_widgets()
|
||||
{
|
||||
ghost_widget("drive9_path", prefs->Emul1541Proc);
|
||||
ghost_widget("drive10_path", prefs->Emul1541Proc);
|
||||
ghost_widget("drive11_path", prefs->Emul1541Proc);
|
||||
|
||||
ghost_widget("sid_filters", prefs->SIDType != SIDTYPE_DIGITAL);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "sid_filters")), prefs->SIDType == SIDTYPE_DIGITAL ? prefs->SIDFilters : (prefs->SIDType == SIDTYPE_SIDCARD ? true : false));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Signal handlers
|
||||
*/
|
||||
|
||||
extern "C" gboolean on_prefs_win_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" void on_ok_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
result = true;
|
||||
get_values();
|
||||
prefs->Save(prefs_path);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
extern "C" void on_quit_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
result = false;
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
extern "C" void on_about_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
GladeXML *about_xml = glade_xml_new(DATADIR "Frodo.glade", "about_win", NULL);
|
||||
if (about_xml)
|
||||
gtk_widget_show(glade_xml_get_widget(about_xml, "about_win"));
|
||||
}
|
||||
|
||||
extern "C" void on_emul1541_proc_toggled(GtkToggleButton *button, gpointer user_data)
|
||||
{
|
||||
prefs->Emul1541Proc = gtk_toggle_button_get_active(button);
|
||||
ghost_widgets();
|
||||
}
|
||||
|
||||
extern "C" void on_sid_type_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
prefs->SIDType = gtk_option_menu_get_history(GTK_OPTION_MENU(glade_xml_get_widget(xml, "sid_type")));
|
||||
ghost_widgets();
|
||||
}
|
||||
|
||||
extern "C" void on_sid_filters_toggled(GtkToggleButton *button, gpointer user_data)
|
||||
{
|
||||
prefs->SIDFilters = gtk_toggle_button_get_active(button);
|
||||
}
|
Loading…
Reference in New Issue
Block a user