The Inbox: Morphic-cmm.1461.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-cmm.1461.mcz

commits-2
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)!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-cmm.1461.mcz

Chris Muller-3
For some reason, I thought there was a hot-key at one time for TRUE
indentation (not tabbing), but found no trace of it.  But rather than
consuming anymore hot-keys for such a rarely-used function, this
adds it to the alignment menu.

I know we're in a feature-freeze Edgar but, technically, this could be
considered a bug fix since it seems like this function was either
there at one point or at least should be now.  It's very low-risk
and shows off Squeak's existing Word Processor capabilities, which I
actually use and are suprisingly good.

 - Chris


 - Chris
On Fri, Aug 31, 2018 at 5:44 PM <[hidden email]> wrote:

>
> 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)!
>
>