Autosyncing with Wine HEAD

svn path=/trunk/; revision=31774
This commit is contained in:
The Wine Synchronizer 2008-01-14 12:43:19 +00:00
parent 5763a92d61
commit 9801c4a81f
8 changed files with 284 additions and 163 deletions

View file

@ -337,24 +337,29 @@ static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert
ClientToScreen(hDlg, &point); ClientToScreen(hDlg, &point);
hwnd = GetDlgItem( hDlg, dlgitem ); hwnd = GetDlgItem( hDlg, dlgitem );
GetWindowRect(hwnd, &rect); GetWindowRect(hwnd, &rect);
if (PtInRect(&rect, point))
{
GetClientRect(hwnd, &rect);
ScreenToClient(hwnd, &point);
x = (long) point.x * MAXHORI; if (!PtInRect(&rect, point))
x /= rect.right;
y = (long) (rect.bottom - point.y) * MAXVERT;
y /= rect.bottom;
if (hori)
*hori = x;
if (vert)
*vert = y;
return 1;
}
else
return 0; return 0;
GetClientRect(hwnd, &rect);
ScreenToClient(hwnd, &point);
x = (long) point.x * MAXHORI;
x /= rect.right;
y = (long) (rect.bottom - point.y) * MAXVERT;
y /= rect.bottom;
if (x < 0) x = 0;
if (y < 0) y = 0;
if (x > MAXHORI) x = MAXHORI;
if (y > MAXVERT) y = MAXVERT;
if (hori)
*hori = x;
if (vert)
*vert = y;
return 1;
} }
/*********************************************************************** /***********************************************************************
* CC_MouseCheckResultWindow [internal] * CC_MouseCheckResultWindow [internal]
@ -436,16 +441,8 @@ void CC_PaintSelectedColor( HWND hDlg, COLORREF cr )
hBrush = CreateSolidBrush(cr); hBrush = CreateSolidBrush(cr);
if (hBrush) if (hBrush)
{ {
hBrush = SelectObject(hdc, hBrush) ; FillRect(hdc, &rect, hBrush);
Rectangle(hdc, rect.left, rect.top, rect.right/2, rect.bottom); DrawEdge(hdc, &rect, BDR_SUNKENOUTER, BF_RECT);
DeleteObject ( SelectObject(hdc, hBrush) ) ;
hBrush = CreateSolidBrush( GetNearestColor(hdc, cr) );
if (hBrush)
{
hBrush = SelectObject(hdc, hBrush) ;
Rectangle(hdc, rect.right/2-1, rect.top, rect.right, rect.bottom);
DeleteObject(SelectObject(hdc, hBrush)) ;
}
} }
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
} }
@ -458,7 +455,7 @@ void CC_PaintTriangle( HWND hDlg, int y)
{ {
HDC hDC; HDC hDC;
long temp; long temp;
int w = LOWORD(GetDialogBaseUnits()); int w = LOWORD(GetDialogBaseUnits()) / 2;
POINT points[3]; POINT points[3];
int height; int height;
int oben; int oben;
@ -479,6 +476,7 @@ void CC_PaintTriangle( HWND hDlg, int y)
oben = points[0].y; /* | \ | */ oben = points[0].y; /* | \ | */
/* | \| */ /* | \| */
temp = (long)height * (long)y; temp = (long)height * (long)y;
points[0].x += 1;
points[0].y = oben + height - temp / (long)MAXVERT; points[0].y = oben + height - temp / (long)MAXVERT;
points[1].y = points[0].y + w; points[1].y = points[0].y + w;
points[2].y = points[0].y - w; points[2].y = points[0].y - w;
@ -491,7 +489,11 @@ void CC_PaintTriangle( HWND hDlg, int y)
lpp->old3angle.right = points[1].x + 1; lpp->old3angle.right = points[1].x + 1;
lpp->old3angle.top = points[2].y - 1; lpp->old3angle.top = points[2].y - 1;
lpp->old3angle.bottom= points[1].y + 1; lpp->old3angle.bottom= points[1].y + 1;
hbr = SelectObject(hDC, GetStockObject(BLACK_BRUSH));
Polygon(hDC, points, 3); Polygon(hDC, points, 3);
SelectObject(hDC, hbr);
ReleaseDC(hDlg, hDC); ReleaseDC(hDlg, hDC);
} }
} }
@ -503,7 +505,8 @@ void CC_PaintTriangle( HWND hDlg, int y)
void CC_PaintCross( HWND hDlg, int x, int y) void CC_PaintCross( HWND hDlg, int x, int y)
{ {
HDC hDC; HDC hDC;
int w = GetDialogBaseUnits(); int w = GetDialogBaseUnits() - 1;
int wc = GetDialogBaseUnits() * 3 / 4;
HWND hwnd = GetDlgItem(hDlg, 0x2c6); HWND hwnd = GetDlgItem(hDlg, 0x2c6);
LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp ); LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp );
RECT rect; RECT rect;
@ -515,8 +518,7 @@ void CC_PaintCross( HWND hDlg, int x, int y)
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
hDC = GetDC(hwnd); hDC = GetDC(hwnd);
SelectClipRgn( hDC, CreateRectRgnIndirect(&rect)); SelectClipRgn( hDC, CreateRectRgnIndirect(&rect));
hPen = CreatePen(PS_SOLID, 2, 0xffffff); /* -white- color */
hPen = SelectObject(hDC, hPen);
point.x = ((long)rect.right * (long)x) / (long)MAXHORI; point.x = ((long)rect.right * (long)x) / (long)MAXHORI;
point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT; point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT;
if ( lpp->oldcross.left != lpp->oldcross.right ) if ( lpp->oldcross.left != lpp->oldcross.right )
@ -529,11 +531,18 @@ void CC_PaintCross( HWND hDlg, int x, int y)
lpp->oldcross.top = point.y - w - 1; lpp->oldcross.top = point.y - w - 1;
lpp->oldcross.bottom = point.y + w + 1; lpp->oldcross.bottom = point.y + w + 1;
hPen = CreatePen(PS_SOLID, 3, 0x000000); /* -black- color */
hPen = SelectObject(hDC, hPen);
MoveToEx(hDC, point.x - w, point.y, &p); MoveToEx(hDC, point.x - w, point.y, &p);
LineTo(hDC, point.x - wc, point.y);
MoveToEx(hDC, point.x + wc, point.y, &p);
LineTo(hDC, point.x + w, point.y); LineTo(hDC, point.x + w, point.y);
MoveToEx(hDC, point.x, point.y - w, &p); MoveToEx(hDC, point.x, point.y - w, &p);
LineTo(hDC, point.x, point.y - wc);
MoveToEx(hDC, point.x, point.y + wc, &p);
LineTo(hDC, point.x, point.y + w); LineTo(hDC, point.x, point.y + w);
DeleteObject( SelectObject(hDC, hPen)) ; DeleteObject( SelectObject(hDC, hPen));
ReleaseDC(hwnd, hDC); ReleaseDC(hwnd, hDC);
} }
} }
@ -642,7 +651,7 @@ static void CC_PaintLumBar( HWND hDlg, int hue, int sat )
rect.bottom = rect.top; rect.bottom = rect.top;
} }
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH) ); DrawEdge(hDC, &rect, BDR_SUNKENOUTER, BF_RECT);
ReleaseDC(hwnd, hDC); ReleaseDC(hwnd, hDC);
} }
} }
@ -730,7 +739,7 @@ void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPCRECT lprect )
static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols) static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
{ {
HWND hwnd = GetDlgItem(hDlg, 0x2d0); HWND hwnd = GetDlgItem(hDlg, 0x2d0);
RECT rect; RECT rect, blockrect;
HDC hdc; HDC hdc;
HBRUSH hBrush; HBRUSH hBrush;
int dx, dy, i, j, k; int dx, dy, i, j, k;
@ -753,14 +762,17 @@ static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
hBrush = CreateSolidBrush(predefcolors[j][i]); hBrush = CreateSolidBrush(predefcolors[j][i]);
if (hBrush) if (hBrush)
{ {
hBrush = SelectObject(hdc, hBrush); blockrect.left = rect.left;
Rectangle(hdc, rect.left, rect.top, blockrect.top = rect.top;
rect.left + dx - DISTANCE, rect.top + dy - DISTANCE); blockrect.right = rect.left + dx - DISTANCE;
rect.left = rect.left + dx; blockrect.bottom = rect.top + dy - DISTANCE;
DeleteObject(SelectObject(hdc, hBrush)) ; FillRect(hdc, &blockrect, hBrush);
DrawEdge(hdc, &blockrect, BDR_SUNKEN, BF_RECT);
DeleteObject(hBrush);
} }
rect.left += dx;
} }
rect.top = rect.top + dy; rect.top += dy;
rect.left = k; rect.left = k;
} }
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
@ -774,7 +786,7 @@ static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, const COLORREF *lpcr ) void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, const COLORREF *lpcr )
{ {
HWND hwnd = GetDlgItem(hDlg, 0x2d1); HWND hwnd = GetDlgItem(hDlg, 0x2d1);
RECT rect; RECT rect, blockrect;
HDC hdc; HDC hdc;
HBRUSH hBrush; HBRUSH hBrush;
int dx, dy, i, j, k; int dx, dy, i, j, k;
@ -799,14 +811,17 @@ void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, const COLORREF *lpcr
hBrush = CreateSolidBrush(lpcr[i+j*cols]); hBrush = CreateSolidBrush(lpcr[i+j*cols]);
if (hBrush) if (hBrush)
{ {
hBrush = SelectObject(hdc, hBrush) ; blockrect.left = rect.left;
Rectangle(hdc, rect.left, rect.top, blockrect.top = rect.top;
rect.left + dx - DISTANCE, rect.top + dy - DISTANCE); blockrect.right = rect.left + dx - DISTANCE;
rect.left = rect.left + dx; blockrect.bottom = rect.top + dy - DISTANCE;
DeleteObject( SelectObject(hdc, hBrush) ) ; FillRect(hdc, &blockrect, hBrush);
DrawEdge(hdc, &blockrect, BDR_SUNKEN, BF_RECT);
DeleteObject(hBrush);
} }
rect.left += dx;
} }
rect.top = rect.top + dy; rect.top += dy;
rect.left = k; rect.left = k;
} }
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
@ -816,7 +831,6 @@ void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, const COLORREF *lpcr
} }
/*********************************************************************** /***********************************************************************
* CC_HookCallChk [internal] * CC_HookCallChk [internal]
*/ */
@ -1075,10 +1089,10 @@ LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
CC_PaintPredefColorArray(hDlg, 6, 8); CC_PaintPredefColorArray(hDlg, 6, 8);
CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors); CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors);
CC_PaintLumBar(hDlg, lpp->h, lpp->s); CC_PaintLumBar(hDlg, lpp->h, lpp->s);
CC_PaintCross(hDlg, lpp->h, lpp->s);
CC_PaintTriangle(hDlg, lpp->l); CC_PaintTriangle(hDlg, lpp->l);
CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult); CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);
CC_PaintColorGraph(hDlg); CC_PaintColorGraph(hDlg);
CC_PaintCross(hDlg, lpp->h, lpp->s);
EndPaint(hDlg, &ps); EndPaint(hDlg, &ps);
return TRUE; return TRUE;
@ -1346,7 +1360,7 @@ BOOL WINAPI ChooseColorA( LPCHOOSECOLORA lpChCol )
lpcc->lpCustColors = lpChCol->lpCustColors; lpcc->lpCustColors = lpChCol->lpCustColors;
lpcc->Flags = lpChCol->Flags; lpcc->Flags = lpChCol->Flags;
lpcc->lCustData = lpChCol->lCustData; lpcc->lCustData = lpChCol->lCustData;
lpcc->lpfnHook = (LPCCHOOKPROC) lpChCol->lpfnHook; lpcc->lpfnHook = lpChCol->lpfnHook;
if ((lpcc->Flags & CC_ENABLETEMPLATE) && (lpChCol->lpTemplateName)) { if ((lpcc->Flags & CC_ENABLETEMPLATE) && (lpChCol->lpTemplateName)) {
if (HIWORD(lpChCol->lpTemplateName)) { if (HIWORD(lpChCol->lpTemplateName)) {
INT len = MultiByteToWideChar( CP_ACP, 0, lpChCol->lpTemplateName, -1, NULL, 0); INT len = MultiByteToWideChar( CP_ACP, 0, lpChCol->lpTemplateName, -1, NULL, 0);

View file

@ -1,5 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="comdlg32" type="win32dll" baseaddress="${BASEADDRESS_COMDLG32}" installbase="system32" installname="comdlg32.dll" allowwarnings="true"> <module name="comdlg32" type="win32dll" baseaddress="${BASEADDRESS_COMDLG32}" installbase="system32" installname="comdlg32.dll" allowwarnings="true">
<importlibrary definition="comdlg32.spec.def" /> <importlibrary definition="comdlg32.spec.def" />
<include base="comdlg32">.</include> <include base="comdlg32">.</include>
@ -30,3 +31,4 @@
<file>rsrc.rc</file> <file>rsrc.rc</file>
<file>comdlg32.spec</file> <file>comdlg32.spec</file>
</module> </module>
</group>

View file

@ -2140,7 +2140,6 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile - if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0)) ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
{ {
LPWSTR lpszTemp;
/* fill destination buffer */ /* fill destination buffer */
if (fodInfos->ofnInfos->lpstrFile) if (fodInfos->ofnInfos->lpstrFile)
@ -2164,13 +2163,31 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
} }
} }
/* set filename offset */ if(fodInfos->unicode)
lpszTemp = PathFindFileNameW(lpstrPathAndFile); {
fodInfos->ofnInfos->nFileOffset = (lpszTemp - lpstrPathAndFile); LPWSTR lpszTemp;
/* set extension offset */ /* set filename offset */
lpszTemp = PathFindExtensionW(lpstrPathAndFile); lpszTemp = PathFindFileNameW(lpstrPathAndFile);
fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - lpstrPathAndFile) + 1 : 0; fodInfos->ofnInfos->nFileOffset = (lpszTemp - lpstrPathAndFile);
/* set extension offset */
lpszTemp = PathFindExtensionW(lpstrPathAndFile);
fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - lpstrPathAndFile) + 1 : 0;
}
else
{
LPSTR lpszTemp;
LPOPENFILENAMEA ofn = (LPOPENFILENAMEA)fodInfos->ofnInfos;
/* set filename offset */
lpszTemp = PathFindFileNameA(ofn->lpstrFile);
fodInfos->ofnInfos->nFileOffset = (lpszTemp - ofn->lpstrFile);
/* set extension offset */
lpszTemp = PathFindExtensionA(ofn->lpstrFile);
fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? (lpszTemp - ofn->lpstrFile) + 1 : 0;
}
/* set the lpstrFileTitle */ /* set the lpstrFileTitle */
if(fodInfos->ofnInfos->lpstrFileTitle) if(fodInfos->ofnInfos->lpstrFileTitle)
@ -3658,12 +3675,20 @@ static void CALLBACK FD32_UpdateResult(const FD31_DATA *lfs)
if (priv->ofnA) if (priv->ofnA)
{ {
LPSTR lpszTemp;
if (ofnW->nMaxFile && if (ofnW->nMaxFile &&
!WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFile, -1, !WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFile, -1,
priv->ofnA->lpstrFile, ofnW->nMaxFile, NULL, NULL )) priv->ofnA->lpstrFile, ofnW->nMaxFile, NULL, NULL ))
priv->ofnA->lpstrFile[ofnW->nMaxFile-1] = 0; priv->ofnA->lpstrFile[ofnW->nMaxFile-1] = 0;
priv->ofnA->nFileOffset = ofnW->nFileOffset;
priv->ofnA->nFileExtension = ofnW->nFileExtension; /* offsets are not guarenteed to be the same in WCHAR to MULTIBYTE conversion */
/* set filename offset */
lpszTemp = PathFindFileNameA(priv->ofnA->lpstrFile);
priv->ofnA->nFileOffset = (lpszTemp - priv->ofnA->lpstrFile);
/* set extension offset */
lpszTemp = PathFindExtensionA(priv->ofnA->lpstrFile);
priv->ofnA->nFileExtension = (*lpszTemp) ? (lpszTemp - priv->ofnA->lpstrFile) + 1 : 0;
} }
} }

View file

@ -112,60 +112,9 @@ BOOL FD31_CallWindowProc(const FD31_DATA *lfs, UINT wMsg, WPARAM wParam,
return lfs->callbacks->CWP(lfs, wMsg, wParam, lParam); return lfs->callbacks->CWP(lfs, wMsg, wParam, lParam);
} }
/***********************************************************************
* FD31_ScanDir [internal]
*/
static BOOL FD31_ScanDir(HWND hWnd, LPCWSTR newPath)
{
WCHAR buffer[BUFFILE];
HWND hdlg, hdlgDir;
LRESULT lRet = TRUE;
HCURSOR hCursorWait, oldCursor;
TRACE("Trying to change to %s\n", debugstr_w(newPath));
if ( newPath[0] && !SetCurrentDirectoryW( newPath ))
return FALSE;
lstrcpynW(buffer, newPath, sizeof(buffer)/sizeof(WCHAR));
/* get the list of spec files */
GetDlgItemTextW(hWnd, edt1, buffer, sizeof(buffer)/sizeof(WCHAR));
hCursorWait = LoadCursorA(0, (LPSTR)IDC_WAIT);
oldCursor = SetCursor(hCursorWait);
/* list of files */
if ((hdlg = GetDlgItem(hWnd, lst1)) != 0) {
WCHAR* scptr; /* ptr on semi-colon */
WCHAR* filter = buffer;
TRACE("Using filter %s\n", debugstr_w(filter));
SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);
while (filter) {
scptr = strchrW(filter, ';');
if (scptr) *scptr = 0;
while (*filter == ' ') filter++;
TRACE("Using file spec %s\n", debugstr_w(filter));
if (SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter) == LB_ERR)
return FALSE;
if (scptr) *scptr = ';';
filter = (scptr) ? (scptr + 1) : 0;
}
}
/* list of directories */
strcpyW(buffer, FILE_star);
if ((hdlgDir = GetDlgItem(hWnd, lst2)) != 0) {
lRet = DlgDirListW(hWnd, buffer, lst2, stc1, DDL_EXCLUSIVE | DDL_DIRECTORY);
}
SetCursor(oldCursor);
return lRet;
}
/*********************************************************************** /***********************************************************************
* FD31_GetFileType [internal] * FD31_GetFileType [internal]
*/ */
static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index) static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
{ {
int n, i; int n, i;
@ -189,6 +138,55 @@ static LPCWSTR FD31_GetFileType(LPCWSTR cfptr, LPCWSTR fptr, const WORD index)
return FILE_star; /* FIXME */ return FILE_star; /* FIXME */
} }
/***********************************************************************
* FD31_ScanDir [internal]
*/
static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
{
WCHAR buffer[BUFFILE];
HWND hdlg, hdlgDir;
LRESULT lRet = TRUE;
HCURSOR hCursorWait, oldCursor;
TRACE("Trying to change to %s\n", debugstr_w(newPath));
if ( newPath[0] && !SetCurrentDirectoryW( newPath ))
return FALSE;
/* get the list of spec files */
lstrcpynW(buffer, FD31_GetFileType(ofn->lpstrCustomFilter,
ofn->lpstrFilter, ofn->nFilterIndex - 1), BUFFILE);
hCursorWait = LoadCursorA(0, (LPSTR)IDC_WAIT);
oldCursor = SetCursor(hCursorWait);
/* list of files */
if ((hdlg = GetDlgItem(hWnd, lst1)) != 0) {
WCHAR* scptr; /* ptr on semi-colon */
WCHAR* filter = buffer;
TRACE("Using filter %s\n", debugstr_w(filter));
SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);
while (filter) {
scptr = strchrW(filter, ';');
if (scptr) *scptr = 0;
while (*filter == ' ') filter++;
TRACE("Using file spec %s\n", debugstr_w(filter));
SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter);
if (scptr) *scptr = ';';
filter = (scptr) ? (scptr + 1) : 0;
}
}
/* list of directories */
strcpyW(buffer, FILE_star);
if ((hdlgDir = GetDlgItem(hWnd, lst2)) != 0) {
lRet = DlgDirListW(hWnd, buffer, lst2, stc1, DDL_EXCLUSIVE | DDL_DIRECTORY);
}
SetCursor(oldCursor);
return lRet;
}
/*********************************************************************** /***********************************************************************
* FD31_WMDrawItem [internal] * FD31_WMDrawItem [internal]
*/ */
@ -375,7 +373,7 @@ static LRESULT FD31_DirListDblClick( const FD31_DATA *lfs )
} }
strcatW(tmpstr, FILE_bslash); strcatW(tmpstr, FILE_bslash);
FD31_ScanDir(hWnd, tmpstr); FD31_ScanDir(lfs->ofnW, hWnd, tmpstr);
/* notify the app */ /* notify the app */
if (lfs->hook) if (lfs->hook)
{ {
@ -450,7 +448,7 @@ static LRESULT FD31_TestPath( const FD31_DATA *lfs, LPWSTR path )
TRACE("path=%s, tmpstr2=%s\n", debugstr_w(path), debugstr_w(tmpstr2)); TRACE("path=%s, tmpstr2=%s\n", debugstr_w(path), debugstr_w(tmpstr2));
SetDlgItemTextW( hWnd, edt1, tmpstr2 ); SetDlgItemTextW( hWnd, edt1, tmpstr2 );
FD31_ScanDir(hWnd, path); FD31_ScanDir(lfs->ofnW, hWnd, path);
return (lfs->ofnW->Flags & OFN_NOVALIDATE) ? TRUE : FALSE; return (lfs->ofnW->Flags & OFN_NOVALIDATE) ? TRUE : FALSE;
} }
@ -462,7 +460,7 @@ static LRESULT FD31_TestPath( const FD31_DATA *lfs, LPWSTR path )
strcatW(path, FILE_bslash); strcatW(path, FILE_bslash);
/* if ScanDir succeeds, we have changed the directory */ /* if ScanDir succeeds, we have changed the directory */
if (FD31_ScanDir(hWnd, path)) if (FD31_ScanDir(lfs->ofnW, hWnd, path))
return FALSE; /* and path is not a valid file name */ return FALSE; /* and path is not a valid file name */
/* if not, this must be a filename */ /* if not, this must be a filename */
@ -477,7 +475,7 @@ static LRESULT FD31_TestPath( const FD31_DATA *lfs, LPWSTR path )
lstrcpynW(tmpstr2, pBeginFileName + 1, sizeof(tmpstr2)/sizeof(WCHAR) ); lstrcpynW(tmpstr2, pBeginFileName + 1, sizeof(tmpstr2)/sizeof(WCHAR) );
/* Should we MessageBox() if this fails? */ /* Should we MessageBox() if this fails? */
if (!FD31_ScanDir(hWnd, path)) if (!FD31_ScanDir(lfs->ofnW, hWnd, path))
{ {
return FALSE; return FALSE;
} }
@ -531,7 +529,7 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control,
FD31_UpdateFileTitle(lfs); FD31_UpdateFileTitle(lfs);
if (lfs->hook) if (lfs->hook)
{ {
lRet = (BOOL)FD31_CallWindowProc(lfs, lfs->fileokstring, lRet = FD31_CallWindowProc(lfs, lfs->fileokstring,
0, lfs->lParam ); 0, lfs->lParam );
if (lRet) if (lRet)
{ {
@ -543,7 +541,7 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control,
{ {
if (ofnW->lpstrFile) if (ofnW->lpstrFile)
{ {
LPWSTR str = (LPWSTR)ofnW->lpstrFile; LPWSTR str = ofnW->lpstrFile;
LPWSTR ptr = strrchrW(str, '\\'); LPWSTR ptr = strrchrW(str, '\\');
str[lstrlenW(str) + 1] = '\0'; str[lstrlenW(str) + 1] = '\0';
*ptr = 0; *ptr = 0;
@ -590,7 +588,6 @@ static LRESULT FD31_FileTypeChange( const FD31_DATA *lfs )
return TRUE; return TRUE;
pstr = (LPWSTR)SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETITEMDATA, lRet, 0); pstr = (LPWSTR)SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETITEMDATA, lRet, 0);
TRACE("Selected filter : %s\n", debugstr_w(pstr)); TRACE("Selected filter : %s\n", debugstr_w(pstr));
SetDlgItemTextW( lfs->hwnd, edt1, pstr );
return FD31_Validate( lfs, NULL, cmb1, lRet, TRUE ); return FD31_Validate( lfs, NULL, cmb1, lRet, TRUE );
} }
@ -871,11 +868,19 @@ LONG FD31_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL) if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL)
ofn->nFilterIndex = 1; ofn->nFilterIndex = 1;
SendDlgItemMessageW(hWnd, cmb1, CB_SETCURSEL, ofn->nFilterIndex - 1, 0); SendDlgItemMessageW(hWnd, cmb1, CB_SETCURSEL, ofn->nFilterIndex - 1, 0);
lstrcpynW(tmpstr, FD31_GetFileType(ofn->lpstrCustomFilter, if (ofn->lpstrFile && ofn->lpstrFile[0])
{
TRACE( "SetText of edt1 to %s\n", debugstr_w(ofn->lpstrFile) );
SetDlgItemTextW( hWnd, edt1, ofn->lpstrFile );
}
else
{
lstrcpynW(tmpstr, FD31_GetFileType(ofn->lpstrCustomFilter,
ofn->lpstrFilter, ofn->nFilterIndex - 1),BUFFILE); ofn->lpstrFilter, ofn->nFilterIndex - 1),BUFFILE);
TRACE("nFilterIndex = %d, SetText of edt1 to %s\n", TRACE("nFilterIndex = %d, SetText of edt1 to %s\n",
ofn->nFilterIndex, debugstr_w(tmpstr)); ofn->nFilterIndex, debugstr_w(tmpstr));
SetDlgItemTextW( hWnd, edt1, tmpstr ); SetDlgItemTextW( hWnd, edt1, tmpstr );
}
/* get drive list */ /* get drive list */
*tmpstr = 0; *tmpstr = 0;
DlgDirListComboBoxW(hWnd, tmpstr, cmb2, 0, DDL_DRIVES | DDL_EXCLUSIVE); DlgDirListComboBoxW(hWnd, tmpstr, cmb2, 0, DDL_DRIVES | DDL_EXCLUSIVE);
@ -896,9 +901,9 @@ LONG FD31_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
} }
else else
*tmpstr = 0; *tmpstr = 0;
if (!FD31_ScanDir(hWnd, tmpstr)) { if (!FD31_ScanDir(ofn, hWnd, tmpstr)) {
*tmpstr = 0; *tmpstr = 0;
if (!FD31_ScanDir(hWnd, tmpstr)) if (!FD31_ScanDir(ofn, hWnd, tmpstr))
WARN("Couldn't read initial directory %s!\n", debugstr_w(tmpstr)); WARN("Couldn't read initial directory %s!\n", debugstr_w(tmpstr));
} }
/* select current drive in combo 2, omit missing drives */ /* select current drive in combo 2, omit missing drives */
@ -919,7 +924,7 @@ LONG FD31_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
if (ofn->Flags & OFN_HIDEREADONLY) if (ofn->Flags & OFN_HIDEREADONLY)
ShowWindow(GetDlgItem(hWnd, chx1), SW_HIDE); ShowWindow(GetDlgItem(hWnd, chx1), SW_HIDE);
if (lfs->hook) if (lfs->hook)
return (BOOL) FD31_CallWindowProc(lfs, WM_INITDIALOG, wParam, lfs->lParam); return FD31_CallWindowProc(lfs, WM_INITDIALOG, wParam, lfs->lParam);
return TRUE; return TRUE;
} }

View file

@ -117,11 +117,11 @@ static void COMDLG32_DumpSBSPFlags(UINT uflags)
FE(SBSP_INITIATEDBYHLINKFRAME), FE(SBSP_INITIATEDBYHLINKFRAME),
}; };
#undef FE #undef FE
DPRINTF("SBSP Flags: %08x =", uflags); TRACE("SBSP Flags: %08x =", uflags);
for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++)
if (flags[i].mask & uflags) if (flags[i].mask & uflags)
DPRINTF("%s ", flags[i].name); TRACE("%s ", flags[i].name);
DPRINTF("\n"); TRACE("\n");
} }
} }
@ -375,8 +375,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
return hRes; return hRes;
} }
/* create an absolute pidl */ /* create an absolute pidl */
pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent, pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent, pidl);
(LPCITEMIDLIST)pidl);
} }
else if(wFlags & SBSP_PARENT) else if(wFlags & SBSP_PARENT)
{ {
@ -388,7 +387,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
else /* SBSP_ABSOLUTE is 0x0000 */ else /* SBSP_ABSOLUTE is 0x0000 */
{ {
/* An absolute pidl (relative from the desktop) */ /* An absolute pidl (relative from the desktop) */
pidlTmp = COMDLG32_PIDL_ILClone((LPCITEMIDLIST)pidl); pidlTmp = COMDLG32_PIDL_ILClone(pidl);
psfTmp = GetShellFolderFromPidl(pidlTmp); psfTmp = GetShellFolderFromPidl(pidlTmp);
} }

View file

@ -382,7 +382,7 @@ static HWND COMDLG32_FR_DoFindReplace(
HRSRC htemplate; HRSRC htemplate;
if(pdata->fr.Flags & FR_ENABLETEMPLATE) if(pdata->fr.Flags & FR_ENABLETEMPLATE)
{ {
hmod = (HMODULE)pdata->fr.hInstance; hmod = pdata->fr.hInstance;
if(pdata->fr.Flags & FR_WINE_UNICODE) if(pdata->fr.Flags & FR_WINE_UNICODE)
{ {
htemplate = FindResourceW(hmod, (LPCWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOG); htemplate = FindResourceW(hmod, (LPCWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOG);

View file

@ -223,7 +223,7 @@ BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
/*********************************************************************** /***********************************************************************
* ChooseFontA (COMDLG32.@) * ChooseFontA (COMDLG32.@)
* *
* See ChosseFontW. * See ChooseFontW.
*/ */
BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont) BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
{ {

View file

@ -2340,6 +2340,7 @@ typedef struct {
typedef struct { typedef struct {
LPPAGESETUPDLGW dlga; LPPAGESETUPDLGW dlga;
PRINTDLGW pdlg; PRINTDLGW pdlg;
PAGESETUPDLGW curdlg; /* Current dialog state */
} PageSetupDataW; } PageSetupDataW;
@ -2683,6 +2684,46 @@ PRINTDLG_PS_ChangePrinterA(HWND hDlg, PageSetupDataA *pda) {
return TRUE; return TRUE;
} }
static void PRINTDLG_PS_SetOrientationW(HWND hDlg, PageSetupDataW* pda)
{
WCHAR PaperName[64];
GetDlgItemTextW(hDlg, cmb2, PaperName, sizeof(PaperName)/sizeof(WCHAR));
PRINTDLG_PaperSizeW(&pda->pdlg, PaperName, &pda->curdlg.ptPaperSize);
pda->curdlg.ptPaperSize.x = _c_10mm2size((LPPAGESETUPDLGA)pda->dlga, pda->curdlg.ptPaperSize.x);
pda->curdlg.ptPaperSize.y = _c_10mm2size((LPPAGESETUPDLGA)pda->dlga, pda->curdlg.ptPaperSize.y);
if(IsDlgButtonChecked(hDlg, rad2))
{
DWORD tmp = pda->curdlg.ptPaperSize.x;
pda->curdlg.ptPaperSize.x = pda->curdlg.ptPaperSize.y;
pda->curdlg.ptPaperSize.y = tmp;
}
}
static void PRINTDLG_PS_UpdatePrintDlgW(PageSetupDataW* pda, HWND hDlg)
{
DEVMODEW* dm;
DWORD sel;
dm = GlobalLock(pda->pdlg.hDevMode);
if(!dm)
return;
if(pda->curdlg.ptPaperSize.y > pda->curdlg.ptPaperSize.x)
dm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;
else
dm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;
sel = SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0);
if(sel != CB_ERR)
dm->u1.s1.dmPaperSize = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, sel, 0);
GlobalUnlock(pda->pdlg.hDevMode);
}
static BOOL static BOOL
PRINTDLG_PS_ChangePrinterW(HWND hDlg, PageSetupDataW *pda) { PRINTDLG_PS_ChangePrinterW(HWND hDlg, PageSetupDataW *pda) {
DEVNAMES *dn; DEVNAMES *dn;
@ -2695,8 +2736,18 @@ PRINTDLG_PS_ChangePrinterW(HWND hDlg, PageSetupDataW *pda) {
portname = ((WCHAR*)dn)+dn->wOutputOffset; portname = ((WCHAR*)dn)+dn->wOutputOffset;
PRINTDLG_SetUpPaperComboBoxW(hDlg,cmb2,devname,portname,dm); PRINTDLG_SetUpPaperComboBoxW(hDlg,cmb2,devname,portname,dm);
PRINTDLG_SetUpPaperComboBoxW(hDlg,cmb3,devname,portname,dm); PRINTDLG_SetUpPaperComboBoxW(hDlg,cmb3,devname,portname,dm);
/* Landscape orientation */
if (dm->u1.s1.dmOrientation == DMORIENT_LANDSCAPE)
CheckRadioButton(hDlg, rad1, rad2, rad2);
else /* this is default if papersize is not set */
CheckRadioButton(hDlg, rad1, rad2, rad1);
GlobalUnlock(pda->pdlg.hDevNames); GlobalUnlock(pda->pdlg.hDevNames);
GlobalUnlock(pda->pdlg.hDevMode); GlobalUnlock(pda->pdlg.hDevMode);
PRINTDLG_PS_SetOrientationW(hDlg, pda);
return TRUE; return TRUE;
} }
@ -2791,21 +2842,30 @@ PRINTDLG_PS_WMCommandA(
} }
return TRUE; return TRUE;
case rad1: case rad1:
if (pda->curdlg.ptPaperSize.x > pda->curdlg.ptPaperSize.y){
DWORD tmp = pda->curdlg.ptPaperSize.x;
pda->curdlg.ptPaperSize.x = pda->curdlg.ptPaperSize.y;
pda->curdlg.ptPaperSize.y = tmp;
}
PRINTDLG_PS_ChangePaperPrev(pda);
break;
case rad2: case rad2:
if (pda->curdlg.ptPaperSize.y > pda->curdlg.ptPaperSize.x){ if((id == rad1 && pda->curdlg.ptPaperSize.x > pda->curdlg.ptPaperSize.y) ||
DWORD tmp = pda->curdlg.ptPaperSize.x; (id == rad2 && pda->curdlg.ptPaperSize.y > pda->curdlg.ptPaperSize.x))
pda->curdlg.ptPaperSize.x = pda->curdlg.ptPaperSize.y; {
pda->curdlg.ptPaperSize.y = tmp; char TmpText[25];
} char TmpText2[25];
DWORD tmp = pda->curdlg.ptPaperSize.x;
pda->curdlg.ptPaperSize.x = pda->curdlg.ptPaperSize.y;
pda->curdlg.ptPaperSize.y = tmp;
GetDlgItemTextA(hDlg, edt4, TmpText, sizeof(TmpText));
GetDlgItemTextA(hDlg, edt5, TmpText2, sizeof(TmpText2));
SetDlgItemTextA(hDlg, edt5, TmpText);
SetDlgItemTextA(hDlg, edt4, TmpText2);
GetDlgItemTextA(hDlg, edt6, TmpText, sizeof(TmpText));
GetDlgItemTextA(hDlg, edt7, TmpText2, sizeof(TmpText2));
SetDlgItemTextA(hDlg, edt7, TmpText);
SetDlgItemTextA(hDlg, edt6, TmpText2);
PRINTDLG_PS_ChangePaperPrev(pda); PRINTDLG_PS_ChangePaperPrev(pda);
break; }
break;
case cmb1: /* Printer combo */ case cmb1: /* Printer combo */
if(msg == CBN_SELCHANGE){ if(msg == CBN_SELCHANGE){
char crPrinterName[256]; char crPrinterName[256];
@ -2890,10 +2950,10 @@ PRINTDLG_PS_WMCommandA(
GETVAL(id, pda->curdlg.rtMargin.left); GETVAL(id, pda->curdlg.rtMargin.left);
break; break;
case edt5: case edt5:
GETVAL(id, pda->curdlg.rtMargin.right); GETVAL(id, pda->curdlg.rtMargin.top);
break; break;
case edt6: case edt6:
GETVAL(id, pda->curdlg.rtMargin.top); GETVAL(id, pda->curdlg.rtMargin.right);
break; break;
case edt7: case edt7:
GETVAL(id, pda->curdlg.rtMargin.bottom); GETVAL(id, pda->curdlg.rtMargin.bottom);
@ -2921,9 +2981,34 @@ PRINTDLG_PS_WMCommandW(
EndDialog(hDlg, FALSE); EndDialog(hDlg, FALSE);
return FALSE ; return FALSE ;
case rad1:
case rad2:
if((LOWORD(wParam) == rad1 && pda->curdlg.ptPaperSize.x > pda->curdlg.ptPaperSize.y) ||
(LOWORD(wParam) == rad2 && pda->curdlg.ptPaperSize.y > pda->curdlg.ptPaperSize.x))
{
WCHAR tmpText[25];
WCHAR tmpText2[25];
DWORD tmp = pda->curdlg.ptPaperSize.y;
pda->curdlg.ptPaperSize.y = pda->curdlg.ptPaperSize.x;
pda->curdlg.ptPaperSize.x = tmp;
GetDlgItemTextW(hDlg, edt4, tmpText, sizeof(tmpText)/sizeof(WCHAR));
GetDlgItemTextW(hDlg, edt5, tmpText2, sizeof(tmpText2)/sizeof(WCHAR));
SetDlgItemTextW(hDlg, edt5, tmpText);
SetDlgItemTextW(hDlg, edt4, tmpText2);
GetDlgItemTextW(hDlg, edt6, tmpText, sizeof(tmpText)/sizeof(WCHAR));
GetDlgItemTextW(hDlg, edt7, tmpText2, sizeof(tmpText2)/sizeof(WCHAR));
SetDlgItemTextW(hDlg, edt7, tmpText);
SetDlgItemTextW(hDlg, edt6, tmpText2);
}
break;
case psh3: { case psh3: {
pda->pdlg.Flags = 0; pda->pdlg.Flags = 0;
pda->pdlg.hwndOwner = hDlg; pda->pdlg.hwndOwner = hDlg;
PRINTDLG_PS_UpdatePrintDlgW(pda, hDlg);
if (PrintDlgW(&(pda->pdlg))) if (PrintDlgW(&(pda->pdlg)))
PRINTDLG_PS_ChangePrinterW(hDlg,pda); PRINTDLG_PS_ChangePrinterW(hDlg,pda);
return TRUE; return TRUE;
@ -3069,12 +3154,12 @@ PRINTDLG_PagePaintProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
scalx = rcClient.right / (double)pda->curdlg.ptPaperSize.x; scalx = rcClient.right / (double)pda->curdlg.ptPaperSize.x;
scaly = rcClient.bottom / (double)pda->curdlg.ptPaperSize.y; scaly = rcClient.bottom / (double)pda->curdlg.ptPaperSize.y;
rcMargin = rcClient; rcMargin = rcClient;
rcMargin.left += (LONG)pda->curdlg.rtMargin.left * scalx; rcMargin.left += pda->curdlg.rtMargin.left * scalx;
rcMargin.top += (LONG)pda->curdlg.rtMargin.top * scalx; rcMargin.top += pda->curdlg.rtMargin.top * scalx;
rcMargin.right -= (LONG)pda->curdlg.rtMargin.right * scaly; rcMargin.right -= pda->curdlg.rtMargin.right * scaly;
rcMargin.bottom -= (LONG)pda->curdlg.rtMargin.bottom * scaly; rcMargin.bottom -= pda->curdlg.rtMargin.bottom * scaly;
/* if the space is too small then we make sure to not draw anything */ /* if the space is too small then we make sure to not draw anything */
rcMargin.left = min(rcMargin.left, rcMargin.right); rcMargin.left = min(rcMargin.left, rcMargin.right);
rcMargin.top = min(rcMargin.top, rcMargin.bottom); rcMargin.top = min(rcMargin.top, rcMargin.bottom);
@ -3268,12 +3353,12 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ '_', '_', 'W', 'I', 'N', 'E', '_', 'P', 'A', 'G', 'E', { '_', '_', 'W', 'I', 'N', 'E', '_', 'P', 'A', 'G', 'E',
'S', 'E', 'T', 'U', 'P', 'D', 'L', 'G', 'D', 'A', 'T', 'A', 0 }; 'S', 'E', 'T', 'U', 'P', 'D', 'L', 'G', 'D', 'A', 'T', 'A', 0 };
PageSetupDataW *pda; PageSetupDataW *pda;
LPDEVMODEW dm;
BOOL res = FALSE; BOOL res = FALSE;
if (uMsg==WM_INITDIALOG) { if (uMsg==WM_INITDIALOG) {
res = TRUE; res = TRUE;
pda = (PageSetupDataW*)lParam; pda = (PageSetupDataW*)lParam;
memcpy(&pda->curdlg, pda, sizeof(pda->curdlg));
SetPropW(hDlg, __WINE_PAGESETUPDLGDATA, pda); SetPropW(hDlg, __WINE_PAGESETUPDLGDATA, pda);
if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) { if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) {
res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,(LPARAM)pda->dlga); res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,(LPARAM)pda->dlga);
@ -3295,16 +3380,7 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
EnableWindow(GetDlgItem(hDlg, edt7), FALSE); EnableWindow(GetDlgItem(hDlg, edt7), FALSE);
} }
if(pda->dlga->hDevMode) PRINTDLG_PS_ChangePrinterW(hDlg,pda);
{
dm = GlobalLock(pda->dlga->hDevMode);
/* Landscape orientation */
if (dm->u1.s1.dmOrientation == DMORIENT_LANDSCAPE)
CheckRadioButton(hDlg, rad1, rad2, rad2);
else /* this is default if papersize is not set */
CheckRadioButton(hDlg, rad1, rad2, rad1);
GlobalUnlock(pda->dlga->hDevMode);
}
if (pda->dlga->Flags & PSD_DISABLEORIENTATION) { if (pda->dlga->Flags & PSD_DISABLEORIENTATION) {
EnableWindow(GetDlgItem(hDlg,rad1),FALSE); EnableWindow(GetDlgItem(hDlg,rad1),FALSE);
@ -3331,7 +3407,7 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
SetDlgItemTextW(hDlg,edt6,str); SetDlgItemTextW(hDlg,edt6,str);
SetDlgItemTextW(hDlg,edt7,str); SetDlgItemTextW(hDlg,edt7,str);
} }
PRINTDLG_PS_ChangePrinterW(hDlg,pda);
if (pda->dlga->Flags & PSD_DISABLEPAPER) { if (pda->dlga->Flags & PSD_DISABLEPAPER) {
EnableWindow(GetDlgItem(hDlg,cmb2),FALSE); EnableWindow(GetDlgItem(hDlg,cmb2),FALSE);
EnableWindow(GetDlgItem(hDlg,cmb3),FALSE); EnableWindow(GetDlgItem(hDlg,cmb3),FALSE);