Skip to content

Commit

Permalink
Merge pull request #73 from hpi-swa-teaching/code-reformatting
Browse files Browse the repository at this point in the history
reformatting done
  • Loading branch information
Ivenjs committed Jun 23, 2024
2 parents e8e3bf2 + f06572e commit bf87a4e
Show file tree
Hide file tree
Showing 28 changed files with 619 additions and 483 deletions.
16 changes: 10 additions & 6 deletions src/SqueakWhiteboard-Core/WBArrowhead.class.st
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
"
This class represents the arrow-part of a WBLine
"
Class {
#name : #WBArrowhead,
#superclass : #PolygonMorph,
#instVars : [
'isVisible'
],
#category : #'SqueakWhiteboard-Core'
#category : #'SqueakWhiteboard-Core',
#'squeak_changestamp' : 'is 6/23/2024 02:11'
}

{
#category : #defaults,
#'squeak_changestamp' : 'si 6/21/2024 00:29'
#'squeak_changestamp' : 'is 6/23/2024 01:28'
}
WBArrowhead class >> defaultVertecies [
WBArrowhead class >> defaultVertices [

^ {0@0. 20@10. 0@20}
]

{
#category : #initialization,
#'squeak_changestamp' : 'si 6/14/2024 12:48'
#'squeak_changestamp' : 'is 6/23/2024 01:28'
}
WBArrowhead >> initialize [

super initialize.
self
addFlexShellIfNecessary;
setVertices: self class defaultVertecies;
setVertices: self class defaultVertices;
fillStyle: Color black;
goBehind.
goBehind
]

{
Expand Down
24 changes: 12 additions & 12 deletions src/SqueakWhiteboard-Core/WBButton.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"
The WBButton is the parent class of all button versions
This class represents a generic button which takes in blocks that get executed on mouseUp
"
Class {
#name : #WBButton,
Expand All @@ -14,16 +14,16 @@ Class {
'currentEvent'
],
#category : #'SqueakWhiteboard-Core',
#'squeak_changestamp' : 'is 5/18/2024 17:13'
#'squeak_changestamp' : 'is 6/23/2024 02:12'
}

{
#category : #size,
#'squeak_changestamp' : 'si 5/23/2024 22:47'
#'squeak_changestamp' : 'is 6/23/2024 01:27'
}
WBButton class >> cornerRadius [

^20
^ 20
]

{
Expand Down Expand Up @@ -95,11 +95,11 @@ WBButton >> clickedColor [

{
#category : #accessing,
#'squeak_changestamp' : 'is 5/19/2024 16:08'
#'squeak_changestamp' : 'is 6/23/2024 01:15'
}
WBButton >> clickedColor: aColor [

clickedColor := aColor.
clickedColor := aColor
]

{
Expand Down Expand Up @@ -131,9 +131,9 @@ WBButton >> handlesMouseDown: anEvent [

{
#category : #'event handling',
#'squeak_changestamp' : 'is 5/27/2024 19:55'
#'squeak_changestamp' : 'is 6/23/2024 01:16'
}
WBButton >> handlesMouseOver: evt [
WBButton >> handlesMouseOver: anEvent [

^ true
]
Expand Down Expand Up @@ -196,11 +196,11 @@ WBButton >> margin [

{
#category : #accessing,
#'squeak_changestamp' : 'nicloeser 5/24/2024 14:57'
#'squeak_changestamp' : 'is 6/23/2024 01:16'
}
WBButton >> margin: aMargin [

margin := aMargin.
margin := aMargin

]

Expand All @@ -224,9 +224,9 @@ WBButton >> mouseEnter: evt [

{
#category : #'event handling',
#'squeak_changestamp' : 'si 6/14/2024 12:21'
#'squeak_changestamp' : 'is 6/23/2024 01:17'
}
WBButton >> mouseLeave: evt [
WBButton >> mouseLeave: anEvent [

self color: self backgroundColor
]
Expand Down
108 changes: 50 additions & 58 deletions src/SqueakWhiteboard-Core/WBCanvas.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"
The WBCanvas is the whiteboard on which the user can interact with its functionality
This class represents the whiteboard on which the user can interact with UI
"
Class {
#name : #WBCanvas,
Expand All @@ -17,16 +17,16 @@ Class {
'images'
],
#category : #'SqueakWhiteboard-Core',
#'squeak_changestamp' : 'is 5/17/2024 15:53'
#'squeak_changestamp' : 'is 6/23/2024 02:27'
}

{
#category : #accessing,
#'squeak_changestamp' : 'si 5/14/2024 11:08'
#'squeak_changestamp' : 'is 6/23/2024 01:27'
}
WBCanvas class >> WhiteBoardSize [

^800
^ 800
]

{
Expand Down Expand Up @@ -102,49 +102,40 @@ WBCanvas >> createDrawingSurface [

{
#category : #'creating elements',
#'squeak_changestamp' : 'si 6/3/2024 15:50'
#'squeak_changestamp' : 'is 6/23/2024 01:18'
}
WBCanvas >> deactivateElement [

self activeElement ifNotNil: [
self activeElement deactivateElement.
self activeElement ifNotNil:
[self activeElement deactivateElement.
self activeElement: nil]

]

{
#category : #'creating elements',
#'squeak_changestamp' : 'is 6/3/2024 18:29'
#'squeak_changestamp' : 'is 6/23/2024 01:18'
}
WBCanvas >> deactivateTextbox [

self activeTextbox ifNotNil: [
self activeTextbox deactivateTextbox.
self activeTextbox ifNotNil:
[self activeTextbox deactivateTextbox.
self activeTextbox: nil]

]

{
#category : #'handle elements',
#'squeak_changestamp' : 'si 6/14/2024 13:10'
#'squeak_changestamp' : 'is 6/23/2024 01:19'
}
WBCanvas >> deleteAllElements [
"maybe it could be cleaner but intuitive way didnt work"
| aCollection |

aCollection := self elements copy.
aCollection do: [:e | e delete].
self elements removeAll
]

{
#category : #drag,
#'squeak_changestamp' : 'si 6/14/2024 13:10'
}
WBCanvas >> dragEnd: anEvent [
"nötig?"
]

{
#category : #drag,
#'squeak_changestamp' : 'is 6/18/2024 16:33'
Expand Down Expand Up @@ -268,27 +259,27 @@ WBCanvas >> globalColor: aColor [

{
#category : #'event handling',
#'squeak_changestamp' : 'is 6/18/2024 16:36'
#'squeak_changestamp' : 'is 6/23/2024 01:23'
}
WBCanvas >> handlesMouseDown: evt [
WBCanvas >> handlesMouseDown: anEvent [

^ true
]

{
#category : #'event handling',
#'squeak_changestamp' : 'is 6/18/2024 16:36'
#'squeak_changestamp' : 'is 6/23/2024 01:23'
}
WBCanvas >> handlesMouseMove: evt [
WBCanvas >> handlesMouseMove: anEvent [

^ true
]

{
#category : #'event handling',
#'squeak_changestamp' : 'is 6/18/2024 16:36'
#'squeak_changestamp' : 'is 6/23/2024 01:23'
}
WBCanvas >> handlesMouseOver: evt [
WBCanvas >> handlesMouseOver: anEvent [

^ true
]
Expand All @@ -313,7 +304,7 @@ WBCanvas >> images: anImage [

{
#category : #initialization,
#'squeak_changestamp' : 'si 6/14/2024 13:18'
#'squeak_changestamp' : 'is 6/23/2024 01:27'
}
WBCanvas >> initialize [

Expand All @@ -322,7 +313,7 @@ WBCanvas >> initialize [
self
scale: 1.0;
height: (self class WhiteBoardSize * self scale);
width: (self class WhiteBoardSize * self scale * 1.5);
width: (self class WhiteBoardSize * self scale * self widthToHeightRatio);
color: Color white;
borderWidth: 1;
borderColor: Color black;
Expand All @@ -337,33 +328,25 @@ WBCanvas >> initialize [

{
#category : #'event handling',
#'squeak_changestamp' : 'si 6/8/2024 00:22'
#'squeak_changestamp' : 'is 6/23/2024 01:24'
}
WBCanvas >> mouseDown: anEvent [

self deactivateElement;
self
deactivateElement;
deactivateTextbox.
self toolbar deactivateElement.
(anEvent yellowButtonPressed) ifTrue: [self dragStart: anEvent]
]

{
#category : #'event handling',
#'squeak_changestamp' : 'is 6/18/2024 16:37'
#'squeak_changestamp' : 'is 6/23/2024 01:24'
}
WBCanvas >> mouseMove: anEvent [

(self elementToSpawn) ifNotNil: [ self elementToSpawn dragMove: anEvent ].
anEvent yellowButtonPressed ifTrue: [ self dragMove: anEvent ]
]

{
#category : #'event handling',
#'squeak_changestamp' : 'is 6/18/2024 16:37'
}
WBCanvas >> mouseUp: anEvent [

self dragEnd: anEvent
(self elementToSpawn) ifNotNil: [self elementToSpawn dragMove: anEvent].
anEvent yellowButtonPressed ifTrue: [self dragMove: anEvent]
]

{
Expand All @@ -386,34 +369,34 @@ WBCanvas >> scale: aFactor [

{
#category : #'creating elements',
#'squeak_changestamp' : 'ACL 6/7/2024 14:30'
#'squeak_changestamp' : 'is 6/23/2024 01:24'
}
WBCanvas >> spawnACopiedElement: anElement At: aPoint [

self elementToSpawn:
(anElement
center: aPoint;
dragOffset: anElement position - aPoint;
canvas: self;
addDropShadow;
yourself).
self addElement: anElement.
(anElement
center: aPoint;
dragOffset: anElement position - aPoint;
canvas: self;
addDropShadow;
yourself).
self addElement: anElement
]

{
#category : #'creating elements',
#'squeak_changestamp' : 'is 6/18/2024 22:38'
#'squeak_changestamp' : 'is 6/23/2024 01:25'
}
WBCanvas >> spawnAnElement: anElement At: aMouseEvent [

self elementToSpawn:
(anElement
center: aMouseEvent cursorPoint;
dragOffset: anElement position - aMouseEvent cursorPoint;
canvas: self;
color: self globalColor;
addDropShadow;
yourself).
(anElement
center: aMouseEvent cursorPoint;
dragOffset: anElement position - aMouseEvent cursorPoint;
canvas: self;
color: self globalColor;
addDropShadow;
yourself).
self addElement: anElement
]

Expand Down Expand Up @@ -445,3 +428,12 @@ WBCanvas >> toolbar: aToolbar [

toolbar := aToolbar
]

{
#category : #accessing,
#'squeak_changestamp' : 'is 6/23/2024 01:26'
}
WBCanvas >> widthToHeightRatio [

^ 1.5
]
4 changes: 2 additions & 2 deletions src/SqueakWhiteboard-Core/WBCircle.class.st
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"
The WBTemporaryButton is a placeholder for functionality that is coming later
This class represents a concrete circle element
"
Class {
#name : #WBCircle,
#superclass : #WBCircularElement,
#category : #'SqueakWhiteboard-Core',
#'squeak_changestamp' : 'is 5/17/2024 15:59'
#'squeak_changestamp' : 'is 6/23/2024 02:17'
}
6 changes: 5 additions & 1 deletion src/SqueakWhiteboard-Core/WBCircularElement.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"
This class represents all circular Elements
"
Class {
#name : #WBCircularElement,
#superclass : #WBElement,
#category : #'SqueakWhiteboard-Core'
#category : #'SqueakWhiteboard-Core',
#'squeak_changestamp' : 'is 6/23/2024 02:16'
}

{
Expand Down
Loading

0 comments on commit bf87a4e

Please sign in to comment.