'From Squeak3.2alpha of 3 October 2001 [latest update: #4551] on 26 November 2001 at 12:13:21 pm'! "Change Set: borderStylesInViewer-sw Date: 26 November 2001 Author: Scott Wallace Makes the full range of new border styles available in viewers"! !Morph class methodsFor: 'scripting' stamp: 'sw 11/26/2001 09:30'! additionsToViewerCategoryColorAndBorder "Answer viewer additions for the 'color & border' category" ^#( #'color & border' ( (slot color 'The color of the object' Color readWrite Player getColor Player setColor:) (slot colorUnder 'The color under the center of the object' Color readOnly Player getColorUnder unused unused ) (slot luminanceUnder 'The luminance under the center of the object' Number readOnly Player getLuminanceUnder unused unused) (slot saturationUnder 'The saturation under the center of the object' Number readOnly Player getSaturationUnder unused unused) (slot brightnessUnder 'The brightness under the center of the object' Number readOnly Player getBrightnessUnder unused unused) (slot borderStyle '"The style of the object''s border' BorderStyle readWrite Player getBorderStyle player setBorderStyle:) (slot borderColor 'The color of the object''s border' Color readWrite Player getBorderColor Player setBorderColor:) (slot borderWidth 'The width of the object''s border' Number readWrite Player getBorderWidth Player setBorderWidth:) (slot roundedCorners 'Whether corners should be rounded' Boolean readWrite Player getRoundedCorners Player setRoundedCorners:) (slot gradientFill 'Whether a gradient fill should be used' Boolean readWrite Player getUseGradientFill Player setUseGradientFill:) (slot radialFill 'Whether the gradient fill, if used, should be radial' Boolean readWrite Player getRadialGradientFill Player setRadialGradientFill:) (slot dropShadow 'Whether a drop shadow is shown' Boolean readWrite Player getDropShadow Player setDropShadow:) (slot shadowColor 'The color of the drop shadow' Color readWrite Player getShadowColor Player setShadowColor:) ) ) ! ! !Player methodsFor: 'slots-kernel' stamp: 'sw 11/26/2001 12:12'! usableMethodInterfacesIn: methodInterfaceList "Filter the list given by methodInterfaceList, to remove items inappropriate to the receiver" self hasCostumeThatIsAWorld ifTrue: [^ methodInterfaceList select: [:anInterface | #(append: beep: clearTurtleTrails doScript: getColor "color" getCursor "cursor" deleteCard doMenuItem emptyScript firstPage goToFirstCardInBackground goToFirstCardOfStack goToLastCardInBackground goToLastCardOfStack goToNextCardInStack goToPreviousCardInStack initiatePainting insertCard liftAllPens lowerAllPens arrowheadsOnAllPens noArrowheadsOnAllPens getMouseX getMouseY "mouseX mouseY" pauseScript: reverse roundUpStrays shuffleContents startScript: stopScript: unhideHiddenObjects getValueAtCursor "valueAtCursor" startAll: pauseAll: stopAll: viewAllMessengers clobberAllMessengers openAllScriptsTool handScriptControlButtons viewAllReferencedObjects jumpToProject:) includes: anInterface selector]]. self hasAnyBorderedCostumes ifTrue: [^ methodInterfaceList]. ^ self hasOnlySketchCostumes ifTrue: [methodInterfaceList select: [:anInterface | (#(getColor getBorderColor getBorderWidth getBorderStyle getRoundedCorners getUseGradientFill getRadialGradientFill ) includes: anInterface selector) not]] ifFalse: [methodInterfaceList select: [:anInterface | (#(getBorderColor getBorderWidth) includes: anInterface selector) not]]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 11/26/2001 11:54'! borderStyleForSymbol: aStyleSymbol "Set the border style of my costume" | aSymbol aStyle existing | aSymbol _ aStyleSymbol asSymbol. (#(none simple) includes: aSymbol) ifTrue: [aStyle _ SimpleBorder new]. aSymbol == #raised ifTrue: [aStyle _ BorderStyle raised]. aSymbol == #inset ifTrue: [aStyle _ BorderStyle inset]. aSymbol == #complexFramed ifTrue: [aStyle _ BorderStyle complexFramed]. aSymbol == #complexRaised ifTrue: [aStyle _ BorderStyle complexRaised]. aSymbol == #complexInset ifTrue: [aStyle _ BorderStyle complexInset]. aSymbol == #complexAltFramed ifTrue: [aStyle _ BorderStyle complexAltFramed]. aSymbol == #complexAltRaised ifTrue: [aStyle _ BorderStyle complexAltRaised width: 4]. aSymbol == #complexAltInset ifTrue: [aStyle _ BorderStyle complexAltInset]. aStyle ifNil: [self error: 'bad style']. existing _ costume renderedMorph borderStyle. aStyle width: existing width; baseColor: existing baseColor. ^ (costume renderedMorph canDrawBorder: aStyle) ifTrue: [aStyle] ifFalse: [nil]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 11/26/2001 11:49'! getBorderColor "Answer the border color of my costume" ^ costume renderedMorph borderStyle baseColor! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 11/26/2001 10:02'! getBorderStyle "Answer the border style" ^ costume renderedMorph borderStyle style! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 11/26/2001 11:33'! getBorderWidth "Answer the border width of my costume" ^ costume renderedMorph borderStyle width! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 11/26/2001 11:59'! setBorderStyle: aSymbol "Set the border style of my costume" | aStyle rend | aStyle _ self borderStyleForSymbol: aSymbol. aStyle ifNil: [^ self]. ((rend _ costume renderedMorph) canDrawBorder: aStyle) ifTrue: [rend borderStyle: aStyle]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 11/26/2001 11:32'! setBorderWidth: aWidth "Set the border width to the given number" costume renderedMorph borderStyle: (costume renderedMorph borderStyle copy width: aWidth)! ! !Vocabulary class methodsFor: 'class initialization' stamp: 'sw 11/26/2001 09:56'! initializeStandardVocabularies "Initialize a few standard vocabularies and place them in the AllStandardVocabularies list." AllStandardVocabularies _ nil. self allStandardVocabularies. self addEToyVocabulary. self addEToyVectorVocabulary. self addStandardVocabulary: self newPublicVocabulary. self addStandardVocabulary: FullVocabulary new. self addStandardVocabulary: self newQuadVocabulary. self addStandardVocabulary: ColorType new. self addStandardVocabulary: BooleanType new. self addStandardVocabulary: GraphicType new. self addStandardVocabulary: PlayerType new. self addStandardVocabulary: SoundType new. self addStandardVocabulary: StringType new. self addStandardVocabulary: MenuType new. self addStandardVocabulary: UnknownType new. self addStandardVocabulary: (SymbolListType new symbols: #(simple raised inset complexFramed complexRaised complexInset complexAltFramed complexAltRaised complexAltInset); vocabularyName: #BorderStyle; yourself). self addStandardVocabulary: (SymbolListType new symbols: #(leftToRight rightToLeft topToBottom bottomToTop); vocabularyName: #ListDirection; yourself). self addStandardVocabulary: (SymbolListType new symbols: #(topLeft bottomRight center justified); vocabularyName: #ListCentering; yourself). self addStandardVocabulary: (SymbolListType new symbols: #(buttonDown whilePressed buttonUp); vocabularyName: #ButtonPhase; yourself). self addStandardVocabulary: (SymbolListType new symbols: #(rigid spaceFill shrinkWrap); vocabularyName: #Resizing; yourself). self addStandardVocabulary: self newSystemVocabulary. "A custom vocabulary for Smalltalk -- still under development)" self numberVocabulary. "creates and adds it" self wonderlandVocabulary. "creates and adds it" self vocabularyForClass: Time. "creates and adds it" "Vocabulary initialize"! ! "Postscript:" Vocabulary initialize. !