Add some rotate buttons to the toolbar, fix the black/random line under the toolbar and remove useless code.
This commit is contained in:
parent
7e800960ff
commit
9a4457e4ff
|
@ -326,33 +326,6 @@ void RefreshAllToolWindows()
|
|||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The Toolkit - Tooltip API wrapper
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
CToolTip::CToolTip(HWND hParent)
|
||||
{
|
||||
hWnd = CreateWindow(TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
hParent, NULL, hAppInst, NULL);
|
||||
}
|
||||
|
||||
void CToolTip::AddToolTip(HWND hCtl, int uID, CRect rcRect, char* text)
|
||||
{
|
||||
TOOLINFO ti;
|
||||
|
||||
memset(&ti, 0, sizeof(TOOLINFO));
|
||||
ti.cbSize = sizeof(TOOLINFO);
|
||||
ti.uFlags = TTF_SUBCLASS;
|
||||
ti.hwnd = hCtl;
|
||||
ti.uId = uID;
|
||||
ti.rect = rcRect.ToMSRect();
|
||||
printf("%i %i %i %i\n", rcRect.ToMSRect().top, ti.rect.left, ti.rect.bottom, ti.rect.right);
|
||||
ti.lpszText = text;
|
||||
|
||||
SendMessage(hWnd, TTM_ADDTOOL, 0, (LPARAM)&ti);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The Toolkit - Toolbar API wrapper
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -362,9 +335,9 @@ CToolBar::CToolBar(HWND hParent)
|
|||
{
|
||||
// Create the toolbar
|
||||
// Note: dropdown buttons look like crap without TBSTYLE_FLAT
|
||||
hWnd = CreateWindowEx(0, TOOLBARCLASSNAME,
|
||||
NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | TBSTYLE_FLAT, 0, 0, 0, 0,
|
||||
hParent, NULL, hAppInst, NULL);
|
||||
hWnd = CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS,
|
||||
0, 0, 0, 0, hParent, NULL, hAppInst, NULL);
|
||||
|
||||
// Send it a few messages to finish setting it up
|
||||
SendMessage(hWnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||
|
@ -403,6 +376,12 @@ void CToolBar::Show(bool bShow)
|
|||
|
||||
void CToolBar::OnSize()
|
||||
{
|
||||
// Not-fully-working wraparound handling code
|
||||
// the toolbar behaves weirdly when it comes to separators
|
||||
// TODO: figure out why.
|
||||
// Note: right now this code is useless, but it may be useful
|
||||
// if we use more toolbars
|
||||
#if 0
|
||||
RECT rc;
|
||||
int parentwidth;
|
||||
|
||||
|
@ -419,31 +398,32 @@ void CToolBar::OnSize()
|
|||
SendMessage(hWnd, TB_GETITEMRECT, i, (LPARAM)&rc);
|
||||
curwidth += (rc.right - rc.left);
|
||||
|
||||
if (i > 0)
|
||||
if (i > 1)
|
||||
{
|
||||
TBBUTTON btn;
|
||||
TBBUTTONINFO btninfo;
|
||||
int cmdid;
|
||||
|
||||
// Retrieve the command ID of the button just behind the current one
|
||||
// if it's a separator, then try the button behind it
|
||||
SendMessage(hWnd, TB_GETBUTTON, i-1, (LPARAM)&btn);
|
||||
if (btn.idCommand == -1)
|
||||
SendMessage(hWnd, TB_GETBUTTON, i-2, (LPARAM)&btn);
|
||||
|
||||
cmdid = btn.idCommand;
|
||||
|
||||
// Add/remove the TBSTATE_WRAP style if needed
|
||||
btninfo.cbSize = sizeof(TBBUTTONINFO);
|
||||
btninfo.dwMask = TBIF_STATE;
|
||||
SendMessage(hWnd, TB_GETBUTTONINFO, btn.idCommand, (LPARAM)&btninfo);
|
||||
SendMessage(hWnd, TB_GETBUTTONINFO, cmdid, (LPARAM)&btninfo);
|
||||
|
||||
btninfo.dwMask = TBIF_STATE;
|
||||
if (curwidth > parentwidth) btninfo.fsState |= TBSTATE_WRAP;
|
||||
else btninfo.fsState &= ~TBSTATE_WRAP;
|
||||
SendMessage(hWnd, TB_SETBUTTONINFO, btn.idCommand, (LPARAM)&btninfo);
|
||||
SendMessage(hWnd, TB_SETBUTTONINFO, cmdid, (LPARAM)&btninfo);
|
||||
|
||||
if (curwidth > parentwidth) curwidth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
SetWindowPos(hWnd, NULL,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
SWP_NOZORDER | SWP_NOMOVE);
|
||||
|
@ -551,7 +531,7 @@ int CToolBar::GetHeight()
|
|||
if (hidden) return 0;
|
||||
|
||||
RECT rc; GetWindowRect(hWnd, &rc);
|
||||
return rc.bottom - rc.top;
|
||||
return rc.bottom - rc.top - 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -173,24 +173,6 @@ void CloseAllToolWindows();
|
|||
// Called once per frame when the emu is running.
|
||||
void RefreshAllToolWindows();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The Toolkit - Tooltip API wrapper
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class CToolTip
|
||||
{
|
||||
public:
|
||||
CToolTip(HWND hParent);
|
||||
~CToolTip() {}
|
||||
|
||||
HWND GetHWnd() { return hWnd; }
|
||||
|
||||
void AddToolTip(HWND hCtl, int uID, CRect rcRect, char* text);
|
||||
|
||||
private:
|
||||
HWND hWnd;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The Toolkit - Toolbar API wrapper
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -217,10 +199,9 @@ public:
|
|||
SendMessage(hWnd, TB_CHECKBUTTON, uID, bCheck ? TRUE:FALSE); }
|
||||
|
||||
void ChangeButtonBitmap(int uID, int uBitmapID);
|
||||
|
||||
void EnableButtonDropdown(int uID, bool bDropdown);
|
||||
|
||||
void SetToolTip(CToolTip tt);
|
||||
void ChangeButtonID(int uIndex, int uNewID) {
|
||||
SendMessage(hWnd, TB_SETCMDID, uIndex, MAKELPARAM(uNewID, 0)); }
|
||||
|
||||
int GetHeight();
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 822 B After Width: | Height: | Size: 822 B |
Binary file not shown.
After Width: | Height: | Size: 822 B |
Binary file not shown.
After Width: | Height: | Size: 822 B |
|
@ -1134,22 +1134,24 @@ void doLCDsLayout()
|
|||
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORGRAY, true);
|
||||
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORBLACK, true);
|
||||
|
||||
MainWindowToolbar->EnableButton(IDC_ROTATE90, true);
|
||||
MainWindowToolbar->EnableButton(IDC_ROTATE270, true);
|
||||
|
||||
if (video.layout_old == 1)
|
||||
{
|
||||
newwidth = oldwidth / 2;
|
||||
newheight = oldheight * 2;
|
||||
}
|
||||
else if (video.layout_old == 2)
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight * 2;
|
||||
}
|
||||
else
|
||||
if (video.layout_old == 2)
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight;
|
||||
}
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight;
|
||||
}
|
||||
MainWindow->checkMenu(ID_LCDS_VERTICAL, true);
|
||||
MainWindow->checkMenu(ID_LCDS_HORIZONTAL, false);
|
||||
MainWindow->checkMenu(ID_LCDS_ONE, false);
|
||||
|
@ -1170,6 +1172,11 @@ void doLCDsLayout()
|
|||
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORGRAY, false);
|
||||
DesEnableMenuItem(mainMenu, IDM_SCREENSEP_COLORBLACK, false);
|
||||
|
||||
// As rotation was reset to 0, the button IDs were reset to
|
||||
// IDC_ROTATE90 and IDC_ROTATE270.
|
||||
MainWindowToolbar->EnableButton(IDC_ROTATE90, false);
|
||||
MainWindowToolbar->EnableButton(IDC_ROTATE270, false);
|
||||
|
||||
if (video.layout == 1)
|
||||
{
|
||||
if (video.layout_old == 0)
|
||||
|
@ -1177,46 +1184,43 @@ void doLCDsLayout()
|
|||
newwidth = oldwidth * 2;
|
||||
newheight = oldheight / 2;
|
||||
}
|
||||
else if (video.layout_old == 2)
|
||||
{
|
||||
newwidth = oldwidth * 2;
|
||||
newheight = oldheight;
|
||||
}
|
||||
else
|
||||
if (video.layout_old == 2)
|
||||
{
|
||||
newwidth = oldwidth * 2;
|
||||
newheight = oldheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight;
|
||||
}
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight;
|
||||
}
|
||||
MainWindow->checkMenu(ID_LCDS_HORIZONTAL, false);
|
||||
MainWindow->checkMenu(ID_LCDS_VERTICAL, true);
|
||||
MainWindow->checkMenu(ID_LCDS_ONE, false);
|
||||
}
|
||||
else
|
||||
if (video.layout == 2)
|
||||
else if (video.layout == 2)
|
||||
{
|
||||
if (video.layout_old == 0)
|
||||
{
|
||||
if (video.layout_old == 0)
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight / 2;
|
||||
}
|
||||
else
|
||||
if (video.layout_old == 1)
|
||||
{
|
||||
newwidth = oldwidth / 2;
|
||||
newheight = oldheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight;
|
||||
}
|
||||
MainWindow->checkMenu(ID_LCDS_HORIZONTAL, false);
|
||||
MainWindow->checkMenu(ID_LCDS_VERTICAL, false);
|
||||
MainWindow->checkMenu(ID_LCDS_ONE, true);
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight / 2;
|
||||
}
|
||||
else if (video.layout_old == 1)
|
||||
{
|
||||
newwidth = oldwidth / 2;
|
||||
newheight = oldheight;
|
||||
}
|
||||
else
|
||||
return;
|
||||
{
|
||||
newwidth = oldwidth;
|
||||
newheight = oldheight;
|
||||
}
|
||||
MainWindow->checkMenu(ID_LCDS_HORIZONTAL, false);
|
||||
MainWindow->checkMenu(ID_LCDS_VERTICAL, false);
|
||||
MainWindow->checkMenu(ID_LCDS_ONE, true);
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
video.layout_old = video.layout;
|
||||
|
@ -2986,6 +2990,18 @@ void SetRotate(HWND hwnd, int rot, bool user)
|
|||
|
||||
MainWindow->setClientSize(newwidth, newheight);
|
||||
|
||||
int cwid, ccwid;
|
||||
switch (rot)
|
||||
{
|
||||
case 0: cwid = IDC_ROTATE90; ccwid = IDC_ROTATE270; break;
|
||||
case 90: cwid = IDC_ROTATE180; ccwid = IDC_ROTATE0; break;
|
||||
case 180: cwid = IDC_ROTATE270; ccwid = IDC_ROTATE90; break;
|
||||
case 270: cwid = IDC_ROTATE0; ccwid = IDC_ROTATE180; break;
|
||||
}
|
||||
|
||||
MainWindowToolbar->ChangeButtonID(6, cwid);
|
||||
MainWindowToolbar->ChangeButtonID(7, ccwid);
|
||||
|
||||
/* Recreate the DirectDraw back buffer */
|
||||
if (lpBackSurface!=NULL)
|
||||
{
|
||||
|
@ -3786,6 +3802,20 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
MainWindowToolbar->AppendButton(IDM_PAUSE, IDB_PLAY, 0, false);
|
||||
MainWindowToolbar->AppendButton(IDM_CLOSEROM, IDB_STOP, 0, false);
|
||||
MainWindowToolbar->AppendButton(IDM_RESET, IDB_RESET, 0, false);
|
||||
MainWindowToolbar->AppendSeparator();
|
||||
|
||||
int cwid, ccwid;
|
||||
DWORD rotstate = (video.layout == 0) ? TBSTATE_ENABLED : 0;
|
||||
switch (video.rotation)
|
||||
{
|
||||
case 0: cwid = IDC_ROTATE90; ccwid = IDC_ROTATE270; break;
|
||||
case 90: cwid = IDC_ROTATE180; ccwid = IDC_ROTATE0; break;
|
||||
case 180: cwid = IDC_ROTATE270; ccwid = IDC_ROTATE90; break;
|
||||
case 270: cwid = IDC_ROTATE0; ccwid = IDC_ROTATE180; break;
|
||||
}
|
||||
|
||||
MainWindowToolbar->AppendButton(cwid, IDB_ROTATECW, rotstate, false);
|
||||
MainWindowToolbar->AppendButton(ccwid, IDB_ROTATECCW, rotstate, false);
|
||||
|
||||
bool showtb = GetPrivateProfileBool("Display", "Show Toolbar", true, IniName);
|
||||
MainWindowToolbar->Show(showtb);
|
||||
|
@ -5283,6 +5313,40 @@ DOKEYDOWN:
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
case TTN_NEEDTEXT:
|
||||
{
|
||||
TOOLTIPTEXT* ttt = (TOOLTIPTEXT*)lParam;
|
||||
ttt->hinst = hAppInst;
|
||||
|
||||
switch (ttt->hdr.idFrom)
|
||||
{
|
||||
case IDM_OPEN:
|
||||
if (RecentRoms.empty()) ttt->lpszText = "Open a ROM";
|
||||
else ttt->lpszText = "Open a ROM\nClick the arrow to open a recent ROM"; break;
|
||||
|
||||
case IDM_PAUSE:
|
||||
if (paused) ttt->lpszText = "Resume emulation";
|
||||
else ttt->lpszText = "Pause emulation"; break;
|
||||
|
||||
case IDM_CLOSEROM: ttt->lpszText = "Stop emulation"; break;
|
||||
case IDM_RESET: ttt->lpszText = "Reset emulation"; break;
|
||||
|
||||
case IDC_ROTATE0:
|
||||
if (video.rotation == 90) ttt->lpszText = "Rotate CCW";
|
||||
else if (video.rotation == 270) ttt->lpszText = "Rotate CW"; break;
|
||||
case IDC_ROTATE90:
|
||||
if (video.rotation == 180) ttt->lpszText = "Rotate CCW";
|
||||
else if (video.rotation == 0) ttt->lpszText = "Rotate CW"; break;
|
||||
case IDC_ROTATE180:
|
||||
if (video.rotation == 270) ttt->lpszText = "Rotate CCW";
|
||||
else if (video.rotation == 90) ttt->lpszText = "Rotate CW"; break;
|
||||
case IDC_ROTATE270:
|
||||
if (video.rotation == 0) ttt->lpszText = "Rotate CCW";
|
||||
else if (video.rotation == 180) ttt->lpszText = "Rotate CW"; break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -34,7 +34,10 @@
|
|||
#define IDM_PAL 117
|
||||
#define IDM_TILE 118
|
||||
#define IDM_MAP 119
|
||||
#define IDB_ROTATECCW 119
|
||||
#define IDM_MBG0 120
|
||||
#define IDB_BITMAP2 120
|
||||
#define IDB_ROTATECW 120
|
||||
#define IDM_MBG1 121
|
||||
#define IDM_MBG2 122
|
||||
#define IDM_MBG3 123
|
||||
|
@ -756,6 +759,7 @@
|
|||
#define IDC_LUASCRIPT_RESERVE_END 58099
|
||||
#define IDD_LUARECENT_RESERVE_START 58100
|
||||
#define IDD_LUARECENT_RESERVE_END 58199
|
||||
#define IDC_FRAMEADVANCE 58200
|
||||
#define IDC_LABEL_HK1 60001
|
||||
#define IDC_LABEL_HK2 60002
|
||||
#define IDC_LABEL_HK3 60003
|
||||
|
@ -807,7 +811,7 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 118
|
||||
#define _APS_NEXT_RESOURCE_VALUE 121
|
||||
#define _APS_NEXT_COMMAND_VALUE 40073
|
||||
#define _APS_NEXT_CONTROL_VALUE 1022
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue