Skip to content

Commit

Permalink
Enforce style guide
Browse files Browse the repository at this point in the history
Mainly whitespace changes
  • Loading branch information
lukasrad02 committed Aug 5, 2022
1 parent 8a5bdc8 commit b59125d
Show file tree
Hide file tree
Showing 49 changed files with 82 additions and 88 deletions.
1 change: 0 additions & 1 deletion packages/SVG-Editor.package/.squot-contents
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
SquotTrackedObjectMetadata {
#objectClassName : #PackageInfo,
#id : UUID [ 'fa526e874d4a4e45855a3d5b7ec17f60' ],
#objectsReplacedByNames : true,
#serializer : #SquotCypressCodeSerializer
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ buildSwitchesWIth: aToolBuilder
^ aToolBuilder pluggablePanelSpec new
layout: #horizontal;
children: {
self buildOpenButtonWith: aToolBuilder .
self buildSaveButtonWith: aToolBuilder .
self buildCloseButtonWith: aToolBuilder
};
self buildOpenButtonWith: aToolBuilder .
self buildSaveButtonWith: aToolBuilder .
self buildCloseButtonWith: aToolBuilder};
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ buildWith: aToolBuilder
(self switchesFrame) -> (self buildSwitchesWIth: aToolBuilder) .
(self panelDrawingFrame) -> (self buildDrawingAreaWith: aToolBuilder) .
(self treeFrame) -> (self buildTreeViewWith: aToolBuilder) .
(self infoPanelFrame) -> (self buildInfoPanelWith: aToolBuilder)
}.
(self infoPanelFrame) -> (self buildInfoPanelWith: aToolBuilder)}.

^ aToolBuilder build: window
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"buildInfoPanelWith:" : "lra 6/12/2022 19:55",
"buildOpenButtonWith:" : "lha 5/17/2022 19:32",
"buildSaveButtonWith:" : "lha 5/17/2022 19:32",
"buildSwitchesWIth:" : "nh 5/16/2022 15:54",
"buildSwitchesWIth:" : "lra 8/5/2022 16:17",
"buildTreeViewWith:" : "lra 6/12/2022 19:55",
"buildWith:" : "aes 5/28/2022 12:28",
"buildWith:" : "lra 8/5/2022 16:17",
"buttonHeight" : "nh 5/15/2022 15:51",
"infoPanelFrame" : "aes 5/28/2022 12:29",
"initialize" : "lha 5/17/2022 19:31",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
canCloseFile

^ self svg notNil
^ self svg notNil
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"actionSaveFile" : "lra 6/12/2022 19:17",
"askOpenPath" : "lha 5/17/2022 19:27",
"askSavePath" : "lha 5/17/2022 19:28",
"canCloseFile" : "lha 5/17/2022 19:28",
"canCloseFile" : "lra 8/5/2022 16:18",
"canSaveFile" : "lha 5/17/2022 19:28",
"displayNameOf:" : "aes 5/27/2022 14:20",
"getChildrenOf:" : "aes 5/27/2022 13:58",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ rendering
renderBezier3Segments: aCollection fill: aFillStyle stroke: aStrokeStyle strokeWidth: aNumber transform: aMatrix on: aCanvas

|bezier2Run|

bezier2Run := SVGBezier2SegmentRun
fromBezier3Segments: aCollection
precision: aMatrix compositeScale r reciprocal.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rendering
renderPolyline: anSVGPolyine on: aCanvas

| lineWidth lineColor|
|lineWidth lineColor|
anSVGPolyine points isEmpty
ifTrue: [^ anSVGPolyine].
lineWidth := anSVGPolyine composedStyle at: 'stroke-width'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ renderRect: anSVGRect on: aCanvas
transform := transform composedWithLocal: (MatrixTransform2x3 withScale: scale reciprocal).
lineWidth := (anSVGRect composedStyle at: 'stroke-width') rounded max: 1.
lineColor := anSVGRect composedStyle at: 'stroke'.
aCanvas asBalloonCanvas preserveStateDuring: [:bc|
aCanvas asBalloonCanvas preserveStateDuring: [:bc |
bc transformBy: transform during: [:balloonCanvas |
balloonCanvas
aaLevel: anSVGRect antialiasingLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ renderText: anSVGText on: aCanvas
ifTrue: [offset := (textFont widthOfString: anSVGText text) // 2 @ textFont ascent].
anchor = 'end'
ifTrue: [offset := (textFont widthOfString: anSVGText text) @ textFont ascent].
aCanvas asBalloonCanvas preserveStateDuring: [:bc|
aCanvas asBalloonCanvas preserveStateDuring: [:bc |
bc copy
aaLevel: anSVGText antialiasingLevel;
drawString: anSVGText text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
},
"instance" : {
"renderBezier2SegmentRun:fill:stroke:strokeWidth:transform:on:" : "nh 8/3/2022 15:26",
"renderBezier3Segments:fill:stroke:strokeWidth:transform:on:" : "nh 8/3/2022 15:18",
"renderBezier3Segments:fill:stroke:strokeWidth:transform:on:" : "lra 8/5/2022 16:11",
"renderEllipse:on:" : "nh 7/26/2022 18:30",
"renderLine:on:" : "nh 7/26/2022 18:30",
"renderPath:on:" : "nh 7/26/2022 18:30",
"renderPolygon:on:" : "nh 7/26/2022 18:30",
"renderPolyline:on:" : "nh 7/26/2022 18:30",
"renderRect:on:" : "nh 7/26/2022 18:30",
"renderText:on:" : "nh 7/26/2022 18:31" } }
"renderPolyline:on:" : "lra 8/5/2022 16:11",
"renderRect:on:" : "lra 8/5/2022 16:11",
"renderText:on:" : "lra 8/5/2022 16:12" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ createRectangleFromSVG: anElement
"Create the bounding rectangle from the svg circle."

self rectangle: (Rectangle
center: (anElement attributeAt: 'cx' ifAbsent: [0]) asSVGNumber @ (anElement attributeAt: 'cy' ifAbsent: [0]) asSVGNumber
extent: (anElement attributeAt: 'r' ifAbsent: [0]) asSVGNumber asPoint * 2)
center: (anElement attributeAt: 'cx' ifAbsent: [0]) asSVGNumber @ (anElement attributeAt: 'cy' ifAbsent: [0]) asSVGNumber
extent: (anElement attributeAt: 'r' ifAbsent: [0]) asSVGNumber asPoint * 2)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
},
"instance" : {
"accept:" : "aes 5/16/2022 16:29",
"createRectangleFromSVG:" : "lra 6/12/2022 16:37",
"createRectangleFromSVG:" : "lra 8/5/2022 16:08",
"humanReadableClassName" : "aes 5/27/2022 14:29" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ boundsChangedFrom: oldBounds to: newBounds

|temporaryTransform|
temporaryTransform := self transform.
oldBounds extent = newBounds extent ifFalse:[
oldBounds extent = newBounds extent ifFalse: [
temporaryTransform := temporaryTransform composedWithGlobal:
(MatrixTransform2x3 withOffset: oldBounds origin negated).
temporaryTransform := temporaryTransform composedWithGlobal:
(MatrixTransform2x3 withScale: newBounds extent / oldBounds extent).
temporaryTransform := temporaryTransform composedWithGlobal:
(MatrixTransform2x3 withOffset: newBounds origin).
].
(MatrixTransform2x3 withOffset: newBounds origin)].
temporaryTransform offset: temporaryTransform offset + (newBounds origin - oldBounds origin).
self transform: temporaryTransform
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
helpers
fullContainsPoint: aPoint

^ (self fullBounds containsPoint: aPoint) and:[self containsPoint: aPoint]
^ (self fullBounds containsPoint: aPoint) and: [self containsPoint: aPoint]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fullDrawOn: aCanvas
"Draw the full Morphic structure on the given Canvas"

self visible ifFalse: [^ self].
(self hasProperty: #errorOnDraw) ifTrue:[^ self drawErrorOn: aCanvas].
(self hasProperty: #errorOnDraw) ifTrue: [^ self drawErrorOn: aCanvas].
"Note: At some point we should generalize this into some sort of
multi-canvas so that we can cross-optimize some drawing operations."

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
helpers
transformFrom: uberMorph

(self owner isNil or:[self == uberMorph]) ifTrue: [^ self transform].
(self owner isNil or: [self == uberMorph]) ifTrue: [^ self transform].
^ (self owner transformFrom: uberMorph) asMatrixTransform2x3 composedWithLocal: self transform
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"accept:" : "aes 5/14/2022 12:17",
"antialiasingLevel" : "lra 6/12/2022 18:50",
"antialiasingLevel:" : "lra 6/12/2022 18:50",
"boundsChangedFrom:to:" : "lra 6/12/2022 17:48",
"boundsChangedFrom:to:" : "lra 8/5/2022 15:57",
"cachedComposedStyle" : "gvc 7/29/2005 21:00",
"cachedComposedStyle:" : "lra 6/12/2022 16:53",
"composedFillStyle" : "lra 6/12/2022 18:50",
Expand All @@ -19,8 +19,8 @@
"displayName" : "aes 5/27/2022 14:36",
"extent:" : "lra 6/12/2022 18:51",
"fillFromSVGSpec:" : "lra 6/12/2022 18:52",
"fullContainsPoint:" : "lra 6/12/2022 15:19",
"fullDrawOn:" : "lra 6/12/2022 19:19",
"fullContainsPoint:" : "lra 8/5/2022 15:58",
"fullDrawOn:" : "lra 8/5/2022 15:58",
"globalBoundingBox" : "aes 6/16/2022 16:29",
"globalTransform" : "lra 6/12/2022 18:51",
"handleBoundsChange:" : "lra 6/12/2022 15:34",
Expand All @@ -43,7 +43,7 @@
"svgContext" : "lra 6/12/2022 18:51",
"transform" : "lra 6/12/2022 16:11",
"transform:" : "lra 6/12/2022 16:11",
"transformFrom:" : "lra 6/12/2022 18:52",
"transformFrom:" : "lra 8/5/2022 15:59",
"transformFromSVGAttribute:" : "lra 6/12/2022 18:52",
"transformFromSVGAttributeStream:" : "lra 6/12/2022 17:38",
"transformFromSVGElement:" : "lra 6/12/2022 18:52",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ drawSubmorphsOn: aCanvas

(self composedStyle at: 'display')
ifFalse: [^ self].
aCanvas asBalloonCanvas preserveStateDuring:[:balloonCanvas|
aCanvas asBalloonCanvas preserveStateDuring: [:balloonCanvas |
balloonCanvas
aaLevel: 3.
super drawSubmorphsOn: balloonCanvas]
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"createPolylineFromSVGPolyline:" : "lra 6/12/2022 18:37",
"createRectFromSVGRect:" : "lra 6/12/2022 18:37",
"createTextFromSVGText:" : "lra 6/12/2022 18:37",
"drawSubmorphsOn:" : "lra 6/12/2022 18:37",
"drawSubmorphsOn:" : "lra 8/5/2022 16:01",
"fills" : "gvc 8/1/2005 13:29",
"fills:" : "gvc 8/1/2005 13:29",
"getFill:" : "lra 6/12/2022 18:36",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
helpers
containsPoint: aPoint

| semiMin semiMax center i lPoint |
|semiMin semiMax center i lPoint|
lPoint := self transform globalPointToLocal: aPoint.
(self bounds containsPoint: aPoint) ifFalse: [^ false].
semiMin := self rectangle width asFloat / 2 min: self rectangle height asFloat / 2.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ createRectangleFromSVG: anElement
"Create the bounding rectangle from the svg ellipse."

self rectangle: (Rectangle
center: (anElement attributeAt: 'cx' ifAbsent: [0]) asSVGNumber @ (anElement attributeAt: 'cy' ifAbsent: [0]) asSVGNumber
extent: (anElement attributeAt: 'rx' ifAbsent: [0]) asSVGNumber @ ((anElement attributeAt: 'ry' ifAbsent: [0]) asSVGNumber) * 2)
center: (anElement attributeAt: 'cx' ifAbsent: [0]) asSVGNumber @ (anElement attributeAt: 'cy' ifAbsent: [0]) asSVGNumber
extent: (anElement attributeAt: 'rx' ifAbsent: [0]) asSVGNumber @ ((anElement attributeAt: 'ry' ifAbsent: [0]) asSVGNumber) * 2)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
},
"instance" : {
"accept:" : "aes 5/16/2022 15:54",
"containsPoint:" : "AS 5/20/2022 16:06",
"createRectangleFromSVG:" : "AS 5/19/2022 15:54",
"containsPoint:" : "lra 8/5/2022 16:07",
"createRectangleFromSVG:" : "lra 8/5/2022 16:08",
"drawOn:" : "lra 6/12/2022 18:42",
"humanReadableClassName" : "aes 5/27/2022 14:29" } }
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
serializer
applyTransformOf: aMorph on: anXMLElement

| transform description temp |
|transform description temp|
transform := aMorph transform.
transform isIdentity
ifTrue: [^ self].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"applyStyleOf:on:" : "aes 6/19/2022 14:12",
"applyTSpanAttributesOf:on:" : "lra 6/12/2022 16:27",
"applyTextAttributesOf:on:" : "aes 5/23/2022 16:58",
"applyTransformOf:on:" : "lra 6/12/2022 18:53",
"applyTransformOf:on:" : "lra 8/5/2022 16:15",
"document" : "lra 6/12/2022 16:16",
"document:" : "lra 6/12/2022 16:57",
"exportOn:" : "nh 5/16/2022 16:12",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
helpers
computePixelRampOfSize: length

"Compute the pixel ramp in the receiver"
|bits lastColor lastIndex nextIndex nextColor distance theta ramp step lastWord nextWord|

ramp := self colorRamp asSortedCollection: [:a1 :a2| a1 key < a2 key].
|bits lastColor lastIndex nextIndex nextColor distance theta ramp step lastWord nextWord|
ramp := self colorRamp asSortedCollection: [:a1 :a2 | a1 key < a2 key].
bits := Bitmap new: length.
lastColor := ramp first value.
lastWord := lastColor pixelWord32.
lastIndex := 0.
ramp do: [:assoc|
ramp do: [:assoc |
nextIndex := (assoc key * length) rounded.
nextColor := assoc value.
nextWord := nextColor pixelWord32.
distance := nextIndex - lastIndex.
distance = 0 ifTrue: [distance := 1].
step := 1.0 / distance.
theta := 0.0.
lastIndex+1 to: nextIndex do: [:i|
lastIndex + 1 to: nextIndex do: [:i |
theta := theta + step.
bits at: i put: (self interpolatedAlphaMix: theta of: lastWord and: nextWord)].
lastIndex := nextIndex.
lastColor := nextColor.
lastWord := nextWord].
lastIndex+1 to: length do: [:i| bits at: i put: lastWord].
lastIndex + 1 to: length do: [:i | bits at: i put: lastWord].
^ bits
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"startFrom:" : "aes 8/5/2022 14:02",
"unitsFrom:" : "aes 8/5/2022 13:38" },
"instance" : {
"computePixelRampOfSize:" : "aes 6/19/2022 14:30",
"computePixelRampOfSize:" : "lra 8/5/2022 16:10",
"id" : "aes 6/19/2022 14:26",
"interpolatedAlphaMix:of:and:" : "lra 6/12/2022 16:37",
"mappedTo:" : "AS 6/19/2022 11:56",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ helpers
computeBounds

|box|
(self submorphs isNil or: [self submorphs isEmpty]) ifTrue:[^ self].
(self submorphs isNil or: [self submorphs isEmpty]) ifTrue: [^ self].
box := nil.
self submorphs do:[:m|
self submorphs do: [:m|
|subBounds|
subBounds := self transform localBoundsToGlobal: m bounds.
box
ifNil:[box := subBounds]
ifNotNil:[box := box quickMerge: subBounds].
].
ifNotNil:[box := box quickMerge: subBounds]].
box ifNil:[box := 0 @ 0 corner: 20 @ 20].
self
privateBounds: box;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
},
"instance" : {
"accept:" : "aes 5/14/2022 17:41",
"computeBounds" : "lra 6/12/2022 18:54",
"computeBounds" : "lra 8/5/2022 16:02",
"createFromSVG:" : "AS 5/19/2022 15:50",
"drawOn:" : "AS 5/19/2022 16:11",
"handlesMouseOver:" : "lra 6/12/2022 16:17",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ createRectangleFromSVG: anElement

self
rectangle: ((anElement attributeAt: 'x1' ifAbsent: [0]) asSVGNumber @ (anElement attributeAt: 'y1' ifAbsent: [0]) asSVGNumber
corner: (anElement attributeAt: 'x2' ifAbsent: [0]) asSVGNumber @ (anElement attributeAt: 'y2' ifAbsent: [0]) asSVGNumber)
corner: (anElement attributeAt: 'x2' ifAbsent: [0]) asSVGNumber @ (anElement attributeAt: 'y2' ifAbsent: [0]) asSVGNumber)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
},
"instance" : {
"accept:" : "aes 5/16/2022 17:25",
"createRectangleFromSVG:" : "lra 6/12/2022 16:42",
"createRectangleFromSVG:" : "lra 8/5/2022 16:08",
"drawOn:" : "lra 6/12/2022 18:42",
"humanReadableClassName" : "aes 5/27/2022 14:29" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ initialization
saveSVGBoundsInformation: anElement
"Store the original sizing information for a later export."

self svgWidth: (anElement attributeAt: 'width').
self svgHeight: (anElement attributeAt: 'height').
self viewBox: (anElement attributeAt: 'viewBox')
self
svgWidth: (anElement attributeAt: 'width');
svgHeight: (anElement attributeAt: 'height');
viewBox: (anElement attributeAt: 'viewBox')
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"handlesMouseOver:" : "lra 6/12/2022 16:19",
"humanReadableClassName" : "aes 5/27/2022 14:28",
"initialize" : "gvc 8/1/2005 13:42",
"saveSVGBoundsInformation:" : "aes 5/23/2022 15:53",
"saveSVGBoundsInformation:" : "lra 8/5/2022 16:03",
"setDimensionsFromSVG:" : "lra 6/12/2022 17:51",
"svgHeight" : "lra 6/12/2022 16:20",
"svgHeight:" : "lra 6/12/2022 16:54",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ computeBounds
[:s | self segments do: [:seg | seg controlPointsDo: [:point | s nextPut: point]]].
allPoints isEmpty ifTrue: [^ self].
self
privateBounds: ((Rectangle encompassing: allPoints) outsetBy: ((self composedStyle at: 'stroke-width')// 2));
privateBounds: ((Rectangle encompassing: allPoints) outsetBy: ((self composedStyle at: 'stroke-width') // 2));
privateFullBounds: self bounds
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"accept:" : "aes 5/23/2022 12:39",
"addSegment:" : "gvc 7/28/2005 15:40",
"adjustSegmentEnds" : "lra 6/12/2022 18:40",
"computeBounds" : "lra 6/12/2022 17:36",
"computeBounds" : "lra 8/5/2022 16:05",
"createArcSegmentFrom:at:" : "lra 6/12/2022 16:39",
"createClosingLineSegmentFrom:to:" : "lra 6/12/2022 18:40",
"createCubicBezierSegmentFrom:at:" : "lra 6/12/2022 18:40",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ createRectangleFromSVG: anElement

self
rectangle: ((anElement attributeAt: 'x' ifAbsent: [0]) asSVGNumber @ (anElement attributeAt: 'y' ifAbsent: [0]) asSVGNumber
extent: (anElement attributeAt: 'width') asSVGNumber @ (anElement attributeAt: 'height') asSVGNumber)
extent: (anElement attributeAt: 'width') asSVGNumber @ (anElement attributeAt: 'height') asSVGNumber)
Loading

0 comments on commit b59125d

Please sign in to comment.