The Inbox: Morphic-ct.1587.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-ct.1587.mcz

commits-2
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1587.mcz

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

Name: Morphic-ct.1587
Author: ct
Time: 10 November 2019, 7:45:50.611559 pm
UUID: 8e927769-03b3-2946-be0e-f116cbd279a8
Ancestors: Morphic-mt.1584

Proposal: Add ultimative emphasisExtra "Custom attribute"

=============== Diff against Morphic-mt.1584 ===============

Item was changed:
  ----- Method: SmalltalkEditor>>emphasisExtras (in category 'editing keys') -----
  emphasisExtras
  ^#(
  'Do it'
  'Print it'
  'Style it'
  'Link to comment of class'
  'Link to definition of class'
  'Link to hierarchy of class'
  'Link to method'
  'URL Link'
+ 'Custom attribute'
  ).!

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].
+ [| input |
+ input := UIManager default request: 'Enter attribute expression:'.
+ input isEmptyOrNil ifTrue: [^ false].
+ attribute := Compiler evaluate: input.
+ thisSel := self selection].
  ["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 isEmpty and: [attribute notNil])
  ifTrue: [
  | 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!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1587.mcz

Christoph Thiede