Removed the hackery that was being done with the plugin configuration dialogs on windows. That was unnecessary and ugly. The HWND type is dead for non windows. Also cleaned up the gui a little.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5999 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2010-07-30 03:51:49 +00:00
parent 75bd5ed645
commit 06fb0c292a
21 changed files with 144 additions and 378 deletions

View File

@ -103,22 +103,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
}
#endif
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
wxWindow *win = new wxWindow();
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
return win;
#else
return new wxWindow();
#endif
}
#endif
void *DllDebugger(void *_hParent, bool Show)
{
return NULL;
@ -145,14 +129,13 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
LogManager::SetInstance((LogManager*)globals->logManager);
}
void DllConfig(HWND _hParent)
void DllConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
// Load config settings
g_Config.Load();
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new DSPConfigDialogHLE(frame);
m_ConfigFrame = new DSPConfigDialogHLE((wxWindow *)_hParent);
// add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
@ -163,23 +146,8 @@ void DllConfig(HWND _hParent)
m_ConfigFrame->AddBackend((*iter).c_str());
}
// Only allow one open at a time
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif
}

View File

@ -95,22 +95,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
}
#endif
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
@ -133,11 +117,10 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
LogManager::SetInstance((LogManager *)globals->logManager);
}
void DllConfig(HWND _hParent)
void DllConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new DSPConfigDialogLLE(frame);
m_ConfigFrame = new DSPConfigDialogLLE((wxWindow *)_hParent);
// add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
@ -148,23 +131,9 @@ void DllConfig(HWND _hParent)
m_ConfigFrame->AddBackend((*iter).c_str());
}
// Only allow one open at a time
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif
}

View File

@ -96,15 +96,6 @@ bool IsD3D()
// This is used for the functions right below here which use wxwidgets
#if defined(HAVE_WX) && HAVE_WX
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
wxWindow* GetParentedWxWindow(HWND Parent)
{
wxSetInstance((HINSTANCE)g_hInstance);
wxWindow* win = new wxWindow();
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
return win;
}
#endif
void *DllDebugger(void *_hParent, bool Show)
@ -186,9 +177,9 @@ void DllAbout(HWND _hParent)
MessageBoxA(NULL, "DllAbout not implemented, how did you come here? Anyway, report this to the devs.", "Error!", MB_OK);
}
void DllConfig(HWND _hParent)
void DllConfig(void *_hParent)
{
DlgSettings_Show(g_hInstance, _hParent);
DlgSettings_Show(g_hInstance, (HWND)((wxWindow *)_hParent)->GetHandle());
}
void Initialize(void* init)

View File

@ -85,15 +85,6 @@ bool IsD3D()
// This is used for the functions right below here which use wxwidgets
#if defined(HAVE_WX) && HAVE_WX
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
wxWindow* GetParentedWxWindow(HWND Parent)
{
wxSetInstance((HINSTANCE)g_hInstance);
wxWindow *win = new wxWindow();
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
return win;
}
#endif
void *DllDebugger(void *_hParent, bool Show)
@ -187,7 +178,7 @@ void DllAbout(HWND _hParent)
//DialogBox(g_hInstance,(LPCTSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc);
}
void DllConfig(HWND _hParent)
void DllConfig(void *_hParent)
{
// If not initialized, only init D3D so we can enumerate resolutions.
if (!s_PluginInitialized)
@ -196,21 +187,11 @@ void DllConfig(HWND _hParent)
g_Config.GameIniLoad(globals->game_ini);
UpdateActiveConfig();
#if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new GFXConfigDialogDX(frame);
m_ConfigFrame = new GFXConfigDialogDX((wxWindow *)_hParent);
// Prevent user to show more than 1 config window at same time
frame->Disable();
m_ConfigFrame->CreateGUIControls();
m_ConfigFrame->ShowModal();
frame->Enable();
frame->SetFocus();
frame->SetHWND(NULL);
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif
if (!s_PluginInitialized)
D3D::Shutdown();

View File

@ -136,19 +136,6 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
extern HINSTANCE g_hInstance;
#endif
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif
void *DllDebugger(void *_hParent, bool Show)
@ -160,35 +147,18 @@ void *DllDebugger(void *_hParent, bool Show)
#endif
}
void DllConfig(HWND _hParent)
void DllConfig(void *_hParent)
{
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
g_Config.GameIniLoad(globals->game_ini);
g_Config.UpdateProjectionHack();
UpdateActiveConfig();
#if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new GFXConfigDialogOGL(frame);
m_ConfigFrame = new GFXConfigDialogOGL((wxWindow *)_hParent);
// Prevent user to show more than 1 config window at same time
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->CreateGUIControls();
m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->CreateGUIControls();
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif
}

View File

@ -66,7 +66,7 @@ void *DllDebugger(void *_hParent, bool Show)
return NULL;
}
void DllConfig(HWND _hParent)
void DllConfig(void *_hParent)
{
}

View File

@ -213,11 +213,11 @@ void GetMousePos(float& x, float& y)
// Get the cursor position for the entire screen
GetCursorPos(&point);
// Get the cursor position relative to the upper left corner of the rendering window
ScreenToClient(g_WiimoteInitialize.hWnd, &point);
ScreenToClient((HWND)g_WiimoteInitialize.hWnd, &point);
// Get the size of the rendering window. (In my case Rect.top and Rect.left was zero.)
RECT Rect;
GetClientRect(g_WiimoteInitialize.hWnd, &Rect);
GetClientRect((HWND)g_WiimoteInitialize.hWnd, &Rect);
// Width and height is the size of the rendering window
float WinWidth = (float)(Rect.right - Rect.left);
float WinHeight = (float)(Rect.bottom - Rect.top);

View File

@ -115,21 +115,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
}
#endif
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif
// Exports
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
@ -157,7 +142,7 @@ void *DllDebugger(void *_hParent, bool Show)
return NULL;
}
void DllConfig(HWND _hParent)
void DllConfig(void *_hParent)
{
#ifdef _WIN32
if (WiiMoteReal::g_AutoPairUpInvisibleWindow == NULL)
@ -177,24 +162,9 @@ void DllConfig(HWND _hParent)
#if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent);
m_BasicConfigFrame = new WiimoteBasicConfigDialog(frame);
#ifdef _WIN32
frame->Disable();
m_BasicConfigFrame = new WiimoteBasicConfigDialog((wxWindow *)_hParent);
m_BasicConfigFrame->ShowModal();
frame->Enable();
#else
m_BasicConfigFrame->ShowModal();
#endif
#ifdef _WIN32
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_BasicConfigFrame->Destroy();
m_BasicConfigFrame = NULL;
frame->Destroy();
#endif
}
@ -347,7 +317,7 @@ void Wiimote_ControlChannel(int _number, u16 _channelID, const void* _pData, u32
WiiMoteEmu::g_ReportingAuto[_number] = false;
WARN_LOG(WIIMOTE, "Wiimote: #%i Disconnected", _number);
#ifdef _WIN32
PostMessage(g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, _number);
PostMessage((HWND)g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, _number);
#endif
return;
}

View File

@ -794,7 +794,7 @@ THREAD_RETURN RunInvisibleMessageWindow_ThreadFunc(void* arg)
void ToggleEmulatorState(bool stop) {
PostMessage(GetParent(g_WiimoteInitialize.hWnd), WM_USER, WM_USER_PAUSE, 0);
PostMessage(GetParent((HWND)g_WiimoteInitialize.hWnd), WM_USER, WM_USER_PAUSE, 0);
if (stop) {
while (g_EmulatorState != PLUGIN_EMUSTATE_PLAY) Sleep(50);
}
@ -832,7 +832,7 @@ int PairUpRefreshWiimote(bool addwiimote)
Allocate();
ToggleEmulatorState(false);
if (addwiimote)
PostMessage(GetParent(g_WiimoteInitialize.hWnd), WM_USER, WM_USER_KEYDOWN, (3 + connectslot));
PostMessage(GetParent((HWND)g_WiimoteInitialize.hWnd), WM_USER, WM_USER_KEYDOWN, (3 + connectslot));
}
return 0;

View File

@ -53,23 +53,6 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
HINSTANCE g_hInstance;
#endif
// copied from GCPad
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif
// /
#ifdef _WIN32
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
@ -271,7 +254,7 @@ void GetDllInfo(PLUGIN_INFO* _pPluginInfo)
// input: A handle to the window that calls this function
// output: none
//
void DllConfig(HWND _hParent)
void DllConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
const bool was_init = g_plugin.controller_interface.IsInit();
@ -279,34 +262,18 @@ void DllConfig(HWND _hParent)
if (false == was_init)
{
#if defined(HAVE_X11) && HAVE_X11
Window win = GDK_WINDOW_XID(GTK_WIDGET(_hParent)->window);
Window win = GDK_WINDOW_XID(GTK_WIDGET(((wxWindow *)_hParent)->GetHandle())->window);
InitPlugin((void *)win);
#else
InitPlugin(_hParent);
InitPlugin(((wxWindow *)_hParent)->GetHandle());
#endif
}
wxWindow *frame = GetParentedWxWindow(_hParent);
WiimoteConfigDiag* const m_ConfigFrame = new WiimoteConfigDiag(frame, g_plugin);
//InputConfigDialog* const m_ConfigFrame = new InputConfigDialog(frame, g_plugin, PLUGIN_FULL_NAME);
WiimoteConfigDiag* const m_ConfigFrame = new WiimoteConfigDiag((wxWindow *)_hParent, g_plugin);
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
wxMilliSleep(50); // hooray for hacks
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy();
frame->Destroy();
// /
if (false == was_init)
DeInitPlugin();