Merge pull request #1698 from kaitengero/debugger-scripts

Additional functionality for debugger scripts
This commit is contained in:
zilmar 2020-01-26 09:06:31 +10:30 committed by GitHub
commit 088dc17556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 3 deletions

View File

@ -178,6 +178,9 @@ LRESULT CDebugScripts::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*
case ID_POPUP_STOP:
StopSelected();
break;
case ID_POPUP_SCRIPT_EDIT:
EditSelected();
break;
case IDC_CLEAR_BTN:
ConsoleClear();
break;
@ -196,7 +199,7 @@ LRESULT CDebugScripts::OnScriptListDblClicked(NMHDR* pNMHDR)
m_ScriptList.SelectItem(nItem);
RunSelected();
ToggleSelected();
return 0;
}
@ -405,4 +408,23 @@ void CDebugScripts::StopSelected()
m_Debugger->ScriptSystem()->StopScript(m_SelectedScriptName);
//m_Debugger->Debug_RefreshScriptsWindow();
}
}
void CDebugScripts::ToggleSelected()
{
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName);
if (state == STATE_INVALID || state == STATE_STOPPED)
{
RunSelected();
}
else
{
StopSelected();
}
}
void CDebugScripts::EditSelected()
{
ShellExecute(NULL, "edit", m_SelectedScriptName, NULL, "Scripts", SW_SHOWNORMAL);
}

View File

@ -107,6 +107,8 @@ public:
void EvaluateInSelectedInstance(char* code);
void RunSelected();
void StopSelected();
void ToggleSelected();
void EditSelected();
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(void)

View File

@ -114,7 +114,7 @@ void CScriptInstance::StateChanged()
{
// todo mutex might be needed here
//m_Debugger->Debug_RefreshScriptsWindow();
m_Debugger->Debug_RefreshScriptsWindow();
//m_ScriptSystem->DeleteStoppedInstances();
}

View File

@ -1990,6 +1990,7 @@ BEGIN
BEGIN
MENUITEM "Run", ID_POPUP_RUN
MENUITEM "Stop", ID_POPUP_STOP
MENUITEM "Edit", ID_POPUP_SCRIPT_EDIT
END
END

View File

@ -721,6 +721,7 @@
#define ID_POPUPMENU_CLEARALLBPS 40019
#define ID_POPUPMENU_TOGGLERBP 40020
#define ID_POPUPMENU_TOGGLEWBP 40021
#define ID_POPUP_SCRIPT_EDIT 40023
#define ID_POPUP_RUN 40024
#define ID_POPUP_STOP 40025
#define ID_POPUPMENU_INSERTNOP 40026