--- a/WinWorkstation.st Wed Feb 26 19:30:45 2020 +0100
+++ b/WinWorkstation.st Wed Feb 26 19:31:05 2020 +0100
@@ -10096,7 +10096,7 @@
^ aPoint
].
- targetMonitorInfo := Display monitorInfoForPoint:aPoint.
+ targetMonitorInfo := self monitorInfoForPoint:aPoint.
(targetMonitorInfo isNil
or:[targetMonitorInfo isCenterMonitor]) ifTrue:[
"the point is not inside any monitor
@@ -10105,25 +10105,23 @@
^ (aPoint * (self scaleFactorForRootViewTranslationOnMonitorNamed:centerMonitorDeviceName)) rounded
].
- minScaleFactor := (Display monitorInfos
- collect:[:eachMonitorInfo |
- self scaleFactorForRootViewTranslationOnMonitorNamed:eachMonitorInfo name
- ])
- min.
+ minScaleFactor := (self monitorInfos collect:[:eachMonitorInfo |
+ self scaleFactorForRootViewTranslationOnMonitorNamed:eachMonitorInfo name
+ ]) min.
scaledX := self
- convertTargetValue:aPoint x
- targetMonitorInfo:targetMonitorInfo
- minScaleFactor:minScaleFactor
- monitorInfoTopOrLeftFetch:[:monitorInfo | monitorInfo screenX].
+ convertTargetValue:aPoint x
+ targetMonitorInfo:targetMonitorInfo
+ minScaleFactor:minScaleFactor
+ monitorInfoTopOrLeftFetch:[:monitorInfo | monitorInfo screenX].
scaledY := self
- convertTargetValue:aPoint y
- targetMonitorInfo:targetMonitorInfo
- minScaleFactor:minScaleFactor
- monitorInfoTopOrLeftFetch:[:monitorInfo | monitorInfo screenY].
-
- ^ scaledX@scaledY
+ convertTargetValue:aPoint y
+ targetMonitorInfo:targetMonitorInfo
+ minScaleFactor:minScaleFactor
+ monitorInfoTopOrLeftFetch:[:monitorInfo | monitorInfo screenY].
+
+ ^ scaledX @ scaledY
"
self convertVirtualResolutionPointToCurrentResolutionPoint:2000@400
@@ -17214,171 +17212,166 @@
trueForMultiSelect := trueForMultiSelectArg ? false.
dialogTitleArg notEmptyOrNil ifTrue:[
- dialogTitle := dialogTitleArg asUnicode16String.
+ dialogTitle := dialogTitleArg asUnicode16String.
].
defaultFilenameArg notNil ifTrue:[
- |defaultFilename|
-
- defaultFilename := defaultFilenameArg asFilename.
- defaultFilename isDirectory ifTrue:[
- defaultDirectory := defaultFilename.
- ] ifFalse:[
- defaultDirectory := defaultFilename directory.
- defaultBaseName := defaultFilename baseName asUnicode16String.
- ].
-
- defaultDirectory := defaultDirectory pathName asUnicode16String.
+ |defaultFilename|
+
+ defaultFilename := defaultFilenameArg asFilename.
+ defaultFilename isDirectory ifTrue:[
+ defaultDirectory := defaultFilename.
+ ] ifFalse:[
+ defaultDirectory := defaultFilename directory.
+ defaultBaseName := defaultFilename baseName asUnicode16String.
+ ].
+
+ defaultDirectory := defaultDirectory pathName asUnicode16String.
].
owningTopView notNil ifTrue:[
- owningViewId := owningTopView id.
- windowGroup := owningTopView windowGroup.
+ owningViewId := owningTopView id.
+ windowGroup := owningTopView windowGroup.
].
filterStringOrArrayOfPairs notEmptyOrNil ifTrue:[
- null := (String new:1)
- at:1 put:Character null;
- yourself.
-
- filterStringOrArrayOfPairs notNil ifTrue:[
- filterStringOrArrayOfPairs isString ifTrue:[
- filterString := filterStringOrArrayOfPairs.
- filterArrayOrPairs := OrderedCollection new.
- filterStringParts := filterStringOrArrayOfPairs subStrings:null.
-
- 1
- to:filterStringParts size
- by:2
- do:[:index |
- filterArrayOrPairs
- add:(Array
- with:(filterStringParts at:index)
- with:(filterStringParts at:index + 1)).
- ].
- ] ifFalse:[
- filterArrayOrPairs := filterStringOrArrayOfPairs.
- filterString := ((filterStringOrArrayOfPairs
- collect:[:eachPair |
- eachPair first, null, eachPair second, null
- ])
- asStringWith:''), null.
- ].
-
- filterString := filterString asUnicode16String.
- ].
+ null := Character null asString.
+
+ filterStringOrArrayOfPairs notNil ifTrue:[
+ filterStringOrArrayOfPairs isString ifTrue:[
+ filterString := filterStringOrArrayOfPairs.
+ filterArrayOrPairs := OrderedCollection new.
+ filterStringParts := filterStringOrArrayOfPairs subStrings:null.
+
+ 1 to:filterStringParts size
+ by:2
+ do:[:index |
+ filterArrayOrPairs
+ add:(Array
+ with:(filterStringParts at:index)
+ with:(filterStringParts at:index + 1)).
+ ].
+ ] ifFalse:[
+ filterArrayOrPairs := filterStringOrArrayOfPairs.
+ filterString := ((filterStringOrArrayOfPairs
+ collect:[:eachPair |
+ eachPair first, null, eachPair second, null
+ ])
+ asStringWith:''), null.
+ ].
+
+ filterString := filterString asUnicode16String.
+ ].
].
[
- nativeFileDialogCreationData := self
- primNativeFileDialogWithTitle:dialogTitle
- defaultBaseName:defaultBaseName
- defaultDirectory:defaultDirectory
- owningViewId:owningViewId
- filterString:filterString
- filterIndex:filterIndexArg ? 1
- trueForSave:trueForSave
- trueForMultiSelect:trueForMultiSelect
- trueForPromptOverwrite:trueForPromptOverwrite ? true.
-
- dataAddress := nativeFileDialogCreationData dataAddress.
- didPerformCroppedBaseNameHack := false.
-
- [
- delay := 100 milliseconds.
-
- (trueForSave not
- and:[didPerformCroppedBaseNameHack not]) ifTrue:[
- "hack for display bug (cropped default basename)
- https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/644328"
- didPerformCroppedBaseNameHack := self primTryCroppedBaseNameHackByDataAddress:dataAddress.
- didPerformCroppedBaseNameHack ifFalse:[
- delay := 10 milliseconds.
- ].
- ].
-
- windowGroup notNil ifTrue:[
- windowGroup sensor eventSemaphore waitWithTimeout:delay.
- "sr: we can process all events (also redraws),
- because the operating system handles the modal,
- user events are blocked by operating system"
- windowGroup processEvents.
- ] ifFalse:[
- Delay waitFor:delay.
- ].
-
- NativeFileDialogInitializeError handle:[:ex |
- "set #returnValue to suppress the #ensure block,
- no need for close if this error occures,
- cleanups are done within #primCheckForErrorInFileDialogInitializeByCreationData"
- returnValue := ''.
- ex reject.
- ] do:[
- self primCheckForErrorInFileDialogInitializeByCreationData:nativeFileDialogCreationData.
- ].
-
- returnValue := self primGetNativeFileDialogResultByCreationData:nativeFileDialogCreationData.
- ] doWhile:[
- returnValue isNil
- ].
+ nativeFileDialogCreationData := self
+ primNativeFileDialogWithTitle:dialogTitle
+ defaultBaseName:defaultBaseName
+ defaultDirectory:defaultDirectory
+ owningViewId:owningViewId
+ filterString:filterString
+ filterIndex:filterIndexArg ? 1
+ trueForSave:trueForSave
+ trueForMultiSelect:trueForMultiSelect
+ trueForPromptOverwrite:trueForPromptOverwrite ? true.
+
+ dataAddress := nativeFileDialogCreationData dataAddress.
+ didPerformCroppedBaseNameHack := false.
+
+ [
+ delay := 100 milliseconds.
+
+ (trueForSave not
+ and:[didPerformCroppedBaseNameHack not]) ifTrue:[
+ "hack for display bug (cropped default basename)
+ https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/644328"
+ didPerformCroppedBaseNameHack := self primTryCroppedBaseNameHackByDataAddress:dataAddress.
+ didPerformCroppedBaseNameHack ifFalse:[
+ delay := 10 milliseconds.
+ ].
+ ].
+
+ windowGroup notNil ifTrue:[
+ windowGroup sensor eventSemaphore waitWithTimeout:delay.
+ "sr: we can process all events (also redraws),
+ because the operating system handles the modal,
+ user events are blocked by operating system"
+ windowGroup processEvents.
+ ] ifFalse:[
+ Delay waitFor:delay.
+ ].
+
+ NativeFileDialogInitializeError handle:[:ex |
+ "set #returnValue to suppress the #ensure block,
+ no need for close if this error occures,
+ cleanups are done within #primCheckForErrorInFileDialogInitializeByCreationData"
+ returnValue := ''.
+ ex reject.
+ ] do:[
+ self primCheckForErrorInFileDialogInitializeByCreationData:nativeFileDialogCreationData.
+ ].
+
+ returnValue := self primGetNativeFileDialogResultByCreationData:nativeFileDialogCreationData.
+ ] doWhile:[
+ returnValue isNil
+ ].
] ensure:[
- (nativeFileDialogCreationData notNil
- "/ if #returnValue is not nil, we already finished and did the memory free
- and:[returnValue isNil]) ifTrue:[
- Display primCloseNativeFileDialogByCreationData:nativeFileDialogCreationData.
- ].
+ (nativeFileDialogCreationData notNil
+ "/ if #returnValue is not nil, we already finished and did the memory free
+ and:[returnValue isNil]) ifTrue:[
+ self primCloseNativeFileDialogByCreationData:nativeFileDialogCreationData.
+ ].
].
returnValue isEmptyOrNil ifTrue:[
- "dialog was aborted"
- ^ nil
+ "dialog was aborted"
+ ^ nil
].
nativeFileDialogReturnData := returnValue.
targetFileOrDirectory := nativeFileDialogReturnData targetFileOrDirectory.
multiSelectBaseNames := nativeFileDialogReturnData multiSelectBaseNames.
multiSelectBaseNames notEmptyOrNil ifTrue:[
- "/ add the direcotry to the explorer history
- self addPathToExplorerHistory:targetFileOrDirectory.
-
- needsSlash := targetFileOrDirectory last ~= $\.
-
- ^ (multiSelectBaseNames
- subStrings:$|)
- reject:[:each | each isEmptyOrNil]
- thenCollect:[:each |
- needsSlash ifTrue:[
- targetFileOrDirectory, '\', each
- ] ifFalse:[
- targetFileOrDirectory, each
- ]
- ]
+ "/ add the direcotry to the explorer history
+ self addPathToExplorerHistory:targetFileOrDirectory.
+
+ needsSlash := targetFileOrDirectory last ~= $\.
+
+ ^ (multiSelectBaseNames subStrings:$|)
+ select:[:each | each notEmptyOrNil]
+ thenCollect:[:each |
+ needsSlash ifTrue:[
+ targetFileOrDirectory, '\', each
+ ] ifFalse:[
+ targetFileOrDirectory, each
+ ]
+ ]
].
"/ add the direcotry to the explorer history
self addPathToExplorerHistory:targetFileOrDirectory asFilename directory pathName.
(trueForSave
- and:[filterArrayOrPairs notEmptyOrNil
- and:[targetFileOrDirectory asFilename suffix isEmptyOrNil]]) ifTrue:[
- selectedSuffixInfo := filterArrayOrPairs
- at:nativeFileDialogReturnData selectedFilterIndex
- ifAbsent:nil.
-
- selectedSuffixInfo notNil ifTrue:[
- selectedSuffix := (selectedSuffixInfo second
- subStrings:'.')
- lastIfEmpty:nil.
-
- (selectedSuffix notNil
- and:[selectedSuffix ~= '*']) ifTrue:[
- ^ targetFileOrDirectory, '.', selectedSuffix
- ].
- ].
+ and:[filterArrayOrPairs notEmptyOrNil
+ and:[targetFileOrDirectory asFilename suffix isEmptyOrNil]]) ifTrue:[
+ selectedSuffixInfo := filterArrayOrPairs
+ at:nativeFileDialogReturnData selectedFilterIndex
+ ifAbsent:nil.
+
+ selectedSuffixInfo notNil ifTrue:[
+ selectedSuffix := (selectedSuffixInfo second subStrings:'.')
+ lastIfEmpty:nil.
+
+ (selectedSuffix notNil
+ and:[selectedSuffix ~= '*']) ifTrue:[
+ ^ targetFileOrDirectory, '.', selectedSuffix
+ ].
+ ].
].
trueForMultiSelect ifTrue:[
- ^ Array with:targetFileOrDirectory
+ ^ Array with:targetFileOrDirectory
].
^ targetFileOrDirectory
@@ -17386,96 +17379,96 @@
"
########### example1 without owning view ##########
- |null|
-
- null := (Character codePoint:0) asString.
-
- Display
- nativeFileDialogWithTitle:'Hello World'
- defaultFilename:'C:\users\sr\desktop\dsfjbgfhkbsdhzbret.ets'
- owningTopView:nil
- filter:
- 'expecco Testsuite', null, '*.ets', null,
- 'expecco Logfile', null, '*.elf', null,
- 'All', null, '*.*', null,
- null
- filterIndex:3
- trueForSave:true
- trueForMultiSelect:nil
- trueForPromptOverwrite:nil
+ |null|
+
+ null := Character null asString.
+
+ Display
+ nativeFileDialogWithTitle:'Hello World'
+ defaultFilename:'C:\users\sr\desktop\dsfjbgfhkbsdhzbret.ets'
+ owningTopView:nil
+ filter:
+ 'expecco Testsuite', null, '*.ets', null,
+ 'expecco Logfile', null, '*.elf', null,
+ 'All', null, '*.*', null,
+ null
+ filterIndex:3
+ trueForSave:true
+ trueForMultiSelect:nil
+ trueForPromptOverwrite:nil
########### example2 without owning view and termination ##########
- |null p|
-
- null := (Character codePoint:0) asString.
-
- p :=
- [
- Display
- nativeFileDialogWithTitle:'Hello World'
- defaultFilename:'D:\sadasdsad'
- owningTopView:nil
- filter:
- 'expecco Testsuite', null, '*.ets', null,
- 'expecco Logfile', null, '*.elf', null,
- null
- filterIndex:2
- trueForSave:false
- trueForMultiSelect:nil
- trueForPromptOverwrite:nil
- ] fork.
-
- Delay waitForSeconds:5.
-
- p terminate.
+ |null p|
+
+ null := Character null asString.
+
+ p :=
+ [
+ Display
+ nativeFileDialogWithTitle:'Hello World'
+ defaultFilename:'D:\sadasdsad'
+ owningTopView:nil
+ filter:
+ 'expecco Testsuite', null, '*.ets', null,
+ 'expecco Logfile', null, '*.elf', null,
+ null
+ filterIndex:2
+ trueForSave:false
+ trueForMultiSelect:nil
+ trueForPromptOverwrite:nil
+ ] fork.
+
+ Delay waitForSeconds:5.
+
+ p terminate.
########### example3 with owning view (makes the launcher modal) ##########
- |owningTopView|
-
- owningTopView := NewLauncher open window topView.
- Delay waitForSeconds:1.
-
- Display
- nativeFileDialogWithTitle:'Hello World'
- defaultFilename:'D:\sadasdsad'
- owningTopView:owningTopView
- filter:#(
- #('expecco Testsuite' '*.ets')
- #('expecco Logfile' '*.elf')
- )
- filterIndex:2
- trueForSave:false
- trueForMultiSelect:nil
- trueForPromptOverwrite:nil.
+ |owningTopView|
+
+ owningTopView := Transcript topView.
+ Delay waitForSeconds:1.
+
+ Display
+ nativeFileDialogWithTitle:'Hello World'
+ defaultFilename:'D:\sadasdsad'
+ owningTopView:owningTopView
+ filter:#(
+ #('expecco Testsuite' '*.ets')
+ #('expecco Logfile' '*.elf')
+ )
+ filterIndex:2
+ trueForSave:false
+ trueForMultiSelect:nil
+ trueForPromptOverwrite:nil.
########### example4 with owning view (makes the launcher modal) and termination ##########
- |owningTopView p|
-
- owningTopView := NewLauncher open window topView.
- Delay waitForSeconds:1.
-
- p :=
- [
- Display
- nativeFileDialogWithTitle:'Hello World'
- defaultFilename:'D:\sadasdsad'
- owningTopView:owningTopView
- filter:#(
- #('expecco Testsuite' '*.ets')
- #('expecco Logfile' '*.elf')
- )
- filterIndex:2
- trueForSave:false
- trueForMultiSelect:nil
- trueForPromptOverwrite:nil.
- ] fork.
-
- Delay waitForSeconds:5.
-
- p terminate.
+ |owningTopView p|
+
+ owningTopView := Transcript topView.
+ Delay waitForSeconds:1.
+
+ p :=
+ [
+ Display
+ nativeFileDialogWithTitle:'Hello World'
+ defaultFilename:'D:\sadasdsad'
+ owningTopView:owningTopView
+ filter:#(
+ #('expecco Testsuite' '*.ets')
+ #('expecco Logfile' '*.elf')
+ )
+ filterIndex:2
+ trueForSave:false
+ trueForMultiSelect:nil
+ trueForPromptOverwrite:nil.
+ ] fork.
+
+ Delay waitForSeconds:5.
+
+ p terminate.
"
"Created: / 25-10-2018 / 10:54:52 / sr"