PATCH: Templated file dialog does not make dialog big enough

Adam Gundy arg at cyberscience.com
Wed Mar 5 08:40:54 CST 2003


Hi. We use a templated file dialog to add a preview control at the right edge
of the normal controls. The dialog window size was not being calculated correctly,
and was hiding the preview control.

Also fixed FILEDLG95_Handle_GetFilePath() which wasn't properly building the full
filepath.

Cyberscience disclaims all copyright and responsibility... ;-)

Changelog:

        * dlls/commdlg/filedlg95.c: Adam Gundy <arg at cyberscience.com>
        ArrangeCtrlPositions() did not cope correctly with a templated
        dialog which has an extra 'preview' control to the right of
        the 'marker' control. FILEDLG95_Handle_GetFilePath() did
        not return the path - it wasn't combining the path with the filename.

diff -u -r wine-20030219/dlls/commdlg/filedlg95.c wine-20030219-new/dlls/commdlg/filedlg95.c
--- wine-20030219/dlls/commdlg/filedlg95.c      Tue Jan 14 23:43:42 2003
+++ wine-20030219-new/dlls/commdlg/filedlg95.c  Wed Mar  5 11:06:38 2003
@@ -550,9 +550,9 @@
     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,ptParentClient.y, SWP_NOZORDER );
-    SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
-        (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
+    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);
 
     hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
     if(hwndStc32)
@@ -586,10 +586,12 @@
           else if (rectCtrl.left >= rectTemp.right)
          {
             rectCtrl.left += ptMoveCtl.x;
+            rectCtrl.right += ptMoveCtl.x;
          }
           else if (rectCtrl.top >= rectTemp.bottom)
           {
            rectCtrl.top  += ptMoveCtl.y;
+           rectCtrl.bottom  += ptMoveCtl.y;
          }
 
           SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
@@ -618,7 +620,9 @@
             MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
 
             rectCtrl.left += ptMoveCtl.x;
+            rectCtrl.right += ptMoveCtl.x;
             rectCtrl.top += ptMoveCtl.y;
+            rectCtrl.bottom += ptMoveCtl.y;
 
             SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
                 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
@@ -809,8 +813,12 @@
                             buffer, size, NULL, NULL);
 
     if(n<size)
+    {
+        /* 'n' includes trailing \0 */
+        buffer[n-1] = '\\';
         WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed, 
-                           &buffer[n], size-n, NULL, NULL);
+                            &buffer[n], size-n, NULL, NULL);
+    }
     MemFree(lpstrFileList);
 
     TRACE("returned -> %s\n",debugstr_a(buffer));


Seeya,
 Adam
--
Real Programmers don't comment their code. If it was hard to write,
it should be hard to read, and even harder to modify.
These are all my own opinions.




More information about the wine-patches mailing list