David T. Lewis uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-dtl.313.mcz
==================== Summary ====================
Name: EToys-dtl.313
Author: dtl
Time: 25 November 2017, 9:54:37.052975 am
UUID: af30c57e-305f-4ee3-bf9a-c8e8e46c8b3f
Ancestors: EToys-bp.312
Remove most direct references to global World for Etoys.
Still to be done: Remove the World references in SyntaxMorph and WiWPasteUpMorph.
=============== Diff against EToys-bp.312 ===============
Item was changed:
----- Method: DisplayScreen class>>restoreDisplay (in category '*Etoys-Squeakland-screen modes') -----
restoreDisplay
"Clear the screen to gray and then redisplay all the scheduled views."
+ Smalltalk isMorphic ifTrue: [^ Project current world restoreMorphicDisplay].
- Smalltalk isMorphic ifTrue: [^ World restoreMorphicDisplay].
Display extent = DisplayScreen actualScreenSize
ifFalse:
[DisplayScreen startUp.
ScheduledControllers unCacheWindows].
ScheduledControllers restore!
Item was changed:
----- Method: EToysLauncher>>onEnterWorld (in category 'event handling') -----
onEnterWorld
(owner notNil
+ and: [Project current world == owner])
- and: [World == owner])
ifTrue: [owner addMorphInLayer: self.
self updatePane]
+ ifFalse: [Project current world removeActionsWithReceiver: self]!
- ifFalse: [World removeActionsWithReceiver: self]!
Item was changed:
----- Method: EtoysDebugger>>highlight: (in category 'highlighting') -----
highlight: aMorph
"| rect |
rect := BorderedMorph newBounds: aMorph bounds color: Color transparent.
rect openInWorld.
+ Project current world addAlarm: #delete
- World addAlarm: #delete
withArguments: #()
for: rect
at: (Time millisecondClockValue + 200)."
highlighter ifNotNil: [highlighter delete].
highlighter := HighlightMorph on: aMorph.
highlighter openInWorld!
Item was changed:
----- Method: EtoysDebugger>>trailMorph (in category 'accessing') -----
trailMorph
+ ^ self scriptedPlayer costume ifNil: [Project current world] ifNotNil: [:m | m trailMorph]!
- ^ self scriptedPlayer costume ifNil: [World] ifNotNil: [:m | m trailMorph]!
Item was changed:
----- Method: FileList2 class>>findAProjectSimple (in category '*Etoys-Squeakland-blue ui') -----
findAProjectSimple
"self findAProjectSimple"
^ self
+ morphicViewProjectLoader2InWorld: Project current world
- morphicViewProjectLoader2InWorld: World
reallyLoad: true
dirFilterType: #limitedSuperSwikiDirectoryList!
Item was changed:
----- Method: HTTPProxyEditor class>>activateWindow: (in category 'instance creation') -----
activateWindow: aWindow
"private - activate the window"
+ | world |
+ world := Project current world.
aWindow
+ right: (aWindow right min: world bounds right);
+ bottom: (aWindow bottom min: world bounds bottom);
+ left: (aWindow left max: world bounds left);
+ top: (aWindow top max: world bounds top).
+ aWindow comeToFront; flash!
- right: (aWindow right min: World bounds right).
- aWindow
- bottom: (aWindow bottom min: World bounds bottom).
- aWindow
- left: (aWindow left max: World bounds left).
- aWindow
- top: (aWindow top max: World bounds top).
- ""
- aWindow comeToFront.
- aWindow flash!
Item was changed:
----- Method: HTTPProxyEditor class>>open (in category 'instance creation') -----
open
"open the receiver"
+ Project current world submorphs
+ do: [:each | (each isKindOf: self)
+ ifTrue: [self activateWindow: each.
- World submorphs
- do: [:each | ""
- ((each isKindOf: self)
- )
- ifTrue: [""
- self activateWindow: each.
^ self]].
- ""
^ self new openInWorld!
Item was changed:
----- Method: KedamaMorph>>initialize (in category 'initialization') -----
initialize
super initialize.
drawRequested := true.
changePending := false.
+ pixelsPerPatch := (Project current world width min: Project current world height)
+ // (self class defaultDimensions x * 2). "heuristic..."
- pixelsPerPatch := (World width min: World height) // (self class defaultDimensions x * 2). "heuristic..."
self dimensions: self class defaultDimensions. "dimensions of this StarSqueak world in patches"
super extent: dimensions * pixelsPerPatch.
self assuredPlayer assureUniClass.
self clearAll. "be sure this is done once in case setup fails to do it"
autoChanged := true.
self leftEdgeMode: #wrap.
self rightEdgeMode: #wrap.
self topEdgeMode: #wrap.
self bottomEdgeMode: #wrap.
turtlesDictSemaphore := Semaphore forMutualExclusion.
!
Item was changed:
----- Method: Morph>>asWearableCostume (in category '*Etoys-support') -----
asWearableCostume
"Return a wearable costume for some player"
+ ^(Project current world drawingClass withForm: self imageForm) copyCostumeStateFrom: self!
- ^(World drawingClass withForm: self imageForm) copyCostumeStateFrom: self!
Item was changed:
----- Method: Morph>>showDesignationsOfObjects (in category '*Etoys-card in a stack') -----
showDesignationsOfObjects
"Momentarily show the designations of objects on the receiver"
| colorToUse |
self isStackBackground ifFalse: [^self].
self submorphsDo:
[:aMorph | | aLabel |
aLabel :=aMorph renderedMorph holdsSeparateDataForEachInstance
ifTrue:
[colorToUse := Color orange.
aMorph externalName]
ifFalse:
[colorToUse := aMorph isShared ifFalse: [Color red] ifTrue: [Color green].
nil].
Display
border: (aMorph fullBoundsInWorld insetBy: -6)
width: 6
rule: Form over
fillColor: colorToUse.
aLabel ifNotNil:
[aLabel asString
displayOn: Display
at: aMorph fullBoundsInWorld bottomLeft + (0 @ 5)
textColor: Color blue]].
Sensor anyButtonPressed
ifTrue: [Sensor waitNoButton]
ifFalse: [Sensor waitButton].
+ self world fullRepaintNeeded!
- World fullRepaintNeeded!
Item was changed:
----- Method: MovingEyeMorph>>step (in category 'stepping and presenter') -----
step
| cp |
+ cp := self globalPointToLocal: self world primaryHand position.
- cp := self globalPointToLocal: World primaryHand position.
(inner containsPoint: cp)
ifTrue: [iris position: (cp - (iris extent // 2))]
ifFalse: [self irisPos: cp].
self changed "cover up gribblies if embedded in Flash"!
Item was changed:
----- Method: OLPCVirtualScreen>>checkForNewScreenSize (in category 'display') -----
checkForNewScreenSize
| aPoint |
aPoint := DisplayScreen actualScreenSize.
aPoint = display extent ifTrue:[^nil].
display setExtent: aPoint depth: depth.
display fillColor: (Color gray: 0.2).
self setupWarp; forceToScreen.
display forceToScreen. "to capture the borders"
+ Project current world restoreMorphicDisplay.
+ Project current world repositionFlapsAfterScreenSizeChange.!
- World restoreMorphicDisplay.
- World repositionFlapsAfterScreenSizeChange.!
Item was changed:
----- Method: OLPCVirtualScreen>>zoomOut: (in category 'display') -----
zoomOut: aBoolean
"When the physical display is bigger than the virtual display size, we have two options. One is to zoom in and maximize the visible area and another is to map a pixel to a pixel and show it in smaller area (at the center of screen). This flag governs them."
self canZoomOut ifFalse: [^ self].
zoomOut := aBoolean.
display fillColor: (Color gray: 0.2).
self setupWarp; forceToScreen.
display forceToScreen. "to capture the borders"
+ Project current world restoreMorphicDisplay.
+ Project current world repositionFlapsAfterScreenSizeChange.
- World restoreMorphicDisplay.
- World repositionFlapsAfterScreenSizeChange.
!
Item was changed:
----- Method: Player>>grabPatchMorph (in category 'slot-kedama') -----
grabPatchMorph
+ Project current world primaryHand attachMorph: costume renderedMorph.
- World primaryHand attachMorph: costume renderedMorph.
!
Item was changed:
----- Method: Project class>>interruptName:preemptedProcess: (in category '*Etoys-Squeakland-utilities') -----
interruptName: labelString preemptedProcess: theInterruptedProcess
"Create a Notifier on the active scheduling process with the given label."
| preemptedProcess projectProcess |
Smalltalk isMorphic ifFalse:
[^ ScheduledControllers interruptName: labelString].
ActiveHand ifNotNil:[ActiveHand interrupted].
+ ActiveWorld := Project current world. "reinstall active globals"
+ ActiveHand := ActiveWorld primaryHand.
- ActiveWorld := World. "reinstall active globals"
- ActiveHand := World primaryHand.
ActiveHand interrupted. "make sure this one's interrupted too"
ActiveEvent := nil.
projectProcess := self uiProcess. "we still need the accessor for a while"
preemptedProcess := theInterruptedProcess ifNil: [Processor preemptedProcess].
"Only debug preempted process if its priority is >= projectProcess' priority"
preemptedProcess priority < projectProcess priority
ifTrue:[preemptedProcess := projectProcess].
preemptedProcess suspend.
Debugger openInterrupt: labelString onProcess: preemptedProcess
!
Item was changed:
----- Method: ProjectLoading class>>loadSexpProjectDict:stream:fromDirectory:withProjectView: (in category '*etoys') -----
loadSexpProjectDict: dict stream: preStream fromDirectory: aDirectoryOrNil withProjectView: existingView
| archive anObject newProj d member memberStream members newSet allNames realName oldSet s |
(self checkStream: preStream) ifTrue: [^ nil].
ProgressNotification signal: '0.2'.
preStream reset.
archive := preStream isZipArchive
ifTrue:[ZipArchive new readFrom: preStream]
ifFalse:[nil].
members := archive membersMatching: '*.cs'.
members do: [:e | newSet := ChangeSorter newChangesFromStream: e contentStream named: 'zzTemp', Time totalSeconds printString].
member := (archive membersMatching: '*.sexp') first.
memberStream := member contentStream.
(self checkSecurity: member name preStream: preStream projStream: memberStream)
ifFalse: [^nil].
self flag: #tfel. "load all projects and save them again in the new format, then get rid of the error block!!"
s := memberStream basicUpToEnd.
d := [(DataStream on: memberStream) next] on: Error do: [:e |
(Smalltalk at: #MSExpParser) parse: s with: #ksexp].
anObject := d sissReadObjectsAsEtoysProject.
preStream close.
"anObject := (MSExpParser parse: (archive membersMatching: '*.sexp') first contents with: #ksexp) sissReadObjects."
anObject ifNil: [^ nil].
+ (anObject isKindOf: PasteUpMorph) ifFalse: [^ Project current world addMorph: anObject].
- (anObject isKindOf: PasteUpMorph) ifFalse: [^ World addMorph: anObject].
ProgressNotification signal: '0.7'.
newProj := MorphicProject new.
newProj installPasteUpAsWorld: anObject.
newSet ifNotNil: [oldSet := newProj changeSet. newProj setChangeSet: newSet. ChangeSorter removeChangeSet: oldSet].
dict at: 'projectname' ifPresent: [:n |
allNames := Project allNames.
realName := Utilities keyLike: n satisfying:
[:nn | (allNames includes: nn) not].
newProj renameTo: realName.
].
anObject valueOfProperty: #projectVersion ifPresentDo: [:v | newProj version: v].
newProj noteManifestDetailsIn: dict.
ProgressNotification signal: '0.8'.
^ newProj.!
Item was changed:
----- Method: ScrollableField>>spawn: (in category '*Etoys-Squeakland-as yet unclassified') -----
spawn: aByteString
"Hack to open the object catalog when Cmd-O is pressed"
self setMyText: aByteString.
+ (Project current world commandKeySelectors at: $o) value.
- (World commandKeySelectors at: $o) value.
!
Item was changed:
----- Method: SketchMorph>>asWearableCostume (in category '*Etoys-e-toy support') -----
asWearableCostume
"Return a wearable costume for some player"
+ ^(Project current world drawingClass withForm: originalForm) copyCostumeStateFrom: self!
- ^(World drawingClass withForm: originalForm) copyCostumeStateFrom: self!
Item was changed:
----- Method: StandardScriptingSystem>>benchmarkCategory (in category '*Etoys-Squeakland-benchmarks') -----
benchmarkCategory
"ScriptingSystem benchmarkCategory"
+ | m v result world |
+ world := Project current world.
- | m v result |
m := Morph new openInWorld.
m openViewerForArgument.
+ world doOneCycle.
- World doOneCycle.
v := m player allOpenViewers first submorphs last.
result := [v chosenCategorySymbol: #geometry.
+ world doOneCycle] timeToRun.
- World doOneCycle] timeToRun.
m delete.
+ world doOneCycle.
- World doOneCycle.
^ result!
Item was changed:
----- Method: StandardScriptingSystem>>benchmarkPainter (in category '*Etoys-Squeakland-benchmarks') -----
benchmarkPainter
"ScriptingSystem benchmarkPainter"
+ | world result |
+ world := Project current world.
+ result := [world makeNewDrawing: nil at: 400 @ 300.
+ world doOneCycle] timeToRun.
+ (world findA: SketchEditorMorph) cancelOutOfPainting.
+ world doOneCycle.
- | result |
- result := [World makeNewDrawing: nil at: 400 @ 300.
- World doOneCycle] timeToRun.
- (World findA: SketchEditorMorph) cancelOutOfPainting.
- World doOneCycle.
^ result!
Item was changed:
----- Method: StandardScriptingSystem>>benchmarkScriptor (in category '*Etoys-Squeakland-benchmarks') -----
benchmarkScriptor
"ScriptingSystem benchmarkScriptor"
"(Picking up third one)"
| result m |
m := Morph new openInWorld.
m openViewerForArgument.
m player assureUniClass.
m player newScriptorAround: nil.
m player newScriptorAround: nil.
result := [(m player newScriptorAround: nil) openInWorld.
+ Project current world doOneCycle] timeToRun.
- World doOneCycle] timeToRun.
m delete.
+ Project current world doOneCycle.
- World doOneCycle.
^ result!
Item was changed:
----- Method: StandardScriptingSystem>>benchmarkViewer (in category '*Etoys-Squeakland-benchmarks') -----
benchmarkViewer
"ScriptingSystem benchmarkViewer"
+ | result m world |
- | result m |
m := Morph new openInWorld.
+ world := Project current world.
result := [m openViewerForArgument.
+ world doOneCycle] timeToRun.
- World doOneCycle] timeToRun.
m delete.
+ world doOneCycle.
- World doOneCycle.
^ result!
Item was changed:
----- Method: SugarLauncher>>shutDown (in category 'running') -----
shutDown
sharedActivity ifNotNil: [
self leaveSharedActivity.
sharedActivity := nil].
Project allSubInstancesDo: [:prj | prj removeParameter: #sugarId].
ServerDirectory inImageServers keysAndValuesDo: [:srvrName :srvr |
(srvr isKindOf: SugarDatastoreDirectory) ifTrue: [
ServerDirectory removeServerNamed: srvrName ifAbsent: []]].
Current := nil.
+ Project current world windowEventHandler: nil.
- World windowEventHandler: nil.
!
Item was changed:
----- Method: SugarLauncher>>startUp (in category 'running') -----
startUp
self class allInstances do: [:ea | ea shutDown].
Current := self.
SugarNavigatorBar current
ifNotNil: [:bar | bar startUp].
parameters at: 'ACTIVITY_ID' ifPresent: [ :activityId |
OLPCVirtualScreen setupIfNeeded.
+ Project current world windowEventHandler: self.
- World windowEventHandler: self.
(Smalltalk classNamed: 'DBus') ifNotNil: [:dbus |
dbus sessionBus
export: (Smalltalk classNamed: 'SugarEtoysActivity') new
on: 'org.laptop.Activity', activityId
at: '/org/laptop/Activity/', activityId].
Utilities authorName: self ownerBuddy nick.
ServerDirectory
addServer: (SugarDatastoreDirectory mimetype: 'application/x-squeak-project' extension: '.pr')
named: SugarLauncher defaultDatastoreDirName.
self joinSharedActivity.
self isShared ifFalse: [
parameters at: 'OBJECT_ID' ifPresent: [:id |
^self resumeJournalEntry: id]].
self isShared ifTrue: [^self].
^self welcome: (parameters at: 'URI' ifAbsent: [''])].
self welcome: ''
!
Item was changed:
----- Method: SugarLauncher>>viewSource (in category 'commands') -----
viewSource
WorldState addDeferredUIMessage: [
+ Project current world showSourceKeyHit]!
- World showSourceKeyHit]!
Item was changed:
----- Method: SugarNavigatorBar>>putUpInitialBalloonHelp (in category 'initialization') -----
putUpInitialBalloonHelp
"
SugarNavigatorBar putUpInitialBalloonHelp
"
| suppliesButton b1 b2 p b |
suppliesButton := paintButton owner submorphs detect: [:e | e isButton and: [e actionSelector = #toggleSupplies]].
b1 := BalloonMorph string: self paintButtonInitialExplanation for: paintButton corner: #topRight force: false.
b2 := BalloonMorph string: self suppliesButtonInitialExplanation for: suppliesButton corner: #topLeft force: true.
p := PasteUpMorph new.
p clipSubmorphs: false.
p color: Color transparent.
p borderWidth: 0.
p addMorph: b1.
p addMorph: b2.
+ b := BalloonMorph string: p for: self world corner: #bottomLeft.
- b := BalloonMorph string: p for: World corner: #bottomLeft.
b color: Color transparent.
b borderWidth: 0.
[(Delay forSeconds: 1) wait. b popUpForHand: ActiveHand] fork.
!
Item was changed:
----- Method: SugarNavigatorBar>>putUpInitialBalloonHelpFor: (in category 'initialization') -----
putUpInitialBalloonHelpFor: quads
"Given a list of quads of the form <selector> <help-msg> <corner> <force-boolean> (see senders for examples), put up initial balloon help for them."
"
SugarNavigatorBar someInstance putUpInitialBalloonHelpFor: #((doNewPainting 'make a new painting' topRight false) (toggleSupplies 'open the supplies bin' topLeft true))
SugarNavigatorBar someInstance putUpInitialBalloonHelpFor: #((showNavBar 'show the tool bar' bottomLeft false) (hideNavBar 'hide the tool bar' bottomLeft false))
"
| b1 p b |
p := PasteUpMorph new.
p clipSubmorphs: false.
p color: Color transparent.
p borderWidth: 0.
quads do: [:aQuad |
(submorphs first submorphs detect: [:e | e isButton and: [e actionSelector = aQuad first]] ifNone: [nil]) ifNotNil:
[:aButton |
b1 := BalloonMorph string: aQuad second for: aButton corner: aQuad third force: aQuad fourth.
p addMorph: b1]].
+ b := BalloonMorph string: p for: self world corner: #bottomLeft.
- b := BalloonMorph string: p for: World corner: #bottomLeft.
b color: Color transparent.
b borderWidth: 0.
[(Delay forSeconds: 1) wait. b popUpForHand: ActiveHand] fork.
!
Item was changed:
----- Method: SugarNavigatorBar>>quitSqueak (in category 'button actions') -----
quitSqueak
^SugarLauncher isRunningInSugar
ifTrue: [SugarLauncher current quit]
ifFalse: [
Preferences eToyFriendly
ifTrue: [super quitSqueak]
ifFalse: [Smalltalk
snapshot: (
UserDialogBoxMorph
confirm: 'Save changes before quitting?' translated
orCancel: [ ^self ]
+ at: self world center)
- at: World center)
andQuit: true]].!
tim Rowledge uploaded a new version of CommandLine to project The Trunk:
http://source.squeak.org/trunk/CommandLine-tpr.9.mcz
==================== Summary ====================
Name: CommandLine-tpr.9
Author: tpr
Time: 27 November 2017, 4:19:28.477888 pm
UUID: d691df70-b8c1-4a0b-9ec1-0976b33fe9ab
Ancestors: CommandLine-mt.8
Add convenience method to save files via UIManager
=============== Diff against CommandLine-mt.8 ===============
Item was added:
+ ----- Method: DummyUIManager>>saveFilenameRequest:initialAnswer: (in category 'ui requests') -----
+ saveFilenameRequest: queryString initialAnswer: defaultAnswer
+ "Open a FileSaverDialog to ask for a place and filename to use for saving a file. The initial suggestion for the filename is defaultAnswer but the user may choose any existing file or type in a new name entirely"
+
+ (ProvideAnswerNotification signal: queryString)
+ ifNotNil: [:answer |
+ ^ answer == #default ifTrue: [defaultAnswer] ifFalse: [answer]].
+
+ self error: 'No user response possible'!
tim Rowledge uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-tpr.174.mcz
==================== Summary ====================
Name: Files-tpr.174
Author: tpr
Time: 27 November 2017, 4:17:37.367161 pm
UUID: 66bc2358-5091-4a6e-8ca9-d3cc71fac05e
Ancestors: Files-tpr.173
Minor changes to use vmPathToSqueakPath
=============== Diff against Files-tpr.173 ===============
Item was changed:
----- Method: DirectoryEntry>>convertFromSystemName (in category 'multilingual system') -----
convertFromSystemName
+ name := name vmPathToSqueakPath!
- name := (FilePath pathName: name isEncoded: true) asSqueakPathName!
Item was changed:
----- Method: StandardFileStream>>requestDropStream: (in category 'dnd requests') -----
requestDropStream: dropIndex
"Return a read-only stream for some file the user has just dropped onto Squeak."
| rawName |
rawName := self class primDropRequestFileName: dropIndex.
+ name := rawName vmPathToSqueakPath.
- name := (FilePath pathName: rawName isEncoded: true) asSqueakPathName.
fileID := self primDropRequestFileHandle: dropIndex.
fileID == nil ifTrue:[^nil].
self register.
rwmode := false.
buffer1 := String new: 1.
self enableReadBuffering
!
tim Rowledge uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-tpr.769.mcz
==================== Summary ====================
Name: Collections-tpr.769
Author: tpr
Time: 27 November 2017, 4:16:19.721254 pm
UUID: be0bba64-3ddd-45fa-8627-c842ab821515
Ancestors: Collections-nice.768
Minor changes relating to FilePath use
=============== Diff against Collections-nice.768 ===============
Item was changed:
----- Method: String>>asFileName (in category 'converting') -----
asFileName
+ "Answer a String made up from the receiver that is an acceptable file base
+ name. Does not produce corrected fulll paths if the directory separator etc are included"
- "Answer a String made up from the receiver that is an acceptable file
- name."
| string checkedString |
string := FileDirectory checkName: self fixErrors: true.
checkedString := (FilePath pathName: string) asVmPathName.
^ (FilePath pathName: checkedString isEncoded: true) asSqueakPathName.
!
Item was added:
+ ----- Method: String>>vmPathToSqueakPath (in category 'converting') -----
+ vmPathToSqueakPath
+ "convert a file path string received from the vm to a Squeak String"
+
+ ^ (FilePath pathName: self isEncoded: true) asSqueakPathName!
tim Rowledge uploaded a new version of ToolBuilder-Kernel to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Kernel-tpr.115.mcz
==================== Summary ====================
Name: ToolBuilder-Kernel-tpr.115
Author: tpr
Time: 27 November 2017, 4:09:03.40509 pm
UUID: f289467d-522d-43e7-8422-704f8fbb6cc2
Ancestors: ToolBuilder-Kernel-tpr.114
Add convenience method for saving file via UIManager
=============== Diff against ToolBuilder-Kernel-tpr.114 ===============
Item was added:
+ ----- Method: UIManager>>saveFilenameRequest:initialAnswer: (in category 'ui requests') -----
+ saveFilenameRequest: queryString initialAnswer: defaultAnswer
+ "Open a FileSaverDialog to ask for a place and filename to use for saving a file. The initial suggestion for the filename is defaultAnswer but the user may choose any existing file or type in a new name entirely"
+
+ ^self subclassResponsibility!
tim Rowledge uploaded a new version of ToolBuilder-MVC to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-MVC-tpr.50.mcz
==================== Summary ====================
Name: ToolBuilder-MVC-tpr.50
Author: tpr
Time: 27 November 2017, 4:07:53.194506 pm
UUID: e349d745-4348-47a1-8ece-3c1f321463fe
Ancestors: ToolBuilder-MVC-tpr.49
Add convenience method to save a file via UIMananger
=============== Diff against ToolBuilder-MVC-tpr.49 ===============
Item was added:
+ ----- Method: MVCUIManager>>saveFilenameRequest:initialAnswer: (in category 'ui requests') -----
+ saveFilenameRequest: queryString initialAnswer: defaultAnswer
+ "Open a FileSaverDialog to ask for a place and filename to use for saving a file. The initial suggestion for the filename is defaultAnswer but the user may choose any existing file or type in a new name entirely"
+ "MVC has to stick with the boring way of doing it"
+ | result |
+ result := self request: queryString initialAnswer: defaultAnswer.
+ ^result isEmpty ifTrue: [nil] ifFalse:[result]
+ !
tim Rowledge uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-tpr.201.mcz
==================== Summary ====================
Name: ToolBuilder-Morphic-tpr.201
Author: tpr
Time: 27 November 2017, 4:06:41.954459 pm
UUID: 90b9cbb2-57e1-4fd0-acae-81d4b61d97a8
Ancestors: ToolBuilder-Morphic-dtl.200
Convenience method for file saving via the UIManager
=============== Diff against ToolBuilder-Morphic-dtl.200 ===============
Item was added:
+ ----- Method: MorphicUIManager>>saveFilenameRequest:initialAnswer: (in category 'ui requests') -----
+ saveFilenameRequest: queryString initialAnswer: defaultAnswer
+ "Open a FileSaverDialog to ask for a place and filename to use for saving a file. The initial suggestion for the filename is defaultAnswer but the user may choose any existing file or type in a new name entirely"
+
+ ^FileSaverDialog openOnInitialFilename: defaultAnswer label: queryString
+ !
tim Rowledge uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-tpr.777.mcz
==================== Summary ====================
Name: Tools-tpr.777
Author: tpr
Time: 27 November 2017, 4:03:09.56613 pm
UUID: 71e5c1c3-35d0-4c3d-bbe2-83174f32e145
Ancestors: Tools-dtl.776
Add a directory chooser tool.
Some improvements to FileSaverDIalogs
=============== Diff against Tools-dtl.776 ===============
Item was added:
+ FileAbstractSelectionDialog subclass: #DirectoryChooserDialog
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Tools-FileDialogs'!
Item was added:
+ ----- Method: DirectoryChooserDialog>>buildWith: (in category 'toolbuilder') -----
+ buildWith: builder
+ "assemble the spec for the chooser dialog UI"
+
+ | windowSpec window |
+ windowSpec := self buildWindowWith: builder specs: {
+ (self frameOffsetFromTop: 0
+ fromLeft: 0
+ width: 1
+ offsetFromBottom: self buttonHeight) -> [self buildDirectoryTreeWith: builder].
+ }.
+ windowSpec buttons add:( builder pluggableButtonSpec new
+ model: self;
+ label: 'Accept';
+ action: #acceptFileName).
+ windowSpec buttons add:( builder pluggableButtonSpec new
+ model: self;
+ label: 'Cancel';
+ action: #cancelFileChooser).
+ window := builder build: windowSpec.
+ self changed: #selectedPath.
+ ^window
+ !
Item was added:
+ ----- Method: DirectoryChooserDialog>>finalChoice (in category 'ui details') -----
+ finalChoice
+ "return the chosen directory that was saved by an accept click or nil; client must check for validity"
+
+ ^self directory fullName!
Item was added:
+ ----- Method: DirectoryChooserDialog>>userMessage (in category 'ui details') -----
+ userMessage
+ "return the string to present to the user in order to explain the purpose of this dialog appearing"
+
+ ^message ifNil:['Choose a directory name']!
Item was added:
+ ----- Method: FileChooserDialog class>>openOnSuffixList:label: (in category 'instance creation') -----
+ openOnSuffixList: patternList label: messageString
+ "open a modal dialog to choose a file. Start the dialog with aDirectory selected and files matching the default 'everything' pattern"
+
+ ^self new
+ suffixList: patternList;
+ message: messageString;
+ getUserResponse!
Item was added:
+ ----- Method: FileSaverDialog class>>openOnInitialFilename:label: (in category 'instance creation') -----
+ openOnInitialFilename: filenameString label: labelString
+ "open a modal dialog to save a file. Start the dialog with the default directory selected and the suggested file name, set the user message to labelString"
+
+
+ ^self new
+ initialFilename: filenameString;
+ message: labelString;
+ getUserResponse
+
+ !
Item was changed:
----- Method: FileSaverDialog>>initialFilename: (in category 'initialize-release') -----
+ initialFilename: aFilenameOrNil
- initialFilename: aFilename
"Set the initial choice of filename to highlight.
We split the potential filename to see if it includes a path and if so, use that as the chosen directory - the client can manually change that with a subsequent send of #directory: if wanted.
We split the root filename to find an extension and use that as the suffix - again, the client can manually change that later"
| e f p |
+ aFilenameOrNil ifNil:[^self].
+
+ p := FileDirectory dirPathFor: aFilenameOrNil.
- p := FileDirectory dirPathFor: aFilename.
p isEmpty ifFalse:[self directory: (FileDirectory on: p)].
+ f := FileDirectory localNameFor: aFilenameOrNil.
- f := FileDirectory localNameFor: aFilename.
fileName := f.
e := FileDirectory extensionFor: f.
e isEmpty ifFalse:[self suffix: e]!
Patrick Rein uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-pre.386.mcz
==================== Summary ====================
Name: Graphics-pre.386
Author: pre
Time: 27 November 2017, 5:15:20.018723 pm
UUID: edc4e679-010f-c24c-b74e-3fe17fbefe4d
Ancestors: Graphics-nice.385
Improves comment and code of veryDeepCopy code in Color (very minor change)
=============== Diff against Graphics-nice.385 ===============
Item was changed:
----- Method: Color>>veryDeepCopyWith: (in category 'copying') -----
veryDeepCopyWith: deepCopier
+ "I am immutable in the Morphic world. Do not record me."
+ ^ self!
- "Return self. I am immutable in the Morphic world. Do not record me."!
Patrick Rein uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-pre.1125.mcz
==================== Summary ====================
Name: Kernel-pre.1125
Author: pre
Time: 27 November 2017, 5:13:00.494723 pm
UUID: 9e2716d1-e17d-1d4e-a6db-bdab28e189c8
Ancestors: Kernel-dtl.1124
Adds a comment for deepCopy to make the consequences regarding object identity explicit.
=============== Diff against Kernel-dtl.1124 ===============
Item was changed:
----- Method: Object>>deepCopy (in category 'copying') -----
deepCopy
+ "Answer a copy of the receiver with its own copy of each instance variable.
+ WARNING: deepCopy does not preserve object identities in cycles in the object graph. Consider using #veryDeepCopy instead."
- "Answer a copy of the receiver with its own copy of each instance
- variable."
| newObject class index |
class := self class.
(class == Object) ifTrue: [^self].
class isVariable
ifTrue:
[index := self basicSize.
newObject := class basicNew: index.
[index > 0]
whileTrue:
[newObject basicAt: index put: (self basicAt: index) deepCopy.
index := index - 1]]
ifFalse: [newObject := class basicNew].
index := class instSize.
[index > 0]
whileTrue:
[newObject instVarAt: index put: (self instVarAt: index) deepCopy.
index := index - 1].
^newObject!
Item was changed:
----- Method: Object>>veryDeepCopy (in category 'copying') -----
veryDeepCopy
+ "Do a complete tree copy using a dictionary. An object in the tree twice is only copied once. All references to the object in the copy of the tree will point to the new copy."
- "Do a complete tree copy using a dictionary. An object in the tree twice is only copied once. All references to the object in the copy of the tree will point to the new copy."
| copier new |
copier := DeepCopier new: self initialDeepCopierSize.
new := self veryDeepCopyWith: copier.
copier mapUniClasses.
copier references associationsDo: [:assoc |
assoc value veryDeepFixupWith: copier].
copier fixDependents.
^ new!