'From Squeak3.3alpha of 18 January 2002 [latest update: #4976] on 3 October 2002 at 2:17:44 am'! "Change Set: fixesEtc-sw Date: 3 October 2002 Author: Scott Wallace Published as 4977fixesEtc-sw.cs to 3.3a. ¥ Fixes 'one last' bug in the revamped implementation of #spawn: if the spawning browser were looking at the #all category, the spawned browser was being given a faulty message-category-list index, which would result in difficulty submiting the method later on. ¥ Fixes the annotation for class-comment for the case when the selection is a metaclass method. ¥ Fixes Wonderland.makePlaneNamed so that it returns the resulting actor. ¥ Fixes Scamper.back so that it does not generate an error when the document index is out of range. ¥ Bulletproofs MenuItemMorph.mouseEnter against an orphaned condition that is known to occur. ¥ Fixes bug that made text on menu tile editable; click on menu tile again brings up the list of alternatives. I don't know just when or why this got broken, but it was reported recently by Alex Peake. ¥ Fixes MenuItemMorph.veryDeepFixupWith: so that it does not bomb when arguments is nil. ¥ Adds a menu item for Recent Submissions browsers that allows the currently-selected method to be removed from the RecentSubmissions list. This is useful to rid the Recent Submissions browser of methods that were temporarily changed for debugging and subsequently reverted. ¥ FileList2 will now return a read-only stream on a file if the default read/write-access cannot be obtained. Practically, speaking, all known uses of FileList actually only need read-only access anyway. "! !CodeHolder methodsFor: 'annotation' stamp: 'sw 9/11/2002 21:30'! annotationForClassCommentFor: aClass "Provide a line of content for an annotation pane, given that the receiver is pointing at the clas comment of the given class." | aStamp nonMeta | aStamp _ (nonMeta _ aClass theNonMetaClass) organization commentStamp. ^ aStamp ifNil: [nonMeta name, ' has no class comment'] ifNotNil: ['class comment for ', nonMeta name, (aStamp = '' ifFalse: [' - ', aStamp] ifTrue: [''])]! ! !Browser methodsFor: 'accessing' stamp: 'sw 9/26/2002 17:56'! suggestCategoryToSpawnedBrowser: aBrowser "aBrowser is a message-category browser being spawned from the receiver. Tell it what it needs to know to get its category info properly set up." (self isMemberOf: Browser) "yecch, but I didn't invent the browser hierarchy" ifTrue: [aBrowser messageCategoryListIndex: (self messageCategoryList indexOf: self categoryOfCurrentMethod ifAbsent: [2])] ifFalse: [aBrowser setOriginalCategoryIndexForCurrentMethod]! ! !FileList2 methodsFor: 'as yet unclassified' stamp: 'sw 9/12/2002 00:43'! getSelectedFile "Answer a filestream on the selected file. If it cannot be opened for read/write, try read-only before giving up; answer nil if unsuccessful" ok == true ifFalse: [^ nil]. directory ifNil: [^ nil]. fileName ifNil: [^ nil]. ^ (directory oldFileNamed: fileName) ifNil: [directory readOnlyFileNamed: fileName]! ! !MenuItemMorph methodsFor: 'events' stamp: 'sw 10/3/2002 02:16'! mouseEnter: evt "The mouse entered the receiver" owner ifNotNil: [owner stayUp ifFalse: [self mouseEnterDragging: evt]]! ! !MenuItemMorph methodsFor: 'copying' stamp: 'sw 9/25/2002 03:24'! veryDeepFixupWith: deepCopier "If target and arguments fields were weakly copied, fix them here. If they were in the tree being copied, fix them up, otherwise point to the originals!!!!" super veryDeepFixupWith: deepCopier. target _ deepCopier references at: target ifAbsent: [target]. arguments notNil ifTrue: [arguments _ arguments collect: [:each | deepCopier references at: each ifAbsent: [each]]]! ! !MenuTile methodsFor: 'initialization' stamp: 'sw 10/3/2002 02:16'! initialize "Initialize the menu tile" super initialize. self addArrows; setLiteral: 'send to back'. self labelMorph useStringFormat; putSelector: nil! ! !RecentMessageSet methodsFor: 'message functions' stamp: 'sw 9/26/2002 17:59'! messageListMenu: aMenu shifted: shifted "Answer the message-list menu" shifted ifTrue: [^ self shiftedMessageListMenu: aMenu]. aMenu addList:#( ('what to show...' offerWhatToShowMenu) - ('browse full (b)' browseMethodFull) ('browse hierarchy (h)' classHierarchy) ('browse method (O)' openSingleMessageBrowser) ('browse protocol (p)' browseFullProtocol) - ('fileOut (o)' fileOutMessage) ('printOut' printOutMessage) ('copy selector (c)' copySelector) - ('senders of... (n)' browseSendersOfMessages) ('implementors of... (m)' browseMessages) ('inheritance (i)' methodHierarchy) ('versions (v)' browseVersions) - ('inst var refs...' browseInstVarRefs) ('inst var defs...' browseInstVarDefs) ('class var refs...' browseClassVarRefs) ('class variables' browseClassVariables) ('class refs (N)' browseClassRefs) - ('remove method (x)' removeMessage) ('remove from RecentSubmissions' removeFromRecentSubmissions) - ('more...' shiftedYellowButtonActivity)). ^ aMenu! ! !RecentMessageSet methodsFor: 'message functions' stamp: 'sw 9/26/2002 18:09'! removeFromRecentSubmissions "Remove the currently-selected method from the RecentSubmissions list" | aClass methodSym | ((aClass _ self selectedClassOrMetaClass) notNil and: [(methodSym _ self selectedMessageName) notNil]) ifTrue: [Utilities purgeFromRecentSubmissions: (MethodReference new setStandardClass: aClass methodSymbol: methodSym). self reformulateList]! ! !Scamper methodsFor: 'menus' stamp: 'sw 9/26/2002 18:21'! back "The user hit the back button -- go to the previous document" currentUrlIndex > 1 ifTrue: [currentUrlIndex _ currentUrlIndex - 1. currentUrlIndex <= recentDocuments size ifTrue: [self displayDocument: (recentDocuments at: currentUrlIndex)]] "this method is added to Scamper: Aibek 4/18/99"! ! !String methodsFor: 'converting' stamp: 'sw 8/3/2002 04:32'! asSignedInteger "Answer the Integer created by interpreting the receiver as the string representation of an integer, possibly with a leading minus sign. Answer nil if no digits, else find the first digit and then all consecutive digits after that" | startPosition tail endPosition | startPosition _ self findFirst: [:ch | ch isDigit or: [ch == $-]]. startPosition == 0 ifTrue: [^ nil]. tail _ self copyFrom: startPosition to: self size. endPosition _ tail findFirst: [:ch | ch isDigit not and: [ch ~~ $-]]. endPosition == 0 ifTrue: [endPosition _ tail size + 1]. ^ Number readFromString: (tail copyFrom: 1 to: endPosition - 1) " 'znak -58 to wit' asSignedInteger "! ! !String methodsFor: 'converting' stamp: 'sw 6/6/2002 18:24'! withFirstCharacterDownshifted "Answer an object like the receiver but with first character downshifted if necesary" "'MElViN' withFirstCharacterDownshifted" "#Will withFirstCharacterDownshifted" | answer | self isEmpty ifTrue: [^ self]. answer _ self isString ifTrue: ["don't change receiver" self copy] ifFalse: [self asString]. answer at: 1 put: (answer at: 1) asLowercase. ^ self isString ifTrue: [answer] ifFalse: [answer as: self class]! ! !Utilities class methodsFor: 'recent method submissions' stamp: 'sw 9/26/2002 19:16'! purgeFromRecentSubmissions: aMethodReference "Purge any reference found in RecentSubmissions to the method supplied" RecentSubmissions _ RecentSubmissions select: [:aSubmission | Utilities setClassAndSelectorFrom: aSubmission in: [:aClass :aSelector | (aClass ~~ aMethodReference actualClass) or: [aSelector ~~ aMethodReference methodSymbol]]]! ! !Wonderland methodsFor: 'creating' stamp: 'sw 9/26/2002 01:03'! makePlaneNamed: aString "Create a simple plane" | tex vertices faces mesh | tex _ B3DTexture2Array new: 4. tex at: 1 put: (0@0); at: 2 put: (1@0); at: 3 put: (1@1); at: 4 put: (0@1). vertices _ B3DVector3Array new: 4. vertices at: 1 put: -1@1@-1; at: 2 put: 1@1@-1; at: 3 put: 1@-1@-1; at: 4 put: -1@-1@-1. vertices do:[:vtx| vtx *= 0.5]. faces _ B3DIndexedTriangleArray new: 2. faces at: 1 put: (B3DIndexedTriangle with: 1 with: 2 with: 3). faces at: 2 put: (B3DIndexedTriangle with: 3 with: 4 with: 1). mesh _ B3DIndexedTriangleMesh new. mesh vertices: vertices. mesh faces: faces. mesh texCoords: tex. ^ self createSimpleActor: mesh named: aString parent: nil! !