--- a/Tools__TextDiffTool.st Tue Jul 19 14:32:44 2011 +0200
+++ b/Tools__TextDiffTool.st Tue Jul 19 14:32:56 2011 +0200
@@ -9,13 +9,14 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-"{ Package: 'stx:libbasic3' }"
+"{ Package: 'stx:libtool' }"
"{ NameSpace: Tools }"
ApplicationModel subclass:#TextDiffTool
- instanceVariableNames:'labelAHolder textAHolder labelBHolder textBHolder diffSpecHolder
- showDiffHolder diffView numChangedTexts'
+ instanceVariableNames:'labelAHolder textAHolder labelBHolder textBHolder classHolder
+ languageHolder showDiffHolder diffSpecHolder diffView
+ numChangedTexts codeView'
classVariableNames:''
poolDictionaries:''
category:'Interface-Diff'
@@ -125,6 +126,138 @@
)
!
+textViewSpec
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
+
+ "
+ UIPainter new openOnClass:Tools::TextDiffTool andSelector:#textViewSpec
+ Tools::TextDiffTool new openInterface:#textViewSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: 'textViewSpec'
+ window:
+ (WindowSpec
+ label: 'Text Only'
+ name: 'Text Only'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 782 506)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (ArbitraryComponentSpec
+ name: 'CodeView'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ model: textAHolder
+ hasHorizontalScrollBar: false
+ hasVerticalScrollBar: false
+ autoHideScrollBars: false
+ hasBorder: false
+ component: #'Tools::CodeView2'
+ postBuildCallback: postBuildCodeView:
+ )
+ )
+
+ )
+ )
+!
+
+versionAOnlySpec
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
+
+ "
+ UIPainter new openOnClass:Tools::TextDiffTool andSelector:#versionAOnlySpec
+ Tools::TextDiffTool new openInterface:#versionAOnlySpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: versionAOnlySpec
+ window:
+ (WindowSpec
+ label: 'Version A Only'
+ name: 'Version A Only'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 782 506)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (UISubSpecification
+ name: 'VersionA'
+ layout: (LayoutFrame 0 0 0 0 0 1 30 0)
+ minorKey: versionALabelSpec
+ )
+ (UISubSpecification
+ name: 'Text'
+ layout: (LayoutFrame 0 0 30 0 0 1 0 1)
+ minorKey: textViewSpec
+ )
+ )
+
+ )
+ )
+!
+
+versionBOnlySpec
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
+
+ "
+ UIPainter new openOnClass:Tools::TextDiffTool andSelector:#versionBOnlySpec
+ Tools::TextDiffTool new openInterface:#versionBOnlySpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: 'versionBOnlySpec'
+ window:
+ (WindowSpec
+ label: 'Version B Only'
+ name: 'Version B Only'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 782 506)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (UISubSpecification
+ name: 'VersionB'
+ layout: (LayoutFrame 0 0 0 0 0 1 30 0)
+ minorKey: versionBLabelSpec
+ )
+ (UISubSpecification
+ name: 'Text'
+ layout: (LayoutFrame 0 0 30 0 0 1 0 1)
+ minorKey: textViewSpec
+ )
+ )
+
+ )
+ )
+
+ "Created: / 19-07-2011 / 10:06:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
windowSpec
"This resource specification was automatically generated
by the UIPainter of ST/X."
@@ -382,14 +515,39 @@
^ #(
#labelAHolder
#labelBHolder
+
#textAHolder
#textBHolder
+
+ #showDiffHolder
+
+ #classHolder
+ #languageHolder
).
+ "Modified: / 19-07-2011 / 13:02:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TextDiffTool methodsFor:'aspects'!
+classHolder
+ "return/create the 'classHolder' value holder (automatically generated)"
+
+ classHolder isNil ifTrue:[
+ classHolder := ValueHolder new.
+ ].
+ ^ classHolder
+!
+
+classHolder: aValueHolder
+
+ classHolder := aValueHolder.
+ codeView notNil ifTrue:[codeView classHolder: aValueHolder].
+ diffView notNil ifTrue:[diffView classHolder: aValueHolder].
+
+ "Modified: / 19-07-2011 / 12:54:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
diffSpecHolder
"return/create the 'diffSpecHolder' value holder (automatically generated)"
@@ -425,10 +583,12 @@
"return/create the 'labelAHolder' value holder (automatically generated)"
labelAHolder isNil ifTrue:[
- labelAHolder := ValueHolder new.
+ labelAHolder := ValueHolder with:'Version A'.
labelAHolder addDependent:self.
].
^ labelAHolder
+
+ "Modified: / 19-07-2011 / 11:41:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
labelAHolder:something
@@ -454,10 +614,12 @@
"return/create the 'labelBHolder' value holder (automatically generated)"
labelBHolder isNil ifTrue:[
- labelBHolder := ValueHolder new.
+ labelBHolder := ValueHolder with:'Version B'.
labelBHolder addDependent:self.
].
^ labelBHolder
+
+ "Modified: / 19-07-2011 / 11:42:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
labelBHolder:something
@@ -479,6 +641,24 @@
].
!
+languageHolder
+ "return/create the 'languageHolder' value holder (automatically generated)"
+
+ languageHolder isNil ifTrue:[
+ languageHolder := ValueHolder new.
+ ].
+ ^ languageHolder
+!
+
+languageHolder:aValueHolder
+
+ languageHolder := aValueHolder.
+ codeView notNil ifTrue:[codeView languageHolder: aValueHolder].
+ diffView notNil ifTrue:[diffView languageHolder: aValueHolder].
+
+ "Modified: / 19-07-2011 / 12:54:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
showDiffHolder
"return/create the 'showDiffHolder' value holder (automatically generated)"
@@ -575,12 +755,16 @@
(changedObject == textAHolder or:[changedObject == textBHolder]) ifTrue:[
- self updateAfterAorBChanged.
- ^ self.
- ].
+ self updateAfterAorBChanged.
+ ^ self.
+ ].
+ (changedObject == showDiffHolder) ifTrue:[
+ self updateViews.
+ ^self.
+ ].
super update:something with:aParameter from:changedObject
- "Modified: / 06-07-2011 / 12:46:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-07-2011 / 11:30:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
updateAfterAorBChanged
@@ -589,17 +773,49 @@
numChangedTexts >= 2 ifFalse:[^self].
numChangedTexts := 0.
- diffView ifNil:[^self].
- diffView scrolledView ifNil:[^self].
- diffView scrolledView
- text1: self textAHolder value
- text2: self textBHolder value
+ self updateViews
"Created: / 06-07-2011 / 12:12:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateViews
+
+ | a b |
+ a := self textAHolder value.
+ b := self textBHolder value.
+
+ self showDiffHolder value ifFalse:[
+ self showTextOnly.
+ ^ self
+ ].
+
+ (a notNil and:[b notNil]) ifTrue:[
+ self showDiff.
+ ^self
+ ].
+ a notNil ifTrue:[
+ self showVersionA.
+ ^self
+ ].
+ b notNil ifTrue:[
+ self showVersionB.
+ ^self
+ ].
+
+ self breakPoint: #jv.
+
+ "Created: / 19-07-2011 / 11:29:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TextDiffTool methodsFor:'hooks'!
+postBuildCodeView:aScrollableView
+
+ codeView := aScrollableView
+
+ "Created: / 19-07-2011 / 10:17:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
postBuildDiffView:aScrollableView
diffView := aScrollableView
@@ -617,10 +833,46 @@
"Modified: / 06-07-2011 / 12:15:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!TextDiffTool methodsFor:'private'!
+
+showDiff
+
+ self diffSpecHolder value: #diffSpec.
+
+ diffView ifNil:[^self].
+ diffView scrolledView ifNil:[^self].
+ diffView scrolledView
+ text1: self textAHolder value
+ text2: self textBHolder value
+
+ "Created: / 19-07-2011 / 10:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+showTextOnly
+
+ self diffSpecHolder value: #textViewSpec
+
+ "Created: / 19-07-2011 / 11:39:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+showVersionA
+
+ self diffSpecHolder value: #versionAOnlySpec
+
+ "Created: / 19-07-2011 / 10:22:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+showVersionB
+
+ self diffSpecHolder value: #versionBOnlySpec
+
+ "Created: / 19-07-2011 / 10:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!TextDiffTool class methodsFor:'documentation'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__TextDiffTool.st,v 1.1 2011-07-06 12:03:36 vrany Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__TextDiffTool.st,v 1.2 2011-07-19 12:32:56 vrany Exp $'
!
version_SVN