[squeak-dev] The Trunk: Morphic-mt.2012.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jun 22 13:10:47 UTC 2022


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.2012.mcz

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

Name: Morphic-mt.2012
Author: mt
Time: 22 June 2022, 3:10:41.886264 pm
UUID: 151eca82-7108-b244-b81d-e5604db8ebf9
Ancestors: Morphic-ct.2011, Morphic-ct.2010, Morphic-ct.1994

Merges (and revises) Morphic-ct.2010, Morphic-ct.1994 and cherri-picks from Morphic-kfr-2001...1997 (wrong ancestry).

Morphic-ct.2011:
	Corrects documentation for Morph >> #startDrag:. Please review briefly.

Morphic-ct.2010:
	Proposal to fix z-order of docking bar menus when etoys mode is activated.

Morphic-ct.1994:
	Minor UI improvement to FontImporter: Use menu style for the previewText button and make the buttons in the preview slightly larger to avoid overlapping texts.

Morphic-kfr-2001...1997
- Open a HelpBrowser with TextLink.
- Modal color picker balloon help must pop up above the tiny morphs, not on top of them
- Offset of temporary cursor was off
- When ColorPicker is triggered from halo, remove the halo. Otherwise it will sometimes obscure the ColorPicker.
- Get rid of balloon help [in color picker]

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

Item was changed:
  ----- Method: ColorPickerMorph>>modalBalloonHelpAtPoint: (in category 'private') -----
  modalBalloonHelpAtPoint: cursorPoint 
  	self flag: #arNote.	"Throw this away. There needs to be another way."
  	self submorphsDo: 
  			[:m | 
  			m wantsBalloon 
  				ifTrue: 
  					[(m valueOfProperty: #balloon) isNil
  						ifTrue: 
+ 							[(m containsPoint: cursorPoint) ifTrue: [m showBalloon: m balloonText at: (m topCenter ). 
+ 								m setProperty: #balloon toValue: true]]
+ 						ifFalse: [(m containsPoint: cursorPoint) ifFalse: [self deleteBalloon.
+ 								m setProperty: #balloon toValue:nil]]]]!
- 							[(m containsPoint: cursorPoint) ifTrue: [m showBalloon: m balloonText]]
- 						ifFalse: [(m containsPoint: cursorPoint) ifFalse: [m deleteBalloon]]]]!

Item was changed:
  ----- Method: ColorPickerMorph>>pickUpColorFor: (in category 'menu') -----
  pickUpColorFor: aMorph
  	"Show the eyedropper cursor, and modally track the mouse through a mouse-down and mouse-up cycle"
  
        | aHand localPt c |
  	aHand := aMorph ifNil: [self activeHand] ifNotNil: [aMorph activeHand].
  	aHand ifNil: [aHand := self currentHand].
  	self addToWorld: aHand world near: (aMorph ifNil: [aHand world]) fullBounds.
  	self owner ifNil: [^ self].
  
  	aHand showTemporaryCursor: (ScriptingSystem formAtKey: #Eyedropper) 
+ 			hotSpotOffset: 2 at 14.    "<<<< the form was changed a bit??"
- 			hotSpotOffset: 6 negated @ 4 negated.    "<<<< the form was changed a bit??"
  
  	self updateContinuously: false.
  	[Sensor anyButtonPressed]
  		whileFalse: 
  			 [self trackColorUnderMouse].
  	self deleteAllBalloons.
  
  	localPt := Sensor cursorPoint - self topLeft.
  	self inhibitDragging ifFalse: [
  		(DragBox containsPoint: localPt) ifTrue:
  			["Click or drag the drag-dot means to anchor as a modeless picker"
  			^ self anchorAndRunModeless: aHand].
  	].
  	(clickedTranslucency := TransparentBox containsPoint: localPt)
  		ifTrue: [selectedColor := originalColor].
  
  	self updateContinuously: true.
  	[Sensor anyButtonPressed]
  		whileTrue:
  			 [self updateTargetColorWith: self indicateColorUnderMouse].
  	c := self getColorFromKedamaWorldIfPossible: Sensor cursorPoint.
  	c ifNotNil: [selectedColor := c].
  	aHand newMouseFocus: nil;
  		showTemporaryCursor: nil;
  		flushEvents.
  	self delete.
  		 
   !

Item was added:
+ ----- Method: DockingBarMenuMorph>>popUpAdjacentTo:forHand:from: (in category 'as yet unclassified') -----
+ popUpAdjacentTo: rightOrLeftPoint forHand: hand from: sourceItem
+ 
+ 	| ownerInWorld world |
+ 	super popUpAdjacentTo: rightOrLeftPoint forHand: hand from: sourceItem.
+ 	
+ 	"Docking bar and protruding menu should appear visually merged. Move the source item behind the receiver. If we did it the other way around, other navigators and docking bars in front of the sourceItem would cover the receiver. For the same reason, we can't use a higher different morphic layer numbers for docking bar menus because this would hide them after all other navigators."
+ 	world := owner world.
+ 	ownerInWorld := sourceItem firstOwnerSuchThat: [:owner | owner owner == world].
+ 	world addMorph: ownerInWorld inFrontOf: self.!

Item was changed:
  ----- Method: DockingBarMorph>>add:icon:help:subMenu: (in category 'construction') -----
  add: wordingString icon: aForm help: helpString subMenu: aMenuMorph 
  	"Append the given submenu with the given label."
  	| item |
  	item := DockingBarItemMorph new.
  	item contents: wordingString.
  	item subMenu: aMenuMorph.
  	item icon: aForm.
  	helpString isNil
  		ifFalse: [item setBalloonText: helpString].
  	aMenuMorph ifNotNil: [
+ 		"Docking bar and protruding menu should appear visually merged."
+ 		aMenuMorph morphicLayerNumber: self morphicLayerNumber].
- 		aMenuMorph morphicLayerNumber: self morphicLayerNumber + 1].
  	self addMorphBack: item!

Item was changed:
  ----- Method: DockingBarMorph>>add:icon:selectedIcon:help:subMenu: (in category 'construction') -----
  add: wordingString icon: aForm selectedIcon: anotherForm help: helpString subMenu: aMenuMorph 
  	"Append the given submenu with the given label."
  	| item |
  	item := DockingBarItemMorph new
  		contents: wordingString;
  		subMenu: aMenuMorph;
  		icon: aForm;
  		selectedIcon: anotherForm.
  	helpString ifNotNil: [
  		item setBalloonText: helpString ].
  	aMenuMorph ifNotNil: [
+ 		"Docking bar and protruding menu should appear visually merged."
+ 		aMenuMorph morphicLayerNumber: self morphicLayerNumber].
- 		aMenuMorph morphicLayerNumber: self morphicLayerNumber + 1 ].
  	self addMorphBack: item!

Item was changed:
  ----- Method: DockingBarMorph>>addItem: (in category 'construction') -----
  addItem: aBlock
  	| item |
  	item := DockingBarItemMorph new.
  	aBlock value: item.
  	item subMenu ifNotNil: [:menu |
  		"Docking bar and protruding menu should appear visually merged."
+ 		menu morphicLayerNumber: self morphicLayerNumber].
- 		menu morphicLayerNumber: self morphicLayerNumber + 1].
  	self addMorphBack: item!

Item was changed:
  ----- Method: DockingBarMorph>>addUpdatingItem: (in category 'construction') -----
  addUpdatingItem: aBlock
  	| item |
  	item := DockingBarUpdatingItemMorph new.
  	aBlock value: item.
  	item subMenu ifNotNil: [:menu |
  		"Docking bar and protruding menu should appear visually merged."
+ 		menu morphicLayerNumber: self morphicLayerNumber].
- 		menu morphicLayerNumber: self morphicLayerNumber + 1].
  	self addMorphBack: item!

Item was changed:
  ----- Method: FontImporterTool>>buildPreviewPaneWith: (in category 'ui - building') -----
  buildPreviewPaneWith: builder
  	"Build the preview panel. Offer the user the change preview text through the default font, point size, extra (glyph) scale and extra (line) gap."
  	
  	^ builder pluggablePanelSpec new
  "		wantsResizeHandles: true;"
  		children: {
  			builder pluggablePanelSpec new
  				children: {
  					builder pluggableButtonSpec new
  						model: self;
  						help: #previewTextButtonHelp;
  						label: #previewTextButtonLabel;
  						action: #offerPreviewTextMenu;
+ 						style: #menuButton;
+ 						frame: (LayoutFrame fractions: (0 at 0 corner: 0.16 at 1));
- 						frame: (LayoutFrame fractions: (0 at 0 corner: 0.15 at 1));
  						yourself.
  						
  					builder pluggableInputFieldSpec new
  						model: self;
  						help: 'Type custom preview text here...' translated;
  						getText: #customPreviewText;
  						setText: #acceptCustomPreviewText:;
  						editText: #editCustomPreviewText:;
  						plainTextOnly: true;
+ 						frame: (LayoutFrame fractions: (0.16 at 0 corner: 0.84 at 1));
- 						frame: (LayoutFrame fractions: (0.15 at 0 corner: 0.85 at 1));
  						yourself.
  						
  					builder pluggableButtonSpec new
  						model: self;
  						help: 'Click to see current preview text using the system''s current fonts for comparison' translated;
  						label: 'Compare' translated;
  						action: #browseSystemFonts;
+ 						frame: (LayoutFrame fractions: (0.84 at 0 corner: 1 at 1));
- 						frame: (LayoutFrame fractions: (0.85 at 0 corner: 1 at 1));
  						yourself };
  				frame:  (LayoutFrame
  					fractions: (0 at 0 corner: 1 at 0)
  					offsets: (0 at 0 corner: 0@ self customPreviewTextHeight));
  				yourself.
  				
  			builder pluggableTextSpec new
  				model: self;
  				getText: #previewText;
  				textStyle: #selectedFontTextStyle;
  				askBeforeDiscardingEdits: false;
  				indicateUnacceptedChanges: false;
  				softLineWrap: false;
  				padding: self previewTextPadding;
  				stylerClass: (TextStyler for: #Smalltalk);
  				menu: #previewTextMenu:shifted:;
  				frame: (LayoutFrame
  					fractions: (0 at 0 corner: 1 at 1)
  					offsets: (0 @ self customPreviewTextHeight corner: 0@ self configurationPanelHeight negated));
  				yourself.
  				
  			builder pluggablePanelSpec new name: #configPanel; children: (Array streamContents: [:s | | n |
  				n := 0.
  				self fontConfigurationSpecs groupsDo: [:kind :get :help :label :group | | w |
  					kind caseOf: {
  						[#spacer] -> [
  							w := builder pluggableSpacerSpec new fillSpaceHorizontally].
  						[#button] -> [
  							w := builder pluggableButtonSpec new
  								model: self; label: label; action: get; help: help; yourself].
  						[#text] -> [
  							w := builder pluggableInputFieldSpec new
  								model: self; getText: get; setText: get asSimpleSetter;
  								help: help; plainTextOnly: true; yourself].
  					} otherwise: [ "Ignore" ].
  					w ifNotNil: [ "Remember the group. See #toggleEditMode"
  						w name: (group, (n := n + 1)) asSymbol.
  						s nextPut: w] ]]);
  				layout: #horizontal;
  				frame: self configurationPanelFrame;
  				yourself.
  		};
  		yourself!

Item was changed:
  ----- Method: Morph>>changeColor (in category 'menus') -----
  changeColor
  	"Change the color of the receiver -- triggered, e.g. from a menu"
  	NewColorPickerMorph useIt
  		ifTrue: [ (NewColorPickerMorph on: self) openNear: self fullBoundsInWorld ]
  		ifFalse:
+ 			[ self removeHalo."Halo can obscure the color picker"
+ 			  ColorPickerMorph new
- 			[ ColorPickerMorph new
  				 choseModalityFromPreference ;
  				 sourceHand: self activeHand ;
  				 target: self ;
  				 selector: #fillStyle: ;
  				 originalColor: self color ;
  				
  				putUpFor: self
  				near: self fullBoundsInWorld ]!

Item was changed:
  ----- Method: Morph>>startDrag: (in category 'event handling') -----
  startDrag: evt
+ 	"Handle a drag event when the user moves the cursor over the receiver, pressing and holding the red button, and then moves the cursor for more than the #dragThreshold. This message is only sent to clients that request it by sending #waitForClicksOrDrag:event: to the initiating hand in their mouseDown: method. This default implementation delegates to an #eventHandler if any."
- 	"Handle a double-click event. This message is only sent to clients that request it by sending #waitForClicksOrDrag:event: to the initiating hand in their mouseDown: method. This default implementation does nothing."
  
  	self eventHandler ifNotNil:
  		[self eventHandler startDrag: evt fromMorph: self].!

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 help on 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 with: 'Help'].
+ 		[attribute := TextLink new.
  		thisSel := attribute analyze: self selection asString].
  		[attribute := TextURL new.
  		thisSel := attribute analyze: self selection asString].
  		[thisSel := self selection.
  		attribute := self requestAttribute].
  		["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