TerminalView.st
changeset 979 32f75cd56edc
parent 977 785c3ad4eff1
child 985 275897f12b52
equal deleted inserted replaced
978:8f6dee49a562 979:32f75cd56edc
   218     or:[prevNLines ~~ nFullLinesShown]) ifTrue:[
   218     or:[prevNLines ~~ nFullLinesShown]) ifTrue:[
   219         self defineWindowSize.
   219         self defineWindowSize.
   220     ]
   220     ]
   221 
   221 
   222     "Created: / 12.6.1998 / 22:34:39 / cg"
   222     "Created: / 12.6.1998 / 22:34:39 / cg"
   223     "Modified: / 12.6.1998 / 22:35:38 / cg"
   223     "Modified: / 20.6.1998 / 19:45:28 / cg"
   224 !
   224 !
   225 
   225 
   226 defineWindowSize
   226 defineWindowSize
   227     inStream notNil ifTrue:[
   227     inStream notNil ifTrue:[
   228         (OperatingSystem 
   228         (OperatingSystem 
   230             width:(innerWidth // font width)
   230             width:(innerWidth // font width)
   231             height:(nFullLinesShown)) ifFalse:[
   231             height:(nFullLinesShown)) ifFalse:[
   232 "/            Transcript showCR:'VT100: cannot change windowSize'.
   232 "/            Transcript showCR:'VT100: cannot change windowSize'.
   233         ].
   233         ].
   234         numberOfLines := nFullLinesShown.
   234         numberOfLines := nFullLinesShown.
       
   235 "/        Transcript showCR:'VT100: changed len to ', numberOfLines printString.
   235     ].
   236     ].
   236     shellPid notNil ifTrue:[
   237     shellPid notNil ifTrue:[
   237         OperatingSystem sendSignal:OperatingSystem sigWINCH to:shellPid
   238         OperatingSystem sendSignal:OperatingSystem sigWINCH to:shellPid
   238     ]
   239     ]
   239 
   240 
   240     "Created: / 11.6.1998 / 22:51:39 / cg"
   241     "Created: / 11.6.1998 / 22:51:39 / cg"
   241     "Modified: / 17.6.1998 / 16:18:59 / cg"
   242     "Modified: / 20.6.1998 / 20:29:13 / cg"
   242 !
   243 !
   243 
   244 
   244 keyPress:aKey x:x y:y
   245 keyPress:aKey x:x y:y
   245     |rest rawKey seq|
   246     |rest rawKey seq|
   246 
   247 
   362 
   363 
   363     l := self listAt:cursorLine.
   364     l := self listAt:cursorLine.
   364     (l size >= (cursorCol-1)) ifTrue:[
   365     (l size >= (cursorCol-1)) ifTrue:[
   365         l notNil ifTrue:[
   366         l notNil ifTrue:[
   366             l := l copyTo:cursorCol-1.
   367             l := l copyTo:cursorCol-1.
   367             self at:cursorLine put:l.
   368             self withoutRedrawAt:cursorLine put:l.
       
   369             self invalidateLine:cursorLine
       
   370             "/ self at:cursorLine put:l.
   368         ]
   371         ]
   369     ]
   372     ]
   370 
   373 
   371     "Created: / 10.6.1998 / 14:45:01 / cg"
   374     "Created: / 10.6.1998 / 14:45:01 / cg"
   372     "Modified: / 12.6.1998 / 22:27:54 / cg"
   375     "Modified: / 20.6.1998 / 19:10:21 / cg"
   373 !
   376 !
   374 
   377 
   375 doCursorDown:n
   378 doCursorDown:n
   376     |wasOn|
   379     |wasOn rEnd|
   377 
   380 
   378     cursorLine + 1 - firstLineShown + n > rangeEndLine ifFalse:[
   381 "/    rangeEndLine == numberOfLines ifTrue:[
       
   382 "/        ^ super cursorDown:n
       
   383 "/    ].
       
   384     cursorLine + 1 - firstLineShown + n <= rangeEndLine ifTrue:[
   379         "/ no special action req'd
   385         "/ no special action req'd
   380         ^ super cursorDown:n
   386         ^ super cursorDown:n
   381     ].
   387     ].
       
   388 
   382     n timesRepeat:[
   389     n timesRepeat:[
   383         wasOn := self hideCursor.
   390         wasOn := self hideCursor.
   384         cursorVisibleLine == rangeEndLine ifTrue:[
   391         rEnd := rangeEndLine+firstLineShown-1.
   385             self deleteLine:rangeStartLine.
   392         cursorLine ==  rEnd ifTrue:[
   386             self insertLine:'' before:rangeEndLine
   393             self deleteLine:(rangeStartLine+firstLineShown-1).
       
   394             self insertLine:'' before:rEnd.
   387         ] ifFalse:[
   395         ] ifFalse:[
   388             super cursorDown
   396             super cursorDown
   389         ].
   397         ].
   390         self makeCursorVisibleAndShowCursor:wasOn.
   398         wasOn ifTrue:[self showCursor]. "/ self makeCursorVisibleAndShowCursor:wasOn.
   391     ]
   399     ]
   392 
   400 
   393     "Modified: / 18.6.1998 / 14:30:07 / cg"
   401     "Modified: / 20.6.1998 / 20:29:39 / cg"
   394 !
   402 !
   395 
   403 
   396 doCursorHome
   404 doCursorHome
   397     self cursorVisibleLine:1 col:1
   405     self cursorVisibleLine:1 col:1
   398     "/ super cursorHome
   406     "/ super cursorHome
   423 
   431 
   424     "Created: / 10.6.1998 / 15:10:08 / cg"
   432     "Created: / 10.6.1998 / 15:10:08 / cg"
   425 !
   433 !
   426 
   434 
   427 doCursorUp:n
   435 doCursorUp:n
   428     |wasOn|
   436     |wasOn rStart|
   429 
   437 
   430     cursorLine + 1 - firstLineShown - n < rangeStartLine ifFalse:[
   438 "/    rangeStartLine == 1 ifTrue:[
       
   439 "/        ^ super cursorUp:n
       
   440 "/    ].
       
   441     cursorLine + 1 - firstLineShown - n >= rangeStartLine ifTrue:[
   431         "/ no special action req'd
   442         "/ no special action req'd
   432         ^ super cursorUp:n
   443         ^ super cursorUp:n
   433     ].
   444     ].
   434     n timesRepeat:[
   445     n timesRepeat:[
   435         wasOn := self hideCursor.
   446         wasOn := self hideCursor.
   436         cursorVisibleLine == rangeStartLine ifTrue:[
   447         rStart := rangeStartLine+firstLineShown-1.
   437             rangeEndLine <= list size ifTrue:[
   448         cursorLine == rStart ifTrue:[
   438                 self deleteLine:rangeEndLine.
   449             (rangeEndLine+firstLineShown-1) <= list size ifTrue:[
   439                 self insertLine:'' before:rangeStartLine
   450                 self deleteLine:(rangeEndLine+firstLineShown-1).
   440             ]
   451                 self insertLine:'' before:rStart.
       
   452             ].
   441         ] ifFalse:[
   453         ] ifFalse:[
   442             super cursorUp
   454             super cursorUp
   443         ].
   455         ].
   444         self makeCursorVisibleAndShowCursor:wasOn.
   456         self makeCursorVisibleAndShowCursor:wasOn.
   445     ]
   457     ]
   446 
   458 
   447     "Created: / 11.6.1998 / 22:29:46 / cg"
   459     "Created: / 11.6.1998 / 22:29:46 / cg"
   448     "Modified: / 20.6.1998 / 17:35:09 / cg"
   460     "Modified: / 20.6.1998 / 20:30:34 / cg"
   449 !
   461 !
   450 
   462 
   451 doSendInterrupt
   463 doSendInterrupt
   452     OperatingSystem sendSignal:(OperatingSystem sigINT) to:shellPid negated.
   464     OperatingSystem sendSignal:(OperatingSystem sigINT) to:shellPid negated.
   453 
   465 
   540     collectSize := 100.
   552     collectSize := 100.
   541     st80Mode := false.
   553     st80Mode := false.
   542     trimBlankLines := true.
   554     trimBlankLines := true.
   543 
   555 
   544     numberOfColumns := 80.
   556     numberOfColumns := 80.
   545     numberOfLines := 25.
   557     numberOfLines := 24.
   546     rangeStartLine := 1.
   558     rangeStartLine := 1.
   547     rangeEndLine := numberOfLines.
   559     rangeEndLine := numberOfLines.
   548 
   560 
   549     self initializeKeyboardSequences.
   561     self initializeKeyboardSequences.
   550     list := OrderedCollection new:24 withAll:''.
   562     list := OrderedCollection new:24 withAll:''.
   554     "
   566     "
   555      VT52TerminalView openShell
   567      VT52TerminalView openShell
   556      VT100TerminalView openShell
   568      VT100TerminalView openShell
   557     "
   569     "
   558 
   570 
   559     "Modified: / 20.6.1998 / 18:21:19 / cg"
   571     "Modified: / 20.6.1998 / 20:06:49 / cg"
   560 !
   572 !
   561 
   573 
   562 initializeKeyboardMap
   574 initializeKeyboardMap
   563     |ctrlKeys cmdKeys|
   575     |ctrlKeys cmdKeys|
   564 
   576 
   794     ].
   806     ].
   795 
   807 
   796     (self sensor hasEvent:#processInput:n: for:self) ifFalse:[
   808     (self sensor hasEvent:#processInput:n: for:self) ifFalse:[
   797         self endEntry.
   809         self endEntry.
   798         self showCursor.
   810         self showCursor.
   799         self makeCursorVisible.
   811         "/ self makeCursorVisible.
   800     ].
   812     ].
   801 
   813 
   802     "Created: / 10.6.1998 / 17:26:09 / cg"
   814     "Created: / 10.6.1998 / 17:26:09 / cg"
   803     "Modified: / 17.6.1998 / 16:16:04 / cg"
   815     "Modified: / 20.6.1998 / 19:18:07 / cg"
   804 ! !
   816 ! !
   805 
   817 
   806 !TerminalView methodsFor:'queries'!
   818 !TerminalView methodsFor:'queries'!
   807 
   819 
   808 preferredExtent
   820 preferredExtent
   809     ^ (fontWidth * numberOfColumns + (leftMargin * 2))
   821     ^ (fontWidth * numberOfColumns + (leftMargin * 2))
   810       @ 
   822       @ 
   811       (self heightForLines:25)
   823       ((self heightForLines:numberOfLines) + 8)
   812 
   824 
   813     "Modified: / 12.6.1998 / 22:37:30 / cg"
   825     "Modified: / 20.6.1998 / 20:06:57 / cg"
   814 !
   826 !
   815 
   827 
   816 terminalType
   828 terminalType
   817     ^ #dump
   829     ^ #dump
   818 
   830 
   850 ! !
   862 ! !
   851 
   863 
   852 !TerminalView class methodsFor:'documentation'!
   864 !TerminalView class methodsFor:'documentation'!
   853 
   865 
   854 version
   866 version
   855     ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.42 1998-06-20 16:21:30 cg Exp $'
   867     ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.43 1998-06-20 18:31:05 cg Exp $'
   856 ! !
   868 ! !