[Pkg] The Trunk: EToys-kfr.339.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jan 1 13:37:21 UTC 2019


Karl Ramberg uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-kfr.339.mcz

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

Name: EToys-kfr.339
Author: kfr
Time: 1 January 2019, 2:37:14.21875 pm
UUID: d14aae8c-2874-41e9-a1f1-a08d1638ce02
Ancestors: EToys-pre.338

A few changes to TextPropertiesMorph to make it work more like intended.

=============== Diff against EToys-pre.338 ===============

Item was changed:
  ----- Method: TextPropertiesMorph>>changeStyle (in category 'button actions') -----
  changeStyle
  	"Put up a menu allowing the user to choose a new style for the TextMorph."
  
+ 	| anEditor |
+ 	anEditor := self establishSelectionInterval.
+ 	anEditor changeTextFont.
+ 	!
- 	| aList reply style |
- 	aList := StrikeFont actualFamilyNames.
- 	aList addFirst: 'DefaultTextStyle'.
- 	reply := (SelectionMenu labelList: aList lines: #(1) selections: aList) startUp.
- 	reply ifNil: [^self].
- 
- 	(style := TextStyle named: reply) ifNil: [Beeper beep. ^ true].
- 	self applyToWholeText ifTrue: [self activeEditor selectAll].
- 	self activeEditor changeStyleTo: style copy.
- 	self activeTextMorph updateFromParagraph.
- 	self activeTextMorph releaseEditor!

Item was changed:
  ----- Method: TextPropertiesMorph>>establishSelectionInterval (in category '*Etoys-Squeakland-button actions') -----
  establishSelectionInterval
  	"If the active editor has a nonempty selection interval, assimilate it."
  
+ 	| activeEditor itsSize |
- 	| activeEditor anInterval itsSize |
  	activeEditor := self activeEditor.
+ 	self applyToWholeText ifTrue: [ ^activeEditor selectAll].
+ 	
+ 	(selectionInterval size > 0)
- 	anInterval := activeEditor selectionInterval.
- 	anInterval size > 0
  		ifTrue:  "User set it manually, so remember it"
+ 			[^activeEditor selectInterval:  selectionInterval]
- 			[selectionInterval := anInterval]
  		ifFalse:
  			[itsSize := self activeTextMorph text string size.
  			selectionInterval := Interval from: selectionInterval start to: (selectionInterval stop min: itsSize).
+ 			 ^activeEditor selectInterval:  selectionInterval]!
- 			activeEditor selectionInterval:  selectionInterval]!

Item was changed:
  ----- Method: TextPropertiesMorph>>initialize (in category 'initialization') -----
  initialize
  	"initialize the state of the receiver"
  
  	super initialize.
  
  	applyToWholeText := false. 
  	myTarget
  		ifNil:
  			[myTarget := TextMorph new openInWorld.
  			myTarget contents: ''].
+       selectionInterval := myTarget editor selectionInterval.
+ 	activeTextMorph := myTarget copy. 
+       thingsToRevert
- 
- 	activeTextMorph := myTarget.  "Formerly was a copy..."
- 
- 	thingsToRevert
  		add: (#wrapFlag: ->  myTarget isWrapped);
  		add: (#autoFit: ->  myTarget isAutoFit);
  		add: (#setTextStyle: -> myTarget textStyle);
  		add: (#margins: ->  myTarget margins);
  		add: (#extent: ->  myTarget extent);
  		add: (#textColor: ->  myTarget textColor);
  		add: (#restoreText: ->  myTarget text deepCopy).
  	self rebuild!

Item was changed:
  ----- Method: TextPropertiesMorph>>targetTextColor (in category 'as yet unclassified') -----
  targetTextColor
+       
+ 	 | attrs c ind |
+       ind := selectionInterval start.
+ 	
+ 	(ind isNil or: [ind < 1 or: [ind >activeTextMorph text size]]) ifTrue: [ind := 1].
+ 	attrs :=activeTextMorph text attributesAt: ind.
+ 	c := attrs detect: [:attr | attr class = TextColor] ifNone: [].
+ 	^ c ifNil: [Color black] ifNotNil: [c color].!
- 
- 	^Color black!



More information about the Packages mailing list