[squeak-dev] The Trunk: Morphic-mt.1882.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Feb 10 09:12:08 UTC 2022
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1882.mcz
==================== Summary ====================
Name: Morphic-mt.1882
Author: mt
Time: 10 February 2022, 10:12:00.064982 am
UUID: 44e91808-4d53-7147-b5aa-1a42884d4d91
Ancestors: Morphic-mt.1881
Minor visual improvements for text-input requests:
- No resize grips when acceptOrCR, which are typically one-liners like search fields
- Connect horizontal-scroll policy to #alwaysHideHScrollbar preference
- Remove text attributes from initialAnswer since these dialogs are optimized for plain-text only
=============== Diff against Morphic-mt.1881 ===============
Item was changed:
----- Method: FillInTheBlankMorph>>createTextPaneAcceptOnCR: (in category 'initialization') -----
createTextPaneAcceptOnCR: acceptBoolean
textPane := PluggableTextMorph
on: self
text: #response
accept: #response:
readSelection: #selectionInterval
menu: #codePaneMenu:shifted:.
textPane
plainTextOnly: true;
+ hScrollBarPolicy: ((acceptBoolean or: (Preferences alwaysHideHScrollbar))
+ ifTrue: [#never] ifFalse: [#whenNeeded]);
+ vScrollBarPolicy: #whenNeeded;
- showScrollBarsOnlyWhenNeeded;
wantsFrameAdornments: false;
hasUnacceptedEdits: true;
askBeforeDiscardingEdits: false;
setProperty: #alwaysAccept toValue: true;
acceptOnCR: acceptBoolean;
setNameTo: 'textPane';
layoutFrame: (LayoutFrame fractions: (0 at 0 corner: 1 at 1));
hResizing: #spaceFill;
vResizing: #spaceFill;
scrollToTop.
^ textPane!
Item was changed:
----- Method: FillInTheBlankMorph>>setQuery:initialAnswer:answerExtent:acceptOnCR: (in category 'initialization') -----
setQuery: queryString initialAnswer: initialAnswer answerExtent: answerExtent acceptOnCR: acceptBoolean
+ | text textFont preferredLineCount preferredCharCount preferredExtent |
- | text |
+ result := initialAnswer asString. "plain text only; see #createTextPaneAcceptOnCR:"
- result := initialAnswer.
done := false.
self paneMorph removeAllMorphs.
self title: 'Input Requested' translated.
self message: queryString.
+ preferredLineCount := (result lineCount
+ min: 10 "Both one-liner and multi-liner show this max. lines before scrolling"
+ max: (acceptBoolean ifTrue: [1 "one-liner"] ifFalse: [3 "multi-liner"])).
+ preferredCharCount := 0.
+ result lineIndicesDo: [:start :end :endCR |
+ preferredCharCount := preferredCharCount max: end-start].
+ preferredCharCount := preferredCharCount
+ min: 75 "Optimized for bigger multi-line input request"
+ max: 30 "Optimized for a small search field".
+
+ textFont := TextStyle defaultFont.
+ preferredExtent := (textFont widthOf: $x) * preferredCharCount
+ @ (ToolBuilder default inputFieldHeightFor: preferredLineCount).
+
text := self createTextPaneAcceptOnCR: acceptBoolean.
self paneMorph addMorphBack: text.
self paneMorph
wantsPaneSplitters: true;
- addCornerGrips;
- layoutInset: ProportionalSplitterMorph gripThickness;
cellGap: ProportionalSplitterMorph gripThickness.
- self paneMorph grips do: [:ea | ea showHandle: true].
+ acceptBoolean ifFalse: [
+ self paneMorph
+ addCornerGrips;
+ layoutInset: ProportionalSplitterMorph gripThickness.
+ self paneMorph grips do: [:ea | ea showHandle: true]].
+
+ self paneMorph layoutExtent: preferredExtent.
- self paneMorph extent: ((initialAnswer asText asMorph extent + (self paneMorph layoutInset * 2) asPoint + ((20 at 10) * RealEstateAgent scaleFactor) truncated max: answerExtent) min: ((500 at 500) * RealEstateAgent scaleFactor) truncated).
self setDefaultParameters.!
More information about the Squeak-dev
mailing list
|