FrameBase: some changes to ease implementations (PR #910)

. simplify the interface FrameBase to make it easier to implement it for different cases (remove HDC and make parameters more explicit)
. remove functions which are only called on a Win32Frame (in which case a cast is guaranteed to succeed)
. otherwise there is the risk that every FrameBase implementation wants to add its own variants.
. FrameBase::FrameRefreshStatus() simplify implementation: pass all flags explicitly
This commit is contained in:
Andrea
2021-01-10 16:33:06 +00:00
committed by GitHub
parent 159cde7d64
commit 6cffb30330
16 changed files with 292 additions and 239 deletions
+14 -11
View File
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "PropertySheet.h"
#include "../Windows/AppleWin.h"
#include "../Windows/WinFrame.h"
#include "../Windows/Win32Frame.h"
#include "../Registry.h"
#include "../SerialComms.h"
#include "../resource/resource.h"
@@ -115,7 +115,7 @@ INT_PTR CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPA
break;
case IDC_MONOCOLOR:
GetFrame().ChooseMonochromeColor();
Win32Frame::GetWin32Frame().ChooseMonochromeColor();
break;
case IDC_CHECK_CONFIRM_REBOOT:
@@ -201,7 +201,8 @@ INT_PTR CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPA
m_PropertySheetHelper.FillComboBox(hWnd,IDC_VIDEOTYPE, GetVideo().GetVideoChoices(), GetVideo().GetVideoType());
CheckDlgButton(hWnd, IDC_CHECK_HALF_SCAN_LINES, GetVideo().IsVideoStyle(VS_HALF_SCANLINES) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_FS_SHOW_SUBUNIT_STATUS, GetFullScreenShowSubunitStatus() ? BST_CHECKED : BST_UNCHECKED);
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
CheckDlgButton(hWnd, IDC_CHECK_FS_SHOW_SUBUNIT_STATUS, win32Frame.GetFullScreenShowSubunitStatus() ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_CHECK_VERTICAL_BLEND, GetVideo().IsVideoStyle(VS_COLOR_VERTICAL_BLEND) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_CHECK_VERTICAL_BLEND), (GetVideo().GetVideoType() == VT_COLOR_IDEALIZED) ? TRUE : FALSE);
@@ -271,6 +272,7 @@ INT_PTR CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPA
void CPageConfig::DlgOK(HWND hWnd)
{
bool bVideoReinit = false;
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
const VideoType_e newVideoType = (VideoType_e) SendDlgItemMessage(hWnd, IDC_VIDEOTYPE, CB_GETCURSEL, 0, 0);
if (GetVideo().GetVideoType() != newVideoType)
@@ -312,34 +314,35 @@ void CPageConfig::DlgOK(HWND hWnd)
{
GetVideo().Config_Save_Video();
GetFrame().FrameRefreshStatus(DRAW_TITLE, false);
win32Frame.FrameRefreshStatus(DRAW_TITLE);
GetVideo().VideoReinitialize();
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
{
GetFrame().VideoRedrawScreen();
win32Frame.VideoRedrawScreen();
}
}
//
const bool bNewFSSubunitStatus = IsDlgButtonChecked(hWnd, IDC_CHECK_FS_SHOW_SUBUNIT_STATUS) ? true : false;
if (GetFullScreenShowSubunitStatus() != bNewFSSubunitStatus)
if (win32Frame.GetFullScreenShowSubunitStatus() != bNewFSSubunitStatus)
{
REGSAVE(TEXT(REGVALUE_FS_SHOW_SUBUNIT_STATUS), bNewFSSubunitStatus ? 1 : 0);
GetFrame().SetFullScreenShowSubunitStatus(bNewFSSubunitStatus);
win32Frame.SetFullScreenShowSubunitStatus(bNewFSSubunitStatus);
if (IsFullScreen())
GetFrame().FrameRefreshStatus(DRAW_BACKGROUND | DRAW_LEDS | DRAW_DISK_STATUS);
if (win32Frame.IsFullScreen())
win32Frame.FrameRefreshStatus(DRAW_BACKGROUND | DRAW_LEDS | DRAW_DISK_STATUS);
}
//
const BOOL bNewConfirmReboot = IsDlgButtonChecked(hWnd, IDC_CHECK_CONFIRM_REBOOT) ? 1 : 0;
if (GetFrame().g_bConfirmReboot != bNewConfirmReboot)
if (win32Frame.g_bConfirmReboot != bNewConfirmReboot)
{
REGSAVE(TEXT(REGVALUE_CONFIRM_REBOOT), bNewConfirmReboot);
GetFrame().g_bConfirmReboot = bNewConfirmReboot;
win32Frame.g_bConfirmReboot = bNewConfirmReboot;
}
//
+2 -2
View File
@@ -91,14 +91,14 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
if (HIWORD(wparam) == CBN_SELCHANGE)
{
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam));
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES);
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
}
break;
case IDC_COMBO_DISK2:
if (HIWORD(wparam) == CBN_SELCHANGE)
{
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam));
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES);
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
}
break;
case IDC_COMBO_HDD1:
@@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../Windows/AppleWin.h" // g_nAppMode, g_uScrollLockToggle, sg_PropertySheet
#include "../CardManager.h"
#include "../Disk.h"
#include "../Windows/WinFrame.h"
#include "../Log.h"
#include "../Registry.h"
#include "../SaveState.h"