[squeak-dev] The Inbox: Morphic-cmm.1461.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Aug 31 22:44:00 UTC 2018
Chris Muller uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-cmm.1461.mcz
==================== Summary ====================
Name: Morphic-cmm.1461
Author: cmm
Time: 31 August 2018, 5:43:21.798326 pm
UUID: 6dc60589-e0cb-48b5-b7ef-45d11b88aca1
Ancestors: Morphic-kfr.1460
Provide access to the TextIndent attribute on the alignment menu.
=============== Diff against Morphic-kfr.1460 ===============
Item was changed:
----- Method: TextEditor>>changeAlignment (in category 'menu messages') -----
changeAlignment
+ | options reply |
+ options := self existingIndentation
+ caseOf:
+ {[0]-> [ #('leftFlush' 'indented' 'centered' 'justified' 'rightFlush') ].
+ [1] -> [ #('leftFlush' 'indented more' 'centered' 'justified' 'rightFlush') ]}
+ otherwise: [ #('leftFlush' 'indented less' 'indented more' 'centered' 'justified' 'rightFlush') ].
+ reply := UIManager default chooseFrom: options values: options.
+ reply ifNil: [ ^ self ].
- | aList reply |
- aList := #(leftFlush centered justified rightFlush).
- reply := UIManager default chooseFrom: aList values: aList.
- reply ifNil:[^self].
self setAlignment: reply.
paragraph composeAll.
self recomputeSelection.
^ true!
Item was added:
+ ----- Method: TextEditor>>existingIndentation (in category 'private') -----
+ existingIndentation
+ ^ paragraph text indentationAmountAt: (self encompassLine: self selectionInterval)!
Item was changed:
----- Method: TextEditor>>setAlignment: (in category 'menu messages') -----
+ setAlignment: selectionString
+ | attr interval |
+ attr := selectionString
+ caseOf:
+ { [ 'indented' ] -> [ TextIndent amount: 1 ].
+ [ 'indented more' ] -> [ TextIndent amount: self existingIndentation+1 ].
+ [ 'indented less' ] -> [ TextIndent amount: (self existingIndentation-1 max: 0) ]}
+ otherwise:
+ [ TextAlignment perform: selectionString asSymbol ].
- setAlignment: aSymbol
- | attr interval |
- attr := TextAlignment perform: aSymbol.
interval := self encompassLine: self selectionInterval.
+ paragraph
- paragraph
replaceFrom: interval first
to: interval last
with: ((paragraph text copyFrom: interval first to: interval last) addAttribute: attr)!
More information about the Squeak-dev
mailing list
|