[squeak-dev] The Trunk: Morphic-ct.1587.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 26 15:21:32 UTC 2022


Christoph Thiede uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/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!



More information about the Squeak-dev mailing list