Tools__CodeView2.st
changeset 13098 ce4a7109bbcd
parent 13097 0244f714f047
child 13105 4e02e8dc7d4b
equal deleted inserted replaced
13097:0244f714f047 13098:ce4a7109bbcd
    40 !
    40 !
    41 
    41 
    42 SimpleView subclass:#GutterView
    42 SimpleView subclass:#GutterView
    43 	instanceVariableNames:'codeView textView textViewScroller widthAcceptCancel
    43 	instanceVariableNames:'codeView textView textViewScroller widthAcceptCancel
    44 		widthAnnotations widthDiffInfo firstLineShown lastLineShown
    44 		widthAnnotations widthDiffInfo firstLineShown lastLineShown
    45 		numberOfLines acceptColor cancelColor diffColor'
    45 		numberOfLines acceptColor cancelColor diffColor menuHolder'
    46 	classVariableNames:''
    46 	classVariableNames:''
    47 	poolDictionaries:''
    47 	poolDictionaries:''
    48 	privateIn:CodeView2
    48 	privateIn:CodeView2
    49 !
    49 !
    50 
    50 
  1966     "Created: / 14-02-2010 / 22:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1966     "Created: / 14-02-2010 / 22:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1967 ! !
  1967 ! !
  1968 
  1968 
  1969 !CodeView2::GutterView methodsFor:'accessing'!
  1969 !CodeView2::GutterView methodsFor:'accessing'!
  1970 
  1970 
       
  1971 menuHolder:aValueThing
       
  1972     menuHolder := aValueThing
       
  1973 !
       
  1974 
  1971 setTextView: aTextView
  1975 setTextView: aTextView
  1972 
  1976 
  1973     self assert: textView isNil message:'Attempting to set textView twice'.
  1977     self assert: textView isNil message:'Attempting to set textView twice'.
  1974     textView := aTextView.
  1978     textView := aTextView.
  1975 
  1979 
  2077 diff
  2081 diff
  2078 
  2082 
  2079     "Created: / 07-10-2011 / 20:23:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2083     "Created: / 07-10-2011 / 20:23:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2080 !
  2084 !
  2081 
  2085 
  2082 middleButtonMenu
  2086 middleButtonMenu    
       
  2087     menuHolder notNil ifTrue:[^ menuHolder value].
  2083     ^ codeView servicesMenu
  2088     ^ codeView servicesMenu
  2084 ! !
  2089 ! !
  2085 
  2090 
  2086 !CodeView2::GutterView methodsFor:'change & update'!
  2091 !CodeView2::GutterView methodsFor:'change & update'!
  2087 
  2092 
  2088 adjustSizeForLongestLine
  2093 adjustSizeForLongestLine
  2089     |longestLineString textW requiredW newWidth|
  2094     "recompute the required width (longest linenumber present, not shown)"
  2090 
  2095 
  2091     longestLineString := self displayedString:(textView list size max:99).
  2096     |newNumberOfLines longestLineString textW requiredW newWidth|
  2092 
  2097 
       
  2098     newNumberOfLines := textView list size.
       
  2099 
       
  2100     longestLineString := self displayedString:(newNumberOfLines max:99).
  2093     textW := (longestLineString widthOn:self).
  2101     textW := (longestLineString widthOn:self).
  2094     requiredW := textW + self padding.
  2102     requiredW := textW + self padding.
  2095 
  2103 
  2096     ((requiredW > width) or:[requiredW < (width * 3 // 4)]) ifTrue:[
  2104     ((requiredW > width) or:[requiredW < (width * 3 // 4)]) ifTrue:[
  2097         "/ some hysteresis to avoid quick readjust again
  2105         "/ some hysteresis to avoid quick readjust again
  2102             textViewScroller origin:(newWidth+1 @ 0.0) corner:(1.0 @ 1.0).
  2110             textViewScroller origin:(newWidth+1 @ 0.0) corner:(1.0 @ 1.0).
  2103         ] ensure:[
  2111         ] ensure:[
  2104             textView addDependent:self.
  2112             textView addDependent:self.
  2105         ].
  2113         ].
  2106         self invalidate.
  2114         self invalidate.
       
  2115     ] ifFalse:[
       
  2116         numberOfLines ~= newNumberOfLines ifTrue:[
       
  2117             self invalidate
       
  2118         ]
  2107     ].
  2119     ].
  2108 !
  2120 !
  2109 
  2121 
  2110 update:something with:aParameter from:changedObject
  2122 update:something with:aParameter from:changedObject
  2111 "/    self shown ifFalse:[^self].
  2123 "/    self shown ifFalse:[^self].
  3561 ! !
  3573 ! !
  3562 
  3574 
  3563 !CodeView2 class methodsFor:'documentation'!
  3575 !CodeView2 class methodsFor:'documentation'!
  3564 
  3576 
  3565 version
  3577 version
  3566     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.97 2013-07-04 16:54:00 cg Exp $'
  3578     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.98 2013-07-04 17:06:05 cg Exp $'
  3567 !
  3579 !
  3568 
  3580 
  3569 version_CVS
  3581 version_CVS
  3570     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.97 2013-07-04 16:54:00 cg Exp $'
  3582     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.98 2013-07-04 17:06:05 cg Exp $'
  3571 !
  3583 !
  3572 
  3584 
  3573 version_SVN
  3585 version_SVN
  3574     ^ '$Id: Tools__CodeView2.st,v 1.97 2013-07-04 16:54:00 cg Exp $'
  3586     ^ '$Id: Tools__CodeView2.st,v 1.98 2013-07-04 17:06:05 cg Exp $'
  3575 ! !
  3587 ! !
  3576 
  3588 
  3577 
  3589 
  3578 CodeView2 initialize!
  3590 CodeView2 initialize!