[Pkg] The Trunk: EToys-mt.326.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun May 6 13:18:46 UTC 2018
Marcel Taeumel uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-mt.326.mcz
==================== Summary ====================
Name: EToys-mt.326
Author: mt
Time: 6 May 2018, 3:18:35.522836 pm
UUID: 95d9813d-1659-9b4f-9cc6-d290709bf39a
Ancestors: EToys-tpr.325
Supplement to refactoring in Morphic-mt.1427.
=============== Diff against EToys-tpr.325 ===============
Item was changed:
----- Method: AnonymousSoundMorph>>sound:interimName: (in category 'initialization') -----
sound: aSampledSound interimName: anInterimName
"Establish the sound object and an interim name."
| aStringMorph |
self removeAllMorphs.
self hResizing: #shrinkWrap; vResizing: #shrinkWrap.
+ self borderWidth: 2.
- borderWidth := 2.
self listDirection: #topToBottom.
sound := aSampledSound.
interimName := anInterimName.
aStringMorph := StringMorph contents: interimName font: ScriptingSystem fontForEToyButtons.
self addMorphBack: aStringMorph.
self addButtonRow.
self balloonTextSelector: #soundMorphHelpString.
self setNameTo: interimName!
Item was changed:
----- Method: CalendarMorph>>newButtonWithContents: (in category 'building') -----
newButtonWithContents: aByteString
^SimpleButtonMorph new
label: aByteString;
color: (self color mixed: 0.5 with: Color gray);
+ borderStyle: (BorderStyle raised width: 2)!
- borderColor: #raised;
- borderWidth: 2!
Item was changed:
----- Method: CalendarMorph>>newDateButtonWithContents: (in category 'building') -----
newDateButtonWithContents: aByteString
^SimpleButtonMorph new
label: aByteString;
cornerStyle: #square;
color: self color muchLighter;
+ borderStyle: (BorderStyle raised width: 2);
- borderColor: #raised;
- borderWidth: 2;
width: 30!
Item was changed:
----- Method: ChessMorph>>addButtonRow (in category 'initialize') -----
addButtonRow
| r m |
r := AlignmentMorph newRow hResizing: #shrinkWrap; vResizing: #shrinkWrap; color: Color transparent.
+ r cellInset: 2.
r addMorphBack: (self buttonName: ' New ' translated action: #newGame).
r addMorphBack: (self buttonName: ' Help ' translated action: #findBestMove).
r addMorphBack: (self buttonName: ' Play ' translated action: #thinkAndMove).
r addMorphBack: (self buttonName: ' Auto ' translated action: #autoPlay).
r addMorphBack: (self buttonName: ' Undo ' translated action: #undoMove).
r addMorphBack: (self buttonName: ' Redo ' translated action: #redoMove).
r addMorphBack: (self buttonName: ' Quit ' translated action: #delete).
r disableTableLayout: true.
r align: r bounds topLeft with: self layoutBounds topLeft.
self addMorphFront: r.
m := UpdatingStringMorph on: self selector: #statusString.
m useStringFormat.
m disableTableLayout: true.
m align: m bounds topLeft with: r fullBounds bottomLeft.
self addMorphFront: m.!
Item was changed:
----- Method: ChessMorph>>buttonName:action: (in category 'initialize') -----
buttonName: aString action: aSymbol
^ SimpleButtonMorph new
target: self;
label: aString;
actionSelector: aSymbol;
color: (Color gray: 0.8); "old color"
fillStyle: self buttonFillStyle;
+ borderWidth: 1;
+ borderRaised.
- borderWidth: 0;
- borderColor: #raised.
!
Item was changed:
----- Method: ChessMorph>>defaultBorderColor (in category 'initialization') -----
defaultBorderColor
+ ^ Color transparent!
- "answer the default border color/fill style for the receiver"
- ^ #raised!
Item was added:
+ ----- Method: ChessMorph>>defaultBorderStyle (in category 'initialization') -----
+ defaultBorderStyle
+ ^ BorderStyle raised!
Item was changed:
----- Method: ChessMorph>>initialize (in category 'initialization') -----
initialize
"initialize the state of the receiver"
super initialize.
""
animateMove := false.
autoPlay := false.
+ self cornerStyle: #square.
- self cornerStyle: #rounded.
self layoutPolicy: TableLayout new.
self listDirection: #leftToRight;
wrapDirection: #bottomToTop.
self addSquares.
self addButtonRow.
self newGame!
Item was changed:
----- Method: CommandTilesMorph>>initialize (in category 'initialization') -----
initialize
super initialize.
self wrapCentering: #center; cellPositioning: #leftCenter.
self hResizing: #shrinkWrap.
+ self borderWidth: 0.
- borderWidth := 0.
self layoutInset: 0.
self extent: 5 at 5. "will grow to fit"
!
Item was changed:
----- Method: EToyProjectHistoryMorph>>defaultBorderColor (in category 'initialization') -----
defaultBorderColor
+ ^ Color transparent!
- "answer the default border color/fill style for the receiver"
- ^ #raised!
Item was added:
+ ----- Method: EToyProjectHistoryMorph>>defaultBorderStyle (in category 'initialization') -----
+ defaultBorderStyle
+ ^ BorderStyle raised!
Item was changed:
----- Method: EToyProjectHistoryMorph>>rebuild (in category 'as yet unclassified') -----
rebuild
| history r1 |
history := ProjectHistory currentHistory mostRecentCopy.
changeCounter := ProjectHistory changeCounter.
self removeAllMorphs.
self rubberBandCells: false. "enable growing"
r1 := self addARow: {
self inAColumn: {
StringMorph new contents: 'Jump...' translated; lock.
}.
}.
r1 on: #mouseUp send: #jumpToProject to: self.
history do: [ :each |
(
self addARow: {
(self inAColumn: {
StretchyImageMorph new form: each second; minWidth: 35; minHeight: 35; lock
}) vResizing: #spaceFill.
self inAColumn: {
StringMorph new contents: each first; lock.
"StringMorph new contents: each fourth first; lock."
}.
(self inAColumn: {
StringMorph new
color: Color red;
contents: 'X';
on: #mouseDown send: #confirmedDelete:evt:from: to: self withValue: each fourth first
}) hResizing: #rigid.
}
)
color: Color paleYellow;
+ borderStyle: (BorderStyle raised width: 1);
- borderWidth: 1;
- borderColor: #raised;
vResizing: #spaceFill;
on: #mouseUp send: #mouseUp:in: to: self;
on: #mouseDown send: #mouseDown:in: to: self;
on: #mouseMove send: #mouseMove:in: to: self;
on: #mouseLeave send: #mouseLeave:in: to: self;
setProperty: #projectParametersTuple toValue: each;
setBalloonText: (each third isEmptyOrNil ifTrue: ['not saved'] ifFalse: [each third])
].
"---
newTuple := {
aProject name.
aProject thumbnail.
aProject url.
WeakArray with: aProject.
}.
---"!
Item was changed:
----- Method: FishEyeMorph>>extent: (in category 'geometry') -----
extent: aPoint
"Round to a number divisible by grid. Note that the superclass has its own implementation."
| g gridSize |
gridSize := self gridSizeFor: aPoint.
"self halt."
+ g := (aPoint - (2 * self borderWidth)) // gridSize.
- g := (aPoint - (2 * borderWidth)) // gridSize.
srcExtent := g * gridSize.
gridNum := g.
^super extent: self defaultExtent!
Item was changed:
----- Method: FreeCell>>buildButton:target:label:selector: (in category 'private') -----
buildButton: aButton target: aTarget label: aLabel selector: aSelector
"wrap a button or switch in an alignmentMorph to provide some space around the button"
| a |
aButton
target: aTarget;
label: aLabel;
actionSelector: aSelector;
+ borderStyle: (BorderStyle raised width: 2);
- borderColor: #raised;
- borderWidth: 2;
color: Color gray.
a := AlignmentMorph newColumn
wrapCentering: #center; cellPositioning: #topCenter;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
color: Color transparent;
layoutInset: 1.
a addMorph: aButton.
^ a
!
Item was changed:
----- Method: FreeCell>>makeControlBar (in category 'initialization') -----
makeControlBar
^AlignmentMorph newRow
color: self colorNearBottom;
+ borderStyle: (BorderStyle inset width: 2);
- borderColor: #inset;
- borderWidth: 2;
layoutInset: 0;
hResizing: #spaceFill; vResizing: #shrinkWrap; wrapCentering: #center; cellPositioning: #leftCenter;
yourself.!
Item was changed:
----- Method: FreeCellStatistics>>buildButton:target:label:selector: (in category 'user interface') -----
buildButton: aButton target: aTarget label: aLabel selector: aSelector
"wrap a button or switch in an alignmentMorph to provide some space around the button"
| a |
aButton
target: aTarget;
label: aLabel;
actionSelector: aSelector;
+ borderStyle: (BorderStyle raised width: 2);
- borderColor: #raised;
- borderWidth: 2;
color: Color gray.
a := AlignmentMorph newColumn
wrapCentering: #center; cellPositioning: #topCenter;
hResizing: #spaceFill;
vResizing: #shrinkWrap;
color: Color transparent;
layoutInset: 1.
a addMorph: aButton.
^ a
!
Item was changed:
----- Method: FreeCellStatistics>>makeControls (in category 'user interface') -----
makeControls
| row |
row := AlignmentMorph newRow.
row
wrapCentering: #center; cellPositioning: #leftCenter;
hResizing: #spaceFill;
vResizing: #shrinkWrap;
color: self color;
+ borderStyle: (BorderStyle inset width: 2);
- borderWidth: 2;
- borderColor: #inset;
addMorphBack: self makeOkButton;
addMorphBack: self makeResetButton.
^row.!
Item was changed:
----- Method: FreeCellStatistics>>makeStatistics (in category 'user interface') -----
makeStatistics
| row |
row := AlignmentMorph newRow.
row
wrapCentering: #center; cellPositioning: #leftCenter;
hResizing: #spaceFill;
vResizing: #spaceFill;
color: self color;
+ borderStyle: (BorderStyle inset width: 2);
- borderWidth: 2;
- borderColor: #inset;
addMorphBack: (AlignmentMorph newColumn
wrapCentering: #center; cellPositioning: #topCenter;
color: self color;
addMorph: (statsMorph := TextMorph new contents: self statsText)).
^row.!
Item was changed:
----- Method: HTTPProxyEditor>>updateWidgets (in category 'initialization') -----
updateWidgets
"update the receiver's widgets"
acceptWidget isNil
ifFalse: [""
acceptWidget color: Color lightGreen;
+ borderStyle: (BorderStyle raised width: 2)].
- borderWidth: 2;
- borderColor: #raised].
cancelWidget isNil
ifFalse: [""
cancelWidget color: Color lightRed;
+ borderStyle: (BorderStyle raised width: 2)].
- borderWidth: 2;
- borderColor: #raised].
""
serverNameLabelWidget isNil
ifFalse: [""
serverNameLabelWidget color: self paneColor lighter;
+ borderStyle: (BorderStyle raised width: serverNameLabelWidget borderWidth)].
- borderColor: #raised].
portLabelWidget isNil
ifFalse: [""
portLabelWidget color: self paneColor lighter;
+ borderStyle: (BorderStyle raised width: portLabelWidget borderWidth)]!
- borderColor: #raised]!
Item was changed:
----- Method: IconicButtonWithLabel>>labelGraphic:color:andLabel: (in category 'as yet unclassified') -----
labelGraphic: aForm color: nonTranslucent andLabel: aStringMorph
| graphicalMorph labeledItem actualForm |
labeledItem := AlignmentMorph newColumn.
labeledItem hResizing: #shrinkWrap.
labeledItem vResizing: #shrinkWrap.
labeledItem color: nonTranslucent.
labeledItem borderWidth: 0.
labeledItem
layoutInset: 4 at 0;
cellPositioning: #center.
self removeAllMorphs.
actualForm := (Form extent: aForm extent depth: 32) fillColor: nonTranslucent.
aForm displayOn: actualForm at: 0 at 0 rule: 34.
graphicalMorph := SketchMorph withForm: actualForm.
labeledItem addMorph: graphicalMorph.
labeledItem addMorphBack: (Morph new extent: (4 at 4)) beTransparent.
aStringMorph ifNotNil: [
labeledItem addMorphBack: aStringMorph
].
self addMorph: labeledItem.
+ self extent: submorphs first fullBounds extent + (self borderWidth + 6).
- self extent: submorphs first fullBounds extent + (borderWidth + 6).
labeledItem lock.
!
Item was changed:
----- Method: IconicButtonWithLabel>>labelString: (in category 'as yet unclassified') -----
labelString: aString
labelMorph ifNotNil: [
labelMorph contents: aString.
+ self extent: self firstSubmorph fullBounds extent + (self borderWidth + 6).
- self extent: submorphs first fullBounds extent + (borderWidth + 6).
].
!
Item was changed:
----- Method: MidiInputMorph>>addChannelControlsFor: (in category 'as yet unclassified') -----
addChannelControlsFor: channelIndex
| r divider col |
r := self makeRow
hResizing: #shrinkWrap;
vResizing: #shrinkWrap.
r addMorphBack: (self channelNumAndMuteButtonFor: channelIndex).
r addMorphBack: (Morph new extent: 10 at 5; color: color). "spacer"
r addMorphBack: (self panAndVolControlsFor: channelIndex).
divider := AlignmentMorph new
extent: 10 at 1;
- borderWidth: 1;
layoutInset: 0;
+ borderStyle: (BorderStyle raised width: 1);
- borderColor: #raised;
color: color;
hResizing: #spaceFill;
vResizing: #rigid.
col := self lastSubmorph.
col addMorphBack: divider.
col addMorphBack: r.
!
Item was changed:
----- Method: MidiInputMorph>>makeControls (in category 'as yet unclassified') -----
makeControls
| bb r reverbSwitch onOffSwitch |
bb := SimpleButtonMorph new
target: self;
+ borderStyle: (BorderStyle raised width: 2);
- borderColor: #raised;
- borderWidth: 2;
color: color.
r := AlignmentMorph newRow.
r color: bb color; borderWidth: 0; layoutInset: 0.
r hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 5 at 5.
r addMorphBack: (
bb label: '<>';
actWhen: #buttonDown;
actionSelector: #invokeMenu).
onOffSwitch := SimpleSwitchMorph new
offColor: color;
onColor: (Color r: 1.0 g: 0.6 b: 0.6);
borderWidth: 2;
label: 'On';
actionSelector: #toggleOnOff;
target: self;
setSwitchState: false.
r addMorphBack: onOffSwitch.
reverbSwitch := SimpleSwitchMorph new
offColor: color;
onColor: (Color r: 1.0 g: 0.6 b: 0.6);
borderWidth: 2;
label: 'Reverb Disable';
actionSelector: #disableReverb:;
target: self;
setSwitchState: SoundPlayer isReverbOn not.
r addMorphBack: reverbSwitch.
^ r
!
Item was changed:
----- Method: Mines>>buildButton:target:label:selector: (in category 'initialize') -----
buildButton: aButton target: aTarget label: aLabel selector: aSelector
"wrap a button or switch in an alignmentMorph to allow a row of buttons to fill space"
| a |
aButton
target: aTarget;
label: aLabel;
actionSelector: aSelector;
+ borderStyle: (BorderStyle raised width: 2);
- borderColor: #raised;
- borderWidth: 2;
color: color.
a := AlignmentMorph newColumn
wrapCentering: #center; cellPositioning: #topCenter;
hResizing: #spaceFill;
vResizing: #shrinkWrap;
color: color.
a addMorph: aButton.
^ a
!
Item was changed:
----- Method: Mines>>defaultBorderColor (in category 'initialization') -----
defaultBorderColor
+ ^ Color transparent!
- "answer the default border color/fill style for the receiver"
- ^ #raised!
Item was added:
+ ----- Method: Mines>>defaultBorderStyle (in category 'initialization') -----
+ defaultBorderStyle
+ ^ BorderStyle raised!
Item was changed:
----- Method: Mines>>makeControls (in category 'initialize') -----
makeControls
| row |
row := AlignmentMorph newRow color: color;
borderWidth: 2;
layoutInset: 3.
+ row borderStyle: BorderStyle inset.
- row borderColor: #inset.
row hResizing: #spaceFill;
vResizing: #shrinkWrap;
wrapCentering: #center;
cellPositioning: #leftCenter;
extent: 5 @ 5.
row
addMorph: (self
buildButton: SimpleSwitchMorph new
target: self
label: ' Help ' translated
selector: #help:).
row
addMorph: (self
buildButton: SimpleButtonMorph new
target: self
label: ' Quit ' translated
selector: #delete).
"row
addMorph: (self
buildButton: SimpleButtonMorph new
target: self
label: ' Hint ' translated
selector: #hint)."
row
addMorph: (self
buildButton: SimpleButtonMorph new
target: self
label: ' New game ' translated
selector: #newGame).
minesDisplay := LedMorph new digits: 2;
extent: 2 * 10 @ 15.
row
addMorph: (self wrapPanel: minesDisplay label: 'Mines:' translated).
timeDisplay := LedTimerMorph new digits: 3;
extent: 3 * 10 @ 15.
row
addMorph: (self wrapPanel: timeDisplay label: 'Time:' translated).
^ row!
Item was changed:
----- Method: MinesBoard>>defaultBorderColor (in category 'initialization') -----
defaultBorderColor
+ ^ Color transparent!
- "answer the default border color/fill style for the receiver"
- ^ #inset!
Item was added:
+ ----- Method: MinesBoard>>defaultBorderStyle (in category 'initialization') -----
+ defaultBorderStyle
+ ^ BorderStyle inset!
Item was changed:
----- Method: MinesTile>>drawOn: (in category 'drawing') -----
drawOn: aCanvas
"Draw a rectangle with a solid, inset, or raised border.
Note: the raised border color *and* the inset border color are generated
from the receiver's own color, instead of having the inset border color
generated from the owner's color, as in BorderedMorph."
| font rct |
+ super drawOn: aCanvas.
+
+ self borderStyle style == #inset ifTrue: [
-
- borderWidth = 0 ifTrue: [ "no border"
- aCanvas fillRectangle: bounds color: color.
- ^ self.].
-
- borderColor == #raised ifTrue: [
- ^ aCanvas frameAndFillRectangle: bounds
- fillColor: color
- borderWidth: borderWidth
- topLeftColor: color lighter lighter
- bottomRightColor: color darker darker darker].
-
- borderColor == #inset ifTrue: [
- aCanvas frameAndFillRectangle: bounds
- fillColor: color
- borderWidth: 1 " borderWidth"
- topLeftColor: (color darker darker darker)
- bottomRightColor: color lighter.
self isMine ifTrue: [
font := StrikeFont familyName: 'Atlanta' size: 22 emphasized: 1.
+ rct := self bounds insetBy: ((self bounds width) - (font widthOfString: '*'))/2 at 0.
- rct := bounds insetBy: ((bounds width) - (font widthOfString: '*'))/2 at 0.
rct := rct top: rct top + 1.
aCanvas drawString: '*' in: (rct translateBy: 1 at 1) font: font color: Color black.
^ aCanvas drawString: '*' in: rct font: font color: Color red .].
self nearMines > 0 ifTrue: [
font := StrikeFont familyName: 'ComicBold' size: 22 emphasized: 1.
+ rct := self bounds insetBy: ((self bounds width) - (font widthOfString: nearMines asString))/2 at 0.
- rct := bounds insetBy: ((bounds width) - (font widthOfString: nearMines asString))/2 at 0.
rct := rct top: rct top + 1.
aCanvas drawString: nearMines asString in: (rct translateBy: 1 at 1) font: font color: Color black.
+ ^ aCanvas drawString: nearMines asString in: rct font: font color: ((palette at: nearMines) ) .]].!
- ^ aCanvas drawString: nearMines asString in: rct font: font color: ((palette at: nearMines) ) .].
- ^self. ].
-
- "solid color border"
- aCanvas frameAndFillRectangle: bounds
- fillColor: color
- borderWidth: borderWidth
- borderColor: borderColor.!
Item was changed:
----- Method: MinesTile>>switchState: (in category 'accessing') -----
switchState: aBoolean
switchState := aBoolean.
disabled ifFalse:
[switchState
ifTrue:[
"flag ifTrue: [self setFlag]." "if this is a flagged tile, unflag it."
+ self borderStyle: (BorderStyle inset width: 1).
- self borderColor: #inset.
self color: onColor]
ifFalse:[
+ self borderStyle: (BorderStyle raised width: 3).
- self borderColor: #raised.
self color: offColor]]!
Item was changed:
----- Method: NewVariableDialogMorph>>buildDecimalPlacesButton (in category 'build') -----
buildDecimalPlacesButton
| button |
button := SimpleButtonMorph new
labelString: self decimalPlaces asString font: Preferences standardEToysButtonFont;
color: (Color r: 0.806 g: 1.0 b: 0.645);
target: self;
actionSelector: #chooseDecimalPlaces;
extent: 200 @ (TextStyle defaultFont height + 10);
cornerStyle: #square;
+ borderStyle: BorderStyle raised;
- borderColor: #raised;
yourself.
self addArrowsOn: button.
^ button
!
Item was changed:
----- Method: NewVariableDialogMorph>>buildVarTypeButton (in category 'build') -----
buildVarTypeButton
| button |
button := SimpleButtonMorph new
labelString: self varType translated font: Preferences standardEToysButtonFont;
color: (Color r: 0.806 g: 1.0 b: 0.645);
target: self;
actionSelector: #chooseType;
extent: 200 @ (TextStyle defaultFont height + 10);
cornerStyle: #square;
+ borderStyle: BorderStyle raised;
- borderColor: #raised;
yourself.
self addArrowsOn: button.
^ button
!
Item was changed:
----- Method: PDAClockMorph>>drawOn: (in category 'drawing') -----
drawOn: aCanvas
+ aCanvas frameAndFillRectangle: self bounds fillColor: backgroundColor
+ borderWidth: self borderWidth borderColor: self borderColor.
- aCanvas frameAndFillRectangle: bounds fillColor: backgroundColor
- borderWidth: 1 borderColor: borderColor.
super drawOn: aCanvas.
!
Item was changed:
----- Method: PlayingCardDeck>>initialize (in category 'initialization') -----
initialize
super initialize.
self cellPositioning: #topLeft.
self reverseTableCells: true.
self layout: #grid.
self hResizing: #shrinkWrap.
self vResizing: #shrinkWrap.
+ self borderWidth: 0.
- borderWidth := 0.
self layoutInset: 0.
stackingPolicy := #stagger.
stackingOrder := #ascending.
emptyDropPolicy := #any.
self newSeed.
^self!
Item was changed:
----- Method: RecordingControls>>initialize (in category 'initialization') -----
initialize
"Initialize the receiver."
| r full |
super initialize.
self hResizing: #shrinkWrap; vResizing: #shrinkWrap.
+ self borderWidth: 2.
- borderWidth := 2.
self listDirection: #topToBottom.
recorder := SoundRecorder new.
recordingSaved := false.
full := self addButtonRows.
self changeCodec: OggSpeexCodec name: 'Speex'.
"self addRecordLevelSliderIn: full." "Doesn't work in most or maybe even all platforms..."
r := AlignmentMorph newRow vResizing: #shrinkWrap.
r addMorphBack: (self makeRecordMeterIn: full).
self addMorphBack: r.
self extent: 10 at 10. "make minimum size"
self setButtonEnablement
!
Item was changed:
----- Method: RulerMorph>>drawOn: (in category 'drawing') -----
drawOn: aCanvas
| s |
super drawOn: aCanvas.
s := self width printString, 'x', self height printString.
+ aCanvas drawString: s in: (self bounds insetBy: self borderWidth + 5) font: nil color: Color red.
- aCanvas drawString: s in: (bounds insetBy: borderWidth + 5) font: nil color: Color red.
!
Item was changed:
----- Method: SameGame>>buildButton:target:label:selector: (in category 'initialization') -----
buildButton: aButton target: aTarget label: aLabel selector: aSelector
"wrap a button or switch in an alignmentMorph to allow a row of buttons to fill space"
| a |
aButton
target: aTarget;
label: aLabel;
actionSelector: aSelector;
+ borderStyle: (BorderStyle raised width: 2);
- borderColor: #raised;
- borderWidth: 2;
color: color.
a := AlignmentMorph newColumn
wrapCentering: #center; cellPositioning: #topCenter;
hResizing: #spaceFill;
vResizing: #shrinkWrap;
color: color.
a addMorph: aButton.
^ a
!
Item was changed:
----- Method: SameGameTile>>setSwitchState: (in category 'accessing') -----
setSwitchState: aBoolean
switchState := aBoolean.
disabled ifFalse:
[switchState
ifTrue:
+ [self borderInset.
- [self borderColor: #inset.
self color: onColor]
ifFalse:
+ [self borderRaised.
- [self borderColor: #raised.
self color: offColor]]!
Item was changed:
----- Method: ScriptEditorMorph>>extent: (in category 'other') -----
extent: x
| newExtent tw menu |
newExtent := x max: self minWidth @ self minHeight.
(tw := self findA: TwoWayScrollPane) ifNil:
["This was the old behavior"
^ super extent: newExtent].
(self hasProperty: #autoFitContents) ifTrue: [
menu := MenuMorph new defaultTarget: self.
menu addUpdating: #autoFitString target: self action: #autoFitOnOff.
menu addTitle: 'To resize the script, uncheck the box below' translated.
menu popUpEvent: nil in: self world .
^ self].
"Allow the user to resize to any size"
tw extent: ((newExtent x max: self firstSubmorph width)
+ @ (newExtent y - self firstSubmorph height)) - (self borderWidth * 2) + (-4 @ -4). "inset?"
- @ (newExtent y - self firstSubmorph height)) - (borderWidth * 2) + (-4 @ -4). "inset?"
^ super extent: newExtent!
Item was changed:
----- Method: ScriptableButton>>label: (in category 'accessing') -----
label: aString
"Set the receiver's label as indicated"
| aLabel |
(aLabel := self findA: StringMorph)
ifNotNil:
[aLabel contents: aString]
ifNil:
[aLabel := StringMorph contents: aString font: Preferences standardEToysButtonFont.
self addMorph: aLabel].
+ self extent: aLabel extent + (self borderWidth + 6).
- self extent: aLabel extent + (borderWidth + 6).
aLabel position: self center - (aLabel extent // 2).
aLabel lock!
Item was changed:
----- Method: StackMorph>>formatList: (in category 'menu') -----
formatList: pl
| rr ff |
"Turn this plugglable list into a good looking morph."
pl color: Color transparent; borderWidth: 0.
pl font: ((TextStyle named: #Palatino) fontOfSize: 14).
pl toggleCornerRounding; width: 252; retractableOrNot; hResizing: #spaceFill.
rr := (RectangleMorph new) toggleCornerRounding; extent: pl extent + (30 at 30).
rr color: self currentPage color; fillStyle: (ff := self currentPage fillStyle copy).
ff isGradientFill ifTrue: [
rr fillStyle direction: (ff direction * self currentPage extent / rr extent) rounded.
rr fillStyle origin: rr bounds origin].
rr addMorph: pl.
rr layoutPolicy: TableLayout new.
rr layoutInset: 10 at 15; cellInset: 10 at 15; wrapDirection: #leftToRight.
+ rr listCentering: #center; borderStyle: (BorderStyle raised width: 5).
- rr listCentering: #center; borderWidth: 5; borderColor: #raised.
"Up and down buttons on left with arrows in a holder."
"lb := (RectangleMorph new) color: transparent; borderWidth: 0."
^ rr!
Item was changed:
----- Method: StandardViewer>>addHeaderMorphWithBarHeight:includeDismissButton: (in category 'initialization') -----
addHeaderMorphWithBarHeight: anInteger includeDismissButton: aBoolean
"Add the header morph to the receiver, using anInteger as a guide for its height, and if aBoolean is true, include a dismiss buton for it"
| header aButton aTextMorph nail wrpr costs headWrapper |
header := AlignmentMorph newRow color: Color transparent; wrapCentering: #center; cellPositioning: #leftCenter.
aBoolean ifTrue:
[aButton := self tanOButton.
header addMorph: aButton.
aButton actionSelector: #dismiss;
setBalloonText: 'remove this entire Viewer from the screen
don''t worry -- nothing will be lost!!.' translated.
header addTransparentSpacerOfSize: 3].
costs := scriptedPlayer costumes.
costs ifNotNil:
[(costs size > 1 or: [costs size = 1 and: [costs first ~~ scriptedPlayer costume]]) ifTrue:
[header addUpDownArrowsFor: self.
"addArrowsOn: adds the box with two arrow at the front."
(wrpr := header submorphs first) submorphs second setBalloonText: 'switch to previous costume' translated.
wrpr submorphs first setBalloonText: 'switch to next costume' translated].
header addTransparentSpacerOfSize: 3].
self viewsMorph ifTrue: [scriptedPlayer costume assureExternalName].
aTextMorph := UpdatingStringMorph new
useStringFormat;
target: scriptedPlayer;
getSelector: #nameForViewer;
setNameTo: 'name';
font: ScriptingSystem fontForNameEditingInScriptor.
self viewsMorph ifTrue:
[aTextMorph putSelector: #setName:.
aTextMorph setProperty: #okToTextEdit toValue: true].
aTextMorph step.
header addMorphBack: aTextMorph.
aTextMorph setBalloonText: 'Click here to edit the player''s name.' translated.
header addMorphBack: ((self transparentSpacerOfSize: 0) hResizing: #spaceFill; color: Color red).
aButton := ThreePhaseButtonMorph
labelSymbol: #AddInstanceVariable
target: scriptedPlayer
actionSelector: #addInstanceVariable
arguments: #().
aButton setBalloonText: 'click here to add a variable
to this object.' translated.
header addMorphBack: aButton.
header addTransparentSpacerOfSize: 3.
nail := (self hasProperty: #noInteriorThumbnail)
ifFalse:
[ThumbnailMorph new objectToView: scriptedPlayer viewSelector: #costume]
ifTrue:
[ImageMorph new image: (ScriptingSystem formAtKey: #MenuIcon)].
nail on: #mouseDown send: #offerViewerMenuForEvt:morph: to: scriptedPlayer.
header addMorphBack: nail.
nail setBalloonText: 'click here to get a menu
that will allow you to
locate this object,
tear off a tile, etc..' translated.
(self hasProperty: #noInteriorThumbnail)
ifFalse:
+ [nail borderStyle: (BorderStyle raised width: 3)].
- [nail borderWidth: 3; borderColor: #raised].
header addTransparentSpacerOfSize: 3.
aButton := ThreePhaseButtonMorph labelSymbol: #AddCategoryViewer.
aButton
actWhen: #buttonUp;
target: self;
actionSelector: #addCategoryViewer;
setBalloonText: 'click here to add
another category pane' translated.
header addMorphBack: aButton.
header beSticky.
anInteger > 0
ifTrue:
[headWrapper := AlignmentMorph newColumn color: self color.
headWrapper addTransparentSpacerOfSize: (0 @ anInteger).
headWrapper addMorphBack: header.
self addMorph: headWrapper]
ifFalse:
[self addMorph: header]!
Item was changed:
----- Method: SyntaxMorph>>borderColor: (in category 'accessing') -----
borderColor: colorOrSymbolOrNil
+ self borderColor = colorOrSymbolOrNil ifFalse: [
+ super borderColor: colorOrSymbolOrNil.
- borderColor = colorOrSymbolOrNil ifFalse: [
- borderColor := colorOrSymbolOrNil.
self bounds area < 40000
ifTrue: [self invalidRect: self bounds]
ifFalse: [(self bounds areasOutside: (self bounds insetBy: self borderWidth))
do: [:r | self invalidRect: r]]].
!
Item was changed:
----- Method: SyntaxMorph>>select (in category 'selection') -----
select
self deselect.
"Outer block is not colored and has no popup"
(owner isSyntaxMorph and: [owner nodeClassIs: MethodNode])
ifTrue: [self setDeselectedColor "normal"]
ifFalse: [self color: Color lightBrown].
+ self borderStyle: (BorderStyle raised width: self borderWidth).
- self borderColor: #raised.
self offerPopUp.!
Item was changed:
----- Method: SyntaxMorph>>trackDropZones (in category 'insertion drop zones') -----
trackDropZones
| hand i localPt insertion insHt ii prevBot nxtHt d c1 c2 ht2 spacer1 spacer2 wid ht1 dc each |
hand := self primaryHand.
("hand lastEvent redButtonPressed &" hand hasSubmorphs
and: [(self hasOwner: hand) not]) ifFalse: [^ self].
insertion := hand firstSubmorph renderedMorph.
insertion isSyntaxMorph ifFalse: [^ self].
insertion isNoun ifFalse: [(insertion nodeClassIs: CommentNode) ifFalse: [^ self]].
localPt := self globalPointToLocal: hand position.
insHt := insertion height. "**just use standard line height here"
self removeDropZones. "Maybe first check if in right place, then just tweak heights."
i := (ii := self indexOfMorphAbove: localPt) min: submorphs size-1.
prevBot := i <= 0 ifTrue: [(self innerBounds) top]
ifFalse: [(self submorphs at: i) bottom].
nxtHt := (submorphs isEmpty
ifTrue: [insertion]
ifFalse: [self submorphs at: i+1]) height.
d := ii > i ifTrue: [nxtHt "for consistent behavior at bottom"]
ifFalse: [0 max: (localPt y - prevBot min: nxtHt)].
"Top and bottom spacer heights cause continuous motion..."
c1 := Color transparent. c2 := Color transparent.
ht2 := d*insHt//nxtHt. ht1 := insHt - ht2.
+ wid := self width - (2*self borderWidth) - (2*self layoutInset).
- wid := self width - (2*borderWidth) - (2*self layoutInset).
wid isPoint ifTrue: [wid := wid x].
(spacer1 := BorderedMorph newBounds: (0 at 0 extent: wid at ht1)
color: (ht1 > (insHt//2) ifTrue: [c1] ifFalse: [c2]))
borderWidth: 1; borderColor: spacer1 color.
self privateAddMorph: spacer1 atIndex: (i+1 max: 1).
(spacer2 := BorderedMorph newBounds: (0 at 0 extent: wid at ht2)
color: (ht2 > (insHt//2+1) ifTrue: [c1] ifFalse: [c2]))
borderWidth: 1; borderColor: spacer2 color.
spacer1 setProperty: #dropZone toValue: true.
spacer2 setProperty: #dropZone toValue: true.
self privateAddMorph: spacer2 atIndex: (i+3 min: submorphs size+1).
self fullBounds. "Force layout prior to testing for cursor containment"
"Maintain the drop target highlight -- highlight spacer if hand is in it."
{spacer1. spacer2} do:
[:spacer | (spacer containsPoint: localPt) ifTrue:
[spacer color: self dropColor.
"Ignore border color. Maybe do it later.
self borderColor = self dropColor
ifTrue: [self borderColor: self stdBorderColor]"]].
"If no submorph (incl spacers) highlighted, then re-highlight the block."
"Ignore border color. Maybe do it later.
((self wantsDroppedMorph: insertion event: hand lastEvent) and:
[(self submorphs anySatisfy: [:m | m containsPoint: localPt]) not])
ifTrue: [self borderColor: self dropColor].
"
"Dragging a tile within a Block, if beside a tile, color it a dropzone"
"Transcript show: localPt y printString; space; show: submorphs first top
printString; space; show: submorphs last top printString; cr."
dc := self dropColor.
1 to: ((ii+4 min: submorphs size) max: 1) do: [:ind |
each := submorphs at: ind.
each isSyntaxMorph ifTrue: [
localPt y >= each top
ifTrue: ["in this one or beyond"
(localPt y < each bottom)
ifTrue: [(each submorphs anySatisfy: [:m |
m containsPoint: localPt])
ifTrue: [each setDeselectedColor]
ifFalse: [each color: dc]]
ifFalse: [each color = dc ifTrue: [each setDeselectedColor]]]
ifFalse: [each color = dc ifTrue: [each setDeselectedColor]]]].
!
Item was changed:
----- Method: SyntaxMorph>>unhighlight (in category 'highlighting') -----
unhighlight
+ self setDeselectedColor.!
- self setDeselectedColor.
-
-
- false ifTrue: [
- self currentSelectionDo: [:innerMorph :mouseDownLoc :outerMorph |
- self color: ( false
- "(self == outerMorph or: [owner notNil and: [owner isSyntaxMorph not]])"
- ifTrue: [self valueOfProperty: #deselectedBorderColor ifAbsent: [#raised]]
- ifFalse: [self color: Color transparent]
- )
- ]].
- !
Item was changed:
----- Method: SyntaxMorph>>unhighlightBorder (in category 'highlighting') -----
unhighlightBorder
self currentSelectionDo: [:innerMorph :mouseDownLoc :outerMorph |
self borderColor: (
(self == outerMorph or: [owner notNil and: [owner isSyntaxMorph not]])
+ ifFalse: [self borderColor: self stdBorderColor]
+ ifTrue: [
+ (self hasProperty: #deselectedBorderColor)
+ ifTrue: [self borderColor: (self valueOfProperty: #deselectedBorderColor)]
+ ifFalse: [self borderStyle: (BorderStyle raised width: self borderWidth)]] )].!
- ifTrue: [self valueOfProperty: #deselectedBorderColor ifAbsent: [#raised]]
- ifFalse: [self stdBorderColor]
- )
- ]
- !
Item was changed:
----- Method: Tetris>>buildButtonTarget:label:selector:help: (in category 'initialization') -----
buildButtonTarget: aTarget label: aLabel selector: aSelector help: aString
^self rowForButtons
addMorph: (
SimpleButtonMorph new
target: aTarget;
label: aLabel;
actionSelector: aSelector;
+ borderStyle: (BorderStyle raised width: 2);
- borderColor: #raised;
- borderWidth: 2;
color: color
)
!
Item was changed:
----- Method: TileMorph>>typeColor: (in category 'misc') -----
typeColor: aColor
"Set the receiver's typeColor"
+ self borderColor: ScriptingSystem standardTileBorderColor.
+
- borderColor := ScriptingSystem standardTileBorderColor.
typeColor := aColor.
color := ScriptingSystem uniformTileInteriorColor !
Item was changed:
----- Method: WatchMorph>>drawOn: (in category 'drawing') -----
drawOn: aCanvas
"Draw the watch on the given canvas"
| pHour pMin pSec time centerColor |
time := Time now.
pHour := self radius: 0.6 hourAngle: time hours + (time minutes/60.0).
pMin := self radius: 0.72 hourAngle: (time minutes / 5.0).
pSec := self radius: 0.8 hourAngle: (time seconds / 5.0).
centerColor := cColor
ifNil:
[Color transparent]
ifNotNil:
[time hours < 12
ifTrue: [cColor muchLighter]
ifFalse: [cColor]].
antialias ifTrue:
[aCanvas asBalloonCanvas
aaLevel: 4;
+ drawOval: (self bounds insetBy: self borderWidth // 2 + 1) color: self fillStyle
+ borderWidth: self borderWidth borderColor: self borderColor;
+ drawOval: (self bounds insetBy: self extent*0.35) color: centerColor
- drawOval: (bounds insetBy: borderWidth // 2 + 1) color: self fillStyle
- borderWidth: borderWidth borderColor: borderColor;
- drawOval: (bounds insetBy: self extent*0.35) color: centerColor
borderWidth: 0 borderColor: Color black;
drawPolygon: {self center. pHour}
color: Color transparent borderWidth: 3 borderColor: handsColor;
drawPolygon: {self center. pMin}
color: Color transparent borderWidth: 2 borderColor: handsColor;
drawPolygon: {self center. pSec}
color: Color transparent borderWidth: 1 borderColor: handsColor]
ifFalse:
[super drawOn: aCanvas.
aCanvas
+ fillOval: (self bounds insetBy: self extent*0.35) color: centerColor;
- fillOval: (bounds insetBy: self extent*0.35) color: centerColor;
line: self center to: pHour width: 3 color: handsColor;
line: self center to: pMin width: 2 color: handsColor;
line: self center to: pSec width: 1 color: handsColor]
!
More information about the Packages
mailing list