FileDialog.st
changeset 18015 c2c3ac7e3d6d
parent 17990 0e4375f0483f
child 18037 9e48562729d9
--- a/FileDialog.st	Thu Mar 15 15:29:19 2018 +0100
+++ b/FileDialog.st	Tue Mar 20 11:47:43 2018 +0100
@@ -1251,6 +1251,15 @@
     ^ selectedFiles reject:[:aFile| aFile isDirectory ].
 !
 
+defaultWindowExtent
+    "return my default window extent or nil.
+     Return nil if the defaul extent should be computed by other means."
+
+    ^ LastExtent
+
+    "Created: / 20-03-2018 / 11:26:14 / stefan"
+!
+
 directory
     "return the value of the instance variable 'directory' (automatically generated)"
 
@@ -1992,24 +2001,26 @@
 preOpenWith:aBuilder
     "called right before being opened"
 
-    |delta|
-
-    "Increase height of the window so height of the file part
-     remain the same. This cares for any components added by a hook"
+    verticalPanelView notNil ifTrue:[
+"/ SV: disabled, because dialogs where opened full height:
+"/        "Increase height of the window so height of the file part
+"/         remains the same. This cares for any components added by a hook"
+"/
+"/        |delta|
+"/
+"/        delta := verticalPanelView preferredHeight - verticalPanelView height.
+"/        delta > 0 ifTrue:[
+"/            "/ components where added (possibly in the aboutToOpenBoxNotifiction
+"/            aBuilder window height: (aBuilder window height + delta).
+"/        ].
 
-    verticalPanelView notNil ifTrue:[
-        delta := verticalPanelView preferredHeight - verticalPanelView height.
-        delta > 0 ifTrue:[
-            "/ components where added (possibly in the aboutToOpenBoxNotifiction
-            aBuilder window height: (aBuilder window height + delta).
-        ].
-
+"/ This code was disabled without comment:
 "/        sumH := 0.
 "/        verticalPanelView subViews from:2 do:[:view|
 "/            sumH := sumH + view preferredHeight.
 "/        ].
 "/        sumH ~~ 0 ifTrue:[
-"/            newVPanelHeight := verticalPanelView preferredHeight374
+"/            newVPanelHeight := verticalPanelView preferredHeight.
 "/            aBuilder window height: aBuilder window height + sumH.
 "/        ].
     ].
@@ -2017,12 +2028,24 @@
     treeBrowser currentFileNameHolder value:(Array with:self startFilename).
 
     "Created: / 03-06-2013 / 18:19:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 20-03-2018 / 11:34:26 / stefan"
 !
 
 rememberExtent
-    self class lastExtent:self window topView extent.
+    "if the user changed the size of the dialog, the next time the dialog
+     is opened with this size.
+     But ignore height changes < 40 pixels. On some systems the height of the title bar
+     is added to the height. (https://expeccoalm.exept.de/D160693)"
+
+    |currentExtent|
+
+    currentExtent := self window topView extent.
+    (LastExtent isNil or:[(LastExtent y - currentExtent y) abs > 40]) ifTrue:[
+        self class lastExtent:currentExtent.
+    ].
 
     "Created: / 14-02-2011 / 17:55:11 / cg"
+    "Modified: / 20-03-2018 / 11:44:06 / stefan"
 ! !
 
 !FileDialog methodsFor:'menus'!