Skip to content

Commit

Permalink
added page number visualization close #59
Browse files Browse the repository at this point in the history
  • Loading branch information
MkuuWaUjinga committed Jul 18, 2017
1 parent 15b5279 commit 797d37f
Show file tree
Hide file tree
Showing 29 changed files with 118 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
visualization
addNumberToSign: aNumber colored: aColor

self visualization addMorphBack: (StringMorph new contents: aNumber asString;
color: aColor;
font: (StrikeFont familyName: 'ComicSansMS' pointSize: 36 emphasized: 1)).
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ closeWindow

(self pageDict at: self currentPage) remove: thumbnail.

self currentPage < self numberPages ifTrue: [self windowFromNextPage: self currentPage + 1. self addMorphBack: (self pageDict at: self currentPage) last].

self selectedWindow == thumbnail
ifTrue: [self numberPages = 1 ifTrue: [self delete. ^ self]
ifFalse: [self pageDict removeKey: self currentPage. self previousPage. ^self]].

thumbnail delete.

self isLastPage ifFalse: [self windowFromNextPage: self currentPage + 1. self addMorphBack: (self pageDict at: self currentPage) last]
ifTrue: [
" check whether there is only one window left "
self selectedWindow == thumbnail
ifTrue: [self isFirstPage
ifTrue: [self delete. ^ self]
ifFalse: [self deletePageNumberAt: self currentPage. self pageDict removeKey: self currentPage. self previousPage. ^self]]
].

self updateLayout].
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ as yet unclassified
delete

super delete.
self visualization delete.
WAExpose hasDashboard: false.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
visualization
deletePageNumberAt: aNumber

(self visualization submorphs at: aNumber) delete.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ drawOn: aCanvas

super drawOn: aCanvas.
aCanvas
drawString: 'Hit [Esc] to close'
drawString: 'Hit [Esc] to close. Hit $x to close the selected window.'
at: 10@10
font: Preferences standardDefaultTextFont
color: Color white.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
spaces
getWindowsInCurrentSpace

|windows|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ initialize

self eventHandler: UiEventHandler new.
self eventHandler on: Character escape send: #delete to: self.

"self eventHandler on: Character enter send: #activateWindow to: self.
self eventHandler on: Character linefeed send: #activateWindow to: self."
self eventHandler on: Character cr send: #activateWindow to: self.

self eventHandler on: Character arrowUp send: #previousPage to: self.
Expand All @@ -36,4 +33,5 @@ initialize
self initializeSelectionRectangle.
self initializeThumbnails.
self initializeUpButton.
self initializeDownButton.
self initializeDownButton.
self initializeVisualization.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
pages
initializeDownButton

arrowDown := (('<font color="#FFFFFF"><b>DOWN</b></font>' asHtmlText asMorph margins: 10@3; imageForm) asMorph
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
pages
initializeUpButton

arrowUp := (('<font color="#FFFFFF"><b>UP</b></font>' asHtmlText asMorph margins: 10@3; imageForm) asMorph
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
visualization
initializeVisualization

self visualization: (Morph new position: ActiveWorld extent x - 45 @ 0;
extent: 45@ActiveWorld extent y;
clipSubmorphs: true;
disableTableLayout: true;
color: (Color black);
changeTableLayout;
listDirection: #topToBottom;
listCentering: #center;
cellInset: 10;
layoutInset: 20).

1 to: self numberPages do: [:n | n = self currentPage ifTrue: [self addNumberToSign: n colored: Color white ] ifFalse: [self addNumberToSign: n colored: Color gray]].

self visualization openInWorld.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pages
isFirstPage

^ self currentPage <= 1.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pages
isLastPage

^ self currentPage = self numberPages.
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
as yet unclassified
pages
nextPage

self currentPage < self numberPages ifTrue: [
self isLastPage ifFalse: [
self thumbnailsOnPage do: [:thmb|thmb delete].

(self visualization submorphs at: self currentPage) color: Color gray.

self currentPage: self currentPage + 1.

(self pageDict at: self currentPage) do: [:thmb | self addMorphBack: thmb].

self selectWindow: (self pageDict at: currentPage) first.

self selectWindow: (self pageDict at: self currentPage) first.

(self visualization submorphs at: self currentPage) color: Color white.

self updateLayout.
].

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
numberOfWindowsOnPage
^ numberOfWindowsOnPage

^ numberOfWindowsOnPage.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
pages
numberPages

^ self pageDict size.
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
as yet unclassified
pages
previousPage

self currentPage > 1 ifTrue: [
self thumbnailsOnPage do: [:thmb|thmb delete].

self isFirstPage ifFalse: [

self thumbnailsOnPage ifNotEmpty: [self thumbnailsOnPage do: [:thmb|thmb delete]. (self visualization submorphs at: self currentPage) color: Color gray.].

self currentPage: self currentPage - 1.

(self pageDict at: self currentPage) do: [:thmb | self addMorphBack: thmb].

self selectWindow: (self pageDict at: self currentPage) last.


(self visualization submorphs at: self currentPage) color: Color white.

self updateLayout.
].
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
as yet unclassified
selectNextWindow

self selectWindow: (self thumbnailsOnPage atWrap: (self thumbnailsOnPage indexOf: self selectedWindow) + 1).
self thumbnailsOnPage ifNotEmpty: [
self selectWindow: (self thumbnailsOnPage atWrap: (self thumbnailsOnPage indexOf: self selectedWindow) + 1)
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
as yet unclassified
selectPreviousWindow

self selectWindow: (self thumbnailsOnPage atWrap: (self thumbnailsOnPage indexOf: self selectedWindow) - 1).
self thumbnailsOnPage ifNotEmpty: [
self selectWindow: (self thumbnailsOnPage atWrap: (self thumbnailsOnPage indexOf: self selectedWindow) - 1)
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
pages
thumbnailsOnPage

^ (self submorphs copyWithout: selectionRectangle) intersection: ((self submorphs copyWithout: arrowDown) intersection: (self submorphs copyWithout: arrowUp)).
^ self submorphs reject: [:each | (Array with: selectionRectangle with: arrowDown with: arrowUp) includes: each].
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ updateLayout

self fullBounds.

self currentPage < self numberPages ifTrue: [self addMorphFront: arrowDown].
self currentPage > 1 ifTrue: [self addMorphFront: arrowUp].
self isLastPage ifFalse: [self addMorphFront: arrowDown].
self isFirstPage ifFalse: [self addMorphFront: arrowUp].

self selectWindow: self selectedWindow.

self comeToFront.
self visualization comeToFront.
self grabKeyboard.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
visualization: anObject
visualization := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
visualization
^ visualization
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
as yet unclassified
pages
windowFromNextPage: aNumber

aNumber > self numberPages ifTrue: [(self pageDict at: aNumber - 1) isEmpty ifTrue: [self pageDict removeKey: aNumber - 1]]
ifFalse: [| wnd | wnd := (self pageDict at: aNumber) removeFirst. (self pageDict at: aNumber - 1) addLast: wnd. ^ self windowFromNextPage: aNumber + 1 ].
aNumber > self numberPages ifTrue: [(self pageDict at: aNumber - 1) isEmpty ifTrue: [self pageDict removeKey: aNumber - 1. self deletePageNumberAt: aNumber - 1]]
ifFalse: [| wnd | wnd := (self pageDict at: aNumber) removeFirst. (self pageDict at: aNumber - 1) addLast: wnd.
^ self windowFromNextPage: aNumber + 1 ].

Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,37 @@
"instance" : {
"activateWindow" : "adz 6/15/2017 20:23",
"activateWindowFromEvent:thumbnail:" : "adz 6/16/2017 20:30",
"closeWindow" : "adz 7/11/2017 01:38",
"addNumberToSign:colored:" : "adz 7/18/2017 00:53",
"closeWindow" : "adz 7/18/2017 09:32",
"currentPage" : "adz 7/6/2017 15:16",
"currentPage:" : "adz 7/6/2017 15:16",
"delete" : "adz 6/21/2017 17:20",
"drawOn:" : "adz 6/8/2017 11:14",
"delete" : "adz 7/18/2017 00:04",
"deletePageNumberAt:" : "adz 7/18/2017 09:34",
"drawOn:" : "adz 7/18/2017 09:23",
"getWindowsInCurrentSpace" : "adz 6/22/2017 10:05",
"initialize" : "AZ 7/13/2017 11:06",
"initialize" : "adz 7/17/2017 23:31",
"initializeDownButton" : "adz 7/10/2017 21:53",
"initializeSelectionRectangle" : "adz 7/6/2017 16:08",
"initializeThumbnails" : "adz 7/10/2017 21:50",
"initializeUpButton" : "adz 7/10/2017 21:53",
"initializeVisualization" : "adz 7/18/2017 09:25",
"intoWorld:" : "adz 7/10/2017 22:22",
"nextPage" : "AZ 7/13/2017 11:16",
"numberOfWindowsOnPage" : "adz 7/10/2017 21:33",
"isFirstPage" : "adz 7/17/2017 22:03",
"isLastPage" : "adz 7/17/2017 22:03",
"nextPage" : "adz 7/18/2017 00:14",
"numberOfWindowsOnPage" : "adz 7/18/2017 09:27",
"numberOfWindowsOnPage:" : "adz 7/10/2017 21:33",
"numberPages" : "adz 7/6/2017 15:22",
"pageDict" : "adz 7/6/2017 12:04",
"pageDict:" : "adz 7/6/2017 12:04",
"previousPage" : "AZ 7/13/2017 11:18",
"selectNextWindow" : "adz 7/6/2017 14:14",
"selectPreviousWindow" : "adz 7/6/2017 14:13",
"previousPage" : "adz 7/18/2017 09:19",
"selectNextWindow" : "adz 7/17/2017 21:44",
"selectPreviousWindow" : "adz 7/17/2017 21:44",
"selectWindow:" : "adz 7/6/2017 14:15",
"selectWindowFromEvent:thumbnail:" : "jh 5/16/2017 12:13",
"selectedWindow" : "jh 5/16/2017 12:13",
"thumbnailsOnPage" : "adz 7/6/2017 15:47",
"updateLayout" : "adz 7/11/2017 01:43",
"windowFromNextPage:" : "adz 7/11/2017 01:41" } }
"thumbnailsOnPage" : "adz 7/17/2017 23:07",
"updateLayout" : "adz 7/18/2017 01:02",
"visualization" : "adz 7/17/2017 23:21",
"visualization:" : "adz 7/17/2017 23:21",
"windowFromNextPage:" : "adz 7/18/2017 09:31" } }
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"arrowDown",
"currentPage",
"arrowUp",
"numberOfWindowsOnPage" ],
"numberOfWindowsOnPage",
"visualization" ],
"name" : "WAExpose",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
drawing
addNumberToSign: aNumber colored: aColor

self addMorphBack: (StringMorph new center: self center;
contents: aNumber asString;
self addMorphBack: (StringMorph new contents: aNumber asString;
color: aColor;
font: (StrikeFont familyName: 'ComicSansMS' pointSize: 36 emphasized: 1)).
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ initialize: aNumber
super initialize.
self seconds: self startSeconds;
extent: self defaultExtent;
clipSubmorphs: true;
disableTableLayout: true;
color: self defaultColor;
setLayout.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ setLayout
^ self layoutPolicy: TableLayout new;
listDirection: #leftToRight;
listCentering: #center;
layoutInset: 10;
layoutInset: 20;
cellInset: 5.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"class" : {
"new:" : "adz 6/22/2017 00:46" },
"instance" : {
"addNumberToSign:colored:" : "NS 6/22/2017 11:53",
"addNumberToSign:colored:" : "adz 7/18/2017 00:58",
"countDown" : "adz 6/22/2017 00:47",
"defaultColor" : "NS 6/22/2017 11:57",
"defaultExtent" : "NS 6/22/2017 11:56",
"initialize:" : "NS 6/22/2017 12:02",
"initialize:" : "adz 7/17/2017 23:27",
"number" : "adz 6/21/2017 14:17",
"number:" : "adz 6/21/2017 14:17",
"numberOfSpaces" : "NS 6/22/2017 11:59",
"seconds" : "adz 6/21/2017 14:24",
"seconds:" : "adz 6/21/2017 14:24",
"setLayout" : "NS 6/22/2017 11:58",
"setLayout" : "adz 7/18/2017 01:00",
"startSeconds" : "NS 6/22/2017 11:54",
"step" : "adz 6/21/2017 14:23" } }

0 comments on commit 797d37f

Please sign in to comment.