[squeak-dev] The Trunk: Morphic-ar.195.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Sep 27 03:20:32 UTC 2009


Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ar.195.mcz

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

Name: Morphic-ar.195
Author: ar
Time: 26 September 2009, 8:17:47 am
UUID: 8db33b9f-5897-ac48-8273-a6f07a03f5c3
Ancestors: Morphic-ml.194

Fixes the standard font chooser for changing default system fonts (list, window, code etc) which require the ability to set the emphasis flags for them.

=============== Diff against Morphic-ml.194 ===============

Item was changed:
  ----- Method: TextMorphEditor>>changeTextFont (in category 'attributes') -----
  changeTextFont
  	"Present a dialog which allows the user to select a font, and if one is chosen, apply it to the current selection.	If there is no selection, or the selection is empty, apply it to the whole morph."
  	| curFont startIndex chooser newFont |
  	startIndex := self startIndex.
  	curFont := (paragraph text fontAt: startIndex withStyle: paragraph textStyle).
  	morph openModal: (
  		Cursor wait showWhile: [ 
  			(chooser := FontChooserTool default
  				withTitle: 'Change the selected text''s font to...' translated
  				for: self 
  				setSelector: #changeSelectionFontTo:
+ 				getSelector: curFont)
+ 			"Do not allow changing the emphasis; we don't know how to deal with
+ 			a 'pre-emphasized' font here, so bail."
+ 				offerStyleList: false;
+  				open]).
- 				getSelector: curFont) open]).
  	newFont := chooser result.
  	newFont ifNotNil:[self changeSelectionFontTo: newFont].!

Item was changed:
  ----- Method: TextEditor>>changeTextFont (in category 'attributes') -----
  changeTextFont
  	"Present a dialog which allows the user to select a font, and if one is chosen, apply it to the current selection.	If there is no selection, or the selection is empty, apply it to the whole morph."
  	| curFont startIndex chooser newFont |
  	startIndex := self startIndex.
  	curFont := (paragraph text fontAt: startIndex withStyle: paragraph textStyle).
  	morph openModal: (
  		Cursor wait showWhile: [ 
  			(chooser := FontChooserTool default
  				withTitle: 'Change the selected text''s font to...' translated
  				for: self 
  				setSelector: #changeSelectionFontTo:
+ 				getSelector: curFont)
+ 			"Do not allow changing the emphasis; we don't know how to deal with
+ 			a 'pre-emphasized' font here, so bail."
+ 					offerStyleList: false;
+ 					open]).
- 				getSelector: curFont) open]).
  	newFont := chooser result.
  	newFont ifNotNil:[self changeSelectionFontTo: newFont].!

Item was changed:
  ----- Method: FontChooserTool>>offerStyleList (in category 'initialize') -----
  offerStyleList
+ 	"Whether to offer a choice of styles with the font."
+ 	^offerStyleList!
- 	"Whether to offer a choice of styles with the font.
- 	Currently disabled since most of the text machinery doesn't like emphasis
- 	already being applied to the font. Would have to decompose font/emphasis
- 	in order for that to work."
- 	^false!

Item was added:
+ ----- Method: FontChooserTool>>selectedTextStyle (in category 'font list') -----
+ selectedTextStyle
+ 
+ 	^TextStyle named: (self selectedFontFamily ifNil:[^TextStyle default]).!

Item was changed:
  ----- Method: FontChooserTool>>pointSizeList (in category 'point size') -----
  pointSizeList
+ 	^self selectedTextStyle pointSizes collect: [:each | each asString padded: #left to: 3 with: $ ]!
- 	^self selectedFont textStyle pointSizes collect: [:each | each asString padded: #left to: 3 with: $ ]!

Item was changed:
  Model subclass: #FontChooserTool
+ 	instanceVariableNames: 'title selectedFontIndex fontList target getSelector setSelector pointSize emphasis window result offerStyleList'
- 	instanceVariableNames: 'title selectedFontIndex fontList target getSelector setSelector pointSize emphasis window result'
  	classVariableNames: 'Default'
  	poolDictionaries: ''
  	category: 'Morphic-Support'!
  
  !FontChooserTool commentStamp: 'ar 8/30/2009 14:28' prior: 0!
  A ToolBuilder version of FreeTypePlus' FontChooser[Morph].!

Item was changed:
  ----- Method: FontChooserTool>>selectedFont (in category 'font list') -----
  selectedFont
+ 	| font |
+ 	font := self selectedTextStyle fontOfPointSize: pointSize.
- 	| font family |
- 	family := self fontList at: self selectedFontIndex ifAbsent:[^TextStyle defaultFont].
- 	font := (TextStyle named: family) fontOfPointSize: pointSize.
  	^font emphasized: emphasis!

Item was added:
+ ----- Method: FontChooserTool>>offerStyleList: (in category 'initialize') -----
+ offerStyleList: aBool
+ 	"Whether to offer a choice of styles with the font."
+ 	offerStyleList := aBool!

Item was changed:
  ----- Method: FontChooserTool>>initialize (in category 'initialize') -----
  initialize
  	super initialize.
  	title := 'Choose A Font'.
  	getSelector := TextStyle defaultFont.
+ 	emphasis := 0.
+ 	offerStyleList := true.!
- 	emphasis := 0.!

Item was removed:
- ----- Method: TextEditor>>changeTextFontDialog (in category 'attributes') -----
- changeTextFontDialog
- 	"Present a dialog which allows the user to select a font, and if one is chosen, apply it to the current selection.	If there is no selection, or the selection is empty, apply it to the whole morph."
- 	| curFont startIndex chooser newFont |
- 	startIndex := self startIndex.
- 	curFont := (paragraph text fontAt: startIndex withStyle: paragraph textStyle).
- 	(curFont isKindOf: LogicalFont)
- 		ifTrue:[
- 			curFont := curFont copy.
- 			((paragraph text emphasisAt: startIndex) anyMask: 1) ifTrue:[curFont forceBold].
- 			((paragraph text emphasisAt: startIndex) anyMask: 2) ifTrue:[curFont forceItalicOrOblique].
- 			curFont clearRealFont].
- 	morph openModal: (
- 		Cursor wait showWhile: [ 
- 			(chooser := FontChooserTool default
- 				withTitle: 'Change the selected text''s font to...' translated
- 				for: self 
- 				setSelector: #changeSelectionFontTo:
- 				getSelector: curFont) open]).
- 	newFont := chooser result.
- 	newFont ifNotNil:[self changeSelectionFontTo: newFont].!




More information about the Squeak-dev mailing list