'From Squeak3.1alpha of 5 February 2001 [latest update: #3740] on 27 February 2001 at 8:35:10 am'! "Change Set: miscFeb-sw Date: 27 February 2001 Author: Scott Wallace * Allows, in the #addList: menu constructors, a third element to each tuple which can hold the corresponding balloon help. * Provides an alternative form of the menu that pops up showing all messages sent in a method (which is used by the senders of... and implementors of... features) which can have a caption. * Somewhat rationalizes the (long-standing) different ways to force a refetch in a Browser on the one hand and a MessageSet on the other by introducing method #setContentsToForceRefresh. * Elevates #browseImplementors to CodeHolder so it can be used by VersionsBrowsers, for example. * Mark protocol browsers as not 'growable'. * Removes ancient dead branches in a couple of methods of CategoryViewer relating to roads not taken. * Removes various other dead code."! !CategoryViewer methodsFor: 'categories' stamp: 'sw 2/23/2001 22:31'! categoryChoice: aCategory "Make the given category be my current one." | bin actualPane | (actualPane _ namePane renderedMorph) firstSubmorph contents: aCategory; color: Color black. actualPane extent: actualPane firstSubmorph extent. bin _ PhraseWrapperMorph new borderWidth: 0; listDirection: #topToBottom. bin addAllMorphs: ((scriptedPlayer tilePhrasesForCategory: aCategory inViewer: self) collect: [:aViewerRow | self viewerEntryFor: aViewerRow]). bin enforceTileColorPolicy. submorphs size < 2 ifTrue: [self addMorphBack: bin] ifFalse: [self replaceSubmorph: self listPane by: bin]. self world ifNotNil: [self world startSteppingSubmorphsOf: self] ! ! !CategoryViewer methodsFor: 'categories' stamp: 'sw 2/23/2001 22:29'! currentCategory "Answer the symbol representing the receiver's currently-selected category" | current | current _ namePane renderedMorph firstSubmorph contents. ^ current ifNotNil: [current asSymbol] ifNil: [#basic]! ! !CodeHolder methodsFor: 'contents' stamp: 'sw 2/14/2001 15:25'! setContentsToForceRefetch "Set the receiver's contents such that on the next update the contents will be formulated afresh. This is a critical and obscure difference between Browsers on the one hand and MessageSets on the other, and has over the years been the source of much confusion and much difficulty. By centralizing the different handling here, we don't need so many idiosyncratic overrides in MessageSet any more" contents _ nil! ! !CodeHolder methodsFor: 'misc' stamp: 'sw 2/27/2001 07:26'! browseImplementors "Create and schedule a message set browser on all implementors of the currently selected message selector. Do nothing if no message is selected." | aMessageName | (aMessageName _ self selectedMessageName) ifNotNil: [Smalltalk browseAllImplementorsOf: aMessageName]! ! !CodeHolder methodsFor: 'self-updating' stamp: 'sw 2/14/2001 15:34'! updateCodePaneIfNeeded "If the code for the currently selected method has changed underneath me, then update the contents of my code pane unless it holds unaccepted edits" self didCodeChangeElsewhere ifTrue: [self hasUnacceptedEdits ifFalse: [self setContentsToForceRefetch. self contentsChanged] ifTrue: [self changed: #codeChangedElsewhere]]! ! !CustomMenu methodsFor: 'construction' stamp: 'sw 2/27/2001 07:52'! addList: listOfTuplesAndDashes "Add a menu item to the receiver for each tuple in the given list of the form ( ). Add a line for each dash (-) in the list. The tuples may have an optional third element, providing balloon help for the item, but such an element is ignored in mvc." listOfTuplesAndDashes do: [:aTuple | aTuple == #- ifTrue: [self addLine] ifFalse: [self add: aTuple first action: aTuple second]] "CustomMenu new addList: #( ('apples' buyApples) ('oranges' buyOranges) - ('milk' buyMilk)); startUp" ! ! !MenuMorph methodsFor: 'construction' stamp: 'sw 2/27/2001 07:50'! addList: aList "Add the given items to this menu, where each item is a pair ( ).. If an element of the list is simply the symobl $-, add a line to the receiver. The optional third element of each entry, if present, provides balloon help." aList do: [:tuple | (tuple == #-) ifTrue: [self addLine] ifFalse: [self add: tuple first action: tuple second. tuple size > 2 ifTrue: [self balloonTextForLastItem: tuple third]]]! ! !MessageSet methodsFor: 'contents' stamp: 'sw 2/14/2001 15:25'! setContentsToForceRefetch "Set the receiver's contents such that on the next update the contents will be formulated afresh. This is a critical and obscure difference between Browsers on the one hand and MessageSets on the other, and has over the years been the source of much confusion and much difficulty. By centralizing the different handling here, we don't need so many idiosyncratic overrides in MessageSet any more" contents _ ''! ! !ProtocolBrowser methodsFor: 'accessing' stamp: 'sw 1/28/2001 21:01'! growable "Answer whether the receiver is subject to manual additions and deletions" ^ false! ! !SystemDictionary methodsFor: 'browsing' stamp: 'sw 12/5/2000 14:18'! showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock "Show a sorted menu of the given selectors, preceded by firstItem, and all abbreviated to 40 characters. Evaluate choiceBlock if a message is chosen." ^ self showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock withCaption: nil! ! !SystemDictionary methodsFor: 'browsing' stamp: 'sw 12/13/2000 17:06'! showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock withCaption: aCaption "Show a sorted menu of the given selectors, preceded by firstItem, and all abbreviated to 40 characters. Use aCaption as the menu title, if it is not nil. Evaluate choiceBlock if a message is chosen." | index menuLabels sortedList aMenu | sortedList _ selectorCollection asSortedCollection. menuLabels _ String streamContents: [:strm | strm nextPutAll: (firstItem contractTo: 40). sortedList do: [:sel | strm cr; nextPutAll: (sel contractTo: 40)]]. aMenu _ PopUpMenu labels: menuLabels lines: #(1). index _ aCaption ifNotNil: [aMenu startUpWithCaption: aCaption] ifNil: [aMenu startUp]. index = 1 ifTrue: [choiceBlock value: firstItem]. index > 1 ifTrue: [choiceBlock value: (sortedList at: index - 1)]! ! Player class removeSelector: #flagshipInstance! Player removeSelector: #beep:! Player removeSelector: #isFlagshipForClass! MessageSet removeSelector: #updateCodePaneIfNeeded! Browser removeSelector: #browseImplementors!