Skip to content

Commit

Permalink
feature finished
Browse files Browse the repository at this point in the history
  • Loading branch information
simonimmelmann committed Jul 5, 2024
1 parent 1554ac5 commit f69f469
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 76 deletions.
22 changes: 22 additions & 0 deletions src/SqueakWhiteboard-Core/WBEdgeOfLine.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,28 @@ WBEdgeOfLine >> line: aLine [
line := aLine
]

{
#category : #'button creation',
#'squeak_changestamp' : 'si 7/5/2024 11:52'
}
WBEdgeOfLine >> makeColorButtons [

^ OrderedCollection new
add: (self makeColorButtonWithColor: Color black);
add: (self makeColorButtonWithColor: Color gray darker);
add: (self makeColorButtonWithColor: Color gray lighter);
add: (self makeColorButtonWithColor: Color red);
add: (self makeColorButtonWithColor: Color orange);
add: (self makeColorButtonWithColor: Color yellow);
add: (self makeColorButtonWithColor: Color green);
add: (self makeColorButtonWithColor: Color cyan);
add: (self makeColorButtonWithColor: Color blue);
add: (self makeColorButtonWithColor: Color ocean);
add: (self makeColorButtonWithColor: Color magenta);
add: (self makeColorButtonWithColor: Color magenta muchDarker);
yourself
]

{
#category : #'event handling',
#'squeak_changestamp' : 'si 6/14/2024 11:46'
Expand Down
86 changes: 69 additions & 17 deletions src/SqueakWhiteboard-Core/WBElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,25 @@ WBElement >> buttonFunctionalityForDelete [
^ [:aButton | self delete]
]

{
#category : #'button functionalities',
#'squeak_changestamp' : 'si 7/5/2024 11:18'
}
WBElement >> buttonFunctionalityForTransparentBorderColor [

^ [:aButton | self morph borderColor: Color transparent.
self morph borderWidth: 3]
]

{
#category : #'button functionalities',
#'squeak_changestamp' : 'si 7/5/2024 11:15'
}
WBElement >> buttonFunctionalityForTransparentColor [

^ [:aButton |self morph color: Color transparent]
]

{
#category : #'button creation',
#'squeak_changestamp' : 'ACL 6/23/2024 15:51'
Expand Down Expand Up @@ -554,20 +573,23 @@ WBElement >> makeBorderColorButtonWithColor: aColor [

{
#category : #'button creation',
#'squeak_changestamp' : 'ACL 6/23/2024 15:54'
#'squeak_changestamp' : 'si 7/5/2024 11:44'
}
WBElement >> makeBorderColorButtons [

^ OrderedCollection new
add: (self makeBorderColorButtonWithColor: Color yellow);
add: (self makeBorderColorButtonWithColor: Color orange);
add: (self makeBorderColorButtonWithColor: Color black);
add: (self makeBorderColorButtonWithColor: Color gray);
add: (self makeTransparentBorderColorButton);
add: (self makeBorderColorButtonWithColor: Color red);
add: (self makeBorderColorButtonWithColor: Color magenta);
add: (self makeBorderColorButtonWithColor: Color blue);
add: (self makeBorderColorButtonWithColor: Color cyan);
add: (self makeBorderColorButtonWithColor: Color orange);
add: (self makeBorderColorButtonWithColor: Color yellow);
add: (self makeBorderColorButtonWithColor: Color green);
add: (self makeBorderColorButtonWithColor: Color gray);
add: (self makeBorderColorButtonWithColor: Color black);
add: (self makeBorderColorButtonWithColor: Color cyan);
add: (self makeBorderColorButtonWithColor: Color blue);
add: (self makeBorderColorButtonWithColor: Color ocean);
add: (self makeBorderColorButtonWithColor: Color magenta);
add: (self makeBorderColorButtonWithColor: Color magenta muchDarker);
yourself
]

Expand All @@ -587,21 +609,23 @@ WBElement >> makeColorButtonWithColor: aColor [

{
#category : #'button creation',
#'squeak_changestamp' : 'si 7/4/2024 12:59'
#'squeak_changestamp' : 'si 7/5/2024 11:42'
}
WBElement >> makeColorButtons [

^ OrderedCollection new
add: (self makeColorButtonWithColor: Color yellow);
add: (self makeColorButtonWithColor: Color orange);
add: (self makeColorButtonWithColor: Color black);
add: (self makeColorButtonWithColor: Color gray);
add: (self makeTransparentColorButton);
add: (self makeColorButtonWithColor: Color red);
add: (self makeColorButtonWithColor: Color magenta);
add: (self makeColorButtonWithColor: Color blue);
add: (self makeColorButtonWithColor: Color cyan);
add: (self makeColorButtonWithColor: Color orange);
add: (self makeColorButtonWithColor: Color yellow);
add: (self makeColorButtonWithColor: Color green);
add: (self makeColorButtonWithColor: Color gray);
add: (self makeColorButtonWithColor: Color black);
add: (WBButton new);
add: (self makeColorButtonWithColor: Color cyan);
add: (self makeColorButtonWithColor: Color blue);
add: (self makeColorButtonWithColor: Color ocean);
add: (self makeColorButtonWithColor: Color magenta);
add: (self makeColorButtonWithColor: Color magenta muchDarker);
yourself
]

Expand Down Expand Up @@ -634,6 +658,34 @@ WBElement >> makePopWith: aCollection columns: aNumber [

]

{
#category : #'button creation',
#'squeak_changestamp' : 'si 7/5/2024 11:18'
}
WBElement >> makeTransparentBorderColorButton [

^ WBButton new
color: Color white;
backgroundColor: Color white;
clickedColor: Color white muchDarker;
block: self buttonFunctionalityForTransparentBorderColor;
yourself
]

{
#category : #'button creation',
#'squeak_changestamp' : 'si 7/5/2024 11:18'
}
WBElement >> makeTransparentColorButton [

^ WBButton new
color: Color white;
backgroundColor: Color white;
clickedColor: Color white muchDarker;
block: self buttonFunctionalityForTransparentColor;
yourself
]

{
#category : #private,
#'squeak_changestamp' : 'is 6/18/2024 17:32'
Expand Down
74 changes: 15 additions & 59 deletions src/SqueakWhiteboard-Tests/WBElementPopUpTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ WBElementPopUpTests >> testExistenceOfPopUp [

{
#category : #tests,
#'squeak_changestamp' : 'is 7/1/2024 22:40'
#'squeak_changestamp' : 'si 7/5/2024 12:01'
}
WBElementPopUpTests >> testFunctionalityOfBorderColor [
| element mouseEvent buttonForColor |
Expand All @@ -58,41 +58,19 @@ WBElementPopUpTests >> testFunctionalityOfBorderColor [
element mouseDown: mouseEvent.
(element popUp submorphs at: 1) clickFunctionality: mouseEvent.

self assert: element popUp popUp submorphs size = 12.

buttonForColor := element popUp popUp submorphs at: 1.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color black.

buttonForColor := element popUp popUp submorphs at: 2.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color gray.

buttonForColor := element popUp popUp submorphs at: 3.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color green.

buttonForColor := element popUp popUp submorphs at: 4.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color cyan.

buttonForColor := element popUp popUp submorphs at: 5.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color blue.
self assert: element morph borderColor = Color magenta muchDarker.

buttonForColor := element popUp popUp submorphs at: 6.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color magenta.

buttonForColor := element popUp popUp submorphs at: 7.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color red.

buttonForColor := element popUp popUp submorphs at: 8.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color orange.
self assert: element morph borderColor = Color green.

buttonForColor := element popUp popUp submorphs at: 9.
buttonForColor := element popUp popUp submorphs at: 10.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element morph borderColor = Color yellow
self assert: element morph borderColor = Color transparent.
]

{
Expand All @@ -117,7 +95,7 @@ WBElementPopUpTests >> testFunctionalityOfBorderColorPopUp [

{
#category : #tests,
#'squeak_changestamp' : 'is 7/1/2024 22:40'
#'squeak_changestamp' : 'si 7/5/2024 11:59'
}
WBElementPopUpTests >> testFunctionalityOfColor [
| element mouseEvent buttonForColor |
Expand All @@ -130,43 +108,21 @@ WBElementPopUpTests >> testFunctionalityOfColor [
element := self canvas elements at: 1.

element mouseDown: mouseEvent.
(element popUp submorphs at: 2) clickFunctionality: mouseEvent.
(element popUp submorphs at: 2) clickFunctionality: mouseEvent.

self assert: element popUp popUp submorphs size = 12.

buttonForColor := element popUp popUp submorphs at: 1.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color black.

buttonForColor := element popUp popUp submorphs at: 2.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color gray.

buttonForColor := element popUp popUp submorphs at: 3.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color green.

buttonForColor := element popUp popUp submorphs at: 4.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color cyan.

buttonForColor := element popUp popUp submorphs at: 5.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color blue.
self assert: element color = Color magenta muchDarker.

buttonForColor := element popUp popUp submorphs at: 6.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color magenta.

buttonForColor := element popUp popUp submorphs at: 7.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color red.

buttonForColor := element popUp popUp submorphs at: 8.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color orange.
self assert: element color = Color green.

buttonForColor := element popUp popUp submorphs at: 9.
buttonForColor := element popUp popUp submorphs at: 10.
buttonForColor clickFunctionality: (MouseButtonEvent new position: self canvas position + (100@100)).
self assert: element color = Color yellow
self assert: element color = Color transparent.
]

{
Expand Down

0 comments on commit f69f469

Please sign in to comment.