|
Class: CodeView
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--ListView
|
+--TextView
|
+--EditTextView
|
+--TextCollector
|
+--Workspace
|
+--CodeView
|
+--Tools::CodeView2::TextView
|
+--Tools::NewSystemBrowserCodeView
- Package:
- stx:libwidg
- Category:
- Views-Text
- Version:
- rev:
1.92
date: 2024/04/09 12:20:21
- user: stefan
- file: CodeView.st directory: libwidg
- module: stx stc-classLibrary: libwidg
a view for text which is known to be smalltalk code.
It adds 'explain' to the menu, and defines another action:
explainAction to be performed for explain.
This action is to be defined by the user of this view
(i.e. usually the owning browser)
In addition, uncomment/comment are added to the controlMenu.
These are smalltalk specific - if you plan to edit other language code,
you need a different kind of CodeView for that.
If used with a model, accept sends the changeMsg to it (as defined in EditTextView).
(however, it is possible to define both changeMsg and acceptAction)
See how doIt/printIt/inspectIt are handled in the superclass: Workspace.
Caveat:
in this version, CodeView does not yet support MVC setups for doIt
and explain.
If required, simulate this by setting the doItAction and
explainAction, to notify the model manually about whats going on.
[instance variables:]
commentStrings <Array> an array with 2 entries;
the first defining the EOL-comment string,
the 2nd (another array) defining opening
and closing comment strings.
Default to ST/X comments,
can be changed in an instance for other
programming languages.
copyrightCOPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
accessing
-
explainAction: aBlock
-
set the action to be performed on explain
-
formatAction: aBlock
-
set the action to be performed on format
-
pointerOverWordAction: aBlock
-
cursor handling
-
cursorReturn
-
(comment from inherited method)
move cursor to start of next line; scroll if at end of visible text
-
cursorReturn: withPossibleAutoindent
-
added an argument to disable autoindent, because this method is called from other
places as well (especially: the terminal emulator)...
event handling
-
buttonMotion: buttonState x: x y: y
-
line := self visibleLineOfY:y.
-
keyPress: key x: x y: y
-
catch keyboard shortcuts
menu & menu actions
-
accept
-
redefined accept action;
save cursor and selection to allow restore in case of an error
(we are typically compiling here ... and the compiler may show
errors by highlighting them)
-
editMenu
-
return the popUpMenu;
to make this independent from what is defined in superclasses,
get the superclass menu and add my functions.
-
explain
-
explain action;
evaluate the explainBlock passing whole contents and
selection as arguments.
-
format
-
format action;
evaluate the formatBlock passing whole contents as argument.
-
showLineLimitInMenu
-
(comment from inherited method)
false.
more do what I mean
-
checkPossiblyRepetitiveReplace: thisOriginal with: thisReplacement
-
check if user does something repetitive...
|