Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.78.mcz ==================== Summary ==================== Name: ST80-nice.78 Author: nice Time: 26 December 2009, 11:47:03 am UUID: 213d76c1-73e2-41a1-8bce-3aae46a37774 Ancestors: ST80-nice.77 Cosmetic: puch a few temps inside closures =============== Diff against ST80-nice.77 =============== Item was changed: ----- Method: ParagraphEditor>>browseClassFromIt (in category 'menu messages') ----- browseClassFromIt "Launch a browser for the class indicated by the current selection. If multiple classes matching the selection exist, let the user choose among them." + | aClass | - | aBrow aClass | self lineSelectAndEmptyCheck: [^ self]. aClass := Utilities classFromPattern: (self selection string copyWithoutAll: CharacterSet separators) withCaption: 'choose a class to browse...'. aClass ifNil: [^ view flash]. self terminateAndInitializeAround: + [| aBrow | + aBrow := SystemBrowser default new. - [aBrow := SystemBrowser default new. aBrow setClass: aClass selector: nil. aBrow class openBrowserView: (aBrow openEditString: nil) label: 'System Browser'].! Item was changed: ----- Method: ParagraphEditor>>presentSpecialMenu (in category 'menu messages') ----- presentSpecialMenu "Present a list of expressions, and if the user chooses one, evaluate it in the context of the receiver, a ParagraphEditor. Primarily for debugging, this provides a convenient way to talk to the various views, controllers, and models associated with any text pane" - | reply items | self terminateAndInitializeAround: + [| reply items | + reply := (UIManager default chooseFrom: (items := self specialMenuItems) lines: #()). - [reply := (UIManager default chooseFrom: (items := self specialMenuItems) lines: #()). reply = 0 ifTrue: [^ self]. Compiler new evaluate: (items at: reply) in: [] to: self] ! Item was changed: ----- Method: Paragraph>>clickAt:for:controller: (in category 'selecting') ----- clickAt: clickPoint for: model controller: aController "Give sensitive text a chance to fire. Display flash: (100@100 extent: 100@100)." + | startBlock action | - | startBlock action range box boxes | action := false. startBlock := self characterBlockAtPoint: clickPoint. (text attributesAt: startBlock stringIndex forStyle: textStyle) do: [:att | att mayActOnClick ifTrue: + [| range boxes box | + range := text rangeOf: att startingAt: startBlock stringIndex. - [range := text rangeOf: att startingAt: startBlock stringIndex. boxes := self selectionRectsFrom: (self characterBlockForIndex: range first) to: (self characterBlockForIndex: range last+1). box := boxes detect: [:each | each containsPoint: clickPoint] ifNone: [^ action]. Utilities awaitMouseUpIn: box repeating: [] ifSucceed: [aController terminateAndInitializeAround: [(att actOnClickFor: model in: self at: clickPoint editor: aController) ifTrue: [action := true]]]]]. ^ action! Item was changed: ----- Method: PopUpMenu>>startUpLeftFlush (in category 'accessing') ----- startUpLeftFlush "Build and invoke this menu with no initial selection. By Jerry Archibald, 4/01. If in MVC, align menus items with the left margin. Answer the selection associated with the menu item chosen by the user or nil if none is chosen. The mechanism for getting left-flush appearance in mvc leaves a tiny possibility for misadventure: if the user, in mvc, puts up the jump-to-project menu, then hits cmd period while it is up, then puts up a second jump-to-project menu before dismissing or proceeding through the debugger, it's possible for mvc popup-menus thereafter to appear left-aligned rather than centered; this very unlikely condition can be cleared by evaluating 'PopUpMenu alignment: 2'" + | saveAlignment | - | saveAlignment result | Smalltalk isMorphic ifFalse: [saveAlignment := PopUpMenu alignment. PopUpMenu leftFlush]. + ^[self startUp] ensure: - [result := self startUp] ensure: [Smalltalk isMorphic ifFalse: + [PopUpMenu alignment: saveAlignment]].! - [PopUpMenu alignment: saveAlignment]]. - ^ result! Item was changed: ----- Method: StandardSystemView>>chooseMoveRectangle (in category 'framing') ----- chooseMoveRectangle "Ask the user to designate a new window rectangle." + | offset | - | offset p | offset := Sensor anyButtonPressed "Offset if draggin, eg, label" ifTrue: [self windowBox topLeft - Sensor cursorPoint] ifFalse: [0@0]. self isCollapsed ifTrue: [^ self labelDisplayBox newRectFrom: + [:f | | p | + p := Sensor cursorPoint + offset. - [:f | p := Sensor cursorPoint + offset. p := (p max: 0@0) truncateTo: 8. p extent: f extent]] ifFalse: [^ self windowBox newRectFrom: + [:f | | p | + p := Sensor cursorPoint + offset. - [:f | p := Sensor cursorPoint + offset. self constrainFrame: (p extent: f extent)]]! Item was changed: ----- Method: ParagraphEditor>>browseIt (in category 'menu messages') ----- browseIt "Launch a browser for the current selection, if appropriate" + | aSymbol | - | aSymbol anEntry | self flag: #yoCharCases. Preferences alternativeBrowseIt ifTrue: [^ self browseClassFromIt]. self lineSelectAndEmptyCheck: [^ self]. (aSymbol := self selectedSymbol) isNil ifTrue: [^ view flash]. self terminateAndInitializeAround: [aSymbol first isUppercase ifTrue: + [| anEntry | + anEntry := (Smalltalk - [anEntry := (Smalltalk at: aSymbol ifAbsent: [ self systemNavigation browseAllImplementorsOf: aSymbol. ^ nil]). anEntry isNil ifTrue: [^ view flash]. (anEntry isBehavior or: [ anEntry isTrait ]) ifFalse: [ anEntry := anEntry class ]. ToolSet browse: anEntry selector: nil. ] ifFalse:[ self systemNavigation browseAllImplementorsOf: aSymbol]]! Item was changed: ----- Method: StandardSystemView>>subviewWithLongestSide:near: (in category 'private') ----- subviewWithLongestSide: sideBlock near: aPoint + | theSub theSide theLen | - | theSub theSide theLen box | theLen := 0. subViews do: + [:sub | + | box | + box := sub insetDisplayBox. - [:sub | box := sub insetDisplayBox. box forPoint: aPoint closestSideDistLen: [:side :dist :len | (dist <= 5 and: [len > theLen]) ifTrue: [theSub := sub. theSide := side. theLen := len]]]. sideBlock value: theSide. ^ theSub! Item was changed: ----- Method: ParagraphEditor>>inOutdent:delta: (in category 'editing keys') ----- inOutdent: characterStream delta: delta "Add/remove a tab at the front of every line occupied by the selection. Flushes typeahead. Derived from work by Larry Tesler back in December 1985. Now triggered by Cmd-L and Cmd-R. 2/29/96 sw" | realStart realStop lines startLine stopLine start stop adjustStart indentation size numLines inStream newString outStream | sensor keyboard. "Flush typeahead" "Operate on entire lines, but remember the real selection for re-highlighting later" realStart := self startIndex. realStop := self stopIndex - 1. "Special case a caret on a line of its own, including weird case at end of paragraph" (realStart > realStop and: [realStart < 2 or: [(paragraph string at: realStart - 1) == Character cr or: [(paragraph string at: realStart - 1) == Character lf]]]) ifTrue: [delta < 0 ifTrue: [view flash] ifFalse: [self replaceSelectionWith: Character tab asSymbol asText. self selectAt: realStart + 1]. ^ true]. lines := paragraph lines. startLine := paragraph lineIndexOfCharacterIndex: realStart. stopLine := paragraph lineIndexOfCharacterIndex: (realStart max: realStop). start := (lines at: startLine) first. stop := (lines at: stopLine) last. "Pin the start of highlighting unless the selection starts a line" adjustStart := realStart > start. "Find the indentation of the least-indented non-blank line; never outdent more" indentation := (startLine to: stopLine) inject: 1000 into: [:m :l | + m min: (paragraph indentationOfLineIndex: l ifBlank: [:tabs | 1000])]. - m := m min: (paragraph indentationOfLineIndex: l ifBlank: [:tabs | 1000])]. size := stop + 1 - start. numLines := stopLine + 1 - startLine. inStream := ReadStream on: paragraph string from: start to: stop. newString := WideString new: size + ((numLines * delta) max: 0). outStream := ReadWriteStream on: newString. "This subroutine does the actual work" self indent: delta fromStream: inStream toStream: outStream. "Adjust the range that will be highlighted later" adjustStart ifTrue: [realStart := (realStart + delta) max: start]. realStop := realStop + outStream position - size. "Prepare for another iteration" indentation := indentation + delta. size := outStream position. inStream := outStream setFrom: 1 to: size. outStream == nil ifTrue: "tried to outdent but some line(s) were already left flush" [view flash] ifFalse: [self selectInvisiblyFrom: start to: stop. size = newString size ifFalse: [newString := outStream contents]. self replaceSelectionWith: newString asText]. self selectFrom: realStart to: realStop. "highlight only the original range" ^ true! Item was changed: ----- Method: ParagraphEditor>>selectionAsTiles (in category 'menu messages') ----- selectionAsTiles "Try to make new universal tiles from the selected text" + | selection | - | selection tiles | selection := self selection. self terminateAndInitializeAround: + [| tiles | + self currentHand attachMorph: (tiles := Player tilesFrom: selection). - [self currentHand attachMorph: (tiles := Player tilesFrom: selection). Preferences tileTranslucentDrag ifTrue: [tiles lookTranslucent] ifFalse: [tiles align: tiles topLeft with: self currentHand position + tiles cursorBaseOffset]].! Item was changed: ----- Method: StandardSystemView>>reframePanesAdjoining:along:to: (in category 'framing') ----- reframePanesAdjoining: subView along: side to: aDisplayBox + | delta newRect minDim theMin | - | newBox delta newRect minDim theMin | newRect := aDisplayBox. theMin := 16. "First check that this won't make any pane smaller than theMin screen dots" minDim := ((subViews select: [:sub | sub displayBox bordersOn: subView displayBox along: side]) collect: [:sub | sub displayBox adjustTo: newRect along: side]) inject: 999 into: [:was :rect | (was min: rect width) min: rect height]. "If so, amend newRect as required" minDim < theMin ifTrue: [delta := minDim - theMin. newRect := newRect withSide: side setTo: ((newRect perform: side) > (subView displayBox perform: side) ifTrue: [(newRect perform: side) + delta] ifFalse: [(newRect perform: side) - delta])]. "Now adjust all adjoining panes for real" subViews do: [:sub | (sub displayBox bordersOn: subView displayBox along: side) ifTrue: + [| newBox | + newBox := sub displayBox adjustTo: newRect along: side. - [newBox := sub displayBox adjustTo: newRect along: side. sub window: sub window viewport: (sub transform: (sub inverseDisplayTransform: newBox)) rounded]]. "And adjust the growing pane itself" subView window: subView window viewport: (subView transform: (subView inverseDisplayTransform: newRect)) rounded. "Finally force a recomposition of the whole window" viewport := nil. self resizeTo: self viewport. self uncacheBits; displayEmphasized! Item was changed: ----- Method: StandardSystemController>>adjustWindowCorners (in category 'borders') ----- adjustWindowCorners + | box clicked | - | box cornerBox p clicked f2 | box := view windowBox. clicked := false. #(topLeft topRight bottomRight bottomLeft) do: [:readCorner | + | cornerBox | cornerBox := ((box insetBy: 2) perform: readCorner) - (10@10) extent: 20@20. (cornerBox containsPoint: sensor cursorPoint) ifTrue: ["Display reverse: cornerBox." (Cursor perform: readCorner) showWhile: + [[(cornerBox containsPoint: (sensor cursorPoint)) - [[(cornerBox containsPoint: (p := sensor cursorPoint)) and: [(clicked := sensor anyButtonPressed) not]] whileTrue: [ self interActivityPause ]. "Display reverse: cornerBox." clicked ifTrue: [view newFrame: + [:f | | p f2 | + p := sensor cursorPoint. - [:f | p := sensor cursorPoint. readCorner = #topLeft ifTrue: [f2 := p corner: f bottomRight]. readCorner = #bottomLeft ifTrue: [f2 := (f withBottom: p y) withLeft: p x]. readCorner = #bottomRight ifTrue: [f2 := f topLeft corner: p]. readCorner = #topRight ifTrue: [f2 := (f withTop: p y) withRight: p x]. f2]]]]]. ^ clicked! Item was changed: ----- Method: StandardSystemView>>setUpdatablePanesFrom: (in category 'updating') ----- setUpdatablePanesFrom: getSelectors - | aList aPane | "Set my updatablePanes inst var to the list of panes which are list panes with the given get-list selectors. Order is important here!! Note that the method is robust in the face of panes not found, but a warning is printed in the transcript in each such case" + | aList | - aList := OrderedCollection new. getSelectors do: + [:sel | + | aPane | + aPane := self subViewSatisfying: - [:sel | aPane := self subViewSatisfying: [:pane | (pane isKindOf: PluggableListView) and: [pane getListSelector == sel]]. aPane ifNotNil: [aList add: aPane] ifNil: [Transcript cr; show: 'Warning: view ', sel, ' not found.']]. updatablePanes := aList asArray! |
Free forum by Nabble | Edit this page |