[squeak-dev] The Trunk: Morphic-mt.1870.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Feb 5 15:21:02 UTC 2022
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1870.mcz
==================== Summary ====================
Name: Morphic-mt.1870
Author: mt
Time: 5 February 2022, 4:20:57.225491 pm
UUID: 7a906266-c964-6d43-8810-a1722667db19
Ancestors: Morphic-mt.1869
Makes use of #lineGridForMorphs and #lineGapSliceForMorphs via #useCompactLists preference.
Note that our lists do now use a list font's #lineGap by default to give it more breathing space on screen. If you do not like this, you can enable #useCompactLists:. Note that some TrueType fonts, however, depend on lists to leave some space for their font features. See #extraScale and #extraGap to configure this for your favorite font, imported via FontImporterTool.
=============== Diff against Morphic-mt.1869 ===============
Item was changed:
----- Method: IndentingListItemMorph>>minHeight (in category 'layout') -----
minHeight
| iconHeight |
iconHeight := self hasIcon
ifTrue: [self icon height + 2]
ifFalse: [0].
+ ^ self fontToUse lineGridForMorphs max: iconHeight !
- ^ self fontToUse height max: iconHeight !
Item was changed:
----- Method: LazyListMorph>>display:atRow:on: (in category 'drawing') -----
display: item atRow: row on: canvas
"display the given item at row row"
+ | drawBounds leading emphasized rowColor itemAsText alignment |
- | drawBounds emphasized rowColor itemAsText alignment |
itemAsText := item asStringOrText.
alignment := self cellPositioning.
"If it is a text, we will only use the first character's emphasis."
emphasized := itemAsText isText
ifTrue: [font emphasized: (itemAsText emphasisAt: 1)]
ifFalse: [font].
rowColor := itemAsText isText
ifTrue: [itemAsText colorAt: 1 ifNone: [self colorForRow: row]]
ifFalse: [self colorForRow: row].
drawBounds := self drawBoundsForRow: row.
alignment ~= #leftCenter ifTrue: [
| itemWidth |
itemWidth := self widthToDisplayItem: item. "includes left/right margins"
alignment == #center ifTrue: [
drawBounds := (self center x - (itemWidth / 2) floor) @ drawBounds top corner: (self center x + (itemWidth / 2) ceiling) @ drawBounds bottom].
alignment == #rightCenter ifTrue: [
drawBounds := (self right - itemWidth) @ drawBounds top corner: self right @ drawBounds bottom]].
"Draw icon if existing. Adjust draw bounds in that case."
drawBounds := drawBounds translateBy: (self cellInset left @ 0).
(self icon: row) ifNotNil: [ :icon || top |
top := drawBounds top + ((drawBounds height - self iconExtent y) // 2).
canvas translucentImage: icon at: drawBounds left @ top.
+ drawBounds := drawBounds left: drawBounds left + self iconExtent x + self cellInset left ].
- drawBounds := drawBounds left: drawBounds left + self iconExtent x + 2 ].
"We will only draw strings here."
+ leading := emphasized lineGapSliceForMorphs. "look vertically centered"
drawBounds := drawBounds translateBy: (0 @ self cellInset top).
canvas
drawString: itemAsText asString
+ in: (drawBounds origin + (0 @ leading) corner: drawBounds corner)
- in: drawBounds
font: emphasized
color: rowColor.
"Draw filter matches if any."
self
displayFilterOn: canvas
for: row
in: drawBounds
font: emphasized.!
Item was changed:
----- Method: LazyListMorph>>displayFilterOn:for:in:font: (in category 'drawing') -----
displayFilterOn: canvas for: row in: drawBounds font: font
"Draw filter matches if any."
+ | fillStyle fillHeight leading |
- | fillStyle fillHeight |
self showFilter ifFalse: [^ self].
+ fillHeight := font lineGridForMorphs.
- fillHeight := font height.
fillStyle := self filterColor isColor
ifTrue: [SolidFillStyle color: self filterColor]
ifFalse: [self filterColor].
fillStyle isGradientFill ifTrue: [
fillStyle origin: drawBounds topLeft.
fillStyle direction: 0@ fillHeight].
+ leading := font lineGapSliceForMorphs.
+
(self filterOffsets: row) do: [:offset |
| highlightRectangle |
highlightRectangle := ((drawBounds left + offset first first) @ drawBounds top
corner: (drawBounds left + offset first last) @ (drawBounds top + fillHeight)).
canvas
frameAndFillRoundRect: (highlightRectangle outsetBy: 1 at 0)
radius: (3 * RealEstateAgent scaleFactor) truncated
fillStyle: fillStyle
borderWidth: (1 * RealEstateAgent scaleFactor) truncated
borderColor: fillStyle asColor twiceDarker.
canvas
drawString: offset second
+ in: (highlightRectangle origin + (0 @ leading) corner: highlightRectangle corner)
- in: highlightRectangle
font: font
color: self filterTextColor].!
Item was changed:
----- Method: LazyListMorph>>rowHeight (in category 'layout') -----
rowHeight
+ ^ font lineGridForMorphs + self cellInset top + self cellInset bottom!
- ^ font height + self cellInset top + self cellInset bottom!
Item was changed:
----- Method: LazyListMorph>>widthToDisplayItem: (in category 'layout') -----
widthToDisplayItem: item
| labelWidth iconWidth leftMargin rightMargin |
- labelWidth := self font widthOfStringOrText: item asStringOrText.
- iconWidth := self listSource canHaveIcons ifTrue: [self iconExtent x] ifFalse: [0].
leftMargin := self cellInset left.
rightMargin := self cellInset right.
+ labelWidth := self font widthOfStringOrText: item asStringOrText.
+ iconWidth := self listSource canHaveIcons ifTrue: [self iconExtent x + leftMargin] ifFalse: [0].
^ leftMargin + iconWidth + labelWidth + rightMargin!
Item was changed:
----- Method: MenuItemMorph>>drawLabelOn: (in category 'drawing') -----
drawLabelOn: aCanvas
| stringBounds |
stringBounds := self bounds.
self hasIcon ifTrue: [
stringBounds := stringBounds left: stringBounds left + self iconForm width + 2 ].
self hasMarker ifTrue: [
stringBounds := stringBounds left: stringBounds left + self submorphBounds width + 8 ].
- stringBounds := stringBounds top: stringBounds top + stringBounds bottom - self fontToUse height // 2.
-
aCanvas
drawString: self contents
+ at: stringBounds left @ (stringBounds center y - (self fontToUse height // 2))
- in: stringBounds
font: self fontToUse
color: self colorToUse.!
Item was changed:
----- Method: MenuItemMorph>>minHeight (in category 'layout') -----
minHeight
| iconHeight |
iconHeight := self hasIcon
ifTrue: [self icon height + 2]
ifFalse: [0].
+ ^ self fontToUse lineGridForMorphs max: iconHeight!
- ^ self fontToUse height + 2 max: iconHeight!
Item was changed:
----- Method: PluggableButtonMorph>>updateMinimumExtent (in category 'layout') -----
updateMinimumExtent
| hMin vMin |
self label isMorph
ifTrue: [^ self minimumExtent: self label minExtent].
hMin := vMin := 0.
self hResizing ~~ #spaceFill
ifTrue: [hMin := (self font widthOfString: self label) max: (self font widthOf: $x) * 3].
self vResizing ~~ #spaceFill
+ ifTrue: [vMin := self font lineGridForMorphs].
- ifTrue: [vMin := self font height].
hMin := hMin + (2* self borderStyle width).
vMin := vMin + (2* self borderStyle width).
self layoutInset isRectangle
ifTrue: [
hMin := hMin + self layoutInset left + self layoutInset right.
vMin := vMin + self layoutInset top + self layoutInset bottom]
ifFalse: [self layoutInset isPoint
ifTrue: [
hMin := hMin + (2* self layoutInset x).
vMin := vMin + (2* self layoutInset y)]
ifFalse: [
hMin := hMin + (2* self layoutInset).
vMin := vMin + (2* self layoutInset)]].
self minimumExtent: hMin @ vMin.
"Since we have no submorphs, we have to resize here if we want to shrink wrap."
self hResizing == #shrinkWrap ifTrue: [self width: hMin].
self vResizing == #shrinkWrap ifTrue: [self height: vMin].!
Item was changed:
----- Method: StringMorph>>drawOn: (in category 'drawing') -----
drawOn: aCanvas
aCanvas
drawString: self contents
+ in: self innerBounds
- in: self bounds
font: self fontToUse
color: self color.!
Item was added:
+ ----- Method: StringMorph>>innerBounds (in category 'geometry - layout') -----
+ innerBounds
+ "Overwritten to respect the receiver's font's #lineGap."
+
+ | b |
+ b := super innerBounds.
+ ^ b origin + (0 @ self fontToUse lineGapSliceForMorphs) corner: b corner!
Item was changed:
----- Method: StringMorph>>measureContents (in category 'accessing - support') -----
measureContents
| f |
f := self fontToUse.
+ ^(((f widthOfString: contents) max: self minimumWidth) @ f lineGridForMorphs).!
- ^(((f widthOfString: contents) max: self minimumWidth) @ f height).!
Item was changed:
----- Method: StringMorph>>minHeight (in category 'layout') -----
minHeight
"Layout specific."
+ ^ super minHeight max: self fontToUse lineGridForMorphs!
- ^ super minHeight max: self fontToUse height!
Item was changed:
----- Method: StringMorph>>setWidth: (in category 'accessing - support') -----
setWidth: width
+ self extent: width @ self height!
- self extent: width @ (font ifNil: [TextStyle defaultFont]) height!
Item was changed:
+ (PackageInfo named: 'Morphic') postscript: '"Apply new useCompactLists property."
+ MorphicProject useCompactLists: false.'!
- (PackageInfo named: 'Morphic') postscript: '"Clear cache of blank icons"
- MenuIcons cleanUp: true.
- "Fixes height of all window titles."
- SystemWindow allSubInstancesDo: [:wnd | wnd replaceBoxes].
- "Rebuild docking bar menus."
- TheWorldMainDockingBar updateInstances.'!
More information about the Squeak-dev
mailing list
|