VDBAbstractUnixConsoleApplication.st
changeset 139 c619cc458fb1
parent 94 e76206d071fc
child 143 df7f89efd39d
equal deleted inserted replaced
138:8b44ccd9ae58 139:c619cc458fb1
     8 "
     8 "
     9 "{ Package: 'jv:vdb' }"
     9 "{ Package: 'jv:vdb' }"
    10 
    10 
    11 "{ NameSpace: Smalltalk }"
    11 "{ NameSpace: Smalltalk }"
    12 
    12 
    13 VDBAbstractApplication subclass:#VDBAbstractUnixConsoleApplication
    13 VDBAbstractConsoleApplication subclass:#VDBAbstractUnixConsoleApplication
    14 	instanceVariableNames:'consoleView'
    14 	instanceVariableNames:''
    15 	classVariableNames:''
    15 	classVariableNames:''
    16 	poolDictionaries:''
    16 	poolDictionaries:''
    17 	category:'VDB-UI-Console-Unix'
    17 	category:'VDB-UI-Console-Unix'
    18 !
    18 !
    19 
    19 
    28 
    28 
    29 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
    29 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
    30 "
    30 "
    31 ! !
    31 ! !
    32 
    32 
    33 !VDBAbstractUnixConsoleApplication class methodsFor:'interface specs'!
    33 !VDBAbstractUnixConsoleApplication class methodsFor:'accessing - defaults'!
    34 
    34 
    35 windowSpec
    35 defaultWindowTitle
    36     "This resource specification was automatically generated
    36     "Returns default window title for this application. By default,
    37      by the UIPainter of ST/X."
    37      extracts the title from #windowSpec.
       
    38      
       
    39      Subclasses may (must) override this method."
    38 
    40 
    39     "Do not manually edit this!! If it is corrupted,
    41     ^ self shouldImplement:'Override #defaultWindowTitle in concrete classes'
    40      the UIPainter may not be able to read the specification."
       
    41 
       
    42     "
       
    43      UIPainter new openOnClass:VDBAbstractConsoleApplication andSelector:#windowSpec
       
    44      VDBAbstractConsoleApplication new openInterface:#windowSpec
       
    45      VDBAbstractConsoleApplication open
       
    46     "
       
    47 
       
    48     <resource: #canvas>
       
    49 
       
    50     ^ 
       
    51     #(FullSpec
       
    52        name: windowSpec
       
    53        window: 
       
    54       (WindowSpec
       
    55          label: 'Console'
       
    56          name: 'Console'
       
    57          min: (Point 10 10)
       
    58          bounds: (Rectangle 0 0 782 332)
       
    59        )
       
    60        component: 
       
    61       (SpecCollection
       
    62          collection: (
       
    63           (ArbitraryComponentSpec
       
    64              name: 'Console'
       
    65              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
       
    66              hasHorizontalScrollBar: true
       
    67              hasVerticalScrollBar: true
       
    68              miniScrollerHorizontal: true
       
    69              autoHideScrollBars: false
       
    70              hasBorder: false
       
    71              component: consoleView
       
    72            )
       
    73           )
       
    74         
       
    75        )
       
    76      )
       
    77 ! !
    42 ! !
    78 
    43 
    79 !VDBAbstractUnixConsoleApplication class methodsFor:'plugIn spec'!
    44 !VDBAbstractUnixConsoleApplication class methodsFor:'startup-web applications'!
    80 
    45 
    81 aspectSelectors
    46 initialPageSpec
    82     "This resource specification was automatically generated
    47     "this is only required for web-applications"
    83      by the UIPainter of ST/X."
       
    84 
    48 
    85     "Do not manually edit this. If it is corrupted,
    49     ^ self shouldImplement
    86      the UIPainter may not be able to read the specification."
    50 !
    87 
    51 
    88     "Return a description of exported aspects;
    52 pageSpecs
    89      these can be connected to aspects of an embedding application
    53     "this is only required for web-applications"
    90      (if this app is embedded in a subCanvas)."
       
    91 
    54 
    92     ^ #(
    55     ^ self shouldImplement
    93         #debuggerHolder
       
    94       ).
       
    95 
       
    96 ! !
    56 ! !
    97 
    57 
    98 !VDBAbstractUnixConsoleApplication class methodsFor:'testing'!
    58 !VDBAbstractUnixConsoleApplication class methodsFor:'testing'!
    99 
    59 
   100 isAbstract
    60 isAbstract
   101     ^ self == VDBAbstractUnixConsoleApplication
    61     ^ self == VDBAbstractUnixConsoleApplication
   102 ! !
    62 ! !
   103 
    63 
   104 !VDBAbstractUnixConsoleApplication methodsFor:'accessing'!
       
   105 
       
   106 consoleInput
       
   107     self subclassResponsibility
       
   108 
       
   109     "Created: / 01-06-2017 / 09:43:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   110 !
       
   111 
       
   112 consoleOutput
       
   113     self subclassResponsibility
       
   114 
       
   115     "Created: / 01-06-2017 / 09:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   116 ! !
       
   117 
       
   118 !VDBAbstractUnixConsoleApplication methodsFor:'aspects'!
    64 !VDBAbstractUnixConsoleApplication methodsFor:'aspects'!
   119 
    65 
   120 consoleView
    66 consoleViewClass
   121     consoleView isNil ifTrue:[ 
    67     ^ VT100TerminalView
   122         consoleView :=VT100TerminalView new.
       
   123         consoleView font: self textFont;
       
   124                     cursorType: #block;  
       
   125                     foregroundColor: Color white
       
   126                     backgroundColor: Color black;
       
   127                     cursorForegroundColor: Color white
       
   128                           backgroundColor: Color white.
       
   129         debugger notNil ifTrue:[ 
       
   130             consoleView inStream: self consoleInput.
       
   131             consoleView outStream: self consoleOutput.
       
   132             consoleView startReaderProcessWhenVisible.
       
   133         ].
       
   134     ].
       
   135     ^ consoleView
       
   136 
    68 
   137     "Created: / 06-06-2014 / 21:33:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    69     "Created: / 21-01-2019 / 14:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   138     "Modified: / 20-08-2018 / 10:18:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   139 ! !
       
   140 
       
   141 !VDBAbstractUnixConsoleApplication methodsFor:'initialization & release'!
       
   142 
       
   143 subscribe   
       
   144     "Register for debugger events. To be overrided by subclasses"
       
   145 
       
   146     super subscribe.
       
   147     (debugger notNil and:[consoleView notNil]) ifTrue:[
       
   148         consoleView stopReaderProcess.
       
   149         consoleView inStream: self consoleInput.
       
   150         consoleView outStream: self consoleOutput.            
       
   151         consoleView startReaderProcessWhenVisible.
       
   152     ].
       
   153 
       
   154     "Created: / 10-06-2014 / 21:02:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   155     "Modified: / 01-06-2017 / 09:47:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   156 !
       
   157 
       
   158 unsubscribe
       
   159     "Unsubscribe myself fo debugger events"
       
   160 
       
   161     super unsubscribe.
       
   162     consoleView notNil ifTrue:[ 
       
   163         consoleView stopReaderProcess.
       
   164         consoleView inStream: nil.
       
   165         consoleView outStream: nil.
       
   166     ].
       
   167 
       
   168     "Created: / 09-06-2014 / 10:09:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   169 ! !
    70 ! !
   170 
    71 
   171 !VDBAbstractUnixConsoleApplication class methodsFor:'documentation'!
    72 !VDBAbstractUnixConsoleApplication class methodsFor:'documentation'!
   172 
    73 
   173 version_HG
    74 version_HG