Christoph Thiede uploaded a new version of Tools to project The Trunk: http://source.squeak.org/trunk/Tools-ct.1176.mcz
==================== Summary ====================
Name: Tools-ct.1176 Author: ct Time: 13 September 2022, 9:07:22.211523 am UUID: 148ebbd0-9395-6244-9393-47242da1629b Ancestors: Tools-ct.1175
Improves high-dpi support for FileList2.
=============== Diff against Tools-ct.1175 ===============
Item was changed: ----- Method: FileList2 class>>blueButtonText:textColor:color:inWindow: (in category 'blue ui') ----- blueButtonText: aString textColor: textColor color: aColor inWindow: window | result | result := window fancyText: aString translated + font: Preferences standardButtonFont - font: Preferences standardEToysFont color: textColor. result setProperty: #buttonText toValue: aString; hResizing: #rigid; + extent: 100 px @ 20 px; + layoutInset: 4 px; + borderWidth: 1 px; - extent: 100 @ 20; - layoutInset: 4; - borderWidth: 1; useRoundedCorners. aColor isNil ifFalse: [""result color: aColor. result borderColor: aColor muchDarker]. ^ result!
Item was changed: ----- Method: FileList2 class>>blueButtonText:textColor:color:inWindow:balloonText:selector:recipient: (in category 'blue ui') ----- blueButtonText: aString textColor: textColor color: aColor inWindow: window balloonText: balloonText selector: sel recipient: recip | result | result := window fancyText: aString translated + font: Preferences standardButtonFont - font: Preferences standardEToysFont color: textColor. result setProperty: #buttonText toValue: aString; hResizing: #rigid; + extent: 100 px @ 20 px; + layoutInset: 4 px; + borderWidth: 1 px; - extent: 100 @ 20; - layoutInset: 4; - borderWidth: 1; useRoundedCorners; setBalloonText: balloonText. result on: #mouseUp send: sel to: recip. aColor isNil ifFalse: ["" result color: aColor. result borderColor: aColor muchDarker]. ^ result!
Item was changed: ----- Method: FileList2 class>>morphicViewFileSelectorForSuffixes:directory: (in category 'morphic ui') ----- morphicViewFileSelectorForSuffixes: aList directory: dir "Answer a morphic file-selector tool for the given suffix list and the given directory."
| aFileList window fixedSize midLine gap | aFileList := self new directory: dir. aFileList optionalButtonSpecs: aFileList okayAndCancelServices. aList ifNotNil: [aFileList fileSelectionBlock: [:entry :myPattern | entry isDirectory ifTrue: [false] ifFalse: [aList includes: (FileDirectory extensionFor: entry name asLowercase)]]]. window := BorderedMorph new layoutPolicy: ProportionalLayout new; color: Color lightBlue; borderColor: Color blue; + borderWidth: 4 px; + layoutInset: 4 px; + extent: 600 px @ 400 px; - borderWidth: 4; - layoutInset: 4; - extent: 600@400; useRoundedCorners. window setProperty: #fileListModel toValue: aFileList. aFileList modalView: window. midLine := 0.4. + fixedSize := 25 px. + gap := 5 px. - fixedSize := 25. - gap := 5. self addFullPanesTo: window from: { {self textRow: 'Please select a file'. 0 @ 0 corner: 1 @ 0. 0@0 corner: 0@fixedSize}. {aFileList optionalButtonRow. 0 @ 0 corner: 1 @ 0. 0@fixedSize corner: 0@(fixedSize * 2)}. {aFileList morphicDirectoryTreePane. 0@0 corner: midLine@1. gap @(fixedSize * 2) corner: gap negated@0}. {aFileList morphicFileListPane. midLine @ 0 corner: 1@1. gap@(fixedSize * 2) corner: gap negated@0}. }.
aFileList postOpen.
^ window !
Item was changed: ----- Method: FileList2 class>>morphicViewFolderSelector: (in category 'morphic ui') ----- morphicViewFolderSelector: aDir "Answer a tool that allows the user to select a folder"
| aFileList window fixedSize | aFileList := self new directory: aDir. aFileList optionalButtonSpecs: aFileList servicesForFolderSelector. window := (SystemWindow labelled: aDir pathName) model: aFileList. aFileList modalView: window.
+ fixedSize := 25 px. - fixedSize := 25. self addFullPanesTo: window from: { {self textRow: 'Please select a folder'. 0 @ 0 corner: 1 @ 0. 0@0 corner: 0@fixedSize}. {aFileList optionalButtonRow. 0 @ 0 corner: 1 @ 0. 0@fixedSize corner: 0@(fixedSize * 2)}. {aFileList morphicDirectoryTreePane. 0@0 corner: 1@1. 0@(fixedSize * 2) corner: 0@0}. }. aFileList postOpen. + ^ window! - ^ window !
Item was changed: ----- Method: FileList2 class>>morphicViewGeneralLoaderInWorld: (in category 'blue ui') ----- morphicViewGeneralLoaderInWorld: aWorld " FileList2 morphicViewGeneralLoaderInWorld: self currentWorld " | window aFileList buttons treePane textColor1 fileListPane pane2a pane2b fileTypeInfo fileTypeButtons fileTypeRow actionRow |
fileTypeInfo := self endingSpecs. window := AlignmentMorphBob1 newColumn. window hResizing: #shrinkWrap; vResizing: #shrinkWrap. textColor1 := Color r: 0.742 g: 0.839 b: 1.0. aFileList := self new directory: FileDirectory default. aFileList fileSelectionBlock: self projectOnlySelectionBlock; modalView: window. window setProperty: #FileList toValue: aFileList; wrapCentering: #center; cellPositioning: #topCenter; + borderWidth: 1 px; - borderWidth: 1; borderColor: (Color r: 0.9 g: 0.801 b: 0.2); useRoundedCorners.
fileTypeButtons := fileTypeInfo collect: [ :each | (self blueButtonText: each first textColor: Color gray inWindow: window) setProperty: #enabled toValue: true; hResizing: #shrinkWrap; useSquareCorners ]. buttons := {{'OK'. Color lightGreen}. {'Cancel'. Color lightRed}} collect: [ :each | self blueButtonText: each first textColor: textColor1 color: each second inWindow: window ].
treePane := aFileList morphicDirectoryTreePane + extent: 250 px @ 300 px; - extent: 250@300; retractable: false; borderWidth: 0. fileListPane := aFileList morphicFileListPane + extent: 350 px @ 300 px; - extent: 350@300; retractable: false; borderWidth: 0. window addARow: {window fancyText: 'Find...' translated font: Preferences standardEToysTitleFont color: textColor1}. + fileTypeRow := window addARowCentered: fileTypeButtons cellInset: 2 px. - fileTypeRow := window addARowCentered: fileTypeButtons cellInset: 2. actionRow := window addARowCentered: { buttons first. + (Morph new extent: 30 px @ 5 px) color: Color transparent. - (Morph new extent: 30@5) color: Color transparent. buttons second + } cellInset: 2 px. - } cellInset: 2. window addARow: { (window inAColumn: {(pane2a := window inARow: {window inAColumn: {treePane}}) useRoundedCorners; layoutInset: 0; + borderWidth: 1 px; - borderWidth: 1; borderColor: (Color r: 0.6 g: 0.7 b: 1) }) layoutInset: 10. (window inAColumn: {(pane2b := window inARow: {window inAColumn: {fileListPane}}) useRoundedCorners; layoutInset: 0; + borderWidth: 1 px; - borderWidth: 1; borderColor: (Color r: 0.6 g: 0.7 b: 1) + }) layoutInset: 10 px. - }) layoutInset: 10. }. window fullBounds. window fillWithRamp: (Color r: 1 g: 0.85 b: 0.975) oriented: 0.65. pane2a fillWithRamp: (Color r: 0.85 g: 0.9 b: 1) oriented: (0.7 @ 0.35). pane2b fillWithRamp: (Color r: 0.85 g: 0.9 b: 1) oriented: (0.7 @ 0.35). " buttons do: [ :each | each fillWithRamp: ColorTheme current dialogButtonsRampOrColor oriented: (0.75 @ 0). ]. " fileTypeButtons do: [ :each | each on: #mouseUp send: #value:value: to: [ :evt :morph | self update: actionRow in: window fileTypeRow: fileTypeRow morphUp: morph. ] ]. buttons first on: #mouseUp send: #okHit to: aFileList. buttons second on: #mouseUp send: #cancelHit to: aFileList. aFileList postOpen. window position: aWorld topLeft + (aWorld extent - window extent // 2). aFileList directoryChangeBlock: [ :newDir | self update: actionRow in: window fileTypeRow: fileTypeRow morphUp: nil. self enableTypeButtons: fileTypeButtons info: fileTypeInfo forDir: newDir. ]. aFileList directory: aFileList directory. window adoptPaneColor: (Color r: 0.548 g: 0.677 b: 1.0). ^ window openInWorld: aWorld.!
Item was changed: ----- Method: FileList2 class>>morphicViewImageViewer (in category 'morphic ui') ----- morphicViewImageViewer
| dir aFileList window midLine fixedSize |
dir := FileDirectory default. aFileList := self new directory: dir. aFileList optionalButtonSpecs: aFileList specsForImageViewer. aFileList fileSelectionBlock: [ :entry :myPattern | entry isDirectory ifTrue: [ false ] ifFalse: [ #('bmp' 'gif' 'jpg' 'form' 'png') includes: (FileDirectory extensionFor: entry name asLowercase) ] ]. window := (SystemWindow labelled: dir pathName) model: aFileList.
+ fixedSize := 25 px. - fixedSize := 25. midLine := 0.4. self addFullPanesTo: window from: { {aFileList optionalButtonRow. 0 @ 0 corner: 1 @ 0. 0@0 corner: 0@fixedSize}. {aFileList morphicDirectoryTreePane. 0@0 corner: midLine@1. 0@fixedSize corner: 0@0}. {aFileList morphicFileListPane. midLine @ 0 corner: 1@1. 0@fixedSize corner: 0@0}. }. aFileList postOpen. ^ window !
Item was changed: ----- Method: FileList2 class>>morphicViewNoFile (in category 'morphic ui') ----- morphicViewNoFile
| dir aFileList window midLine fixedSize |
dir := FileDirectory default. aFileList := self new directory: dir. window := (SystemWindow labelled: dir pathName) model: aFileList.
+ fixedSize := 25 px. - fixedSize := 25. midLine := 0.4. self addFullPanesTo: window from: { {aFileList morphicPatternPane. 0@0 corner: 0.3@0. 0@0 corner: 0@fixedSize}. {aFileList optionalButtonRow. 0.3 @ 0 corner: 1@0. 0@0 corner: 0@fixedSize}. {aFileList morphicDirectoryTreePane. 0@0 corner: midLine@1. 0@fixedSize corner: 0@0}. {aFileList morphicFileListPane. midLine @ 0 corner: 1@1. 0@fixedSize corner: 0@0}. }. aFileList postOpen. + ^ window! - ^ window !
Item was changed: ----- Method: FileList2 class>>morphicViewProjectLoader (in category 'morphic ui') ----- morphicViewProjectLoader
| dir aFileList window midLine fixedSize |
dir := FileDirectory default. aFileList := self new directory: dir. aFileList optionalButtonSpecs: aFileList servicesForProjectLoader. aFileList fileSelectionBlock: self projectOnlySelectionBlock. window := (SystemWindow labelled: dir pathName) model: aFileList.
+ fixedSize := 25 px. - fixedSize := 25. midLine := 0.4. self addFullPanesTo: window from: { {aFileList optionalButtonRow. 0 @ 0 corner: 1 @ 0. 0@0 corner: 0@fixedSize}. {aFileList morphicDirectoryTreePane. 0@0 corner: midLine@1. 0@fixedSize corner: 0@0}. {aFileList morphicFileListPane. midLine @ 0 corner: 1@1. 0@fixedSize corner: 0@0}. }. aFileList postOpen. + ^ window! - ^ window !
Item was changed: ----- Method: FileList2 class>>morphicViewProjectLoader2InWorld:reallyLoad:dirFilterType: (in category 'blue ui') ----- morphicViewProjectLoader2InWorld: aWorld reallyLoad: aBoolean dirFilterType: aSymbol
| window aFileList buttons treePane textColor1 fileListPane pane2a pane2b treeExtent filesExtent |
window := AlignmentMorphBob1 newColumn. window hResizing: #shrinkWrap; vResizing: #shrinkWrap. textColor1 := Color r: 0.742 g: 0.839 b: 1.0. aFileList := self new. aFileList optionalButtonSpecs: aFileList servicesForProjectLoader; fileSelectionBlock: ( aSymbol == #limitedSuperSwikiDirectoryList ifTrue: [ MessageSend receiver: Project current selector: #latestProjectVersionsFromFileEntries: ] ifFalse: [ self projectOnlySelectionBlock ] ); "dirSelectionBlock: self hideSqueakletDirectoryBlock;" modalView: window. aFileList directory: FileDirectory default. window setProperty: #FileList toValue: aFileList; wrapCentering: #center; cellPositioning: #topCenter; + borderWidth: 1 px; - borderWidth: 1; borderColor: (Color r: 0.9 g: 0.801 b: 0.2); useRoundedCorners. buttons := {{'OK'. Color lightGreen}. {'Cancel'. Color lightRed}} collect: [ :each | self blueButtonText: each first textColor: textColor1 color: each second inWindow: window ].
+ aWorld width < 800 px ifTrue: [ + treeExtent := 150 px @ 300 px. + filesExtent := 350 px @ 300 px. - aWorld width < 800 ifTrue: [ - treeExtent := 150@300. - filesExtent := 350@300. ] ifFalse: [ + treeExtent := 350 px @ 500 px. + filesExtent := 550 px @500 px. - treeExtent := 350@500. - filesExtent := 550@500. ]. (treePane := aFileList morphicDirectoryTreePaneFiltered: aSymbol) extent: treeExtent; retractable: false; borderWidth: 0. fileListPane := aFileList morphicFileListPane extent: filesExtent; retractable: false; borderWidth: 0. window addARow: { window fancyText: 'Load A Project' translated font: Preferences standardEToysTitleFont color: textColor1 }; addARowCentered: { buttons first. + (Morph new extent: 30 px @ 5 px) color: Color transparent. - (Morph new extent: 30@5) color: Color transparent. buttons second }; addARow: { + window fancyText: 'Please select a project' translated font: Preferences standardButtonFont color: textColor1 - window fancyText: 'Please select a project' translated font: Preferences standardEToysFont color: textColor1 }; addARow: { (window inAColumn: {(pane2a := window inARow: {window inAColumn: {treePane}}) useRoundedCorners; layoutInset: 0; + borderWidth: 1 px; - borderWidth: 1; borderColor: (Color r: 0.6 g: 0.7 b: 1) + }) layoutInset: 10 px. - }) layoutInset: 10. (window inAColumn: {(pane2b := window inARow: {window inAColumn: {fileListPane}}) useRoundedCorners; layoutInset: 0; + borderWidth: 1 px; - borderWidth: 1; borderColor: (Color r: 0.6 g: 0.7 b: 1) + }) layoutInset: 10 px. - }) layoutInset: 10. }. window fullBounds. window fillWithRamp: (Color r: 1 g: 0.85 b: 0.975) oriented: 0.65. pane2a fillWithRamp: (Color r: 0.85 g: 0.9 b: 1) oriented: (0.7 @ 0.35). pane2b fillWithRamp: (Color r: 0.85 g: 0.9 b: 1) oriented: (0.7 @ 0.35). " buttons do: [ :each | each fillWithRamp: ColorTheme current dialogButtonsRampOrColor oriented: (0.75 @ 0). ]. " buttons first on: #mouseUp send: (aBoolean ifTrue: [#okHitForProjectLoader] ifFalse: [#okHit]) to: aFileList. buttons second on: #mouseUp send: #cancelHit to: aFileList. aFileList postOpen. window position: aWorld topLeft + (aWorld extent - window extent // 2). window adoptPaneColor: (Color r: 0.548 g: 0.677 b: 1.0). ^ window openInWorld: aWorld.!
Item was changed: ----- Method: FileList2 class>>morphicViewProjectSaverFor: (in category 'blue ui') ----- morphicViewProjectSaverFor: aProject " (FileList2 morphicViewProjectSaverFor: Project current) openInWorld " | window aFileList buttons treePane pane2 textColor1 option treeExtent buttonData buttonRow |
textColor1 := Color r: 0.742 g: 0.839 b: 1.0. aFileList := self new directory: ServerDirectory projectDefaultDirectory. aFileList dirSelectionBlock: self hideSqueakletDirectoryBlock. window := AlignmentMorphBob1 newColumn. window hResizing: #shrinkWrap; vResizing: #shrinkWrap. aFileList modalView: window. window setProperty: #FileList toValue: aFileList; wrapCentering: #center; cellPositioning: #topCenter; borderWidth: 1; borderColor: (Color r: 0.9 g: 0.801 b: 0.2); useRoundedCorners.
buttonData := Preferences enableLocalSave ifTrue: [{ {'Save'. #okHit. 'Save in the place specified below, and in the Squeaklets folder on your local disk'. Color lightGreen}. {'Save on local disk only'. #saveLocalOnlyHit. 'saves in the Squeaklets folder'. Color lightGreen}. {'Cancel'. #cancelHit. 'return without saving'. Color lightRed} }] ifFalse: [{ {'Save'. #okHit. 'Save in the place specified below, and in the Squeaklets folder on your local disk'. Color lightGreen}. {'Cancel'. #cancelHit. 'return without saving'. Color lightRed} }]. buttons := buttonData collect: [ :each | (self blueButtonText: each first textColor: textColor1 color: each fourth inWindow: window) setBalloonText: each third translated; hResizing: #shrinkWrap; on: #mouseUp send: each second to: aFileList ].
option := aProject world valueOfProperty: #SuperSwikiPublishOptions ifAbsent: [#initialDirectoryList]. aProject world removeProperty: #SuperSwikiPublishOptions.
+ treeExtent := Project current world height < 500 px + ifTrue: [ 350 px @ 150 px ] + ifFalse: [ 350 px @ 300 px ]. - treeExtent := Project current world height < 500 - ifTrue: [ 350@150 ] - ifFalse: [ 350@300 ].
(treePane := aFileList morphicDirectoryTreePaneFiltered: option) extent: treeExtent; retractable: false; borderWidth: 0. window addARowCentered: { window fancyText: 'Publish This Project' translated font: Preferences standardEToysTitleFont color: textColor1 }. buttonRow := OrderedCollection new. + buttons do: [:button | buttonRow add: button] separatedBy: [buttonRow add: ((Morph new extent: 30 px @ 5 px) color: Color transparent)]. - buttons do: [:button | buttonRow add: button] separatedBy: [buttonRow add: ((Morph new extent: 30@5) color: Color transparent)].
" addARowCentered: { buttons first. + (Morph new extent: 30 px @ 5 px) color: Color transparent. - (Morph new extent: 30@5) color: Color transparent. buttons second. + (Morph new extent: 30 px@ 5 px) color: Color transparent. - (Morph new extent: 30@5) color: Color transparent. buttons third };" window addARowCentered: buttonRow; + addARowCentered: { (window inAColumn: {(ProjectViewMorph on: aProject) lock}) layoutInset: 4 px}; - addARowCentered: { (window inAColumn: {(ProjectViewMorph on: aProject) lock}) layoutInset: 4}; addARowCentered: { + window fancyText: 'Please select a folder' translated font: Preferences standardButtonFont color: textColor1 - window fancyText: 'Please select a folder' translated font: Preferences standardEToysFont color: textColor1 }; addARow: { ( window inAColumn: { (pane2 := window inARow: {window inAColumn: {treePane}}) useRoundedCorners; layoutInset: 0; + borderWidth: 1 px; - borderWidth: 1; borderColor: (Color r: 0.6 g: 0.7 b: 1) } + ) layoutInset: 10 px - ) layoutInset: 10 }. window fullBounds. window fillWithRamp: (Color r: 1 g: 0.85 b: 0.975) oriented: 0.65. pane2 fillWithRamp: (Color r: 0.85 g: 0.9 b: 1) oriented: (0.7 @ 0.35). " buttons do: [ :each | each fillWithRamp: ColorTheme current dialogButtonsRampOrColor oriented: (0.75 @ 0). ]. " window morphicLayerNumber: window class dialogLayer. aFileList postOpen. window adoptPaneColor: (Color r: 0.548 g: 0.677 b: 1.0). ^ window !
Item was changed: ----- Method: FileList2>>blueButtonForService:textColor:inWindow: (in category 'user interface') ----- blueButtonForService: aService textColor: textColor inWindow: window | block result | block := [self fullName isNil ifTrue: [self inform: 'Please select a file' translated] ifFalse: [aService performServiceFor: self]]. result := window fancyText: aService buttonLabel capitalized translated + font: Preferences standardButtonFont - font: Preferences standardEToysFont color: textColor. result setProperty: #buttonText toValue: aService buttonLabel capitalized; hResizing: #rigid; + extent: 100 px @ 20 px; + layoutInset: 4 px; + borderWidth: 1 px; - extent: 100 @ 20; - layoutInset: 4; - borderWidth: 1; useRoundedCorners; setBalloonText: aService label. result on: #mouseUp send: #value to: block. ^ result!
Item was changed: ----- Method: FileList2>>optionalButtonRow (in category 'initialization') ----- optionalButtonRow "Answer the button row associated with a file list"
| aRow | aRow := AlignmentMorph newRow beSticky. aRow color: Color transparent. aRow clipSubmorphs: true. + aRow layoutInset: 5 px @ 1 px; cellGap: 6 px. - aRow layoutInset: 5@1; cellGap: 6. self universalButtonServices do: "just the three sort-by items" [:service | aRow addMorphBack: (service buttonToTriggerIn: self). (service selector == #sortBySize) ifTrue: + [aRow addTransparentSpacerOfSize: (4 px @ 0)]]. - [aRow addTransparentSpacerOfSize: (4@0)]]. aRow setNameTo: 'buttons'. aRow setProperty: #buttonRow toValue: true. "Used for dynamic retrieval later on" ^ aRow!
packages@lists.squeakfoundation.org