--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Tools__TextDiffTool.st Wed Jul 06 14:03:36 2011 +0200
@@ -0,0 +1,628 @@
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+"{ Package: 'stx:libbasic3' }"
+
+"{ NameSpace: Tools }"
+
+ApplicationModel subclass:#TextDiffTool
+ instanceVariableNames:'labelAHolder textAHolder labelBHolder textBHolder diffSpecHolder
+ showDiffHolder diffView numChangedTexts'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-Diff'
+!
+
+!TextDiffTool class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+! !
+
+!TextDiffTool class methodsFor:'image specs'!
+
+versionA24x24
+
+ ^ToolbarIconLibrary versionA24x24
+
+ "Created: / 24-03-2010 / 20:49:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionB24x24
+
+ ^ToolbarIconLibrary versionB24x24
+
+ "Created: / 24-03-2010 / 20:50:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionBase24x24
+
+ ^ToolbarIconLibrary versionBase24x24
+
+ "Created: / 24-03-2010 / 20:50:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TextDiffTool class methodsFor:'interface specs'!
+
+diffSpec
+ "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:#diffSpec
+ Tools::TextDiffTool new openInterface:#diffSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: diffSpec
+ window:
+ (WindowSpec
+ label: 'Text Diff Tool (for embedding)'
+ name: 'Text Diff Tool (for embedding)'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 782 506)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: '2Labels'
+ layout: (LayoutFrame 0 0 0 0 -16 1 30 0)
+ component:
+ (SpecCollection
+ collection: (
+ (UISubSpecification
+ name: 'VersionA'
+ layout: (LayoutFrame 0 0 0 0 0 0.5 30 0)
+ minorKey: versionALabelSpec
+ )
+ (UISubSpecification
+ name: 'VersionB'
+ layout: (LayoutFrame 5 0.5 0 0 0 1 30 0)
+ minorKey: versionBLabelSpec
+ )
+ )
+
+ )
+ )
+ (ArbitraryComponentSpec
+ name: 'Diff2TextView'
+ layout: (LayoutFrame 0 0 30 0 0 1 0 1)
+ hasHorizontalScrollBar: false
+ hasVerticalScrollBar: false
+ autoHideScrollBars: false
+ hasBorder: false
+ component: #'Tools::DiffCodeView2'
+ postBuildCallback: postBuildDiffView:
+ )
+ )
+
+ )
+ )
+!
+
+windowSpec
+ "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:#windowSpec
+ Tools::TextDiffTool new openInterface:#windowSpec
+ Tools::TextDiffTool open
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: windowSpec
+ window:
+ (WindowSpec
+ label: 'Text Diff Tool'
+ name: 'Text Diff Tool'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 640 480)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (UISubSpecification
+ name: 'Contents'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ minorKey: windowSpecForEmbedding
+ )
+ )
+
+ )
+ )
+
+ "Modified: / 30-06-2011 / 20:45:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+windowSpecForEmbedding
+ "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:#windowSpecForEmbedding
+ Tools::TextDiffTool new openInterface:#windowSpecForEmbedding
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: windowSpecForEmbedding
+ window:
+ (WindowSpec
+ label: 'Text Diff Tool (for embedding)'
+ name: 'Text Diff Tool (for embedding)'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 782 506)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (SubCanvasSpec
+ name: 'Contents'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ hasHorizontalScrollBar: false
+ hasVerticalScrollBar: false
+ specHolder: diffSpecHolder
+ createNewBuilder: false
+ )
+ )
+
+ )
+ )
+! !
+
+!TextDiffTool class methodsFor:'interface specs - labels'!
+
+versionALabelSpec
+ "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:SVN::DiffViewApp andSelector:#versionALabelSpec
+ SVN::DiffViewApp new openInterface:#versionALabelSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: versionALabelSpec
+ window:
+ (WindowSpec
+ label: 'Version A'
+ name: 'Version A'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 300 30)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'versionA24x24'
+ name: 'VersionAIcon'
+ layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5)
+ hasCharacterOrientedLabel: false
+ translateLabel: true
+ )
+ (LabelSpec
+ label: 'Version A'
+ name: 'VersionALabel'
+ layout: (LayoutFrame 30 0 0 0 0 1 0 1)
+ translateLabel: true
+ labelChannel: labelAHolder
+ resizeForLabel: true
+ adjust: left
+ )
+ )
+
+ )
+ )
+
+ "Modified: / 30-06-2011 / 20:53:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionBLabelSpec
+ "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:SVN::DiffViewApp andSelector:#versionBLabelSpec
+ SVN::DiffViewApp new openInterface:#versionBLabelSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: versionBLabelSpec
+ window:
+ (WindowSpec
+ label: 'Version B'
+ name: 'Version B'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 300 30)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'versionB24x24'
+ name: 'VersionBIcon'
+ layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5)
+ hasCharacterOrientedLabel: false
+ translateLabel: true
+ )
+ (LabelSpec
+ label: 'Version B'
+ name: 'VersionBLabel'
+ layout: (LayoutFrame 30 0 0 0 0 1 0 1)
+ translateLabel: true
+ labelChannel: labelBHolder
+ resizeForLabel: true
+ adjust: left
+ useDynamicPreferredWidth: true
+ usePreferredWidth: true
+ )
+ )
+
+ )
+ )
+
+ "Modified: / 30-06-2011 / 20:53:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionBaseLabelSpec
+ "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:SVN::DiffViewApp andSelector:#versionBaseLabelSpec
+ SVN::DiffViewApp new openInterface:#versionBaseLabelSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: versionBaseLabelSpec
+ window:
+ (WindowSpec
+ label: 'Version Base'
+ name: 'Version Base'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 300 30)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'versionBase24x24'
+ name: 'VersionBaseIcon'
+ layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5)
+ hasCharacterOrientedLabel: false
+ translateLabel: true
+ )
+ (LabelSpec
+ label: 'Version Base'
+ name: 'VersionBaseLabel'
+ layout: (LayoutFrame 30 0 5 0 191 0 0 1)
+ translateLabel: true
+ labelChannel: versionBaseLabelAspect
+ resizeForLabel: true
+ adjust: left
+ useDynamicPreferredWidth: true
+ usePreferredWidth: true
+ )
+ )
+
+ )
+ )
+
+ "Modified: / 24-03-2010 / 20:51:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TextDiffTool class methodsFor:'plugIn spec'!
+
+aspectSelectors
+ "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."
+
+ "Return a description of exported aspects;
+ these can be connected to aspects of an embedding application
+ (if this app is embedded in a subCanvas)."
+
+ ^ #(
+ #labelAHolder
+ #labelBHolder
+ #textAHolder
+ #textBHolder
+ ).
+
+! !
+
+!TextDiffTool methodsFor:'aspects'!
+
+diffSpecHolder
+ "return/create the 'diffSpecHolder' value holder (automatically generated)"
+
+ diffSpecHolder isNil ifTrue:[
+ diffSpecHolder := ValueHolder with: #diffSpec.
+ diffSpecHolder addDependent:self.
+ ].
+ ^ diffSpecHolder
+
+ "Modified: / 06-07-2011 / 11:57:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+diffSpecHolder:something
+ "set the 'diffSpecHolder' value holder (automatically generated)"
+
+ |oldValue newValue|
+
+ diffSpecHolder notNil ifTrue:[
+ oldValue := diffSpecHolder value.
+ diffSpecHolder removeDependent:self.
+ ].
+ diffSpecHolder := something.
+ diffSpecHolder notNil ifTrue:[
+ diffSpecHolder addDependent:self.
+ ].
+ newValue := diffSpecHolder value.
+ oldValue ~~ newValue ifTrue:[
+ self update:#value with:newValue from:diffSpecHolder.
+ ].
+!
+
+labelAHolder
+ "return/create the 'labelAHolder' value holder (automatically generated)"
+
+ labelAHolder isNil ifTrue:[
+ labelAHolder := ValueHolder new.
+ labelAHolder addDependent:self.
+ ].
+ ^ labelAHolder
+!
+
+labelAHolder:something
+ "set the 'labelAHolder' value holder (automatically generated)"
+
+ |oldValue newValue|
+
+ labelAHolder notNil ifTrue:[
+ oldValue := labelAHolder value.
+ labelAHolder removeDependent:self.
+ ].
+ labelAHolder := something.
+ labelAHolder notNil ifTrue:[
+ labelAHolder addDependent:self.
+ ].
+ newValue := labelAHolder value.
+ oldValue ~~ newValue ifTrue:[
+ self update:#value with:newValue from:labelAHolder.
+ ].
+!
+
+labelBHolder
+ "return/create the 'labelBHolder' value holder (automatically generated)"
+
+ labelBHolder isNil ifTrue:[
+ labelBHolder := ValueHolder new.
+ labelBHolder addDependent:self.
+ ].
+ ^ labelBHolder
+!
+
+labelBHolder:something
+ "set the 'labelBHolder' value holder (automatically generated)"
+
+ |oldValue newValue|
+
+ labelBHolder notNil ifTrue:[
+ oldValue := labelBHolder value.
+ labelBHolder removeDependent:self.
+ ].
+ labelBHolder := something.
+ labelBHolder notNil ifTrue:[
+ labelBHolder addDependent:self.
+ ].
+ newValue := labelBHolder value.
+ oldValue ~~ newValue ifTrue:[
+ self update:#value with:newValue from:labelBHolder.
+ ].
+!
+
+showDiffHolder
+ "return/create the 'showDiffHolder' value holder (automatically generated)"
+
+ showDiffHolder isNil ifTrue:[
+ showDiffHolder := ValueHolder with: true.
+ showDiffHolder addDependent:self.
+ ].
+ ^ showDiffHolder
+
+ "Modified: / 30-06-2011 / 20:59:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+showDiffHolder:something
+ "set the 'showDiffHolder' value holder (automatically generated)"
+
+ |oldValue newValue|
+
+ showDiffHolder notNil ifTrue:[
+ oldValue := showDiffHolder value.
+ showDiffHolder removeDependent:self.
+ ].
+ showDiffHolder := something.
+ showDiffHolder notNil ifTrue:[
+ showDiffHolder addDependent:self.
+ ].
+ newValue := showDiffHolder value.
+ oldValue ~~ newValue ifTrue:[
+ self update:#value with:newValue from:showDiffHolder.
+ ].
+!
+
+textAHolder
+ "return/create the 'textAHolder' value holder (automatically generated)"
+
+ textAHolder isNil ifTrue:[
+ textAHolder := ValueHolder new.
+ textAHolder addDependent:self.
+ ].
+ ^ textAHolder
+!
+
+textAHolder:something
+ "set the 'textAHolder' value holder (automatically generated)"
+
+ |oldValue newValue|
+
+ textAHolder notNil ifTrue:[
+ oldValue := textAHolder value.
+ textAHolder removeDependent:self.
+ ].
+ textAHolder := something.
+ textAHolder notNil ifTrue:[
+ textAHolder addDependent:self.
+ ].
+ newValue := textAHolder value.
+ oldValue ~~ newValue ifTrue:[
+ self update:#value with:newValue from:textAHolder.
+ ].
+!
+
+textBHolder
+ "return/create the 'textBHolder' value holder (automatically generated)"
+
+ textBHolder isNil ifTrue:[
+ textBHolder := ValueHolder new.
+ textBHolder addDependent:self.
+ ].
+ ^ textBHolder
+!
+
+textBHolder:something
+ "set the 'textBHolder' value holder (automatically generated)"
+
+ |oldValue newValue|
+
+ textBHolder notNil ifTrue:[
+ oldValue := textBHolder value.
+ textBHolder removeDependent:self.
+ ].
+ textBHolder := something.
+ textBHolder notNil ifTrue:[
+ textBHolder addDependent:self.
+ ].
+ newValue := textBHolder value.
+ oldValue ~~ newValue ifTrue:[
+ self update:#value with:newValue from:textBHolder.
+ ].
+! !
+
+!TextDiffTool methodsFor:'change & update'!
+
+update:something with:aParameter from:changedObject
+ "Invoked when an object that I depend upon sends a change notification."
+
+
+ (changedObject == textAHolder or:[changedObject == textBHolder]) ifTrue:[
+ self updateAfterAorBChanged.
+ ^ self.
+ ].
+ super update:something with:aParameter from:changedObject
+
+ "Modified: / 06-07-2011 / 12:46:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateAfterAorBChanged
+
+ numChangedTexts := numChangedTexts + 1.
+ numChangedTexts >= 2 ifFalse:[^self].
+ numChangedTexts := 0.
+
+ diffView ifNil:[^self].
+ diffView scrolledView ifNil:[^self].
+ diffView scrolledView
+ text1: self textAHolder value
+ text2: self textBHolder value
+
+ "Created: / 06-07-2011 / 12:12:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TextDiffTool methodsFor:'hooks'!
+
+postBuildDiffView:aScrollableView
+
+ diffView := aScrollableView
+
+ "Created: / 30-06-2011 / 20:55:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TextDiffTool methodsFor:'initialization'!
+
+initialize
+
+ super initialize.
+ numChangedTexts := 0.
+
+ "Modified: / 06-07-2011 / 12:15:04 / 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 $'
+!
+
+version_SVN
+ ^ '§Id§'
+! !