eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Tools::CodeView2':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: CodeView2 (in Tools)


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--Tools::CodeView2

Package:
stx:libtool
Category:
Interface-CodeView
Version:
rev: 1.327 date: 2024/04/09 12:34:04
user: stefan
file: Tools__CodeView2.st directory: libtool
module: stx stc-classLibrary: libtool

Description:


documentation to be added.

class:
    <a short class summary here, describing what instances represent>

responsibilities:    
    <describing what my main role is>

collaborators:    
    <describing with whom and how I talk to>

API:
    <public api and main messages>
    
example:
    <a one-line examples on how to use - can also be in a separate example method>

implementation:
    <implementation points>


[instance variables:]

[class variables:]

copyright

COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague All Rights Reserved Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Class protocol:

debugging
o  trace: aSelector

o  traceSelectors

o  untrace: aSelector

o  untraceAll

examples
o  example1

menu specs
o  debugMenu
This resource specification was automatically generated
by the MenuEditor of ST/X.

Usage example(s):

     MenuEditor new openOnClass:Tools::CodeView2 andSelector:#debugMenu
     (Menu new fromLiteralArrayEncoding:(Tools::CodeView2 debugMenu)) startUp

o  editMenu
This resource specification was automatically generated
by the MenuEditor of ST/X.

Usage example(s):

     MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu
     (Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu)) startUp

o  editMenu_eclipseStyle
This resource specification was automatically generated
by the MenuEditor of ST/X.

Usage example(s):

     MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu_eclipseStyle
     (Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu_eclipseStyle)) startUp

o  editMenu_stxStyle
This resource specification was automatically generated
by the MenuEditor of ST/X.

Usage example(s):

     MenuEditor new openOnClass:Tools::CodeView2 andSelector:#editMenu_stxStyle
     (Menu new fromLiteralArrayEncoding:(Tools::CodeView2 editMenu_stxStyle)) startUp

testing
o  hasOwnScrollbars
a hack for codeView2, which behaves like a TextView, but has its own
scrollbars embedded - sigh (an extra load one).
This allows for the UIBuilder to avoid creating an extra set around such
a view (as is the case with TextSpec with scrollbars when using CodeView2)


Instance protocol:

accessing
o  acceptAction: aBlock

o  acceptEnabled: aBoolean

o  breakpoints

o  browser

o  codeAspect

o  codeAspect: aSymbol
tell the textView what is shown, so it can adjust the
syntaxhighlighter.
See SyntaxHighlighter codeAspectXXX for possible aspects.

o  compareAction: aBlock

o  compilerClass

o  compilerClass: aClass

o  contents

o  contents: aStringOrStringCollection
self update:#value with: aStringOrStringCollection from: textView model

o  contents: aStringOrStringCollection clear: clearPrevious
Set the contents. If clearPrevous is true, then
previous original text is cleared and set to given one.
(so the text is considered not modified)

o  contentsWithoutEmphasis

o  currentParseNode

o  delegate: anObject
I want to see the events of the text and gutter view

o  diffMode

o  diffMode: aBoolean

o  editedMethodOrClass: aMethodOrClass
Sets the edited method or class (for code completion and highlighting)

o  font
return the current drawing font.
Forward from my textview

o  font: aFont
(comment from inherited method)
set the font for drawing if it has changed.
This should be redefined in some widget to perform an automatic
redraw/invalidate. See also: #basicFont:

o  mode

o  mode: aSymbol
is this the same as codeAspect ?

o  model
(comment from inherited method)
return nil - simpleViews have no model (only providing geometric)

o  model: newModel

o  modified
return true if text was modified

o  modified: aBoolean
set/clear the modified flag

o  services

o  services: aCollectionOfServices
allow setting of the services (instances);
this is needed for FileBrowser, to setup a codeView2 without Smalltalk-specific
services

o  servicesFromClient

o  showAcceptCancelBar

o  showGutter

o  simulatedContext: anObject
the context (or mimicri) to be used in doIts

o  simulatedSelf
the self to be used in doIts

o  simulatedSelf: anObject
the self to be used in doIts

o  smallLintRulesHolder: aHolder
if set, this is returned and the browser is not asked

o  synchronizeWith: aCodeView

o  unsynchronizeWith: aCodeView

o  xOriginOfContents
(comment from inherited method)
return the x coordinate of the viewOrigin in pixels;
used by scrollBars to compute thumb position within the document.

o  yOriginOfContents
(comment from inherited method)
return the y coordinate of the viewOrigin in pixels;
used by scrollBars to compute thumb position within the document.

accessing-behavior
o  expandTabsWhenUpdating
return the tab expansion behavior.
If true (the default), the list of lines as given via #list: or
due to a model update is processed and lines are replaced by lines with
tabs expanded.
This behavior is ok in 99.99% of all applications.
However, you may turn this off iff:
- you are certain, that no tabs are in the passed in list
- it is very expensive to process the list (for example, because the list
is defined by a virtual array, which computes the lines dynamically, on the fly).
One use where this flag should be turned off is in the hex-memory display,
which is able to simulate texts with millions of lines, but they are actually
simulated by generating the presented lines dynamically, as they are displayed.
Notice, that to totally prevent scanning og the whole text, you may have to turn off
other flags, such as checkineEndConventionWhenUpdating

o  expandTabsWhenUpdating: aBoolean
define the tab expansion behavior.
If true (the default), the list of lines as given via #list: or
due to a model update is processed and lines are replaced by lines with
tabs expanded.
This behavior is ok in 99.99% of all applications.
However, you may turn this off iff:
- you are certain, that no tabs are in the passed in list
- it is very expensive to process the list (for example, because the list
is defined by a virtual array, which computes the lines dynamically, on the fly).
One use where this flag should be turned off is in the hex-memory display,
which is able to simulate texts with millions of lines, but they are actually
simulated by generating the presented lines dynamically, as they are displayed.
Notice, that to totally prevent scanning og the whole text, you may have to turn off
other flags, such as checkineEndConventionWhenUpdating

o  readOnly: aBoolean
ignored here; present for compatibility with some textView subclasses,
so that UIPainter can handle it in its TextView spec (which contains a
readOnly field)

accessing-code component
o  editedLanguage
marked as obsolete by exept MBP at 16-09-2021

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  editedLanguage: aProgrammingLanguage
marked as obsolete by exept MBP at 16-09-2021

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  klass
the class or the class of the method being shown.

o  klass: aClass
the class or the class of the method being shown

o  language
marked as obsolete by exept MBP at 16-09-2021

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  language: newValue
marked as obsolete by exept MBP at 16-09-2021

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  method
the method being shown, or nil

o  method: aMethod
the method being shown, or nil

o  programmingLanguage
return the value in 'languageHolder', the programmingLanguage of the class
or method being shown.

o  programmingLanguage: aProgrammingLanguage
Sets the edited (programming) language.

accessing-look
o  backgroundColor: aColor
(comment from inherited method)
set the background color of the contents -
here, (since there is no contents), the viewBackground is changed.

o  viewBackground: aColor
Modified (format): / 12-02-2017 / 12:58:44 / cg

aspects
o  browserHolder

o  browserHolder: aValueModel

o  classHolder
return/create the 'classHolder' value holder (automatically generated)

o  classHolder: aValueModel
set the 'classHolder' value holder (automatically generated)

o  currentBlockNodeHolder
return/create the 'currentBlockNodeHolder' value holder (automatically generated)

o  currentBlockNodeHolder: something
set the 'currentBlockNodeHolder' value holder (automatically generated)

o  currentParseNodeHolder
return/create the 'currentParseNodeHolder' value holder (automatically generated)

o  currentParseNodeHolder: something
set the 'currentParseNodeHolder' value holder (automatically generated)

o  languageHolder
cg: I don't like the smalltalk default here, because everyone who is not showing ST-code (expecco, filebrowser etc.)

o  languageHolder: aValueModel
set the 'languageHolder' value holder (automatically generated)

o  methodHolder
return/create the 'methodHolder' value holder (automatically generated)

o  methodHolder: aValueModel
set the 'methodHolder' value holder (automatically generated)

o  modeHolder
return/create the 'modeHolder' value holder (automatically generated)

o  modeHolder: something
set the 'modeHolder' value holder (automatically generated)

o  smalllintRulesHolder

change & update
o  update: aspect with: param from: sender
languageHolder value class == Workflow::ExecutionEditorShellScript::Shell_Language ifTrue:[self halt].

o  updateGutter

o  updateGutterVisibility

o  updateScrollersViewBackground
this changes the scroller's background, to show the positions of
warnings, for easy location of interesting spots

channels
o  modifiedChannel
return the valueHolder holding true if text was modified

Usage example(s):

^ modifiedChannel

o  modifiedChannel: aValueHolder
set the valueHolder holding true if text was modified

o  reallyModifiedChannel
return the valueHolder holding true if text was modified

o  reallyModifiedChannel: aValueModel

o  showAcceptCancelBarChannel

o  showAcceptCancelBarChannel: aValueHolder
set the valueHolder holding true if the accept-cancel bar is to be shown

o  showGutterChannel

o  showGutterChannel: aValueHolder
set the valueHolder holding true if the gutter is to be shown

code services
o  browseMethod: method

o  browseMethod: method label: label

o  browseMethods: methods label: label

o  extractSelectorAndSelectedTextFrom: givenSelectedText
self windowGroup withWaitCursorDo:[

o  implementorsOf: selector

o  implementorsOf: selector in: listOfClasses

o  sendersOf: selector
not exact, but much faster (looks for symbol only, does not parse code for real send)

delegation
o  commentStrings: anArrayOfCommentStrings

o  doesNotUnderstand: aMessage
(comment from inherited method)
this message is sent by the runtime system (VM) when
a message is not understood by some object (i.e. there
is no method for that selector). The original message has
been packed into aMessage (i.e. the receiver, selector and
any arguments) and the original receiver is then sent the
#doesNotUnderstand: message.
Here, we raise another signal which usually enters the debugger.
You can of course redefine #doesNotUnderstand: in your classes
to implement message delegation,
or handle the MessageNotUnderstood exception gracefully.

o  executeDoIt: theCode

o  hasSelection
true if there us a text selection

o  takeFocus
(comment from inherited method)
Unconditionally take the focus from my windowGroup

o  textFromCharacterPosition: start to: end

o  trimBlankLines: shouldTrimBoolean

o  trimLastCR: shouldTrimBoolean

delegation-drawing
o  drawLine: lineNo in: view atX: x y: yBaseline width: w height: hFont ascent: aFont from: startCol to: endColOrNil with: fg and: bg
See the comment in
CodeViewService>>drawLine:in:atX...

o  redrawVisibleLine: visLineNr

o  redrawVisibleLine: visLine col: colNr

o  redrawVisibleLine: visLine from: startCol

o  redrawVisibleLine: visLine from: startCol to: endCol

delegation-events
o  buttonMotion: button x: x y: y in: view
Delegates events to services. Answers true iff at least
one service handler method returns true. In that case,
the event is is NOT processes by the view.

o  buttonMultiPress: button x: x y: y in: view
Delegates events to services. Answers true iff at least
one service handler method returns true. In that case,
the event is is NOT processes by the view.

o  buttonPress: button x: x y: y in: view
Possibly delegate event a service.
Answers true (i.e. event was handled) iff at least
one service handler method returns true.
In that case, the event is is NOT processes by the view.
Notice, that this is called both for events in the gutter AND for events in the text.

o  buttonRelease: button x: x y: y in: view
Delegates events to services. Answers true iff at least
one service handler method returns true. In that case,
the event is is NOT processes by the view.

o  highlightClassVariable: varName
interface from browser (when a class var is selected)

o  highlightInstanceVariable: varName
interface from browser (when an inst var is selected)

o  highlightVariableNamed: varName
interface for whoever likes it

o  keyPress: key x: x y: y in: view
Delegates events to services. Answers true iff at least
one service handler method returns true. In that case,
the event is is NOT processes by the view.

o  keyRelease: key x: x y: y in: view
Delegates events to services. Answers true iff at least
one service handler method returns true. In that case,
the event is is NOT processes by the view.

o  linesDeletedFrom: start to: end

o  linesInsertedFrom: start to: end

o  linesModifiedFrom: start to: end

o  scrollDown: nLines in: view
my text view scrolled...

o  scrollTo: origin redraw: doRedraw in: view
my text view scrolled...

o  scrollUp: nLines in: view
my text view scrolled...

diff mode
o  recomputeDiff: view

initialize & release
o  defaultServices
used to call "CodeViewService availableServices",

o  initialize
Invoked when a new instance is created.

Usage example(s):

initialize methods

o  initializeGutterViewIn: parentView

o  initializeServices
only do it, if the services have not yet been defined by the user of this view

o  initializeTextView
Initialize textView. gutterView has to be already initialized!

o  release
(comment from inherited method)
remove all dependencies from the receiver

o  scrollable: aBoolean
must be called before initailized (i.e. after basicNew),
to suppress the scrollbar. Useful for synced2TextView,
which wants a single scrollbar for multiple views.

menu actions
o  accept
(comment from inherited method)
accept the current contents by executing the accept-action and/or changeMessage.

o  again

o  browseImplementorsOfIt

o  browseSendersOfIt

o  copySelection

o  copySelectionBox

o  cut

o  doIt

o  inspectIt

o  inspectSelectedSelector

o  inspectSyntaxElements

o  inspectView

o  pasteOrReplace

o  pasteOrReplaceFromHistory

o  printIt

o  profileIt

o  undo

menus-dynamic
o  debugMenu

o  editMenu
install the standard 'more' menu into my own menu

o  implementorsMenu
self windowGroup withWaitCursorDo:[

o  implementorsMenu: implementors selector: selector

o  sendersMenu
self windowGroup withWaitCursorDo:[

o  sendersMenu: senders selector: selector

o  servicesMenu
disabled, because this menu is now on the gutter,

private
o  codeCompletion
I found this code 3 times (CodeView2, NewSystemBrowser and DebugView) - smells a lot!

o  reallyModified
check for modified code by comparing the source against
the codeView's contents.
That's the true modified value
(in case user undid his changes, and the displayed text is actually original)

o  showInfo: message

private-accessing
o  gutterView

o  syntaxElementSelection

o  syntaxElementSelection: anElement
anElement isNil ifTrue:[

o  syntaxElements

o  syntaxElements: aCollection

o  textView
return my textView component

o  textViewScroller
may be nil, if my textview is unscolled

queries-contents
o  heightOfContents
(comment from inherited method)
return the height of the contents in logical units
- defaults to view's visible area here.
This method MUST be redefined in all view classess which are
going to be scrolled AND show data which has different size than
the view. For example, a view showing A4-size documents should return
the number of vertical pixels such a document has on this device.
A view showing a bitmap of height 1000 should return 1000.
If not redefined, scrollbars have no way of knowing the actual size
of the contents being shown. This is called by scrollBars to compute
the relative height of the document vs. the view's actual size.
The value returned here must be based on a scale of 1, since users
of this will scale as appropriate.

o  widthOfContents
(comment from inherited method)
return the width of the contents in logical units
- defaults to views visible area here.
This method MUST be redefined in all view classess which are
going to be scrolled AND show data which has different size than
the view. For example, a view showing A4-size documents should return
the number of horizontal pixels such a document has on this device.
A view showing a bitmap of width 500 should return 500.
If not redefined, scrollbars have no way of knowing the actual size
of the contents being shown. This is called by scrollBars to compute
the relative width of the document vs. the view's actual width.
The value returned here must be based on a scale of 1, since users
of this will scale as appropriate.

realization
o  disableAllServices

o  enableAllServices

o  postRealize
(comment from inherited method)
invoked after a view was realized.
Can be redefined in subclasses to perform delayed actions.

redrawing
o  clearScrollbarBackground
immediate change the scroller to showing nothing;

o  flash
(comment from inherited method)
flash the view - fill it black, then white, finally
redraw completely.
Can be used to wakeup the user :-)
when problem or warning conditions arise.
Someone may redefine this to flash its contents (instead of black/white).

o  flash: aString
flash the view and show aString for a moment.

o  flash: messageOrNil withColor: flashColor
delegated to my textview

scrolling
o  horizontalScrollStep
(comment from inherited method)
return the amount to scroll when stepping left/right.
Subclasses may want to redefine this.

o  scrollDown: nLines
(comment from inherited method)
change origin to scroll down some pixels

o  scrollDownLines: nLines

o  scrollHorizontalToPercent: p
(comment from inherited method)
scroll to a position given in percent of total

o  scrollLeft
(comment from inherited method)
scroll left by some amount; this is called when the scrollbars
scroll-step left button is pressed.

o  scrollLeft: nPixels
(comment from inherited method)
change origin to scroll left some pixels

o  scrollRight
(comment from inherited method)
scroll right by some amount; this is called when the scrollbars
scroll-step right button is pressed.

o  scrollRight: nPixels
(comment from inherited method)
change origin to scroll right some pixels

o  scrollTo: newOrigin
(comment from inherited method)
change origin to have newOrigin be visible at the top-left.
The argument defines the integer device coordinates of the new top-left
point.

o  scrollToLine: lineNr

o  scrollUp: nLines
(comment from inherited method)
change origin to scroll up (towards the origin) by some pixels

o  scrollUpLines: nLines

o  scrollVerticalToPercent: p
(comment from inherited method)
scroll to a position given in percent of total

o  verticalScrollStep
(comment from inherited method)
return the amount to scroll when stepping up/down (also used for mouseWheel).
Subclasses may want to redefine this.

o  viewOrigin
(comment from inherited method)
return the viewOrigin; that's the coordinate of the contents
which is shown topLeft in the view
(i.e. the origin of the visible part of the contents).

services
o  breakpointService
that one or nil

o  breakpointService: newServiceOrNil
set the breakpoint service

o  hasBreakpointService

o  hasBreakpoints

o  inspectBreakpoints

o  lintService
prefers the smallsense-lint service over others

o  registerService: aCodeViewService

o  servicesDo: aBlock

o  syntaxHighlightingService
that one or nil

o  unregisterAllServices

o  unregisterService: aCodeViewService

testing
o  isCodeView2
(comment from inherited method)
codeview2 seems to require some extra hacks

o  isReadOnly
(comment from inherited method)
stupid default - there are queries for this in keyboardProcessor

o  isTextView
(comment from inherited method)
Returns true, if the view displays text


Private classes:

    AnnotationShowingScrollerBackground
    GutterView
    TextView


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:49:45 GMT