diff -r 798e6c92cd74 -r b482d2c77040 Tools__CodeView2.st --- a/Tools__CodeView2.st Thu Nov 01 15:18:23 2012 +0100 +++ b/Tools__CodeView2.st Thu Nov 01 15:20:15 2012 +0100 @@ -1356,13 +1356,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. @@ -1380,7 +1387,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]. @@ -1405,16 +1412,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. @@ -1976,7 +1979,7 @@ padding ^self paddingLeft + self paddingRight - + (widthAcceptCancel ? 0) + + self usedWidthForAcceptCancel + (widthAnnotations ? 0) + (widthDiffInfo ? 0) @@ -2017,6 +2020,10 @@ "Modified: / 16-06-2011 / 14:03:11 / Jan Vrany " "Modified (format): / 26-03-2012 / 11:19:54 / cg" +! + +usedWidthForAcceptCancel + ^ (codeView showAcceptCancelBar ifTrue:[widthAcceptCancel ? 0] ifFalse:[0]) ! ! !CodeView2::GutterView methodsFor:'actions'! @@ -2074,24 +2081,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:[ @@ -2118,6 +2129,7 @@ initialize super initialize. + widthAcceptCancel := 16. widthAnnotations := 8. widthDiffInfo := 5. @@ -2132,9 +2144,10 @@ setCodeView: aCodeView2 codeView := aCodeView2. + textView := aCodeView2 textView. + codeView addDependent: self. codeView reallyModifiedChannel addDependent: self. - textView := aCodeView2 textView. textView addDependent: self. textViewScroller := aCodeView2 textViewScroller. "/ self backgroundPaint: (textView viewBackground "backgroundPaint" blendWith: (Color gray:80)). @@ -2284,7 +2297,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 @@ -3368,11 +3381,11 @@ !CodeView2 class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.66 2012-10-23 12:51:09 cg Exp $' + ^ '$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.66 2012-10-23 12:51:09 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.67 2012-11-01 14:20:15 cg Exp $' ! version_SVN