--- a/Tools__CodeView2.st Wed Feb 05 19:56:55 2014 +0100
+++ b/Tools__CodeView2.st Wed Feb 05 19:56:57 2014 +0100
@@ -32,6 +32,7 @@
classHolder browserHolder codeAspect modifiedChannel
showGutterChannel showAcceptCancelBarChannel modeHolder
serviceManager services servicesFromClient syntaxElements
+ currentParseNodeHolder currentBlockNodeHolder
syntaxElementSelection highlightEmphasis diffMode
synchronizedCodeViews'
classVariableNames:'TraceSelectors'
@@ -42,7 +43,8 @@
SimpleView subclass:#GutterView
instanceVariableNames:'codeView textView textViewScroller widthAcceptCancel
widthAnnotations widthDiffInfo numberOfLines acceptColor
- cancelColor diffColor menuHolder showLineNumbers'
+ cancelColor diffColor menuHolder currentBlockNodeHolder
+ showLineNumbers'
classVariableNames:''
poolDictionaries:''
privateIn:CodeView2
@@ -222,126 +224,113 @@
<resource: #menu>
- ^
+ ^
#(Menu
- (
- (MenuItem
- label: 'Implementors...'
- itemValue: browseImplementorsOfIt
- translateLabel: true
- submenuChannel: implementorsMenu
- shortcutKey: ImplementorsOfIt
- )
- (MenuItem
- label: 'Senders...'
- itemValue: browseSendersOfIt
- translateLabel: true
- submenuChannel: sendersMenu
- shortcutKey: SendersOfIt
- )
- (MenuItem
- label: 'Refactor'
- nameKey: refactor
- translateLabel: true
- isVisible: false
- shortcutKey: Shift
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'Accept'
- itemValue: accept
- translateLabel: true
- shortcutKey: Accept
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'Cut'
- itemValue: cut
- translateLabel: true
- shortcutKey: Cut
- )
- (MenuItem
- label: 'Copy'
- itemValue: copySelection
- translateLabel: true
- shortcutKey: Copy
- )
- (MenuItem
- label: 'Paste'
- itemValue: pasteOrReplace
- translateLabel: true
- shortcutKey: Paste
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'Undo'
- itemValue: undo
- translateLabel: true
- shortcutKey: Undo
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'Do it'
- itemValue: doIt
- translateLabel: true
- shortcutKey: DoIt
- )
- (MenuItem
- label: 'Print it'
- itemValue: printIt
- translateLabel: true
- shortcutKey: PrintIt
- )
- (MenuItem
- label: 'Inspect it'
- itemValue: inspectIt
- translateLabel: true
- shortcutKey: InspectIt
- )
- (MenuItem
- label: 'Profile it'
- itemValue: profileIt
- translateLabel: true
- shortcutKey: InspectIt
- )
- (MenuItem
- label: '-'
- )
- (MenuItem
- label: 'Show Gutter'
- nameKey: ShowGutter
- translateLabel: true
- indication: showGutterChannel
- )
- (MenuItem
- label: 'More'
- nameKey: More
- translateLabel: true
- )
- (MenuItem
- label: 'Services'
- translateLabel: true
- submenuChannel: servicesMenu
- )
- (MenuItem
- label: 'Debug'
- translateLabel: true
- submenuChannel: debugMenu
- )
- )
- nil
- nil
+ (
+ (MenuItem
+ label: 'Implementors...'
+ itemValue: browseImplementorsOfIt
+ submenuChannel: implementorsMenu
+ shortcutKey: ImplementorsOfIt
+ )
+ (MenuItem
+ label: 'Senders...'
+ itemValue: browseSendersOfIt
+ submenuChannel: sendersMenu
+ shortcutKey: SendersOfIt
+ )
+ (MenuItem
+ label: 'Refactor'
+ nameKey: refactor
+ isVisible: false
+ shortcutKey: Shift
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Accept'
+ itemValue: accept
+ shortcutKey: Accept
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Cut'
+ itemValue: cut
+ shortcutKey: Cut
+ )
+ (MenuItem
+ label: 'Copy'
+ itemValue: copySelection
+ shortcutKey: Copy
+ )
+ (MenuItem
+ label: 'Paste'
+ itemValue: pasteOrReplace
+ shortcutKey: Paste
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Undo'
+ itemValue: undo
+ shortcutKey: Undo
+ )
+ (MenuItem
+ label: 'Redo'
+ itemValue: redo
+ shortcutKey: Redo
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Do it'
+ itemValue: doIt
+ shortcutKey: DoIt
+ )
+ (MenuItem
+ label: 'Print it'
+ itemValue: printIt
+ shortcutKey: PrintIt
+ )
+ (MenuItem
+ label: 'Inspect it'
+ itemValue: inspectIt
+ shortcutKey: InspectIt
+ )
+ (MenuItem
+ label: 'Profile it'
+ itemValue: profileIt
+ shortcutKey: InspectIt
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ label: 'Show Gutter'
+ nameKey: ShowGutter
+ indication: showGutterChannel
+ )
+ (MenuItem
+ label: 'More'
+ nameKey: More
+ )
+ (MenuItem
+ label: 'Services'
+ submenuChannel: servicesMenu
+ )
+ (MenuItem
+ label: 'Debug'
+ submenuChannel: debugMenu
+ )
+ )
+ nil
+ nil
)
-
- "Modified: / 08-03-2012 / 12:36:18 / cg"
!
editMenu_stxStyle
@@ -459,6 +448,14 @@
"Modified: / 02-03-2012 / 19:53:19 / cg"
! !
+!CodeView2 methodsFor:'* As yet uncategorized *'!
+
+defaultFileNameForSave
+ self halt:'please define defaultFileNameForSave here'.
+
+ "Created: / 11-05-2012 / 15:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CodeView2 methodsFor:'accessing'!
acceptAction:aBlock
@@ -501,6 +498,18 @@
"Modified: / 27-09-2013 / 10:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+compilerClass
+ ^textView compilerClass
+
+ "Created: / 10-05-2012 / 23:47:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+compilerClass: aClass
+ textView compilerClass: aClass
+
+ "Created: / 10-05-2012 / 23:47:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
contents
^textView contents
@@ -516,6 +525,33 @@
"Modified: / 19-07-2011 / 13:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+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)"
+
+ textView contents: aStringOrStringCollection clear: clearPrevious
+
+ "Modified: / 19-07-2011 / 13:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 17-02-2012 / 00:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+currentParseNode
+
+ ^self currentParseNodeHolder value
+
+ "Created: / 21-02-2012 / 14:20:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+delegate: anObject
+
+ super delegate: anObject.
+ self textView delegate: anObject.
+ self gutterView delegate: anObject.
+
+ "Created: / 11-05-2012 / 10:29:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
diffMode
^ diffMode
!
@@ -579,19 +615,19 @@
|oldValue newValue|
textView model notNil ifTrue:[
- oldValue := textView model value.
- textView model removeDependent:self.
+ oldValue := textView model value.
+ textView model removeDependent:self.
].
textView model: aValueModel.
textView model notNil ifTrue:[
- textView model addDependent:self.
+ textView model addDependent:self.
].
newValue := textView model value.
oldValue ~~ newValue ifTrue:[
- self update:#value with:newValue from:textView model.
+ self update:#value with:newValue from:textView model.
].
- "Modified: / 27-07-2011 / 12:58:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 17-03-2012 / 16:11:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
modified
@@ -658,9 +694,20 @@
"Created: / 06-04-2010 / 14:13:14 / Jakub <zelenja7@fel.cvut.cz>"
"Modified: / 23-06-2010 / 17:01:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+unsynchronizeWith: aCodeView
+
+ self assert: aCodeView ~= self.
+ (synchronizedCodeViews includes: aCodeView) ifFalse:[^self].
+ synchronizedCodeViews := synchronizedCodeViews copyWithout: aCodeView.
+
+ "Created: / 06-04-2010 / 14:13:14 / Jakub <zelenja7@fel.cvut.cz>"
+ "Modified: / 23-06-2010 / 17:01:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 19-03-2012 / 14:25:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-!CodeView2 methodsFor:'accessing-code component'!
+!CodeView2 methodsFor:'accessing - code component'!
klass
| v |
@@ -668,11 +715,13 @@
(v := self classHolder value) notNil ifTrue:[^v].
(v := self method) notNil ifTrue:[^v mclass].
- ^UndefinedObject
+ ^nil
"Created: / 27-07-2011 / 13:14:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 22-07-2013 / 13:34:05 / cg"
-!
+! !
+
+!CodeView2 methodsFor:'accessing-code component'!
klass: aClass
@@ -768,6 +817,39 @@
"Modified: / 17-06-2011 / 12:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+currentBlockNodeHolder
+ "return/create the 'currentBlockNodeHolder' value holder (automatically generated)"
+
+ currentBlockNodeHolder isNil ifTrue:[
+ currentBlockNodeHolder := ValueHolder new.
+ ].
+ ^ currentBlockNodeHolder
+!
+
+currentBlockNodeHolder:something
+ "set the 'currentBlockNodeHolder' value holder (automatically generated)"
+
+ currentBlockNodeHolder := something.
+!
+
+currentParseNodeHolder
+ "return/create the 'currentParseNodeHolder' value holder (automatically generated)"
+
+ currentParseNodeHolder isNil ifTrue:[
+ currentParseNodeHolder := ValueHolder new.
+ ].
+ ^ currentParseNodeHolder
+!
+
+currentParseNodeHolder:something
+ "set the 'currentParseNodeHolder' value holder (automatically generated)"
+
+ currentParseNodeHolder := something.
+ gutterView notNil ifTrue:[ gutterView currentBlockNodeHolder: currentBlockNodeHolder ].
+
+ "Modified: / 16-02-2012 / 23:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
languageHolder
languageHolder isNil ifTrue:[
"/ cg: I dont like the smalltalk default here, because everyone who is not showing ST-code (expecco, filebrowser etc.)
@@ -884,28 +966,32 @@
sender == methodHolder ifTrue:[
- textView editedMethodOrClass: methodHolder value.
+ textView editedMethodOrClass: methodHolder value.
].
sender == classHolder ifTrue:[
- methodHolder value isNil ifTrue:[
- textView editedMethodOrClass: classHolder value.
- ].
+ methodHolder value isNil ifTrue:[
+ textView editedMethodOrClass: classHolder value.
+ ].
].
sender == languageHolder ifTrue:[
- textView editedLanguage: languageHolder value.
+ textView editedLanguage: languageHolder value.
+ ].
+
+ sender == modeHolder ifTrue:[
+ codeAspect := modeHolder value
].
sender == showGutterChannel ifTrue: [
- self updateGutterVisibility.
- ^self.
+ self updateGutterVisibility.
+ ^self.
].
- services do:[:each |
- each isEnabled ifTrue:[
- each update:aspect with:param from:sender
- ]
+ services do:[:each |
+ each isEnabled ifTrue:[
+ each update:aspect with:param from:sender
+ ]
].
super update:aspect with:param from:sender
@@ -1116,11 +1202,10 @@
senderBlock == false ifTrue:[ ^ #() ].
^ SystemBrowser
- allMethodsIn:Smalltalk allClasses
- where:senderBlock.
-
- "/ exact, but much slower
- "/ (parses code to see if this is really a send or only a symbol reference)
+ allMethodsIn:Smalltalk allClasses
+ where:senderBlock.
+
+ "/ exact, but much slower
"/ ^SystemBrowser
"/ findSendersOf: selector
"/ in: Smalltalk allClasses
@@ -1151,6 +1236,38 @@
"Created: / 14-02-2010 / 09:53:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CodeView2 methodsFor:'delegation - events'!
+
+buttonPress: 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."
+
+ ^ services
+ contains:[:service |
+ service isEnabled and:[ ((service buttonPress: button x:x y:y in: view) == true) ]
+ ].
+
+ "Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 06-10-2011 / 14:14:00 / cg"
+ "Modified (format): / 05-03-2012 / 08:56:02 / cg"
+!
+
+scrollTo:origin redraw:doRedraw in: view
+ view == textView ifTrue: [
+ "/my text view scrolled...
+ synchronizedCodeViews do:[:codeView|
+ codeView scrollTo:origin redraw:doRedraw in: view.
+ ]
+ ] ifFalse: [
+ "/other code view scrolls and I'm notified about that
+ textView basicScrollTo:origin redraw:doRedraw.
+ ]
+
+ "Created: / 06-04-2010 / 14:02:39 / Jakub <zelenja7@fel.cvut.cz>"
+ "Created: / 19-03-2012 / 17:05:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CodeView2 methodsFor:'delegation-drawing'!
drawLine:lineNo in: view atX:x y:y width: w height:h from:startCol to:endColOrNil with:fg and:bg
@@ -1202,21 +1319,6 @@
"Modified: / 06-10-2011 / 14:13:57 / cg"
!
-buttonPress: 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."
-
- ^ services
- contains:[:service |
- (service isEnabled
- and:[ ((service buttonPress: button x:x y:y in: view) == true) ])
- ].
-
- "Modified: / 07-03-2010 / 13:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (comment): / 29-08-2013 / 16:23:08 / cg"
-!
-
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,
@@ -1383,13 +1485,13 @@
initialize
"Invoked when a new instance is created."
"Call super initialize"
-
+
super initialize.
"Now set up some visual properties"
self level:-1.
"Now initialize sub-views"
showGutterChannel := ValueHolder with: true.
- showGutterChannel addDependent: self.
+ showGutterChannel addDependent: self.
"/ toDo: I don't like two options in the settings;
"/ showAcceptCancelBarChannel := (ValueHolder with: (UserPreferences current showAcceptCancelBarInBrowser)).
showAcceptCancelBarChannel := ValueHolder with: (UserPreferences current codeView2ShowAcceptCancel).
@@ -1403,9 +1505,11 @@
self initializeGutterView.
self initializeTextView.
textView setCodeView:self.
- modifiedChannel := ValueHolder with:false.
+ modifiedChannel := ValueHolder with:false.
diffMode := false.
synchronizedCodeViews := #().
+ currentParseNodeHolder := ValueHolder new.
+ currentBlockNodeHolder := ValueHolder new.
servicesFromClient := false.
services := OrderedCollection new.
@@ -1414,7 +1518,7 @@
"Modified: / 14-12-2009 / 13:59:53 / Jindra <a>"
"Modified: / 06-04-2010 / 13:56:35 / Jakub <zelenja7@fel.cvut.cz>"
"Modified: / 06-10-2011 / 14:15:48 / cg"
- "Modified: / 18-10-2011 / 19:17:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-02-2012 / 23:05:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeGutterView
@@ -1433,14 +1537,14 @@
"/ only do it, if the services have not yet been defined by the user of this view
"/ (FileBrowser does not want Smalltalk-specific services)
servicesFromClient ifFalse:[
- serviceClasses := self defaultServices sort:[:a :b|name < b name].
- serviceClasses do:[:cls|
- self registerService: cls new
- ].
+ serviceClasses := self defaultServices sort:[:a :b|a priority = b priority ifTrue:[a name < b name] ifFalse:[a priority > b priority]].
+ serviceClasses do:[:cls|
+ self registerService: cls new
+ ].
].
- "Modified: / 27-07-2011 / 11:37:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 22-07-2013 / 14:02:59 / cg"
+ "Modified: / 24-07-2013 / 11:56:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeTextView
@@ -1631,35 +1735,35 @@
"Modified: / 05-03-2012 / 09:02:43 / cg"
!
-implementorsMenu: implementors selector: selector
+implementorsMenu: implementors selector: selector
| menu|
menu := Menu new.
implementors isEmptyOrNil ifTrue:[
- menu addItem:(MenuItem label:'No implementors found') disable
+ menu addItem:(MenuItem label:'No implementors found') disable
] ifFalse:[
- menu addItem:(MenuItem
- label:(selector "storeString" , (' (all implementors) ') asText allItalic)
- itemValue:[
- self browseMethods:implementors
- label:'Implementors of ' , selector "storeString"
- ]).
-
- menu addSeparator.
- "/ (implementors asOrderedCollection sort:[:a :b | a mclass name < b mclass name])
- (implementors asOrderedCollection sort:[:a :b | a selector < b selector])
- "implementors" do:[:mth |
- menu
- addItem:(MenuItem label:(selector "storeString" allBold
- , (' in ' , mth containingClass name "asText allBold"))
- value:[ self browseMethod:mth label: 'Implementor of ' , selector "storeString" ])
- ]
+ menu addItem:(MenuItem
+ label:(selector storeString , (' (all implementors) ') asText allItalic)
+ itemValue:[
+ self browseMethods:implementors
+ label:'Implementors of ' , selector storeString
+ ]).
+
+ menu addSeparator.
+ (implementors asOrderedCollection sort:[:a :b | a mclass name < b mclass name])
+ "implementors" do:[:mth |
+ menu
+ addItem:(MenuItem label:(selector storeString
+ , (' in ' , mth containingClass nameInBrowser asText allBold))
+ itemValue:[ self browseMethod:mth label: 'Implementor of ' , selector storeString ])
+ ]
].
^ menu
"Modified: / 19-10-2008 / 08:16:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Created: / 14-02-2010 / 19:39:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 28-08-2013 / 22:03:06 / cg"
+ "Modified: / 07-03-2012 / 12:56:56 / cg"
+ "Modified: / 14-10-2013 / 10:47:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
sendersMenu
@@ -1697,43 +1801,42 @@
"Modified: / 05-03-2012 / 09:02:56 / cg"
!
-sendersMenu: senders selector: selector
+sendersMenu: senders selector: selector
| menu shownSenderItems numCut sendersSorted|
menu := Menu new.
senders isEmptyOrNil ifTrue:[
- menu addItem:(MenuItem label:'No senders found') disable
+ menu addItem:(MenuItem label:'No senders found') disable
] ifFalse:[
- menu addItem:(MenuItem
- label:(selector "storeString" , (' (all senders)') asText allItalic)
- itemValue:[
- self browseMethods:senders
- label:'Senders of ' , selector "storeString"
- ]).
- menu addSeparator.
- "/ sendersSorted := senders asOrderedCollection
- "/ sort:[:a :b | a whoString < b whoString].
- sendersSorted := senders asOrderedCollection
- sort:[:a :b | a selector < b selector].
- shownSenderItems := (senders size > 20) ifTrue:[sendersSorted copyTo:20] ifFalse:[sendersSorted].
- numCut := senders size - 20.
- shownSenderItems do:[:mth |
- menu
- addItem:(MenuItem label:(mth selector "storeString" allBold
- , (' in ' , mth containingClass name "asText allBold"))
- value:[ self browseMethod:mth label: 'Sender of ' , selector "storeString" ])
- ].
- numCut > 0 ifTrue:[
- menu addSeparator.
- menu addItem:(MenuItem label:('... %1 more senders not shown here' bindWith:numCut)) disable
- ].
+ menu addItem:(MenuItem
+ label:(selector storeString , (' (all senders)') asText allItalic)
+ itemValue:[
+ self browseMethods:senders
+ label:'Senders of ' , selector storeString
+ ]).
+ menu addSeparator.
+ sendersSorted := senders asOrderedCollection
+ sort:[:a :b | a whoString < b whoString].
+ shownSenderItems := (senders size > 20) ifTrue:[sendersSorted copyTo:20] ifFalse:[sendersSorted].
+ numCut := senders size - 20.
+ shownSenderItems do:[:mth |
+ menu
+ addItem:(MenuItem label:(mth selector storeString
+ , (' in ' , mth containingClass nameInBrowser asText allBold))
+ itemValue:[ self browseMethod:mth label: 'Sender of ' , selector storeString ])
+ ].
+ numCut > 0 ifTrue:[
+ menu addSeparator.
+ menu addItem:(MenuItem label:('... %1 more senders not shown here' bindWith:numCut)) disable
+ ].
].
^ menu
"Modified: / 19-10-2008 / 08:17:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Created: / 14-02-2010 / 19:40:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 07-07-2011 / 14:51:54 / jv"
- "Modified: / 28-08-2013 / 22:03:57 / cg"
+ "Modified: / 07-03-2012 / 12:58:31 / cg"
+ "Modified: / 14-10-2013 / 10:47:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
servicesMenu
@@ -1867,8 +1970,17 @@
^ syntaxElementSelection
!
-syntaxElementSelection:something
- syntaxElementSelection := something.
+syntaxElementSelection:anElement
+ syntaxElementSelection := anElement.
+"/ anElement isNil ifTrue:[
+"/ currentParseNodeHolder value: nil.
+"/"/ currentBlockNodeHolder value: nil.
+"/ ] ifFalse:[
+"/ currentParseNodeHolder value: anElement node.
+"/"/ currentBlockNodeHolder value: anElement node enclosingBlock.
+"/ ]
+
+ "Modified: / 24-09-2013 / 00:14:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
syntaxElements
@@ -2016,6 +2128,12 @@
"Created: / 07-10-2011 / 19:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+acceptCancelRight
+ ^((self paddingLeft) + (widthAcceptCancel ? 0))
+
+ "Created: / 10-09-2013 / 03:00:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
cancelButtonBottom
^(self height * 0.8) ceiling.
@@ -2045,10 +2163,10 @@
paddingRight
- ^0"px"
+ ^3"px"
"Created: / 14-02-2010 / 22:27:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 16-06-2011 / 13:47:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-02-2012 / 22:40:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
preferredExtent
@@ -2104,6 +2222,37 @@
^ codeView servicesMenu
! !
+!CodeView2::GutterView methodsFor:'aspects'!
+
+currentBlockNodeHolder
+ "return/create the 'currentBlockNodeHolder' value holder (automatically generated)"
+
+ currentBlockNodeHolder isNil ifTrue:[
+ currentBlockNodeHolder := ValueHolder new.
+ currentBlockNodeHolder addDependent:self.
+ ].
+ ^ currentBlockNodeHolder
+!
+
+currentBlockNodeHolder:something
+ "set the 'currentBlockNodeHolder' value holder (automatically generated)"
+
+ |oldValue newValue|
+
+ currentBlockNodeHolder notNil ifTrue:[
+ oldValue := currentBlockNodeHolder value.
+ currentBlockNodeHolder removeDependent:self.
+ ].
+ currentBlockNodeHolder := something.
+ currentBlockNodeHolder notNil ifTrue:[
+ currentBlockNodeHolder addDependent:self.
+ ].
+ newValue := currentBlockNodeHolder value.
+ oldValue ~~ newValue ifTrue:[
+ self update:#value with:newValue from:currentBlockNodeHolder.
+ ].
+! !
+
!CodeView2::GutterView methodsFor:'change & update'!
adjustSizeForLongestLine
@@ -2142,34 +2291,31 @@
"/ self shown ifFalse:[^self].
(changedObject == textView) ifTrue:[
- ((something == #sizeOfContents)
- or:[ false "(something == #sizeOfView)" ]) ifTrue:[
- self adjustSizeForLongestLine.
+ ((something == #sizeOfContents)
+ or:[ false "(something == #sizeOfView)" ]) ifTrue:[
+ self adjustSizeForLongestLine.
"/ (numberOfLines ~= (textView list size max:textView cursorLine)) ifTrue:[
"/ self invalidate.
"/ ].
- ^ self.
- ].
- something == #originOfContents ifTrue:[
- self invalidate.
- ^ self.
- ].
- "/ something printCR.
+ ^ self.
+ ].
+ something == #originOfContents ifTrue:[
+ self invalidateLines.
+ ^ self.
+ ].
+ "/ something printCR.
].
(changedObject == textView reallyModifiedChannel) ifTrue:[
- "/ cg: I think this is rubbish: if any service needs that, it should make itself
- "/ dependent of it itself (leads to many redraws for non-existing accept-cancel bar,
- "/ if no such service is active)
- "/ self invalidate.
- ^ self.
+ self invalidateAcceptCancelBar.
+ ^self.
].
super update:something with:aParameter from:changedObject
"Modified (format): / 15-07-2011 / 20:14:04 / cg"
- "Modified: / 07-10-2011 / 19:25:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-09-2013 / 03:15:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeView2::GutterView methodsFor:'event handling'!
@@ -2209,6 +2355,13 @@
"Created: / 17-06-2011 / 13:02:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (comment): / 18-05-2012 / 10:56:54 / cg"
+!
+
+sizeChanged:how
+ super sizeChanged:how.
+ self invalidateAcceptCancelBar.
+
+ "Created: / 10-09-2013 / 03:19:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeView2::GutterView methodsFor:'help'!
@@ -2233,7 +2386,7 @@
showLineNumbers := true.
widthAcceptCancel := 16.
- widthAnnotations := 8.
+ widthAnnotations := "16"8.
widthDiffInfo := 5.
acceptColor := Color green lighter onDevice:device.
@@ -2246,18 +2399,21 @@
setCodeView: aCodeView2
codeView := aCodeView2.
- textView := aCodeView2 textView.
codeView addDependent: self.
codeView reallyModifiedChannel addDependent: self.
+ codeView currentBlockNodeHolder addDependent: self.
+
+ textView := aCodeView2 textView.
textView addDependent: self.
+ self currentBlockNodeHolder: codeView currentBlockNodeHolder.
textViewScroller := aCodeView2 textViewScroller.
"/ self backgroundPaint: (textView viewBackground "backgroundPaint" blendWith: (Color gray:80)).
self viewBackground: (View defaultBackgroundColor).
"Created: / 14-02-2010 / 15:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 17-08-2011 / 15:15:55 / cg"
- "Modified: / 08-10-2011 / 11:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-04-2012 / 17:46:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeView2::GutterView methodsFor:'queries'!
@@ -2305,46 +2461,78 @@
|visibleLineNr "{ Class: SmallInteger }"|
+ "/JV: BAD, BAD BAD - check senders, they are not prepared
+ "/ to get nil!!
shown ifFalse:[^ nil].
lineNr isNil ifTrue:[^ nil].
visibleLineNr := lineNr - textView firstLineShown + 1.
^ textView yOfVisibleLine:visibleLineNr
+
+ "Modified (format): / 28-08-2013 / 12:49:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeView2::GutterView methodsFor:'redrawing'!
+invalidateAcceptCancelBar
+ | w |
+
+ (widthAcceptCancel ? 0) == 0 ifTrue:[ ^ self ].
+ w := ((self paddingLeft) + (widthAcceptCancel ? 0)) + 1.
+ self
+ invalidateX: 0
+ y: 0
+ width: w
+ height: self height.
+
+ "Created: / 10-09-2013 / 03:07:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
invalidateDeviceRectangle:aRectangle repairNow:doRepairNow
^ super invalidateDeviceRectangle:aRectangle repairNow:doRepairNow
!
+invalidateLines
+
+ | x0 |
+ x0 := ((self paddingLeft) + (widthAcceptCancel ? 0)) + 1.
+ self
+ invalidateX: x0
+ y: 0
+ width: self width - x0
+ height: self height.
+
+ "Created: / 10-09-2013 / 03:08:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
redrawAcceptCancelBarX: x y: y width:w height:h
| rw acceptBottom cancelBottom |
x > ((self paddingLeft) + (widthAcceptCancel ? 0)) ifTrue:[
- ^self.
+ ^self.
].
rw := ((x + w) min: (self paddingLeft + (widthAcceptCancel ? 0))) - x.
-
+
textView reallyModified ifFalse:[
- self fillRectangleX:x y:y width:rw height:h color: self viewBackground
+ self fillRectangleX:x y:y width:rw height:h color: self viewBackground
] ifTrue:[
- acceptBottom := self acceptButtonBottom.
- cancelBottom := self cancelButtonBottom.
- y < acceptBottom ifTrue:[
- self fillRectangleX:x y:y width:rw height: ((y + h) min: acceptBottom) color: acceptColor.
- ].
- (y < cancelBottom) ifTrue:[
- self fillRectangleX:x y: acceptBottom + 1width:rw height: ((y + h) min: cancelBottom) - acceptBottom - 1color: cancelColor.
- ].
- (y + h >= cancelBottom) ifTrue:[
- self fillRectangleX:x y: cancelBottom + 1 width:rw height: (y + h) - cancelBottom - 1 color: diffColor.
- ]
-
+ acceptBottom := self acceptButtonBottom.
+ cancelBottom := self cancelButtonBottom.
+ y < acceptBottom ifTrue:[
+ self fillRectangleX:x y:y width:rw height: ((y + h) min: acceptBottom) color: acceptColor.
+ ].
+ (y < cancelBottom) ifTrue:[
+ self fillRectangleX:x y: acceptBottom + 1width:rw height: ((y + h) min: cancelBottom) - acceptBottom - 1color: cancelColor.
+ ].
+ (y + h >= cancelBottom) ifTrue:[
+ self fillRectangleX:x y: cancelBottom + 1 width:rw height: (y + h) - cancelBottom - 1 color: diffColor.
+ ]
+
]
"Created: / 07-10-2011 / 19:44:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-09-2013 / 03:03:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
redrawBackgroundX:x y:y width:w height:h
@@ -2391,40 +2579,41 @@
!
redrawLine:line cleared:cleared drawServices:drawServices
- "redraws specified line. Returns width of drawn object.
+ "redraws specified line. Returns width of drawn object.
Color of drawn objects should be taken from lineFont, lineColor"
-
+
|lineString yTop yBaseline fontAscent fontDescent
textW requiredW oldFont newFont oldColor newColor|
+ shown ifFalse:[ ^ self ]. "/ Do not bother if the view is not shown.
textView isNil ifTrue:[^ self]. "/ happens when shown in UIPainter
requiredW := self width.
showLineNumbers ifTrue:[
- lineString := self displayedString:line.
-
- textW := (lineString widthOn:self).
- requiredW := textW + self padding.
-
- oldFont := self font.
- oldColor := self paint.
-
- newFont := self lineFontForLine:line.
- newFont isNil ifTrue:[
- newFont := oldFont.
- newColor := self lineColorForLine:line.
- newColor ifNotNil:[ self paint:newColor ].
- ].
- newFont ~~ oldFont ifTrue:[
- "/ ensure that the line number lines are not higher than the text lines
- (newFont heightOn:device) > (textView font heightOn:device) ifTrue:[
- newFont := textView font.
- ].
- newFont ~~ oldFont ifTrue:[
- self font:newFont
- ].
- ].
+ lineString := self displayedString:line.
+
+ textW := (lineString widthOn:self).
+ requiredW := textW + self padding.
+
+ oldFont := self font.
+ oldColor := self paint.
+
+ newFont := self lineFontForLine:line.
+ newFont isNil ifTrue:[
+ newFont := oldFont.
+ newColor := self lineColorForLine:line.
+ newColor ifNotNil:[ self paint:newColor ].
+ ].
+ newFont ~~ oldFont ifTrue:[
+ "/ ensure that the line number lines are not higher than the text lines
+ (newFont heightOn:device) > (textView font heightOn:device) ifTrue:[
+ newFont := textView font.
+ ].
+ newFont ~~ oldFont ifTrue:[
+ self font:newFont
+ ].
+ ].
].
fontAscent := textView font ascentOn:device.
@@ -2434,9 +2623,9 @@
yBaseline := yTop + fontAscent.
cleared ifFalse:[
- self clearRectangleX:0 y:yBaseline - font ascent
- width: width - 2
- height: font ascent + font descent.
+ self clearRectangleX:0 y:yBaseline - font ascent
+ width: width - 2
+ height: font ascent + font descent.
].
"/ cg: this should be done differently: services know about the
@@ -2444,36 +2633,45 @@
"/ otherwise, some redraws become unusably slow (especially
"/ with multiple fonts/colors/emphases)...
drawServices ifTrue:[
- "Let services draw annotations and other stuff"
- codeView notNil ifTrue:[
- codeView
- drawLine:line in: self
- atX: (self paddingLeft + self usedWidthForAcceptCancel) y:yBaseline width: widthAnnotations height: font height
- from:nil to:nil with:self paint and: self backgroundColor.
- ]
+ "Let services draw annotations and other stuff"
+ codeView notNil ifTrue:[
+ codeView
+ drawLine:line in: self
+ atX: (self paddingLeft + self usedWidthForAcceptCancel) y:yBaseline width: widthAnnotations height: font height
+ from:nil to:nil with:self paint and: self backgroundColor.
+ ]
].
showLineNumbers ifTrue:[
- self
- displayString:lineString
- x:(width - textW - 2 - self paddingRight - widthDiffInfo)
- y:yBaseline.
-
- newFont
- ifNotNil:[
- self font:oldFont.
- self paint:oldColor
- ]
- ifNil:[
- newColor ifNotNil:[ self paint:oldColor ].
- ].
+ self
+ displayString:lineString
+ x:(width - textW - 2 - self paddingRight - widthDiffInfo)
+ y:yBaseline.
+
+ newFont
+ ifNotNil:[
+ self font:oldFont.
+ self paint:oldColor
+ ]
+ ifNil:[
+ newColor ifNotNil:[ self paint:oldColor ].
+ ].
].
+ "/ If the view has been cleared here, we have also to redraw corresponding portion
+ "/ of accept/cancel bar !!
+ cleared ifFalse:[
+ "/ In that case it was cleared above.
+ self redrawAcceptCancelBarX:0 y:yBaseline - font ascent
+ width: width - 2
+ height: font ascent + font descent.
+ ].
^ requiredW.
"Modified: / 14-12-2009 / 15:30:44 / Jindra <a>"
"Created: / 17-06-2011 / 14:11:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 18-07-2012 / 19:05:24 / cg"
+ "Modified: / 28-08-2013 / 15:17:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
redrawLinesFrom:start
@@ -2551,6 +2749,17 @@
"Created: / 07-10-2011 / 20:32:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+contents: text clear: clearPrevious
+
+ | savedListOriginal |
+ savedListOriginal := listOriginal.
+ super contents: text.
+ listOriginal := savedListOriginal.
+ self updateReallyModified.
+
+ "Created: / 17-02-2012 / 00:35:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
deletedLines
^ deletedLines
@@ -2580,6 +2789,12 @@
emptyLines := something.
!
+fontAscent
+ ^fontAscent notNil ifTrue:[fontAscent] ifFalse:[super fontAscent]
+
+ "Created: / 19-05-2012 / 14:13:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
insertedLines
^ insertedLines
@@ -2646,9 +2861,15 @@
listOriginal := aCollection copy.
reallyModifiedChannel value: false.
- self notifyLinesModifiedFrom: 1 to: list size.
+
+ "/JV: used to be notifyLines... but that method
+ "/ leaves suppressNotifications to true, which is not what
+ "/ we want!!
+ self updateReallyModified.
+ codeView linesModifiedFrom: 1 to: list size.
"Created: / 08-10-2011 / 12:23:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 03-08-2013 / 13:35:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setList:aCollection expandTabs:expandTabs redraw:doRedraw
@@ -2656,9 +2877,25 @@
super setList:aCollection expandTabs:expandTabs redraw:doRedraw.
listOriginal := aCollection copy.
reallyModifiedChannel value: false.
- self notifyLinesModifiedFrom: 1 to: list size.
+
+ "/JV: used to be notifyLines... but that method
+ "/ leaves suppressNotifications to true, which is not what
+ "/ we want!!
+ self updateReallyModified.
+ codeView linesModifiedFrom: 1 to: list size.
"Created: / 07-10-2011 / 18:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 03-08-2013 / 13:35:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CodeView2::TextView methodsFor:'accessing-look'!
+
+lineSpacing
+
+ ^lineSpacing
+
+ "Modified: / 22-05-1996 / 12:22:29 / cg"
+ "Created: / 19-03-2012 / 13:22:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeView2::TextView methodsFor:'accessing-state'!
@@ -2686,6 +2923,33 @@
"Created: / 08-10-2011 / 12:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CodeView2::TextView methodsFor:'bit blitting'!
+
+copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async
+ "/ a vertical scroll operation ?
+ aDrawable == self ifTrue:[
+ ((srcY ~= dstY) and:[srcX = dstX]) ifTrue:[
+ "/ Do copy in gutter, but not accept-cancel bar!!
+ | x0 |
+
+ x0 := gutterView acceptCancelRight.
+ gutterView
+ copyFrom:gutterView
+ x:x0
+ y:srcY
+ toX:x0
+ y:dstY
+ width:(gutterView width - x0)
+ height:h
+ async:false
+ ]
+ ].
+ ^ super
+ copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async
+
+ "Modified (comment): / 10-09-2013 / 03:13:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CodeView2::TextView methodsFor:'channels'!
reallyModifiedChannel
@@ -2721,15 +2985,10 @@
!CodeView2::TextView methodsFor:'delegation-events'!
isQuickMenuModifierPressed
- |sensor|
-
- sensor := self sensor.
UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[
- ^ sensor ctrlDown
+ ^ self sensor ctrlDown
].
- ^ sensor metaDown
-
- "Modified: / 29-08-2013 / 16:22:30 / cg"
+ ^ self sensor metaDown
!
isQuickMenuModifierReleased
@@ -2741,99 +3000,105 @@
!CodeView2::TextView methodsFor:'drawing'!
-drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
-
- super
- drawFromVisibleLine:startVisLineNr
- to:endVisLineNr
- with:fg
- and:bg.
-
- "/ if in diffmode...
- self redrawLines.
-
- "Created: / 05-04-2010 / 12:08:38 / Jakub <zelenja7@fel.cvut.cz>"
- "Modified: / 02-05-2010 / 18:46:04 / Jakub <zelenja7@fel.cvut.cz>"
+backgroundForVisibleLine:visLineNr default:bg
+ | lineNr |
+
+
+ diffMode ifTrue:[
+ lineNr := self visibleLineToListLine:visLineNr.
+ (insertedLines notEmptyOrNil and:[insertedLines includes:lineNr]) ifTrue:[
+ ^self colorInserted
+ ].
+ (changedLines notEmptyOrNil and:[changedLines includes:lineNr]) ifTrue:[
+ ^self colorChanged
+ ].
+ (deletedLines notEmptyOrNil and:[deletedLines includes:lineNr]) ifTrue:[
+ ^self colorDeleted
+ ].
+ ].
+ ^ bg
+
+ "Modified: / 17-03-2012 / 12:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-drawLine:line fromX:x inVisible:visLineNr with:fg and:bg
-
- super
- drawLine:line
- fromX:x
- inVisible:visLineNr
- with:fg
- and:bg.
-
- "/ if in diffmode...
- self redrawLines.
+drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
+ "draw a visible line range in fg/bg"
+
+ diffMode ifFalse:[
+ super drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg.
+ ^self.
+ ].
+
+ startVisLineNr to: endVisLineNr do:[:visLineNr|
+ self drawVisibleLine: visLineNr with:fg and:bg
+ ]
+
+ "Modified: / 15-12-1999 / 23:19:39 / cg"
+ "Created: / 17-03-2012 / 09:44:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+drawLine:line fromX:x inVisible:visLineNr with:fg and:bg
+ super
+ drawLine:line
+ fromX:x
+ inVisible:visLineNr
+ with:fg
+ and:(self backgroundForVisibleLine:visLineNr default:bg).
"Created: / 05-04-2010 / 12:07:07 / Jakub <zelenja7@fel.cvut.cz>"
"Modified: / 02-05-2010 / 18:46:00 / Jakub <zelenja7@fel.cvut.cz>"
+ "Modified: / 17-03-2012 / 10:05:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg
-
- super
- drawLine:lineStringArg
- inVisible:visLineNr
- col:col
- with:fg
- and:bg.
-
- "/ if in diffmode...
- self redrawLines.
+drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg
+ super
+ drawLine:lineStringArg
+ inVisible:visLineNr
+ col:col
+ with:fg
+ and:(self backgroundForVisibleLine:visLineNr default:bg).
"Created: / 05-04-2010 / 11:49:42 / Jakub <zelenja7@fel.cvut.cz>"
"Modified: / 02-05-2010 / 18:45:56 / Jakub <zelenja7@fel.cvut.cz>"
+ "Modified: / 17-03-2012 / 10:04:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg
-
- super
- drawLine:lineStringArg
- inVisible:visLineNr
- from:startCol
- to:endColOrNil
- with:fg
- and:bg.
-
- "/ if in diffmode...
- self redrawLines.
+drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg
+ super
+ drawLine:lineStringArg
+ inVisible:visLineNr
+ from:startCol
+ to:endColOrNil
+ with:fg
+ and:(self backgroundForVisibleLine:visLineNr default:bg).
"Created: / 05-04-2010 / 11:54:54 / Jakub <zelenja7@fel.cvut.cz>"
"Modified: / 02-05-2010 / 18:45:52 / Jakub <zelenja7@fel.cvut.cz>"
+ "Modified: / 17-03-2012 / 10:04:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg
-
- super
- drawLine:lineString
- inVisible:visLineNr
- from:startCol
- with:fg
- and:bg.
-
- "/ if in diffmode...
- self redrawLines.
+drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg
+ super
+ drawLine:lineString
+ inVisible:visLineNr
+ from:startCol
+ with:fg
+ and:(self backgroundForVisibleLine:visLineNr default:bg).
"Created: / 05-04-2010 / 11:54:26 / Jakub <zelenja7@fel.cvut.cz>"
"Modified: / 02-05-2010 / 18:45:48 / Jakub <zelenja7@fel.cvut.cz>"
+ "Modified: / 17-03-2012 / 10:04:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-drawVisibleLine:visLineNr with:fg and:bg
- super
- drawVisibleLine:visLineNr
- with:fg
- and:bg.
-
- gutterView redrawVisibleLine:visLineNr.
-
- "/ if in diffmode...
- self redrawLines.
+drawVisibleLine:visLineNr with:fg and:bg
+ super
+ drawVisibleLine:visLineNr
+ with:fg
+ and:(self backgroundForVisibleLine:visLineNr default:bg).
"Created: / 05-04-2010 / 11:49:42 / Jakub <zelenja7@fel.cvut.cz>"
"Modified: / 02-05-2010 / 18:45:44 / Jakub <zelenja7@fel.cvut.cz>"
+ "Modified: / 17-03-2012 / 10:04:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
redraw
@@ -2849,50 +3114,52 @@
|i pom|
diffMode ifFalse:[^self].
+ true ifTrue:[^self].
+
pom := self hasSelection.
(pom) ifTrue:[ ^ self. ].
i := 1.
[
- i <= (deletedLines size)
+ i <= (deletedLines size)
] whileTrue:[
- ((deletedLines at:i) > 0) ifTrue:[
- super
- drawVisibleLine:(deletedLines at:i)
- with:fgColor
- and:self colorDeleted.
- ].
- i := i + 1.
+ ((deletedLines at:i) > 0) ifTrue:[
+ super
+ drawVisibleLine:(deletedLines at:i)
+ with:fgColor
+ and:self colorDeleted.
+ ].
+ i := i + 1.
].
i := 1.
[
- i <= (insertedLines size)
+ i <= (insertedLines size)
] whileTrue:[
- ((insertedLines at:i) > 0) ifTrue:[
- super
- drawVisibleLine:(insertedLines at:i)
- with:fgColor
- and:self colorInserted.
- ].
- i := i + 1.
+ ((insertedLines at:i) > 0) ifTrue:[
+ super
+ drawVisibleLine:(insertedLines at:i)
+ with:fgColor
+ and:self colorInserted.
+ ].
+ i := i + 1.
].
i := 1.
[
- i <= (changedLines size)
+ i <= (changedLines size)
] whileTrue:[
- ((changedLines at:i) > 0) ifTrue:[
- super
- drawVisibleLine:(changedLines at:i)
- with:fgColor
- and:self colorChanged.
- ].
- i := i + 1.
+ ((changedLines at:i) > 0) ifTrue:[
+ super
+ drawVisibleLine:(changedLines at:i)
+ with:fgColor
+ and:self colorChanged.
+ ].
+ i := i + 1.
].
"Created: / 26-04-2010 / 21:04:31 / Jakub <zelenja7@fel.cvut.cz>"
"Modified: / 22-06-2010 / 23:28:30 / Jakub <zelenja7@fel.cvut.cz>"
- "Modified: / 08-04-2011 / 20:52:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 17-03-2012 / 09:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeView2::TextView methodsFor:'editing'!
@@ -3199,31 +3466,31 @@
"Bit hacky here, should ask language some language toolbox
for formatting helper, that should do it..."
(lang notNil and:[lang isSmalltalk]) ifTrue:[
- | line lineNo indent |
- lineNo := lineNr.
- [lineNo ~~ 1] whileTrue:[
- lineNo := lineNo - 1.
- line := self listAt:lineNo.
-
- line notNil ifTrue:[
- indent := line indexOfNonSeparatorStartingAt:1.
- "beggining of block"
- line notEmptyOrNil ifTrue:[
- line last == $[ ifTrue:[
- indent := indent + 4.
- ] ifFalse:[
- "end of block args"
- (line last == $| and: [line includes: $[]) ifTrue:[
- indent := indent + 4.
- ]
- ].
- ].
- indent ~~ 0 ifTrue:[
- ^ indent - 1
- ]
- ]
- ].
- ^0.
+ | line lineNo indent |
+ lineNo := lineNr.
+ [lineNo ~~ 1] whileTrue:[
+ lineNo := lineNo - 1.
+ line := self listAt:lineNo.
+
+ line notNil ifTrue:[
+ indent := line indexOfNonSeparatorStartingAt:1.
+ "beggining od block"
+ line notEmptyOrNil ifTrue:[
+ line last == $[ ifTrue:[
+ indent := indent + 4.
+ ] ifFalse:[
+ "end of block args"
+ (line last == $| and: [line includes: $[]) ifTrue:[
+ indent := indent + 4.
+ ]
+ ].
+ ].
+ indent ~~ 0 ifTrue:[
+ ^ indent - 1
+ ]
+ ]
+ ].
+ ^0.
].
^super leftIndentForLine:lineNr
@@ -3240,13 +3507,14 @@
diffMode := false.
suppressNotifications := false.
reallyModifiedChannel := false asValue.
+ autoIndent := UserPreferences current codeView2AutoIndent.
self enableMotionEvents.
"Created: / 23-06-2010 / 17:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 06-07-2011 / 17:46:31 / jv"
"Modified: / 21-08-2011 / 10:09:29 / cg"
- "Modified: / 07-10-2011 / 19:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-07-2013 / 13:15:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setCodeView: aCodeView2
@@ -3582,6 +3850,14 @@
"Modified: / 02-05-2010 / 19:29:23 / Jakub <zelenja7@fel.cvut.cz>"
!
+basicScrollTo:anOrigin redraw:doRedraw
+ super scrollTo:anOrigin redraw:doRedraw
+
+ "Modified: / 06-04-2010 / 14:05:40 / Jakub <zelenja7@fel.cvut.cz>"
+ "Modified: / 17-03-2012 / 10:06:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 19-03-2012 / 17:01:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
basicScrollUp:nLines
|i|
@@ -3651,6 +3927,16 @@
"Modified: / 06-04-2010 / 14:04:28 / Jakub <zelenja7@fel.cvut.cz>"
!
+scrollTo:anOrigin redraw:doRedraw
+
+ codeView scrollTo:anOrigin redraw:doRedraw in: self.
+ self basicScrollTo:anOrigin redraw:doRedraw
+
+ "Modified: / 06-04-2010 / 14:04:28 / Jakub <zelenja7@fel.cvut.cz>"
+ "Modified: / 17-03-2012 / 10:06:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 19-03-2012 / 17:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
scrollUp:nLines
codeView scrollUp: nLines in: self.
@@ -3680,15 +3966,15 @@
!CodeView2 class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.129 2013-10-09 16:16:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.130 2014-02-05 18:56:57 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.129 2013-10-09 16:16:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.130 2014-02-05 18:56:57 cg Exp $'
!
version_SVN
- ^ '$Id: Tools__CodeView2.st,v 1.129 2013-10-09 16:16:02 cg Exp $'
+ ^ '$Id: Tools__CodeView2.st,v 1.130 2014-02-05 18:56:57 cg Exp $'
! !