Skip to content

Commit

Permalink
replace squeak icons with material icons (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
mschroederi committed Jul 10, 2018
1 parent bc73959 commit 8fd81cf
Show file tree
Hide file tree
Showing 29 changed files with 134 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
drawing
defaultHeight

^ self class defaultHeight
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
drawing
updateBounds

self bounds: (self bounds origin extent: self calculateWidth @ self class defaultHeight)
self bounds: (self bounds origin extent: self calculateWidth @ self defaultHeight)
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"calculateWidthByText" : "mats 6/21/2018 11:31",
"checkToggled" : "mats 7/3/2018 13:09",
"decreaseSize" : "mats 5/22/2018 11:06",
"defaultHeight" : "mats 7/10/2018 12:45",
"disable" : "CG 7/1/2018 11:11",
"drawOn:" : "JW 6/15/2018 12:46",
"drop" : "CG 7/1/2018 11:12",
Expand Down Expand Up @@ -61,7 +62,7 @@
"toggleOff" : "JW 6/15/2018 12:39",
"toggleOn" : "mats 7/3/2018 13:09",
"toggled:" : "JW 6/15/2018 12:34",
"updateBounds" : "mats 6/19/2018 12:03",
"updateBounds" : "mats 7/10/2018 12:45",
"updateContents:" : "CG 7/1/2018 11:36",
"updateIcon" : "LS 6/10/2018 17:42",
"updateIconColor:" : "LS 6/10/2018 15:33",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
updateBounds

self width: self class defaultHeight.
self height: self class defaultHeight
self width: self defaultHeight.
self height: self defaultHeight
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"initialize" : "Max 5/23/2018 12:01",
"mouseEnter:" : "LS 5/28/2018 22:00",
"mouseLeave:" : "LS 5/28/2018 22:00",
"updateBounds" : "LS 6/12/2018 09:22" } }
"updateBounds" : "mats 7/10/2018 12:45" } }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
listItemHeight

^ 48
^ MDListItem defaultHeight
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
listItemHeightDense

^ MDListItem denseHeight
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
denseLayout: aBoolean

^ self setProperty: #denseLayout to: aBoolean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
firstVisibleItem

^ (((self scrollOffset / (self class listItemHeight + self listItemPadding)) floor + 1) max: 1) min: self filteredListItems size
^ (((self scrollOffset / (self listItemHeight + self listItemPadding)) floor + 1) max: 1) min: self filteredListItems size
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ globalPositionToIndex: aPoint

| position index |
position := aPoint - self position + self scrollOffset.
index := (position y / (self class listItemHeight + self listItemPadding)) ceiling.
index := (position y / (self listItemHeight + self listItemPadding)) ceiling.

^ index
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
drawing
hasDenseLayout

^ self properties at: #denseLayout ifAbsent: [^ self setProperty: #denseLayout to: false]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
lastVisibleItem

^ (self firstVisibleItem + ((self height / (self class listItemHeight + self listItemPadding)) ceiling - 1)) min: self filteredListItems size
^ (self firstVisibleItem + ((self height / (self listItemHeight + self listItemPadding)) ceiling - 1)) min: self filteredListItems size
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
listItemHeight

self hasDenseLayout
ifTrue: [^ self class listItemHeightDense]
ifFalse: [^ self class listItemHeight]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
event handling
listItemHeightWithPadding

^ self class listItemHeight + self listItemPadding
^ self listItemHeight + self listItemPadding
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
drawing
relativePositionOfItemAt: aRow

^ (0 @ (self class listItemHeight + self listItemPadding) * (aRow - 1))
^ (0 @ (self listItemHeight + self listItemPadding) * (aRow - 1))
18 changes: 11 additions & 7 deletions packages/Material-Core.package/MDList.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"class" : {
"defaultDividerPadding" : "mats 6/1/2018 23:29",
"defaultListItemPadding" : "mats 6/1/2018 15:57",
"listItemHeight" : "mats 6/4/2018 17:03",
"listItemHeight" : "mats 7/10/2018 12:43",
"listItemHeightDense" : "mats 7/10/2018 12:43",
"scrollDelta" : "mats 5/30/2018 14:13" },
"instance" : {
"addListItem:" : "LS 6/28/2018 20:53",
Expand All @@ -11,6 +12,7 @@
"backgroundColor:" : "mats 5/31/2018 09:35",
"contentHeight" : "LS 6/28/2018 17:26",
"createDivider" : "mats 6/8/2018 14:51",
"denseLayout:" : "mats 7/10/2018 12:48",
"divider" : "mats 6/8/2018 15:24",
"divider:" : "mats 6/8/2018 14:52",
"dividersDrawable:" : "LS 6/28/2018 21:14",
Expand All @@ -27,26 +29,28 @@
"filterTerm" : "LS 6/28/2018 09:30",
"filteredListItems" : "CG 7/1/2018 12:07",
"filteredListItems:" : "CG 7/1/2018 12:07",
"firstVisibleItem" : "LS 6/28/2018 17:37",
"firstVisibleItem" : "mats 7/10/2018 12:51",
"forVisibleItemIndicesDo:" : "LS 6/28/2018 17:37",
"globalBoundsOfLabelOfItem:at:" : "LS 7/10/2018 12:15",
"globalPositionOfFirstVisibleItem" : "LS 6/28/2018 17:37",
"globalPositionOfItemAt:" : "LS 7/10/2018 12:15",
"globalPositionToIndex:" : "mats 6/14/2018 12:06",
"globalPositionOfItemAt:" : "LS 6/28/2018 17:36",
"globalPositionToIndex:" : "mats 7/10/2018 12:51",
"globalPositionToPositionInListItem:" : "mats 6/14/2018 12:07",
"handlesMouseDown:" : "mats 5/30/2018 11:46",
"handlesMouseMove:" : "mats 5/30/2018 13:19",
"handlesMouseOver:" : "mats 5/30/2018 18:38",
"handlesMouseUp:" : "mats 5/30/2018 11:46",
"handlesMouseWheel:" : "mats 5/29/2018 21:43",
"hasDenseLayout" : "mats 7/10/2018 12:49",
"hasFilter" : "CG 7/1/2018 12:08",
"ifInBounds:do:" : "mats 7/3/2018 15:30",
"initialize" : "mats 6/8/2018 15:04",
"lastKeystrokes" : "CG 7/1/2018 12:08",
"lastKeystrokes:" : "CG 7/1/2018 12:08",
"lastVisibleItem" : "LS 6/28/2018 17:37",
"lastVisibleItem" : "mats 7/10/2018 12:51",
"layoutChanged" : "mats 6/8/2018 15:25",
"listItemHeightWithPadding" : "mats 6/14/2018 12:06",
"listItemHeight" : "mats 7/10/2018 12:51",
"listItemHeightWithPadding" : "mats 7/10/2018 12:51",
"listItemPadding" : "mats 6/1/2018 16:00",
"listItemPadding:" : "mats 6/1/2018 15:58",
"listItems" : "mats 6/8/2018 15:25",
Expand All @@ -58,7 +62,7 @@
"mouseUp:" : "mats 7/3/2018 15:18",
"newSelectedItem:" : "JW 6/21/2018 01:03",
"relativePositionOfFirstVisibleItem" : "LS 6/28/2018 17:37",
"relativePositionOfItemAt:" : "LS 7/10/2018 12:16",
"relativePositionOfItemAt:" : "mats 7/10/2018 12:51",
"removeFilter" : "mats 7/10/2018 11:17",
"removeLastKeystroke" : "LS 6/28/2018 21:06",
"removeListItem:" : "CG 7/1/2018 12:09",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default properties
denseHeight

^ 36
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
defaultHeight

self hasDenseLayout
ifTrue: [^ self class denseHeight]
ifFalse: [^ self class defaultHeight]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
as yet unclassified
denseLayout: aBoolean

| value |
value := self setProperty: #denseLayout to: aBoolean.
self height: self defaultHeight.

^ value
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
hasDenseLayout

^ self properties at: #denseLayout ifAbsent: [^ self setProperty: #denseLayout to: false]
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"defaultHeight" : "mats 6/4/2018 17:03",
"defaultIconPadding" : "mats 6/5/2018 08:26",
"defaultTextPadding" : "mats 6/5/2018 09:11",
"denseHeight" : "mats 7/10/2018 12:43",
"newOnList:" : "mats 5/30/2018 11:58",
"textColorSelected" : "mats 7/3/2018 14:43" },
"instance" : {
Expand All @@ -16,9 +17,12 @@
"changed" : "mats 6/1/2018 15:11",
"checkToggled" : "mats 7/3/2018 14:44",
"containsPoint:" : "mats 6/28/2018 00:15",
"defaultHeight" : "mats 7/10/2018 12:53",
"denseLayout:" : "mats 7/10/2018 12:57",
"deselect" : "mats 7/3/2018 14:46",
"formCache" : "mats 6/8/2018 15:32",
"formCache:" : "mats 6/8/2018 15:32",
"hasDenseLayout" : "mats 7/10/2018 12:47",
"initialize" : "mats 7/9/2018 22:45",
"isSelected" : "mats 7/3/2018 14:40",
"labelBounds" : "LS 6/28/2018 15:25",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
as yet unclassified
toolIconsToMaterialIcons

^ Dictionary new
at: (ToolIcons abstract storeString) put: nil;
at: (ToolIcons arrowDown storeString) put: #ic_expand_more;
at: (ToolIcons arrowUp storeString) put: #ic_expand_less;
at: (ToolIcons arrowUpAndDown storeString) put: #ic_unfold_more;
at: (ToolIcons blank storeString) put: #ic_blank;
at: (ToolIcons breakpoint storeString) put: nil;
at: (ToolIcons checkmark storeString) put: nil;
at: (ToolIcons collection storeString) put: #ic_bubble_chart;
at: (ToolIcons exception storeString) put: nil;
at: (ToolIcons flag storeString) put: #ic_flag;
at: (ToolIcons magnitude storeString) put: #ic_functions;
at: (ToolIcons morph storeString) put: #ic_dashboard;
at: (ToolIcons no storeString) put: #ic_remove_circle;
at: (ToolIcons notOverridden storeString) put: nil;
at: (ToolIcons primitive storeString) put: nil;
at: (ToolIcons stream storeString) put: #ic_input;
at: (ToolIcons string storeString) put: #ic_title;
at: (ToolIcons testGray storeString) put: nil;
at: (ToolIcons testGreen storeString) put: #ic_check_box;
at: (ToolIcons testOrange storeString) put: #ic_error_outline;
at: (ToolIcons testRed storeString) put: #ic_cancel;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
getMaterialIconFrom: aForm

^ self class toolIconsToMaterialIcons at: (aForm storeString) ifAbsent: [^ nil]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
initialize

super initialize.
self denseLayout: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
keystrokeActionSelector

^ keystrokeActionSelector
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
accessing
update: aSymbol

Transcript show: aSymbol asString, Character cr.
(aSymbol == #messageList or: aSymbol == #relabel)
ifTrue: [self changed]
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ updateList

self listItems removeAll.
1 to: self listCollection size do: [:num |
| text icon |
| text icon listItem |
text := self listCollection at: num.
self getIconSelector
ifNotNil: [icon := self model perform: self getIconSelector with: num].

self flag: #TODO. "set correct icons"

self addListItem: (
(MDListItem newOnList: self)
ifNotNil: [icon := self getMaterialIconFrom: (self model perform: self getIconSelector with: num)].

listItem := (MDListItem newOnList: self)
text: text;
denseLayout: self hasDenseLayout;
target: [
((self model perform: self selected) = 0)
ifFalse: [(self listItems at: (self model perform: self selected)) deselect].
self model perform: self changeSelected with: num.
(self listItems at: num) select];
actionSelector: #value;
yourself)]
yourself.

icon ifNotNil: [listItem icon: icon].
self addListItem: listItem]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"class" : {
"clearFilterAutomatically" : "mats 7/10/2018 11:11",
"clearFilterAutomatically:" : "mats 7/10/2018 11:11",
"on:list:selected:changeSelected:menu:keystroke:" : "mats 7/9/2018 22:38" },
"on:list:selected:changeSelected:menu:keystroke:" : "mats 7/9/2018 22:38",
"toolIconsToMaterialIcons" : "mats 7/10/2018 14:29" },
"instance" : {
"autoDeselect" : "mats 6/26/2018 11:32",
"autoDeselect:" : "mats 6/26/2018 11:32",
Expand All @@ -29,17 +30,20 @@
"getListSize" : "mats 7/9/2018 16:47",
"getListSizeSelector" : "mats 6/26/2018 11:34",
"getListSizeSelector:" : "mats 6/26/2018 11:34",
"getMaterialIconFrom:" : "mats 7/10/2018 14:06",
"getMenu:" : "mats 7/9/2018 16:40",
"getMenuTitleSelector" : "mats 7/9/2018 16:39",
"getMenuTitleSelector:" : "mats 7/9/2018 16:39",
"handleBasicKeys:" : "mats 7/9/2018 15:31",
"handlesBasicKeys" : "mats 7/9/2018 15:31",
"handlesKeyboard:" : "mats 7/9/2018 16:44",
"initForKeystrokes" : "mats 7/10/2018 11:06",
"initialize" : "mats 7/10/2018 12:49",
"keyStroke:" : "mats 7/9/2018 15:24",
"keyboardFocusChange:" : "mats 7/10/2018 11:16",
"keystroke" : "mats 6/26/2018 11:37",
"keystroke:" : "mats 6/26/2018 11:37",
"keystrokeActionSelector" : "mats 7/10/2018 13:01",
"keystrokeActionSelector:" : "mats 7/9/2018 15:31",
"keystrokePreviewSelector" : "mats 6/26/2018 11:34",
"keystrokePreviewSelector:" : "mats 7/9/2018 15:31",
Expand All @@ -53,29 +57,25 @@
"menu" : "mats 6/26/2018 11:37",
"menu:" : "mats 6/26/2018 11:37",
"model" : "mats 6/26/2018 11:36",
"mouseEnterDragging:" : "JW 7/6/2018 17:07",
"mouseLeaveDragging:" : "JW 7/6/2018 16:31",
"mouseMove:" : "JW 7/6/2018 17:07",
"potentialDropRow" : "JW 7/6/2018 15:45",
"resetPotentialDropRow" : "JW 7/6/2018 15:39",
"rowAtLocation:" : "JW 7/6/2018 16:58",
"selected" : "mats 6/26/2018 11:37",
"selected:" : "mats 7/3/2018 10:17",
"model:" : "mats 7/10/2018 11:07",
"modifierKeyPressed:" : "mats 7/10/2018 11:07",
"mouseDown:" : "mats 7/9/2018 16:43",
"mouseEnterDragging:" : "JW 7/6/2018 17:07",
"mouseLeaveDragging:" : "JW 7/6/2018 16:31",
"mouseMove:" : "JW 7/6/2018 17:07",
"numSelectionsInView" : "mats 7/10/2018 11:33",
"potentialDropRow" : "JW 7/6/2018 15:45",
"previewKeystroke:" : "mats 7/10/2018 11:07",
"priorSelection" : "mats 7/9/2018 16:54",
"priorSelection:" : "mats 7/9/2018 16:54",
"resetPotentialDropRow" : "JW 7/6/2018 15:39",
"rowAtLocation:" : "JW 7/6/2018 16:58",
"selected" : "mats 6/26/2018 11:37",
"selected:" : "mats 7/3/2018 10:17",
"selectionIndex" : "mats 7/9/2018 16:53",
"specialKeyPressed:" : "mats 7/10/2018 11:08",
"update:" : "mats 7/10/2018 11:31",
"updateList" : "mats 7/10/2018 11:25",
"update:" : "mats 7/10/2018 14:00",
"updateList" : "mats 7/10/2018 13:54",
"updateListMorphs" : "mats 7/3/2018 14:57",
"wantsDropSelector" : "mats 6/26/2018 11:34",
"wantsDropSelector:" : "mats 6/26/2018 11:34",
"wantsKeyboardFocus" : "mats 7/9/2018 16:45",
"yellowButtonActivity:" : "mats 7/9/2018 16:42" } }
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"getListSizeSelector",
"keystrokePreviewSelector",
"potentialDropRow",
"wantsDropSelector",
"wantsDropSelector",
"lastKeystrokeTime",
"priorSelection",
"keystrokeActionSelector",
Expand Down

0 comments on commit 8fd81cf

Please sign in to comment.