From 635d6e5811bdd6c197732e41e0707a999c83dbef Mon Sep 17 00:00:00 2001 From: mpohoreski Date: Sun, 14 May 2006 00:44:38 +0000 Subject: [PATCH] framewindow -> g_hFrameWindow --- source/Applewin.cpp | 10 +++--- source/Frame.cpp | 66 ++++++++++++++++++------------------ source/Frame.h | 2 +- source/Harddisk.cpp | 2 +- source/Keyboard.cpp | 2 +- source/PropertySheetPage.cpp | 12 +++---- source/SaveState.cpp | 2 +- source/SoundCore.cpp | 2 +- source/Speaker.cpp | 2 +- source/Video.cpp | 10 +++--- 10 files changed, 55 insertions(+), 55 deletions(-) diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 02f3623d..961a1342 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -619,7 +619,7 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) // Initialize COM CoInitialize( NULL ); SysClk_InitTimer(); -// DSInit(); // Done when framewindow is created (WM_CREATE) +// DSInit(); // Done when g_hFrameWindow is created (WM_CREATE) // DO ONE-TIME INITIALIZATION instance = passinstance; @@ -662,15 +662,15 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) if(bSetFullScreen) { - PostMessage(framewindow, WM_KEYDOWN, VK_F1+BTN_FULLSCR, 0); - PostMessage(framewindow, WM_KEYUP, VK_F1+BTN_FULLSCR, 0); + PostMessage(g_hFrameWindow, WM_KEYDOWN, VK_F1+BTN_FULLSCR, 0); + PostMessage(g_hFrameWindow, WM_KEYUP, VK_F1+BTN_FULLSCR, 0); bSetFullScreen = false; } if(bBoot) { - PostMessage(framewindow, WM_KEYDOWN, VK_F1+BTN_RUN, 0); - PostMessage(framewindow, WM_KEYUP, VK_F1+BTN_RUN, 0); + PostMessage(g_hFrameWindow, WM_KEYDOWN, VK_F1+BTN_RUN, 0); + PostMessage(g_hFrameWindow, WM_KEYUP, VK_F1+BTN_RUN, 0); bBoot = false; } diff --git a/source/Frame.cpp b/source/Frame.cpp index 6067e658..6634749f 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -69,7 +69,7 @@ static int buttony = BUTTONY; static HRGN clipregion = (HRGN)0; static HDC framedc = (HDC)0; static RECT framerect = {0,0,0,0}; -HWND framewindow = (HWND)0; +HWND g_hFrameWindow = (HWND)0; BOOL fullscreen = 0; static BOOL helpquit = 0; static BOOL painting = 0; @@ -173,7 +173,7 @@ void DrawBitmapRect (HDC dc, int x, int y, LPRECT rect, HBITMAP bitmap) { //=========================================================================== void DrawButton (HDC passdc, int number) { FrameReleaseDC(); - HDC dc = (passdc ? passdc : GetDC(framewindow)); + HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow)); int x = buttonx; int y = buttony+number*BUTTONCY; if (number == buttondown) { @@ -205,7 +205,7 @@ void DrawButton (HDC passdc, int number) { NULL); } if (!passdc) - ReleaseDC(framewindow,dc); + ReleaseDC(g_hFrameWindow,dc); } //=========================================================================== @@ -213,7 +213,7 @@ void DrawCrosshairs (int x, int y) { static int lastx = 0; static int lasty = 0; FrameReleaseDC(); - HDC dc = GetDC(framewindow); + HDC dc = GetDC(g_hFrameWindow); #define LINE(x1,y1,x2,y2) MoveToEx(dc,x1,y1,NULL); LineTo(dc,x2,y2); // ERASE THE OLD CROSSHAIRS @@ -275,15 +275,15 @@ void DrawCrosshairs (int x, int y) { #undef LINE lastx = x; lasty = y; - ReleaseDC(framewindow,dc); + ReleaseDC(g_hFrameWindow,dc); } //=========================================================================== void DrawFrameWindow () { FrameReleaseDC(); PAINTSTRUCT ps; - HDC dc = (painting ? BeginPaint(framewindow,&ps) - : GetDC(framewindow)); + HDC dc = (painting ? BeginPaint(g_hFrameWindow,&ps) + : GetDC(g_hFrameWindow)); VideoRealizePalette(dc); if (!fullscreen) { @@ -314,9 +314,9 @@ void DrawFrameWindow () { // DRAW THE STATUS AREA DrawStatusArea(dc,DRAW_BACKGROUND | DRAW_LEDS); if (painting) - EndPaint(framewindow,&ps); + EndPaint(g_hFrameWindow,&ps); else - ReleaseDC(framewindow,dc); + ReleaseDC(g_hFrameWindow,dc); // DRAW THE CONTENTS OF THE EMULATED SCREEN if (mode == MODE_LOGO) @@ -330,7 +330,7 @@ void DrawFrameWindow () { //=========================================================================== void DrawStatusArea (HDC passdc, int drawflags) { FrameReleaseDC(); - HDC dc = (passdc ? passdc : GetDC(framewindow)); + HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow)); int x = buttonx; int y = buttony+BUTTONS*BUTTONCY+1; int iDrive1Status = DISK_STATUS_OFF; @@ -389,7 +389,7 @@ void DrawStatusArea (HDC passdc, int drawflags) { case MODE_PAUSED: _tcscat(title,TEXT(" [Paused]")); break; case MODE_STEPPING: _tcscat(title,TEXT(" [Stepping]")); break; } - SendMessage(framewindow,WM_SETTEXT,0,(LPARAM)title); + SendMessage(g_hFrameWindow,WM_SETTEXT,0,(LPARAM)title); } if (drawflags & DRAW_BUTTON_DRIVES) { @@ -398,7 +398,7 @@ void DrawStatusArea (HDC passdc, int drawflags) { } } if (!passdc) - ReleaseDC(framewindow,dc); + ReleaseDC(g_hFrameWindow,dc); } //=========================================================================== @@ -408,7 +408,7 @@ void EraseButton (int number) { rect.right = rect.left+BUTTONCX; rect.top = buttony+number*BUTTONCY; rect.bottom = rect.top+BUTTONCY; - InvalidateRect(framewindow,&rect,1); + InvalidateRect(g_hFrameWindow,&rect,1); } //=========================================================================== @@ -454,7 +454,7 @@ LRESULT CALLBACK FrameWndProc (HWND window, break; case WM_CREATE: - framewindow = window; + g_hFrameWindow = window; CreateGdiObjects(); DSInit(); MB_Initialize(); @@ -813,7 +813,7 @@ LRESULT CALLBACK FrameWndProc (HWND window, case WM_USER_BENCHMARK: { if (mode != MODE_LOGO) - if (MessageBox(framewindow, + if (MessageBox(g_hFrameWindow, TEXT("Running the benchmarks will reset the state of ") TEXT("the emulated machine, causing you to lose any ") TEXT("unsaved work.\n\n") @@ -836,7 +836,7 @@ LRESULT CALLBACK FrameWndProc (HWND window, // . Changed Apple computer type (][+ or //e) // . Changed disk speed (normal or enhanced) if (mode != MODE_LOGO) - if (MessageBox(framewindow, + if (MessageBox(g_hFrameWindow, TEXT("Restarting the emulator will reset the state ") TEXT("of the emulated machine, causing you to lose any ") TEXT("unsaved work.\n\n") @@ -873,7 +873,7 @@ void ProcessButtonClick (int button) { TCHAR filename[MAX_PATH]; _tcscpy(filename,progdir); _tcscat(filename,TEXT("APPLEWIN.CHM")); - HtmlHelp(framewindow,filename,HH_DISPLAY_TOC,0); + HtmlHelp(g_hFrameWindow,filename,HH_DISPLAY_TOC,0); helpquit = 1; } break; @@ -995,7 +995,7 @@ void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) { if (fullscreen) return; MSG msg; - msg.hwnd = framewindow; + msg.hwnd = g_hFrameWindow; msg.message = message; msg.wParam = wparam; msg.lParam = lparam; @@ -1026,20 +1026,20 @@ void SetFullScreenMode () { buttony = FSBUTTONY; viewportx = FSVIEWPORTX; viewporty = FSVIEWPORTY; - GetWindowRect(framewindow,&framerect); - SetWindowLong(framewindow,GWL_STYLE,WS_POPUP | WS_SYSMENU | WS_VISIBLE); + GetWindowRect(g_hFrameWindow,&framerect); + SetWindowLong(g_hFrameWindow,GWL_STYLE,WS_POPUP | WS_SYSMENU | WS_VISIBLE); DDSURFACEDESC ddsd; ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; if (DirectDrawCreate(NULL,&directdraw,NULL) != DD_OK || - directdraw->SetCooperativeLevel(framewindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK || + directdraw->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK || directdraw->SetDisplayMode(640,480,8) != DD_OK || directdraw->CreateSurface(&ddsd,&surface,NULL) != DD_OK) { SetNormalMode(); return; } - InvalidateRect(framewindow,NULL,1); + InvalidateRect(g_hFrameWindow,NULL,1); } //=========================================================================== @@ -1052,10 +1052,10 @@ void SetNormalMode () { viewporty = VIEWPORTY; directdraw->RestoreDisplayMode(); directdraw->SetCooperativeLevel(NULL,DDSCL_NORMAL); - SetWindowLong(framewindow,GWL_STYLE, + SetWindowLong(g_hFrameWindow,GWL_STYLE, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE); - SetWindowPos(framewindow,0,framerect.left, + SetWindowPos(g_hFrameWindow,0,framerect.left, framerect.top, framerect.right - framerect.left, framerect.bottom - framerect.top, @@ -1074,18 +1074,18 @@ void SetUsingCursor (BOOL newvalue) { return; usingcursor = newvalue; if (usingcursor) { - SetCapture(framewindow); + SetCapture(g_hFrameWindow); RECT rect = {viewportx+2, viewporty+2, viewportx+VIEWPORTCX-1, viewporty+VIEWPORTCY-1}; - ClientToScreen(framewindow,(LPPOINT)&rect.left); - ClientToScreen(framewindow,(LPPOINT)&rect.right); + ClientToScreen(g_hFrameWindow,(LPPOINT)&rect.left); + ClientToScreen(g_hFrameWindow,(LPPOINT)&rect.right); ClipCursor(&rect); ShowCursor(0); POINT pt; GetCursorPos(&pt); - ScreenToClient(framewindow,&pt); + ScreenToClient(g_hFrameWindow,&pt); DrawCrosshairs(pt.x,pt.y); } else { @@ -1116,7 +1116,7 @@ void FrameCreateWindow () { int ypos; if (!RegLoadValue(TEXT("Preferences"),TEXT("Window Y-Position"),1,(DWORD *)&ypos)) ypos = (GetSystemMetrics(SM_CYSCREEN)-height) >> 1; - framewindow = CreateWindow(TEXT("APPLE2FRAME"),apple2e ? TITLE + g_hFrameWindow = CreateWindow(TEXT("APPLE2FRAME"),apple2e ? TITLE : TEXT("Apple ][+ Emulator"), WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE, @@ -1125,11 +1125,11 @@ void FrameCreateWindow () { InitCommonControls(); tooltipwindow = CreateWindow(TOOLTIPS_CLASS,NULL,TTS_ALWAYSTIP, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, - framewindow,(HMENU)0,instance,NULL); + g_hFrameWindow,(HMENU)0,instance,NULL); TOOLINFO toolinfo; toolinfo.cbSize = sizeof(toolinfo); toolinfo.uFlags = TTF_CENTERTIP; - toolinfo.hwnd = framewindow; + toolinfo.hwnd = g_hFrameWindow; toolinfo.hinst = instance; toolinfo.lpszText = LPSTR_TEXTCALLBACK; toolinfo.rect.left = BUTTONX; @@ -1147,7 +1147,7 @@ void FrameCreateWindow () { //=========================================================================== HDC FrameGetDC () { if (!framedc) { - framedc = GetDC(framewindow); + framedc = GetDC(g_hFrameWindow); SetViewportOrgEx(framedc,viewportx,viewporty,NULL); } return framedc; @@ -1202,7 +1202,7 @@ void FrameRegisterClass () { void FrameReleaseDC () { if (framedc) { SetViewportOrgEx(framedc,0,0,NULL); - ReleaseDC(framewindow,framedc); + ReleaseDC(g_hFrameWindow,framedc); framedc = (HDC)0; } } diff --git a/source/Frame.h b/source/Frame.h index 3b5aca1b..276b126a 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -2,7 +2,7 @@ enum {NOT_ASCII=0, ASCII}; -extern HWND framewindow; +extern HWND g_hFrameWindow; extern BOOL fullscreen; void FrameCreateWindow (); diff --git a/source/Harddisk.cpp b/source/Harddisk.cpp index 218a7167..a1403744 100644 --- a/source/Harddisk.cpp +++ b/source/Harddisk.cpp @@ -320,7 +320,7 @@ void HD_Select(int nDrive) OPENFILENAME ofn; ZeroMemory(&ofn,sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = framewindow; + ofn.hwndOwner = g_hFrameWindow; ofn.hInstance = instance; ofn.lpstrFilter = TEXT("Hard Disk Images (*.hdv)\0*.hdv\0"); ofn.lpstrFile = filename; diff --git a/source/Keyboard.cpp b/source/Keyboard.cpp index 6d33d72c..bfc5716c 100644 --- a/source/Keyboard.cpp +++ b/source/Keyboard.cpp @@ -253,7 +253,7 @@ static void ClipboardInit() if (!IsClipboardFormatAvailable(CF_TEXT)) return; - if (!OpenClipboard(framewindow)) + if (!OpenClipboard(g_hFrameWindow)) return; hglb = GetClipboardData(CF_TEXT); diff --git a/source/PropertySheetPage.cpp b/source/PropertySheetPage.cpp index 9d9b858f..ad158fe3 100644 --- a/source/PropertySheetPage.cpp +++ b/source/PropertySheetPage.cpp @@ -244,7 +244,7 @@ static void ConfigDlg_OK(HWND window, BOOL afterclose) // if (afterclose) - PostMessage(framewindow,afterclose,0,0); + PostMessage(g_hFrameWindow,afterclose,0,0); } static void ConfigDlg_CANCEL(HWND window) @@ -423,7 +423,7 @@ static void InputDlg_OK(HWND window, BOOL afterclose) // if (afterclose) - PostMessage(framewindow,afterclose,0,0); + PostMessage(g_hFrameWindow,afterclose,0,0); } static void InputDlg_CANCEL(HWND window) @@ -558,7 +558,7 @@ static void SoundDlg_OK(HWND window, BOOL afterclose, UINT uNewSoundcardType) // if (afterclose) - PostMessage(framewindow,afterclose,0,0); + PostMessage(g_hFrameWindow,afterclose,0,0); } static void SoundDlg_CANCEL(HWND window) @@ -694,7 +694,7 @@ static void SaveStateDlg_OK(HWND window, BOOL afterclose) // if (afterclose) - PostMessage(framewindow,afterclose,0,0); + PostMessage(g_hFrameWindow,afterclose,0,0); } static void SaveStateDlg_CANCEL(HWND window) @@ -855,7 +855,7 @@ static void DiskDlg_OK(HWND window, BOOL afterclose) // if (afterclose) - PostMessage(framewindow,afterclose,0,0); + PostMessage(g_hFrameWindow,afterclose,0,0); } static void DiskDlg_CANCEL(HWND window) @@ -1228,7 +1228,7 @@ void PSP_Init() PropSheetHeader.dwSize = sizeof(PROPSHEETHEADER); PropSheetHeader.dwFlags = PSH_NOAPPLYNOW | /* PSH_NOCONTEXTHELP | */ PSH_PROPSHEETPAGE; - PropSheetHeader.hwndParent = framewindow; + PropSheetHeader.hwndParent = g_hFrameWindow; PropSheetHeader.pszCaption = "AppleWin Configuration"; PropSheetHeader.nPages = PG_NUM_SHEETS; PropSheetHeader.nStartPage = g_nLastPage; diff --git a/source/SaveState.cpp b/source/SaveState.cpp index dca7c035..7374d7e6 100644 --- a/source/SaveState.cpp +++ b/source/SaveState.cpp @@ -152,7 +152,7 @@ void Snapshot_LoadState() } catch(int) { - MessageBox( framewindow, + MessageBox( g_hFrameWindow, szMessage, TEXT("Load State"), MB_ICONEXCLAMATION | MB_SETFOREGROUND); diff --git a/source/SoundCore.cpp b/source/SoundCore.cpp index 8b64aeba..4d646399 100644 --- a/source/SoundCore.cpp +++ b/source/SoundCore.cpp @@ -495,7 +495,7 @@ bool DSInit() return false; } - hr = g_lpDS->SetCooperativeLevel(framewindow, DSSCL_NORMAL); + hr = g_lpDS->SetCooperativeLevel(g_hFrameWindow, DSSCL_NORMAL); if(FAILED(hr)) { if(g_fh) fprintf(g_fh, "SetCooperativeLevel failed (%08X)\n",hr); diff --git a/source/Speaker.cpp b/source/Speaker.cpp index 13a94afa..8a025f4a 100644 --- a/source/Speaker.cpp +++ b/source/Speaker.cpp @@ -105,7 +105,7 @@ static void DisplayBenchmarkResults () TEXT("This benchmark took %u.%02u seconds."), (unsigned)(totaltime / 1000), (unsigned)((totaltime / 10) % 100)); - MessageBox(framewindow, + MessageBox(g_hFrameWindow, buffer, TEXT("Benchmark Results"), MB_ICONINFORMATION | MB_SETFOREGROUND); diff --git a/source/Video.cpp b/source/Video.cpp index eeadac19..eb698c33 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -1385,7 +1385,7 @@ void VideoBenchmark () { // IF THE PROGRAM COUNTER IS NOT IN THE EXPECTED RANGE AT THE END OF THE // CPU BENCHMARK, REPORT AN ERROR AND OPTIONALLY TRACK IT DOWN if ((regs.pc < 0x300) || (regs.pc > 0x400)) - if (MessageBox(framewindow, + if (MessageBox(g_hFrameWindow, TEXT("The emulator has detected a problem while running ") TEXT("the CPU benchmark. Would you like to gather more ") TEXT("information?"), @@ -1414,13 +1414,13 @@ void VideoBenchmark () { (unsigned)loop, (unsigned)lastpc, (unsigned)regs.pc); - MessageBox(framewindow, + MessageBox(g_hFrameWindow, outstr, TEXT("Benchmarks"), MB_ICONINFORMATION | MB_SETFOREGROUND); } else - MessageBox(framewindow, + MessageBox(g_hFrameWindow, TEXT("The emulator was unable to locate the exact ") TEXT("point of the error. This probably means that ") TEXT("the problem is external to the emulator, ") @@ -1475,7 +1475,7 @@ void VideoBenchmark () { (unsigned)(totalmhz10 % 10), (LPCTSTR)(apple2e ? TEXT("") : TEXT(" (6502)")), (unsigned)realisticfps); - MessageBox(framewindow, + MessageBox(g_hFrameWindow, outstr, TEXT("Benchmarks"), MB_ICONINFORMATION | MB_SETFOREGROUND); @@ -1564,7 +1564,7 @@ void VideoChooseColor () { CHOOSECOLOR cc; ZeroMemory(&cc,sizeof(CHOOSECOLOR)); cc.lStructSize = sizeof(CHOOSECOLOR); - cc.hwndOwner = framewindow; + cc.hwndOwner = g_hFrameWindow; cc.rgbResult = monochrome; cc.lpCustColors = customcolors; cc.Flags = CC_RGBINIT | CC_SOLIDCOLOR;