Skip to content

Commit

Permalink
update FromScratch.
Browse files Browse the repository at this point in the history
change toolbar buttons to normal buttons of Stage title.
  • Loading branch information
EiichiroIto committed Oct 26, 2020
1 parent 41fc6b9 commit 4012343
Show file tree
Hide file tree
Showing 77 changed files with 348 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ test
testAxisFont
| p |
p := self newPlotter.
self assert: (p axisFont isKindOf: LogicalFont)
self assert: (p axisFont isKindOf: AbstractFont)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An AlgoritStepperMorphTest is a test class for testing the behavior of AlgoritStepperMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
newMorph
^ ScratchStepperMorph new
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test
testDefaultStepTime
self assert: self newMorph defaultStepTime equals: 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test
testStepTime
| s |
s := self newMorph.
self assert: s stepTime equals: s defaultStepTime.
s stepTime: 123.
self assert: s stepTime equals: 123
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "<historical>",
"super" : "TestCase",
"category" : "FromScratch-Tests",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "ScratchStepperMorphTest",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
private
newFont1
^ StrikeFont fontName: 'Verdana' size: 10
^ StrikeFont familyName: 'Verdana' size: 10
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
testing
isStop
^ #(stopThread stopAll return: break continue) includes: selector
^ #(stopThread stopAll return: break continue doReturn) includes: selector
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
accessing
fileVersion: anAppClass from: aStream
"Answer the Scratch file version number from the given string. If the string is of the form: 'ScratchVxx', were xx is a two-digit integer, answer the value of xx. Otherwise, answer 0."

| str |
str := (aStream next: anAppClass appVersionString size) asString.
(str beginsWith: anAppClass appVersionTag)
ifFalse: [ ^ 0 ].
^ (str
copyFrom: anAppClass appVersionTag size + 1
to: str size) asNumberNoError
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
entry points
readObjFrom: aStream
"Read the root object from the given binary stream."

^ self readObjFrom: aStream showProgress: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
entry points
readObjFrom: aStream showProgress: aBoolean
| str |
str := aStream upToEnd asString.
^ STON fromString: str
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
entry points
storeObj: anObject on: aStream
| str |
str := STON toString: anObject.
aStream nextPutAll: str asByteArray
11 changes: 11 additions & 0 deletions filetree/FromScratch.package/STONObjStream.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "Object",
"category" : "FromScratch-Project",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "STONObjStream",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arithmetic ops
bitAnd: x with: y
^ self binaryCommand: #bitAnd arg1: x arg2: y
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arithmetic ops
bitOr: x with: y
^ self binaryCommand: #bitOr arg1: x arg2: y
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arithmetic ops
bitShift: x left: y
^ self binaryCommand: #bitShiftLeft arg1: x arg2: y
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arithmetic ops
bitShift: x right: y
^ self binaryCommand: #bitShiftRight arg1: x arg2: y
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arithmetic ops
bitXor: x with: y
^ self binaryCommand: #bitXor arg1: x arg2: y
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arithmetic ops
bitAnd: x with: y
^ generator
bitAnd: [ x argString: parser ]
with: [ y argString: parser ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arithmetic ops
bitOr: x with: y
^ generator
bitOr: [ x argString: parser ]
with: [ y argString: parser ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arithmetic ops
bitShift: x left: y
^ generator
bitShift: [ x argString: parser ]
left: [ y argString: parser ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arithmetic ops
bitShift: x right: y
^ generator
bitShift: [ x argString: parser ]
right: [ y argString: parser ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arithmetic ops
bitXor: x with: y
^ generator
bitXor: [ x argString: parser ]
with: [ y argString: parser ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
subHatBlockNamed: aString
^ self subBlocks detect: [ :each | each subName = aString ] ifNone: [ nil ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
special ops
doReturn
"Evaluates its argument, and returns the value to the frame from which the current method was called."

| value args |
args := stackFrame arguments.

"Evaluate the argument, if necessary."
args size < stackFrame expression argumentCount
ifTrue: [ ^ self evaluateNextArgument ].

"Remember the return value."
value := args notEmpty
ifTrue: [ args first ]
ifFalse: [ nil ].

"Pop until we're out of frames to pop, or we hit a return marker."
[ stackFrame isNil ] whileFalse: [ self popStackFrame ].
stackFrame
ifNotNil: [ self returnValueToParentFrame: value.
self popStackFrame ]
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
defaultStepTime
^ 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
stepping and presenter
step
block ifNil: [ ^ self ].
block value
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
stepping
stepTime: anInteger
stepTime := anInteger
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
stepping
stepTime
^ stepTime ifNil: [ self defaultStepTime ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
stepping and presenter
wantsSteps
^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
whenStepsDo: aBlock
block := aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"commentStamp" : "",
"super" : "Morph",
"category" : "FromScratch-Morphic",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"block",
"stepTime"
],
"name" : "ScratchStepperMorph",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
private
defaultFont
^ StrikeFont fontName: 'Verdana' size: 10
^ StrikeFont familyName: 'Verdana' size: 10
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
processes
stepProcesses
process ifNil: [ ^ self ].
process step.
process ifNotNil: [ process step ].
updateInfoCount := updateInfoCount + 1.
updateInfoCount > self maxUpdateInfoCount
ifTrue: [ updateInfoCount := 0.
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
specs
defaultSpec
^ SpBoxLayout newHorizontal
add: #buttonMain;
add: #buttonOther;
add: #buttonAdd withConstraints: [ :c | c width: self buttonWidth ];
add: #buttonSelect withConstraints: [ :c | c width: self buttonWidth ];
add: #buttonDelete withConstraints: [ :c | c width: self buttonWidth ];
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
defaultMainButtonName
^ 'main'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
defaultOtherButtonName
^ '(none)'
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
initialization
initializePresenters
buttonMain := self newButton
label: self defaultMainButtonName;
icon: (self iconNamed: #page);
yourself.
buttonOther := self newButton
label: self defaultOtherButtonName;
icon: (self iconNamed: #page);
yourself.
buttonSelect := self newButton
icon: (self iconNamed: #book);
yourself.
buttonAdd := self newButton
icon: (self iconNamed: #add);
yourself.
buttonDelete := self newButton
icon: (self iconNamed: #delete);
yourself.
self focusOrder
add: buttonMain;
add: buttonSelect;
add: buttonAdd;
add: buttonDelete
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
mainLabel
^ buttonMain label asString
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
otherLabel: aString
buttonOther label: aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
otherLabel
^ buttonOther label asString
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
reset
self otherLabel: self defaultOtherButtonName.
self selectButton: self defaultMainButtonName
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
selectButton: aString
buttonMain state: (self mainLabel = aString).
buttonOther state: (self otherLabel = aString)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
whenAddButtonPressed: aBlock
buttonAdd action: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
whenDeleteButtonPressed: aBlock
buttonDelete action: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
whenMainButtonPressed: aBlock
buttonMain action: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
whenOtherButtonPressed: aBlock
buttonOther action: [ aBlock cull: self otherLabel ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
whenSelectButtonPressed: aBlock
buttonSelect action: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"commentStamp" : "",
"super" : "SpPresenter",
"category" : "FromScratch-Spec2",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"buttonMain",
"buttonSelect",
"buttonAdd",
"buttonDelete",
"buttonOther"
],
"name" : "SpScratchLibrary",
"type" : "normal"
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ initialize

stringMorph := StringMorph new
contents: '';
font: (StrikeFont fontName: 'Verdana' size: 12).
font: (StrikeFont familyName: 'Verdana' size: 12).
self addMorph: stringMorph.

self color: Color red.
Expand Down
Loading

0 comments on commit 4012343

Please sign in to comment.