diff --git a/src/ddebug/common/nodebug.d b/src/ddebug/common/nodebug.d index 5dd5dad..b8d4703 100644 --- a/src/ddebug/common/nodebug.d +++ b/src/ddebug/common/nodebug.d @@ -100,6 +100,7 @@ class ProgramExecutionNoDebug : Thread, ProgramExecution { } // finished + Log.d("ProgramExecutionNoDebug: finished, execution status: ", _status); _listener.onProgramExecutionStatus(this, _status, _exitCode); } diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index 4cd2773..0231c40 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -85,9 +85,9 @@ const Action ACTION_PROJECT_REFRESH = new Action(IDEActions.RefreshProject, "MEN const Action ACTION_PROJECT_UPDATE_DEPENDENCIES = new Action(IDEActions.UpdateProjectDependencies, "MENU_PROJECT_UPDATE_DEPENDENCIES"c); const Action ACTION_DEBUG_START = new Action(IDEActions.DebugStart, "MENU_DEBUG_START_DEBUGGING"c, "debug-run"c, KeyCode.F5, 0); const Action ACTION_DEBUG_START_NO_DEBUG = new Action(IDEActions.DebugStartNoDebug, "MENU_DEBUG_START_NO_DEBUGGING"c, null, KeyCode.F5, KeyFlag.Control); -const Action ACTION_DEBUG_CONTINUE = new Action(IDEActions.DebugContinue, "MENU_DEBUG_CONTINUE"c); -const Action ACTION_DEBUG_STOP = (new Action(IDEActions.DebugStop, "MENU_DEBUG_STOP"c)).disableByDefault(); -const Action ACTION_DEBUG_PAUSE = (new Action(IDEActions.DebugPause, "MENU_DEBUG_PAUSE"c)).disableByDefault(); +const Action ACTION_DEBUG_CONTINUE = new Action(IDEActions.DebugContinue, "MENU_DEBUG_CONTINUE"c, "debug-run"); +const Action ACTION_DEBUG_STOP = (new Action(IDEActions.DebugStop, "MENU_DEBUG_STOP"c, "debug-stop")).disableByDefault(); +const Action ACTION_DEBUG_PAUSE = (new Action(IDEActions.DebugPause, "MENU_DEBUG_PAUSE"c, "debug-pause")).disableByDefault(); const Action ACTION_EDIT_COPY = (new Action(EditorActions.Copy, "MENU_EDIT_COPY"c, "edit-copy"c, KeyCode.KEY_C, KeyFlag.Control)).addAccelerator(KeyCode.INS, KeyFlag.Control).disableByDefault(); const Action ACTION_EDIT_PASTE = (new Action(EditorActions.Paste, "MENU_EDIT_PASTE"c, "edit-paste"c, KeyCode.KEY_V, KeyFlag.Control)).addAccelerator(KeyCode.INS, KeyFlag.Shift).disableByDefault(); const Action ACTION_EDIT_CUT = (new Action(EditorActions.Cut, "MENU_EDIT_CUT"c, "edit-cut"c, KeyCode.KEY_X, KeyFlag.Control)).addAccelerator(KeyCode.DEL, KeyFlag.Shift).disableByDefault(); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 5a2a1c9..efe1348 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -91,12 +91,19 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener { /// stop current program execution void stopExecution() { if (_execution) { + _logPanel.logLine("Stopping program execution"); + Log.d("Stopping execution"); _execution.stop(); - destroy(_execution); + //destroy(_execution); _execution = null; } } + /// returns true if program execution or debugging is active + @property bool isExecutionActive() { + return _execution !is null; + } + /// called when program execution is stopped protected void onProgramExecutionStatus(ProgramExecution process, ExecutionStatus status, int exitCode) { executeInUiThread(delegate() { @@ -571,6 +578,8 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener { tb = res.getOrAddToolbar("Edit"); tb.addButtons(ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT, ACTION_SEPARATOR, ACTION_EDIT_UNDO, ACTION_EDIT_REDO, ACTION_EDIT_INDENT, ACTION_EDIT_UNINDENT); + tb = res.getOrAddToolbar("Debug"); + tb.addButtons(ACTION_DEBUG_STOP, ACTION_DEBUG_CONTINUE, ACTION_DEBUG_PAUSE); return res; } @@ -602,7 +611,6 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener { case IDEActions.CleanWorkspace: case IDEActions.DebugStart: case IDEActions.DebugStartNoDebug: - case IDEActions.DebugContinue: case IDEActions.UpdateProjectDependencies: case IDEActions.RefreshProject: case IDEActions.SetStartupProject: @@ -613,6 +621,13 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener { else a.state = ACTION_STATE_DISABLE; return true; + case IDEActions.DebugStop: + a.state = isExecutionActive ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE; + return true; + case IDEActions.DebugContinue: + case IDEActions.DebugPause: + a.state = isExecutionActive && _execution.isDebugger ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE; + return true; default: return super.handleActionStateRequest(a); } @@ -673,6 +688,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener { case IDEActions.DebugContinue: buildAndRunProject(); return true; + case IDEActions.DebugStop: + stopExecution(); + return true; case IDEActions.UpdateProjectDependencies: buildProject(BuildOperation.Upgrade); return true; diff --git a/views/res/mdpi/debug-pause.png b/views/res/mdpi/debug-pause.png new file mode 100644 index 0000000..0c42c3f Binary files /dev/null and b/views/res/mdpi/debug-pause.png differ diff --git a/views/res/mdpi/debug-stop.png b/views/res/mdpi/debug-stop.png new file mode 100644 index 0000000..daeeb7b Binary files /dev/null and b/views/res/mdpi/debug-stop.png differ diff --git a/views/resources.list b/views/resources.list index 50de379..b91fbb4 100644 --- a/views/resources.list +++ b/views/resources.list @@ -31,6 +31,8 @@ res/hdpi/hdpi_run-build.png res/hdpi/hdpi_text-d.png res/mdpi/cr3_logo.png res/mdpi/debug-run.png +res/mdpi/debug-pause.png +res/mdpi/debug-stop.png res/mdpi/dlangui-logo1.png res/mdpi/document-close.png res/mdpi/document-open-recent.png