--- a/Tools__CodeView2.st Fri Nov 30 14:25:59 2012 +0000
+++ b/Tools__CodeView2.st Fri Nov 30 17:23:39 2012 +0000
@@ -1402,7 +1402,11 @@
"Created: / 06-07-2011 / 17:12:58 / jv"
"Modified: / 06-10-2011 / 14:13:44 / cg"
-! !
+!
+
+
+
+ !
!CodeView2 methodsFor:'diff mode'!
@@ -1446,13 +1450,20 @@
"Now set up some visual properties"
self level:-1.
"Now initialize sub-views"
- showGutterChannel := (ValueHolder with: true).
+ showGutterChannel := ValueHolder with: true.
showGutterChannel addDependent: self.
- showAcceptCancelBarChannel := (ValueHolder with: (UserPreferences current codeView2ShowAcceptCancel)).
+ "/ toDo: I don't like two options in the settings;
+ "/ showAcceptCancelBarChannel := (ValueHolder with: (UserPreferences current showAcceptCancelBarInBrowser)).
+ showAcceptCancelBarChannel := ValueHolder with: (UserPreferences current codeView2ShowAcceptCancel).
+
+ "/ these views must be created first, as they refer to each other's channels in their
+ "/ initialize methods
+ gutterView := CodeView2::GutterView new.
+ textViewScroller := HVScrollableView for: CodeView2::TextView in: self.
+ textView := textViewScroller scrolledView.
self initializeGutterView.
self initializeTextView.
- gutterView setCodeView:self.
textView setCodeView:self.
modifiedChannel := ValueHolder with:false.
diffMode := false.
@@ -1472,7 +1483,7 @@
initializeGutterView
- gutterView := CodeView2::GutterView new.
+ gutterView setCodeView:self.
gutterView origin:(0.0 @ 0.0) corner:(gutterView preferredWidth @ 1.0).
showGutterChannel value ifTrue:[self addSubView: gutterView].
@@ -1501,16 +1512,12 @@
!
initializeTextView
-
- "Initialize textView. gutterView have to be
- already initialized!!"
-
- textViewScroller := HVScrollableView for: CodeView2::TextView in: self.
+ "Initialize textView. gutterView has to be already initialized!!"
+
textViewScroller
origin: ((self showGutter ifTrue:[gutterView width] ifFalse:[0.0]) @ 0.0)
corner: 1.0@1.0;
level: 0.
- textView := textViewScroller scrolledView.
textView level: 0.
textView modifiedChannel addDependent: self.
@@ -2081,7 +2088,7 @@
padding
^self paddingLeft + self paddingRight
- + (widthAcceptCancel ? 0)
+ + self usedWidthForAcceptCancel
+ (widthAnnotations ? 0)
+ (widthDiffInfo ? 0)
@@ -2122,6 +2129,10 @@
"Modified: / 16-06-2011 / 14:03:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 26-03-2012 / 11:19:54 / cg"
+!
+
+usedWidthForAcceptCancel
+ ^ (codeView showAcceptCancelBar ifTrue:[widthAcceptCancel ? 0] ifFalse:[0])
! !
!CodeView2::GutterView methodsFor:'actions'!
@@ -2216,24 +2227,28 @@
buttonPress: btn x: x y: y
|extraSafeArea|
- (x <= (self paddingLeft + widthAcceptCancel)) ifTrue:[
- (y < self acceptButtonBottom) ifTrue:[
- self accept.
- ^self.
+ (x <= (self paddingLeft + self usedWidthForAcceptCancel)) ifTrue:[
+ textView reallyModified ifTrue:[
+ (y < self acceptButtonBottom) ifTrue:[
+ self accept.
+ ^self.
+ ].
+ (y < self cancelButtonBottom) ifTrue:[
+ self cancel.
+ ^self.
+ ].
+ self diff.
].
- (y < self cancelButtonBottom) ifTrue:[
- self cancel.
- ^self.
- ].
- self diff.
^self.
].
+false ifTrue:[
"Do not allow clicking on line numbers..."
extraSafeArea := "('999' widthOn:self)" 5.
x < (self width - self paddingRight - widthDiffInfo - extraSafeArea) ifFalse:[^ self].
-
- ((x > (self paddingLeft + widthAcceptCancel)) or:
+].
+
+ ((x > (self paddingLeft + self usedWidthForAcceptCancel)) or:
[x < (self width - self paddingRight - widthDiffInfo)]
) ifTrue:[
(codeView buttonPress: btn x:x y:y in: self) ifFalse:[
@@ -2260,6 +2275,7 @@
initialize
super initialize.
+
widthAcceptCancel := 16.
widthAnnotations := "16"8.
widthDiffInfo := 5.
@@ -2274,6 +2290,7 @@
setCodeView: aCodeView2
codeView := aCodeView2.
+
codeView addDependent: self.
codeView reallyModifiedChannel addDependent: self.
codeView currentBlockNodeHolder addDependent: self.
@@ -2429,7 +2446,7 @@
"Let the services to draw annotations and other stuff"
codeView
drawLine:line in: self
- atX: self paddingLeft + (widthAcceptCancel ? 0) y:y0 width: widthAnnotations height: font height
+ atX: self paddingLeft + self usedWidthForAcceptCancel y:y0 width: widthAnnotations height: font height
from:nil to:nil with:self paint and: self backgroundColor.
self
displayString:lineString
@@ -2813,6 +2830,8 @@
"Modified: / 17-03-2012 / 10:04:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+
+
redrawLines
|i pom|
@@ -3401,8 +3420,16 @@
"Modified: / 28-10-2011 / 09:23:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CodeView2::TextView methodsFor:'queries'!
+
+supportsSyntaxElements
+ ^ true
+! !
+
!CodeView2::TextView methodsFor:'scrolling'!
+
+
basicScrollTo:anOrigin redraw:doRedraw
super scrollTo:anOrigin redraw:doRedraw
@@ -3411,6 +3438,8 @@
"Created: / 19-03-2012 / 17:01:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+
+
originChanged:delta
super originChanged:delta.
@@ -3420,6 +3449,8 @@
"Created: / 07-12-2009 / 21:50:49 / Jindra <a>"
!
+
+
scrollTo:anOrigin redraw:doRedraw
codeView scrollTo:anOrigin redraw:doRedraw in: self.
@@ -3428,7 +3459,9 @@
"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>"
-! !
+!
+
+ !
!CodeView2::TextView methodsFor:'undo & again'!
@@ -3451,15 +3484,15 @@
!CodeView2 class methodsFor:'documentation'!
version
- ^ '$Id: Tools__CodeView2.st 8065 2012-10-22 16:18:07Z vranyj1 $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.67 2012/11/01 14:20:15 cg Exp $'
!
version_CVS
- ^ '§Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.65 2012/08/23 12:25:31 cg Exp §'
+ ^ '§Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.67 2012/11/01 14:20:15 cg Exp §'
!
version_SVN
- ^ '$Id: Tools__CodeView2.st 8065 2012-10-22 16:18:07Z vranyj1 $'
+ ^ '$Id: Tools__CodeView2.st 8074 2012-11-30 17:23:39Z vranyj1 $'
! !
CodeView2 initialize!