code beautification and the like for OGL config gui

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@132 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-08-05 08:49:27 +00:00
parent 1a504ff031
commit 8ff50f3155
3 changed files with 108 additions and 77 deletions

View File

@ -21,14 +21,22 @@
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose)
EVT_ACTIVATE(ConfigDialog::ConfigDialogActivate)
EVT_BUTTON(ID_CLOSE,ConfigDialog::OKClick)
EVT_BUTTON(ID_APPLY,ConfigDialog::OKClick)
EVT_BUTTON(ID_OK,ConfigDialog::OKClick)
EVT_BUTTON(ID_BROWSE,ConfigDialog::BrowseClick)
EVT_CHECKBOX(ID_FULLSCREEN,ConfigDialog::FullScreenCheck)
EVT_CHECKBOX(ID_RENDERTOMAINWINDOW,ConfigDialog::RenderMainCheck)
EVT_COMBOBOX(ID_FULLSCREENCB,ConfigDialog::FSCB)
EVT_COMBOBOX(ID_WINDOWRESOLUTIONCB,ConfigDialog::WMCB)
EVT_CHECKBOX(ID_FORCEFILTERING,ConfigDialog::ForceFilteringCheck)
EVT_CHECKBOX(ID_FORCEANISOTROPY,ConfigDialog::ForceAnisotropyCheck)
EVT_CHECKBOX(ID_WIREFRAME,ConfigDialog::WireframeCheck)
EVT_CHECKBOX(ID_STATISTICS,ConfigDialog::OverlayCheck)
EVT_CHECKBOX(ID_SHADERERRORS,ConfigDialog::ShowShaderErrorsCheck)
EVT_CHECKBOX(ID_DUMPTEXTURES,ConfigDialog::DumpTexturesChange)
EVT_DIRPICKER_CHANGED(ID_TEXTUREPATH,ConfigDialog::TexturePathChange)
END_EVENT_TABLE()
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
@ -59,82 +67,63 @@ void ConfigDialog::CreateGUIControls()
m_PageAdvanced = new wxPanel(m_Notebook, ID_PAGEADVANCED, wxPoint(4,24), wxSize(476,170));
m_Notebook->AddPage(m_PageAdvanced, wxT("Advanced"));
// page1
m_Fullscreen = new wxCheckBox(m_PageVideo, ID_FULLSCREEN, wxT("Fullscreen"), wxPoint(12,16), wxSize(137,25), 0, wxDefaultValidator, wxT("Fullscreen"));
m_Fullscreen->SetValue(g_Config.bFullscreen);
// page1
m_RenderToMainWindow = new wxCheckBox(m_PageVideo, ID_RENDERTOMAINWINDOW, wxT("Render to Main Window"), wxPoint(12,40), wxSize(137,25), 0, wxDefaultValidator, wxT("RenderToMainWindow"));
m_RenderToMainWindow = new wxCheckBox(m_PageVideo, ID_RENDERTOMAINWINDOW, wxT("Render to main window"), wxPoint(12,40), wxSize(137,25), 0, wxDefaultValidator, wxT("RenderToMainWindow"));
m_RenderToMainWindow->SetValue(g_Config.renderToMainframe);
// all other options doesnt to anything so lets disable them
wxStaticText *WxStaticText2 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT2, wxT("Fullscreen video mode:"), wxPoint(12,72), wxDefaultSize, 0, wxT("WxStaticText2"));
wxArrayString arrayStringFor_FullscreenCB;
m_FullscreenCB = new wxComboBox(m_PageVideo, ID_FULLSCREENCB, wxT(""), wxPoint(132,72), wxSize(121,21), arrayStringFor_FullscreenCB, 0, wxDefaultValidator, wxT("FullscreenCB"));
m_FullscreenCB->Enable(true);
wxStaticText *WxStaticText1 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT1, wxT("Windowed resolution:"), wxPoint(12,104), wxDefaultSize, 0, wxT("WxStaticText1"));
wxArrayString arrayStringFor_WindowResolutionCB;
m_WindowResolutionCB = new wxComboBox(m_PageVideo, ID_WINDOWRESOLUTIONCB, wxT(""), wxPoint(132,104), wxSize(121,21), arrayStringFor_WindowResolutionCB, 0, wxDefaultValidator, wxT("WindowResolutionCB"));
m_WindowResolutionCB->Enable(true);
wxStaticText *WxStaticText1 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT1, wxT("Windowed Resolution:"), wxPoint(12,104), wxDefaultSize, 0, wxT("WxStaticText1"));
wxStaticText *WxStaticText2 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT2, wxT("Fullscreen Video Mode:"), wxPoint(12,72), wxDefaultSize, 0, wxT("WxStaticText2"));
wxArrayString arrayStringFor_AliasModeCB;
m_AliasModeCB = new wxComboBox(m_PageVideo, ID_ALIASMODECB, wxT("WxComboBox1"), wxPoint(132,136), wxSize(121,21), arrayStringFor_AliasModeCB, 0, wxDefaultValidator, wxT("AliasModeCB"));
m_AliasModeCB->Enable(false);
wxStaticText *WxStaticText3 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT3, wxT("Alias Mode:"), wxPoint(12,136), wxDefaultSize, 0, wxT("WxStaticText3"));
// page2
m_ForceFiltering = new wxCheckBox(m_PageEnhancements, ID_FORCEFILTERING, wxT("Force bi/trlinear (May cause small glitches)"), wxPoint(12,16), wxSize(233,25), 0, wxDefaultValidator, wxT("ForceFiltering"));
m_ForceFiltering->Enable(false);
m_ForceAnsitropy = new wxCheckBox(m_PageEnhancements, ID_FORCEANSITROPY, wxT("Force maximum ansitropy filtering"), wxPoint(12,48), wxSize(233,25), 0, wxDefaultValidator, wxT("ForceAnsitropy"));
m_ForceAnsitropy->Enable(false);
m_Wireframe = new wxCheckBox(m_PageAdvanced, ID_WIREFRAME, wxT("Wireframe"), wxPoint(12,16), wxSize(233,25), 0, wxDefaultValidator, wxT("Wireframe"));
m_Wireframe->Enable(false);
m_DumpTextures = new wxCheckBox(m_PageAdvanced, ID_DUMPTEXTURES, wxT("Dump texture to:"), wxPoint(12,88), wxSize(233,25), 0, wxDefaultValidator, wxT("DumpTextures"));
m_DumpTextures->SetValue(g_Config.bDumpTextures);
m_TexturePath = new wxTextCtrl(m_PageAdvanced, ID_TEXTUREPATH, wxT("TexturePath"), wxPoint(20,136), wxSize(129,25), 0, wxDefaultValidator, wxT("TexturePath"));
m_TexturePath->SetValue(wxString::FromAscii(g_Config.texDumpPath));
m_TexturePath->Enable(false);
m_ForceFiltering->SetValue(g_Config.bForceFiltering);
// page3
m_Statistics = new wxCheckBox(m_PageAdvanced, ID_STATISTICS, wxT("Overlay some statistics"), wxPoint(12,40), wxSize(233,25), 0, wxDefaultValidator, wxT("Statistics"));
m_Statistics->SetValue(g_Config.bOverlayStats);
m_Statistics->Enable(true);
m_DumpTextures = new wxCheckBox(m_PageAdvanced, ID_DUMPTEXTURES, wxT("Dump textures to:"), wxPoint(12,88), wxSize(233,25), 0, wxDefaultValidator, wxT("DumpTextures"));
m_DumpTextures->SetValue(g_Config.bDumpTextures);
m_TexturePath = new wxDirPickerCtrl(m_PageAdvanced, ID_TEXTUREPATH, wxEmptyString, wxT("Choose a directory to store texture dumps:"), wxPoint(12,120), wxSize(233,25), 0);//wxDIRP_USE_TEXTCTRL);
m_TexturePath->SetPath(wxString::FromAscii(g_Config.texDumpPath));
m_TexturePath->Enable(m_DumpTextures->IsChecked());
// TODO: make the following work ^^
wxStaticText *WxStaticText3 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT3, wxT("Anti-alias mode:"), wxPoint(12,136), wxDefaultSize, 0, wxT("AA"));
wxArrayString arrayStringFor_AliasModeCB;
m_AliasModeCB = new wxComboBox(m_PageVideo, ID_ALIASMODECB, wxT(""), wxPoint(132,136), wxSize(121,21), arrayStringFor_AliasModeCB, 0, wxDefaultValidator, wxT("AliasModeCB"));
m_AliasModeCB->Enable(false);
m_ForceAnisotropy = new wxCheckBox(m_PageEnhancements, ID_FORCEANISOTROPY, wxT("Force maximum ansitropy filtering"), wxPoint(12,48), wxSize(233,25), 0, wxDefaultValidator, wxT("ForceAnisotropy"));
//m_ForceAnisotropy->SetValue(g_Config.bForceMaxAniso);
m_ForceAnisotropy->Enable(false);
m_Wireframe = new wxCheckBox(m_PageAdvanced, ID_WIREFRAME, wxT("Wireframe"), wxPoint(12,16), wxSize(233,25), 0, wxDefaultValidator, wxT("Wireframe"));
//m_Wireframe->SetValue(g_Config.bWireFrame);
m_Wireframe->Enable(false);
m_ShaderErrors = new wxCheckBox(m_PageAdvanced, ID_SHADERERRORS, wxT("Show shader compilation issues"), wxPoint(12,64), wxSize(233,25), 0, wxDefaultValidator, wxT("ShaderErrors"));
//m_ShaderErrors->SetValue(g_Config.bShowShaderErrors);
m_ShaderErrors->Enable(false);
m_Browse = new wxButton(m_PageAdvanced, ID_BROWSE, wxT("Browse"), wxPoint(156,136), wxSize(65,25), 0, wxDefaultValidator, wxT("Browse"));
m_Browse->Enable(false);
SetTitle(wxT("Opengl Plugin Configuration"));
SetIcon(wxNullIcon);
SetSize(8,8,492,273);
Center();
m_Fullscreen->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( ConfigDialog::FullScreenCheck ), NULL, this );
m_RenderToMainWindow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( ConfigDialog::RenderMainCheck ), NULL, this );
m_Statistics->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( ConfigDialog::OverlayCheck ), NULL, this );
m_FullscreenCB->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( ConfigDialog::FSCB ), NULL, this );
m_WindowResolutionCB->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( ConfigDialog::WMCB ), NULL, this );
}
void ConfigDialog::OnClose(wxCloseEvent& /*event*/)
void ConfigDialog::OnClose(wxCloseEvent& event)
{
g_Config.Save();
EndModal(0);
}
void ConfigDialog::ConfigDialogActivate(wxActivateEvent& event)
{
// init dialog elements from config
}
void ConfigDialog::BrowseClick(wxCommandEvent& event)
{
// Changed Back //
}
void ConfigDialog::OKClick(wxCommandEvent& event)
@ -151,31 +140,68 @@ void ConfigDialog::OKClick(wxCommandEvent& event)
Close();
}
}
void ConfigDialog::FullScreenCheck(wxCommandEvent& event)
{
g_Config.bFullscreen = m_Fullscreen->IsChecked();
}
void ConfigDialog::RenderMainCheck(wxCommandEvent& event)
{
g_Config.renderToMainframe = m_RenderToMainWindow->IsChecked();
}
void ConfigDialog::AddFSReso(char *reso)
{
m_FullscreenCB->Append(wxString::FromAscii(reso));
}
void ConfigDialog::FSCB(wxCommandEvent& event)
{
strcpy(g_Config.iFSResolution, m_FullscreenCB->GetValue().mb_str() );
}
void ConfigDialog::AddWindowReso(char *reso)
{
m_WindowResolutionCB->Append(wxString::FromAscii(reso));
}
void ConfigDialog::FullScreenCheck(wxCommandEvent& event)
{
g_Config.bFullscreen = m_Fullscreen->IsChecked();
}
void ConfigDialog::FSCB(wxCommandEvent& event)
{
strcpy(g_Config.iFSResolution, m_FullscreenCB->GetValue().mb_str() );
}
void ConfigDialog::WMCB(wxCommandEvent& event)
{
strcpy(g_Config.iWindowedRes, m_WindowResolutionCB->GetValue().mb_str() );
}
void ConfigDialog::RenderMainCheck(wxCommandEvent& event)
void ConfigDialog::ForceFilteringCheck(wxCommandEvent& event)
{
g_Config.renderToMainframe = m_RenderToMainWindow->IsChecked();
g_Config.bForceFiltering = m_ForceFiltering->IsChecked();
}
void ConfigDialog::ForceAnisotropyCheck(wxCommandEvent& event)
{
g_Config.bForceMaxAniso = m_ForceAnisotropy->IsChecked();
}
void ConfigDialog::WireframeCheck(wxCommandEvent& event)
{
g_Config.bWireFrame = m_Wireframe->IsChecked();
}
void ConfigDialog::OverlayCheck(wxCommandEvent& event)
{
g_Config.bOverlayStats = m_Statistics->IsChecked();
}
void ConfigDialog::ShowShaderErrorsCheck(wxCommandEvent& event)
{
g_Config.bShowShaderErrors = m_ShaderErrors->IsChecked();
}
void ConfigDialog::DumpTexturesChange(wxCommandEvent& event)
{
m_TexturePath->Enable(m_DumpTextures->IsChecked());
g_Config.bDumpTextures = m_DumpTextures->IsChecked();
}
void ConfigDialog::TexturePathChange(wxFileDirPickerEvent& event)
{
//note: if a user inputs an incorrect path, this event wil not be fired.
strcpy(g_Config.texDumpPath,event.GetPath().c_str());
}

View File

@ -27,6 +27,7 @@
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/filepicker.h>
#undef ConfigDialog_STYLE
@ -39,31 +40,35 @@ class ConfigDialog : public wxDialog
DECLARE_EVENT_TABLE();
public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Opengl Plugin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigDialog_STYLE);
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("OpenGL Plugin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigDialog_STYLE);
virtual ~ConfigDialog();
void ConfigDialogActivate(wxActivateEvent& event);
void BrowseClick(wxCommandEvent& event);
void OKClick(wxCommandEvent& event);
void AddFSReso(char *reso);
void AddWindowReso(char *reso);
void FullScreenCheck(wxCommandEvent& event);
void FSCB(wxCommandEvent& event);
void WMCB(wxCommandEvent& event);
void RenderMainCheck(wxCommandEvent& event);
void AddFSReso(char *reso);
void FSCB(wxCommandEvent& event);
void AddWindowReso(char *reso);
void WMCB(wxCommandEvent& event);
void ForceFilteringCheck(wxCommandEvent& event);
void ForceAnisotropyCheck(wxCommandEvent& event);
void WireframeCheck(wxCommandEvent& event);
void OverlayCheck(wxCommandEvent& event);
void ShowShaderErrorsCheck(wxCommandEvent& event);
void DumpTexturesChange(wxCommandEvent& event);
void TexturePathChange(wxFileDirPickerEvent& event);
private:
wxButton *m_Close;
wxButton *m_Apply;
wxButton *m_OK;
wxTextCtrl *m_TexturePath;
wxButton *m_Browse;
wxDirPickerCtrl *m_TexturePath;
wxCheckBox *m_ShaderErrors;
wxCheckBox *m_Statistics;
wxCheckBox *m_DumpTextures;
wxCheckBox *m_Wireframe;
wxCheckBox *m_ForceAnsitropy;
wxCheckBox *m_ForceAnisotropy;
wxCheckBox *m_ForceFiltering;
wxComboBox *m_AliasModeCB;
wxComboBox *m_WindowResolutionCB;
@ -89,7 +94,7 @@ class ConfigDialog : public wxDialog
ID_STATISTICS = 1023,
ID_DUMPTEXTURES = 1022,
ID_WIREFRAME = 1021,
ID_FORCEANSITROPY = 1020,
ID_FORCEANISOTROPY = 1020,
ID_FORCEFILTERING = 1019,
ID_WXSTATICTEXT3 = 1015,
ID_ALIASMODECB = 1014,

View File

@ -65,14 +65,14 @@ void DllConfig(HWND _hParent)
{
#ifdef _WIN32
wxWindow win;
win.SetHWND((WXHWND)_hParent);
win.Enable(false);
win.SetHWND(_hParent);
//TODO get available resolutions
ConfigDialog frame(&win);
frame.ShowModal();
win.Enable(true);
win.SetHWND(0);
win.SetHWND(0);
#else
ConfigDialog frame(NULL);
@ -156,7 +156,7 @@ void Video_Prepare(void)
PixelShaderMngr::Init();
GL_REPORT_ERRORD();
}
void Video_Shutdown(void)
{