diff -r 6c982fc25fe2 -r 956f5bcac948 VDBWindowsDebuggerConsoleApplication.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VDBWindowsDebuggerConsoleApplication.st Mon Jan 08 19:48:11 2018 +0000 @@ -0,0 +1,267 @@ +" +jv:vdb - Visual / VM Debugger +Copyright (C) 2015-now Jan Vrany + +This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' + +You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ +" +"{ Package: 'jv:vdb' }" + +"{ NameSpace: Smalltalk }" + +VDBAbstractApplication subclass:#VDBWindowsDebuggerConsoleApplication + instanceVariableNames:'consoleView commandView commandHolder commandHistory + pendingCommand' + classVariableNames:'' + poolDictionaries:'' + category:'VDB-UI-Console-Windows' +! + +!VDBWindowsDebuggerConsoleApplication class methodsFor:'documentation'! + +copyright +" +jv:vdb - Visual / VM Debugger +Copyright (C) 2015-now Jan Vrany + +This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License' + +You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/ +" +! + +documentation +"" +! ! + +!VDBWindowsDebuggerConsoleApplication class methodsFor:'accessing'! + +windowTitle + ^ 'Debugger Console' + + "Created: / 08-01-2018 / 18:59:02 / Jan Vrany " +! ! + +!VDBWindowsDebuggerConsoleApplication class methodsFor:'interface specs'! + +windowSpec + "This resource specification was automatically generated + by the UIPainter of ST/X." + + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." + + " + UIPainter new openOnClass:VDBAbstractWindowsConsoleApplication andSelector:#windowSpec + VDBAbstractWindowsConsoleApplication new openInterface:#windowSpec + VDBAbstractWindowsConsoleApplication open + " + + + + ^ + #(FullSpec + name: windowSpec + uuid: 'f62f8c40-f4a2-11e7-be5c-606720e43e2c' + window: + (WindowSpec + label: 'Console' + name: 'Console' + uuid: '574ffdd1-f484-11e7-be5c-606720e43e2c' + min: (Point 10 10) + bounds: (Rectangle 0 0 769 300) + ) + component: + (SpecCollection + collection: ( + (TextEditorSpec + name: 'ConsoleView' + layout: (LayoutFrame 0 0 0 0 0 1 -25 1) + uuid: '574ffdd2-f484-11e7-be5c-606720e43e2c' + hasHorizontalScrollBar: true + hasVerticalScrollBar: true + hasKeyboardFocusInitially: false + postBuildCallback: postBuildConsoleView: + viewClassName: 'TextCollector' + ) + (ComboBoxSpec + name: 'COmmandBox' + layout: (LayoutFrame 0 0 -25 1 0 1 0 1) + uuid: '574ffdd3-f484-11e7-be5c-606720e43e2c' + model: commandHolder + acceptOnLeave: false + acceptOnTab: false + acceptOnLostFocus: false + acceptOnPointerLeave: false + acceptIfUnchanged: true + comboList: commandHistory + postBuildCallback: postBuildCommandView: + ) + ) + + ) + ) +! ! + +!VDBWindowsDebuggerConsoleApplication class methodsFor:'plugIn spec'! + +aspectSelectors + "This resource specification was automatically generated + by the UIPainter of ST/X." + + "Do not manually edit this. If it is corrupted, + the UIPainter may not be able to read the specification." + + "Return a description of exported aspects; + these can be connected to aspects of an embedding application + (if this app is embedded in a subCanvas)." + + ^ #( + #debuggerHolder + ). + +! ! + +!VDBWindowsDebuggerConsoleApplication methodsFor:'actions'! + +postBuildCommandView: aComboBox + commandView := aComboBox. + commandView font: CodeView defaultFont; + foregroundColor: Color white + backgroundColor: Color black; + cursorForegroundColor: Color white + backgroundColor: Color white. + + "Modified: / 08-01-2018 / 19:16:35 / Jan Vrany " +! + +postBuildConsoleView: aTextCollector + consoleView := aTextCollector scrolledView. + consoleView readOnly: true; + font: CodeView defaultFont; + foregroundColor: Color white + backgroundColor: Color black; + cursorForegroundColor: Color white + backgroundColor: Color white. + + "Modified: / 08-01-2018 / 19:16:41 / Jan Vrany " +! + +send: aString + [ + pendingCommand := GDBCommand parse: aString. + commandView readOnly: true. + debugger send: pendingCommand. + ] on: GDBCommandFailedError do:[ + "/ Really, we should ignore the error here. + 1 + 1. "/ this is to trick the static analysis + ]. + + "Created: / 08-01-2018 / 18:42:25 / Jan Vrany " +! ! + +!VDBWindowsDebuggerConsoleApplication methodsFor:'aspects'! + +commandHistory + commandHistory isNil ifTrue:[ + commandHistory := List new. + ]. + ^ commandHistory. + + "Modified: / 08-01-2018 / 18:43:52 / Jan Vrany " +! + +commandHolder + + commandHolder isNil ifTrue:[ + commandHolder := ValueHolder new. + commandHolder addDependent:self. + ]. + ^ commandHolder. + + "Modified: / 08-01-2018 / 18:37:42 / Jan Vrany " +! ! + +!VDBWindowsDebuggerConsoleApplication methodsFor:'change & update'! + +update:aspect with:param from:sender + "Invoked when an object that I depend upon sends a change notification." + + "stub code automatically generated - please change as required" + + sender == commandHolder ifTrue:[ + self updateAfterCommandHolderChanged. + ^ self. + ]. + super update:aspect with:param from:sender + + "Modified: / 08-01-2018 / 18:39:32 / Jan Vrany " +! + +updateAfterCommandHolderChanged + pendingCommand isNil ifTrue:[ + self send: commandHolder value. + ] + + "Created: / 08-01-2018 / 18:39:32 / Jan Vrany " +! ! + +!VDBWindowsDebuggerConsoleApplication methodsFor:'event handling'! + +onCommandEvent: event +"/ event command == outstandingCommand ifTrue:[ +"/ outstandingCommandToken := event token. +"/ ignoreNextLogStreamEvent := true. +"/ ]. + + "Created: / 08-01-2018 / 18:51:48 / Jan Vrany " +! + +onCommandResultEvent: event + event result command == pendingCommand ifTrue:[ + commandHolder value: ''. + commandView readOnly: false. + commandView takeFocus. + pendingCommand := nil. + ]. + + "Created: / 08-01-2018 / 18:52:00 / Jan Vrany " +! + +onLogOutputEvent: event +"/ ignoreNextLogStreamEvent ifTrue:[ +"/ ignoreNextLogStreamEvent := false. +"/ ] ifFalse:[ + self onStreamOutputEvent: event +"/ ] + + "Created: / 08-01-2018 / 18:52:17 / Jan Vrany " +! + +onStreamOutputEvent: event + event value asStringCollection do:[:line | + line notEmptyOrNil ifTrue:[ + consoleView showCR: line. + ]. + ]. + + "Created: / 08-01-2018 / 18:52:34 / Jan Vrany " +! ! + +!VDBWindowsDebuggerConsoleApplication methodsFor:'initialization & release'! + +subscribe + "Register for debugger events. To be overrided by subclasses" + + debugger announcer + when: GDBCommandEvent send: #onCommandEvent: to: self; + when: GDBCommandResultEvent send: #onCommandResultEvent: to: self; + + when: GDBConsoleOutputEvent send: #onStreamOutputEvent: to: self; + when: GDBTargetOutputEvent send: #onStreamOutputEvent: to: self; + when: GDBLogOutputEvent send: #onLogOutputEvent: to: self. + + "Created: / 08-01-2018 / 18:50:55 / Jan Vrany " +! ! +