GE Debugger: Allow enable/disable of prim preview.

This commit is contained in:
Unknown W. Brackets 2017-12-23 02:16:43 -08:00
parent c55db7a496
commit 3c5816e2aa
7 changed files with 23 additions and 1 deletions

View File

@ -157,10 +157,18 @@ void CGEDebugger::SetupPreviews() {
PrimaryPreviewHover(x, y);
});
primaryWindow->SetRightClickMenu(subMenu, [&] (int cmd) {
HMENU subMenu = GetSubMenu(g_hPopupMenus, POPUP_SUBMENU_ID_GEDBG_PREVIEW);
switch (cmd) {
case 0:
// Setup.
CheckMenuItem(subMenu, ID_GEDBG_ENABLE_PREVIEW, MF_BYCOMMAND | ((previewsEnabled_ & 1) ? MF_CHECKED : MF_UNCHECKED));
break;
case ID_GEDBG_EXPORT_IMAGE:
PreviewExport(primaryBuffer_);
break;
case ID_GEDBG_ENABLE_PREVIEW:
previewsEnabled_ ^= 1;
primaryWindow->Redraw();
default:
break;
}
@ -181,10 +189,18 @@ void CGEDebugger::SetupPreviews() {
SecondPreviewHover(x, y);
});
secondWindow->SetRightClickMenu(subMenu, [&] (int cmd) {
HMENU subMenu = GetSubMenu(g_hPopupMenus, POPUP_SUBMENU_ID_GEDBG_PREVIEW);
switch (cmd) {
case 0:
// Setup.
CheckMenuItem(subMenu, ID_GEDBG_ENABLE_PREVIEW, MF_BYCOMMAND | ((previewsEnabled_ & 2) ? MF_CHECKED : MF_UNCHECKED));
break;
case ID_GEDBG_EXPORT_IMAGE:
PreviewExport(secondBuffer_);
break;
case ID_GEDBG_ENABLE_PREVIEW:
previewsEnabled_ ^= 2;
secondWindow->Redraw();
default:
break;
}

View File

@ -109,6 +109,7 @@ private:
const GPUDebugBuffer *secondBuffer_ = nullptr;
bool updating_ = false;
int previewsEnabled_ = 3;
int minWidth_;
int minHeight_;
};

View File

@ -563,6 +563,7 @@ bool SimpleGLWindow::RightClick(int mouseX, int mouseY) {
POINT pt{mouseX, mouseY};
ClientToScreen(hWnd_, &pt);
rightClickCallback_(0);
int result = TrackPopupMenuEx(rightClickMenu_, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, hWnd_, 0);
if (result != 0) {
rightClickCallback_(result);

View File

@ -115,6 +115,7 @@ struct SimpleGLWindow {
hoverCallback_ = hoverCallback;
}
// Called first with 0 that it's opening, then the selected item.
void SetRightClickMenu(HMENU menu, std::function<void(int)> callback) {
rightClickCallback_ = callback;
rightClickMenu_ = menu;

View File

@ -176,6 +176,7 @@ void CGEDebugger::UpdatePrimPreview(u32 op, int which) {
ERROR_LOG(G3D, "Invalid debugging environment, shutting down?");
return;
}
which &= previewsEnabled_;
if (count == 0 || which == 0) {
return;
}

View File

@ -657,6 +657,7 @@ BEGIN
POPUP "gepreviewoptions"
BEGIN
MENUITEM "Export Image...", ID_GEDBG_EXPORT_IMAGE
MENUITEM "Show Prim Preview" ID_GEDBG_ENABLE_PREVIEW
END
END

View File

@ -335,6 +335,7 @@
#define ID_HELP_GITHUB 40168
#define IDC_GEDBG_RECORD 40169
#define ID_GEDBG_EXPORT_IMAGE 40170
#define ID_GEDBG_ENABLE_PREVIEW 40171
// Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
@ -347,7 +348,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 256
#define _APS_NEXT_COMMAND_VALUE 40171
#define _APS_NEXT_COMMAND_VALUE 40172
#define _APS_NEXT_CONTROL_VALUE 1200
#define _APS_NEXT_SYMED_VALUE 101
#endif