OpenGL GUI: Made the resolution wxComboBox() read only, it's better if they don't accept custom values.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2311 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-02-19 10:29:53 +00:00
parent 5746ed490c
commit bdd02fb1b6
5 changed files with 63 additions and 44 deletions

View File

@ -666,7 +666,7 @@ void BPWritten(int addr, int changes, int newval)
case 0xA0: case 0xA0:
case 0xB0: case 0xB0:
// Just update the bpmem struct, don't do anything else. // Just update the bpmem struct, don't do anything else
default: default:
if (changes) if (changes)
{ {

View File

@ -72,10 +72,12 @@ public:
virtual void Update() {}; virtual void Update() {};
virtual bool MakeCurrent() {return false;}; virtual bool MakeCurrent() {return false;};
virtual void updateDim() { virtual void updateDim()
{
if (GetProperty(OGL_FULLSCREEN)) if (GetProperty(OGL_FULLSCREEN))
SetWinSize(currFullRes.x, currFullRes.y); SetWinSize(currFullRes.x, currFullRes.y);
else else
// Set the windowed resolution
SetWinSize(currWinRes.x, currWinRes.y); SetWinSize(currWinRes.x, currWinRes.y);
float FactorX = 640.0f / (float)GetXwin(); float FactorX = 640.0f / (float)GetXwin();
@ -118,8 +120,8 @@ public:
static bool valid() { return false;} static bool valid() { return false;}
GLWindow() { GLWindow()
{
// Load defaults // Load defaults
sscanf(g_Config.iFSResolution, "%dx%d", sscanf(g_Config.iFSResolution, "%dx%d",
&currFullRes.x, &currFullRes.y); &currFullRes.x, &currFullRes.y);

View File

@ -73,12 +73,56 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
{ {
g_Config.Load(); g_Config.Load();
CreateGUIControls();
} }
///////////////////////////////////////////////////////////////////////////////////////////////
// Close and unload the window
// ---------------
ConfigDialog::~ConfigDialog() ConfigDialog::~ConfigDialog()
{ {
} }
void ConfigDialog::OnClose(wxCloseEvent& event)
{
// notice that we don't run wxEntryCleanup(); here so the dll will still be loaded
g_Config.Save();
//EndModal(0);
// Allow wxWidgets to close and unload the window
event.Skip();
}
void ConfigDialog::CloseClick(wxCommandEvent& WXUNUSED (event))
{
Close();
}
///////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
// Add avaliable redolutions and other settings
// ---------------
void ConfigDialog::AddFSReso(char *reso)
{
arrayStringFor_FullscreenCB.Add(wxString::FromAscii(reso));
}
void ConfigDialog::AddWindowReso(char *reso)
{
arrayStringFor_WindowResolutionCB.Add(wxString::FromAscii(reso));
}
void ConfigDialog::AddRenderBackend(const char *backend)
{
m_RenderBackend->Append(wxString::FromAscii(backend));
}
void ConfigDialog::AddAAMode(int mode)
{
wxString tmp;
tmp<<mode;
m_AliasModeCB->Append(tmp);
}
///////////////////////////////////////
void ConfigDialog::CreateGUIControls() void ConfigDialog::CreateGUIControls()
{ {
@ -130,11 +174,11 @@ void ConfigDialog::CreateGUIControls()
#endif #endif
wxStaticText *FSText = new wxStaticText(m_PageGeneral, ID_FSTEXT, wxT("Fullscreen video mode:"), wxDefaultPosition, wxDefaultSize, 0); wxStaticText *FSText = new wxStaticText(m_PageGeneral, ID_FSTEXT, wxT("Fullscreen video mode:"), wxDefaultPosition, wxDefaultSize, 0);
m_FullscreenCB = new wxComboBox(m_PageGeneral, ID_FULLSCREENCB, wxEmptyString, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenCB, 0, wxDefaultValidator); m_FullscreenCB = new wxComboBox(m_PageGeneral, ID_FULLSCREENCB, arrayStringFor_FullscreenCB[0], wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenCB, wxCB_READONLY, wxDefaultValidator);
m_FullscreenCB->SetValue(wxString::FromAscii(g_Config.iFSResolution)); m_FullscreenCB->SetValue(wxString::FromAscii(g_Config.iFSResolution));
wxStaticText *WMText = new wxStaticText(m_PageGeneral, ID_WMTEXT, wxT("Windowed resolution:"), wxDefaultPosition, wxDefaultSize, 0); wxStaticText *WMText = new wxStaticText(m_PageGeneral, ID_WMTEXT, wxT("Windowed resolution:"), wxDefaultPosition, wxDefaultSize, 0);
m_WindowResolutionCB = new wxComboBox(m_PageGeneral, ID_WINDOWRESOLUTIONCB, wxEmptyString, wxDefaultPosition, wxDefaultSize, arrayStringFor_WindowResolutionCB, 0, wxDefaultValidator); m_WindowResolutionCB = new wxComboBox(m_PageGeneral, ID_WINDOWRESOLUTIONCB, arrayStringFor_WindowResolutionCB[0], wxDefaultPosition, wxDefaultSize, arrayStringFor_WindowResolutionCB, wxCB_READONLY, wxDefaultValidator);
m_WindowResolutionCB->SetValue(wxString::FromAscii(g_Config.iWindowedRes)); m_WindowResolutionCB->SetValue(wxString::FromAscii(g_Config.iWindowedRes));
wxStaticText *BEText = new wxStaticText(m_PageGeneral, ID_BETEXT, wxT("Rendering backend:"), wxDefaultPosition, wxDefaultSize, 0); wxStaticText *BEText = new wxStaticText(m_PageGeneral, ID_BETEXT, wxT("Rendering backend:"), wxDefaultPosition, wxDefaultSize, 0);
@ -392,41 +436,6 @@ void ConfigDialog::CreateGUIControls()
UpdateGUI(); UpdateGUI();
} }
void ConfigDialog::OnClose(wxCloseEvent& WXUNUSED (event))
{
/* notice that we don't run wxEntryCleanup(); here so the dll will
still be loaded */
g_Config.Save();
EndModal(0);
}
void ConfigDialog::CloseClick(wxCommandEvent& WXUNUSED (event))
{
Close();
}
void ConfigDialog::AddFSReso(char *reso)
{
m_FullscreenCB->Append(wxString::FromAscii(reso));
}
void ConfigDialog::AddWindowReso(char *reso)
{
m_WindowResolutionCB->Append(wxString::FromAscii(reso));
}
void ConfigDialog::AddRenderBackend(const char *backend)
{
m_RenderBackend->Append(wxString::FromAscii(backend));
}
void ConfigDialog::AddAAMode(int mode)
{
wxString tmp;
tmp<<mode;
m_AliasModeCB->Append(tmp);
}
void ConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event)) void ConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event))
{ {

View File

@ -47,6 +47,7 @@ class ConfigDialog : public wxDialog
void AddWindowReso(char *reso); void AddWindowReso(char *reso);
void AddRenderBackend(const char *backend); void AddRenderBackend(const char *backend);
void AddAAMode(int mode); void AddAAMode(int mode);
void CreateGUIControls();
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
@ -172,7 +173,6 @@ class ConfigDialog : public wxDialog
}; };
void OnClose(wxCloseEvent& event); void OnClose(wxCloseEvent& event);
void CreateGUIControls();
void UpdateGUI(); void UpdateGUI();
void AboutClick(wxCommandEvent& event); void AboutClick(wxCommandEvent& event);

View File

@ -134,6 +134,9 @@ void DllConfig(HWND _hParent)
std::string resos[100]; std::string resos[100];
int i = 0; int i = 0;
// ---------------------------------------------------------------
// Search for avaliable resolutions
// ---------------------
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0) while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
{ {
char szBuffer[100]; char szBuffer[100];
@ -158,7 +161,12 @@ void DllConfig(HWND _hParent)
} }
ZeroMemory(&dmi, sizeof(dmi)); ZeroMemory(&dmi, sizeof(dmi));
} }
frame->ShowModal(); // ----------------------------
// Create the controls and show the window
frame->CreateGUIControls();
frame->Show();
#elif defined(USE_WX) && USE_WX #elif defined(USE_WX) && USE_WX
ConfigDialog frame(NULL); ConfigDialog frame(NULL);