[squeak-dev] The Trunk: Morphic-mt.1935.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Mar 14 15:14:34 UTC 2022
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1935.mcz
==================== Summary ====================
Name: Morphic-mt.1935
Author: mt
Time: 14 March 2022, 4:13:59.244786 pm
UUID: a6e0e43c-f842-8c4d-954e-b760760e226f
Ancestors: Morphic-mt.1934
Adds a line-length limit to dialog messages. Use it to avoid having to add custom line breaks on client side. Consequently, removes layout-specific line breaks in dialog texts. Keep double-breaks (i.e., '\\' or '<br><br>') as visual gap.
Do this also in balloon texts and similar places. We have now a more robust support for custom translations (in the context of localization).
Complements Graphics-mt.498 and Morphic-mt.1933.
=============== Diff against Morphic-mt.1934 ===============
Item was changed:
----- Method: DialogWindow>>createButtonRow (in category 'initialization') -----
createButtonRow
^ buttonRow := Morph new
name: 'Buttons';
color: Color transparent;
changeTableLayout;
vResizing: #shrinkWrap;
+ hResizing: #shrinkWrap;
- hResizing: #spaceFill;
listDirection: #leftToRight;
listCentering: #center;
cellGap: (5 * RealEstateAgent scaleFactor) rounded;
yourself!
Item was changed:
----- Method: DialogWindow>>createMessage: (in category 'initialization') -----
createMessage: aString
messageMorph := aString asText asMorph.
messageMorph
name: 'Message';
readOnly: true;
+ hResizing: #shrinkWrap; vResizing: #shrinkWrap;
+ numCharactersPerLine: 45;
setProperty: #indicateKeyboardFocus toValue: #never;
handlesKeyboardOnlyOnFocus: true. "If user presses enter while only hovering the text, we want to process the stroke to close the dialog."
self setMessageParameters.
^ messageMorph!
Item was changed:
----- Method: DialogWindow>>createPane (in category 'initialization') -----
createPane
^ paneMorph := BorderedMorph new
name: 'Content';
changeProportionalLayout;
hResizing: #rigid;
vResizing: #rigid;
+ layoutInset: (0 at 0 corner: 0@ (TextStyle pointsToPixels: 5) truncated);
- layoutInset: 0;
color: Color transparent;
borderWidth: 0;
yourself.!
Item was changed:
----- Method: DialogWindow>>setMessageParameters (in category 'initialization') -----
setMessageParameters
+ | fontToUse colorToUse margins |
- | fontToUse colorToUse |
messageMorph ifNil: [^ self].
fontToUse := self userInterfaceTheme font ifNil: [TextStyle defaultFont].
colorToUse := self userInterfaceTheme textColor ifNil: [Color black].
+
+ margins := (TextStyle pointsToPixels: 5) truncated.
+
-
messageMorph
+ margins: (self wantsRoundedCorners
+ ifTrue: [margins @ (margins - self cornerRadius) corner: margins @ margins]
+ ifFalse: [margins]);
- hResizing: #shrinkWrap;
- vResizing: #shrinkWrap;
textColor: colorToUse;
textStyle: fontToUse asNewTextStyle. "Use style with other point sizes available"!
Item was changed:
----- Method: DialogWindow>>updateButtonExtent: (in category 'updating') -----
updateButtonExtent: margin
"Update all button extents."
| preferredButtonHeight |
preferredButtonHeight := ToolBuilder default buttonRowHeight.
(buttonRow submorphs collect: [:ea | ea minimumExtent]) max + margin in: [:preferredExtent |
buttonRow submorphsDo: [:ea | ea extent: preferredExtent x @ preferredButtonHeight]].
+ "Check whether horizontal or vertical button layout would be more appropriate."
+ buttonRow listDirection: #leftToRight; fullBounds.
+ buttonRow width > self messageMorph compositionRectangle width
+ ifTrue: [buttonRow listDirection: #topToBottom].!
- "See if horizontal button layout would be more appropriate."
- self flag: #magicNumber. "mt: Remove number with computation, maybe choose button font and 20 characters"
- (buttonRow submorphs collect: [:ea | ea fullBounds width]) sum > (400 * RealEstateAgent scaleFactor)
- ifTrue: [buttonRow
- hResizing: #shrinkWrap;
- listDirection: #topToBottom;
- wrapDirection: #none;
- layoutInset: (buttonRow owner fullBounds width - (buttonRow owner layoutInset left*2) - buttonRow submorphs first fullBounds width // 2 at 0)]
- ifFalse: [buttonRow
- hResizing: #spaceFill;
- listDirection: #leftToRight;
- wrapDirection: #topToBottom;
- layoutInset: 0].!
Item was changed:
Morph subclass: #NewBalloonMorph
+ instanceVariableNames: 'balloonOwner textMorph orientation hasTail'
- instanceVariableNames: 'balloonOwner textMorph maximumWidth orientation hasTail'
classVariableNames: 'UseNewBalloonMorph'
poolDictionaries: ''
category: 'Morphic-Widgets'!
!NewBalloonMorph commentStamp: 'mt 3/31/2015 10:15' prior: 0!
A balloon is a bubble with an optional tail. It contains rich text, which describes something about its balloon-owner.!
Item was changed:
----- Method: NewBalloonMorph>>bubbleInset (in category 'geometry') -----
bubbleInset
+ ^ (5 at 3 * RealEstateAgent scaleFactor) truncated!
- ^ (5 at 2 * RealEstateAgent scaleFactor) rounded!
Item was changed:
----- Method: NewBalloonMorph>>initialize (in category 'initialization') -----
initialize
super initialize.
self disableLayout: true.
self morphicLayerNumber: self class balloonLayer.
self setDefaultParameters.
textMorph := TextMorph new
+ hResizing: #shrinkWrap; vResizing: #shrinkWrap;
+ numCharactersPerLine: Preferences maxBalloonHelpLineLength;
- wrapFlag: false;
lock;
yourself.
self addMorph: textMorph.!
Item was removed:
- ----- Method: NewBalloonMorph>>maximumWidth (in category 'accessing') -----
- maximumWidth
-
- ^ maximumWidth ifNil: [
- maximumWidth := (self balloonOwner balloonFont widthOf: $m) * Preferences maxBalloonHelpLineLength]!
Item was removed:
- ----- Method: NewBalloonMorph>>maximumWidth: (in category 'accessing') -----
- maximumWidth: anInteger
-
- maximumWidth := anInteger.!
Item was changed:
----- Method: NewBalloonMorph>>setText: (in category 'initialization') -----
setText: stringOrText
| text |
text := stringOrText asText.
text hasColorAttribute ifFalse: [
text addAttribute: (TextColor color: (self userInterfaceTheme textColor ifNil: [Color black]))].
text hasFontAttribute ifFalse: [
text addAttribute: (TextFontReference toFont: (self userInterfaceTheme font ifNil: [TextStyle defaultFont]))].
- self textMorph wrapFlag: false.
self textMorph newContents: text.
- self textMorph fullBounds.
-
- (self maximumWidth > 0 and: [self textMorph width > self maximumWidth])
- ifTrue: [
- self textMorph
- wrapFlag: true;
- width: self maximumWidth].
-
self updateLayout.!
Item was changed:
----- Method: NewBalloonMorph>>tailHeight (in category 'geometry') -----
tailHeight
+ ^ (8 * RealEstateAgent scaleFactor) truncated!
- ^ (8 * RealEstateAgent scaleFactor) rounded!
Item was changed:
----- Method: NewBalloonMorph>>tailWidth (in category 'geometry') -----
tailWidth
+ ^ (15 * RealEstateAgent scaleFactor) truncated!
- ^ (15 * RealEstateAgent scaleFactor) rounded!
Item was changed:
----- Method: PluggableTextMorph>>drawWrapBorderOn: (in category 'drawing') -----
drawWrapBorderOn: aCanvas
+ | box offset rect |
- | offset rect |
self wantsWrapBorder ifFalse: [^ self].
textMorph ifNil: [^ self].
+ box := textMorph innerBounds.
+ textMorph margins ifNotNil: [:m | box := box insetBy: m].
- offset := textMorph margins isRectangle
- ifTrue: [textMorph margins left]
- ifFalse: [textMorph margins isPoint
- ifTrue: [textMorph margins x]
- ifFalse: [textMorph margins]].
- offset := offset + ((textMorph textStyle defaultFont widthOf: $x) * self class visualWrapBorderLimit).
- offset > self width ifTrue: [^ self].
+ offset := box left + (textMorph textStyle compositionWidthFor: self class
+ visualWrapBorderLimit).
+ self numCharactersPerLine ifNotNil: [
+ "Respect right margins only if we wrap at that border to not draw over glyphs."
+ offset := offset + (textMorph innerBounds right - box right) + self borderWidth].
+ offset > scroller width ifTrue: [^ self].
+
rect := scroller topLeft + (offset @ 0) corner: scroller bottomRight.
aCanvas
fillRectangle: rect
color: self wrapBorderColor.
aCanvas
line: rect topLeft
to: rect bottomLeft
+ width: self borderWidth
- width: self borderStyle width
color: (self wrapBorderColor muchDarker alpha: 0.5).!
Item was changed:
----- Method: TextEditor>>find (in category 'menu messages') -----
find
"Prompt the user for a string to search for, and search the receiver from the current selection onward for it. 1/26/96 sw"
self setSearchFromSelectionOrHistory.
+ (Project uiManager request: 'Find what to select?' translated initialAnswer: FindText)
- (UIManager default request: 'Find what to select? ' initialAnswer: FindText)
ifEmpty: [^ self]
ifNotEmpty: [:reply |
FindText := reply.
self findAgainNow].!
Item was changed:
+ ----- Method: TextMorph>>asText (in category 'converting') -----
- ----- Method: TextMorph>>asText (in category 'accessing') -----
asText
+ "Answer the receiver's text composed in a paragraph with additional line breaks. Use #text if you want to retain the original text layout."
+
+ ^ self paragraph asTextWithLineBreaks!
- ^ text!
Item was changed:
----- Method: TheWorldMainDockingBar>>installAndOpenGitBrowser (in category 'menu actions') -----
installAndOpenGitBrowser
(Smalltalk hasClassNamed: #SquitBrowser)
ifFalse: [ (UIManager default
+ confirm: 'The Git infrastructure and browser is not yet installed.\\Do you want to install the Git Browser?\\(Note that this step requires an internet connection and may take several minutes.)' translated withCRs
- confirm: 'The Git infrastructure and browser is not yet installed.\\Do you want to install the Git Browser?\\(Note that this step requires an internet connection and\may take several minutes.)' translated withCRs
title: 'Confirm Installation Request' )
ifTrue: [ Installer
ensureRecentMetacello;
installGitInfrastructure.
TheWorldMainDockingBar updateInstances ]
ifFalse: [ ^self ] ].
(Smalltalk classNamed: #SquitBrowser) open.
!
Item was changed:
----- Method: TheWorldMainDockingBar>>installAndOpenSqueakInboxTalk (in category 'menu actions') -----
installAndOpenSqueakInboxTalk
(Smalltalk hasClassNamed: #TalkInboxBrowser)
ifFalse: [ (Project uiManager
+ confirm: 'Squeak Inbox Talk is not yet installed.\\Do you want to install it?\\(Note that this step requires an internet connection and may take several minutes.)' withCRs translated
- confirm: 'Squeak Inbox Talk is not yet installed.\\Do you want to install it?\\(Note that this step requires an internet connection and\may take several minutes.)' withCRs translated
title: 'Confirm Installation Request' )
ifTrue: [ Installer
ensureRecentMetacello;
installSqueakInboxTalk.
TheWorldMainDockingBar updateInstances ]
ifFalse: [ ^self ] ].
(Smalltalk classNamed: #TalkInboxBrowser) open.
!
Item was changed:
----- Method: TheWorldMainDockingBar>>resetAllThemes (in category 'submenu - extras') -----
resetAllThemes
+ (Project uiManager confirm: 'Do you want to reset all UI themes to their original state?\\(The current theme and scale factor will be restored if possible.)' translated withCRs title: 'Reset All Themes')
- (Project uiManager confirm: 'Do you want to reset all UI themes\to their original state?\\(The current theme and scale factor\will be restored if possible.)' translated withCRs title: 'Reset All Themes')
ifTrue: [UserInterfaceTheme cleanUpAndReset].!
Item was changed:
+ (PackageInfo named: 'Morphic') postscript: 'Preferences maxBalloonHelpLineLength: 45.'!
- (PackageInfo named: 'Morphic') postscript: '"No redundant text compositions for shrink-wrapped text morphs anymore. Must recompose so that their paragraph will notice what''s going on."
- TextMorph allSubInstancesDo: [:tm | tm hResizing = #shrinkWrap ifTrue: [tm composeToBounds]].'!
More information about the Squeak-dev
mailing list
|