'From Squeak2.9alpha of 17 July 2000 [latest update: #3398] on 3 February 2001 at 4:59:54 pm'! "Change Set: bobAndTed Date: 3 February 2001 Author: Bob Arning two last minute fixes from Bob with consultations from Ted: - restore ability to pick up PhraseTileMorph from world if placed there temporarily. - older options to save a world/project: --- 'save project on file...' from the world menu --- 'save project on local file only' in the projects menu --- 'save on file...' in the playfield options menu are updated to use new publish mechanism with some modifications: --- the save is local only and directed to the default directory --- the user has a chance to override the file name"! !PasteUpMorph methodsFor: 'menu & halo' stamp: 'RAA 2/3/2001 16:45'! saveOnFile "Ask the user for a filename and save myself on a SmartReferenceStream file. Writes out the version and class structure. The file is fileIn-able. UniClasses will be filed out." | aFileName fileStream ok | self flag: #bob0302. self isWorldMorph ifTrue: [^self project storeLocallyOnly]. aFileName _ ('my ', self class name) asFileName. "do better?" aFileName _ FillInTheBlank request: 'File name? (".project" will be added to end)' initialAnswer: aFileName. aFileName size == 0 ifTrue: [^ self beep]. self allMorphsDo: [:m | m prepareToBeSaved]. ok _ aFileName endsWith: '.project'. "don't double them" ok _ ok | (aFileName endsWith: '.sp'). ok ifFalse: [aFileName _ aFileName,'.project']. fileStream _ FileStream newFileNamed: aFileName. fileStream fileOutClass: nil andObject: self. "Puts UniClass definitions out anyway"! ! !PhraseTileMorph methodsFor: 'mouse' stamp: 'RAA 2/3/2001 16:24'! mouseDown: evt "Pretend we picked up the tile and then put it down for a trial positioning." "The essence of ScriptEditor mouseEnter:" | ed ss guyToTake | self isPartsDonor ifTrue:[^self duplicateMorph: evt]. submorphs isEmpty ifTrue: [^ self]. (ed _ self enclosingEditor) ifNil: [^evt hand grabMorph: self]. guyToTake _ self. owner class == TilePadMorph ifTrue: ["picking me out of another phrase" (ss _ submorphs first) class == TilePadMorph ifTrue: [ss _ ss submorphs first]. guyToTake _ ss fullCopy]. evt hand grabMorph: guyToTake. ed startStepping. ed mouseEnterDragging: evt. ed setProperty: #justPickedUpPhrase toValue: true. ! ! !Project methodsFor: 'file in/out' stamp: 'RAA 2/3/2001 16:49'! storeLocallyInnards "Save the project to the local disk only" | resp newName localDirectory localVersionPair myVersionNumber warning maxNumber | self assureIntegerVersion. "Find out what version" localDirectory _ FileDirectory default. localVersionPair _ self class mostRecent: self name onServer: localDirectory. maxNumber _ myVersionNumber _ self currentVersionNumber. ProgressNotification signal: '2:versionsDetected'. warning _ ''. myVersionNumber < localVersionPair second ifTrue: [ warning _ warning,'\There are newer version(s) in the local directory'. maxNumber _ maxNumber max: localVersionPair second. ]. "8 Nov 2000 - only check on the first attempt to publish" myVersionNumber = 0 ifTrue: [ warning isEmpty ifFalse: [ myVersionNumber = 0 ifTrue: [ warning _ warning,'\THIS PROJECT HAS NEVER BEEN SAVED' ]. warning _ 'WARNING', '\Project: ',self name,warning. resp _ (PopUpMenu labels: 'Store anyway\Cancel' withCRs) startUpWithCaption: (warning, '\Please cancel, rename this project, and see what is there.') withCRs. resp ~= 1 ifTrue: [^ nil] ]. ]. version _ self bumpVersion: maxNumber. "write locally - now zipped automatically" newName _ FillInTheBlank request: 'File name?' initialAnswer: self versionedFileName. newName isEmpty ifTrue: [^ self beep]. lastSavedAtSeconds _ Time totalSeconds. self exportSegmentFileName: newName directory: localDirectory. ProgressNotification signal: '4:localSaveComplete'. "3 is deep in export logic" ProgressNotification signal: '9999 save complete'. ! ! !Project methodsFor: 'file in/out' stamp: 'RAA 2/3/2001 16:44'! storeLocallyOnly "Forget where stored before, and store. Will ask user where." self forgetExistingURL. self validateProjectNameIfOK: [ self isCurrentProject ifTrue: ["exit, then do the command" ^ self armsLengthCommand: #storeLocallyWithProgressInfo withDescription: 'Publishing' ]. self storeLocallyWithProgressInfo. ]. ! ! !Project methodsFor: 'file in/out' stamp: 'RAA 2/3/2001 16:43'! storeLocallyWithProgressInfo ComplexProgressIndicator new targetMorph: nil; historyCategory: 'project storing'; withProgressDo: [self storeLocallyInnards] ! ! !TheWorldMenu methodsFor: 'construction' stamp: 'RAA 2/3/2001 16:34'! projectMenu "Build the project menu for the world." | menu | self flag: #bob0302. menu _ self menu: 'projects...'. self fillIn: menu from: { { 'save on server (also makes a local copy)' . { #myProject . #storeOnServer } }. { 'save to a different server' . { #myProject . #saveAs } }. { 'save project on local file only' . { #myWorld . #saveOnFile } }. { 'see if server version is more recent...' . { #myProject . #loadFromServer } }. { 'load project from file...' . { self . #loadProject } }. nil. { #universalTilesString . { self . #toggleTileEra }. 'yes: new tiles in scripts and viewers. no: old tiles'}. { #largeTilesString . { self . #toggleLargeTiles }. 'yes: tiles in scripts and viewers are tall and green. no: tiles are short and transparent'}. nil. }. self fillIn: menu from: {{'show project hierarchy'. {Project. #showProjectHierarchyInWindow}. 'Opens a window that shows names and relationships of all the projects in your system.'}. nil}. self mvcProjectsAllowed ifTrue: [ self fillIn: menu from: { { 'create new mvc project'. { self . #openMVCProject } }. } ]. self fillIn: menu from: { { 'create new morphic project' . { self . #openMorphicProject } }. nil. { 'go to previous project' . { Project . #returnToPreviousProject } }. { 'go to next project' . { Project . #advanceToNextProject } }. { 'jump to project...' . { #myWorld . #jumpToProject } }. }. Preferences simpleMenus ifFalse: [ self fillIn: menu from: { nil. { 'save for future revert' . { #myProject . #saveForRevert } }. { 'revert to saved copy' . { #myProject . #revert } }. }. ]. ^ menu! !