[squeak-dev] The Trunk: Morphic-cmm.1014.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Oct 19 21:41:03 UTC 2015


Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.1014.mcz

==================== Summary ====================

Name: Morphic-cmm.1014
Author: cmm
Time: 19 October 2015, 4:40:19.528 pm
UUID: 2cdb2aae-a459-4802-a9ca-d66ad4965a02
Ancestors: Morphic-topa.1013

- A new preference, Enable Global Command Keys, allows navigation throughout the IDE with the same hot keys available at the desktop.  It is set by default, but applications might wish to disable it so they can register their own.
- DockingBarMorph honors this preference too, so that applications can have Control+1 thru Control+0 too.
- Hot-keys for Command+R (indent) and Command+L (outdent), respectively, have been changed to Tab and Shift+Tab, respectively, thus freeing up the letter keys for access to their global counterpart functions ((R)ecent Messages List and File (L)ist).
- Transcript is also now globally available with Command+t.
- Removed TextEditor>>#duplicate: because all ways to access that function through the UI were removed (in a series of separate commits).

=============== Diff against Morphic-topa.1013 ===============

Item was changed:
  ----- Method: DockingBarMorph>>initialize (in category 'initialize-release') -----
  initialize
  	"initialize the receiver"
  	super initialize.
  	selectedItem := nil.
  	activeSubMenu := nil.
  	fillsOwner := true.
  	avoidVisibleBordersAtEdge := true.
  	autoGradient := MenuMorph gradientMenu.
  	self 
  		setDefaultParameters ; 
  		beFloating ; 
  		beSticky ;
  		layoutInset: 0 ;
+ 		dropEnabled: true!
- 		dropEnabled: true.
- 	Project current world activeHand addKeyboardListener: self!

Item was added:
+ ----- Method: DockingBarMorph>>setupGlobalHotKeyEventListeners (in category 'initialize-release') -----
+ setupGlobalHotKeyEventListeners
+ 	PasteUpMorph globalCommandKeysEnabled
+ 		ifTrue: [ ActiveHand addKeyboardListener: self ]
+ 		ifFalse: [ ActiveHand removeKeyboardListener: self ]!

Item was changed:
  ----- Method: MorphicProject>>createOrUpdateMainDockingBar (in category 'docking bars support') -----
  createOrUpdateMainDockingBar
  	"Private - create a new main docking bar or update the current one"
  	| w mainDockingBars |
  	w := self world.
  	mainDockingBars := w mainDockingBars.
+ 	mainDockingBars isEmpty ifTrue:
+ 		[ "no docking bar, just create a new one"
+ 		self dockingBar createDockingBar
+ 			 openInWorld: w ;
+ 			 setupGlobalHotKeyEventListeners.
+ 		^ self ].
- 	mainDockingBars isEmpty
- 		ifTrue: ["no docking bar, just create a new one"
- 			self dockingBar createDockingBar openInWorld: w.
- 			^ self].
  	"update if needed"
+ 	mainDockingBars do:
+ 		[ : each | self dockingBar updateIfNeeded: each.
+ 		each setupGlobalHotKeyEventListeners ]!
- 	mainDockingBars
- 		do: [:each | self dockingBar updateIfNeeded: each]!

Item was changed:
  BorderedMorph subclass: #PasteUpMorph
  	instanceVariableNames: 'presenter model cursor padding backgroundMorph turtleTrailsForm turtlePen lastTurtlePositions isPartsBin indicateCursor wantsMouseOverHalos worldState griddingOn'
+ 	classVariableNames: 'DisableDeferredUpdates GlobalCommandKeysEnabled MinCycleLapse StillAlive WindowEventHandler'
- 	classVariableNames: 'DisableDeferredUpdates MinCycleLapse StillAlive WindowEventHandler'
  	poolDictionaries: ''
  	category: 'Morphic-Worlds'!
  
  !PasteUpMorph commentStamp: '<historical>' prior: 0!
  A morph whose submorphs comprise a paste-up of rectangular subparts which "show through".  Anything called a 'Playfield' is a PasteUpMorph.
  
  Facilities commonly needed on pages of graphical presentations and on simulation playfields, such as the painting of new objects, turtle trails, gradient fills, background paintings, parts-bin behavior, collision-detection, etc., are (or will be) provided.
  
  A World, the entire Smalltalk screen, is a PasteUpMorph.  A World responds true to isWorld.  Morph subclasses that have specialized menus (BookMorph) build them in the message addBookMenuItemsTo:hand:.  A PasteUpMorph that is a world, builds its menu in HandMorph buildWorldMenu.
  
  presenter	A Presenter in charge of stopButton stepButton and goButton, 
  			mouseOverHalosEnabled soundsEnabled fenceEnabled coloredTilesEnabled.
  model		<not used>
  cursor		??
  padding		??
  backgroundMorph		A Form that covers the background.
  turtleTrailsForm			Moving submorphs may leave trails on this form.
  turtlePen				Draws the trails.
  lastTurtlePositions		A Dictionary of (aPlayer -> aPoint) so turtle trails can be drawn 
  						only once each step cycle.  The point is the start of the current stroke.
  isPartsBin		If true, every object dragged out is copied.
  autoLineLayout		??
  indicateCursor		??
  resizeToFit		??
  wantsMouseOverHalos		If true, simply moving the cursor over a submorph brings up its halo.
  worldState		If I am also a World, keeps the hands, damageRecorder, stepList etc.
  griddingOn		If true, submorphs are on a grid
  
  !

Item was added:
+ ----- Method: PasteUpMorph class>>globalCommandKeysEnabled (in category 'preferences') -----
+ globalCommandKeysEnabled
+ 	<preference: 'Enable Global Command Keys'
+ 		category: 'Morphic'
+ 		description: 'When true, the global command keys are enabled.  Command-key help is available from the help menu.'
+ 		type: #Boolean>
+ 	^ GlobalCommandKeysEnabled ifNil: [ true ]!

Item was added:
+ ----- Method: PasteUpMorph class>>globalCommandKeysEnabled: (in category 'preferences') -----
+ globalCommandKeysEnabled: aBoolean 
+ 	GlobalCommandKeysEnabled := aBoolean.
+ 	aBoolean
+ 		ifTrue:
+ 			[ ActiveHand
+ 				 addKeyboardListener: SystemWindow topWindow ;
+ 				 addKeyboardListener: ActiveWorld.
+ 			ActiveWorld dockingBars do:
+ 				[ : each | ActiveHand addKeyboardListener: each ] ]
+ 		ifFalse:
+ 			[ ActiveHand
+ 				 removeKeyboardListener: SystemWindow topWindow ;
+ 				 removeKeyboardListener: ActiveWorld.
+ 			ActiveWorld dockingBars do:
+ 				[ : each | ActiveHand removeKeyboardListener: each ] ].
+ 	TheWorldMainDockingBar updateInstances!

Item was changed:
  ----- Method: PasteUpMorph>>becomeActiveDuring: (in category 'initialization') -----
  becomeActiveDuring: aBlock
  	"Make the receiver the ActiveWorld during the evaluation of aBlock.
  	Note that this method does deliberately *not* use #ensure: to prevent
  	re-installation of the world on project switches."
  	| priorWorld priorHand priorEvent |
  	priorWorld := ActiveWorld.
  	priorHand := ActiveHand.
  	priorEvent := ActiveEvent.
+ 	priorHand removeKeyboardListener: priorWorld.
- 	priorHand removeEventListener: priorWorld.
  	ActiveWorld := self.
  	ActiveHand := self hands first. "default"
  	ActiveEvent := nil. "not in event cycle"
+ 	self class globalCommandKeysEnabled ifTrue: [ ActiveHand addKeyboardListener: self ].
- 	ActiveHand addEventListener: self.
  	aBlock
  		on: Error
  		do: [:ex | 
  			ActiveWorld := priorWorld.
  			ActiveEvent := priorEvent.
  			ActiveHand := priorHand.
  			ex pass]!

Item was changed:
  ----- Method: PasteUpMorph>>handleListenEvent: (in category 'events-processing') -----
  handleListenEvent: aUserInputEvent 
  	"Handlers for *global* keys, regardless of which widget has keyboard focus."
  	aUserInputEvent type = #keystroke ifTrue:
  		[ aUserInputEvent commandKeyPressed ifTrue:
+ 			[ aUserInputEvent keyValue = $t asciiValue ifTrue: [ World findATranscript: aUserInputEvent ].
+ 			aUserInputEvent keyValue = $R asciiValue ifTrue: [ Utilities browseRecentSubmissions ].
+ 			aUserInputEvent keyValue = $L asciiValue ifTrue: [ World findAFileList: aUserInputEvent ].
+ 			aUserInputEvent keyValue = $O asciiValue ifTrue: [ World findAMonticelloBrowser ].
- 			[ aUserInputEvent keyValue = $O asciiValue ifTrue: [ World findAMonticelloBrowser ].
  			aUserInputEvent keyValue = $P asciiValue ifTrue: [ World findAPreferencesPanel: aUserInputEvent ].
  			aUserInputEvent keyValue = $Z asciiValue ifTrue: [ ChangeList browseRecentLog ].
  			aUserInputEvent keyValue = $] asciiValue ifTrue:
  				[ Smalltalk
  					snapshot: true
  					andQuit: false ] ] ]!

Item was changed:
  ----- Method: PasteUpMorph>>keystrokeInWorld: (in category 'world menu') -----
  keystrokeInWorld: evt
  	"A keystroke was hit when no keyboard focus was set, so it is sent here to the world instead."
  
  	|  aChar isCmd ascii |
  	aChar := evt keyCharacter.
+ 	(ascii := aChar asciiValue) = Character escape asciiValue ifTrue:
+ 		[evt commandKeyPressed ifFalse: [^ self putUpWorldMenuFromEscapeKey]].
- 	(ascii := aChar asciiValue) = 27 ifTrue: "escape key"
- 		[^ self putUpWorldMenuFromEscapeKey].
  	(evt controlKeyPressed not
  		and: [(#(1 4 8 28 29 30 31 32) includes: ascii)  "home, end, backspace, arrow keys, space"
  			and: [self keyboardNavigationHandler notNil]])
  				ifTrue: [self keyboardNavigationHandler navigateFromKeystroke: aChar].
  
  	isCmd := evt commandKeyPressed and: [Preferences cmdKeysInText].
  	(evt commandKeyPressed and: [Preferences eToyFriendly])
  			ifTrue:
  				[(aChar == $W) ifTrue: [^ self putUpWorldMenu: evt]].
  	(isCmd and: [Preferences honorDesktopCmdKeys]) ifTrue:
  		[^ self dispatchCommandKeyInWorld: aChar event: evt].
  
  	"It was unhandled. Remember the keystroke."
  	self lastKeystroke: evt keyString.
  	self triggerEvent: #keyStroke!

Item was changed:
  ----- Method: SystemWindow>>activate (in category 'top window') -----
  activate
  	"Bring the receiver to the top.  If I am modal, bring along my owning window as well."
  	| modalOwner |
  	self modalChild ifNotNil:
  		[ : modalChild | modalChild owner ifNotNil:
  			[ modalChild activate.
  			^ modalChild modalChild ifNil: [ modalChild flash ] ] ].
  	(isCollapsed not and:
  		[ self paneMorphs size > 1 and: [ self splitters isEmpty ] ]) ifTrue: [ self addPaneSplitters ].
  	self activateWindow.
+ 	PasteUpMorph globalCommandKeysEnabled ifTrue: [ActiveHand addKeyboardListener: self].
- 	ActiveHand addKeyboardListener: self.
  	modalOwner := self modalOwner.
  	(modalOwner notNil and: [ modalOwner isSystemWindow ]) ifTrue: [ modalOwner bringBehind: self ]!

Item was changed:
  ----- Method: TextEditor class>>initializeShiftCmdKeyShortcuts (in category 'keyboard shortcut tables') -----
  initializeShiftCmdKeyShortcuts 
  	"Initialize the shift-command-key (or control-key) shortcut table."
  	"NOTE: if you don't know what your keyboard generates, use Sensor kbdTest"
  	"wod 11/3/1998: Fix setting of cmdMap for shifted keys to actually use the 
  	capitalized versions of the letters.
  	TPR 2/18/99: add the plain ascii values back in for those VMs that don't return the shifted values."
  
  	"TextEditor initialize"
  	
  	| cmdMap cmds |
  
  	"shift-command and control shortcuts"
  	cmdMap := Array new: 256 withAll: #noop:.  		"use temp in case of a crash"
  	cmdMap at: ( 1 + 1) put: #cursorHome:.			"home key"
  	cmdMap at: ( 4 + 1) put: #cursorEnd:.				"end key"
  	cmdMap at: ( 8 + 1) put: #forwardDelete:.			"ctrl-H or delete key"
  	cmdMap at: (11 + 1) put: #cursorPageUp:.			"page up key"
  	cmdMap at: (12 + 1) put: #cursorPageDown:.		"page down key"
  	cmdMap at: (13 + 1) put: #crWithIndent:.			"ctrl-Return"
  	cmdMap at: (27 + 1) put: #offerMenuFromEsc:.	"escape key"
  	cmdMap at: (28 + 1) put: #cursorLeft:.			"left arrow key"
  	cmdMap at: (29 + 1) put: #cursorRight:.			"right arrow key"
  	cmdMap at: (30 + 1) put: #cursorUp:.				"up arrow key"
  	cmdMap at: (31 + 1) put: #cursorDown:.			"down arrow key"
  	cmdMap at: (32 + 1) put: #selectWord:.			"space bar key"
  	cmdMap at: (45 + 1) put: #changeEmphasis:.		"cmd-sh-minus"
  	cmdMap at: (61 + 1) put: #changeEmphasis:.		"cmd-sh-plus"
  	cmdMap at: (127 + 1) put: #forwardDelete:.		"del key"
  
  	"On some keyboards, these characters require a shift"
  	'([<{|"''9' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].
  
  	"NB: sw 12/9/2001 commented out the idiosyncratic line just below, which was grabbing shift-esc in the text editor and hence which argued with the wish to have shift-esc be a universal gesture for escaping the local context and calling up the desktop menu."  
  	"cmdMap at: (27 + 1) put: #shiftEnclose:." 	"ctrl-["
  
  	"'""''(' do: [ :char | cmdMap at: (char asciiValue + 1) put: #enclose:]."
  
  	cmds := #(
  		$c	compareToClipboard:
- 		"$d	duplicate:"
  		$h	cursorTopHome:
  		$j	doAgainMany:
  		$k	changeStyle:
- 		$l	outdent:
  		$m	selectCurrentTypeIn:
- 		$r	indent:
  		$s	search:
  		$u	changeLfToCr:
  		$x	makeLowercase:
  		$y	makeUppercase:
  		$z	makeCapitalized:
  	).
  	1 to: cmds size by: 2 do: [ :i |
  		cmdMap at: ((cmds at: i) asciiValue + 1) put: (cmds at: i + 1).			"plain keys"
  		cmdMap at: ((cmds at: i) asciiValue - 32 + 1) put: (cmds at: i + 1).		"shifted keys"
  		cmdMap at: ((cmds at: i) asciiValue - 96 + 1) put: (cmds at: i + 1).		"ctrl keys"
  	].
  	shiftCmdActions := cmdMap!

Item was changed:
  ----- Method: TextEditor>>dispatchOnKeyboardEvent: (in category 'typing support') -----
  dispatchOnKeyboardEvent: aKeyboardEvent 
  	"Carry out the action associated with this character, if any.  	Type-ahead is passed so some routines can flush or use it."
  	| honorCommandKeys typedChar |
  	((typedChar := aKeyboardEvent keyCharacter) == Character cr and: [ morph acceptOnCR ]) ifTrue:
  		[ self closeTypeIn.
  		^ true ].
  	self clearParens.
  	aKeyboardEvent keyValue = 13 ifTrue:
  		[ aKeyboardEvent controlKeyPressed ifTrue: [ ^ self normalCharacter: aKeyboardEvent ].
  		aKeyboardEvent shiftPressed ifTrue: [ ^ self lf: aKeyboardEvent ].
  		aKeyboardEvent commandKeyPressed ifTrue: [ ^ self crlf: aKeyboardEvent ].
  		^ self crWithIndent: aKeyboardEvent ].
+ 	(aKeyboardEvent keyCharacter = Character tab and: [ self selection notEmpty ]) ifTrue:
+ 		[ aKeyboardEvent shiftPressed
+ 			ifTrue: [ self outdent: aKeyboardEvent ]
+ 			ifFalse: [ self indent: aKeyboardEvent ].
+ 		^ true ].
  	((honorCommandKeys := Preferences cmdKeysInText) and: [ typedChar = Character enter ]) ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ].
  	"Special keys overwrite crtl+key combinations - at least on Windows. To resolve this
  	conflict, assume that keys other than cursor keys aren't used together with Crtl."
  	((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [ aKeyboardEvent keyValue < 27 ]) ifTrue: [ ^ aKeyboardEvent controlKeyPressed
  			ifTrue:
  				[ self
  					perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
  					with: aKeyboardEvent ]
  			ifFalse:
  				[ self
  					perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
  					with: aKeyboardEvent ] ].
  	"backspace, and escape keys (ascii 8 and 27) are command keys"
  	((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ]) or: [ self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ]) ifTrue: [ ^ aKeyboardEvent shiftPressed
  			ifTrue:
  				[ self
  					perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
  					with: aKeyboardEvent ]
  			ifFalse:
  				[ self
  					perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)
  					with: aKeyboardEvent ] ].
  	"the control key can be used to invoke shift-cmd shortcuts"
  	(honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [ ^ self
  			perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)
  			with: aKeyboardEvent ].
  	self class autoEnclose
+ 		ifTrue:
+ 			[ (self autoEncloseFor: typedChar) ifFalse: [ self normalCharacter: aKeyboardEvent ] ]
- 		ifTrue: [ (self autoEncloseFor: typedChar) ifFalse: [ self normalCharacter: aKeyboardEvent ] ]
  		ifFalse: [ self normalCharacter: aKeyboardEvent ].
  	^ false!

Item was removed:
- ----- Method: TextEditor>>duplicate: (in category 'editing keys') -----
- duplicate: aKeyboardEvent
- 	"Paste the current selection over the prior selection, if it is non-overlapping and
- 	 legal.  Flushes typeahead.  Undoer & Redoer: undoAndReselect."
- 
- 	self closeTypeIn.
- 	(self hasSelection and: [self isDisjointFrom: otherInterval])
- 		ifTrue: "Something to duplicate"
- 			[self replace: otherInterval with: self selection and:
- 				[self selectAt: self pointIndex]]
- 		ifFalse:
- 			[morph flash].
- 	^true!

Item was changed:
  (PackageInfo named: 'Morphic') postscript: '"Initialize the key bindings and menus"
+ Editor initialize.
- Editor initialize. "again"
  
  "apply the new icons"
+ MenuIcons initializeIcons'!
- MenuIcons initializeIcons. "again"
- TheWorldMainDockingBar updateInstances.
- 	
- "Fix missing inset of old-style windows."
- SystemWindow allSubInstancesDo: [:ea |
- 	(ea paneMorphs detect: [:m | m layoutFrame leftFraction = 0] ifNone: [])
- 		ifNotNil: [:m | m layoutFrame leftOffset > 0
-     			ifTrue: [ea layoutInset: 0]]].
- 
- "Remove non-functional tools from world menu."
- LanguageEditor unload.
- UUniverseBrowser unload.
- UUniverseEditor unload.'!



More information about the Squeak-dev mailing list