XTermView.st
author Claus Gittinger <cg@exept.de>
Sun, 01 Feb 2015 14:17:11 +0100
changeset 15150 940d37c7d3ac
parent 14461 5dfe30926b88
child 15566 184cea584be5
permissions -rw-r--r--
class: Tools::ChangeList fixed the following redraw bug in ModelListView (which is already fixed in SelectionInListView): if a colored item is shown with selection, the color attribute should be removed (or relaxed), to avoid drawing the label invisible. I.e. if the text color is blue or grey, and the selection bg is blue. we should draw white-on-blue, instead of blue/grey on blue. For this to work, the info whether drawing a selection must be passed down through the renderer to the item's draw routine.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
     1
"
177534def4c3 initial checkin
vrany
parents:
diff changeset
     2
 COPYRIGHT (c) 2006 by eXept Software AG
177534def4c3 initial checkin
vrany
parents:
diff changeset
     3
	      All Rights Reserved
177534def4c3 initial checkin
vrany
parents:
diff changeset
     4
177534def4c3 initial checkin
vrany
parents:
diff changeset
     5
 This software is furnished under a license and may be used
177534def4c3 initial checkin
vrany
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
177534def4c3 initial checkin
vrany
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
177534def4c3 initial checkin
vrany
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
177534def4c3 initial checkin
vrany
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
177534def4c3 initial checkin
vrany
parents:
diff changeset
    10
 hereby transferred.
177534def4c3 initial checkin
vrany
parents:
diff changeset
    11
"
177534def4c3 initial checkin
vrany
parents:
diff changeset
    12
"{ Package: 'stx:libtool' }"
177534def4c3 initial checkin
vrany
parents:
diff changeset
    13
177534def4c3 initial checkin
vrany
parents:
diff changeset
    14
XEmbedContainerView subclass:#XTermView
177534def4c3 initial checkin
vrany
parents:
diff changeset
    15
	instanceVariableNames:'pid wid wd'
177534def4c3 initial checkin
vrany
parents:
diff changeset
    16
	classVariableNames:'XTermType XTermExecutable'
177534def4c3 initial checkin
vrany
parents:
diff changeset
    17
	poolDictionaries:''
177534def4c3 initial checkin
vrany
parents:
diff changeset
    18
	category:'Interface-Tools-Terminal'
177534def4c3 initial checkin
vrany
parents:
diff changeset
    19
!
177534def4c3 initial checkin
vrany
parents:
diff changeset
    20
177534def4c3 initial checkin
vrany
parents:
diff changeset
    21
!XTermView class methodsFor:'documentation'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
    22
177534def4c3 initial checkin
vrany
parents:
diff changeset
    23
copyright
177534def4c3 initial checkin
vrany
parents:
diff changeset
    24
"
177534def4c3 initial checkin
vrany
parents:
diff changeset
    25
 COPYRIGHT (c) 2006 by eXept Software AG
177534def4c3 initial checkin
vrany
parents:
diff changeset
    26
	      All Rights Reserved
177534def4c3 initial checkin
vrany
parents:
diff changeset
    27
177534def4c3 initial checkin
vrany
parents:
diff changeset
    28
 This software is furnished under a license and may be used
177534def4c3 initial checkin
vrany
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
177534def4c3 initial checkin
vrany
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
177534def4c3 initial checkin
vrany
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
177534def4c3 initial checkin
vrany
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
177534def4c3 initial checkin
vrany
parents:
diff changeset
    33
 hereby transferred.
177534def4c3 initial checkin
vrany
parents:
diff changeset
    34
"
13907
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    35
!
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    36
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    37
examples
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    38
"
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    39
    self new open
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    40
"
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
    41
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
    42
177534def4c3 initial checkin
vrany
parents:
diff changeset
    43
!XTermView class methodsFor:'class initialization'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
    44
177534def4c3 initial checkin
vrany
parents:
diff changeset
    45
initialize
177534def4c3 initial checkin
vrany
parents:
diff changeset
    46
177534def4c3 initial checkin
vrany
parents:
diff changeset
    47
    XTermType := #unavailable.
13907
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    48
    #(urxvt rxvt xterm uxterm) do:[:eachXtermCommandSymbol|    
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    49
        (XTermExecutable := OperatingSystem pathOfCommand:eachXtermCommandSymbol) notNil ifTrue:[
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    50
            XTermType := eachXtermCommandSymbol.
11831
f2e23f8433f1 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 10704
diff changeset
    51
            ^ self
13907
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
    52
        ].
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
    53
    ].
177534def4c3 initial checkin
vrany
parents:
diff changeset
    54
177534def4c3 initial checkin
vrany
parents:
diff changeset
    55
    "
177534def4c3 initial checkin
vrany
parents:
diff changeset
    56
        XTermView initialize 
177534def4c3 initial checkin
vrany
parents:
diff changeset
    57
    "
177534def4c3 initial checkin
vrany
parents:
diff changeset
    58
177534def4c3 initial checkin
vrany
parents:
diff changeset
    59
    "Created: / 09-12-2010 / 23:15:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
    60
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
    61
177534def4c3 initial checkin
vrany
parents:
diff changeset
    62
!XTermView class methodsFor:'defaults'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
    63
177534def4c3 initial checkin
vrany
parents:
diff changeset
    64
defaultFont
177534def4c3 initial checkin
vrany
parents:
diff changeset
    65
177534def4c3 initial checkin
vrany
parents:
diff changeset
    66
    DefaultFont ifNotNil:[^CodeView defaultFont].
177534def4c3 initial checkin
vrany
parents:
diff changeset
    67
    ^super defaultFont.
177534def4c3 initial checkin
vrany
parents:
diff changeset
    68
177534def4c3 initial checkin
vrany
parents:
diff changeset
    69
    "Created: / 25-11-2010 / 12:50:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
    70
!
177534def4c3 initial checkin
vrany
parents:
diff changeset
    71
177534def4c3 initial checkin
vrany
parents:
diff changeset
    72
updateStyleCache
177534def4c3 initial checkin
vrany
parents:
diff changeset
    73
177534def4c3 initial checkin
vrany
parents:
diff changeset
    74
    super updateStyleCache.
177534def4c3 initial checkin
vrany
parents:
diff changeset
    75
    "/DefaultViewBackgroundColor := Color black.
177534def4c3 initial checkin
vrany
parents:
diff changeset
    76
177534def4c3 initial checkin
vrany
parents:
diff changeset
    77
    "Created: / 25-11-2010 / 12:21:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
    78
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
    79
177534def4c3 initial checkin
vrany
parents:
diff changeset
    80
!XTermView class methodsFor:'queries'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
    81
177534def4c3 initial checkin
vrany
parents:
diff changeset
    82
isAvailable
177534def4c3 initial checkin
vrany
parents:
diff changeset
    83
177534def4c3 initial checkin
vrany
parents:
diff changeset
    84
    ^XTermType ~= #unavailable
177534def4c3 initial checkin
vrany
parents:
diff changeset
    85
177534def4c3 initial checkin
vrany
parents:
diff changeset
    86
    "Created: / 09-12-2010 / 23:21:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
    87
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
    88
177534def4c3 initial checkin
vrany
parents:
diff changeset
    89
!XTermView methodsFor:'accessing'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
    90
177534def4c3 initial checkin
vrany
parents:
diff changeset
    91
workingDirectory: aStringOrFilename
177534def4c3 initial checkin
vrany
parents:
diff changeset
    92
177534def4c3 initial checkin
vrany
parents:
diff changeset
    93
    aStringOrFilename ifNotNil:
177534def4c3 initial checkin
vrany
parents:
diff changeset
    94
        [wd := aStringOrFilename asString].
177534def4c3 initial checkin
vrany
parents:
diff changeset
    95
177534def4c3 initial checkin
vrany
parents:
diff changeset
    96
    "Created: / 25-11-2010 / 12:32:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
    97
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
    98
177534def4c3 initial checkin
vrany
parents:
diff changeset
    99
!XTermView methodsFor:'event handling'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   100
177534def4c3 initial checkin
vrany
parents:
diff changeset
   101
clientUnplugged: clientInitiated
177534def4c3 initial checkin
vrany
parents:
diff changeset
   102
177534def4c3 initial checkin
vrany
parents:
diff changeset
   103
    | app |
177534def4c3 initial checkin
vrany
parents:
diff changeset
   104
177534def4c3 initial checkin
vrany
parents:
diff changeset
   105
    super clientUnplugged: clientInitiated.
177534def4c3 initial checkin
vrany
parents:
diff changeset
   106
177534def4c3 initial checkin
vrany
parents:
diff changeset
   107
    clientInitiated ifFalse:[^self].
177534def4c3 initial checkin
vrany
parents:
diff changeset
   108
    
177534def4c3 initial checkin
vrany
parents:
diff changeset
   109
    "But hackish..."
177534def4c3 initial checkin
vrany
parents:
diff changeset
   110
    app := self application.
177534def4c3 initial checkin
vrany
parents:
diff changeset
   111
    app ifNil:[^self].
13816
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   112
    (app class == FileApplicationNoteBook::Terminal) ifTrue:[
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   113
        app doClose.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   114
        ^self.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   115
    ].
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   116
    #(removeWorkspace "WorkspaceApplication"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   117
      bufferMenuRemoveCurrentBuffer "NewSystemBrowser"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   118
    ) do:[:closeSelector|
13816
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   119
        (app topApplication respondsTo: closeSelector) ifTrue: [
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   120
            app topApplication perform: closeSelector.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   121
            ^self
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   122
        ]
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   123
    ].
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   124
177534def4c3 initial checkin
vrany
parents:
diff changeset
   125
    "Created: / 06-06-2011 / 10:04:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   126
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
   127
177534def4c3 initial checkin
vrany
parents:
diff changeset
   128
!XTermView methodsFor:'initialization & release'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   129
14461
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   130
closeDownShell
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   131
    "shut down my shell process."
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   132
14460
13d136d2e5a9 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13952
diff changeset
   133
    |p|
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   134
14460
13d136d2e5a9 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13952
diff changeset
   135
    (p := pid) notNil ifTrue:[
13d136d2e5a9 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13952
diff changeset
   136
        pid := nil.
13d136d2e5a9 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13952
diff changeset
   137
        OperatingSystem terminateProcess: p
13d136d2e5a9 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13952
diff changeset
   138
    ].
14461
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   139
!
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   140
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   141
destroy
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   142
    self closeDownShell.
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   143
    super destroy.
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   144
177534def4c3 initial checkin
vrany
parents:
diff changeset
   145
    "Created: / 25-11-2010 / 10:48:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   146
    "Modified: / 01-06-2011 / 13:13:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   147
!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   148
177534def4c3 initial checkin
vrany
parents:
diff changeset
   149
initialize
177534def4c3 initial checkin
vrany
parents:
diff changeset
   150
177534def4c3 initial checkin
vrany
parents:
diff changeset
   151
    super initialize.
177534def4c3 initial checkin
vrany
parents:
diff changeset
   152
    wd := Filename defaultDirectory asString
177534def4c3 initial checkin
vrany
parents:
diff changeset
   153
177534def4c3 initial checkin
vrany
parents:
diff changeset
   154
    "Created: / 25-11-2010 / 12:34:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   155
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
   156
13816
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   157
!XTermView methodsFor:'menu'!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   158
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   159
doClear
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   160
    "reset the scroll-range etc, clear the text buffer"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   161
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   162
"/    rangeStartLine := 1.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   163
"/    rangeEndLine := numberOfLines.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   164
"/
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   165
"/    self normal.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   166
"/    self clear.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   167
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   168
    "Created: / 03-04-2007 / 08:58:59 / cg"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   169
    "Modified: / 03-04-2012 / 10:34:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   170
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   171
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   172
doReset
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   173
    "reset the scroll-range; 
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   174
     may have to reset more in the future (current font-set; color; etc)"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   175
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   176
"/    rangeStartLine := 1.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   177
"/    rangeEndLine := numberOfLines.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   178
"/
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   179
"/    self normal.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   180
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   181
    "Modified: / 03-04-2012 / 10:34:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   182
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   183
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   184
doSendInterrupt
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   185
    "send an INT-signal to the shell (UNIX only)"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   186
    pid notNil ifTrue:[
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   187
        OperatingSystem sendSignal:(OperatingSystem sigINT) to:pid negated.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   188
    ].
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   189
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   190
    "Modified: / 10-06-1998 / 17:49:49 / cg"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   191
    "Modified: / 03-04-2012 / 10:34:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   192
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   193
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   194
doSendKillSignal
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   195
    "send a KILL-signal to the shell (UNIX only)"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   196
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   197
    pid notNil ifTrue:[
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   198
        OperatingSystem sendSignal:(OperatingSystem sigKILL) to:pid negated.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   199
    ]
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   200
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   201
    "Modified: / 03-04-2012 / 10:34:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   202
! !
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   203
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   204
!XTermView methodsFor:'mimicry'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   205
13816
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   206
defaultFileNameForFileDialog
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   207
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   208
    ^nil
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   209
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   210
    "Created: / 03-05-2012 / 12:29:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   211
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   212
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   213
lineLimit:aSmallInteger
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   214
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   215
    "Nothing"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   216
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   217
    "Created: / 03-04-2012 / 10:42:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   218
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   219
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   220
list
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   221
    ^nil
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   222
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   223
    "Created: / 17-07-2012 / 21:11:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   224
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   225
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   226
modified
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   227
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   228
    ^false
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   229
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   230
    "Created: / 03-05-2012 / 11:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   231
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   232
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   233
save
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   234
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   235
    Dialog warn: 'Not yet implemented for XTermView'
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   236
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   237
    "Created: / 03-04-2012 / 10:43:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   238
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   239
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   240
selectionAsString
13952
1b127aaddf33 class: XTermView
Stefan Vogel <sv@exept.de>
parents: 13913
diff changeset
   241
    ^ (self graphicsDevice getSelectionOwnerOf: #PRIMARY) = self drawableId ifTrue:[
1b127aaddf33 class: XTermView
Stefan Vogel <sv@exept.de>
parents: 13913
diff changeset
   242
        self graphicsDevice getClipboardText:#selection for:self drawableId
13816
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   243
    ] ifFalse:[
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   244
        nil
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   245
    ]
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   246
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   247
    "Created: / 03-04-2012 / 10:30:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   248
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   249
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   250
sendLine:aString
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   251
    self halt:'please define sendLine: here'.
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   252
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   253
    "Created: / 03-04-2012 / 10:33:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   254
!
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   255
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   256
shellTerminateAction: aBlock
177534def4c3 initial checkin
vrany
parents:
diff changeset
   257
177534def4c3 initial checkin
vrany
parents:
diff changeset
   258
    "Nothing to do"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   259
177534def4c3 initial checkin
vrany
parents:
diff changeset
   260
    "Created: / 25-11-2010 / 12:37:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   261
!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   262
177534def4c3 initial checkin
vrany
parents:
diff changeset
   263
startShellIn:aUnixFilename
177534def4c3 initial checkin
vrany
parents:
diff changeset
   264
177534def4c3 initial checkin
vrany
parents:
diff changeset
   265
    "Nothing to do. just to be compatible with TerminalView"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   266
177534def4c3 initial checkin
vrany
parents:
diff changeset
   267
    "Created: / 25-11-2010 / 12:38:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   268
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
   269
177534def4c3 initial checkin
vrany
parents:
diff changeset
   270
!XTermView methodsFor:'private'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   271
177534def4c3 initial checkin
vrany
parents:
diff changeset
   272
xcolorNameFor: aColor
177534def4c3 initial checkin
vrany
parents:
diff changeset
   273
177534def4c3 initial checkin
vrany
parents:
diff changeset
   274
    ^'rgb:%1/%2/%3' 
177534def4c3 initial checkin
vrany
parents:
diff changeset
   275
            bindWith: (aColor redByte   printStringRadix: 16)
177534def4c3 initial checkin
vrany
parents:
diff changeset
   276
                with: (aColor greenByte printStringRadix: 16)
177534def4c3 initial checkin
vrany
parents:
diff changeset
   277
                with: (aColor blueByte  printStringRadix: 16)
177534def4c3 initial checkin
vrany
parents:
diff changeset
   278
177534def4c3 initial checkin
vrany
parents:
diff changeset
   279
    "Created: / 25-11-2010 / 12:25:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   280
!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   281
177534def4c3 initial checkin
vrany
parents:
diff changeset
   282
xtermArgs
177534def4c3 initial checkin
vrany
parents:
diff changeset
   283
    | args |
177534def4c3 initial checkin
vrany
parents:
diff changeset
   284
177534def4c3 initial checkin
vrany
parents:
diff changeset
   285
    args := OrderedCollection new.
177534def4c3 initial checkin
vrany
parents:
diff changeset
   286
    args
177534def4c3 initial checkin
vrany
parents:
diff changeset
   287
        add: self xtermExecutable;
13952
1b127aaddf33 class: XTermView
Stefan Vogel <sv@exept.de>
parents: 13913
diff changeset
   288
        add: (XTermType == #xterm ifTrue:['-into'] ifFalse:['-embed']); add:self embeddingWindowId printString;        
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   289
        add: '-j';
13913
d4cdc5e3e3d2 Fix - removed initStyle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13907
diff changeset
   290
"/        add: '-font'; add: (device fullFontNameOf: (font fontId));
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   291
        add: '-fg'; add: 'white'"(self xcolorNameFor: foreground)";
177534def4c3 initial checkin
vrany
parents:
diff changeset
   292
        add: '-bg'; add: 'black'"(self xcolorNameFor: viewBackground)".
177534def4c3 initial checkin
vrany
parents:
diff changeset
   293
177534def4c3 initial checkin
vrany
parents:
diff changeset
   294
    XTermType == #rxvt ifTrue:[
177534def4c3 initial checkin
vrany
parents:
diff changeset
   295
    args
177534def4c3 initial checkin
vrany
parents:
diff changeset
   296
        add: '-tn'; add: 'xterm'
177534def4c3 initial checkin
vrany
parents:
diff changeset
   297
    ].
177534def4c3 initial checkin
vrany
parents:
diff changeset
   298
13816
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   299
    ^args asArray
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   300
13913
d4cdc5e3e3d2 Fix - removed initStyle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13907
diff changeset
   301
    "Modified: / 06-02-2014 / 20:03:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   302
!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   303
177534def4c3 initial checkin
vrany
parents:
diff changeset
   304
xtermExecutable
177534def4c3 initial checkin
vrany
parents:
diff changeset
   305
177534def4c3 initial checkin
vrany
parents:
diff changeset
   306
    ^ XTermExecutable
177534def4c3 initial checkin
vrany
parents:
diff changeset
   307
177534def4c3 initial checkin
vrany
parents:
diff changeset
   308
    "Modified: / 09-12-2010 / 23:16:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   309
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
   310
177534def4c3 initial checkin
vrany
parents:
diff changeset
   311
!XTermView methodsFor:'queries'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   312
177534def4c3 initial checkin
vrany
parents:
diff changeset
   313
preferredExtent
177534def4c3 initial checkin
vrany
parents:
diff changeset
   314
    "return my preferred extent - this is the minimum size I would like to have.
177534def4c3 initial checkin
vrany
parents:
diff changeset
   315
     If the preferredExtent has been set, that one is returned.
177534def4c3 initial checkin
vrany
parents:
diff changeset
   316
     Otherwise, if there are any components, a rectangle enclosing them
177534def4c3 initial checkin
vrany
parents:
diff changeset
   317
     is returned. Otherwise, the actual extent is returned."
177534def4c3 initial checkin
vrany
parents:
diff changeset
   318
177534def4c3 initial checkin
vrany
parents:
diff changeset
   319
    "/ If I have an explicit preferredExtent..
177534def4c3 initial checkin
vrany
parents:
diff changeset
   320
    explicitExtent notNil ifTrue:[
177534def4c3 initial checkin
vrany
parents:
diff changeset
   321
        ^ explicitExtent
177534def4c3 initial checkin
vrany
parents:
diff changeset
   322
    ].
177534def4c3 initial checkin
vrany
parents:
diff changeset
   323
177534def4c3 initial checkin
vrany
parents:
diff changeset
   324
    "/ If I have a cached preferredExtent value..
177534def4c3 initial checkin
vrany
parents:
diff changeset
   325
    preferredExtent notNil ifTrue:[
177534def4c3 initial checkin
vrany
parents:
diff changeset
   326
        ^ preferredExtent
177534def4c3 initial checkin
vrany
parents:
diff changeset
   327
    ].
177534def4c3 initial checkin
vrany
parents:
diff changeset
   328
13952
1b127aaddf33 class: XTermView
Stefan Vogel <sv@exept.de>
parents: 13913
diff changeset
   329
    ^(gc font width * 80) @ (gc font height * 25)
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   330
177534def4c3 initial checkin
vrany
parents:
diff changeset
   331
    "Modified: / 19-07-1996 / 20:43:32 / cg"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   332
    "Created: / 25-11-2010 / 12:51:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   333
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
   334
177534def4c3 initial checkin
vrany
parents:
diff changeset
   335
!XTermView methodsFor:'realization'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   336
177534def4c3 initial checkin
vrany
parents:
diff changeset
   337
postRealize
177534def4c3 initial checkin
vrany
parents:
diff changeset
   338
177534def4c3 initial checkin
vrany
parents:
diff changeset
   339
    super postRealize.
177534def4c3 initial checkin
vrany
parents:
diff changeset
   340
    XTermType ~= #rxvt ifTrue:[self sizeChanged: nil]
177534def4c3 initial checkin
vrany
parents:
diff changeset
   341
177534def4c3 initial checkin
vrany
parents:
diff changeset
   342
    "Created: / 25-11-2010 / 11:08:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   343
    "Modified: / 13-12-2010 / 22:08:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   344
!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   345
177534def4c3 initial checkin
vrany
parents:
diff changeset
   346
preRealize
177534def4c3 initial checkin
vrany
parents:
diff changeset
   347
    super preRealize.
13907
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
   348
    self startXTerm
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
   349
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
   350
    "Created: / 25-11-2010 / 10:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
   351
    "Modified: / 02-06-2011 / 23:27:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
   352
!
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
   353
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
   354
startXTerm
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   355
    clientViewId isNil ifTrue:[
13907
99bbb7660e97 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 13816
diff changeset
   356
        pid := OperatingSystem 
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   357
                exec:self xtermExecutable
177534def4c3 initial checkin
vrany
parents:
diff changeset
   358
                withArguments:self xtermArgs
177534def4c3 initial checkin
vrany
parents:
diff changeset
   359
                fork:true
177534def4c3 initial checkin
vrany
parents:
diff changeset
   360
                inDirectory: wd.
177534def4c3 initial checkin
vrany
parents:
diff changeset
   361
    ]
177534def4c3 initial checkin
vrany
parents:
diff changeset
   362
177534def4c3 initial checkin
vrany
parents:
diff changeset
   363
    "Created: / 25-11-2010 / 10:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   364
    "Modified: / 02-06-2011 / 23:27:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
177534def4c3 initial checkin
vrany
parents:
diff changeset
   365
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
   366
10704
015027d5c1a2 added: #isTextView (sent by recent WorkspaceApplication)
vrany
parents: 10263
diff changeset
   367
!XTermView methodsFor:'testing'!
015027d5c1a2 added: #isTextView (sent by recent WorkspaceApplication)
vrany
parents: 10263
diff changeset
   368
015027d5c1a2 added: #isTextView (sent by recent WorkspaceApplication)
vrany
parents: 10263
diff changeset
   369
isTextView
015027d5c1a2 added: #isTextView (sent by recent WorkspaceApplication)
vrany
parents: 10263
diff changeset
   370
13816
732c224bdfb9 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
   371
    ^true
10704
015027d5c1a2 added: #isTextView (sent by recent WorkspaceApplication)
vrany
parents: 10263
diff changeset
   372
015027d5c1a2 added: #isTextView (sent by recent WorkspaceApplication)
vrany
parents: 10263
diff changeset
   373
    "Created: / 13-09-2011 / 11:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
015027d5c1a2 added: #isTextView (sent by recent WorkspaceApplication)
vrany
parents: 10263
diff changeset
   374
! !
015027d5c1a2 added: #isTextView (sent by recent WorkspaceApplication)
vrany
parents: 10263
diff changeset
   375
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   376
!XTermView class methodsFor:'documentation'!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   377
14461
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   378
version
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   379
    ^ '$Header: /cvs/stx/stx/libtool/XTermView.st,v 1.10 2014-06-05 18:25:15 cg Exp $'
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   380
!
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   381
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   382
version_CVS
14461
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   383
    ^ '$Header: /cvs/stx/stx/libtool/XTermView.st,v 1.10 2014-06-05 18:25:15 cg Exp $'
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   384
!
177534def4c3 initial checkin
vrany
parents:
diff changeset
   385
177534def4c3 initial checkin
vrany
parents:
diff changeset
   386
version_SVN
14461
5dfe30926b88 class: XTermView
Claus Gittinger <cg@exept.de>
parents: 14460
diff changeset
   387
    ^ '$Id: XTermView.st,v 1.10 2014-06-05 18:25:15 cg Exp $'
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   388
! !
177534def4c3 initial checkin
vrany
parents:
diff changeset
   389
13790
743e45769350 class: XTermView
Stefan Vogel <sv@exept.de>
parents: 11831
diff changeset
   390
10263
177534def4c3 initial checkin
vrany
parents:
diff changeset
   391
XTermView initialize!