[squeak-dev] The Inbox: Morphic-ct.2012.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jun 21 20:40:39 UTC 2022

A new version of Morphic was added to project The Inbox:

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

Name: Morphic-ct.2012
Author: ct
Time: 21 June 2022, 10:40:23.630251 pm
UUID: 91f4883b-2ebc-3845-8128-df6f54d201e2
Ancestors: Morphic-mt.2007

Proposal: Shift + click a TextURL for editing its target.

=============== Diff against Morphic-mt.2007 ===============

Item was changed:
  ----- Method: TextURL>>actOnClickFor: (in category '*Morphic') -----
  actOnClickFor: anObject
  	"Do what you can with this URL.  Later a web browser."
  	| m |
+ 	Sensor shiftPressed ifTrue: [^ self editFor: anObject].
  	(url beginsWith: 'sqPr://') ifTrue: [
  		ProjectLoading thumbnailFromUrl: (url copyFrom: 8 to: url size).
  		^ true		"should not get here, but what the heck"
  	(url beginsWith: 'code://') ifTrue: [
  		Project current addDeferredUIMessage: [self open: (Compiler evaluate: (url allButFirst: 7))].
  		^ true		"should not get here, but what the heck"
  	"if it's a web browser, tell it to jump"
  	anObject isWebBrowser
  		ifTrue: [anObject jumpToUrl: url. ^ true]
  		ifFalse: [((anObject respondsTo: #model) and: [anObject model isWebBrowser])
  				ifTrue: [anObject model jumpToUrl: url. ^ true]].
  		"if it's a morph, see if it is contained in a web browser"
  		(anObject isKindOf: Morph) ifTrue: [
  			m := anObject.
  			[ m ~= nil ] whileTrue: [
  				(m isWebBrowser) ifTrue: [
  					m  jumpToUrl: url.
  					^true ].
  				(m hasProperty: #webBrowserView) ifTrue: [
  					m model jumpToUrl: url.
  					^true ].
  				m := m owner. ]
  	"no browser in sight.  ask if we should start a new browser"
  	WebBrowser defaultOrNil
  		ifNil: [Clipboard clipboardText: url]
  		ifNotNil: [:wb |
  			(UIManager default
  				confirm: ('Do you want to open this URL in a Web browser?\\{1}' translated withCRs format: {url})
  				title: 'Open Web Page' translated)
  					ifTrue: [wb openOnUrl: url].
  					^ true ].
  	"Couldn't display in a browser.  Offer to put up just the source"
  	(UIManager default
  		confirm: ('There is no Web browser installed but the URL was copied to the clipboard:\{1}\\Do you want to view the Web page''s source/response anyway?' translated withCRs format: {url})
  		title: 'Open Web Page' translated)
  		ifTrue: [
  			(Smalltalk classNamed: 'WebClient')
  				ifNotNil: [:wc | Project current addDeferredUIMessage: [(wc httpGet: url) explore]]
  				ifNil: [HTTPSocket httpShowPage: url]].
  	^ true!

Item was added:
+ ----- Method: TextURL>>editFor: (in category '*Morphic') -----
+ editFor: anObject
+ 	self analyze: self url.
+ 	^ true!

More information about the Squeak-dev mailing list