Skip to content

Commit

Permalink
Improve styling (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sohn123 authored Jun 11, 2022
1 parent 530fc1a commit 46b2216
Show file tree
Hide file tree
Showing 326 changed files with 647 additions and 653 deletions.
38 changes: 38 additions & 0 deletions format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
files=$(find . -type f -name "*.st")

#Trailing whitespace
sed -i -e 's/[ \t]*$//' $files

#Point before parentheses
sed -i 's/\.)/)/g' $files
sed -i 's/\.]/]/g' $files
sed -i 's/\.}/}/g' $files

#Space before parentheses
sed -i 's/[ ]\+)/)/g' $files
sed -i 's/[ ]\+]/]/g' $files
sed -i 's/[ ]\+}/}/g' $files

#Space after parentheses
sed -i 's/\[[ ]\+/[/g' $files
sed -i 's/([ ]\+/(/g' $files
sed -i 's/{[ ]\+/{/g' $files

#Second Line is new line (Doesn't work with comments)
#sed -i '3,3s/[^"\S]\+/\n&/' $files

#Remove Space after and before |
sed -i -E 's/\|(\s)*(\S*)(\s)*\|/\|\2\|/g' $files

#Old syntax to new syntax
sed -i 's/_/:=/g' $files

#Spaces befor dots (To strict right now)
#sed -i 's/[ ]\+\./\./g' $files

#Spaces around @
sed -i 's/[ ]*@[ ]*/ @ /g' $files

#Dot after return consistency
sed -i '$s/\.$//' $files
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ baseline: spec
group: 'editor' with: #('SVG-Editor');
group: 'tests' with: #('Tests-SVG-Morphic' 'Tests-SVG-Editor');
group: 'mtf' with: #('MorphicTestingFramework');
group: 'swalinter' with: #('SwaLint');
yourself .
group: 'swalinter' with: #('SwaLint');
yourself
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
toolbuilder
buildAndOpen

| builder windowSpec |
builder := ToolBuilder default.
windowSpec := self buildWith: builder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ buildCloseButtonWith: aToolBuilder
help: 'Close the currently opened file';
enabled: #canCloseFile;
action: #actionCloseFile;
yourself
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ buildInfoPanelWith: aToolBuilder
^ aToolBuilder pluggableMultiColumnListSpec new
name: #infoPanel;
model: self model;
list: #infoForSelectedElement.

list: #infoForSelectedElement
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ buildOpenButtonWith: aToolBuilder
label: 'Open';
help: 'Open an SVG file for editing';
action: #actionOpenFile;
yourself
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ buildSaveButtonWith: aToolBuilder
help: 'Save the SVG to a file';
enabled: #canSaveFile;
action: #actionSaveFile;
yourself
yourself
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
toolbuilder
buildWith: aToolBuilder

| window |
|window|
window := self model buildWindowWith: aToolBuilder specs: {
(self switchesFrame) -> (self buildSwitchesWIth: aToolBuilder) .
(self panelDrawingFrame) -> (self buildDrawingAreaWith: aToolBuilder) .
(self treeFrame) -> (self buildTreeViewWith: aToolBuilder) .
(self treeFrame) -> (self buildTreeViewWith: aToolBuilder) .
(self infoPanelFrame) -> (self buildInfoPanelWith: aToolBuilder)
}.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ actionOpenFile
filename := self askOpenPath.
filename ifNil: [^ self].
stream := self getReadStreamForFileNamed: filename.

[self svg: (SVGMorph fromFileStream: stream)]
ensure: [stream close]
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
actions
actionSaveFile

| filename stream |
self canSaveFile ifFalse: [^self].

filename := self askSavePath.
filename ifNil: [^ self].
stream := self getWriteStreamForFileNamed: filename.

[SVGExporter new
visitSVGMorph: self svg;
exportOn: stream]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
displayNameOf: aNode

^ aNode displayName
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
accessing
selectElement: anElement

|current|
selectedPath := OrderedCollection new.
current := anElement.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
accessing
selectedElement: anObject

selectedElement := anObject.
self
self
changed: #selectedElement;
changed: #infoForSelectedElement
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
selectedElement

^ selectedElement
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
selectedPath

^ selectedPath
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ accessing
svg: anSVGMorph

anSVGMorph = self svg ifTrue: [^ self].

svg := anSVGMorph.
self
changed: #svg;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
accessing
for: aMorph

aMorph
aMorph
ifNil: [^ Array new].
^ aMorph accept: self new
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
initialize-release
initialize

self
self
keys: OrderedCollection new;
values: OrderedCollection new

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
helpers
readCircleAttributesOf: aCircle

self
self
at: 'Position' put: aCircle rectangle center asString;
at: 'Radius' put: (aCircle rectangle width / 2) asString
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
helpers
readCommonAttributesOf: aMorph

self
self
at: 'Type' put: aMorph humanReadableClassName;
at: 'ID' put: aMorph id;
readStylesOf: aMorph.

readStylesOf: aMorph
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
helpers
readEllipseAttributesOf: anEllipse

self
self
at: 'Position' put: anEllipse rectangle center asString;
at: 'Horizontal Radius' put: (anEllipse rectangle width / 2) asString;
at: 'Vertical Radius' put: (anEllipse rectangle height / 2) asString
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
helpers
readLineAttributesOf: aLine

self
self
at: 'Start' put: aLine rectangle origin asString;
at: 'End' put: aLine rectangle corner asString
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ helpers
readPointsOf: aPolygonalMorph

self at: 'Points' put: (aPolygonalMorph points joinSeparatedBy: ' ')

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
helpers
readRectangleAttributesOf: aRectangle

self
self
at: 'Position' put: aRectangle rectangle origin asString;
at: 'Width' put: (aRectangle rectangle width) asString;
at: 'Height' put: (aRectangle rectangle height) asString
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
helpers
readStylesOf: aMorph

aMorph style keysAndValuesDo: [ :key :value |
aMorph style keysAndValuesDo: [:key :value |
self at: key put: value asString]
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
visiting
visitSVGCircle: aCircle
^ self

^ self
readCommonAttributesOf: aCircle;
readCircleAttributesOf: aCircle;
asList

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
visiting
visitSVGEllipse: anEllipse
^ self

^ self
readCommonAttributesOf: anEllipse;
readEllipseAttributesOf: anEllipse;
asList
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
visiting
visitSVGGroup: aGroup
^ self

^ self
readCommonAttributesOf: aGroup;
asList
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
visiting
visitSVGLine: aLine
^ self

^ self
readCommonAttributesOf: aLine;
readLineAttributesOf: aLine;
asList
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
visiting
visitSVGMorph: aMorph

^ self
^ self
readCommonAttributesOf: aMorph;
asList
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
visiting
visitSVGPath: aPath
^ self

^ self
readCommonAttributesOf: aPath;
asList
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
visiting
visitSVGPolygon: aPolygon

^ self
^ self
readCommonAttributesOf: aPolygon;
readPointsOf: aPolygon;
asList
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
visiting
visitSVGPolyline: aPolyline

^ self
^ self
readCommonAttributesOf: aPolyline;
readPointsOf: aPolyline;
asList
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
visiting
visitSVGRectangle: aRectangle
^ self

^ self
readCommonAttributesOf: aRectangle;
readRectangleAttributesOf: aRectangle;
asList
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
visiting
visitSVGTSpan: aTSpan

^ self
^ self
readCommonAttributesOf: aTSpan;
readTextAttributesOf: aTSpan;
asList
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
visiting
visitSVGText: aText

^ self
^ self
readCommonAttributesOf: aText;
readTextAttributesOf: aText;
asList
4 changes: 2 additions & 2 deletions packages/SVG-Editor.package/SVGPanel.class/instance/model..st
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
accessing
model: anObject

self model = anObject ifTrue: [^ self].

self model ifNotNil: [self model removeDependent: self].
model := anObject.
self model addDependent: self
Loading

0 comments on commit 46b2216

Please sign in to comment.