[ENH] Browser auto-select --all--

Stephen Travis Pope stp at create.ucsb.edu
Mon Dec 6 16:50:00 UTC 1999


--------------BB3ECF8334C290EE3649998B
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
Content-Transfer-Encoding: 7bit



The attached file-in automatically selects the "all" category upon
displaying a class (or a metaclass) in the browser. It also changes the
semantics of the "?" button slightly so that it switches to display the
class definition if you press it while a method body or the method
template is shown.

--

stp
  Stephen Travis Pope
  stp at create.ucsb.edu -- http://www.create.ucsb.edu/~stp


--------------BB3ECF8334C290EE3649998B
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="522A6368";
 name="Browser-selectAll.cs"
Content-Transfer-Encoding: 7bit
Content-Description: Unknown Document
Content-Disposition: inline;
 filename="Browser-selectAll.cs"


'From Squeak2.7alpha of 17 November 1999 [latest update: #1671] on 06 December 1999 at 5:51:43 am'!

!Browser methodsFor: 'class list' stamp: 'stp 12/06/1999 05:49'!
classListIndex: anInteger 
	"Set anInteger to be the index of the current class selection."

	| className |
	classListIndex := anInteger.
	self setClassOrganizer.
	messageCategoryListIndex := 0.
	messageListIndex := 0.
	self classCommentIndicated
		ifTrue: []
		ifFalse: [editSelection := anInteger = 0
					ifTrue: [metaClassIndicated | (systemCategoryListIndex == 0)
						ifTrue: [#none]
						ifFalse: [#newClass]]
					ifFalse: [#editClass]].
	contents := nil.
	self selectedClass isNil
		ifFalse: [className := self selectedClass name.
					(RecentClasses includes: className)
				ifTrue: [RecentClasses remove: className].
			RecentClasses addFirst: className.
			RecentClasses size > 16
				ifTrue: [RecentClasses removeLast]].
	self changed: #classSelectionChanged.
	self changed: #classListIndex.	"update my selection"
	self changed: #messageCategoryList.
"STP -- Select the 'all' protocol by default"
	classListIndex = 0
		ifFalse: [self messageCategoryListIndex: 1]
		ifTrue: [self changed: #messageList.
				self changed: #contents]! !

!Browser methodsFor: 'metaclass' stamp: 'stp 12/06/1999 05:49'!
metaClassIndicated: trueOrFalse 
	"Indicate whether browsing instance or class messages."

	metaClassIndicated := trueOrFalse.
	self setClassOrganizer.
	systemCategoryListIndex > 0 ifTrue:
		[editSelection := classListIndex = 0
			ifTrue: [metaClassIndicated
				ifTrue: [#none]
				ifFalse: [#newClass]]
			ifFalse: [#editClass]].
	messageCategoryListIndex := 0.
	messageListIndex := 0.
	contents := nil.
	self changed: #classSelectionChanged.
	self changed: #messageCategoryList.
	self changed: #messageList.
	self changed: #contents.
"STP -- Select the 'all' protocol by default"
	classListIndex = 0
		ifFalse: [self messageCategoryListIndex: 1]
		ifTrue: [self changed: #messageList.
				self changed: #contents]! !

!Browser methodsFor: 'class functions' stamp: 'stp 12/06/1999 08:47'!
plusButtonHit
	"Cycle between definition, comment, and hierachy"

	editSelection == #editComment
		ifTrue: [self hierarchy. ^ self].
	(#(hierarchy editMessage newMessage) includes: editSelection)
		ifTrue: [editSelection := #editClass.
			classListIndex = 0 ifTrue: [^ self].
			self okToChange ifFalse: [^ self].
			self changed: #editComment.
			self contentsChanged.
			^self].
	classListIndex = 0 ifTrue: [^ self].
	self okToChange ifFalse: [^ self].
	self messageCategoryListIndex: 0.
	editSelection := #editComment.
	self changed: #classSelectionChanged.
	self contentsChanged.! !

--------------BB3ECF8334C290EE3649998B--





More information about the Squeak-dev mailing list