Etoys: Morphic-kfr.79.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Etoys: Morphic-kfr.79.mcz

commits-2
Spam detection software, running on the system "europa.mgmt.inetu.net", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email.  If you have any questions, see
the administrator of that system for details.

Content preview:  Karl Ramberg uploaded a new version of Morphic to project
  Etoys: http://source.squeak.org/etoys/Morphic-kfr.79.mcz ====================
   Summary ==================== Name: Morphic-kfr.79 Author: kfr Time: 3 March
   2012, 1:47:27 am UUID: d26c063a-671c-aa4a-8c25-c3cd9f5d4994 Ancestors: Morphic-Richo.78
   [...]

Content analysis details:   (5.2 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 3.5 BAYES_99               BODY: Bayesian spam probability is 99 to 100%
                            [score: 1.0000]
 0.0 MISSING_MID            Missing Message-Id: header
 1.2 INVALID_DATE           Invalid Date: header (not RFC 2822)
 3.8 TVD_STOCK1             BODY: TVD_STOCK1
 0.1 RDNS_NONE              Delivered to trusted network by a host with no rDNS
-3.4 AWL                    AWL: From: address is in the auto white-list



Karl Ramberg uploaded a new version of Morphic to project Etoys:
http://source.squeak.org/etoys/Morphic-kfr.79.mcz

==================== Summary ====================

Name: Morphic-kfr.79
Author: kfr
Time: 3 March 2012, 1:47:27 am
UUID: d26c063a-671c-aa4a-8c25-c3cd9f5d4994
Ancestors: Morphic-Richo.78

Author: Scott Wallace
Adds a graph-paper option for the fillStyle of playfields.
Adds a graph-paper tool, allowing all the contributing factors to be viewed and manipulated, and the results seen immediately.

Fixed darker scrollbars in panel and a bug with offset and coarse grid

=============== Diff against Morphic-Richo.78 ===============

Item was changed:
  ----- Method: ColorPickerMorph>>allowsTranslucency (in category 'event handling') -----
  allowsTranslucency
+ "Answer whether the receiver should respect attempts to choose transparency.  Shamefully nonmodular code here."
- "Answer whether the receiver should respect attempts to choose transparency."
 
  | isWorld |
+ (target isKindOf: GraphPaperPanel) ifTrue: [^ false].
  isWorld := (target isPlayerLike and: [target costume isWorldMorph])
  or:  [target isMorph and: [target isWorldMorph]]
  or: [(target isKindOf: UpdatingRectangleMorph) and: [target involvesWorldColor]].
  ^ isWorld not!

Item was added:
+ ----- Method: ColorPickerMorph>>initializeForGraphPaperPanel (in category 'initialization') -----
+ initializeForGraphPaperPanel
+ "Initialize the receiver for appearing as one of the color-pickers in a GraphPaperPanel."
+
+ isModal := false.
+ self removeAllMorphs.
+ self setProperty: #noDraggingThisPicker toValue: true.
+
+ self addMorph: ((Morph newBounds: (RevertBox translateBy: self topLeft))
+ color: Color transparent; setCenteredBalloonText: 'restore original color' translated).
+ self addMorph: ((Morph newBounds: (FeedbackBox translateBy: self topLeft))
+ color: Color transparent; setCenteredBalloonText: 'shows selected color' translated).
+
+ self buildChartForm.
+
+ selectedColor ifNil: [selectedColor := Color white].
+ sourceHand := nil.
+ deleteOnMouseUp := false.
+ updateContinuously := true
+ !

Item was added:
+ ----- Method: ColorPickerMorph>>noChart: (in category 'accessing') -----
+ noChart: aBoolean
+ "Set the noChart variable as indicated."
+
+ noChart := aBoolean!

Item was changed:
  ----- Method: ColorPickerMorph>>updateAlpha: (in category 'private') -----
  updateAlpha: alpha
  "Update the appearance of the translucency box to reflect an alpha value.  If the receiver is designated as not accepting transulcency, enforce an alpha of 1.0 whatever the incoming value may be."
 
  | sliderRect alphaPos toUse |
  toUse := self allowsTranslucency ifTrue: [alpha] ifFalse: [1.0].
  sliderRect := self slopeBox insetBy: 1@3.
  alphaPos := sliderRect left + (toUse * sliderRect width) rounded.
 
  originalForm fill: (sliderRect withRight: alphaPos) fillColor: Color lightGray.
  originalForm fillWhite: (sliderRect withLeft: alphaPos).
 
  originalForm fill: (self slopeBox topRight + (0 @ 3) corner: TransparentBox bottomRight + (-5@-3))
  fillColor: (toUse < 1.0 ifTrue: [Color white] ifFalse: [Color lightGray]).
+ self allowsTranslucency ifTrue: [TransText displayOn: originalForm at: (TransText boundingBox align: TransText boundingBox center with: TransparentBox center) topLeft  rule: Form paint]
- TransText displayOn: originalForm at: (TransText boundingBox align: TransText boundingBox center with: TransparentBox center) topLeft  rule: Form paint.
 
  !

Item was added:
+ GenericPropertiesMorph subclass: #GraphPaperPanel
+ instanceVariableNames: 'backgroundColor gridColor gridEvery showDarkerGridAlso darkerGridColor darkerGridEvery offset'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Morphic-Experimental'!
+
+ !GraphPaperPanel commentStamp: 'sw 2/29/2012 14:44' prior: 0!
+ A panel for authoring "graph paper"
+ backgroundColor -- the color of the ground
+ gridColor -- the color of the fine lines
+ gridEvery -- number of pixels between fine grid lines.
+ darkerGridColor -- color of the secondary, less-frequently-drawn grid
+ darkerLineEvery -- number of primary grid units between darker grid lines
+ offset -- the offset of the InfiniteForm produced.!

Item was added:
+ ----- Method: GraphPaperPanel class>>classicCartesianGraph (in category 'examples') -----
+ classicCartesianGraph
+ "Answer a nicely configured playfield with horizontal and vertical axes and a background well-suited for determining units on the plane."
+
+ | aPlayfield horiz vert pixelsPerUnit parms |
+ aPlayfield := PasteUpMorph new extent: 642 @ 642.
+ horiz := HorizontalNumberLineMorph new.
+ horiz width: 640.
+
+ aPlayfield addMorphBack: horiz.
+ vert := VerticalNumberLineMorph new.
+ vert height: 640.
+ aPlayfield addMorphBack: vert.
+
+ pixelsPerUnit := 16.
+
+ horiz center: (aPlayfield center + (0 @ -2)).
+ vert center: (aPlayfield center + (-14 @ -2)).
+
+ horiz minValue: -20 pixelsPerUnit: pixelsPerUnit unitsPerMark: 1 marksPerLegend: 5.
+ vert minValue: -20 pixelsPerUnit: pixelsPerUnit unitsPerMark: 1 marksPerLegend: 5.
+
+ horiz registerGraphCoordinate: 0 atPlayfieldLocation: 322.
+ vert registerGraphCoordinate: 0 atPlayfieldLocation: 318.
+ vert showZero: false.
+
+ parms := GraphPaperParameters backgroundColor: Color green muchLighter gridColor: Color blue muchLighter gridEvery: 16 showDarkerGridAlso: true darkerGridColor: Color blue muchDarker darkerGridEvery: 10 offset: (0 @ 0).
+ aPlayfield establishGraphPaperFrom: parms.
+
+ horiz update.
+ vert update.
+
+ "temporary fudges to get this basically looking right, though there had been hope that the above attempts would have already succeded..."
+ WorldState addDeferredUIMessage:
+ [vert y: 294.
+ vert maxValue: 20.
+ horiz y: 314.
+ horiz maxValue: 20].
+
+ ^ aPlayfield
+
+ "
+ GraphPaperPanel classicCartesianGraph openInHand
+ "!

Item was added:
+ ----- Method: GraphPaperPanel class>>simpleGraphPaper (in category 'examples') -----
+ simpleGraphPaper
+ "Answer a playfield set up with simple graph paper."
+
+ | aPlayfield parms |
+ aPlayfield := PasteUpMorph new extent: 640 @ 480.
+
+ parms := GraphPaperParameters backgroundColor: Color lightYellow gridColor: Color lightGreen lighter lighter gridEvery: 16 showDarkerGridAlso: true darkerGridColor: Color green lighter darkerGridEvery: 10 offset: (0 @ 0).
+ aPlayfield establishGraphPaperFrom: parms.
+
+ ^ aPlayfield
+
+ "
+ GraphPaperPanel simpleGraphPaper openInHand
+ "!

Item was added:
+ ----- Method: GraphPaperPanel class>>supplementaryPartsDescriptions (in category 'parts-bin') -----
+ supplementaryPartsDescriptions
+ "Answer a list of DescriptionForPartsBin objects that characterize objects that this class wishes to contribute to Stationery bins *other* than by the standard default #newStandAlone protocol"
+
+ ^ {
+ DescriptionForPartsBin
+ formalName: 'x-y plane' translatedNoop
+ categoryList: {'Graphing' translatedNoop}
+ documentation:
+ 'an x-y plane with x and y axes' translatedNoop
+ globalReceiverSymbol: #GraphPaperPanel
+ nativitySelector: #classicCartesianGraph.
+
+ DescriptionForPartsBin
+ formalName: 'graph paper' translatedNoop
+ categoryList: {'Graphing' translatedNoop}
+ documentation:
+ 'simple graph paper' translatedNoop
+ globalReceiverSymbol: #GraphPaperPanel
+ nativitySelector: #simpleGraphPaper.
+
+ "DescriptionForPartsBin
+ formalName: 'Broad x-y plane' translatedNoop
+ categoryList: {'Graphing' translatedNoop}
+ documentation:
+ 'an x-y plane with axes covering a range from -20 to 20' translatedNoop
+ globalReceiverSymbol: #GraphPaperPanel
+ nativitySelector: #largerCartesianGraph.
+
+ DescriptionForPartsBin
+ formalName: 'First quadrant' translatedNoop
+ categoryList: {'Graphing' translatedNoop}
+ documentation:
+ 'the first quadrant of an x-y plane' translatedNoop
+ globalReceiverSymbol: #GraphPaperPanel
+ nativitySelector: #firstQuadrantGraph."
+ }!

Item was added:
+ ----- Method: GraphPaperPanel>>adjustOffset: (in category 'adjusting parameters') -----
+ adjustOffset: aFractionalPoint
+ "Adjust the offset to reflect the value embodied in the argument supplied."
+
+ offset := (aFractionalPoint * self extent) rounded.
+ self showSliderFeedback: offset.
+ self makeToolReflectCurrentSettings!

Item was added:
+ ----- Method: GraphPaperPanel>>backgroundColor (in category 'accessing') -----
+ backgroundColor
+ "Answer the value of backgroundColor"
+
+ ^ backgroundColor!

Item was added:
+ ----- Method: GraphPaperPanel>>backgroundColor: (in category 'accessing') -----
+ backgroundColor: anObject
+ "Set the value of backgroundColor"
+
+ backgroundColor := anObject.
+ self makeToolReflectCurrentSettings!

Item was added:
+ ----- Method: GraphPaperPanel>>colorPickerFor:getter:setter: (in category 'private') -----
+ colorPickerFor: target getter: getterSymbol setter: setterSymbol
+ "Answer a color picker for the given target, getter, and setter, for use in the panel."
+
+ ^ ColorPickerMorph new
+ noChart: true;
+ initializeForGraphPaperPanel;
+ target: target;
+ selector: setterSymbol;
+ originalColor: (target perform: getterSymbol)!

Item was added:
+ ----- Method: GraphPaperPanel>>darkerGridColor (in category 'accessing') -----
+ darkerGridColor
+ "Answer the value of darkerGridColor."
+
+ ^ darkerGridColor!

Item was added:
+ ----- Method: GraphPaperPanel>>darkerGridColor: (in category 'accessing') -----
+ darkerGridColor: anObject
+ "Set the value of darkerGridColor."
+
+ darkerGridColor := anObject.
+ self makeToolReflectCurrentSettings!

Item was added:
+ ----- Method: GraphPaperPanel>>darkerGridEvery (in category 'accessing') -----
+ darkerGridEvery
+ "Answer the value of darkerGridEvery."
+
+ ^ darkerGridEvery!

Item was added:
+ ----- Method: GraphPaperPanel>>darkerGridEvery: (in category 'accessing') -----
+ darkerGridEvery: aNumber
+ "Set the value of darkerGridEvery."
+
+ darkerGridEvery := aNumber rounded.
+ self makeToolReflectCurrentSettings!

Item was added:
+ ----- Method: GraphPaperPanel>>doAccept (in category 'accepting') -----
+ doAccept
+ "The user hit 'accept' -- have the target remember the parameters embodied, and dismiss the panel."
+
+ myTarget renderedMorph establishGraphPaperFrom: (GraphPaperParameters new fillFrom: self).
+ self delete!

Item was added:
+ ----- Method: GraphPaperPanel>>doApply (in category 'accepting') -----
+ doApply
+ "The user hit 'apply' -- have the target remember the parameters embodied.  Keep the panel up.   If user makes any further changes in the panel but then hits cancel, fill style will revert to the version saved here."
+
+ myTarget renderedMorph establishGraphPaperFrom: (GraphPaperParameters new fillFrom: self).
+ thingsToRevert at: #fillStyle: put: myTarget fillStyle.
+ !

Item was added:
+ ----- Method: GraphPaperPanel>>doEnables (in category 'private') -----
+ doEnables
+ "Carry out appropriate enablings within the receiver's interior."
+
+ | itsName |
+ self allMorphsDo: [ :each |
+ itsName := each knownName.
+ (#(pickerForDarkerGrid darkerGridEvery) includes: itsName) ifTrue:
+ [self enable: each when: self showDarkerGridAlso]]!

Item was added:
+ ----- Method: GraphPaperPanel>>doSolidColor (in category 'private') -----
+ doSolidColor
+ "Abandon use of graph paper; use the prevailing background as the new solid color."
+
+ myTarget color: self backgroundColor.
+ self delete.
+ myTarget openAppropriatePropertySheet!

Item was added:
+ ----- Method: GraphPaperPanel>>gridColor (in category 'accessing') -----
+ gridColor
+ "Answer the value of gridColor"
+
+ ^ gridColor!

Item was added:
+ ----- Method: GraphPaperPanel>>gridColor: (in category 'accessing') -----
+ gridColor: anObject
+ "Set the value of gridColor."
+
+ gridColor := anObject.
+ self makeToolReflectCurrentSettings!

Item was added:
+ ----- Method: GraphPaperPanel>>gridEvery (in category 'accessing') -----
+ gridEvery
+ "Answer the value of gridEvery."
+
+ ^ gridEvery!

Item was added:
+ ----- Method: GraphPaperPanel>>gridEvery: (in category 'accessing') -----
+ gridEvery: aNumber
+ "Set the value of gridEvery"
+
+ gridEvery := aNumber rounded.
+ self makeToolReflectCurrentSettings!

Item was added:
+ ----- Method: GraphPaperPanel>>hasTarget: (in category 'accessing') -----
+ hasTarget: aMorph
+ "Answer whether the receiver's target is the morph in question."
+
+ ^ aMorph renderedMorph == myTarget!

Item was added:
+ ----- Method: GraphPaperPanel>>initialize (in category 'initialization') -----
+ initialize
+ "Initialize the receiver.  Notice that, because of GenericPropertiesMorph's custom, 'myTarget' is already set before this is called."
+
+ | existing toUse |
+ super initialize.
+ existing := myTarget renderedMorph valueOfProperty: #graphPaperParameters.
+ toUse := existing
+ ifNotNil:
+ [existing deepCopy]
+ ifNil:
+ [GraphPaperParameters new].
+ backgroundColor := existing
+ ifNotNil:
+ [toUse backgroundColor]
+ ifNil:
+ [myTarget color asColor].
+ gridColor := toUse gridColor.
+ gridEvery := toUse gridEvery.
+ showDarkerGridAlso := toUse showDarkerGridAlso.
+ darkerGridColor := toUse darkerGridColor.
+ darkerGridEvery := toUse darkerGridEvery.
+ offset := toUse offset.
+
+ thingsToRevert at: #fillStyle: put: myTarget fillStyle.
+ self rebuild.
+
+ self makeToolReflectCurrentSettings
+
+ !

Item was added:
+ ----- Method: GraphPaperPanel>>makeToolReflectCurrentSettings (in category 'accessing') -----
+ makeToolReflectCurrentSettings
+ "Make the appropriate item reflect graph-paper corresponding to current settings."
+
+ myTarget color: (GraphPaperParameters new fillFrom: self) asInfiniteForm!

Item was added:
+ ----- Method: GraphPaperPanel>>offset (in category 'accessing') -----
+ offset
+ "Answer the value of offset"
+
+ ^ offset!

Item was added:
+ ----- Method: GraphPaperPanel>>offset: (in category 'accessing') -----
+ offset: anObject
+ "Set the value of offset"
+
+ offset := anObject!

Item was added:
+ ----- Method: GraphPaperPanel>>paneForBackgroundColorPicker (in category 'panes') -----
+ paneForBackgroundColorPicker
+ "Answer a pane for governing the background color."
+
+ ^ self
+ inAColumn: {
+ (self inAColumn: {
+ self colorPickerFor: self
+ getter: #backgroundColor setter: #backgroundColor:.
+ self lockedString: 'paper color' translated.
+ }
+ named: #pickerForBackground) layoutInset: 0.
+ }
+ !

Item was added:
+ ----- Method: GraphPaperPanel>>paneForDarkerGridColorPicker (in category 'panes') -----
+ paneForDarkerGridColorPicker
+ "Answer a pane for governing the secondary line color."
+
+ ^ self
+ inAColumn: {
+ (self inAColumn: {
+ self colorPickerFor: self
+ getter: #darkerGridColor setter: #darkerGridColor:.
+ self lockedString: 'coarse grid color' translated.
+ }
+ named: #pickerForDarkerGrid) layoutInset: 0.
+ }
+ !

Item was added:
+ ----- Method: GraphPaperPanel>>paneForDarkerGridEvery (in category 'panes') -----
+ paneForDarkerGridEvery
+ "Answer a pane for the darkerGridEvery datum."
+
+ | aSlider |
+ aSlider :=  SimpleSliderMorph new
+ color: color darker;
+ extent: 100@28;
+ target: self;
+ minVal: 2;
+ maxVal: 40;
+ actionSelector: #darkerGridEvery:;
+ adjustToValue: self darkerGridEvery.
+
+ ^ (self inARow: {
+ (UpdatingStringMorph new)
+ getSelector: #darkerGridEvery;
+ putSelector: #darkerGridEvery:;
+ target: self;
+ growable: false;
+ decimalPlaces: 0;
+ minimumWidth: 40;
+ maximumWidth: 40;
+ yourself.
+ aSlider}) setNameTo: #darkerGridEvery; yourself!

Item was added:
+ ----- Method: GraphPaperPanel>>paneForExtras (in category 'panes') -----
+ paneForExtras
+ "Answer a pane for the checkbox and buttons"
+
+ ^ self
+ inAColumn: {
+ self transparentSpacerOfSize: (10 @ 20).
+ self paneForGridEvery.
+ self transparentSpacerOfSize: (10 @ 40).
+ self paneForSecondaryGridToggle.
+ self transparentSpacerOfSize: (10 @ 10).
+ self paneForDarkerGridEvery.
+ self transparentSpacerOfSize: (10 @ 40).
+ self paneForOffset.
+ self transparentSpacerOfSize: (10 @ 40).
+ }
+ named: #paneForExtras.!

Item was added:
+ ----- Method: GraphPaperPanel>>paneForGridColorPicker (in category 'panes') -----
+ paneForGridColorPicker
+ "Answer a pane for governing the grid color."
+
+ ^ self
+ inAColumn: {
+ (self inAColumn: {
+ self colorPickerFor: self
+ getter: #gridColor setter: #gridColor:.
+ self lockedString: 'grid color' translated.
+ }
+ named: #pickerForGrid) layoutInset: 0.
+ }
+ !

Item was added:
+ ----- Method: GraphPaperPanel>>paneForGridEvery (in category 'panes') -----
+ paneForGridEvery
+ "Answer a pane to govern the gridEvery datum."
+
+ | aSlider |
+ aSlider :=  SimpleSliderMorph new
+ color: color darker;
+ extent: 100@28;
+ target: self;
+ minVal: 4;
+ maxVal: 360;
+ actionSelector: #gridEvery:;
+ adjustToValue: self gridEvery.
+
+ ^ self inARow: {
+ self lockedString: ('grid size' translated, '  ').
+ (UpdatingStringMorph new)
+ getSelector: #gridEvery;
+ putSelector: #gridEvery:;
+ target: self;
+ growable: false;
+ decimalPlaces: 0;
+ minimumWidth: 40;
+ maximumWidth: 40;
+ yourself.
+ aSlider}!

Item was added:
+ ----- Method: GraphPaperPanel>>paneForOffset (in category 'panes') -----
+ paneForOffset
+ "Answer a pane for the Offset button."
+
+ ^ (self inARow: {
+ self
+ buildFakeSlider: 'Offset' translated
+ selector: #adjustOffset:
+ help: 'Drag in here to change the offset' translated
+ }) hResizing: #shrinkWrap
+
+ !

Item was added:
+ ----- Method: GraphPaperPanel>>paneForSecondaryGridToggle (in category 'panes') -----
+ paneForSecondaryGridToggle
+ "Answer a pane to govern the secondary grid."
+
+ ^ self inARow: {
+ self
+ directToggleButtonFor: self
+ getter: #showDarkerGridAlso
+ setter: #toggleShowDarkerGridAlso
+ help: 'Also show coarse grid' translated.
+ self lockedString: ' coarse grid' translated.
+ }
+ !

Item was added:
+ ----- Method: GraphPaperPanel>>rebuild (in category 'initialization') -----
+ rebuild
+ "Rebuild the contents of the property sheet."
+
+ | buttons |
+ self removeAllMorphs.
+ self addARow: {
+ self lockedString: myTarget topRendererOrSelf externalName
+ "self lockedString: ('Graph paper for {1}' translated format: {myTarget topRendererOrSelf externalName})".
+ }.
+
+ self addARow: {
+ self paneForBackgroundColorPicker.
+ self paneForGridColorPicker.
+
+ }.
+ self addARow: {
+ self paneForExtras.
+ self paneForDarkerGridColorPicker.
+ }.
+
+ buttons := OrderedCollection new.
+ buttons addAll: {
+ self
+ buttonNamed: 'Apply' translated action: #doApply color: color lighter
+ help: 'keep changes made thus far, but keep panel open' translated.
+ self
+ buttonNamed: 'Accept' translated action: #doAccept color: color lighter
+ help: 'keep changes made and close panel' translated.
+ self
+ buttonNamed: 'Cancel' translated action: #doCancel color: color lighter
+ help: 'cancel changes made and close panel' translated.
+ self  transparentSpacerOfSize: (100 @ 1).
+ self buttonNamed: 'Solid color' translated action: #doSolidColor color: color lighter help: 'abandon graph paper, use a solid color instead' translated
+ }.
+
+ self addARow: buttons!

Item was added:
+ ----- Method: GraphPaperPanel>>showDarkerGridAlso (in category 'accessing') -----
+ showDarkerGridAlso
+ "Answer the value of showDarkerGridAlso"
+
+ ^ showDarkerGridAlso!

Item was added:
+ ----- Method: GraphPaperPanel>>showDarkerGridAlso: (in category 'accessing') -----
+ showDarkerGridAlso: anObject
+ "Set the value of showDarkerGridAlso"
+
+ showDarkerGridAlso := anObject!

Item was added:
+ ----- Method: GraphPaperPanel>>toggleShowDarkerGridAlso (in category 'adjusting parameters') -----
+ toggleShowDarkerGridAlso
+ "Toggle whether a secondary grid should be shown."
+
+ showDarkerGridAlso := self showDarkerGridAlso not.
+ self rebuild.
+ self doEnables.
+ self makeToolReflectCurrentSettings!

Item was added:
+ Object subclass: #GraphPaperParameters
+ instanceVariableNames: 'backgroundColor gridColor gridEvery showDarkerGridAlso darkerGridColor darkerGridEvery offset'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Morphic-Experimental'!
+
+ !GraphPaperParameters commentStamp: 'sw 2/29/2012 15:04' prior: 0!
+ parameters that define "graph paper".  
+ backgroundColor the color of the "paper"
+ gridColor the color of the finest grid lines
+ gridEvery pixels per fine grid
+ darkerGridColor the color of the coarser grid lines
+ darkerLineEvery fine grid lines per coarser grid line
+ offset offset point for the infinite form!

Item was added:
+ ----- Method: GraphPaperParameters class>>backgroundColor:gridColor:gridEvery:showDarkerGridAlso:darkerGridColor:darkerGridEvery:offset: (in category 'instance creation') -----
+ backgroundColor: bgColor gridColor: gridColor gridEvery: pixelsPerGrid showDarkerGridAlso: aBoolean darkerGridColor: darkerGridColor darkerGridEvery: gridsPerDarkerGrid offset: offsetPoint
+ "Answer a new GraphPaperParameters instance holding the values provided."
+
+ | parms |
+ parms := self new.
+ parms backgroundColor: bgColor.
+ parms gridColor: gridColor.
+ parms gridEvery: pixelsPerGrid.
+ parms showDarkerGridAlso: aBoolean.
+ parms darkerGridColor: darkerGridColor.
+ parms darkerGridEvery: gridsPerDarkerGrid.
+ parms offset: offsetPoint asPoint.
+ ^ parms!

Item was added:
+ ----- Method: GraphPaperParameters class>>oneTierGridFormOrigin:grid:background:line: (in category 'form creation') -----
+ oneTierGridFormOrigin: origin grid: smallGrid  background: backColor line: lineColor
+ "Answer an infinite form that repeats as a simple grid."
+
+ ^ Morph basicNew gridFormOrigin: origin grid: smallGrid asPoint background: backColor line: lineColor
+
+ "
+ | aPlayfield |
+ aPlayfield := PasteUpMorph authoringPrototype extent: 640 @ 480.
+ aPlayfield color: (GraphPaperParameters oneTierGridFormOrigin: (0@0) grid: 16 background: Color green muchLighter line: Color blue muchLighter).
+ aPlayfield openInHand
+ "
+ !

Item was added:
+ ----- Method: GraphPaperParameters class>>twoTierGridFormOrigin:grid:background:line:darkerGridEvery:darkerGridColor: (in category 'form creation') -----
+ twoTierGridFormOrigin: origin grid: smallGrid  background: backColor line: lineColor darkerGridEvery: darkerGridEvery darkerGridColor: darkerGridColor
+ "Answer an infinite form that repeats a pattern involving grid lines with darker ones at regular intervals, such as 'engineering paper'."
+
+ | smallGridAsPoint gridForm gridOrigin fullGrid aColor darkGridOrigin countX countY |
+ smallGridAsPoint := smallGrid rounded asPoint.
+ fullGrid := smallGridAsPoint * darkerGridEvery.
+ gridForm := Form extent: fullGrid depth: Display depth.
+ gridOrigin := origin \\ smallGridAsPoint.
+ darkGridOrigin := origin \\ fullGrid.
+ backColor ifNotNil: [gridForm fillWithColor: backColor].
+ darkGridOrigin ifNotNil:[countX:=  darkGridOrigin x. countY:=  darkGridOrigin y]
+ ifNil:[countX:= countY := -1].
+
+ gridOrigin x to: gridForm width by: smallGridAsPoint x do:
+ [:x |
+ aColor := (countX \\ darkerGridEvery) = 0 ifTrue: [darkerGridColor] ifFalse: [lineColor].
+ gridForm fill: (x@0 extent: 1@gridForm height) fillColor: aColor.
+ countX:= countX+ 1.].
+ gridOrigin y to: gridForm height by: smallGridAsPoint y do:
+ [:y |
+ aColor := (countY\\ darkerGridEvery) = 0 ifTrue: [darkerGridColor] ifFalse: [lineColor].
+ gridForm fill: (0@y extent: gridForm width@1) fillColor: aColor.
+ countY:= countY+ 1.].
+ ^ InfiniteForm with: gridForm
+
+ "
+ | aPlayfield |
+ aPlayfield := PasteUpMorph authoringPrototype extent: 640 @ 480.
+ aPlayfield color: (GraphPaperParameters twoTierGridFormOrigin: (0@0) grid: 16 background: Color green muchLighter line: Color blue muchLighter darkerGridEvery: 10 darkerGridColor: Color blue muchDarker).
+ aPlayfield openInHand
+ "
+ !

Item was added:
+ ----- Method: GraphPaperParameters>>asInfiniteForm (in category 'form creation') -----
+ asInfiniteForm
+ "Answer an InfiniteForm embodying the parameters of the receiver."
+
+ ^ self showDarkerGridAlso
+ ifTrue:
+ [self class twoTierGridFormOrigin: offset grid: gridEvery  background: backgroundColor line: gridColor darkerGridEvery: darkerGridEvery darkerGridColor: darkerGridColor]
+ ifFalse:
+ [self class oneTierGridFormOrigin: offset grid: gridEvery  background: backgroundColor line: gridColor]!

Item was added:
+ ----- Method: GraphPaperParameters>>backgroundColor (in category 'accessing') -----
+ backgroundColor
+ "Answer the value of backgroundColor"
+
+ ^ backgroundColor!

Item was added:
+ ----- Method: GraphPaperParameters>>backgroundColor: (in category 'accessing') -----
+ backgroundColor: anObject
+ "Set the value of backgroundColor."
+
+ backgroundColor := anObject!

Item was added:
+ ----- Method: GraphPaperParameters>>darkerGridColor (in category 'accessing') -----
+ darkerGridColor
+ "Answer the value of darkerGridColor"
+
+ ^ darkerGridColor!

Item was added:
+ ----- Method: GraphPaperParameters>>darkerGridColor: (in category 'accessing') -----
+ darkerGridColor: anObject
+ "Set the value of darkerGridColor."
+
+ darkerGridColor := anObject!

Item was added:
+ ----- Method: GraphPaperParameters>>darkerGridEvery (in category 'accessing') -----
+ darkerGridEvery
+ "Answer the value of darkerGridEvery"
+
+ ^ darkerGridEvery!

Item was added:
+ ----- Method: GraphPaperParameters>>darkerGridEvery: (in category 'accessing') -----
+ darkerGridEvery: aNumber
+ "Set the value of darkerGridEvery"
+
+ darkerGridEvery := aNumber rounded!

Item was added:
+ ----- Method: GraphPaperParameters>>fillFrom: (in category 'initialization') -----
+ fillFrom: aGraphPaperMorph
+ "Fill the receiver's instance variables from a GraphPaperMorph panel."
+
+ backgroundColor := aGraphPaperMorph backgroundColor.
+ gridColor := aGraphPaperMorph gridColor.
+ gridEvery:= aGraphPaperMorph gridEvery.
+ showDarkerGridAlso := aGraphPaperMorph showDarkerGridAlso ifNil: [false].
+ darkerGridColor := aGraphPaperMorph darkerGridColor.
+ darkerGridEvery := aGraphPaperMorph darkerGridEvery.
+ offset := aGraphPaperMorph offset!

Item was added:
+ ----- Method: GraphPaperParameters>>gridColor (in category 'accessing') -----
+ gridColor
+ "Answer the value of gridColor"
+
+ ^ gridColor!

Item was added:
+ ----- Method: GraphPaperParameters>>gridColor: (in category 'accessing') -----
+ gridColor: anObject
+ "Set the value of gridColor."
+
+ gridColor := anObject!

Item was added:
+ ----- Method: GraphPaperParameters>>gridEvery (in category 'accessing') -----
+ gridEvery
+ "Answer the value of gridEvery"
+
+ ^ gridEvery!

Item was added:
+ ----- Method: GraphPaperParameters>>gridEvery: (in category 'accessing') -----
+ gridEvery: aNumber
+ "Set the value of gridEvery"
+
+ gridEvery := aNumber rounded!

Item was added:
+ ----- Method: GraphPaperParameters>>initialize (in category 'initialization') -----
+ initialize
+ "Initialize the receiver and give default values to all the parameters."
+
+ super initialize.
+ backgroundColor := Color green lighter.
+ gridColor := Color green darker.
+ gridEvery := 16.
+ showDarkerGridAlso := true.
+ darkerGridColor := Color black.
+ darkerGridEvery := 5.
+ offset := 0 @ 0!

Item was added:
+ ----- Method: GraphPaperParameters>>offset (in category 'accessing') -----
+ offset
+ "Answer the value of offset"
+
+ ^ offset!

Item was added:
+ ----- Method: GraphPaperParameters>>offset: (in category 'accessing') -----
+ offset: anObject
+ "Set the value of offset."
+
+ offset := anObject!

Item was added:
+ ----- Method: GraphPaperParameters>>printOn: (in category 'accessing') -----
+ printOn: aStream
+ "Print the receiver on a stream."
+
+ aStream nextPutAll: ('GraphPaperParameters, offset = ', offset printString, ' gridEvery =', gridEvery printString, ' alsoShowDarkerGrid: ',  showDarkerGridAlso printString).
+ showDarkerGridAlso ifTrue:
+ [aStream nextPutAll: ' darkerGridEvery: ',  darkerGridEvery printString]!

Item was added:
+ ----- Method: GraphPaperParameters>>showDarkerGridAlso (in category 'accessing') -----
+ showDarkerGridAlso
+ "Answer the value of showDarkerGridAlso"
+
+ ^ showDarkerGridAlso!

Item was added:
+ ----- Method: GraphPaperParameters>>showDarkerGridAlso: (in category 'accessing') -----
+ showDarkerGridAlso: anObject
+ "Set the value of showDarkerGridAlso"
+
+ showDarkerGridAlso := anObject!

Item was changed:
  ----- Method: Morph>>changeColorSimply (in category 'meta-actions') -----
  changeColorSimply
+ "Put up the simplest color picker to change the receiver's color."
- "Put up a simple color picker to change the receiver's color"
 
+ ((self renderedMorph fillStyle isKindOf: InfiniteForm) and:
+ [self renderedMorph hasProperty: #graphPaperParameters])
+ ifTrue:
+ [self changeGraphPaper]
+ ifFalse:
+ [self changeColor]!
- self changeColor!

Item was added:
+ ----- Method: Morph>>changeGraphPaper (in category 'visual properties') -----
+ changeGraphPaper
+ "Make receiver use a graph-paper fill"
+
+ "At present does not actually establish graph paper unless/until the user hits Accept in the graph-paper dialog."
+
+ self makeGraphPaper!

Item was added:
+ ----- Method: Morph>>establishGraphPaperFrom: (in category 'viewing') -----
+ establishGraphPaperFrom: graphPaperParameters
+ "Establish an InfiniteForm as the receiver's fill style, as defined the given graphPaperParameters; remember the graphPaperParameters provided in a property of the same name."
+
+ self setProperty: #graphPaperParameters toValue: graphPaperParameters.
+ self color: graphPaperParameters asInfiniteForm
+ !

Item was changed:
  ----- Method: Morph>>makeGraphPaper (in category 'e-toy support') -----
  makeGraphPaper
  "Undertake interaction to define graph paper."
 
+ | existing |
+ existing := ActiveWorld submorphs detect:
+ [:m | (m isKindOf: GraphPaperPanel) and:
+ [m hasTarget: self]] ifNone: [nil].
+ existing ifNotNil: [^ existing comeToFront].
+ self putUpGraphPaperPanel
+
+ "The long-standing old code, now superceded by the GraphPaperPanel , follows...
- | smallGrid backColor lineColor gridString |
  gridString := FillInTheBlank request: 'Enter grid size' translated initialAnswer: '16'.
  gridString isEmptyOrNil ifTrue: [^ self].
  smallGrid := gridString asIntegerIfAllDigits.
  (smallGrid isNil or: [smallGrid = 0])
  ifTrue: [^ self].
  Utilities informUser: 'Choose a background color' translated during:
  [self changeColorTarget: self selector: #chosenColor: originalColor: Color yellow hand: ActiveHand showPalette: true].
  backColor := self valueOfProperty: #chosenColor.
 
  Utilities informUser: 'Choose a line color' translated during:
  [self changeColorTarget: self selector: #chosenColor: originalColor: Color black hand: ActiveHand showPalette: true].
  lineColor := self valueOfProperty: #chosenColor.
 
  self removeProperty: #chosenColor.
 
+ self makeGraphPaperGrid: smallGrid background: backColor line: lineColor"!
- self makeGraphPaperGrid: smallGrid background: backColor line: lineColor!

Item was added:
+ ----- Method: Morph>>putUpGraphPaperPanel (in category 'e-toy support') -----
+ putUpGraphPaperPanel
+ "Put up a GraphPaperPanel for the receiver."
+
+ | aPanel |
+ aPanel := GraphPaperPanel basicNew.
+ aPanel targetMorph: self.
+ aPanel initialize.
+ aPanel openNearTarget!

Item was changed:
  ----- Method: Morph>>setStandardTexture (in category 'e-toy support') -----
  setStandardTexture
+ "Use a simple, singier-tier, pleasant graph paper texture."
+
+ | parms |
+ parms := GraphPaperParameters backgroundColor: Color lightYellow gridColor: Color lightGreen lighter lighter gridEvery: 16 showDarkerGridAlso: false darkerGridColor: Color blue darkerGridEvery: 10 offset: (0 @ 0).
+ self establishGraphPaperFrom: parms!
- | parms |
- parms _ self textureParameters.
- self makeGraphPaperGrid: parms first
- background: parms second
- line: parms third!

Item was added:
+ ----- Method: Morph>>useGraphPaperFill (in category 'visual properties') -----
+ useGraphPaperFill
+ "Make receiver use a graph-paper fill"
+
+ self makeGraphPaper!

Item was changed:
+ ----- Method: PasteUpMorph>>addFillStyleMenuItems:hand: (in category 'menu & halo') -----
- ----- Method: PasteUpMorph>>addFillStyleMenuItems:hand: (in category 'menus') -----
  addFillStyleMenuItems: aMenu hand: aHand
  "Add the items for changing the current fill style of the Morph"
 
+ | menu |
+ self canHaveFillStyles ifFalse:[^aMenu add: 'change color...' translated target: self action: #changeColor].
+ menu _ MenuMorph new defaultTarget: self.
+ self fillStyle addFillStyleMenuItems: menu hand: aHand from: self.
+ menu addLine.
+ menu add: 'solid fill' translated action: #useSolidFill.
+ menu add: 'gradient fill' translated action: #useGradientFill.
+ menu add: 'bitmap fill' translated action: #useBitmapFill.
+ menu add: 'graph paper' translated action: #useGraphPaperFill.
+ menu add: 'default fill' translated action: #useDefaultFill.
- self isWorldMorph ifFalse: [^ super addFillStyleMenuItems: aMenu hand: aHand].
 
+ aMenu add: 'fill style' translated subMenu: menu.
+ "aMenu add: 'change color...' translated action: #changeColor"!
- aMenu add: 'desktop color...' translated action: #presentDesktopColorMenu.
- aMenu balloonTextForLastItem: 'change the color or pattern of the desktop background that lies behind everything else on the screen.' translated.!

Item was added:
+ ----- Method: UpdatingStringMorph>>maximumWidth: (in category 'accessing') -----
+ maximumWidth: aValue
+ "Set the maximum width that the receiver can have."
+
+ maximumWidth := aValue!


_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev