From 7ca05cde8a9e2d81f3df8d5dce9d6550883382cd Mon Sep 17 00:00:00 2001 From: shygoo Date: Fri, 18 Dec 2020 14:15:16 -0600 Subject: [PATCH] [Debugger] Add tooltips to scripts window --- .../UserInterface/Debugger/Debugger-Scripts.cpp | 7 +++++++ .../UserInterface/Debugger/Debugger-Scripts.h | 14 ++++++++++++-- Source/Project64/UserInterface/UIResources.rc | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp index ad5410eb4..5840ca5ca 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.cpp @@ -15,6 +15,7 @@ CDebugScripts::CDebugScripts(CDebuggerUI* debugger) : CDebugDialog(debugger), + CToolTipDialog(), m_SelectedScriptName(NULL), m_hQuitScriptDirWatchEvent(NULL), m_hScriptDirWatchThread(NULL) @@ -33,6 +34,7 @@ LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l { DlgResize_Init(false, true); DlgSavePos_Init(DebuggerUI_ScriptsPos); + DlgToolTip_Init(); HFONT monoFont = CreateFont(-11, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, @@ -446,6 +448,11 @@ void CDebugScripts::EvaluateInSelectedInstance(const char* code) void CDebugScripts::RunSelected() { + if (m_SelectedScriptName == NULL) + { + return; + } + INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); if (state == STATE_INVALID || state == STATE_STOPPED) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h index cd29c43af..29b9d262a 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-Scripts.h @@ -12,6 +12,7 @@ #pragma once #include "DebuggerUI.h" #include "ScriptSystem.h" +#include class CScriptList : public CListViewCtrl { @@ -78,8 +79,9 @@ public: }; class CDebugScripts : - public CDebugDialog < CDebugScripts >, - public CDialogResize + public CDebugDialog, + public CDialogResize, + public CToolTipDialog { private: enum { @@ -161,4 +163,12 @@ public: DLGRESIZE_CONTROL(IDC_SCRIPTDIR_BTN, DLSZ_MOVE_Y) DLGRESIZE_CONTROL(IDC_STATUSBAR, DLSZ_SIZE_X | DLSZ_MOVE_Y) END_DLGRESIZE_MAP() + + BEGIN_TOOLTIP_MAP() + TOOLTIP(IDC_CLEAR_BTN, "Clear console output") + TOOLTIP(IDC_COPY_BTN, "Copy console output to the clipboard") + TOOLTIP(IDC_RUN_BTN, "Run selected script") + TOOLTIP(IDC_STOP_BTN, "Stop selected script") + TOOLTIP(IDC_SCRIPTDIR_BTN, "Open scripts directory in file explorer") + END_TOOLTIP_MAP() }; diff --git a/Source/Project64/UserInterface/UIResources.rc b/Source/Project64/UserInterface/UIResources.rc index 757dfdfe9..ee9cc7f47 100644 --- a/Source/Project64/UserInterface/UIResources.rc +++ b/Source/Project64/UserInterface/UIResources.rc @@ -836,8 +836,8 @@ BEGIN GROUPBOX "Output",IDC_OUTPUT_GRP,129,5,285,177,0,WS_EX_TRANSPARENT CONTROL "",IDC_STATUSBAR,"msctls_statusbar32",WS_TABSTOP,0,205,420,11 PUSHBUTTON "...",IDC_SCRIPTDIR_BTN,13,165,21,13 - PUSHBUTTON "Run",IDC_RUN_BTN,43,165,37,13 - PUSHBUTTON "Stop",IDC_STOP_BTN,83,165,37,13 + PUSHBUTTON "Run",IDC_RUN_BTN,43,165,37,13,WS_DISABLED + PUSHBUTTON "Stop",IDC_STOP_BTN,83,165,37,13,WS_DISABLED END IDD_Debugger_RegPI DIALOGEX 0, 0, 190, 210