In 2x windowed mode: always show slot-5 disk ii LEDs; but s5/s6 trk/sec is now on a UI toggle

This commit is contained in:
tomcw 2022-11-03 21:42:30 +00:00
parent 82e9b728d3
commit 3f1b1ded69
3 changed files with 69 additions and 30 deletions

View File

@ -34,7 +34,6 @@ Win32Frame::Win32Frame()
g_bFrameActive = false;
g_windowMinimized = false;
g_bFullScreen_ShowSubunitStatus = true;
m_showDiskiiSlot5Status = false;
g_win_fullscreen_offsetx = 0;
g_win_fullscreen_offsety = 0;
m_bestWidthForFullScreen = 0;
@ -72,6 +71,9 @@ Win32Frame::Win32Frame()
// Set g_nViewportScale, g_nViewportCX, g_nViewportCY & buttonx, buttony
SetViewportScale(kDEFAULT_VIEWPORT_SCALE, true);
// Set m_showDiskiiSlot5Status, m_redrawDiskiiSlot5Status
SetWindowedModeShowDiskiiSlot5Status(false);
}
void Win32Frame::VideoCreateDIBSection(bool resetVideoState)

View File

@ -124,6 +124,7 @@ private:
void FrameShowCursor(BOOL bShow);
void FullScreenRevealCursor(void);
void GetWidthHeight(int& nWidth, int& nHeight);
void SetSlotUIOffsets(void);
bool g_bAltEnter_ToggleFullScreen; // Default for ALT+ENTER is to toggle between windowed and full-screen modes
bool g_bIsFullScreen;
@ -142,6 +143,7 @@ private:
bool g_windowMinimized;
bool g_bFullScreen_ShowSubunitStatus;
bool m_showDiskiiSlot5Status;
bool m_redrawDiskiiSlot5Status;
int g_win_fullscreen_offsetx;
int g_win_fullscreen_offsety;
UINT m_bestWidthForFullScreen;
@ -169,7 +171,7 @@ private:
RECT framerect;
BOOL helpquit;
const UINT smallfontHeight = 11;
static const UINT smallfontHeight = 11;
HFONT smallfont;
HWND tooltipwindow;
@ -195,17 +197,36 @@ private:
HBITMAP g_hDiskWindowedLED[NUM_DISK_STATUS];
// Y-offsets from end of last button
const UINT yOffsetSlot6LEDNumbers = 5;
const UINT yOffsetSlot6LEDs = yOffsetSlot6LEDNumbers + 1;
const UINT yOffsetCapsLock = yOffsetSlot6LEDs + smallfontHeight;
const UINT yOffsetHardDiskLED = yOffsetSlot6LEDs + smallfontHeight + 1;
const UINT yOffsetSlot6TrackInfo = 35;
const UINT yOffsetSlot6SectorInfo = yOffsetSlot6TrackInfo + smallfontHeight;
const UINT yOffsetSlot5Label = yOffsetSlot6SectorInfo + smallfontHeight + 3;
const UINT yOffsetSlot5LEDNumbers = yOffsetSlot5Label + smallfontHeight + 1;
const UINT yOffsetSlot5LEDs = yOffsetSlot5LEDNumbers + 1;
const UINT yOffsetSlot5TrackInfo = yOffsetSlot5LEDs + smallfontHeight;
const UINT yOffsetSlot5SectorInfo = yOffsetSlot5TrackInfo + smallfontHeight;
static const UINT yOffsetSlot6LEDNumbers = 5;
static const UINT yOffsetSlot6LEDs = yOffsetSlot6LEDNumbers + 1;
static const UINT yOffsetCapsLock = yOffsetSlot6LEDs + smallfontHeight;
static const UINT yOffsetHardDiskLED = yOffsetSlot6LEDs + smallfontHeight + 1;
// 2x (or more) Windowed mode: Disk II LEDs and track/sector info
struct D2FullUI // Disk II full UI
{
static const UINT yOffsetSlot6TrackInfo = 35;
static const UINT yOffsetSlot6SectorInfo = yOffsetSlot6TrackInfo + smallfontHeight;
static const UINT yOffsetSlot5Label = yOffsetSlot6SectorInfo + smallfontHeight + 3;
static const UINT yOffsetSlot5LEDNumbers = yOffsetSlot5Label + smallfontHeight + 1;
static const UINT yOffsetSlot5LEDs = yOffsetSlot5LEDNumbers + 1;
static const UINT yOffsetSlot5TrackInfo = yOffsetSlot5LEDs + smallfontHeight;
static const UINT yOffsetSlot5SectorInfo = yOffsetSlot5TrackInfo + smallfontHeight;
};
// 2x (or more) Windowed mode: Disk II LEDs only (no track/sector info)
struct D2CompactUI // Disk II compact UI
{
static const UINT yOffsetSlot5Label = 35;
static const UINT yOffsetSlot5LEDNumbers = yOffsetSlot5Label + smallfontHeight + 1;
static const UINT yOffsetSlot5LEDs = yOffsetSlot5LEDNumbers + 1;
};
const UINT yOffsetSlot6TrackInfo = D2FullUI::yOffsetSlot6TrackInfo;
const UINT yOffsetSlot6SectorInfo = D2FullUI::yOffsetSlot6SectorInfo;
UINT yOffsetSlot5Label;
UINT yOffsetSlot5LEDNumbers;
UINT yOffsetSlot5LEDs;
const UINT yOffsetSlot5TrackInfo = D2FullUI::yOffsetSlot5TrackInfo;
const UINT yOffsetSlot5SectorInfo = D2FullUI::yOffsetSlot5SectorInfo;
int g_nSector[NUM_SLOTS][2];
Disk_Status_e g_eStatusDrive1;
Disk_Status_e g_eStatusDrive2;

View File

@ -527,6 +527,24 @@ bool Win32Frame::GetWindowedModeShowDiskiiSlot5Status(void)
void Win32Frame::SetWindowedModeShowDiskiiSlot5Status(bool bShow)
{
m_showDiskiiSlot5Status = bShow;
m_redrawDiskiiSlot5Status = true;
SetSlotUIOffsets();
}
void Win32Frame::SetSlotUIOffsets(void)
{
if (m_showDiskiiSlot5Status)
{
yOffsetSlot5Label = D2FullUI::yOffsetSlot5Label;
yOffsetSlot5LEDNumbers = D2FullUI::yOffsetSlot5LEDNumbers;
yOffsetSlot5LEDs = D2FullUI::yOffsetSlot5LEDs;
}
else
{
yOffsetSlot5Label = D2CompactUI::yOffsetSlot5Label;
yOffsetSlot5LEDNumbers = D2CompactUI::yOffsetSlot5LEDNumbers;
yOffsetSlot5LEDs = D2CompactUI::yOffsetSlot5LEDs;
}
}
void Win32Frame::FrameDrawDiskLEDS()
@ -571,12 +589,11 @@ void Win32Frame::FrameDrawDiskLEDS( HDC passdc )
DrawBitmapRect(dc, x + 12, y + yOffsetSlot6LEDs, &rDiskLed, g_hDiskWindowedLED[g_eStatusDrive1]);
DrawBitmapRect(dc, x + 31, y + yOffsetSlot6LEDs, &rDiskLed, g_hDiskWindowedLED[g_eStatusDrive2]);
if (g_nViewportScale > 1 && GetCardMgr().QuerySlot(SLOT5) == CT_Disk2 && GetWindowedModeShowDiskiiSlot5Status())
if (g_nViewportScale > 1 && GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
{
Disk_Status_e eDrive1StatusSlot5 = DISK_STATUS_OFF;
Disk_Status_e eDrive2StatusSlot5 = DISK_STATUS_OFF;
if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).GetLightStatus(&eDrive1StatusSlot5, &eDrive2StatusSlot5);
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).GetLightStatus(&eDrive1StatusSlot5, &eDrive2StatusSlot5);
DrawBitmapRect(dc, x + 12, y + yOffsetSlot5LEDs, &rDiskLed, g_hDiskWindowedLED[eDrive1StatusSlot5]);
DrawBitmapRect(dc, x + 31, y + yOffsetSlot5LEDs, &rDiskLed, g_hDiskWindowedLED[eDrive2StatusSlot5]);
@ -761,13 +778,13 @@ void Win32Frame::FrameDrawDiskStatus( HDC passdc )
else
{
// NB. Only draw Track/Sector if 2x windowed
if (g_nViewportScale == 1)
if (g_nViewportScale == 1 || !GetWindowedModeShowDiskiiSlot5Status())
return;
DrawTrackSector(dc, SLOT6, nDrive1Track, g_nSector[SLOT6][0], nDrive2Track, g_nSector[SLOT6][1]);
// Slot 5's Disk II
if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2 && GetWindowedModeShowDiskiiSlot5Status())
if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
{
GetTrackSector(SLOT5, nDrive1Track, nDrive2Track, nActiveFloppy);
DrawTrackSector(dc, SLOT5, nDrive1Track, g_nSector[SLOT5][0], nDrive2Track, g_nSector[SLOT5][1]);
@ -776,7 +793,7 @@ void Win32Frame::FrameDrawDiskStatus( HDC passdc )
}
//===========================================================================
void Win32Frame::DrawStatusArea (HDC passdc, int drawflags)
void Win32Frame::DrawStatusArea(HDC passdc, int drawflags)
{
if (g_hFrameWindow == NULL)
{
@ -875,21 +892,20 @@ void Win32Frame::DrawStatusArea (HDC passdc, int drawflags)
if (g_nViewportScale > 1 && GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
{
if (!GetWindowedModeShowDiskiiSlot5Status())
if (m_redrawDiskiiSlot5Status)
{
// Erase background ("Slot 5" + LEDs + TrackInfo + SectorInfo)
m_redrawDiskiiSlot5Status = false;
// Erase background (Slot6's TrackInfo + SectorInfo + "Slot 5" + LEDs + TrackInfo + SectorInfo)
SelectObject(dc, GetStockObject(NULL_PEN));
SelectObject(dc, btnfacebrush);
Rectangle(dc, x + 1, y + yOffsetSlot5Label, x + BUTTONCX + 1, y + yOffsetSlot5SectorInfo + smallfontHeight);
Rectangle(dc, x + 1, y + yOffsetSlot6TrackInfo, x + BUTTONCX + 1, y + yOffsetSlot5SectorInfo + smallfontHeight);
}
else
{
std::string slot5 = "Slot 5:";
TextOut(dc, x + 14, y + yOffsetSlot5Label, slot5.c_str(), slot5.length());
TextOut(dc, x + 7, y + yOffsetSlot5LEDNumbers, "1", 1);
TextOut(dc, x + 27, y + yOffsetSlot5LEDNumbers, "2", 1);
}
std::string slot5 = "Slot 5:";
TextOut(dc, x + 15, y + yOffsetSlot5Label, slot5.c_str(), slot5.length());
TextOut(dc, x + 7, y + yOffsetSlot5LEDNumbers, "1", 1);
TextOut(dc, x + 27, y + yOffsetSlot5LEDNumbers, "2", 1);
}
}
@ -1638,7 +1654,7 @@ LRESULT Win32Frame::WndProc(
}
else if (pInfo->hdr.idFrom == TTID_SLOT6_TRK_SEC_INFO || pInfo->hdr.idFrom == TTID_SLOT5_TRK_SEC_INFO)
{
if (pInfo->hdr.idFrom == TTID_SLOT5_TRK_SEC_INFO && !GetWindowedModeShowDiskiiSlot5Status())
if (!GetWindowedModeShowDiskiiSlot5Status())
break;
SendMessage(pInfo->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, 0, 150);