[ENH] More Diff Support Tweaks

Mark A. Schwenk mas at wellthot.com
Sun May 21 07:46:45 UTC 2000


The following changes were done for Morphic.

Change Set:		MoreDiffSupport
Date:			21 May 2000
Author:			Mark Schwenk

This change set pushes up the diffButton in the optionalButtonRow from MessageList into Browser.

It also provides diff support for the code pane in ChangeSorters and adds a shiftedMessageMenu item to toggle diff mode.

So what does this really mean? You can now more easily diff what you see in a code pane against its previous version in more places.
-------------- next part --------------
'From Squeak2.8alpha of 19 January 2000 [latest update: #2158] on 21 May 2000 at 1:59:03 am'!
"Change Set:		MoreDiffSupport
Date:			21 May 2000
Author:			Mark Schwenk

This change set pushes up the diffButton in the optionalButtonRow from MessageList into Browser.

It also provides diff support for the code pane in ChangeSorters and adds a shiftedMessageMenu item to toggle diff mode.

So what does this really mean? You can now more easily diff what you see in a code pane against its previous version in more places."!


!Browser methodsFor: 'initialize-release' stamp: 'mas 5/20/2000 21:07'!
optionalButtonRow
	| aRow aButton |
	aRow _ AlignmentMorph newRow.
	aRow beSticky.
	aRow hResizing: #spaceFill.
	aRow setProperty: #clipToOwnerWidth toValue: true.
	aRow addTransparentSpacerOfSize: (5 at 0).
	self optionalButtonPairs  do:
			[:pair |
				aButton _ PluggableButtonMorph
					on: self
					getState: nil
					action: pair second.
				aButton useRoundedCorners;
					label: pair first asString;
					onColor: Color transparent offColor: Color transparent.
				aRow addMorphBack: aButton.
				aRow addTransparentSpacerOfSize: (3 @ 0)].
	aRow addMorphBack: self diffButton.
	^ aRow! !


!ChangeSorter methodsFor: 'message list' stamp: 'mas 5/20/2000 21:47'!
shiftedMessageMenu: aMenu

	^ aMenu addList: #(

		-
		('method pane' 						makeIsolatedCodePane)
		('toggle diffing'						toggleDiffing)
		('implementors of sent messages'		browseAllMessages)
		('change category...'				changeCategory)
			-
		('sample instance'					makeSampleInstance)
		('inspect instances'					inspectInstances)
		('inspect subinstances'				inspectSubInstances)
		-
		('change sets with this method'		findMethodInChangeSets)
		('revert to previous version'			revertToPreviousVersion)
		('revert and forget'					revertAndForget)
		-
		('more...' 							unshiftedYellowButtonActivity))! !

!ChangeSorter methodsFor: 'code pane' stamp: 'mas 5/20/2000 22:03'!
setContents
	"return the source code that shows in the bottom pane"
	| sel class strm changeType |
	self clearUserEditFlag.
	currentClassName ifNil: [^ contents _ myChangeSet preambleString ifNil: ['']].
	class _ self selectedClassOrMetaClass.
	(sel _ currentSelector) == nil
		ifFalse: [changeType _ (myChangeSet atSelector: (sel _ sel asSymbol) class: class).
			changeType == #remove
				ifTrue: [^ contents _ 'Method has been removed (see versions)'].
			changeType == #addedThenRemoved
				ifTrue: [^ contents _ 'Added then removed (see versions)'].
			class ifNil: [^ contents _ 'Method was added, but cannot be found!!'].
			(class includesSelector: sel)
				ifFalse: [^ contents _ 'Method was added, but cannot be found!!'].
			contents _ class sourceCodeAt: sel.
			Preferences browseWithPrettyPrint ifTrue:
				[contents _ class compilerClass new
					format: contents in: class notifying: nil decorated: Preferences colorWhenPrettyPrinting].
			self showDiffs
				ifTrue: [contents _ self diffFromPriorSourceFor: contents].
			^ contents _ contents asText makeSelectorBoldIn: class]
		ifTrue: [strm _ WriteStream on: (String new: 100).
			(myChangeSet classChangeAt: currentClassName) do:
				[:each |
				each = #remove ifTrue: [strm nextPutAll: 'Entire class was removed.'; cr].
				each = #addedThenRemoved ifTrue: [strm nextPutAll: 'Class was added then removed.'].
				each = #rename ifTrue: [strm nextPutAll: 'Class name was changed.'; cr].
				each = #add ifTrue: [strm nextPutAll: 'Class definition was added.'; cr].
				each = #change ifTrue: [strm nextPutAll: 'Class definition was changed.'; cr].
				each = #reorganize ifTrue: [strm nextPutAll: 'Class organization was changed.'; cr].
				each = #comment ifTrue: [strm nextPutAll: 'New class comment.'; cr.
				]].
			^ contents _ strm contents].! !


!MessageSet methodsFor: 'message list' stamp: 'mas 5/21/2000 01:25'!
optionalButtonRow
	| aRow |
	aRow _ super optionalButtonRow.
	aRow centering: #center.
	^ aRow! !



More information about the Squeak-dev mailing list