'From OLPC2.0 of ''24 October 2006'' [latest update: #1435] on 9 July 2007 at 2:29:56 pm'! "Change Set: Unnamed Date: 9 July 2007 Author: Yoshiki Ohshima Add a menu item to set the prefered position of navigator."! !InternalThreadNavigationMorph methodsFor: 'navigation' stamp: 'yo 7/9/2007 14:29'! moreCommands "Put up a menu of options" | allThreads aMenu others target | allThreads _ self class knownThreads. aMenu _ MenuMorph new defaultTarget: self. aMenu addTitle: 'navigation' translated. aMenu addStayUpItem. self flag: #deferred. "Probably don't want that stay-up item, not least because the navigation-keystroke stuff is not dynamically handled" others _ (allThreads keys reject: [ :each | each = threadName]) asSortedCollection. others do: [ :each | aMenu add: ('switch to <{1}>' translated format:{each}) selector: #switchToThread: argument: each]. aMenu addList: { {'switch to recent projects' translated. #getRecentThread}. #-. {'create a new thread' translated. #threadOfNoProjects}. {'edit this thread' translated. #editThisThread}. {'create thread of all projects' translated. #threadOfAllProjects}. #-. {'First project in thread' translated. #firstPage}. {'Last project in thread' translated. #lastPage}}. (target _ self currentIndex + 2) > listOfPages size ifFalse: [aMenu add: ('skip over next project ({1})' translated format:{(listOfPages at: target - 1) first}) action: #skipOverNext]. aMenu addList: { {'jump within this thread' translated. #jumpWithinThread}. {'insert new project' translated. #insertNewProject}. #-. {'simply close this navigator' translated. #delete}. {'destroy this thread' translated. #destroyThread}. #-}. (ActiveWorld hasProperty: #threadNavigatorPosition) ifTrue: [ aMenu addList: { {'reset preferred location'. #resetBottomRightPosition}. #-}. ] ifFalse: [ aMenu addList: { {'remember preferred location in this project'. #setBottomRightPosition}. #-}. ]. (ActiveWorld keyboardNavigationHandler == self) ifFalse: [aMenu add: 'start keyboard navigation with this thread' translated action: #startKeyboardNavigation] ifTrue: [aMenu add: 'stop keyboard navigation with this thread' translated action: #stopKeyboardNavigation]. aMenu popUpInWorld! ! !InternalThreadNavigationMorph methodsFor: 'navigation' stamp: 'yo 7/9/2007 14:24'! positionAppropriately | others otherRects overlaps bottomRight | (self ownerThatIsA: HandMorph) ifNotNil: [^self]. others _ ActiveWorld submorphs select: [ :each | each ~~ self and: [each isKindOf: self class]]. otherRects _ others collect: [ :each | each bounds]. bottomRight _ (ActiveWorld hasProperty: #threadNavigatorPosition) ifTrue: [ ActiveWorld valueOfProperty: #threadNavigatorPosition. ] ifFalse: [ ActiveWorld bottomRight. ]. self align: self fullBounds bottomRight with: bottomRight. self setProperty: #previousWorldBounds toValue: self world bounds. [ overlaps _ false. otherRects do: [ :r | (r intersects: bounds) ifTrue: [overlaps _ true. self bottom: r top]. ]. self top < self world top ifTrue: [ self bottom: bottomRight y. self right: self left - 1. ]. overlaps ] whileTrue.! ! !InternalThreadNavigationMorph methodsFor: 'menu' stamp: 'yo 7/9/2007 14:10'! resetBottomRightPosition ActiveWorld removeProperty: #threadNavigatorPosition. ! ! !InternalThreadNavigationMorph methodsFor: 'menu' stamp: 'yo 7/9/2007 14:24'! setBottomRightPosition ActiveWorld setProperty: #threadNavigatorPosition toValue: self bottomRight. ! ! InternalThreadNavigationMorph removeSelector: #setBottomRightPosition:!