BorderedMorph subclass: #ViJoyMorph instanceVariableNames: 'model' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyMorph methodsFor: 'private' stamp: 'e-itoh 10/10/2007 22:28'! listFromSubmorphs: aMorph | top prev list | top := JoyList joyNil. prev := nil. aMorph submorphsDo: [:each | list := JoyList new: each model. prev ifNotNil: [prev next: list]. top isNil ifTrue: [top := list]. prev := list]. ^ top! ! !ViJoyMorph methodsFor: 'private' stamp: 'e-itoh 10/7/2007 19:56'! rebuild self subclassResponsibility! ! !ViJoyMorph methodsFor: 'private' stamp: 'e-itoh 10/8/2007 17:59'! reorganize ! ! !ViJoyMorph methodsFor: 'accessing' stamp: 'e-itoh 10/8/2007 10:52'! addMorphsTo: aMorph from: aJoyList | list | list := aJoyList. [list notNil] whileTrue: [aMorph addMorphBack: (self class morphForModel: list v). list := list next]! ! !ViJoyMorph methodsFor: 'accessing' stamp: 'e-itoh 10/7/2007 11:31'! model ^ model! ! !ViJoyMorph methodsFor: 'accessing' stamp: 'e-itoh 10/7/2007 19:55'! model: anObject model := anObject. self rebuild! ! !ViJoyMorph methodsFor: 'dropping/grabbing' stamp: 'e-itoh 10/10/2007 20:46'! justGrabbedFrom: formerOwner | morph | super justGrabbedFrom: formerOwner. (formerOwner isKindOf: ViJoyMorph) ifTrue: [morph := formerOwner] ifFalse: [morph := formerOwner ownerThatIsA: ViJoyMorph]. morph ifNotNil: [morph reorganize]! ! !ViJoyMorph methodsFor: 'dropping/grabbing' stamp: 'e-itoh 10/9/2007 21:46'! wantsDroppedMorph: aMorph event: anEvent ^ (aMorph isKindOf: ViJoyFunction) or: [aMorph isKindOf: ViJoyQuotation]! ! !ViJoyMorph methodsFor: 'event handling' stamp: 'e-itoh 10/9/2007 22:05'! handlesMouseDown: anEvent ^ (self ownerThatIsA: ViJoyStack) isNil! ! !ViJoyMorph methodsFor: 'event handling' stamp: 'e-itoh 10/9/2007 21:53'! mouseDown: anEvent anEvent hand grabMorph: self! ! !ViJoyMorph methodsFor: 'initialization' stamp: 'e-itoh 10/7/2007 22:17'! createBox | box | box := IconicButton new. box color: Color transparent; target: self; useSquareCorners; borderWidth: 0. ^ box! ! !ViJoyMorph methodsFor: 'initialization' stamp: 'e-itoh 10/7/2007 22:32'! createCloseBox ^ self createBox labelGraphic: SystemWindow closeBoxImage; extent: 14 @ 14; actionSelector: #delete! ! !ViJoyMorph methodsFor: 'initialization' stamp: 'e-itoh 10/8/2007 14:23'! defaultBorderWidth ^ 1! ! !ViJoyMorph methodsFor: 'initialization' stamp: 'e-itoh 10/9/2007 21:01'! initialize super initialize. self extent: 50 @ 20; changeTableLayout; listDirection: #topToBottom; listCentering: #center; wrapDirection: #none; wrapCentering: #center; hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: 2. self minCellSize: 10@20; useRoundedCorners! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! ViJoyMorph class instanceVariableNames: ''! !ViJoyMorph class methodsFor: 'instance creation' stamp: 'e-itoh 10/11/2007 20:39'! morph | morph | morph := AlignmentMorph newColumn color: Color lightYellow. morph hResizing: #shrinkWrap; vResizing: #shrinkWrap; setNameTo: 'Joy'. morph borderWidth: 1. morph addMorphBack: (self titleMorph: morph). morph addMorphBack: self primitiveMorph. morph addMorphBack: self moduleMorph. morph addMorphBack: self numberMorph. morph addMorphBack: self booleanMorph. morph addMorphBack: self quoteMorph. morph addMorphBack: self stringMorph. ^ morph! ! !ViJoyMorph class methodsFor: 'instance creation' stamp: 'e-itoh 10/7/2007 21:49'! newFrom: aJoyNode ^ self basicNew initialize model: aJoyNode! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 21:17'! addTenkeyTo: aMorph notify: aStringMorph | morph | (0 to: 9) do: [:each | morph := SimpleButtonMorph newWithLabel: each asString. morph target: self; actWhen: #buttonUp; actionSelector: #key:to:; arguments: (Array with: each with: aStringMorph). aMorph addMorphBack: morph]. morph := SimpleButtonMorph newWithLabel: '-'. morph target: self; actWhen: #buttonUp; actionSelector: #key:to:; arguments: (Array with: #toggleMinus with: aStringMorph). aMorph addMorphBack: morph. morph := SimpleButtonMorph newWithLabel: '<'. morph target: self; actWhen: #buttonUp; actionSelector: #key:to:; arguments: (Array with: #bs with: aStringMorph). aMorph addMorphBack: morph! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 19:30'! booleanMorph | row button | row := AlignmentMorph newRow color: Color transparent. row hResizing: #spaceFill; vResizing: #shrinkWrap. row addMorphBack: (StringMorph contents: 'boolean: '). row addMorphBack: AlignmentMorph newVariableTransparentSpacer. button := SimpleButtonMorph newWithLabel: 'true'. button target: self; actWhen: #buttonUp; actionSelector: #generateBoolean:; arguments: (Array with: true). row addMorphBack: button. button := SimpleButtonMorph newWithLabel: 'false'. button target: self; actWhen: #buttonUp; actionSelector: #generateBoolean:; arguments: (Array with: false). row addMorphBack: button. ^ row! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 20:19'! clearStrings: aMorph aMorph removeAllMorphs! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 20:16'! enterString: aMorph | ret button | ret := FillInTheBlank request: 'enter new string' initialAnswer: ''. (ret isNil or: [ret isEmpty]) ifTrue: [^ self]. aMorph ifNotNil: [button := SimpleButtonMorph newWithLabel: ret. button target: self; actWhen: #buttonUp; actionSelector: #generateString:; arguments: (Array with: ret). aMorph addMorphBack: button]. self generateString: ret! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/8/2007 21:37'! generateBoolean: aBoolean | node | node := JoyBoolean newFrom: aBoolean. (ViJoyMorph morphForModel: node) openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/8/2007 20:51'! generateConcatenation | mname node | mname := self selectModuleName. mname ifNil: [^ self]. node := JoyDefinition newName: mname code: (JoyLibrary default codeOf: mname). (ViJoyMorph morphForModel: node) openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/8/2007 20:51'! generateModule | mname node | mname := self selectModuleName. mname ifNil: [^ self]. node := JoyModule newFrom: mname. (ViJoyMorph morphForModel: node) openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 22:34'! generateNewConcatenation | node | node := JoyDefinition newName: nil code: JoyList joyNil. (ViJoyMorph morphForModel: node) openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 21:14'! generateNumber: aMorph | node | node := JoyNumber newFrom: aMorph label asNumber. (ViJoyMorph morphForModel: node) openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/8/2007 20:53'! generatePrimitive | mname node | mname := self selectPrimitiveName. mname ifNil: [^ self]. node := JoyPrimitive newFrom: mname. (ViJoyMorph morphForModel: node) openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 22:33'! generateQuotation (self morphForModel: JoyList joyNil) openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 20:01'! generateStack ViJoyStack new openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 20:16'! generateString: aString | node | node := JoyString newFrom: aString. (ViJoyMorph morphForModel: node) openInHand! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 21:14'! key: aSymbolOrNumber to: aMorph | string | string := aMorph label. aSymbolOrNumber = #bs ifTrue: [string notEmpty ifTrue: [string := string allButLast]]. aSymbolOrNumber = #clear ifTrue: [string := '']. aSymbolOrNumber = #toggleMinus ifTrue: [string := string asNumber negated asString]. aSymbolOrNumber isNumber ifTrue: [string := string , aSymbolOrNumber asString]. aMorph label: string asNumber asString! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 21:32'! moduleMorph | morph button | morph := AlignmentMorph newRow color: Color transparent. morph hResizing: #spaceFill; vResizing: #shrinkWrap; setNameTo: 'JoyModuleGenerator'. morph addMorphBack: (StringMorph contents: 'module: '). morph addMorphBack: (AlignmentMorph newVariableTransparentSpacer). button := SimpleButtonMorph newWithLabel: 'select'. button target: self; actWhen: #buttonUp; actionSelector: #generateModule. morph addMorphBack: button. button := SimpleButtonMorph newWithLabel: 'code'. button target: self; actWhen: #buttonUp; actionSelector: #generateConcatenation. morph addMorphBack: button. button := SimpleButtonMorph newWithLabel: 'new'. button target: self; actWhen: #buttonUp; actionSelector: #generateNewConcatenation. morph addMorphBack: button. ^ morph! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/9/2007 21:22'! morphForModel: aJoyNode (aJoyNode isKindOf: JoyBoolean) ifTrue: [^ ViJoyBoolean newFrom: aJoyNode]. (aJoyNode isKindOf: JoyDefinition) ifTrue: [^ ViJoyConcatenation newFrom: aJoyNode]. (aJoyNode isKindOf: JoyList) ifTrue: [^ ViJoyQuotation newFrom: aJoyNode]. (aJoyNode isKindOf: JoyModule) ifTrue: [^ ViJoyModule newFrom: aJoyNode]. (aJoyNode isKindOf: JoyChar) ifTrue: [^ ViJoyChar newFrom: aJoyNode]. (aJoyNode isKindOf: JoyNumber) ifTrue: [^ ViJoyNumber newFrom: aJoyNode]. (aJoyNode isKindOf: JoyPrimitive) ifTrue: [^ ViJoyPrimitive newFrom: aJoyNode]. (aJoyNode isKindOf: JoyString) ifTrue: [^ ViJoyString newFrom: aJoyNode]. aJoyNode ifNil: [^ ViJoyQuotation newFrom: nil]. self error: 'invalid node'! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 21:18'! numberMorph | col row button morph | col := AlignmentMorph newColumn color: Color transparent. col hResizing: #shrinkWrap; vResizing: #shrinkWrap; setNameTo: 'JoyConstantGenerator'. row := AlignmentMorph newRow color: Color transparent. row addMorphBack: (StringMorph contents: 'number: '). row addMorphBack: (AlignmentMorph newVariableTransparentSpacer). button := SimpleButtonMorph newWithLabel: '0'. button target: self; actWhen: #buttonUp; actionSelector: #generateNumber:; arguments: (Array with: button). row addMorphBack: button. morph := SimpleButtonMorph newWithLabel: 'C'. morph target: self; actWhen: #buttonUp; actionSelector: #key:to:; arguments: (Array with: #clear with: button). row addMorphBack: morph. col addMorphBack: row. row := AlignmentMorph newRow color: Color lightBlue. self addTenkeyTo: row notify: button. col addMorphBack: row. ^ col! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 21:32'! primitiveMorph | morph button | morph := AlignmentMorph newRow color: Color transparent. morph hResizing: #spaceFill; vResizing: #shrinkWrap; setNameTo: 'JoyPrimitiveGenerator'. morph addMorphBack: (StringMorph contents: 'primitive: '). morph addMorphBack: (AlignmentMorph newVariableTransparentSpacer). button := SimpleButtonMorph newWithLabel: 'select'. button target: self; actWhen: #buttonUp; actionSelector: #generatePrimitive. morph addMorphBack: button. ^ morph! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 19:33'! quoteMorph | row button | row := AlignmentMorph newRow color: Color transparent. row hResizing: #spaceFill; vResizing: #shrinkWrap. row addMorphBack: (StringMorph contents: 'quote: '). row addMorphBack: AlignmentMorph newVariableTransparentSpacer. button := SimpleButtonMorph newWithLabel: 'quote'. button target: self; actWhen: #buttonUp; actionSelector: #generateQuotation. row addMorphBack: button. ^ row! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/8/2007 20:52'! selectModuleName | library names ret | library := JoyLibrary default. names := library names asSortedCollection. ret := PopUpMenu withCaption: 'modules' chooseFrom: names. ret = 0 ifTrue: [^ nil]. ^ names at: ret! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/8/2007 20:53'! selectPrimitiveName | names ret | names := JoyPrimitive names asSortedCollection. ret := PopUpMenu withCaption: 'primitives' chooseFrom: names. ret = 0 ifTrue: [^ nil]. ^ names at: ret! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 21:32'! stringMorph | row button col row2 | col := AlignmentMorph newColumn color: Color transparent. col hResizing: #spaceFill; vResizing: #spaceFill. row2 := AlignmentMorph newRow color: Color transparent. row := AlignmentMorph newRow color: Color transparent. row addMorphBack: (StringMorph contents: 'string: '). row addMorphBack: AlignmentMorph newVariableTransparentSpacer. button := SimpleButtonMorph newWithLabel: 'clr'. button target: self; actWhen: #buttonUp; actionSelector: #clearStrings:; arguments: (Array with: row2). row addMorphBack: button. button := SimpleButtonMorph newWithLabel: 'enter'. button target: self; actWhen: #buttonUp; actionSelector: #enterString:; arguments: (Array with: row2). row addMorphBack: button. col addMorphBack: row. col addMorphBack: row2. ^ col! ! !ViJoyMorph class methodsFor: 'private' stamp: 'e-itoh 10/10/2007 20:25'! titleMorph: aMorph | morph button | morph := AlignmentMorph newRow color: Color yellow darker. morph hResizing: #spaceFill; vResizing: #shrinkWrap. button := SimpleButtonMorph newWithLabel: 'X'. button target: aMorph; actWhen: #buttonUp; actionSelector: #delete. morph addMorphBack: button. morph addMorphBack: AlignmentMorph newVariableTransparentSpacer. morph addMorphBack: (StringMorph contents: 'Joy'). morph addMorphBack: AlignmentMorph newVariableTransparentSpacer. button := SimpleButtonMorph newWithLabel: 'stack'. button target: self; actWhen: #buttonUp; actionSelector: #generateStack. morph addMorphBack: button. ^ morph! ! ViJoyMorph subclass: #ViJoyConcatenation instanceVariableNames: 'nameModified' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyConcatenation methodsFor: 'private' stamp: 'e-itoh 10/8/2007 19:28'! mainMorph | morph | morph := self submorphNamed: 'main'. morph ifNil: [self error: 'invalid concatenation']. ^ morph! ! !ViJoyConcatenation methodsFor: 'private' stamp: 'e-itoh 10/8/2007 13:56'! name ^ model name! ! !ViJoyConcatenation methodsFor: 'private' stamp: 'e-itoh 10/9/2007 22:11'! name: aString | library | model name = aString ifTrue: [^ self]. library := JoyLibrary default. (library includesName: model name) ifTrue: [library removeName: model name]. model name: aString. aString isEmpty ifFalse: [^ library addDefinition: model]. nameModified := true! ! !ViJoyConcatenation methodsFor: 'private' stamp: 'e-itoh 10/8/2007 19:16'! rebuild | row | self removeAllMorphs. self createMenu. model ifNil: [^ self]. model name ifNil: [model name: ((1 to: 8) inject: '' into: [:n :i | n , 'abcdefghijklmnopqrstuvwxyz0123456789' atRandom asString])]. row := AlignmentMorph newRow color: Color transparent. row hResizing: #shrinkWrap; vResizing: #shrinkWrap; cellInset: 6; enableDragNDrop; setNameTo: 'main'. self addMorphsTo: row from: model code. self addMorphBack: row! ! !ViJoyConcatenation methodsFor: 'private' stamp: 'e-itoh 10/8/2007 19:47'! reorganize model code: (self listFromSubmorphs: self mainMorph). self rebuild. self updateLibrary! ! !ViJoyConcatenation methodsFor: 'private' stamp: 'e-itoh 10/8/2007 11:33'! run ViJoyStack default execList: model code! ! !ViJoyConcatenation methodsFor: 'private' stamp: 'e-itoh 10/8/2007 19:45'! updateLibrary | library | library := JoyLibrary default. (library includesName: model name) ifTrue: [library addDefinition: model]! ! !ViJoyConcatenation methodsFor: 'initialization' stamp: 'e-itoh 10/9/2007 22:21'! createMenu | row | row := AlignmentMorph newRow color: Color transparent. row hResizing: #shrinkWrap; vResizing: #shrinkWrap. row addMorphBack: self createCloseBox; addMorphBack: (StringMorph contents: '['); addMorphBack: self createNameBox; addMorphBack: (StringMorph contents: ']'); addMorphBack: self createRunBox. self addMorphBack: row! ! !ViJoyConcatenation methodsFor: 'initialization' stamp: 'e-itoh 10/9/2007 22:20'! createNameBox | morph | morph := UpdatingStringMorph on: self selector: #name. morph contents: ''; putSelector: #name:; useStringFormat; hResizing: #shrinkWrap; vResizing: #shrinkWrap. ^ morph! ! !ViJoyConcatenation methodsFor: 'initialization' stamp: 'e-itoh 10/8/2007 10:54'! createRunBox | morph | morph := SimpleButtonMorph newWithLabel: 'Run'. ^ morph target: self; actWhen: #buttonUp; actionSelector: #run! ! !ViJoyConcatenation methodsFor: 'initialization' stamp: 'e-itoh 10/8/2007 20:41'! defaultColor ^ Color lightCyan muchLighter! ! !ViJoyConcatenation methodsFor: 'initialization' stamp: 'e-itoh 10/9/2007 21:29'! initialize super initialize. self listDirection: #topToBottom; listCentering: #center; hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: 2. nameModified := false! ! !ViJoyConcatenation methodsFor: 'dropping/grabbing' stamp: 'e-itoh 10/8/2007 19:28'! acceptDroppingMorph: aMorph event: anEvent self mainMorph acceptDroppingMorph: aMorph event: anEvent. self reorganize! ! ViJoyMorph subclass: #ViJoyFunction instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyFunction methodsFor: 'private' stamp: 'e-itoh 10/7/2007 20:34'! rebuild | aMorph | self removeAllMorphs. model ifNil: [^ self]. aMorph := UpdatingStringMorph on: self selector: #titleString. aMorph useStringFormat; hResizing: #shrinkWrap; vResizing: #shrinkWrap. self addMorphBack: aMorph! ! !ViJoyFunction methodsFor: 'private' stamp: 'e-itoh 10/7/2007 20:32'! titleString ^ model titleString! ! !ViJoyFunction methodsFor: 'dropping/grabbing' stamp: 'e-itoh 10/7/2007 19:48'! wantsDroppedMorph: aMorph event: anEvent ^ false! ! !ViJoyFunction methodsFor: 'dropping/grabbing' stamp: 'e-itoh 10/7/2007 21:16'! wantsToBeDroppedInto: aMorph ^ (aMorph isKindOf: ViJoyMorph) or: [aMorph isKindOf: PasteUpMorph]! ! ViJoyFunction subclass: #ViJoyBoolean instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyBoolean methodsFor: 'initialization' stamp: 'e-itoh 10/7/2007 20:24'! defaultColor ^ Color yellow! ! ViJoyFunction subclass: #ViJoyChar instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyChar methodsFor: 'initialization' stamp: 'e-itoh 10/9/2007 21:21'! defaultColor ^ Color green ! ! ViJoyFunction subclass: #ViJoyModule instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyModule methodsFor: 'initialization' stamp: 'e-itoh 10/7/2007 20:26'! defaultColor ^ Color lightCyan! ! ViJoyFunction subclass: #ViJoyNumber instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyNumber methodsFor: 'initialization' stamp: 'e-itoh 10/7/2007 20:25'! defaultColor ^ Color lightGreen! ! ViJoyFunction subclass: #ViJoyPrimitive instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyPrimitive methodsFor: 'initialization' stamp: 'e-itoh 10/8/2007 20:31'! defaultColor ^ Color lightMagenta! ! ViJoyMorph subclass: #ViJoyQuotation instanceVariableNames: 'name' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyQuotation methodsFor: 'initialization' stamp: 'e-itoh 10/8/2007 14:20'! defaultBorderColor ^ Color black! ! !ViJoyQuotation methodsFor: 'initialization' stamp: 'e-itoh 10/9/2007 20:42'! defaultBorderWidth ^ 1! ! !ViJoyQuotation methodsFor: 'initialization' stamp: 'e-itoh 10/8/2007 19:08'! defaultColor ^ Color lightGray lighter lighter! ! !ViJoyQuotation methodsFor: 'initialization' stamp: 'e-itoh 10/9/2007 21:30'! initialize super initialize. self listDirection: #leftToRight; listCentering: #center; wrapDirection: #none; wrapCentering: #topLeft; hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 30 @ 30. self cornerStyle: #square; layoutInset: 4! ! !ViJoyQuotation methodsFor: 'dropping/grabbing' stamp: 'e-itoh 10/8/2007 18:36'! acceptDroppingMorph: aMorph event: anEvent super acceptDroppingMorph: aMorph event: anEvent. self reorganize! ! !ViJoyQuotation methodsFor: 'dropping/grabbing' stamp: 'e-itoh 10/9/2007 22:02'! wantsDroppedMorph: aMorph event: anEvent ^ owner isKindOf: PasteUpMorph! ! !ViJoyQuotation methodsFor: 'private' stamp: 'e-itoh 10/8/2007 15:21'! rebuild self removeAllMorphs. model ifNil: [^ self]. self addMorphsTo: self from: model! ! !ViJoyQuotation methodsFor: 'private' stamp: 'e-itoh 10/10/2007 20:47'! reorganize model := self listFromSubmorphs: self. self rebuild! ! ViJoyMorph subclass: #ViJoyStack instanceVariableNames: '' classVariableNames: 'DefaultJoyStack' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyStack methodsFor: 'initialization' stamp: 'e-itoh 10/10/2007 21:32'! createClearBox | morph | morph := SimpleButtonMorph newWithLabel: 'clr'. ^ morph target: self; actWhen: #buttonUp; actionSelector: #stackClear! ! !ViJoyStack methodsFor: 'initialization' stamp: 'e-itoh 10/8/2007 20:44'! createMenu | row | row := AlignmentMorph newRow color: Color transparent. row hResizing: #shrinkWrap; vResizing: #shrinkWrap. row addMorphBack: (StringMorph contents: 'JoyStack'); addMorphBack: self createClearBox; addMorphBack: self createPopBox. self addMorphBack: row! ! !ViJoyStack methodsFor: 'initialization' stamp: 'e-itoh 10/10/2007 21:32'! createPopBox | morph | morph := SimpleButtonMorph newWithLabel: 'pop'. morph target: self; actWhen: #buttonUp; actionSelector: #stackPop. ^ morph! ! !ViJoyStack methodsFor: 'initialization' stamp: 'e-itoh 10/7/2007 21:17'! defaultColor ^ Color lightBrown! ! !ViJoyStack methodsFor: 'initialization' stamp: 'e-itoh 10/9/2007 21:06'! initialize super initialize. self listDirection: #topToBottom; listCentering: #topLeft; wrapDirection: #none; wrapCentering: #center; hResizing: #shrinkWrap; vResizing: #shrinkWrap. model := JoyMachine new. self rebuild. DefaultJoyStack ifNil: [DefaultJoyStack := self]! ! !ViJoyStack methodsFor: 'private' stamp: 'e-itoh 10/7/2007 22:37'! delete super delete. DefaultJoyStack == self ifTrue: [DefaultJoyStack := nil]! ! !ViJoyStack methodsFor: 'private' stamp: 'e-itoh 10/8/2007 19:09'! rebuild self removeAllMorphs. self createMenu. model ifNil: [^ self]. self addMorphsTo: self from: model stack! ! !ViJoyStack methodsFor: 'private' stamp: 'e-itoh 10/10/2007 22:37'! stackClear model stack: JoyList joyNil. self rebuild! ! !ViJoyStack methodsFor: 'private' stamp: 'e-itoh 10/7/2007 22:26'! stackPop model stack ifNil: [^ self]. model popStack. self rebuild! ! !ViJoyStack methodsFor: 'accessing' stamp: 'e-itoh 10/8/2007 11:34'! execList: aJoyList model execList: aJoyList. self rebuild! ! !ViJoyStack methodsFor: 'accessing' stamp: 'e-itoh 10/7/2007 22:35'! setDefault DefaultJoyStack := self! ! !ViJoyStack methodsFor: 'dropping/grabbing' stamp: 'e-itoh 10/8/2007 20:18'! acceptDroppingMorph: aMorph event: anEvent super acceptDroppingMorph: aMorph event: anEvent. model exec: aMorph model. self rebuild! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! ViJoyStack class instanceVariableNames: ''! !ViJoyStack class methodsFor: 'accessing' stamp: 'e-itoh 10/7/2007 22:35'! default ^ DefaultJoyStack! ! !ViJoyStack class methodsFor: 'accessing' stamp: 'e-itoh 10/10/2007 23:57'! reset DefaultJoyStack := nil! ! ViJoyFunction subclass: #ViJoyString instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Joy-GUI'! !ViJoyString methodsFor: 'initialization' stamp: 'e-itoh 10/7/2007 20:27'! defaultColor ^ Color paleGreen! !