[Pkg] The Trunk: Morphic-mt.1498.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Aug 7 07:30:14 UTC 2019
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1498.mcz
==================== Summary ====================
Name: Morphic-mt.1498
Author: mt
Time: 7 August 2019, 9:30:01.438128 am
UUID: 5820bbdd-da72-b445-92bf-5f4917241d85
Ancestors: Morphic-mt.1497
Fixes change-emphasis overrides with Shout being enabled.
Adds an option to shout-style a text selection: CMD+6 then "style it".
Provides idiomatic #styleIt hook to be used in menus or keyboard shortcuts.
=============== Diff against Morphic-mt.1497 ===============
Item was changed:
TextEditor subclass: #SmalltalkEditor
+ instanceVariableNames: ''
- instanceVariableNames: 'styler'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Text Support'!
!SmalltalkEditor commentStamp: 'jmv 8/8/2009 15:10' prior: 0!
The editor built specifically for Smalltalk code!
Item was changed:
----- Method: SmalltalkEditor>>changeEmphasis: (in category 'editing keys') -----
changeEmphasis: characterStream
"Change emphasis without styling if necessary"
+ self styler ifNil: [^super changeEmphasis: characterStream].
+ ^ self styler evaluateWithoutStyling: [super changeEmphasis: characterStream].!
- styler ifNil: [^super changeEmphasis: characterStream].
- ^styler evaluateWithoutStyling: [super changeEmphasis: characterStream].!
Item was changed:
----- Method: SmalltalkEditor>>emphasisExtras (in category 'editing keys') -----
emphasisExtras
^#(
'Do it'
+ 'Print it'
+ 'Style it'
- 'Print it'
'Link to comment of class'
'Link to definition of class'
'Link to hierarchy of class'
'Link to method'
'URL Link'
).!
Item was changed:
----- Method: SmalltalkEditor>>handleEmphasisExtra:with: (in category 'editing keys') -----
handleEmphasisExtra: index with: aKeyboardEvent
"Handle an extra emphasis menu item"
| action attribute thisSel |
action := {
[attribute := TextDoIt new.
thisSel := attribute analyze: self selection].
[attribute := TextPrintIt new.
thisSel := attribute analyze: self selection].
+ [thisSel := self styleSelection].
[attribute := TextLink new.
thisSel := attribute analyze: self selection asString with: 'Comment'].
[attribute := TextLink new.
thisSel := attribute analyze: self selection asString with: 'Definition'].
[attribute := TextLink new.
thisSel := attribute analyze: self selection asString with: 'Hierarchy'].
[attribute := TextLink new.
thisSel := attribute analyze: self selection asString].
[attribute := TextURL new.
thisSel := attribute analyze: self selection asString].
["Edit hidden info"
thisSel := self hiddenInfo. "includes selection"
attribute := TextEmphasis normal].
["Copy hidden info"
self copyHiddenInfo.
^true]. "no other action"
} at: index.
action value.
+ thisSel ifNil: [^ true]. "Could not figure out what to link to"
- thisSel ifNil: [^true]. "Could not figure out what to link to"
+ (thisSel isEmpty and: [attribute notNil])
+ ifTrue: [
+ | oldAttributes |
- attribute ifNotNil: [
- thisSel ifEmpty:[ | oldAttributes |
"only change emphasisHere while typing"
oldAttributes := paragraph text attributesAt: self pointIndex.
+ emphasisHere := Text addAttribute: attribute toArray: oldAttributes]
+ ifFalse: [
+ self replaceSelectionWith: (attribute ifNil: [thisSel] ifNotNil: [thisSel asText addAttribute: attribute]) ].
+ ^ true!
- emphasisHere := Text addAttribute: attribute toArray: oldAttributes.
- ] ifNotEmpty: [
- self replaceSelectionWith: (thisSel asText addAttribute: attribute).
- ]
- ].
- ^true!
Item was added:
+ ----- Method: SmalltalkEditor>>styleIt (in category 'do-its') -----
+ styleIt
+
+ ^ self styleSelection!
Item was added:
+ ----- Method: SmalltalkEditor>>styleSelection (in category 'do-its') -----
+ styleSelection
+
+ | styler |
+ self lineSelectAndEmptyCheck: [^ ''].
+ styler := self styler ifNil: [(Smalltalk classNamed: #SHTextStylerST80) new].
+ ^ styler styledTextFor: self selection!
Item was changed:
----- Method: SmalltalkEditor>>styler (in category 'accessing') -----
styler
"Answers the styler for this editor. Only code editors support syntax highlighting"
+ ^ self morph editView styler
- ^styler
!
Item was removed:
- ----- Method: SmalltalkEditor>>styler: (in category 'accessing') -----
- styler: aStyler
- "Sets the styler for this editor. Only code editors support syntax highlighting"
- ^styler := aStyler!
More information about the Packages
mailing list