'From Pharo1.2a of ''11 June 2010'' [Latest update: #12088] on 11 August 2010 at 2:52:44 pm'! ScrollPane subclass: #PluggableTextMorph instanceVariableNames: 'textMorph getTextSelector setTextSelector getSelectionSelector hasUnacceptedEdits askBeforeDiscardingEdits selectionInterval hasEditingConflicts acceptAction getColorSelector unstyledAcceptText styler editorClass ' classVariableNames: 'ShowTextEditingState ' poolDictionaries: '' category: 'Morphic-Pluggable Widgets'! !MorphicUIManager methodsFor: 'ui requests' stamp: 'GuillermoPolito 8/11/2010 12:51'! edit: aText label: labelString accept: anAction "Open an editor on the given string/text" | window holder text | holder := Workspace new. holder contents: aText. text := PluggableTextMorph on: holder editorClass: TextEditor text: #contents accept: #acceptContents: readSelection: nil menu: nil. text acceptAction: anAction. window := SystemWindow new. labelString ifNotNil: [window setLabel: labelString]. window model: holder . window addMorph: text frame: (0@0 extent: 1@1). window paneColor: Color gray. window openInWorld. ^ window ! ]style[(47 521)f2cblack;b,f2cblack;! ! !Morph methodsFor: 'submorphs-add/remove' stamp: 'GuillermoPolito 8/11/2010 11:40'! possiblyChanged "A hook for notificating possible interested parties Not used in base system"! ! !HelpBrowser methodsFor: 'ui' stamp: 'GuillermoPolito 8/11/2010 12:58'! initWindow | toolbar dock| window := (Smalltalk at: #StandardWindow) new. window model: self. window title: 'Help Browser'. toolbar := window newToolbar: {window newButtonFor: self getState: nil action: #refresh arguments: nil getEnabled: nil labelForm: (HelpIcons iconNamed: #refreshIcon) help: 'Refresh' translated. }. dock := window newToolDockingBar. dock addMorphBack: toolbar. window addMorph: dock fullFrame: (LayoutFrame fractions: (0@0 corner: 1@0) offsets: (0@0 corner: 0 @ dock minExtent y)). "Tree" treeMorph := PluggableTreeMorph new. treeMorph model: self; setSelectedSelector: #onItemClicked:. window addMorph: treeMorph fullFrame: (LayoutFrame fractions: (0@0 corner: 0.3@1) offsets: (0@dock minExtent y corner: 0 @ 0)). "Text" contentMorph := self defaultViewerClass on: self editorClass: TextEditor text: nil accept: nil readSelection: nil menu: nil. window addMorph: contentMorph fullFrame: (LayoutFrame fractions: (0.3@0 corner: 1@1) offsets: (0@dock minExtent y corner: 0 @ 0)). ! ]style[(10 1075)f2cblack;b,f2cblack;! ! !Preferences class methodsFor: 'settings-migration' stamp: 'GuillermoPolito 8/10/2010 17:23'! caseSensitiveFindsSetting ^ SmalltalkEditor caseSensitiveFinds! ]style[(25 38)f2cblack;b,f2cblack;! ! !Preferences class methodsFor: 'settings-migration' stamp: 'GuillermoPolito 8/10/2010 17:23'! caseSensitiveFindsSetting: aBoolean SmalltalkEditor caseSensitiveFinds: aBoolean! ]style[(35 46)f2cblack;b,f2cblack;! ! !Preferences class methodsFor: 'settings-migration' stamp: 'GuillermoPolito 8/11/2010 13:08'! multipleTextUndoSetting ^ TextEditor useMultipleUndo! ]style[(23 30)f2cblack;b,f2cblack;! ! !Preferences class methodsFor: 'settings-migration' stamp: 'GuillermoPolito 8/11/2010 13:08'! multipleTextUndoSetting: aBoolean TextEditor useMultipleUndo: aBoolean! ]style[(33 38)f2cblack;b,f2cblack;! ! !Preferences class methodsFor: 'settings-migration' stamp: 'GuillermoPolito 8/10/2010 17:23'! wordStyleCursorMovementSetting ^ SmalltalkEditor walkAlongDisplayedLine.! ]style[(30 43)f2cblack;b,f2cblack;! ! !Preferences class methodsFor: 'settings-migration' stamp: 'GuillermoPolito 8/10/2010 17:23'! wordStyleCursorMovementSetting: aBoolean SmalltalkEditor walkAlongDisplayedLine: aBoolean! ]style[(40 50)f2cblack;b,f2cblack;! ! !DefaultSettingStyle methodsFor: 'setting loading' stamp: 'GuillermoPolito 8/10/2010 17:20'! loadCaseSensitiveFinds self loadSetting: #caseSensitiveFinds withBlock: [SmalltalkEditor caseSensitiveFinds: nil]. ! ]style[(22 95)f2cblack;b,f2cblack;! ! !DefaultSettingStyle methodsFor: 'setting loading' stamp: 'GuillermoPolito 8/11/2010 13:08'! loadUseMultipleUndo self loadSetting: #useMultipleUndo withBlock: [TextEditor useMultipleUndo: nil]. ! ]style[(19 84)f2cblack;b,f2cblack;! ! !DefaultSettingStyle methodsFor: 'setting loading' stamp: 'GuillermoPolito 8/10/2010 17:20'! loadWalkAlongDisplayedLine self loadSetting: #walkAlongDisplayedLine withBlock: [SmalltalkEditor walkAlongDisplayedLine: nil]. ! ]style[(26 103)f2cblack;b,f2cblack;! ! !ObjectExplorer methodsFor: 'accessing' stamp: 'GuillermoPolito 8/11/2010 12:51'! explorerFor: anObject | window listMorph | rootObject := anObject. window := (SystemWindow labelled: (rootObject printStringLimitedTo: 32)) model: self. window addMorph: (listMorph := SimpleHierarchicalListMorph on: self list: #getList selected: #getCurrentSelection changeSelected: #noteNewSelection: menu: #genericMenu: keystroke: #explorerKey:from:) frame: (0@0 corner: 1@0.8). window addMorph: ((PluggableTextMorph on: self editorClass: self editorClass text: #trash accept: #trash: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) askBeforeDiscardingEdits: false) frame: (0@0.8 corner: 1@1). listMorph autoDeselect: false. ^ window! ]style[(21 712)f2cblack;b,f2cblack;! ! !ObjectExplorer methodsFor: 'menus' stamp: 'GuillermoPolito 8/11/2010 12:13'! editorClass ^SmalltalkEditor! ! !ObjectExplorer methodsFor: 'user interface' stamp: 'GuillermoPolito 8/11/2010 12:51'! explorerFor: anObject withLabel: label | window listMorph | rootObject := anObject. window := (SystemWindow labelled: label) model: self. window addMorph: (listMorph := SimpleHierarchicalListMorph on: self list: #getList selected: #getCurrentSelection changeSelected: #noteNewSelection: menu: #genericMenu: keystroke: nil) frame: (0 @ 0 corner: 1 @ 0.8). window addMorph: ((PluggableTextMorph on: self editorClass: self editorClass text: #trash accept: #trash: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) askBeforeDiscardingEdits: false) frame: (0 @ 0.8 corner: 1 @ 1). listMorph autoDeselect: false. ^ window! ]style[(38 676)f2cblack;b,f2cblack;! ! !MCTool methodsFor: 'morphic ui' stamp: 'GuillermoPolito 8/11/2010 13:02'! textMorph: aSymbol ^ PluggableTextMorph on: self editorClass: TextEditor text: aSymbol accept: (aSymbol, ':') asSymbol! ]style[(18 112)f2cblack;b,f2cblack;! ! !DemoSettingStyle methodsFor: 'setting loading' stamp: 'GuillermoPolito 8/10/2010 17:21'! loadCaseSensitiveFinds self loadSetting: #caseSensitiveFinds withBlock: [SmalltalkEditor caseSensitiveFinds: false]. ! ]style[(22 97)f2cblack;b,f2cblack;! ! !DemoSettingStyle methodsFor: 'setting loading' stamp: 'GuillermoPolito 8/11/2010 13:08'! loadUseMultipleUndo self loadSetting: #useMultipleUndo withBlock: [TextEditor useMultipleUndo: true]. ! ]style[(19 85)f2cblack;b,f2cblack;! ! !DemoSettingStyle methodsFor: 'setting loading' stamp: 'GuillermoPolito 8/10/2010 17:21'! loadWalkAlongDisplayedLine self loadSetting: #walkAlongDisplayedLine withBlock: [SmalltalkEditor walkAlongDisplayedLine: true]. ! ]style[(26 104)f2cblack;b,f2cblack;! ! !ProcessBrowser methodsFor: 'views' stamp: 'GuillermoPolito 8/11/2010 12:52'! asPrototypeInWindow "Create a pluggable version of me, answer a window" | window aTextMorph | window := (SystemWindow labelled: 'later') model: self. window addMorph: ((PluggableListMorph on: self list: #processNameList selected: #processListIndex changeSelected: #processListIndex: menu: #processListMenu: keystroke: #processListKey:from:) enableDragNDrop: false) frame: (0 @ 0 extent: 0.5 @ 0.5). window addMorph: ((PluggableListMorph on: self list: #stackNameList selected: #stackListIndex changeSelected: #stackListIndex: menu: #stackListMenu: keystroke: #stackListKey:from:) enableDragNDrop: false) frame: (0.5 @ 0.0 extent: 0.5 @ 0.5). aTextMorph := PluggableTextMorph on: self editorClass: TextEditor text: #selectedMethod accept: nil readSelection: nil menu: nil. window addMorph: aTextMorph frame: (0 @ 0.5 corner: 1 @ 1). window setLabel: 'Process Browser'. ^ window! ]style[(19 959)f2cblack;b,f2cblack;! ! !ProcessBrowser methodsFor: 'views' stamp: 'GuillermoPolito 8/11/2010 12:53'! openAsMorph "Create a pluggable version of me, answer a window" | window aTextMorph | window := (SystemWindow labelled: 'later') model: self. deferredMessageRecipient := WorldState. window addMorph: ((PluggableListMorph on: self list: #processNameList selected: #processListIndex changeSelected: #processListIndex: menu: #processListMenu: keystroke: #processListKey:from:) enableDragNDrop: false) frame: (0 @ 0 extent: 0.5 @ 0.5). window addMorph: ((PluggableListMorph on: self list: #stackNameList selected: #stackListIndex changeSelected: #stackListIndex: menu: #stackListMenu: keystroke: #stackListKey:from:) enableDragNDrop: false) frame: (0.5 @ 0.0 extent: 0.5 @ 0.5). aTextMorph := PluggableTextMorph on: self editorClass: TextEditor text: #selectedMethod accept: nil readSelection: nil menu: nil. aTextMorph askBeforeDiscardingEdits: false. window addMorph: aTextMorph frame: (0 @ 0.5 corner: 1 @ 1). window setUpdatablePanesFrom: #(#processNameList #stackNameList ). (window setLabel: 'Process Browser') openInWorld. startedCPUWatcher ifTrue: [ self setUpdateCallbackAfter: 7 ]. ^ window! ]style[(11 1194)f2cblack;b,f2cblack;! ! !UITheme methodsFor: 'morph creation' stamp: 'GuillermoPolito 8/11/2010 13:03'! newAutoAcceptTextEditorIn: aThemedMorph for: aModel getText: getSel setText: setSel getEnabled: enabledSel "Answer a text editor for the given model." ^PluggableTextEditorMorph new autoAccept: true; on: aModel editorClass: TextEditor text: getSel accept: setSel readSelection: nil menu: nil; getEnabledSelector: enabledSel; font: self textFont; cornerStyle: aThemedMorph preferredCornerStyle; hResizing: #spaceFill; vResizing: #spaceFill; borderStyle: (BorderStyle inset width: 1); color: Color white; selectionColor: self selectionColor! ]style[(106 464)f2cblack;b,f2cblack;! ! !UITheme methodsFor: 'morph creation' stamp: 'GuillermoPolito 8/11/2010 13:04'! newAutoAcceptTextEntryIn: aThemedMorph for: aModel get: getSel set: setSel class: aClass getEnabled: enabledSel font: aFont help: helpText "Answer a text entry for the given model. Object conversion will be automatic based on the class of object returned after performing the get selector, aClass is provided in case of initial nil returns." |pt| pt := PluggableTextFieldMorph new autoAccept: true; alwaysAccept: true; convertTo: aClass; on: aModel editorClass: TextEditor text: getSel accept: setSel readSelection: nil menu: nil; acceptOnCR: true; getEnabledSelector: enabledSel; font: aFont; cornerStyle: (self textEntryCornerStyleIn: aThemedMorph); hResizing: #spaceFill; vResizing: #rigid; borderStyle: (BorderStyle inset width: 1); color: Color white; selectionColor: self selectionColor; hideScrollBarsIndefinitely; extent: 24@(aFont height + 8); setBalloonText: helpText. pt textMorph autoFit: true; wrapFlag: false; margins: (2@1 corner: 2@1). ^pt ! ]style[(139 875)f2cblack;b,f2cblack;! ! !UITheme methodsFor: 'morph creation' stamp: 'GuillermoPolito 8/11/2010 13:04'! newTextEditorIn: aThemedMorph for: aModel getText: getSel setText: setSel getEnabled: enabledSel "Answer a text editor for the given model." ^PluggableTextEditorMorph new on: aModel editorClass: TextEditor text: getSel accept: setSel readSelection: nil menu: nil; getEnabledSelector: enabledSel; font: self textFont; cornerStyle: aThemedMorph preferredCornerStyle; hResizing: #spaceFill; vResizing: #spaceFill; borderStyle: (BorderStyle inset width: 1); color: Color white; selectionColor: self selectionColor! ]style[(96 445)f2cblack;b,f2cblack;! ! !UITheme methodsFor: 'morph creation' stamp: 'GuillermoPolito 8/11/2010 13:04'! newTextEntryIn: aThemedMorph for: aModel get: getSel set: setSel class: aClass getEnabled: enabledSel help: helpText "Answer a text entry for the given model." |pt| pt := PluggableTextFieldMorph new convertTo: aClass; alwaysAccept: true; on: aModel editorClass: TextEditor text: getSel accept: setSel readSelection: nil menu: nil; acceptOnCR: true; getEnabledSelector: enabledSel; font: self textFont; cornerStyle: (self textEntryCornerStyleIn: aThemedMorph); hResizing: #spaceFill; vResizing: #rigid; borderStyle: (BorderStyle inset width: 1); color: Color white; selectionColor: self selectionColor; hideScrollBarsIndefinitely; extent: 24@(self textFont height + 8); setBalloonText: helpText. pt textMorph autoFit: true; wrapFlag: false; margins: (2@1 corner: 2@1). ^pt! ]style[(116 707)f2cblack;b,f2cblack;! ! !CompilerEvaluationTest methodsFor: 'testing' stamp: 'GuillermoPolito 8/10/2010 17:20'! testEvaluationOfSelfSend "Tests the evaluation of an inherited method that uses super send and self send" | result | result := Compiler new evaluate: (self method copyFrom: 6 to: (self method size)) in: self model doItContext to: self model doItReceiver notifying: (SmalltalkEditor new model: self model; changeParagraph: self method asParagraph ) ifFail: [FakeClassPool adopt: nil. ^ #failedDoit] logged: true. self assert: result = (6250/3).! ]style[(24 454)f2cblack;b,f2cblack;! ! !MorphTreeNavigationBar methodsFor: 'accessing' stamp: 'GuillermoPolito 8/11/2010 12:49'! textEntryLabel: aLabel get: getSel set: setSel help: helpText class: aClass | pt | pt := PluggableTextFieldMorph new convertTo: aClass; alwaysAccept: true; on: self editorClass: TextEditor text: getSel accept: setSel readSelection: nil menu: nil; acceptOnCR: true; getEnabledSelector: nil; font: self preferedFont; cornerStyle: #square; hResizing: #spaceFill; vResizing: #rigid; borderStyle: (BorderStyle inset width: 1); color: Color white; hideScrollBarsIndefinitely; extent: 24@ (self preferedFont height + 4); setBalloonText: helpText. pt textMorph autoFit: true; wrapFlag: false; margins: (1@0 corner: 1@0). ^pt! ]style[(75 590)f2cblack;b,f2cblack;! ! !MorphicToolBuilder methodsFor: 'pluggable widgets' stamp: 'GuillermoPolito 8/11/2010 12:50'! buildPluggableCodePane: aSpec "Install the default styler for code panes. Implementation note: We should just be doing something like, e.g., ^(self buildPluggableText: aSpec) useDefaultStyler Unfortunately, this will retrieve and layout the initial text twice which can make for a noticable performance difference when looking at some larger piece of code. So instead we copy the implementation from buildPlugggableText: here and insert #useDefaultStyler at the right point" | widget | widget := self codePaneClass new. widget useDefaultStyler. widget on: aSpec model editorClass: SmalltalkEditor text: aSpec getText accept: aSpec setText readSelection: aSpec selection menu: aSpec menu. widget font: StandardFonts codeFont. self register: widget id: aSpec name. widget getColorSelector: aSpec color. self setFrame: aSpec frame in: widget. parent ifNotNil:[self add: widget to: parent]. widget borderColor: Color lightGray. widget color: Color white. ^widget! ]style[(29 972)f2cblack;b,f2cblack;! ! !MorphicToolBuilder methodsFor: 'pluggable widgets' stamp: 'GuillermoPolito 8/11/2010 12:50'! buildPluggableText: aSpec | widget | widget := self textPaneClass on: aSpec model editorClass: TextEditor text: aSpec getText accept: aSpec setText readSelection: aSpec selection menu: aSpec menu. widget askBeforeDiscardingEdits: aSpec askBeforeDiscardingEdits. widget font: StandardFonts codeFont. self register: widget id: aSpec name. widget getColorSelector: aSpec color. self buildHelpFor: widget spec: aSpec. self setFrame: aSpec frame in: widget. parent ifNotNil:[self add: widget to: parent]. widget borderColor: Color lightGray. widget color: Color white. ^widget! ]style[(25 581)f2cblack;b,f2cblack;! ! !CodeHolderSystemSettings class methodsFor: 'settings' stamp: 'GuillermoPolito 8/11/2010 13:08'! codeEditingSettingsOn: aBuilder (aBuilder group: #codeEditing) label: 'Editing' translated; parent: #codeBrowsing; description: 'All settings concerned with text editing' translated; with: [ (aBuilder setting: #useMultipleUndo) label: 'Multiple undo' translated; target: TextEditor; description: 'Multiple editing undo availability' translated. (aBuilder setting: #caseSensitiveFinds) label: 'Case sensitive search' translated; target: SmalltalkEditor; description: 'If true, then the "find" command in text will always make its searches in a case-sensitive fashion' translated. (aBuilder setting: #walkAlongDisplayedLine) label: 'Walk along displayed line' translated; target: SmalltalkEditor; description: 'If set to true cursor movement will move along displayed lines rather than logical lines' translated. (aBuilder setting: #smartUpdating) label: 'Smart updating' translated; target: CodeHolder; description: 'If true, then morphic tools such as browsers and inspectors will keep their contents up to date automatically, so that if something changes anywhere, the change will be reflected everywhere' translated. ] ! ]style[(31 1189)f2cblack;b,f2cblack;! ! !MailComposition methodsFor: 'interface' stamp: 'GuillermoPolito 8/11/2010 12:48'! openInMorphic "open an interface for sending a mail message with the given initial text" | textMorph buttonsList sendButton attachmentButton | morphicWindow := SystemWindow labelled: 'Mister Postman'. morphicWindow model: self. textEditor := textMorph := PluggableTextMorph on: self editorClass: TextEditor text: #messageText accept: #messageText: readSelection: nil menu: #menuGet:shifted:. morphicWindow addMorph: textMorph frame: (0 @ 0.1 corner: 1 @ 1). buttonsList := AlignmentMorph newRow. sendButton := PluggableButtonMorph on: self getState: nil action: #submit. sendButton hResizing: #spaceFill; vResizing: #spaceFill; label: 'send message'; setBalloonText: 'Accept any unaccepted edits and add this to the queue of messages to be sent'; onColor: Color white offColor: Color white. buttonsList addMorphBack: sendButton. attachmentButton := PluggableButtonMorph on: self getState: nil action: #addAttachment. attachmentButton hResizing: #spaceFill; vResizing: #spaceFill; label: 'add attachment'; setBalloonText: 'Send a file with the message'; onColor: Color white offColor: Color white. buttonsList addMorphBack: attachmentButton. morphicWindow addMorph: buttonsList frame: (0 @ 0 extent: 1 @ 0.1). morphicWindow openInWorld! ]style[(13 1330)f2cblack;b,f2cblack;! ! !UIThemeW2K methodsFor: 'morph creation' stamp: 'GuillermoPolito 8/11/2010 13:05'! newTextEditorIn: aThemedMorph for: aModel getText: getSel setText: setSel getEnabled: enabledSel "Answer a text editor for the given model." ^PluggableTextEditorMorph new on: aModel editorClass: TextEditor text: getSel accept: setSel readSelection: nil menu: nil; getEnabledSelector: enabledSel; font: self textFont; cornerStyle: #square; hResizing: #spaceFill; vResizing: #spaceFill; borderStyle: (BorderStyle inset width: 1); color: Color white! ]style[(96 380)f2cblack;b,f2cblack;! ! !FillInTheBlankMorph methodsFor: 'initialization' stamp: 'GuillermoPolito 8/11/2010 12:39'! createTextPaneExtent: answerExtent acceptBoolean: acceptBoolean topOffset: topOffset buttonAreaHeight: buttonAreaHeight "create the textPane" | result frame | result := PluggableTextMorph on: self editorClass: TextEditor text: #response accept: #response: readSelection: #selectionInterval menu: #codePaneMenu:shifted:. result extent: answerExtent. result hResizing: #spaceFill; vResizing: #spaceFill. result borderWidth: 1. result hasUnacceptedEdits: true. result acceptOnCR: acceptBoolean. result setNameTo: 'textPane'. frame := LayoutFrame new. frame leftFraction: 0.0; rightFraction: 1.0; topFraction: 0.0; topOffset: topOffset; bottomFraction: 1.0; bottomOffset: buttonAreaHeight negated. result layoutFrame: frame. self addMorph: result. ^ result! ]style[(119 690)f2cblack;b,f2cblack;! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'GuillermoPolito 8/10/2010 17:24'! keystrokeInWorld: evt "A keystroke was hit when no keyboard focus was set, so it is sent here to the world instead." | aChar ascii | aChar := evt keyCharacter. (ascii := aChar asciiValue) = 27 ifTrue: "escape key" [^ self invokeWorldMenuFromEscapeKey]. (self navigationKey: evt) ifTrue: [^self]. (evt controlKeyPressed not and: [(#(1 4 8 28 29 30 31 32) includes: ascii) "home, end, backspace, arrow keys, space" and: [self keyboardNavigationHandler notNil]]) ifTrue: [self keyboardNavigationHandler navigateFromKeystroke: aChar]. (evt commandKeyPressed and: [SmalltalkEditor cmdKeysInText]) ifTrue: [^ self dispatchCommandKeyInWorld: aChar event: evt]. "It was unhandled. Remember the keystroke." self lastKeystroke: evt keyString. self triggerEvent: #keyStroke! ]style[(21 773)f2cblack;b,f2cblack;! ! !TextEditor methodsFor: 'menu messages' stamp: 'GuillermoPolito 8/11/2010 12:45'! select "Nothing"! ! !TextEditor methodsFor: 'typing support' stamp: 'GuillermoPolito 8/11/2010 11:36'! keystroke: aKeyboardEvent self processKeyStroke: aKeyboardEvent.! ! !TextEditor methodsFor: 'deprecated' stamp: 'GuillermoPolito 8/11/2010 14:49'! offerMenuFromEsc: aKeyboardEvent "The escape key was hit while the receiver has the keyboard focus; take action" "self deprecated: 'Escape is now handled by #escape: '." ^ ActiveEvent shiftPressed ifFalse: [ self raiseContextMenu: aKeyboardEvent]! ]style[(32 222)f2cblack;b,f2cblack;! ! !TimeProfiler methodsFor: 'as yet unclassified' stamp: 'GuillermoPolito 8/10/2010 17:23'! codePaneMenu: aMenu shifted: shifted "Note that unless we override perform:orSendTo:, PluggableTextController will respond to all menu items in a text pane" | donorMenu | donorMenu := shifted ifTrue: [SmalltalkEditor shiftedYellowButtonMenu] ifFalse: [SmalltalkEditor yellowButtonMenu]. ^ aMenu addAllFrom: donorMenu! ]style[(36 297)f2cblack;b,f2cblack;! ! !FontChooserMorph methodsFor: 'accessing' stamp: 'GuillermoPolito 8/11/2010 13:02'! newFontPointSizeField | answer | answer := (PluggableTextMorph on: self editorClass: TextEditor text: #pointSizeString accept: #pointSizeString:) acceptOnCR: true; hideVScrollBarIndefinitely: true; color: Color gray veryMuchLighter; borderColor: #inset; vResizing: #rigid; hResizing: #spaceFill; width: (TextStyle defaultFont widthOfString: '99999999.99'); height: TextStyle defaultFont height + 6; yourself. ^answer! ]style[(21 430)f2cblack;b,f2cblack;! ! !PluggableTextMorph methodsFor: '*Polymorph-Widgets' stamp: 'GuillermoPolito 8/11/2010 12:03'! editorClass ^editorClass! ! !PluggableTextMorph methodsFor: '*Polymorph-Widgets-override' stamp: 'GuillermoPolito 8/11/2010 11:41'! mouseEnter: event "Changed to take keyboardFocusOnMouseDown into account." super mouseEnter: event. self textMorph ifNil: [^self]. "TODO: it's not used in CUIS" "selectionInterval ifNotNil: [self textMorph editor selectInterval: selectionInterval; setEmphasisHere]. self textMorph selectionChanged." self wantsKeyboardFocus ifFalse: [^self]. self keyboardFocusOnMouseDown ifFalse: [self textMorph takeKeyboardFocus]! ]style[(17 416)f2cblack;b,f2cblack;! ! !PluggableTextMorph methodsFor: 'initialization' stamp: 'GuillermoPolito 8/11/2010 12:09'! on: anObject editorClass: anEditorClass text: getTextSel accept: setTextSel readSelection: getSelectionSel menu: getMenuSel self model: anObject. editorClass := anEditorClass. getTextSelector := getTextSel. setTextSelector := setTextSel. getSelectionSelector := getSelectionSel. getMenuSelector := getMenuSel. self borderWidth: 1. self setText: self getText. self setSelection: self getSelection.! ]style[(123 283)f2cblack;b,f2cblack;! ! !PluggableTextMorph methodsFor: 'initialization' stamp: 'GuillermoPolito 8/11/2010 12:30'! on: anObject text: getTextSel accept: setTextSel readSelection: getSelectionSel menu: getMenuSel self on: anObject editorClass: TextEditor text: getTextSel accept: setTextSel readSelection: getSelectionSel menu: getMenuSel! ]style[(96 8 134)f2cblack;b,f2cblack;,f2cblack;b! ! !PluggableTextMorph methodsFor: 'updating' stamp: 'GuillermoPolito 8/10/2010 17:24'! update: aSymbol aSymbol ifNil: [^self]. (aSymbol == getColorSelector) ifTrue: [^ self color: (model perform: getColorSelector)]. aSymbol == #flash ifTrue: [^self flash]. aSymbol == getTextSelector ifTrue: [self setText: self getText. ^self setSelection: self getSelection]. aSymbol == getSelectionSelector ifTrue: [^self setSelection: self getSelection]. (aSymbol == #autoSelect and: [getSelectionSelector notNil]) ifTrue: [self handleEdit: [SmalltalkEditor abandonChangeText. "no replacement!!" (textMorph editor) setSearch: model autoSelectString; againOrSame: true]]. aSymbol == #clearUserEdits ifTrue: [^self hasUnacceptedEdits: false]. aSymbol == #wantToChange ifTrue: [self canDiscardEdits ifFalse: [^self promptForCancel]. ^self]. aSymbol == #appendEntry ifTrue: [self handleEdit: [self appendEntry]. ^self ]. aSymbol == #clearText ifTrue: [self handleEdit: [self changeText: Text new]. ^self ]. aSymbol == #bs ifTrue: [self handleEdit: [self bsText]. ^self ]. aSymbol == #codeChangedElsewhere ifTrue: [self hasEditingConflicts: true. ^self changed]. ^ self! ]style[(15 1159)f2cblack;b,f2cblack;! ! !PluggableTextMorphWithModel methodsFor: 'initialization' stamp: 'GuillermoPolito 8/11/2010 13:05'! initialize "initialize the state of the receiver" super initialize. self on: self editorClass: TextEditor text: #getMyText accept: #setMyText: readSelection: nil menu: nil! ]style[(10 176)f2cblack;b,f2cblack;! ! !StringHolder methodsFor: 'code pane menu' stamp: 'GuillermoPolito 8/10/2010 17:23'! codePaneMenu: aMenu shifted: shifted "Note that unless we override perform:orSendTo:, PluggableTextController will respond to all menu items in a text pane" | donorMenu | donorMenu := shifted ifTrue: [SmalltalkEditor shiftedYellowButtonMenu] ifFalse: [SmalltalkEditor yellowButtonMenu]. ^ aMenu addAllFrom: donorMenu! ]style[(36 297)f2cblack;b,f2cblack;! ! !StringHolder methodsFor: 'initialize-release' stamp: 'GuillermoPolito 8/11/2010 12:13'! editorClass ^SmalltalkEditor! ! !StringHolder methodsFor: 'initialize-release' stamp: 'GuillermoPolito 8/11/2010 12:54'! embeddedInMorphicWindowLabeled: labelString wrap: aBoolean | window | window := (SystemWindow labelled: labelString) model: self. window addMorph: ((PluggableTextMorph on: self editorClass: self editorClass text: #contents accept: #acceptContents: readSelection: nil menu: #codePaneMenu:shifted:) wrapFlag: aBoolean) frame: (0@0 corner: 1@1). ^ window! ]style[(58 321)f2cblack;b,f2cblack;! ! !Inspector methodsFor: 'menu commands' stamp: 'GuillermoPolito 8/11/2010 12:14'! editorClass ^SmalltalkEditor! ! !SyntaxError class methodsFor: 'instance creation' stamp: 'GuillermoPolito 8/11/2010 12:54'! buildMorphicViewOn: aSyntaxError "Answer an Morphic view on the given SyntaxError." | window | window := (SystemWindow labelled: 'Syntax Error') model: aSyntaxError. window addMorph: (PluggableListMorph on: aSyntaxError list: #list selected: #listIndex changeSelected: nil menu: #listMenu:) frame: (0@0 corner: 1@0.15). window addMorph: (PluggableTextMorph on: aSyntaxError editorClass: aSyntaxError editorClass text: #contents accept: #contents:notifying: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) frame: (0@0.15 corner: 1@1). ^ window openInWorldExtent: 380@220! ]style[(32 584)f2cblack;b,f2cblack;! ! !CodeHolder methodsFor: 'categories & search pane' stamp: 'GuillermoPolito 8/11/2010 12:32'! newSearchPane "Answer a new search pane for the receiver" | aTextMorph | aTextMorph := PluggableTextMorph on: self editorClass: self editorClass text: #lastSearchString accept: #lastSearchString: readSelection: nil menu: nil. aTextMorph setProperty: #alwaysAccept toValue: true. aTextMorph askBeforeDiscardingEdits: false. aTextMorph acceptOnCR: true. aTextMorph setBalloonText: 'Type here and hit ENTER, and all methods whose selectors match what you typed will appear in the list pane below.'. ^ aTextMorph! ]style[(13 519)f2cblack;b,f2cblack;! ! !CodeHolder methodsFor: 'construction' stamp: 'GuillermoPolito 8/11/2010 12:32'! buildMorphicCodePaneWith: editString "Construct the pane that shows the code. Respect StandardFonts codeFont." | codePane | codePane := MorphicTextEditor default on: self editorClass: self editorClass text: #contents accept: #contents:notifying: readSelection: #contentsSelection menu: #codePaneMenu:shifted:. codePane font: StandardFonts codeFont. editString ifNotNil: [codePane editString: editString. codePane hasUnacceptedEdits: true]. ^ codePane! ]style[(36 451)f2cblack;b,f2cblack;! ! !CodeHolder methodsFor: 'misc' stamp: 'GuillermoPolito 8/11/2010 12:15'! editorClass ^SmalltalkEditor! ! !ChangeList methodsFor: 'menu actions' stamp: 'GuillermoPolito 8/11/2010 12:32'! buildMorphicCodePaneWith: editString | codePane | codePane := AcceptableCleanTextMorph on: self editorClass: self editorClass text: #contents accept: #contents: readSelection: #contentsSelection menu: #codePaneMenu:shifted:. codePane font: StandardFonts codeFont. editString ifNotNil: [ codePane editString: editString. codePane hasUnacceptedEdits: true ]. ^codePane ! ]style[(36 357)f2cblack;b,f2cblack;! ! !SelectorBrowser methodsFor: 'opening' stamp: 'GuillermoPolito 8/11/2010 12:59'! morphicWindow "Create a Browser that lets you type part of a selector, shows a list of selectors, shows the classes of the one you chose, and spawns a full browser on it. Answer the window SelectorBrowser new open " | window typeInView selectorListView classListView | window := (SystemWindow labelled: 'later') model: self. window setStripeColorsFrom: window defaultBackgroundColor. selectorIndex := classListIndex := 0. typeInView := PluggableTextMorph on: self editorClass: SmalltalkEditor text: #contents accept: #contents:notifying: readSelection: #contentsSelection menu: #codePaneMenu:shifted:. typeInView acceptOnCR: true. typeInView hideScrollBarsIndefinitely. window addMorph: typeInView frame: (0@0 corner: 0.5@0.14). selectorListView := PluggableListMorph on: self list: #messageList selected: #messageListIndex changeSelected: #messageListIndex: menu: #selectorMenu: keystroke: #messageListKey:from:. selectorListView menuTitleSelector: #selectorMenuTitle. window addMorph: selectorListView frame: (0@0.14 corner: 0.5@0.6). classListView := PluggableListMorph on: self list: #classList selected: #classListIndex changeSelected: #classListIndex: menu: nil keystroke: #arrowKey:from:. classListView menuTitleSelector: #classListSelectorTitle. window addMorph: classListView frame: (0.5@0 corner: 1@0.6). window addMorph: ((PluggableTextMorph on: self editorClass: SmalltalkEditor text: #byExample accept: #byExample: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) askBeforeDiscardingEdits: false) frame: (0@0.6 corner: 1@1). window setLabel: 'Method Finder'. ^ window! ]style[(13 1671)f2cblack;b,f2cblack;! ! !Browser methodsFor: 'class comment pane' stamp: 'GuillermoPolito 8/11/2010 12:32'! buildMorphicCommentPane "Construct the pane that shows the class comment. Respect the setting StandardFonts codeFont." | commentPane | commentPane := BrowserCommentTextMorph on: self editorClass: self editorClass text: #classCommentText accept: #classComment:notifying: readSelection: nil menu: #codePaneMenu:shifted:. commentPane font: StandardFonts codeFont. ^ commentPane! ]style[(23 382)f2cblack;b,f2cblack;! ! !FileContentsBrowser methodsFor: 'creation' stamp: 'GuillermoPolito 8/11/2010 13:06'! addLowerPanesTo: window at: nominalFractions with: editString | verticalOffset row codePane infoPane infoHeight divider | row := AlignmentMorph newColumn hResizing: #spaceFill; vResizing: #spaceFill; layoutInset: 0; borderWidth: 1; borderColor: Color black; layoutPolicy: ProportionalLayout new. codePane := MorphicTextEditor default on: self editorClass: TextEditor text: #contents accept: #contents:notifying: readSelection: #contentsSelection menu: #codePaneMenu:shifted:. infoPane := PluggableTextMorph on: self editorClass: self editorClass text: #infoViewContents accept: nil readSelection: nil menu: nil. infoPane askBeforeDiscardingEdits: false. verticalOffset := 0. ">>not with this browser--- at least not yet --- innerFractions := 0@0 corner: 1@0. verticalOffset := self addOptionalAnnotationsTo: row at: innerFractions plus: verticalOffset. verticalOffset := self addOptionalButtonsTo: row at: innerFractions plus: verticalOffset. <<<<" infoHeight := 20. row addMorph: (codePane borderWidth: 0) fullFrame: ( LayoutFrame fractions: (0@0 corner: 1@1) offsets: (0@verticalOffset corner: 0@infoHeight negated) ). divider := BorderedSubpaneDividerMorph forTopEdge. divider extent: 4@4; color: Color transparent; borderColor: #raised; borderWidth: 2. row addMorph: divider fullFrame: ( LayoutFrame fractions: (0@1 corner: 1@1) offsets: (0@infoHeight negated corner: 0@(1-infoHeight)) ). row addMorph: (infoPane borderWidth: 0; hideScrollBarsIndefinitely) fullFrame: ( LayoutFrame fractions: (0@1 corner: 1@1) offsets: (0@(1-infoHeight) corner: 0@0) ). window addMorph: row frame: nominalFractions. row on: #mouseEnter send: #paneTransition: to: window. row on: #mouseLeave send: #paneTransition: to: window. ! ]style[(61 1826)f2cblack;b,f2cblack;! ! !Inspector class methodsFor: 'instance creation' stamp: 'GuillermoPolito 8/11/2010 12:47'! openAsMorphOn: anObject withLabel: aLabel "(Inspector openAsMorphOn: SystemOrganization withLabel: 'Test') openInWorld" | window inspector | inspector := self inspect: anObject. window := (SystemWindow labelled: aLabel) model: inspector. window addMorph: ((PluggableListMorph new doubleClickSelector: #inspectSelection; on: inspector list: #fieldList selected: #selectionIndex changeSelected: #toggleIndex: menu: #fieldListMenu: keystroke: #inspectorKey:from:) autoDeselect: false ) "For doubleClick to work best disable autoDeselect" frame: (0 @ 0 corner: self horizontalDividerProportion @ self verticalDividerProportion). window addMorph: (PluggableTextMorph on: inspector editorClass: inspector editorClass text: #contents accept: #accept: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) frame: (self horizontalDividerProportion @ 0 corner: 1 @ self verticalDividerProportion). window addMorph: ((PluggableTextMorph on: inspector editorClass: inspector editorClass text: #trash accept: #trash: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) askBeforeDiscardingEdits: false) frame: (0 @ self verticalDividerProportion corner: 1 @ 1). window setUpdatablePanesFrom: #(#fieldList ). window position: 16 @ 0. "Room for scroll bar." ^ window! ]style[(41 1349)f2cblack;b,f2cblack;! ! !InspectorBrowser class methodsFor: 'as yet unclassified' stamp: 'GuillermoPolito 8/11/2010 12:48'! openAsMorphOn: anObject "(InspectorBrowser openAsMorphOn: SystemOrganization) openInWorld" | window inspector | inspector := self inspect: anObject. window := (SystemWindow labelled: anObject defaultLabelForInspector) model: inspector. window addMorph: (PluggableListMorph on: inspector list: #fieldList selected: #selectionIndex changeSelected: #toggleIndex: menu: #fieldListMenu:) frame: (0@0 corner: 0.3@0.5). window addMorph: (PluggableTextMorph on: inspector editorClass: inspector editorClass text: #contents accept: #accept: readSelection: nil menu: #codePaneMenu:shifted:) frame: (0.3@0 corner: 1.0@0.5). window addMorph: (PluggableListMorph on: inspector list: #msgList selected: #msgListIndex changeSelected: #msgListIndex: menu: #msgListMenu:) frame: (0@0.5 corner: 0.3@1.0). window addMorph: (PluggableTextMorph on: inspector editorClass: inspector editorClass text: #msgText accept: #msgAccept:from: readSelection: nil menu: #msgPaneMenu:shifted:) frame: (0.3@0.5 corner: 1.0@1.0). window setUpdatablePanesFrom: #(fieldList msgList). window position: 16@0. "Room for scroll bar." ^ window! ]style[(23 1225)f2cblack;b,f2cblack;! ! !Workspace methodsFor: 'initialization' stamp: 'GuillermoPolito 8/11/2010 12:11'! editorClass ^SmalltalkEditor! ! !Workspace methodsFor: 'initialization' stamp: 'GuillermoPolito 8/11/2010 12:59'! embeddedInMorphicWindowLabeled: labelString | window pane | window := (SystemWindow labelled: labelString) model: self. pane := PluggableTextMorph on: self editorClass: self editorClass text: #contents accept: #acceptContents: readSelection: nil menu: #codePaneMenu:shifted:. pane font: StandardFonts codeFont. window addMorph: pane frame: (0@0 corner: 1@1). ^ window! ]style[(43 353)f2cblack;b,f2cblack;! ! !TextMorph methodsFor: 'event handling' stamp: 'GuillermoPolito 8/10/2010 17:23'! getMenu: shiftKeyState ^ shiftKeyState not ifTrue: [SmalltalkEditor yellowButtonMenu] ifFalse: [SmalltalkEditor shiftedYellowButtonMenu]! ]style[(22 120)f2cblack;b,f2cblack;! ! !TextMorph methodsFor: 'private' stamp: 'GuillermoPolito 8/11/2010 13:07'! editorClass "Answer the class used to create the receiver's editor" ^TextEditor! ]style[(11 72)f2cblack;b,f2cblack;! ! !TextMorphForEditView methodsFor: 'edit view' stamp: 'GuillermoPolito 8/11/2010 12:12'! editorClass ^ editView editorClass! ! !PluggableTextMorph class methodsFor: 'as yet unclassified' stamp: 'GuillermoPolito 8/11/2010 13:02'! on: anObject editorClass: anEditorClass text: getTextSel accept: setTextSel ^ self on: anObject editorClass: anEditorClass text: getTextSel accept: setTextSel readSelection: nil menu: nil! ]style[(75 38 13 73)f2cblack;b,f2cblack;,f2cblack;b,f2cblack;! ! !PluggableTextMorph class methodsFor: 'as yet unclassified' stamp: 'GuillermoPolito 8/11/2010 12:28'! on: anObject editorClass: anEditorClass text: getTextSel accept: setTextSel readSelection: getSelectionSel menu: getMenuSel ^ self new on: anObject editorClass: anEditorClass text: getTextSel accept: setTextSel readSelection: getSelectionSel menu: getMenuSel! ]style[(123 147)f2cblack;b,f2cblack;! ! !TranscriptStream methodsFor: 'stream extensions' stamp: 'GuillermoPolito 8/11/2010 12:11'! editorClass ^SmalltalkEditor! ! !TranscriptStream methodsFor: '*Morphic' stamp: 'GuillermoPolito 8/11/2010 12:55'! openAsMorphLabel: labelString "Build a morph viewing this transcriptStream" | window | window := (SystemWindow labelled: labelString) model: self. window addMorph: (PluggableTextMorph on: self editorClass: self editorClass text: nil accept: nil readSelection: nil menu: #codePaneMenu:shifted:) frame: (0@0 corner: 1@1). ^ window! ]style[(29 323)f2cblack;b,f2cblack;! ! !TextEditor class methodsFor: 'accessing' stamp: 'GuillermoPolito 8/11/2010 14:41'! cmdActions ^cmdActions ifNil: [ self initializeCmdKeyShortcuts. cmdActions ]! ]style[(10 53 12 2)f2cblack;b,f2cblack;,f2cblack;b,f2cblack;! ! !TextEditor class methodsFor: 'accessing' stamp: 'GuillermoPolito 8/11/2010 14:40'! shiftCmdActions ^shiftCmdActions ifNil:[self initializeShiftCmdKeyShortcuts. shiftCmdActions].! ]style[(15 80)f2cblack;b,f2cblack;! ! !TextEditor class methodsFor: 'class initialization' stamp: 'GuillermoPolito 8/11/2010 14:42'! shiftedYellowButtonMenu "Answer the menu to be presented when the yellow button is pressed while the shift key is down" ^ shiftedYellowButtonMenu ifNil: [self initializeShiftedYellowButtonMenu. shiftedYellowButtonMenu]! ]style[(23 198)f2cblack;b,f2cblack;! ! !TextEditor class methodsFor: 'class initialization' stamp: 'GuillermoPolito 8/11/2010 14:42'! yellowButtonMenu ^ yellowButtonMenu ifNil: [self initializeYellowButtonMenu. yellowButtonMenu]! ]style[(16 80)f2cblack;b,f2cblack;! ! !TextEditor class methodsFor: 'keyboard shortcut tables' stamp: 'GuillermoPolito 8/11/2010 14:46'! initializeBasicCmdKeyShortcuts "Initialize the (unshifted) command-key (or alt-key) shortcut table." " TextEditor initialize " | cmdMap cmds | cmdMap := Array new: 256 withAll: #noop:. "use temp in case of a crash" cmdMap at: 1 + 1 put: #cursorHome:. "home key" cmdMap at: 4 + 1 put: #cursorEnd:. "end key" cmdMap at: 8 + 1 put: #backspace:. "ctrl-H or delete key" cmdMap at: 11 + 1 put: #cursorPageUp:. "page up key" cmdMap at: 12 + 1 put: #cursorPageDown:. "page down key" cmdMap at: 13 + 1 put: #crWithIndent:. "cmd-Return" cmdMap at: 27 + 1 put: #offerMenuFromEsc:. "escape key" cmdMap at: 28 + 1 put: #cursorLeft:. "left arrow key" cmdMap at: 29 + 1 put: #cursorRight:. "right arrow key" cmdMap at: 30 + 1 put: #cursorUp:. "up arrow key" cmdMap at: 31 + 1 put: #cursorDown:. "down arrow key" cmdMap at: 32 + 1 put: #selectWord:. "space bar key" cmdMap at: 127 + 1 put: #forwardDelete:. "del key" cmdMap at: 115 + 1 put:#accept:. '([{''"<' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:]. cmdMap at: $, asciiValue + 1 put: #shiftEnclose:. cmds := #($a #selectAll: $c #copySelection: $e #exchange: $f #find: $g #findAgain: $h #setSearchString: $v #paste: $w #backWord: $x #cut: $y #swapChars: $z #undo:). 1 to: cmds size by: 2 do: [:i | cmdMap at: (cmds at: i) asciiValue + 1 put: (cmds at: i + 1)]. cmdActions := cmdMap! ]style[(30 1373)f2cblack;b,f2cblack;! ! !EditableDropListMorph methodsFor: 'as yet unclassified' stamp: 'GuillermoPolito 8/11/2010 12:57'! newContentMorph "Answer a new content morph" | pt | pt := PluggableTextFieldMorph new convertTo: String; alwaysAccept: true; on: self editorClass: TextEditor text: #content accept: #content: readSelection: nil menu: nil; acceptOnCR: true; getEnabledSelector: nil; font: UITheme current textFont; cornerStyle: (UITheme current textEntryCornerStyleIn: self); hResizing: #spaceFill; vResizing: #rigid; borderStyle: (BorderStyle inset width: 1); color: Color white; hideScrollBarsIndefinitely; extent: 24 @ (UITheme current textFont height + 8); setBalloonText: nil. pt textMorph autoFit: true; wrapFlag: false; margins: (2 @ 1 corner: 2 @ 1). ^ pt! ]style[(15 738)f2cblack;b,f2cblack;! ! !Debugger methodsFor: '*Polymorph-Widgets-override' stamp: 'GuillermoPolito 8/11/2010 12:33'! buildMorphicNotifierLabelled: label message: messageString | notifyPane window extentToUse row| self expandStack. window := (PreDebugWindow labelled: label) model: self. extentToUse := 450 @ 156. "nice and wide to show plenty of the error msg" window addMorph: (row := self buttonRowForPreDebugWindow: window) fullFrame: (LayoutFrame fractions: (0@0 corner: 1@0) offsets: (0@0 corner: 0@row minExtent y)). row color: Color transparent. messageString notNil ifFalse: [notifyPane := PluggableListMorph on: self list: #contextStackList selected: #contextStackIndex changeSelected: #debugAt: menu: nil keystroke: nil] ifTrue: [notifyPane := PluggableTextMorph on: self editorClass: self editorClass text: nil accept: nil readSelection: nil menu: #debugProceedMenu:. notifyPane editString: (self preDebugNotifierContentsFrom: messageString); askBeforeDiscardingEdits: false]. window addMorph: notifyPane fullFrame: (LayoutFrame fractions: (0@0 corner: 1@1) offsets: (0@24 corner: 0@0)). window setBalloonTextForCloseBox. window openInWorldExtent: extentToUse. window currentWorld displayWorld. "helps with interrupt not working somehow." ^window! ]style[(58 1153)f2cblack;b,f2cblack;! ! !Debugger methodsFor: 'initialize' stamp: 'GuillermoPolito 8/11/2010 12:57'! openFullMorphicLabel: aLabelString "Open a full morphic debugger with the given label" | window aListMorph oldContextStackIndex | oldContextStackIndex := contextStackIndex. self expandStack. "Sets contextStackIndex to zero." window := (SystemWindow labelled: aLabelString) model: self. aListMorph := PluggableListMorph on: self list: #contextStackList selected: #contextStackIndex changeSelected: #toggleContextStackIndex: menu: #contextStackMenu:shifted: keystroke: #contextStackKey:from:. aListMorph menuTitleSelector: #messageListSelectorTitle. window addMorph: aListMorph frame: (0@0 corner: 1@0.25). self addLowerPanesTo: window at: (0@0.25 corner: 1@0.8) with: nil. window addMorph: (( PluggableListMorph new doubleClickSelector: #inspectSelection; on: self receiverInspector list: #fieldList selected: #selectionIndex changeSelected: #toggleIndex: menu: #fieldListMenu: keystroke: #inspectorKey:from:) autoDeselect: false) "For doubleClick to work best disable autoDeselect" frame: (0@0.8 corner: 0.2@1). window addMorph: (PluggableTextMorph on: self receiverInspector editorClass: self receiverInspector editorClass text: #contents accept: #accept: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) frame: (0.2@0.8 corner: 0.5@1). window addMorph: ( PluggableListMorph new doubleClickSelector: #inspectSelection; on: self contextVariablesInspector list: #fieldList selected: #selectionIndex changeSelected: #toggleIndex: menu: #fieldListMenu: keystroke: #inspectorKey:from:) frame: (0.5@0.8 corner: 0.7@1). window addMorph: (PluggableTextMorph on: self contextVariablesInspector editorClass: self contextVariablesInspector editorClass text: #contents accept: #accept: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) frame: (0.7@0.8 corner: 1@1). window openInWorld. self toggleContextStackIndex: oldContextStackIndex. ^ window ! ]style[(34 1973)f2cblack;b,f2cblack;! ! !FileList methodsFor: '*Polymorph-Widgets' stamp: 'GuillermoPolito 8/11/2010 13:01'! morphicPatternPane "Remove the vertical scrollbar since the minHeight would otherwise be too large to fit the layout frame. Added here for Pharo since FileList2 has been merged into FileList." |pane| pane := PluggableTextMorph on: self editorClass: self editorClass text: #pattern accept: #pattern:. pane acceptOnCR: true; hideVScrollBarIndefinitely: true. ^pane! ]style[(18 371)f2cblack;b,f2cblack;! ! !FileList methodsFor: 'file list menu' stamp: 'GuillermoPolito 8/10/2010 17:24'! fileContentsMenu: aMenu shifted: shifted "Construct aMenu to have items appropriate for the file browser's code pane, given the shift state provided" | shiftMenu services maybeLine extraLines | shifted ifTrue: [shiftMenu := SmalltalkEditor shiftedYellowButtonMenu. ^ aMenu addAllFrom: shiftMenu]. fileName ifNotNil: [services := OrderedCollection new. (#(briefHex briefFile needToGetBriefHex needToGetBrief) includes: brevityState) ifTrue: [services add: self serviceGet]. (#(fullHex briefHex needToGetFullHex needToGetBriefHex) includes: brevityState) ifFalse: [services add: self serviceGetHex]. (#(needToGetShiftJIS needToGetEUCJP needToGetCNGB needToGetEUCKR needToGetUTF8) includes: brevityState) ifFalse: [services add: self serviceGetEncodedText]. maybeLine := services size. (FileStream sourceFileSuffixes includes: self suffixOfSelectedFile) ifTrue: [services addAll: (self servicesFromSelectorSpecs: #(fileIntoNewChangeSet: fileIn: browseChangesFile: browseFile:))]. extraLines := OrderedCollection new. maybeLine > 0 ifTrue: [extraLines add: maybeLine]. services size > maybeLine ifTrue: [extraLines add: services size]. aMenu addServices: services for: self fullName extraLines: extraLines]. aMenu addList: { {'Find...(f)' translated. #find}. {'Find again (g)' translated. #findAgain}. {'Set search string (h)' translated. #setSearchString}. #-. {'Do again (j)' translated. #again}. {'Undo (z)' translated. #undo}. #-. {'Copy (c)' translated. #copySelection}. {'Cut (x)' translated. #cut}. {'Paste (v)' translated. #paste}. {'Paste...' translated. #pasteRecent}. #-. {'Do it (d)' translated. #doIt}. {'Print it (p)' translated. #printIt}. {'Inspect it (i)' translated. #inspectIt}. {'FileIn selection (G)' translated. #fileItIn}. #-. {'Accept (s)' translated. #accept}. {'Cancel (l)' translated. #cancel}. #-. {'More...' translated. #shiftedYellowButtonActivity}}. ^ aMenu ! ]style[(40 1993)f2cblack;b,f2cblack;! ! !FileList methodsFor: 'user interface' stamp: 'GuillermoPolito 8/11/2010 12:38'! morphicFileContentsPane ^PluggableTextMorph on: self editorClass: self editorClass text: #contents accept: #put: readSelection: #contentsSelection menu: #fileContentsMenu:shifted: ! ]style[(23 175)f2cblack;b,f2cblack;! ! !FileList methodsFor: 'private' stamp: 'GuillermoPolito 8/11/2010 12:14'! editorClass ^SmalltalkEditor! ! !FileList class methodsFor: 'instance creation' stamp: 'GuillermoPolito 8/11/2010 12:39'! openMorphOn: aFileStream editString: editString "Open a morphic view of a FileList on the given file." | fileModel window fileContentsView | fileModel := FileList new setFileStream: aFileStream. "closes the stream" window := (SystemWindow labelled: aFileStream fullName) model: fileModel. window addMorph: (fileContentsView := PluggableTextMorph on: fileModel editorClass: fileModel editorClass text: #contents accept: #put: readSelection: #contentsSelection menu: #fileContentsMenu:shifted:) frame: (0@0 corner: 1@1). editString ifNotNil: [fileContentsView editString: editString. fileContentsView hasUnacceptedEdits: true]. ^ window! ]style[(47 621)f2cblack;b,f2cblack;! ! PluggableTextMorph class removeSelector: #on:text:accept:! PluggableTextMorph class removeSelector: #on:text:accept:readSelection:menu:! ScrollPane subclass: #PluggableTextMorph instanceVariableNames: 'textMorph getTextSelector setTextSelector getSelectionSelector hasUnacceptedEdits askBeforeDiscardingEdits selectionInterval hasEditingConflicts acceptAction getColorSelector unstyledAcceptText styler editorClass' classVariableNames: 'ShowTextEditingState' poolDictionaries: '' category: 'Morphic-Pluggable Widgets'! Smalltalk removeClassNamed: #ParagraphEditor! Smalltalk removeClassNamed: #TextMorphEditor!