[squeak-dev] The Trunk: Morphic-mt.1563.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Oct 9 15:39:56 UTC 2019


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1563.mcz

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

Name: Morphic-mt.1563
Author: mt
Time: 9 October 2019, 5:39:49.80239 pm
UUID: b0ff9f2d-aef0-9d43-8a3b-f3b0cffc30bd
Ancestors: Morphic-mt.1562

Clean up TextMorph a little bit. Explicate stuff from ImmPlugin and move some methods to Multilingual package. Do not send #setCompositionWindow anymore until we figure out a better way to do this. it is quite a fancy no-op on most systems.

=============== Diff against Morphic-mt.1562 ===============

Item was removed:
- ----- Method: HandMorph class>>compositionWindowManager (in category 'accessing') -----
- compositionWindowManager
- 	CompositionWindowManager ifNotNil: [^CompositionWindowManager].
- 	Smalltalk platformName = 'Win32' 
- 		ifTrue: [^CompositionWindowManager := ImmWin32 new].
- 	(Smalltalk platformName = 'unix' 
- 		and: [(Smalltalk windowSystemName) = 'X11']) 
- 			ifTrue: [^CompositionWindowManager := ImmX11 new].
- 	^CompositionWindowManager := ImmAbstractPlatform new!

Item was removed:
- ----- Method: HandMorph>>compositionWindowManager (in category 'focus handling') -----
- compositionWindowManager
- 
- 	^ self class compositionWindowManager.
- !

Item was changed:
  ----- Method: HandMorph>>newKeyboardFocus: (in category 'focus handling') -----
  newKeyboardFocus: aMorphOrNil
  	"Make the given morph the new keyboard focus, canceling the previous keyboard focus if any. If the argument is nil, the current keyboard focus is cancelled."
  	
  	| oldFocus newFocus |
  	oldFocus := self keyboardFocus.
  	newFocus := aMorphOrNil ifNotNil: [:m | m keyboardFocusDelegate].
  	
  	self keyboardFocus: newFocus.
  	
  	oldFocus == newFocus ifFalse: [
  		oldFocus ifNotNil: [:m | m keyboardFocusChange: false].
  		newFocus ifNotNil: [:m | m keyboardFocusChange: true]].
  	
+ 	self flag: #ImmPlugin.
+ 	"newFocus ifNotNil: [:m |
+ 		self compositionWindowManager keyboardFocusForAMorph: m]."
- 	newFocus ifNotNil: [:m |
- 		self compositionWindowManager keyboardFocusForAMorph: m].
  
  	^ newFocus
  !

Item was removed:
- ----- Method: Morph>>preferredKeyboardBounds (in category 'event handling') -----
- preferredKeyboardBounds
- 
- 	^ self bounds: self bounds in: self world.
- !

Item was removed:
- ----- Method: Morph>>preferredKeyboardPosition (in category 'event handling') -----
- preferredKeyboardPosition
- 
- 	^ (self bounds: self bounds in: self world) topLeft.
- !

Item was changed:
  RectangleMorph subclass: #TextMorph
+ 	instanceVariableNames: 'textStyle text wrapFlag paragraph editor container predecessor successor backgroundColor margins readOnly autoFit'
- 	instanceVariableNames: 'textStyle text wrapFlag paragraph editor container predecessor successor backgroundColor margins editHistory readOnly autoFit'
  	classVariableNames: 'CaretForm DefaultEditorClass'
  	poolDictionaries: ''
  	category: 'Morphic-Basic'!
  
  !TextMorph commentStamp: 'nice 3/24/2010 07:40' prior: 0!
  TextMorphs support display of text with emphasis.  They also support reasonable text-editing capabilities, as well as embedded hot links, and the ability to embed submorphs in the text.
  
  Late in life, TextMorph was made a subclass of BorderedMorph to provide border and background color if desired.  In order to keep things compatible, protocols have been redirected so that color (preferably textColor) relates to the text, and backgroundColor relates to the inner fill color.
  
  Text display is clipped to the innerBounds of the rectangle, and text composition is normally performed within a rectangle which is innerBounds inset by the margins parameter.
  
  If text has been embedded in another object, one can elect to fill the owner's shape, in which case the text will be laid out in the shape of the owner's shadow image (including any submorphs other than the text).  One can also elect to have the text avoid occlusions, in which case it will avoid the bounds of any sibling morphs that appear in front of it.  It may be necessary to update bounds in order for the text runaround to notice the presence of a new occluding shape.
  
  The optional autoFitContents property enables the following feature:  if the text contents changes, then the bounds of the morph will be adjusted to fit the minimum rectangle that encloses the text (plus any margins specified).  Similarly, any attempt to change the size of the morph will be resisted if this parameter is set.  Except...
  
  If the wrapFlag parameter is true, then text will be wrapped at word boundaries based on the composition width (innerBounds insetBy: margins) width.  Thus an attempt to resize the morph in autofit mode, if it changes the width, will cause the text to be recomposed with the new width, and then the bounds will be reset to the minimum enclosing rectangle.  Similarly, if the text contents are changed with the wrapFlag set to true, word wrap will be performed based on the current compostion width, after which the bounds will be set (or not), based on the autoFitcontents property.
  
  Note that fonts can only be applied to the TextMorph as a whole.  While you can change the size, color, and emphasis of a subsection of the text and have it apply to only that subsection, changing the font changes the font for the entire contents of the TextMorph. 
  
  Still a TextMorph can be composed of several texts of different fonts
  | font1 font2 t1 t2 tMorph|
  tMorph := TextMorph new.
  font1 := (TextFontReference toFont: (StrikeFont familyName: 'Atlanta' size: 22)).
  font2 := (TextFontReference toFont: (StrikeFont familyName: 'Atlanta' size: 11)).
  t1 := 'this is font1' asText addAttribute: font1.
  t2 := ' and this is font2' asText addAttribute: font2.
  tMorph contents: (t1,t2).
  tMorph openInHand.
  
  
  Yet to do:
  Make a comprehensive control for the eyedropper, with border width and color, inner color and text color, and margin widths.!

Item was changed:
  ----- Method: TextMorph>>extent: (in category 'geometry') -----
  extent: aPoint 
  	| newExtent priorEditor |
  	bounds extent = aPoint ifTrue: [^ self].
  	priorEditor := editor.
  	self isAutoFit
  		ifTrue: [wrapFlag ifFalse: [^ self].  "full autofit can't change"
  				newExtent := aPoint truncated.
  				newExtent x = self extent x ifTrue: [^ self].  "No change of wrap width"
+ 				self releaseParagraph.  "invalidate the paragraph cache"
- 				self releaseParagraphReally.  "invalidate the paragraph cache"
  				super extent: newExtent.
  				priorEditor
  					ifNil: [self fit]  "since the width has changed..."
  					ifNotNil: [self installEditorToReplace: priorEditor]]
  		ifFalse: [super extent: aPoint truncated.
  				wrapFlag ifFalse: [^ self].  "no effect on composition"
  				self composeToBounds]
  !

Item was changed:
  ----- Method: TextMorph>>handleInteraction:fromEvent: (in category 'editing') -----
  handleInteraction: interactionBlock fromEvent: evt
  	"Perform the changes in interactionBlock, noting any change in selection
  	and possibly a change in the size of the paragraph (ar 9/22/2001 - added for TextPrintIts)"
  
  	| oldEditor oldParagraph oldText oldSelection |
  	oldEditor := editor.
  	oldParagraph := paragraph.
  	oldText := oldParagraph text copy.
  	oldSelection := oldParagraph selectionRects. "already copy"
  
  	"Note old selection."
  	self selectionChanged: oldSelection.
  	
  	interactionBlock value.
  
  	(oldParagraph == paragraph) ifTrue:[
  		"this will not work if the paragraph changed"
  		editor := oldEditor.     "since it may have been changed while in block"
  	].
  	
  	"Note new selection."
  	paragraph selectionRects in: [:newSelection |
  		newSelection ~= oldSelection ifTrue: [
  			self selectionChanged: newSelection]].
  		
  	(oldText = paragraph text and: [ oldText runs = paragraph text runs ])
  		ifFalse:[ 
  			self paragraph composeAll.
  			self updateFromParagraph ].
+ 	
+ 	self flag: #ImmPlugin.
+ 	"self setCompositionWindow."!
- 	self setCompositionWindow.!

Item was changed:
  ----- Method: TextMorph>>setCompositionWindow (in category 'editing') -----
  setCompositionWindow
  
  	| hand |
+ 	self flag: #ImmPlugin.
  	hand := self primaryHand.
  	hand ifNotNil: [hand compositionWindowManager keyboardFocusForAMorph: self].
  !

Item was changed:
  ----- Method: TextMorphForEditView>>mouseUp: (in category 'event handling') -----
  mouseUp: evt
  	super mouseUp: evt.
  	self stopSteppingSelector: #autoScrollView:.
  	editView scrollSelectionIntoView: evt.
  
+ 	self flag: #ImmPlugin.
+ 	"self setCompositionWindow."
- 	self setCompositionWindow.
  !

Item was removed:
- ----- Method: TextMorphForEditView>>preferredKeyboardPosition (in category 'event handling') -----
- preferredKeyboardPosition
- 
- 	| pos |
- 	pos := super preferredKeyboardPosition.
- 	^ pos + (self boundsInWorld) topLeft.
- !



More information about the Squeak-dev mailing list