Skip to content

Commit

Permalink
changed magic numbers to default values in some ui classes
Browse files Browse the repository at this point in the history
  • Loading branch information
gitjannes committed Jul 11, 2024
1 parent 3180b3d commit ea74649
Show file tree
Hide file tree
Showing 58 changed files with 174 additions and 92 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultBorderWidth

^ 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultCellInset

^ 8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultLayoutInset

^ 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultMenuHeight

^ 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultMenuWidth

^ 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultOpacity

^ 0.8
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ drawing
addFileButton

self fileButton: (TCUButton new
extent: 100 @ 30;
text: 'Select File';
on: #mouseUp send: #buttonFileSelectPressed to: self chatWindow;
name: 'selectFile';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ drawing
addPollButton

self pollButton: (TCUButton new
extent: 100 @ 30;
text: '|||';
on: #mouseUp send: #createPollEditor to: self chatWindow;
name: 'openPollEditor';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ drawing
addStickerButton

self stickerButton: (TCUButton new
extent: 100 @ 30;
text: 'Sticker';
on: #mouseUp send: #buttonStickerPressed to: self chatWindow;
name: 'sendSticker';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ createButtonMenu

self buttonMenu: (RectangleMorph new
color: TCUDefaultValues colorNileBlue;
extent: 200@200;
extent: self class defaultMenuWidth @ (self class defaultMenuHeight);
useRoundedCorners;
layoutPolicy: TableLayout new;
listDirection: #leftToRight;
wrapDirection: #bottomToTop;
wrapCentering: #topLeft;
layoutInset: 2;
layoutInset: self class defaultLayoutInset;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
cellInset: 8;
cellInset: self class defaultCellInset;
yourself).
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ initialize
super initialize.

self
color: (TCUDefaultValues colorLightGray alpha: 0.8);
borderWidth: 0;
color: (TCUDefaultValues colorLightGray alpha: self class defaultOpacity);
borderWidth: self class defaultBorderWidth;
on: #mouseUp send: #clear to: self.
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
{
"class" : {
"defaultBorderWidth" : "jkon 7/11/2024 15:25",
"defaultCellInset" : "jkon 7/11/2024 15:23",
"defaultLayoutInset" : "jkon 7/11/2024 15:22",
"defaultMenuHeight" : "jkon 7/11/2024 15:20",
"defaultMenuWidth" : "jkon 7/11/2024 15:20",
"defaultOpacity" : "jkon 7/11/2024 15:24",
"newFor:withBounds:from:" : "jkon 7/5/2024 09:30" },
"instance" : {
"addButtonMenu" : "jkon 7/5/2024 09:30",
"addFileButton" : "jkon 7/4/2024 22:43",
"addPollButton" : "jkon 7/4/2024 22:43",
"addStickerButton" : "jkon 7/4/2024 22:43",
"addFileButton" : "jkon 7/11/2024 15:18",
"addPollButton" : "jkon 7/11/2024 15:18",
"addStickerButton" : "jkon 7/11/2024 15:18",
"buttonMenu" : "jkon 7/4/2024 22:11",
"buttonMenu:" : "jkon 7/4/2024 22:11",
"chat" : "jkon 7/4/2024 22:06",
"chat:" : "jkon 7/4/2024 22:06",
"chatWindow" : "jkon 7/4/2024 22:42",
"chatWindow:" : "jkon 7/4/2024 22:43",
"clear" : "jkon 7/4/2024 22:09",
"createButtonMenu" : "jkon 7/4/2024 22:13",
"createButtonMenu" : "jkon 7/11/2024 15:23",
"fileButton" : "jkon 7/4/2024 22:06",
"fileButton:" : "jkon 7/4/2024 22:06",
"initialize" : "jkon 7/4/2024 22:08",
"initialize" : "jkon 7/11/2024 15:25",
"pollButton" : "jkon 7/4/2024 22:06",
"pollButton:" : "jkon 7/4/2024 22:06",
"stickerButton" : "jkon 7/4/2024 22:06",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultBorderWidth

^ 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultPhotoPageSizeMultiplicator

^ 0.9
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ addHiddenPhotoPage

self chat hasPhoto ifTrue: [
self
photoPage: (TCUChatPhotoPage newWithBounds: self bounds andPhoto: self photo andSize: (self width * 0.9));
photoPage: (TCUChatPhotoPage newWithBounds: self bounds andPhoto: self photo andSize: (self width * self class defaultPhotoPageSizeMultiplicator));
addMorphFront: self photoPage.

self photoPage hide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ drawing
createContentWrapper

self contentWrapper: (RectangleMorph new
borderWidth: 0;
"color: Color red;"
borderWidth: self class defaultBorderWidth;
color: Color transparent;
width: self width * self class defaultContentWidthPercentage;
height: self height - self class defaultInfoBarHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ drawing
createDescription

self description: (RectangleMorph new
borderWidth: 0;
borderWidth: self class defaultBorderWidth;
color: Color white;
layoutPolicy: TableLayout new;
listDirection: #topToBottom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ drawing
createInfoBar

self infoBar: (RectangleMorph new
borderWidth: 0;
borderWidth: self class defaultBorderWidth;
color: Color white;
width: self width;
height: self class defaultInfoBarHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ drawing
createTitle

self title: (RectangleMorph new
borderWidth: 0;
borderWidth: self class defaultBorderWidth;
color: Color white;
layoutPolicy: TableLayout new;
listDirection: #topToBottom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ initialize

self
color: TCUDefaultValues colorLightGray;
borderWidth: 0.
borderWidth: self class defaultBorderWidth.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"class" : {
"defaultBorderWidth" : "jkon 7/11/2024 15:28",
"defaultContentInset" : "RS 5/29/2021 18:32",
"defaultContentLayoutInset" : "RS 5/29/2021 18:49",
"defaultContentWidthPercentage" : "RS 5/29/2021 18:49",
"defaultHeight" : "jkon 5/15/2024 12:25",
"defaultInfoBarHeight" : "RS 5/20/2021 21:30",
"defaultPhotoPageSizeMultiplicator" : "jkon 7/11/2024 15:27",
"defaultPhotoSize" : "jkon 5/15/2024 11:14",
"defaultSpacing" : "RS 5/20/2021 20:57",
"newFor:withBounds:" : "jkon 5/22/2024 10:39" },
Expand All @@ -13,7 +15,7 @@
"addContent" : "jkon 5/22/2024 10:53",
"addDescription" : "jkon 5/15/2024 11:36",
"addDescriptionText" : "RK 8/4/2021 12:05",
"addHiddenPhotoPage" : "jkon 5/22/2024 10:41",
"addHiddenPhotoPage" : "jkon 7/11/2024 15:27",
"addInfoBar" : "RS 5/20/2021 21:28",
"addInfoText" : "jkon 5/15/2024 11:04",
"addPhoto" : "jkon 5/22/2024 10:26",
Expand All @@ -27,15 +29,15 @@
"chat:" : "RS 5/29/2021 18:46",
"contentWrapper" : "RS 5/29/2021 18:46",
"contentWrapper:" : "RK 8/4/2021 10:25",
"createContentWrapper" : "jkon 5/15/2024 11:53",
"createDescription" : "RS 5/29/2021 18:32",
"createInfoBar" : "RS 5/20/2021 21:31",
"createTitle" : "jkon 5/22/2024 10:54",
"createContentWrapper" : "jkon 7/11/2024 15:29",
"createDescription" : "jkon 7/11/2024 15:31",
"createInfoBar" : "jkon 7/11/2024 15:31",
"createTitle" : "jkon 7/11/2024 15:31",
"description" : "RS 5/29/2021 18:46",
"description:" : "RK 8/4/2021 10:26",
"infoBar" : "RS 5/20/2021 21:38",
"infoBar:" : "RK 8/4/2021 10:39",
"initialize" : "RS 5/20/2021 20:39",
"initialize" : "jkon 7/11/2024 15:31",
"photo" : "jkon 5/22/2024 10:19",
"photo:" : "jkon 5/22/2024 10:19",
"photoPage" : "jkon 5/15/2024 15:05",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultBorderWidth

^ 0
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ initialize
self
color: TCUDefaultValues colorNileBlue;
on: #mouseDown send: #hide to: self;
borderWidth: 0.
borderWidth: self class defaultBorderWidth.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"class" : {
"defaultBorderWidth" : "jkon 7/11/2024 15:32",
"newWithBounds:andPhoto:andSize:" : "jkon 5/22/2024 10:27" },
"instance" : {
"addPhoto" : "jkon 5/22/2024 10:21",
"initialize" : "jkon 5/15/2024 15:11",
"initialize" : "jkon 7/11/2024 15:32",
"photo" : "jkon 5/22/2024 10:30",
"photo:" : "jkon 5/22/2024 10:31",
"photoSize" : "jkon 5/15/2024 15:00",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultBorderWidth

^ 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultCellInset

^ 8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultFieldHeight

^ 20
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultInputFieldBorderWidth

^ 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultInputFieldWidth

^ 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultLayoutInset

^ 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultTextFieldWidth

^ 20
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultTypeOptionHeight

^ 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultTypeOptionWidth

^ 200
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ addInputFieldFor: aRectangle

|inputField|
inputField := (TextMorph new
borderWidth: 2;
borderWidth: self class defaultInputFieldBorderWidth;
borderColor: TCUDefaultValues colorLightBlue;
color: Color white;
contentsWrapped: '' asText;
extent: 200 @ 20;
extent: self class defaultInputFieldWidth @ (self class defaultFieldHeight);
yourself).
self allInputFields add: inputField.
aRectangle addMorph: inputField.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ addTextFieldFor: aRectangle with: aString
|text|
text := (TextMorph new
contents: aString;
extent: 20 @ 20;
extent: self class defaultTextFieldWidth @ (self class defaultFieldHeight);
readOnly: true;
color: Color white;
lock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ addTextInputFor: aString

| morph|
morph := (RectangleMorph new
borderWidth: 0;
borderWidth: self class defaultBorderWidth;
color: TCUDefaultValues colorNileBlue;
layoutPolicy: TableLayout new;
listDirection: #leftToRight;
wrapDirection: #leftToRight;
wrapCentering: #topLeft;
layoutInset: 2;
layoutInset: self class defaultLayoutInset;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
yourself).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ createTypeOption
self typeOption:
(RectangleMorph new
color: TCUDefaultValues colorNileBlue;
extent: 200@200;
extent: self class defaultTypeOptionWidth @ (self class defaultTypeOptionHeight);
useRoundedCorners;
layoutPolicy: TableLayout new;
listDirection: #leftToRight;
wrapDirection: #bottomToTop;
wrapCentering: #topLeft;
layoutInset: 2;
layoutInset: self class defaultLayoutInset;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
cellInset: 8;
cellInset: self class defaultCellInset;
yourself).
Loading

0 comments on commit ea74649

Please sign in to comment.