Windows port: Add a constructor to CToolWindow. Also fix a bug that would cause

the Adhoc interface to always be initialized even when SoftAP is selected.
This commit is contained in:
luigi__ 2009-09-09 18:11:51 +00:00
parent 3fb9b04bfe
commit 3ac9b07639
3 changed files with 36 additions and 17 deletions

View File

@ -47,14 +47,9 @@ DWORD GetFontQuality()
vector<string> ReggedWndClasses;
bool RegWndClass(string name, WNDPROC wndProc, int extraSize)
bool RegWndClass(string name, WNDPROC wndProc, UINT style, int extraSize)
{
return RegWndClass(name, wndProc, 0, NULL, extraSize);
}
bool RegWndClass(string name, WNDPROC wndProc, HICON icon, int extraSize)
{
return RegWndClass(name, wndProc, 0, icon, extraSize);
return RegWndClass(name, wndProc, style, NULL, extraSize);
}
bool RegWndClass(string name, WNDPROC wndProc, UINT style, HICON icon, int extraSize)
@ -107,6 +102,22 @@ void UnregWndClass(string name)
// Base toolwindow class
//-----------------------------------------------------------------------------
CToolWindow::CToolWindow(char* className, WNDPROC proc, char* title, int width, int height)
: hWnd(NULL)
{
DWORD style = WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
RECT rc;
rc.left = 0;
rc.right = width;
rc.top = 0;
rc.bottom = height;
AdjustWindowRect(&rc, style, FALSE);
hWnd = CreateWindow(className, title, style, CW_USEDEFAULT, CW_USEDEFAULT,
rc.right - rc.left, rc.bottom - rc.top, HWND_DESKTOP, NULL, hAppInst, (LPVOID)this);
}
CToolWindow::CToolWindow(int ID, DLGPROC proc, char* title)
: hWnd(NULL)
{

View File

@ -47,8 +47,7 @@ DWORD GetFontQuality();
// Incase the class was already registered, the function
// just does nothing and returns true.
// Returns false if registration failed.
bool RegWndClass(string name, WNDPROC wndProc, int extraSize = 0);
bool RegWndClass(string name, WNDPROC wndProc, HICON icon, int extraSize = 0);
bool RegWndClass(string name, WNDPROC wndProc, UINT style, int extraSize = 0);
bool RegWndClass(string name, WNDPROC wndProc, UINT style, HICON icon, int extraSize = 0);
// UnregWndClass()
@ -65,6 +64,12 @@ class CToolWindow
{
public:
// CToolWindow constructor #1
// Creates a window using CreateWindow().
// If the window creation failed for whatever reason,
// hWnd will be NULL.
CToolWindow(char* className, WNDPROC proc, char* title, int width, int height);
// CToolWindow constructor #2
// Creates a window from a dialog template resource.
// If the window creation failed for whatever reason,
// hWnd will be NULL.

View File

@ -2078,6 +2078,9 @@ int _main()
}
addonsChangePak(addon_type);
CommonSettings.wifi.mode = GetPrivateProfileInt("Wifi", "Mode", 0, IniName);
CommonSettings.wifi.infraBridgeAdapter = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName);
#ifdef GDB_STUB
if ( cmdline.arm9_gdb_port != 0) {
arm9_gdb_stub = createStub_gdb( cmdline.arm9_gdb_port,
@ -2176,9 +2179,6 @@ int _main()
GetPrivateProfileString("Firmware", "FirmwareFile", "firmware.bin", CommonSettings.Firmware, 256, IniName);
CommonSettings.BootFromFirmware = GetPrivateProfileBool("Firmware", "BootFromFirmware", FALSE, IniName);
CommonSettings.wifi.mode = GetPrivateProfileInt("Wifi", "Mode", 0, IniName);
CommonSettings.wifi.infraBridgeAdapter = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName);
video.currentfilter = GetPrivateProfileInt("Video", "Filter", video.NONE, IniName);
FilterUpdate(MainWindow->getHWnd(),false);
@ -2964,9 +2964,7 @@ void RunConfig(CONFIGSCREEN which)
}
else
{
#endif
MessageBox(MainWindow->getHWnd(),"winpcap failed to initialize, and so wifi cannot be configured.","wifi system failure",0);
#ifdef EXPERIMENTAL_WIFI
}
#endif
break;
@ -3863,12 +3861,17 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0;
case IDM_IOREG:
ViewRegisters->open();
//OpenToolWindow(IORegView);
//if (!RegWndClass("DeSmuME_IORegView", IORegView_Proc, CS_DBLCLKS, sizeof(CIORegView*)))
// return 0;
//OpenToolWindow(new CIORegView());
return 0;
case IDM_MEMORY:
//if(!MemView_IsOpened(ARMCPU_ARM9)) MemView_DlgOpen(HWND_DESKTOP, "ARM9 memory", ARMCPU_ARM9);
//if(!MemView_IsOpened(ARMCPU_ARM7)) MemView_DlgOpen(HWND_DESKTOP, "ARM7 memory", ARMCPU_ARM7);
if (RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, sizeof(CMemView*)))
if (!RegWndClass("MemView_ViewBox", MemView_ViewBoxProc, 0, sizeof(CMemView*)))
return 0;
OpenToolWindow(new CMemView());
return 0;
case IDM_SOUND_VIEW: