Hi,

Can you try this patch to see if it helps.

thanks

Max

On Tue, 2003-03-18 at 05:58, Mike McCormack wrote:
> Hi,
> 
> This patch does badly with Visio 2000's file Open dialog. The file 
> dialog is as big as the main window, but the OK button is placed in the 
> middle of the dialog, more or less. (It should be at the bottom RHS).
> 
> I can send you a screenshot if you'd like.
> 
> Mike
> 
> Maxime Bellengé wrote:
> > As requested by Alexandre, I send the patch with more comments.
> > 
> > I have made several test cases under windows and taken screenshot to
> > compare with wine. If someone is interested in seeing them, send me a
> > mail.
> > 
> > ChangeLog:
> > - Fix how the size of the dialog is computed and the child component
> > placed.
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > Index: dlls/commdlg/filedlg95.c
> > ===================================================================
> > RCS file: /home/wine/wine/dlls/commdlg/filedlg95.c,v
> > retrieving revision 1.90
> > diff -u -r1.90 filedlg95.c
> > --- dlls/commdlg/filedlg95.c        7 Mar 2003 20:29:31 -0000       1.90
-- 
Maxime Bellengé <[EMAIL PROTECTED]>
Index: wine/dlls/commdlg/filedlg95.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/filedlg95.c,v
retrieving revision 1.90
diff -u -r1.90 filedlg95.c
--- wine/dlls/commdlg/filedlg95.c	7 Mar 2003 20:29:31 -0000	1.90
+++ wine/dlls/commdlg/filedlg95.c	19 Mar 2003 22:07:38 -0000
@@ -515,54 +515,57 @@
     hwndStc32=GetDlgItem(hwndChildDlg,stc32);
     GetClientRect(hwndParentDlg,&rectParent);
     GetClientRect(hwndChildDlg,&rectChild);
+    TRACE("Parent l:%d t:%d r:%d b:%d\n",rectParent.left,rectParent.top,rectParent.right,rectParent.bottom);
+    TRACE("Child l:%d t:%d r:%d b:%d\n",rectChild.left,rectChild.top,rectChild.right,rectChild.bottom);
+    /*
+      There are two possibilities to add components to the default file dialog box.
+
+      By default, all the new components are added below the standard dialog box (the else case).
 
+      However, if there is a static text component with the stc32 id, a special case happens.
+      The x and y coordinates of stc32 indicate the top left corner where to place the standard file dialog box
+      in the window and the cx and cy indicate how to size the window.
+      Moreover, if the new component's coordinates are on the left of the stc32 , it is placed on the left 
+      of the standard file dialog box. If they are above the stc32 component, it is placed above and so on....
+      
+     */
     if(hwndStc32)
-    {
+    {      
       GetWindowRect(hwndStc32,&rectStc32);
       MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);
-      CopyRect(&rectTemp,&rectStc32);
+      CopyRect(&rectTemp,&rectStc32);      
+      TRACE("stc32 l:%d t:%d r:%d b:%d\n",rectStc32.left,rectStc32.top,rectStc32.right,rectStc32.bottom);
 
-      SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));
-      SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
-
-      ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
-      if(rectStc32.right < rectTemp.right)
-        ptMoveCtl.x = 0;
-      else
-        ptMoveCtl.x = (rectStc32.right - rectTemp.right);
-
-      ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top));
-      if(rectStc32.bottom < rectTemp.bottom)
-        ptMoveCtl.y = 0;
-      else
-        ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom);
+      ptParentClient.x = (rectParent.right-rectParent.left)+(rectChild.right-rectChild.left)-(rectStc32.right-rectStc32.left);
+      ptMoveCtl.x = (rectParent.right-rectParent.left) ;
+  
+      ptParentClient.y = (rectParent.bottom-rectParent.top)+(rectChild.bottom-rectChild.top)-(rectStc32.bottom-rectStc32.top) ;
+      ptMoveCtl.y = (rectParent.bottom-rectParent.top) ;
     }
     else
     {
-      if( (GetWindow(hwndChildDlg,GW_CHILD)) == NULL) return;
-
+      TRACE("pas sct\n");
       SetRectEmpty(&rectTemp);
       ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
       ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top);
       ptMoveCtl.y = rectParent.bottom-rectParent.top;
-      ptMoveCtl.x=0;
+      ptMoveCtl.x = rectParent.right - rectParent.left;
+      //SetRect(&rectTemp,0,0,ptParentClient.x,ptMoveCtl.y);
+
     }
+    /* Set the new size of the window from the extra space needed */
     SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y);
     AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE));
 
-    SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x + ptMoveCtl.x,ptParentClient.y + ptMoveCtl.y, SWP_NOZORDER );
-    SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left) + ptMoveCtl.x,
-        (rectParent.bottom-rectParent.top) + ptMoveCtl.y,SWP_NOMOVE | SWP_NOZORDER);
-
+    SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y, SWP_NOZORDER );
+    SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
+		 (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
+      
+    /* 
+       This part moves the child components below the file dialog box if stc32 is not present
+       and place them accordinf to stc32 if it is present.
+     */
     hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
-    if(hwndStc32)
-    {
-      GetWindowRect(hwndStc32,&rectStc32);
-      MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
-    }
-    else
-      SetRect(&rectStc32,0,0,0,0);
-
     if (hwndChild )
     {
       do
@@ -573,35 +576,30 @@
 				continue;
           GetWindowRect(hwndChild,&rectCtrl);
           MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
-
+	  TRACE("Child l:%d t:%d r:%d b:%d\n",rectCtrl.left,rectCtrl.top,rectCtrl.right,rectCtrl.bottom);
           /*
-            Check the initial position of the controls relative to the initial
-            position and size of stc32 (before it is expanded).
+            If stc32 is present, moves the child components as required.
           */
-          if (rectCtrl.left >= rectTemp.right && rectCtrl.top >= rectTemp.bottom)
-          {
-            rectCtrl.left += ptMoveCtl.x;
-            rectCtrl.top  += ptMoveCtl.y;
-          }
-          else if (rectCtrl.left >= rectTemp.right)
-	  {
-            rectCtrl.left += ptMoveCtl.x;
-            rectCtrl.right += ptMoveCtl.x;
+   	  if ((rectCtrl.left >= rectTemp.right) && ((rectCtrl.left+ptMoveCtl.x)<rectParent.right)){
+	    rectCtrl.left += ptMoveCtl.x;
+	    rectCtrl.right +=ptMoveCtl.x; 
 	  }
-          else if (rectCtrl.top >= rectTemp.bottom)
-          {
+	  if ((rectCtrl.top >= rectTemp.bottom) && ((rectCtrl.top+ptMoveCtl.y)<rectParent.bottom)){
 	    rectCtrl.top  += ptMoveCtl.y;
-           rectCtrl.bottom  += ptMoveCtl.y;
+	    rectCtrl.bottom  += ptMoveCtl.y;
 	  }
-
+    
           SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
 				rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
 				SWP_NOSIZE | SWP_NOZORDER );
         }
       } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != NULL);
-    }
-    hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
+    }   
 
+    /*
+      This part moves the components of the default file dialog box according to the stc32 coordinates.
+     */
+    hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
     if(hwndStc32)
     {
       GetWindowRect(hwndStc32,&rectStc32);
@@ -616,7 +614,7 @@
           {
             if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
               continue;
-            GetWindowRect(hwndChild,&rectCtrl);
+	    GetWindowRect(hwndChild,&rectCtrl);
             MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
 
             rectCtrl.left += ptMoveCtl.x;
@@ -684,7 +682,6 @@
         fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
     {
       HINSTANCE hinst;
-
       if (fodInfos->ofnInfos->Flags  & OFN_ENABLETEMPLATEHANDLE)
       {
         hinst = 0;

Reply via email to