'From etoys3.0 of 24 February 2008 [latest update: #1969] on 16 April 2008 at 1:20:47 pm'! "Change Set: transEmphAlign-KR Date: 16 April 2008 Author: Korakurider translate choices for Emphasis & Alignment of TextMorph"! !ParagraphEditor methodsFor: 'menu messages' stamp: 'KR 4/16/2008 12:59'! changeAlignment | aList reply | #('left flush' 'centered' 'justified' 'right flush') translatedNoop. aList _ #(leftFlush centered justified rightFlush). reply _ (SelectionMenu labelList: (aList collect: [:t | t asString fromCamelCase translated]) selections: aList) startUp. reply ifNil:[^self]. self setAlignment: reply. paragraph composeAll. self recomputeSelection. self mvcRedisplay. ^ true! ! !ParagraphEditor methodsFor: 'menu messages' stamp: 'KR 4/16/2008 13:02'! changeEmphasisOrAlignment | aList reply | #('normal' 'bold' 'italic' 'narrow' 'underlined' 'struck out' 'left flush' 'centered' 'right flush' 'justified') translatedNoop. aList _ #(normal bold italic narrow underlined struckOut leftFlush centered rightFlush justified). reply _ (SelectionMenu labelList: (aList collect: [:t | t asString fromCamelCase translated]) lines: #(6) selections: aList) startUp. reply ~~ nil ifTrue: [(#(leftFlush centered rightFlush justified) includes: reply) ifTrue: [paragraph perform: reply. self recomputeInterval] ifFalse: [self setEmphasis: reply. paragraph composeAll. self recomputeSelection. self mvcRedisplay]]. ^ true! ! !TextMorphEditor methodsFor: 'attributes' stamp: 'KR 4/16/2008 13:17'! changeEmphasisOrAlignment | aList reply code align menuList startIndex alignSymbol | self flag: #arNote. "Move this up once we get rid of MVC" startIndex _ self startIndex. #('normal' 'bold' 'italic' 'narrow' 'underlined' 'struck out' 'left flush' 'centered' 'right flush' 'justified') translatedNoop. aList _ #(normal bold italic narrow underlined struckOut leftFlush centered rightFlush justified). align _ paragraph text alignmentAt: startIndex ifAbsent:[paragraph textStyle alignment]. alignSymbol _ TextAlignment alignmentSymbol: align. code _ paragraph text emphasisAt: startIndex. menuList _ WriteStream on: Array new. menuList nextPut: (code isZero ifTrue:[''] ifFalse:['']), 'normal' translated. menuList nextPutAll: (#(bold italic underlined struckOut) collect:[:emph| (code anyMask: (TextEmphasis perform: emph) emphasisCode) ifTrue:['', emph asString fromCamelCase translated] ifFalse:['',emph asString fromCamelCase translated]]). ((paragraph text attributesAt: startIndex forStyle: paragraph textStyle) anySatisfy:[:attr| attr isKern and:[attr kern < 0]]) ifTrue:[menuList nextPut:'', 'narrow' translated] ifFalse:[menuList nextPut:'', 'narrow' translated]. menuList nextPutAll: (#(leftFlush centered rightFlush justified) collect:[:type| type == alignSymbol ifTrue:['',type asString fromCamelCase translated] ifFalse:['',type asString fromCamelCase translated]]). aList _ #(normal bold italic underlined struckOut narrow leftFlush centered rightFlush justified). reply _ (SelectionMenu labelList: menuList contents lines: #(1 6) selections: aList) startUpWithoutKeyboard. reply notNil ifTrue: [(#(leftFlush centered rightFlush justified) includes: reply) ifTrue: [self setAlignment: reply. paragraph composeAll. self recomputeInterval] ifFalse: [self setEmphasis: reply. paragraph composeAll. self recomputeSelection. self mvcRedisplay]]. ^ true! !