Changeset 6709 for trunk/src/comdlg32
- Timestamp:
- Sep 15, 2001, 11:26:26 AM (24 years ago)
- Location:
- trunk/src/comdlg32
- Files:
-
- 7 edited
-
colordlg.c (modified) (43 diffs)
-
filedlg.c (modified) (63 diffs)
-
filedlgbrowser.c (modified) (41 diffs)
-
filetitle.c (modified) (3 diffs)
-
finddlg32.c (modified) (13 diffs)
-
fontdlg.c (modified) (38 diffs)
-
printdlg.c (modified) (81 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/colordlg.c
r6708 r6709 74 74 int nextuserdef; /* next free place in user defined color array */ 75 75 HDC hdcMem; /* color graph used for BitBlt() */ 76 HBITMAP hbmMem; /* color graph bitmap */ 76 HBITMAP hbmMem; /* color graph bitmap */ 77 77 RECT fullsize; /* original dialog window size */ 78 78 UINT msetrgb; /* # of SETRGBSTRING message (today not used) */ … … 155 155 /* lum */ 156 156 case 'L': mmsum *= 120; /* 0...61200=(255+255)*120 */ 157 result = mmsum / 255; /* 0...240 */158 break;157 result = mmsum / 255; /* 0...240 */ 158 break; 159 159 /* saturation */ 160 160 case 'S': if (!mmsum) 161 result = 0;162 else163 if (!mini || maxi == 255)164 result = 240;165 else166 {167 result = mmdif * 240; /* 0...61200=255*240 */168 result /= (mmsum > 255 ? mmsum = 510 - mmsum : mmsum); /* 0..255 */169 }170 break;161 result = 0; 162 else 163 if (!mini || maxi == 255) 164 result = 240; 165 else 166 { 167 result = mmdif * 240; /* 0...61200=255*240 */ 168 result /= (mmsum > 255 ? mmsum = 510 - mmsum : mmsum); /* 0..255 */ 169 } 170 break; 171 171 /* hue */ 172 172 case 'H': if (!mmdif) 173 result = 160;174 else175 {176 if (maxi == r)177 {178 iresult = 40 * (g - b); /* -10200 ... 10200 */179 iresult /= (int) mmdif; /* -40 .. 40 */180 if (iresult < 0)181 iresult += 240; /* 0..40 and 200..240 */182 }183 else184 if (maxi == g)185 {186 iresult = 40 * (b - r);187 iresult /= (int) mmdif;188 iresult += 80; /* 40 .. 120 */189 }190 else191 if (maxi == b)192 {193 iresult = 40 * (r - g);194 iresult /= (int) mmdif;195 iresult += 160; /* 120 .. 200 */196 }197 result = iresult;198 }199 break;173 result = 160; 174 else 175 { 176 if (maxi == r) 177 { 178 iresult = 40 * (g - b); /* -10200 ... 10200 */ 179 iresult /= (int) mmdif; /* -40 .. 40 */ 180 if (iresult < 0) 181 iresult += 240; /* 0..40 and 200..240 */ 182 } 183 else 184 if (maxi == g) 185 { 186 iresult = 40 * (b - r); 187 iresult /= (int) mmdif; 188 iresult += 80; /* 40 .. 120 */ 189 } 190 else 191 if (maxi == b) 192 { 193 iresult = 40 * (r - g); 194 iresult /= (int) mmdif; 195 iresult += 160; /* 120 .. 200 */ 196 } 197 result = iresult; 198 } 199 break; 200 200 } 201 201 return result; /* is this integer arithmetic precise enough ? */ … … 249 249 */ 250 250 static int CC_MouseCheckPredefColorArray( LCCPRIV lpp, HWND hDlg, int dlgitem, int rows, int cols, 251 LPARAM lParam )251 LPARAM lParam ) 252 252 { 253 253 HWND hwnd; … … 283 283 */ 284 284 static int CC_MouseCheckUserColorArray( LCCPRIV lpp, HWND hDlg, int dlgitem, int rows, int cols, 285 LPARAM lParam )285 LPARAM lParam ) 286 286 { 287 287 HWND hwnd; … … 317 317 318 318 /* 240 ^...... ^^ 240 319 | . ||319 | . || 320 320 SAT | . || LUM 321 | . ||322 +-----> 239 ----323 HUE321 | . || 322 +-----> 239 ---- 323 HUE 324 324 */ 325 325 /*********************************************************************** … … 464 464 RECT rect; 465 465 HWND hwnd = GetDlgItem(hDlg, 0x2be); 466 LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER); 466 LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER); 467 467 468 468 if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6))) /* if full size */ … … 476 476 ScreenToClient(hDlg, points); /* |< | */ 477 477 oben = points[0].y; /* | \ | */ 478 /* | \| */478 /* | \| */ 479 479 temp = (long)height * (long)y; 480 480 points[0].y = oben + height - temp / (long)MAXVERT; … … 502 502 int w = GetDialogBaseUnits(); 503 503 HWND hwnd = GetDlgItem(hDlg, 0x2c6); 504 LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER ); 504 LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER ); 505 505 RECT rect; 506 506 POINT point, p; … … 524 524 lpp->oldcross.right = point.x + w + 1; 525 525 lpp->oldcross.top = point.y - w - 1; 526 lpp->oldcross.bottom = point.y + w + 1; 527 528 MoveToEx(hDC, point.x - w, point.y, &p); 526 lpp->oldcross.bottom = point.y + w + 1; 527 528 MoveToEx(hDC, point.x - w, point.y, &p); 529 529 LineTo(hDC, point.x + w, point.y); 530 MoveToEx(hDC, point.x, point.y - w, &p); 530 MoveToEx(hDC, point.x, point.y - w, &p); 531 531 LineTo(hDC, point.x, point.y + w); 532 532 DeleteObject( SelectObject(hDC, hPen)) ; … … 543 543 * CC_PrepareColorGraph [internal] 544 544 */ 545 static void CC_PrepareColorGraph( HWND hDlg ) 545 static void CC_PrepareColorGraph( HWND hDlg ) 546 546 { 547 547 int sdif, hdif, xdif, ydif, r, g, b, hue, sat; 548 548 HWND hwnd = GetDlgItem(hDlg, 0x2c6); 549 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 549 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 550 550 HBRUSH hbrush; 551 551 HDC hdc ; … … 590 590 { 591 591 HWND hwnd = GetDlgItem( hDlg, 0x2c6 ); 592 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 592 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 593 593 HDC hDC; 594 594 RECT rect; … … 650 650 { 651 651 char buffer[10]; 652 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 652 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 653 653 int r = GetRValue(cr); 654 654 int g = GetGValue(cr); … … 695 695 { 696 696 int i; 697 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 698 697 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 698 699 699 EnableWindow( GetDlgItem(hDlg, 0x2cf), FALSE); 700 700 CC_PrepareColorGraph(hDlg); … … 743 743 for ( j = 0; j < rows; j++ ) 744 744 { 745 for ( i = 0; i < cols; i++ ) 745 for ( i = 0; i < cols; i++ ) 746 746 { 747 747 hBrush = CreateSolidBrush(predefcolors[j][i]); … … 764 764 /*********************************************************************** 765 765 * CC_PaintUserColorArray [internal] 766 * Paint the 16 user-selected colors 766 * Paint the 16 user-selected colors 767 767 */ 768 768 static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpcr ) … … 782 782 783 783 hdc = GetDC(hwnd); 784 if (hdc) 784 if (hdc) 785 785 { 786 786 FillRect(hdc, &rect, GetClassLongA(hwnd, GCL_HBRBACKGROUND) ); … … 791 791 hBrush = CreateSolidBrush(lpcr[i+j*cols]); 792 792 if (hBrush) 793 { 793 { 794 794 hBrush = SelectObject(hdc, hBrush) ; 795 795 Rectangle(hdc, rect.left, rect.top, … … 826 826 * CC_WMInitDialog [internal] 827 827 */ 828 static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 ) 828 static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 ) 829 829 { 830 830 int i, res; … … 833 833 RECT rect; 834 834 POINT point; 835 LCCPRIV lpp; 836 835 LCCPRIV lpp; 836 837 837 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam); 838 838 lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) ); … … 851 851 } 852 852 ch32->lStructSize = sizeof(CHOOSECOLORW); 853 ch32->hwndOwner = ch16->hwndOwner; 853 ch32->hwndOwner = ch16->hwndOwner; 854 854 ch32->hInstance = ch16->hInstance; 855 855 ch32->lpCustColors = PTR_SEG_TO_LIN(ch16->lpCustColors); … … 866 866 return FALSE; 867 867 } 868 SetWindowLongA(hDlg, DWL_USER, (LONG)lpp); 868 SetWindowLongA(hDlg, DWL_USER, (LONG)lpp); 869 869 870 870 if (!(lpp->lpcc->Flags & CC_SHOWHELP)) … … 876 876 if (lpp->lpcc->Flags & CC_RGBINIT) 877 877 { 878 for (i = 0; i < 6; i++) 878 for (i = 0; i < 6; i++) 879 879 for (j = 0; j < 8; j++) 880 880 if (predefcolors[i][j] == lpp->lpcc->rgbResult) … … 930 930 res = CallWindowProcA( (WNDPROC)lpp->lpcc->lpfnHook, hDlg, WM_INITDIALOG, wParam, lParam); 931 931 } 932 932 933 933 /* Set the initial values of the color chooser dialog */ 934 934 r = GetRValue(lpp->lpcc->rgbResult); … … 959 959 * CC_WMCommand [internal] 960 960 */ 961 static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl ) 961 static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl ) 962 962 { 963 963 int r, g, b, i, xx; … … 965 965 HDC hdc; 966 966 COLORREF *cr; 967 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 967 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 968 968 TRACE("CC_WMCommand wParam=%x lParam=%lx\n", wParam, lParam); 969 969 switch (wParam) 970 970 { 971 971 case 0x2c2: /* edit notify RGB */ 972 case 0x2c3:973 case 0x2c4:974 if (notifyCode == EN_UPDATE && !lpp->updating)975 {976 i = CC_CheckDigitsInEdit(hwndCtl, 255);977 r = GetRValue(lpp->lpcc->rgbResult);978 g = GetGValue(lpp->lpcc->rgbResult);979 b= GetBValue(lpp->lpcc->rgbResult);980 xx = 0;981 switch (wParam)982 {983 case 0x2c2: if ((xx = (i != r))) r = i; break;984 case 0x2c3: if ((xx = (i != g))) g = i; break;985 case 0x2c4: if ((xx = (i != b))) b = i; break;986 }987 if (xx) /* something has changed */988 {989 lpp->lpcc->rgbResult = RGB(r, g, b);990 CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);991 lpp->h = CC_RGBtoHSL('H', r, g, b);992 lpp->s = CC_RGBtoHSL('S', r, g, b);993 lpp->l = CC_RGBtoHSL('L', r, g, b);994 CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l);995 CC_PaintCross(hDlg, lpp->h, lpp->s);996 CC_PaintTriangle(hDlg, lpp->l);997 }998 }999 break;1000 1001 case 0x2bf: /* edit notify HSL */1002 case 0x2c0:1003 case 0x2c1:1004 if (notifyCode == EN_UPDATE && !lpp->updating)1005 {1006 i = CC_CheckDigitsInEdit(hwndCtl , wParam == 0x2bf ? 239:240);1007 xx = 0;1008 switch (wParam)1009 {1010 case 0x2bf: if ((xx = ( i != lpp->h))) lpp->h = i; break;1011 case 0x2c0: if ((xx = ( i != lpp->s))) lpp->s = i; break;1012 case 0x2c1: if ((xx = ( i != lpp->l))) lpp->l = i; break;1013 }1014 if (xx) /* something has changed */1015 {1016 r = CC_HSLtoRGB('R', lpp->h, lpp->s, lpp->l);1017 g = CC_HSLtoRGB('G', lpp->h, lpp->s, lpp->l);1018 b = CC_HSLtoRGB('B', lpp->h, lpp->s, lpp->l);1019 lpp->lpcc->rgbResult = RGB(r, g, b);1020 CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);1021 CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult);1022 CC_PaintCross(hDlg, lpp->h, lpp->s);1023 CC_PaintTriangle(hDlg, lpp->l);1024 }1025 }1026 break;1027 972 case 0x2c3: 973 case 0x2c4: 974 if (notifyCode == EN_UPDATE && !lpp->updating) 975 { 976 i = CC_CheckDigitsInEdit(hwndCtl, 255); 977 r = GetRValue(lpp->lpcc->rgbResult); 978 g = GetGValue(lpp->lpcc->rgbResult); 979 b= GetBValue(lpp->lpcc->rgbResult); 980 xx = 0; 981 switch (wParam) 982 { 983 case 0x2c2: if ((xx = (i != r))) r = i; break; 984 case 0x2c3: if ((xx = (i != g))) g = i; break; 985 case 0x2c4: if ((xx = (i != b))) b = i; break; 986 } 987 if (xx) /* something has changed */ 988 { 989 lpp->lpcc->rgbResult = RGB(r, g, b); 990 CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult); 991 lpp->h = CC_RGBtoHSL('H', r, g, b); 992 lpp->s = CC_RGBtoHSL('S', r, g, b); 993 lpp->l = CC_RGBtoHSL('L', r, g, b); 994 CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l); 995 CC_PaintCross(hDlg, lpp->h, lpp->s); 996 CC_PaintTriangle(hDlg, lpp->l); 997 } 998 } 999 break; 1000 1001 case 0x2bf: /* edit notify HSL */ 1002 case 0x2c0: 1003 case 0x2c1: 1004 if (notifyCode == EN_UPDATE && !lpp->updating) 1005 { 1006 i = CC_CheckDigitsInEdit(hwndCtl , wParam == 0x2bf ? 239:240); 1007 xx = 0; 1008 switch (wParam) 1009 { 1010 case 0x2bf: if ((xx = ( i != lpp->h))) lpp->h = i; break; 1011 case 0x2c0: if ((xx = ( i != lpp->s))) lpp->s = i; break; 1012 case 0x2c1: if ((xx = ( i != lpp->l))) lpp->l = i; break; 1013 } 1014 if (xx) /* something has changed */ 1015 { 1016 r = CC_HSLtoRGB('R', lpp->h, lpp->s, lpp->l); 1017 g = CC_HSLtoRGB('G', lpp->h, lpp->s, lpp->l); 1018 b = CC_HSLtoRGB('B', lpp->h, lpp->s, lpp->l); 1019 lpp->lpcc->rgbResult = RGB(r, g, b); 1020 CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult); 1021 CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult); 1022 CC_PaintCross(hDlg, lpp->h, lpp->s); 1023 CC_PaintTriangle(hDlg, lpp->l); 1024 } 1025 } 1026 break; 1027 1028 1028 case 0x2cf: 1029 1029 CC_SwitchToFullSize(hDlg, lpp->lpcc->rgbResult, &lpp->fullsize); 1030 SetFocus( GetDlgItem(hDlg, 0x2bf));1031 break;1030 SetFocus( GetDlgItem(hDlg, 0x2bf)); 1031 break; 1032 1032 1033 1033 case 0x2c8: /* add colors ... column by column */ … … 1035 1035 cr[(lpp->nextuserdef % 2) * 8 + lpp->nextuserdef / 2] = lpp->lpcc->rgbResult; 1036 1036 if (++lpp->nextuserdef == 16) 1037 lpp->nextuserdef = 0;1038 CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors);1039 break;1037 lpp->nextuserdef = 0; 1038 CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors); 1039 break; 1040 1040 1041 1041 case 0x2c9: /* resulting color */ 1042 hdc = GetDC(hDlg);1043 lpp->lpcc->rgbResult = GetNearestColor(hdc, lpp->lpcc->rgbResult);1044 ReleaseDC(hDlg, hdc);1045 CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult);1046 CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult);1047 r = GetRValue(lpp->lpcc->rgbResult);1048 g = GetGValue(lpp->lpcc->rgbResult);1049 b = GetBValue(lpp->lpcc->rgbResult);1050 lpp->h = CC_RGBtoHSL('H', r, g, b);1051 lpp->s = CC_RGBtoHSL('S', r, g, b);1052 lpp->l = CC_RGBtoHSL('L', r, g, b);1053 CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l);1054 CC_PaintCross(hDlg, lpp->h, lpp->s);1055 CC_PaintTriangle(hDlg, lpp->l);1056 break;1057 1058 case 0x40e: /* Help! */ /* The Beatles, 1965 ;-) */1059 i = RegisterWindowMessageA(HELPMSGSTRINGA);1042 hdc = GetDC(hDlg); 1043 lpp->lpcc->rgbResult = GetNearestColor(hdc, lpp->lpcc->rgbResult); 1044 ReleaseDC(hDlg, hdc); 1045 CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult); 1046 CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult); 1047 r = GetRValue(lpp->lpcc->rgbResult); 1048 g = GetGValue(lpp->lpcc->rgbResult); 1049 b = GetBValue(lpp->lpcc->rgbResult); 1050 lpp->h = CC_RGBtoHSL('H', r, g, b); 1051 lpp->s = CC_RGBtoHSL('S', r, g, b); 1052 lpp->l = CC_RGBtoHSL('L', r, g, b); 1053 CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l); 1054 CC_PaintCross(hDlg, lpp->h, lpp->s); 1055 CC_PaintTriangle(hDlg, lpp->l); 1056 break; 1057 1058 case 0x40e: /* Help! */ /* The Beatles, 1965 ;-) */ 1059 i = RegisterWindowMessageA(HELPMSGSTRINGA); 1060 1060 #ifndef __WIN32OS2__ 1061 1061 if (lpp->lpcc16) 1062 1062 { 1063 1063 if (lpp->lpcc->hwndOwner) 1064 SendMessage16(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc16);1064 SendMessage16(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc16); 1065 1065 if ( CC_HookCallChk(lpp->lpcc)) 1066 CallWindowProc16( (WNDPROC16) lpp->lpcc16->lpfnHook, hDlg,1067 WM_COMMAND, psh15, (LPARAM)lpp->lpcc16);1066 CallWindowProc16( (WNDPROC16) lpp->lpcc16->lpfnHook, hDlg, 1067 WM_COMMAND, psh15, (LPARAM)lpp->lpcc16); 1068 1068 } 1069 1069 else … … 1071 1071 #endif //!__WIN32OS2__ 1072 1072 if (lpp->lpcc->hwndOwner) 1073 SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc);1073 SendMessageA(lpp->lpcc->hwndOwner, i, 0, (LPARAM)lpp->lpcc); 1074 1074 if ( CC_HookCallChk(lpp->lpcc)) 1075 CallWindowProcA( (WNDPROC) lpp->lpcc->lpfnHook, hDlg,1076 WM_COMMAND, psh15, (LPARAM)lpp->lpcc);1075 CallWindowProcA( (WNDPROC) lpp->lpcc->lpfnHook, hDlg, 1076 WM_COMMAND, psh15, (LPARAM)lpp->lpcc); 1077 1077 #ifndef __WIN32OS2__ 1078 1078 } 1079 1079 #endif //!__WIN32OS2__ 1080 break;1080 break; 1081 1081 1082 1082 case IDOK : 1083 cokmsg = RegisterWindowMessageA(COLOROKSTRINGA);1083 cokmsg = RegisterWindowMessageA(COLOROKSTRINGA); 1084 1084 #ifndef __WIN32OS2__ 1085 1085 if (lpp->lpcc16) 1086 1086 { 1087 if (lpp->lpcc->hwndOwner)1088 if (SendMessage16(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc16))1089 break; /* do NOT close */1087 if (lpp->lpcc->hwndOwner) 1088 if (SendMessage16(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc16)) 1089 break; /* do NOT close */ 1090 1090 } 1091 1091 else 1092 1092 { 1093 1093 #endif //!__WIN32OS2__ 1094 if (lpp->lpcc->hwndOwner)1095 if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc))1096 break; /* do NOT close */1094 if (lpp->lpcc->hwndOwner) 1095 if (SendMessageA(lpp->lpcc->hwndOwner, cokmsg, 0, (LPARAM)lpp->lpcc)) 1096 break; /* do NOT close */ 1097 1097 #ifndef __WIN32OS2__ 1098 1098 } … … 1104 1104 } 1105 1105 #endif 1106 EndDialog(hDlg, 1) ;1107 return TRUE ;1108 1109 case IDCANCEL :1110 EndDialog(hDlg, 0) ;1111 return TRUE ;1106 EndDialog(hDlg, 1) ; 1107 return TRUE ; 1108 1109 case IDCANCEL : 1110 EndDialog(hDlg, 0) ; 1111 return TRUE ; 1112 1112 1113 1113 } … … 1118 1118 * CC_WMPaint [internal] 1119 1119 */ 1120 static LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam ) 1120 static LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam ) 1121 1121 { 1122 1122 HDC hdc; 1123 1123 PAINTSTRUCT ps; 1124 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 1124 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 1125 1125 1126 1126 hdc = BeginPaint(hDlg, &ps); … … 1151 1151 CC_PaintCross(hDlg, lpp->h, lpp->s); 1152 1152 return 1; 1153 } 1153 } 1154 1154 return 0; 1155 1155 } … … 1159 1159 * CC_WMMouseMove [internal] 1160 1160 */ 1161 static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam ) 1162 { 1163 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 1161 static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam ) 1162 { 1163 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 1164 1164 int r, g, b; 1165 1165 … … 1167 1167 { 1168 1168 int *ptrh = NULL, *ptrs = &lpp->l; 1169 if (lpp->capturedGraph == 0x2c6) 1169 if (lpp->capturedGraph == 0x2c6) 1170 1170 { 1171 1171 ptrh = &lpp->h; … … 1196 1196 * CC_WMLButtonDown [internal] 1197 1197 */ 1198 static LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam ) 1199 { 1200 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 1198 static LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam ) 1199 { 1200 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 1201 1201 int r, g, b, i; 1202 1202 i = 0; … … 1208 1208 i = 1; 1209 1209 else 1210 if (CC_MouseCheckColorGraph(hDlg, 0x2c6, &lpp->h, &lpp->s, lParam))1210 if (CC_MouseCheckColorGraph(hDlg, 0x2c6, &lpp->h, &lpp->s, lParam)) 1211 1211 { 1212 i = 2;1212 i = 2; 1213 1213 lpp->capturedGraph = 0x2c6; 1214 1214 } 1215 else1216 if (CC_MouseCheckColorGraph(hDlg, 0x2be, NULL, &lpp->l, lParam))1215 else 1216 if (CC_MouseCheckColorGraph(hDlg, 0x2be, NULL, &lpp->l, lParam)) 1217 1217 { 1218 i = 2;1218 i = 2; 1219 1219 lpp->capturedGraph = 0x2be; 1220 1220 } … … 1276 1276 1277 1277 switch (message) 1278 {1279 case WM_INITDIALOG:1280 return CC_WMInitDialog(hDlg, wParam, lParam, FALSE);1281 case WM_NCDESTROY:1282 DeleteDC(lpp->hdcMem); 1283 DeleteObject(lpp->hbmMem); 1278 { 1279 case WM_INITDIALOG: 1280 return CC_WMInitDialog(hDlg, wParam, lParam, FALSE); 1281 case WM_NCDESTROY: 1282 DeleteDC(lpp->hdcMem); 1283 DeleteObject(lpp->hbmMem); 1284 1284 HeapFree(GetProcessHeap(), 0, lpp); 1285 SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */1286 break;1287 case WM_COMMAND:1288 if (CC_WMCommand( hDlg, wParam, lParam, HIWORD(wParam), (HWND) lParam))1289 return TRUE;1290 break; 1291 case WM_PAINT:1292 if ( CC_WMPaint(hDlg, wParam, lParam))1293 return TRUE;1294 break;1295 case WM_LBUTTONDBLCLK:1296 if (CC_MouseCheckResultWindow(hDlg, lParam))1297 return TRUE;1298 break;1299 case WM_MOUSEMOVE:1300 if (CC_WMMouseMove(hDlg, lParam))1301 return TRUE;1302 break;1303 case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/1285 SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */ 1286 break; 1287 case WM_COMMAND: 1288 if (CC_WMCommand( hDlg, wParam, lParam, HIWORD(wParam), (HWND) lParam)) 1289 return TRUE; 1290 break; 1291 case WM_PAINT: 1292 if ( CC_WMPaint(hDlg, wParam, lParam)) 1293 return TRUE; 1294 break; 1295 case WM_LBUTTONDBLCLK: 1296 if (CC_MouseCheckResultWindow(hDlg, lParam)) 1297 return TRUE; 1298 break; 1299 case WM_MOUSEMOVE: 1300 if (CC_WMMouseMove(hDlg, lParam)) 1301 return TRUE; 1302 break; 1303 case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/ 1304 1304 if (CC_WMLButtonUp(hDlg, wParam, lParam)) 1305 1305 return TRUE; 1306 break;1307 case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/1308 if (CC_WMLButtonDown(hDlg, wParam, lParam))1309 return TRUE;1310 break; 1311 }1306 break; 1307 case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/ 1308 if (CC_WMLButtonDown(hDlg, wParam, lParam)) 1309 return TRUE; 1310 break; 1311 } 1312 1312 return FALSE ; 1313 1313 } … … 1321 1321 { 1322 1322 int res; 1323 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 1323 LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); 1324 1324 if (message != WM_INITDIALOG) 1325 1325 { … … 1339 1339 1340 1340 switch (message) 1341 {1342 case WM_INITDIALOG:1343 return CC_WMInitDialog(hDlg, wParam, lParam, TRUE);1344 case WM_NCDESTROY:1345 DeleteDC(lpp->hdcMem); 1346 DeleteObject(lpp->hbmMem); 1341 { 1342 case WM_INITDIALOG: 1343 return CC_WMInitDialog(hDlg, wParam, lParam, TRUE); 1344 case WM_NCDESTROY: 1345 DeleteDC(lpp->hdcMem); 1346 DeleteObject(lpp->hbmMem); 1347 1347 HeapFree(GetProcessHeap(), 0, lpp->lpcc); 1348 1348 HeapFree(GetProcessHeap(), 0, lpp); 1349 SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */1350 break;1351 case WM_COMMAND:1352 if (CC_WMCommand(hDlg, wParam, lParam, HIWORD(lParam), (HWND)LOWORD(lParam)))1353 return TRUE;1354 break; 1355 case WM_PAINT:1356 if (CC_WMPaint(hDlg, wParam, lParam))1357 return TRUE;1358 break;1359 case WM_LBUTTONDBLCLK:1360 if (CC_MouseCheckResultWindow(hDlg,lParam))1361 return TRUE;1362 break;1363 case WM_MOUSEMOVE:1364 if (CC_WMMouseMove(hDlg, lParam))1365 return TRUE;1366 break;1367 case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/1349 SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */ 1350 break; 1351 case WM_COMMAND: 1352 if (CC_WMCommand(hDlg, wParam, lParam, HIWORD(lParam), (HWND)LOWORD(lParam))) 1353 return TRUE; 1354 break; 1355 case WM_PAINT: 1356 if (CC_WMPaint(hDlg, wParam, lParam)) 1357 return TRUE; 1358 break; 1359 case WM_LBUTTONDBLCLK: 1360 if (CC_MouseCheckResultWindow(hDlg,lParam)) 1361 return TRUE; 1362 break; 1363 case WM_MOUSEMOVE: 1364 if (CC_WMMouseMove(hDlg, lParam)) 1365 return TRUE; 1366 break; 1367 case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/ 1368 1368 if (CC_WMLButtonUp(hDlg, wParam, lParam)) 1369 1369 return TRUE; 1370 break;1371 case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/1372 if (CC_WMLButtonDown(hDlg, wParam, lParam))1373 return TRUE;1374 break; 1375 }1370 break; 1371 case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/ 1372 if (CC_WMLButtonDown(hDlg, wParam, lParam)) 1373 return TRUE; 1374 break; 1375 } 1376 1376 return FALSE ; 1377 1377 } … … 1390 1390 LPCVOID template; 1391 1391 FARPROC16 ptr; 1392 1392 1393 1393 TRACE("ChooseColor\n"); 1394 if (!lpChCol) return FALSE; 1394 if (!lpChCol) return FALSE; 1395 1395 1396 1396 if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE) … … 1415 1415 else 1416 1416 { 1417 HANDLE hResInfo, hDlgTmpl32;1417 HANDLE hResInfo, hDlgTmpl32; 1418 1418 LPCVOID template32; 1419 1419 DWORD size; 1420 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_COLOR", RT_DIALOGA)))1421 {1422 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);1423 return FALSE;1424 }1425 if (!(hDlgTmpl32 = LoadResource(COMMDLG_hInstance32, hResInfo)) ||1426 !(template32 = LockResource(hDlgTmpl32)))1427 {1428 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);1429 return FALSE;1430 }1420 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_COLOR", RT_DIALOGA))) 1421 { 1422 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 1423 return FALSE; 1424 } 1425 if (!(hDlgTmpl32 = LoadResource(COMMDLG_hInstance32, hResInfo)) || 1426 !(template32 = LockResource(hDlgTmpl32))) 1427 { 1428 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 1429 return FALSE; 1430 } 1431 1431 size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo); 1432 1432 hGlobal16 = GlobalAlloc16(0, size); … … 1438 1438 } 1439 1439 template = GlobalLock16(hGlobal16); 1440 if (!template) 1440 if (!template) 1441 1441 { 1442 1442 COMDLG32_SetCommDlgExtendedError(CDERR_MEMLOCKFAILURE); … … 1475 1475 1476 1476 TRACE("ChooseColor\n"); 1477 if (!lpChCol) return FALSE; 1477 if (!lpChCol) return FALSE; 1478 1478 1479 1479 if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE) … … 1504 1504 else 1505 1505 { 1506 HANDLE hResInfo, hDlgTmpl;1507 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_COLOR", RT_DIALOGA)))1508 {1509 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);1510 return FALSE;1511 }1512 if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hResInfo )) ||1513 !(template = LockResource(hDlgTmpl)))1514 {1515 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);1516 return FALSE;1517 }1506 HANDLE hResInfo, hDlgTmpl; 1507 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, "CHOOSE_COLOR", RT_DIALOGA))) 1508 { 1509 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 1510 return FALSE; 1511 } 1512 if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hResInfo )) || 1513 !(template = LockResource(hDlgTmpl))) 1514 { 1515 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 1516 return FALSE; 1517 } 1518 1518 } 1519 1519 … … 1541 1541 if ((lpcc->Flags & CC_ENABLETEMPLATE) && (lpChCol->lpTemplateName)) { 1542 1542 if (HIWORD(lpChCol->lpTemplateName)) 1543 lpcc->lpTemplateName = HEAP_strdupAtoW(GetProcessHeap(), 0, lpChCol->lpTemplateName);1543 lpcc->lpTemplateName = HEAP_strdupAtoW(GetProcessHeap(), 0, lpChCol->lpTemplateName); 1544 1544 else 1545 lpcc->lpTemplateName = (LPWSTR)lpChCol->lpTemplateName;1545 lpcc->lpTemplateName = (LPWSTR)lpChCol->lpTemplateName; 1546 1546 } 1547 1547 -
trunk/src/comdlg32/filedlg.c
r6708 r6709 28 28 #define GlobalLock16 GlobalLock 29 29 #define GlobalUnlock16 GlobalUnlock 30 #define GlobalAlloc16 GlobalAlloc31 #define FreeResource16 FreeResource30 #define GlobalAlloc16 GlobalAlloc 31 #define FreeResource16 FreeResource 32 32 #define LoadResource16 LoadResourceA 33 33 #define FindResource16 FindResourceA 34 #define MapSL(a) a34 #define MapSL(a) a 35 35 #define CallWindowProc16 CallWindowProcA 36 36 … … 42 42 43 43 #define BUFFILE 512 44 #define BUFFILEALLOC 512 * sizeof(WCHAR) 45 46 struct FSPRIVATE 44 #define BUFFILEALLOC 512 * sizeof(WCHAR) 45 46 struct FSPRIVATE 47 47 { 48 48 HWND hwnd; /* file dialog window handle */ … … 75 75 #define LFS32A 2 76 76 #define LFS32W 3 77 77 78 78 static const WCHAR FILE_star[] = {'*','.','*', 0}; 79 79 static const WCHAR FILE_bslash[] = {'\\', 0}; … … 111 111 112 112 LRESULT WINAPI FileOpenDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, 113 LPARAM lParam);113 LPARAM lParam); 114 114 LRESULT WINAPI FileSaveDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, 115 LPARAM lParam);115 LPARAM lParam); 116 116 117 117 static LRESULT WINAPI FileOpenDlgProc(HWND hDlg, UINT msg, … … 119 119 120 120 /*********************************************************************** 121 * FileDlg_Init[internal]121 * FileDlg_Init [internal] 122 122 */ 123 123 static BOOL FileDlg_Init(void) … … 125 125 static BOOL initialized = 0; 126 126 CURSORICONINFO *fldrInfo; 127 127 128 128 if (!initialized) { 129 129 #ifdef __WIN32OS2__ 130 if (!hFolder) hFolder = LoadImageA(0, MAKEINTRESOURCEA(OIC_FOLDER), IMAGE_ICON, 16, 16, LR_SHARED);131 if (!hFolder2) hFolder2 = LoadImageA(0, MAKEINTRESOURCEA(OIC_FOLDER2), IMAGE_ICON, 16, 16, LR_SHARED);132 if (!hFloppy) hFloppy = LoadImageA(0, MAKEINTRESOURCEA(OIC_FLOPPY), IMAGE_ICON, 16, 16, LR_SHARED);133 if (!hHDisk) hHDisk = LoadImageA(0, MAKEINTRESOURCEA(OIC_HDISK), IMAGE_ICON, 16, 16, LR_SHARED);134 if (!hCDRom) hCDRom = LoadImageA(0, MAKEINTRESOURCEA(OIC_CDROM), IMAGE_ICON, 16, 16, LR_SHARED);135 if (!hNet) hNet = LoadImageA(0, MAKEINTRESOURCEA(OIC_NETWORK), IMAGE_ICON, 16, 16, LR_SHARED);130 if (!hFolder) hFolder = LoadImageA(0, MAKEINTRESOURCEA(OIC_FOLDER), IMAGE_ICON, 16, 16, LR_SHARED); 131 if (!hFolder2) hFolder2 = LoadImageA(0, MAKEINTRESOURCEA(OIC_FOLDER2), IMAGE_ICON, 16, 16, LR_SHARED); 132 if (!hFloppy) hFloppy = LoadImageA(0, MAKEINTRESOURCEA(OIC_FLOPPY), IMAGE_ICON, 16, 16, LR_SHARED); 133 if (!hHDisk) hHDisk = LoadImageA(0, MAKEINTRESOURCEA(OIC_HDISK), IMAGE_ICON, 16, 16, LR_SHARED); 134 if (!hCDRom) hCDRom = LoadImageA(0, MAKEINTRESOURCEA(OIC_CDROM), IMAGE_ICON, 16, 16, LR_SHARED); 135 if (!hNet) hNet = LoadImageA(0, MAKEINTRESOURCEA(OIC_NETWORK), IMAGE_ICON, 16, 16, LR_SHARED); 136 136 #else 137 137 HINSTANCE inst = GetModuleHandleA( "comdlg32.dll" ); … … 148 148 hNet = LoadImageA( inst, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED ); 149 149 #endif 150 if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 || 151 hHDisk == 0 || hCDRom == 0 || hNet == 0)152 {153 ERR("Error loading icons !\n");154 return FALSE;155 }150 if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 || 151 hHDisk == 0 || hCDRom == 0 || hNet == 0) 152 { 153 ERR("Error loading icons !\n"); 154 return FALSE; 155 } 156 156 #ifdef __WIN32OS2__ 157 fldrHeight = 16;158 fldrWidth = 16;157 fldrHeight = 16; 158 fldrWidth = 16; 159 159 #else 160 fldrInfo = (CURSORICONINFO *) GlobalLock16( hFolder2 );161 if (!fldrInfo)162 { 163 ERR("Error measuring icons !\n");164 return FALSE;165 }166 fldrHeight = fldrInfo -> nHeight;167 fldrWidth = fldrInfo -> nWidth;168 GlobalUnlock16( hFolder2 );169 #endif 170 initialized = TRUE;160 fldrInfo = (CURSORICONINFO *) GlobalLock16( hFolder2 ); 161 if (!fldrInfo) 162 { 163 ERR("Error measuring icons !\n"); 164 return FALSE; 165 } 166 fldrHeight = fldrInfo -> nHeight; 167 fldrWidth = fldrInfo -> nWidth; 168 GlobalUnlock16( hFolder2 ); 169 #endif 170 initialized = TRUE; 171 171 } 172 172 return TRUE; … … 188 188 if (ofnW->Flags & OFN_ENABLETEMPLATEHANDLE) 189 189 { 190 if (!(lfs->template = LockResource( ofnW->hInstance )))191 {192 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);193 return FALSE;194 }190 if (!(lfs->template = LockResource( ofnW->hInstance ))) 191 { 192 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 193 return FALSE; 194 } 195 195 } 196 196 else if (ofnW->Flags & OFN_ENABLETEMPLATE) 197 197 { 198 HANDLE hResInfo;198 HANDLE hResInfo; 199 199 if (lfs->ofnA) 200 hResInfo = FindResourceA(lfs->ofnA->hInstance,201 lfs->ofnA->lpTemplateName,200 hResInfo = FindResourceA(lfs->ofnA->hInstance, 201 lfs->ofnA->lpTemplateName, 202 202 RT_DIALOGA); 203 203 else 204 hResInfo = FindResourceW(ofnW->hInstance,205 ofnW->lpTemplateName,204 hResInfo = FindResourceW(ofnW->hInstance, 205 ofnW->lpTemplateName, 206 206 RT_DIALOGW); 207 207 if (!hResInfo) 208 {209 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);210 return FALSE;211 }212 if (!(hDlgTmpl = LoadResource(ofnW->hInstance,213 hResInfo)) ||214 !(lfs->template = LockResource(hDlgTmpl)))215 {216 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);217 return FALSE;218 }208 { 209 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 210 return FALSE; 211 } 212 if (!(hDlgTmpl = LoadResource(ofnW->hInstance, 213 hResInfo)) || 214 !(lfs->template = LockResource(hDlgTmpl))) 215 { 216 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 217 return FALSE; 218 } 219 219 } else { /* get it from internal Wine resource */ 220 HANDLE hResInfo;221 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, 220 HANDLE hResInfo; 221 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, 222 222 lfs->open? "OPEN_FILE":"SAVE_FILE", RT_DIALOGA))) 223 {224 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);225 return FALSE;223 { 224 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 225 return FALSE; 226 226 } 227 227 if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hResInfo )) || … … 253 253 else if (ofn16->Flags & OFN_ENABLETEMPLATE) 254 254 { 255 HANDLE16 hResInfo;256 if (!(hResInfo = FindResource16(ofn16->hInstance,257 MapSL(ofn16->lpTemplateName),255 HANDLE16 hResInfo; 256 if (!(hResInfo = FindResource16(ofn16->hInstance, 257 MapSL(ofn16->lpTemplateName), 258 258 RT_DIALOGA))) 259 {260 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);261 return FALSE;262 }263 if (!(lfs->hDlgTmpl16 = LoadResource16( ofn16->hInstance, hResInfo )))264 {265 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);266 return FALSE;267 }259 { 260 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 261 return FALSE; 262 } 263 if (!(lfs->hDlgTmpl16 = LoadResource16( ofn16->hInstance, hResInfo ))) 264 { 265 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 266 return FALSE; 267 } 268 268 lfs->hResource16 = lfs->hDlgTmpl16; 269 269 } 270 270 else 271 271 { /* get resource from (32 bits) own Wine resource; convert it to 16 */ 272 HANDLE hResInfo, hDlgTmpl32;272 HANDLE hResInfo, hDlgTmpl32; 273 273 LPCVOID template32; 274 274 DWORD size; 275 275 276 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, 276 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, 277 277 lfs->open ? "OPEN_FILE":"SAVE_FILE", RT_DIALOGA))) 278 {279 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);280 return FALSE;281 }282 if (!(hDlgTmpl32 = LoadResource(COMMDLG_hInstance32, hResInfo )) ||283 !(template32 = LockResource( hDlgTmpl32 )))284 {285 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);286 return FALSE;287 }278 { 279 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 280 return FALSE; 281 } 282 if (!(hDlgTmpl32 = LoadResource(COMMDLG_hInstance32, hResInfo )) || 283 !(template32 = LockResource( hDlgTmpl32 ))) 284 { 285 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 286 return FALSE; 287 } 288 288 size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo); 289 289 hGlobal16 = GlobalAlloc16(0, size); … … 321 321 cp = strrchrW(temp, '\\'); 322 322 if (cp != NULL) { 323 strcpyW(temp, cp+1);323 strcpyW(temp, cp+1); 324 324 } 325 325 cp = strrchrW(temp, ':'); 326 326 if (cp != NULL) { 327 strcpyW(temp, cp+1);327 strcpyW(temp, cp+1); 328 328 } 329 329 /* FIXME: shouldn't we do something with the result here? ;-) */ … … 366 366 367 367 /*********************************************************************** 368 * FILEDLG_ScanDir [internal]368 * FILEDLG_ScanDir [internal] 369 369 */ 370 370 static BOOL FILEDLG_ScanDir(HWND hWnd, LPWSTR newPath) 371 371 { 372 WCHAR buffer[BUFFILE];373 HWND hdlg, hdlgDir;372 WCHAR buffer[BUFFILE]; 373 HWND hdlg, hdlgDir; 374 374 LRESULT lRet = TRUE; 375 375 HCURSOR hCursorWait, oldCursor; … … 387 387 /* list of files */ 388 388 if ((hdlg = GetDlgItem(hWnd, lst1)) != 0) { 389 WCHAR* scptr; /* ptr on semi-colon */390 WCHAR*filter = buffer;391 392 TRACE("Using filter %s\n", debugstr_w(filter));393 SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);394 while (filter) {395 scptr = strchrW(filter, ';');396 if (scptr)*scptr = 0;389 WCHAR* scptr; /* ptr on semi-colon */ 390 WCHAR* filter = buffer; 391 392 TRACE("Using filter %s\n", debugstr_w(filter)); 393 SendMessageW(hdlg, LB_RESETCONTENT, 0, 0); 394 while (filter) { 395 scptr = strchrW(filter, ';'); 396 if (scptr) *scptr = 0; 397 397 while (*filter == ' ') filter++; 398 TRACE("Using file spec %s\n", debugstr_w(filter));399 if (SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter) == LB_ERR)400 return FALSE;401 if (scptr) *scptr = ';';402 filter = (scptr) ? (scptr + 1) : 0;403 }398 TRACE("Using file spec %s\n", debugstr_w(filter)); 399 if (SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter) == LB_ERR) 400 return FALSE; 401 if (scptr) *scptr = ';'; 402 filter = (scptr) ? (scptr + 1) : 0; 403 } 404 404 } 405 405 … … 416 416 417 417 /*********************************************************************** 418 * FILEDLG_GetFileType[internal]418 * FILEDLG_GetFileType [internal] 419 419 */ 420 420 … … 424 424 i = 0; 425 425 if (cfptr) 426 for ( ;(n = lstrlenW(cfptr)) != 0; i++) 426 for ( ;(n = lstrlenW(cfptr)) != 0; i++) 427 427 { 428 cfptr += n + 1;429 if (i == index)430 return cfptr;431 cfptr += lstrlenW(cfptr) + 1;428 cfptr += n + 1; 429 if (i == index) 430 return cfptr; 431 cfptr += lstrlenW(cfptr) + 1; 432 432 } 433 433 if (fptr) 434 for ( ;(n = lstrlenW(fptr)) != 0; i++) 434 for ( ;(n = lstrlenW(fptr)) != 0; i++) 435 435 { 436 fptr += n + 1;437 if (i == index)438 return fptr;439 fptr += lstrlenW(fptr) + 1;436 fptr += n + 1; 437 if (i == index) 438 return fptr; 439 fptr += lstrlenW(fptr) + 1; 440 440 } 441 441 return (LPWSTR) FILE_star; /* FIXME */ … … 455 455 { 456 456 if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC))) return FALSE; 457 SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, 457 SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, 458 458 (LPARAM)str); 459 459 460 if ((lpdis->itemState & ODS_SELECTED) && !savedlg)461 {462 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );463 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));464 }465 if (savedlg)466 SetTextColor(lpdis->hDC,GetSysColor(COLOR_GRAYTEXT) );467 468 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + 1,460 if ((lpdis->itemState & ODS_SELECTED) && !savedlg) 461 { 462 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) ); 463 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); 464 } 465 if (savedlg) 466 SetTextColor(lpdis->hDC,GetSysColor(COLOR_GRAYTEXT) ); 467 468 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + 1, 469 469 lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED, 470 470 &(lpdis->rcItem), str, lstrlenW(str), NULL); 471 471 472 if (lpdis->itemState & ODS_SELECTED)473 DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );474 475 if ((lpdis->itemState & ODS_SELECTED) && !savedlg)476 {477 SetBkColor( lpdis->hDC, oldBk );478 SetTextColor( lpdis->hDC, oldText );479 }472 if (lpdis->itemState & ODS_SELECTED) 473 DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) ); 474 475 if ((lpdis->itemState & ODS_SELECTED) && !savedlg) 476 { 477 SetBkColor( lpdis->hDC, oldBk ); 478 SetTextColor( lpdis->hDC, oldText ); 479 } 480 480 HeapFree(GetProcessHeap(), 0, str); 481 return TRUE;481 return TRUE; 482 482 } 483 483 … … 486 486 if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC))) 487 487 return FALSE; 488 SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, 488 SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, 489 489 (LPARAM)str); 490 490 491 if (lpdis->itemState & ODS_SELECTED)492 {493 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );494 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));495 }496 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,491 if (lpdis->itemState & ODS_SELECTED) 492 { 493 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) ); 494 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); 495 } 496 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth, 497 497 lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED, 498 498 &(lpdis->rcItem), str, lstrlenW(str), NULL); 499 499 500 if (lpdis->itemState & ODS_SELECTED)501 DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );502 503 if (lpdis->itemState & ODS_SELECTED)504 {505 SetBkColor( lpdis->hDC, oldBk );506 SetTextColor( lpdis->hDC, oldText );507 }508 DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder);500 if (lpdis->itemState & ODS_SELECTED) 501 DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) ); 502 503 if (lpdis->itemState & ODS_SELECTED) 504 { 505 SetBkColor( lpdis->hDC, oldBk ); 506 SetTextColor( lpdis->hDC, oldText ); 507 } 508 DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder); 509 509 HeapFree(GetProcessHeap(), 0, str); 510 return TRUE;510 return TRUE; 511 511 } 512 512 if (lpdis->CtlType == ODT_COMBOBOX && lpdis->CtlID == cmb2) … … 515 515 if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC))) 516 516 return FALSE; 517 SendMessageW(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID, 517 SendMessageW(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID, 518 518 (LPARAM)str); 519 519 root[0] += str[2] - 'a'; … … 526 526 default: hIcon = hHDisk; break; 527 527 } 528 if (lpdis->itemState & ODS_SELECTED)529 {530 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );531 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));532 }533 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,528 if (lpdis->itemState & ODS_SELECTED) 529 { 530 oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) ); 531 oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); 532 } 533 ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth, 534 534 lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED, 535 535 &(lpdis->rcItem), str, lstrlenW(str), NULL); 536 536 537 if (lpdis->itemState & ODS_SELECTED)538 {539 SetBkColor( lpdis->hDC, oldBk );540 SetTextColor( lpdis->hDC, oldText );541 }542 DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon);537 if (lpdis->itemState & ODS_SELECTED) 538 { 539 SetBkColor( lpdis->hDC, oldBk ); 540 SetTextColor( lpdis->hDC, oldText ); 541 } 542 DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon); 543 543 HeapFree(GetProcessHeap(), 0, str); 544 return TRUE;544 return TRUE; 545 545 } 546 546 return FALSE; … … 550 550 * FILEDLG_WMMeasureItem [internal] 551 551 */ 552 static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam) 552 static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam) 553 553 { 554 554 LPMEASUREITEMSTRUCT lpmeasure; 555 555 556 556 lpmeasure = (LPMEASUREITEMSTRUCT)lParam; 557 557 lpmeasure->itemHeight = fldrHeight; … … 562 562 */ 563 563 #ifdef __WIN32OS2__ 564 static LONG FILEDLG_WMMeasureItem16(HWND hWnd, WPARAM wParam, LPARAM lParam) 564 static LONG FILEDLG_WMMeasureItem16(HWND hWnd, WPARAM wParam, LPARAM lParam) 565 565 { 566 566 LPMEASUREITEMSTRUCT lpmeasure; 567 567 568 568 lpmeasure = (LPMEASUREITEMSTRUCT)lParam; 569 569 lpmeasure->itemHeight = fldrHeight; … … 571 571 } 572 572 #else 573 static LONG FILEDLG_WMMeasureItem16(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) 573 static LONG FILEDLG_WMMeasureItem16(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) 574 574 { 575 575 LPMEASUREITEMSTRUCT16 lpmeasure; 576 576 577 577 lpmeasure = MapSL(lParam); 578 578 lpmeasure->itemHeight = fldrHeight; … … 608 608 TRACE("lpstrCustomFilter = %p\n", pstr); 609 609 while(*pstr) 610 {611 old_pstr = pstr;610 { 611 old_pstr = pstr; 612 612 i = SendDlgItemMessageW(hWnd, cmb1, CB_ADDSTRING, 0, 613 613 (LPARAM)(ofn->lpstrCustomFilter) + n ); 614 614 n += lstrlenW(pstr) + 1; 615 pstr += lstrlenW(pstr) + 1;616 TRACE("add str='%s' "617 "associated to '%s'\n", debugstr_w(old_pstr), debugstr_w(pstr));615 pstr += lstrlenW(pstr) + 1; 616 TRACE("add str='%s' " 617 "associated to '%s'\n", debugstr_w(old_pstr), debugstr_w(pstr)); 618 618 SendDlgItemMessageW(hWnd, cmb1, CB_SETITEMDATA, i, (LPARAM)pstr); 619 619 n += lstrlenW(pstr) + 1; 620 pstr += lstrlenW(pstr) + 1;621 }620 pstr += lstrlenW(pstr) + 1; 621 } 622 622 } 623 623 /* read filter information */ 624 624 if (ofn->lpstrFilter) { 625 pstr = (LPWSTR) ofn->lpstrFilter;626 n = 0;627 while(*pstr) {628 old_pstr = pstr;629 i = SendDlgItemMessageW(hWnd, cmb1, CB_ADDSTRING, 0,630 (LPARAM)(ofn->lpstrFilter + n) );631 n += lstrlenW(pstr) + 1;632 pstr += lstrlenW(pstr) + 1;633 TRACE("add str='%s' "634 "associated to '%s'\n", debugstr_w(old_pstr), debugstr_w(pstr));635 SendDlgItemMessageW(hWnd, cmb1, CB_SETITEMDATA, i, (LPARAM)pstr);636 n += lstrlenW(pstr) + 1;637 pstr += lstrlenW(pstr) + 1;638 }625 pstr = (LPWSTR) ofn->lpstrFilter; 626 n = 0; 627 while(*pstr) { 628 old_pstr = pstr; 629 i = SendDlgItemMessageW(hWnd, cmb1, CB_ADDSTRING, 0, 630 (LPARAM)(ofn->lpstrFilter + n) ); 631 n += lstrlenW(pstr) + 1; 632 pstr += lstrlenW(pstr) + 1; 633 TRACE("add str='%s' " 634 "associated to '%s'\n", debugstr_w(old_pstr), debugstr_w(pstr)); 635 SendDlgItemMessageW(hWnd, cmb1, CB_SETITEMDATA, i, (LPARAM)pstr); 636 n += lstrlenW(pstr) + 1; 637 pstr += lstrlenW(pstr) + 1; 638 } 639 639 } 640 640 /* set default filter */ 641 641 if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL) 642 ofn->nFilterIndex = 1;643 SendDlgItemMessageW(hWnd, cmb1, CB_SETCURSEL, ofn->nFilterIndex - 1, 0); 642 ofn->nFilterIndex = 1; 643 SendDlgItemMessageW(hWnd, cmb1, CB_SETCURSEL, ofn->nFilterIndex - 1, 0); 644 644 lstrcpynW(tmpstr, FILEDLG_GetFileType(ofn->lpstrCustomFilter, 645 (LPWSTR)ofn->lpstrFilter, ofn->nFilterIndex - 1),BUFFILE);646 TRACE("nFilterIndex = %ld, SetText of edt1 to '%s'\n", 647 ofn->nFilterIndex, debugstr_w(tmpstr));645 (LPWSTR)ofn->lpstrFilter, ofn->nFilterIndex - 1),BUFFILE); 646 TRACE("nFilterIndex = %ld, SetText of edt1 to '%s'\n", 647 ofn->nFilterIndex, debugstr_w(tmpstr)); 648 648 SetDlgItemTextW( hWnd, edt1, tmpstr ); 649 649 /* get drive list */ … … 651 651 DlgDirListComboBoxW(hWnd, tmpstr, cmb2, 0, DDL_DRIVES | DDL_EXCLUSIVE); 652 652 /* read initial directory */ 653 if (ofn->lpstrInitialDir != NULL) 653 if (ofn->lpstrInitialDir != NULL) 654 654 { 655 655 int len; … … 690 690 { 691 691 str[0] = 'a' + i; 692 if(drives & (1 << i)) n++;692 if(drives & (1 << i)) n++; 693 693 694 694 if (toupper(str[0]) == toupper(dir[0])) break; … … 720 720 /*********************************************************************** 721 721 * FILEDLG_UpdateResult [internal] 722 * update the displayed file name (with path) 722 * update the displayed file name (with path) 723 723 */ 724 724 void FILEDLG_UpdateResult(LFSPRIVATE lfs, WCHAR *tmpstr) … … 747 747 if (lfs->ofn16) 748 748 { /* we have to convert to short (8.3) path */ 749 char tmp[1024]; /* MAX_PATHNAME_LEN */750 LPOPENFILENAME16 ofn16 = lfs->ofn16;749 char tmp[1024]; /* MAX_PATHNAME_LEN */ 750 LPOPENFILENAME16 ofn16 = lfs->ofn16; 751 751 char *dest = MapSL(ofn16->lpstrFile); 752 752 if (!WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFile, -1, 753 753 tmp, ofnW->nMaxFile, NULL, NULL )) 754 754 tmp[ofnW->nMaxFile-1] = 0; 755 GetShortPathNameA(tmp, dest, ofn16->nMaxFile);756 757 /* the same procedure as every year... */755 GetShortPathNameA(tmp, dest, ofn16->nMaxFile); 756 757 /* the same procedure as every year... */ 758 758 ofn16->nFileOffset = strrchr(dest,'\\') - dest +1; 759 759 ofn16->nFileExtension = 0; … … 779 779 /*********************************************************************** 780 780 * FILEDLG_UpdateFileTitle [internal] 781 * update the displayed file name (without path) 781 * update the displayed file name (without path) 782 782 */ 783 783 void FILEDLG_UpdateFileTitle(LFSPRIVATE lfs) … … 785 785 LONG lRet; 786 786 LPOPENFILENAMEW ofnW = lfs->ofnW; 787 if (ofnW->lpstrFileTitle != NULL) 787 if (ofnW->lpstrFileTitle != NULL) 788 788 { 789 789 lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0); … … 825 825 pstr = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC); 826 826 SendDlgItemMessageW(hWnd, lst2, LB_GETTEXT, lRet, 827 (LPARAM)pstr);827 (LPARAM)pstr); 828 828 strcpyW( tmpstr, pstr ); 829 829 HeapFree(GetProcessHeap(), 0, pstr); … … 897 897 pBeginFileName = strrchrW(path, '\\'); 898 898 if (pBeginFileName == NULL) 899 pBeginFileName = strrchrW(path, ':');899 pBeginFileName = strrchrW(path, ':'); 900 900 901 901 if (strchrW(path,'*') != NULL || strchrW(path,'?') != NULL) … … 904 904 if (pBeginFileName != NULL) 905 905 { 906 lstrcpynW(tmpstr2, pBeginFileName + 1, BUFFILE);907 *(pBeginFileName + 1) = 0;908 }909 else910 {911 strcpyW(tmpstr2, path);912 *path = 0;906 lstrcpynW(tmpstr2, pBeginFileName + 1, BUFFILE); 907 *(pBeginFileName + 1) = 0; 908 } 909 else 910 { 911 strcpyW(tmpstr2, path); 912 *path = 0; 913 913 } 914 914 … … 997 997 lRet = (BOOL)FILEDLG_CallWindowProc(lfs, lfs->fileokstring, 998 998 0, lfs->lParam ); 999 if (lRet) 999 if (lRet) 1000 1000 { 1001 1001 *ofnW = ofnsav; /* restore old state */ … … 1009 1009 LPWSTR str = (LPWSTR)ofnW->lpstrFile; 1010 1010 LPWSTR ptr = strrchrW(str, '\\'); 1011 str[lstrlenW(str) + 1] = '\0';1012 *ptr = 0;1011 str[lstrlenW(str) + 1] = '\0'; 1012 *ptr = 0; 1013 1013 } 1014 1014 } … … 1035 1035 (LPARAM)pstr); 1036 1036 wsprintfW(diskname, FILE_specc, pstr[2]); 1037 HeapFree(GetProcessHeap(), 0, pstr); 1037 HeapFree(GetProcessHeap(), 0, pstr); 1038 1038 1039 1039 return FILEDLG_Validate( lfs, diskname, cmb2, lRet, TRUE ); … … 1067 1067 */ 1068 1068 static LRESULT FILEDLG_WMCommand(HWND hWnd, LPARAM lParam, UINT notification, 1069 UINT control, LFSPRIVATE lfs ) 1069 UINT control, LFSPRIVATE lfs ) 1070 1070 { 1071 1071 switch (control) … … 1090 1090 1091 1091 case cmb1: /* file type drop list */ 1092 if (notification == CBN_SELCHANGE) 1092 if (notification == CBN_SELCHANGE) 1093 1093 return FILEDLG_FileTypeChange( lfs ); 1094 1094 break; … … 1215 1215 if (ofnA->lpstrTitle) 1216 1216 str = ofnA->lpstrTitle; 1217 else 1217 else 1218 1218 /* Allocates default title (FIXME : get it from resource) */ 1219 1219 str = open ? defaultopen:defaultsave; … … 1272 1272 /************************************************************************ 1273 1273 * FILEDLG_DestroyPrivate [internal] 1274 * destroys the private object 1274 * destroys the private object 1275 1275 */ 1276 1276 void FILEDLG_DestroyPrivate(LFSPRIVATE lfs) … … 1311 1311 /************************************************************************ 1312 1312 * FILEDLG_AllocPrivate [internal] 1313 * allocate a private object to hold 32 bits Unicode 1313 * allocate a private object to hold 32 bits Unicode 1314 1314 * structure that will be used throughtout the calls, while 1315 1315 * keeping available the original structures and a few variables … … 1369 1369 FILEDLG_MapOfnStructA(lfs->ofnA, lfs->ofnW, lfs->open); 1370 1370 } 1371 else 1371 else 1372 1372 ret = NULL; 1373 1373 } … … 1390 1390 * Creates a win31 style dialog box for the user to select a file to open/save. 1391 1391 */ 1392 BOOL WINAPI GetFileName31A( 1392 BOOL WINAPI GetFileName31A( 1393 1393 LPOPENFILENAMEA lpofn, /* addess of structure with data*/ 1394 1394 UINT dlgType /* type dialogue : open/save */ … … 1405 1405 { 1406 1406 hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); 1407 bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner, 1407 bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner, 1408 1408 (DLGPROC) FileOpenDlgProc, (DWORD) lfs); 1409 1409 FILEDLG_DestroyPrivate(lfs); … … 1420 1420 * Creates a win31 style dialog box for the user to select a file to open/save 1421 1421 */ 1422 BOOL WINAPI GetFileName31W( 1422 BOOL WINAPI GetFileName31W( 1423 1423 LPOPENFILENAMEW lpofn, /* addess of structure with data*/ 1424 1424 UINT dlgType /* type dialogue : open/save */ … … 1435 1435 { 1436 1436 hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); 1437 bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner, 1437 bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner, 1438 1438 (DLGPROC) FileOpenDlgProc, (DWORD) lfs); 1439 1439 FILEDLG_DestroyPrivate(lfs); … … 1453 1453 LRESULT WINAPI FileOpenDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, 1454 1454 LPARAM lParam) 1455 { 1455 { 1456 1456 LFSPRIVATE lfs = (LFSPRIVATE)GetPropA(hWnd,OFN_PROP); 1457 1457 DRAWITEMSTRUCT dis; 1458 1458 1459 1459 TRACE("msg=%x wparam=%x lParam=%lx\n", wMsg, wParam, lParam); 1460 1460 if ((wMsg != WM_INITDIALOG) && lfs && lfs->hook) 1461 1461 { 1462 1462 LRESULT lRet = (BOOL16)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam); 1463 if (lRet) 1463 if (lRet) 1464 1464 return lRet; /* else continue message processing */ 1465 1465 } … … 1483 1483 switch (HIWORD(lParam)) 1484 1484 { 1485 case CTLCOLOR_BTN:1486 SetTextColor((HDC16)wParam, 0x00000000);1485 case CTLCOLOR_BTN: 1486 SetTextColor((HDC16)wParam, 0x00000000); 1487 1487 return hGRAYBrush; 1488 case CTLCOLOR_STATIC:1488 case CTLCOLOR_STATIC: 1489 1489 SetTextColor((HDC16)wParam, 0x00000000); 1490 1490 return hGRAYBrush; 1491 }1491 } 1492 1492 break; 1493 1493 #endif … … 1510 1510 LRESULT lRet; 1511 1511 lRet = (BOOL16)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam); 1512 if (lRet) 1512 if (lRet) 1513 1513 return lRet; /* else continue message processing */ 1514 } 1514 } 1515 1515 switch (wMsg) { 1516 1516 case WM_INITDIALOG: 1517 1517 return FILEDLG_WMInitDialog(hWnd, wParam, lParam); 1518 1518 1519 1519 case WM_MEASUREITEM: 1520 1520 return FILEDLG_WMMeasureItem16(hWnd, wParam, lParam); 1521 1521 1522 1522 case WM_DRAWITEM: 1523 1523 FILEDLG_MapDrawItemStruct(MapSL(lParam), &dis); … … 1527 1527 return FILEDLG_WMCommand(hWnd, lParam, HIWORD(lParam), wParam, lfs); 1528 1528 } 1529 1529 1530 1530 /* 1531 1531 case WM_CTLCOLOR: … … 1541 1541 } 1542 1542 return FALSE; 1543 1543 1544 1544 */ 1545 1545 return FALSE; … … 1549 1549 /*********************************************************************** 1550 1550 * FileOpenDlgProc [internal] 1551 * Used for open and save, in fact. 1551 * Used for open and save, in fact. 1552 1552 */ 1553 1553 static LRESULT WINAPI FileOpenDlgProc(HWND hWnd, UINT wMsg, … … 1561 1561 LRESULT lRet; 1562 1562 lRet = (BOOL)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam); 1563 if (lRet) 1563 if (lRet) 1564 1564 return lRet; /* else continue message processing */ 1565 1565 } … … 1582 1582 switch (HIWORD(lParam)) 1583 1583 { 1584 case CTLCOLOR_BTN:1585 SetTextColor((HDC16)wParam, 0x00000000);1584 case CTLCOLOR_BTN: 1585 SetTextColor((HDC16)wParam, 0x00000000); 1586 1586 return hGRAYBrush; 1587 case CTLCOLOR_STATIC:1587 case CTLCOLOR_STATIC: 1588 1588 SetTextColor((HDC16)wParam, 0x00000000); 1589 1589 return hGRAYBrush; 1590 }1590 } 1591 1591 break; 1592 1592 #endif … … 1595 1595 } 1596 1596 1597 /* ------------------ APIs ---------------------- */ 1597 /* ------------------ APIs ---------------------- */ 1598 1598 #ifndef __WIN32OS2__ 1599 1599 /*********************************************************************** … … 1609 1609 * unknown, there are some FIXME's left. 1610 1610 */ 1611 BOOL16 WINAPI GetOpenFileName16( 1612 SEGPTR ofn /* [in/out] address of structure with data*/1613 )1611 BOOL16 WINAPI GetOpenFileName16( 1612 SEGPTR ofn /* [in/out] address of structure with data*/ 1613 ) 1614 1614 { 1615 1615 HINSTANCE hInst; … … 1626 1626 hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); 1627 1627 ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 6); 1628 bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, 1628 bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, 1629 1629 (DLGPROC16) ptr, (DWORD) lfs); 1630 1630 FILEDLG_DestroyPrivate(lfs); … … 1647 1647 * unknown. There are some FIXME's left. 1648 1648 */ 1649 BOOL16 WINAPI GetSaveFileName16( 1650 SEGPTR ofn /* [in/out] addess of structure with data*/1651 )1649 BOOL16 WINAPI GetSaveFileName16( 1650 SEGPTR ofn /* [in/out] addess of structure with data*/ 1651 ) 1652 1652 { 1653 1653 HINSTANCE hInst; … … 1664 1664 hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); 1665 1665 ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 7); 1666 bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, 1666 bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, 1667 1667 (DLGPROC16) ptr, (DWORD) lfs); 1668 1668 FILEDLG_DestroyPrivate(lfs); 1669 } 1669 } 1670 1670 1671 1671 TRACE("return lpstrFile='%s' !\n", (char *)MapSL(lpofn->lpstrFile)); … … 1685 1685 */ 1686 1686 BOOL WINAPI GetOpenFileNameA( 1687 LPOPENFILENAMEA ofn) /* [in/out] address of init structure */1687 LPOPENFILENAMEA ofn) /* [in/out] address of init structure */ 1688 1688 { 1689 1689 BOOL newlook = TRUE; /* FIXME: TWEAK_WineLook */ … … 1721 1721 */ 1722 1722 BOOL WINAPI GetOpenFileNameW( 1723 LPOPENFILENAMEW ofn) /* [in/out] address of init structure */1723 LPOPENFILENAMEW ofn) /* [in/out] address of init structure */ 1724 1724 { 1725 1725 BOOL newlook = TRUE; /* FIXME: TWEAK_WineLook */ … … 1757 1757 */ 1758 1758 BOOL WINAPI GetSaveFileNameA( 1759 LPOPENFILENAMEA ofn) /* [in/out] address of init structure */1759 LPOPENFILENAMEA ofn) /* [in/out] address of init structure */ 1760 1760 { 1761 1761 BOOL newlook = TRUE; /* FIXME: TWEAK_WineLook */ … … 1775 1775 { 1776 1776 return GetFileDialog95A(ofn, SAVE_DIALOG); 1777 } 1777 } 1778 1778 else 1779 1779 { … … 1793 1793 */ 1794 1794 BOOL WINAPI GetSaveFileNameW( 1795 LPOPENFILENAMEW ofn) /* [in/out] address of init structure */1795 LPOPENFILENAMEW ofn) /* [in/out] address of init structure */ 1796 1796 { 1797 1797 BOOL newlook = TRUE; /* FIXME: TWEAK_WineLook */ … … 1811 1811 { 1812 1812 return GetFileDialog95W(ofn, SAVE_DIALOG); 1813 } 1813 } 1814 1814 else 1815 1815 { -
trunk/src/comdlg32/filedlgbrowser.c
r6708 r6709 1 1 /* 2 2 * Implementation of IShellBrowser for the File Open common dialog 3 * 3 * 4 4 * 5 5 */ … … 59 59 * External Prototypes 60 60 */ 61 extern const char *FileOpenDlgInfosStr; 61 extern const char *FileOpenDlgInfosStr; 62 62 63 63 extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName); … … 91 91 static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) 92 92 { 93 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);94 95 switch (src->uType)96 {97 case STRRET_WSTR:98 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);99 COMDLG32_SHFree(src->u.pOleStr);100 break;101 102 case STRRET_CSTRA:93 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); 94 95 switch (src->uType) 96 { 97 case STRRET_WSTR: 98 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); 99 COMDLG32_SHFree(src->u.pOleStr); 100 break; 101 102 case STRRET_CSTRA: 103 103 if (len && !MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, (LPWSTR)dest, len )) 104 104 ((LPWSTR)dest)[len-1] = 0; 105 break;106 107 case STRRET_OFFSETA:108 if (pidl)109 {105 break; 106 107 case STRRET_OFFSETA: 108 if (pidl) 109 { 110 110 if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, 111 111 -1, (LPWSTR)dest, len )) 112 112 ((LPWSTR)dest)[len-1] = 0; 113 }114 break;115 116 default:117 FIXME("unknown type!\n");118 if (len)119 { *(LPWSTR)dest = '\0';120 }121 return(FALSE);122 }123 return S_OK;113 } 114 break; 115 116 default: 117 FIXME("unknown type!\n"); 118 if (len) 119 { *(LPWSTR)dest = '\0'; 120 } 121 return(FALSE); 122 } 123 return S_OK; 124 124 } 125 125 126 126 /* 127 * IShellBrowser127 * IShellBrowser 128 128 */ 129 129 130 130 /************************************************************************** 131 131 * IShellBrowserImpl_Construct … … 158 158 */ 159 159 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, 160 REFIID riid, 160 REFIID riid, 161 161 LPVOID *ppvObj) 162 162 { … … 168 168 169 169 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 170 { *ppvObj = This; 170 { *ppvObj = This; 171 171 } 172 172 else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/ … … 215 215 TRACE("(%p)\n", This); 216 216 217 if (!--(This->ref)) 218 { 217 if (!--(This->ref)) 218 { 219 219 HeapFree(GetProcessHeap(),0, This); 220 220 return 0; … … 235 235 * 236 236 * Note : We will never be window less in the File Open dialog 237 * 238 */ 239 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 237 * 238 */ 239 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 240 240 HWND * phwnd) 241 241 { … … 249 249 *phwnd = This->hwndOwner; 250 250 251 return (*phwnd) ? S_OK : E_UNEXPECTED; 251 return (*phwnd) ? S_OK : E_UNEXPECTED; 252 252 253 253 } … … 276 276 * See Windows documentation on IShellBrowser::BrowseObject for more details 277 277 * 278 * This function will override user specified flags and will always 279 * use SBSP_DEFBROWSER and SBSP_DEFMODE. 280 */ 281 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 282 LPCITEMIDLIST pidl, 278 * This function will override user specified flags and will always 279 * use SBSP_DEFBROWSER and SBSP_DEFMODE. 280 */ 281 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 282 LPCITEMIDLIST pidl, 283 283 UINT wFlags) 284 284 { … … 301 301 if(wFlags & SBSP_RELATIVE) 302 302 { 303 303 304 304 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */ 305 305 if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder, … … 307 307 { 308 308 ERR("bind to object failed\n"); 309 return hRes;309 return hRes; 310 310 } 311 311 /* create an absolute pidl */ … … 326 326 psfTmp = GetShellFolderFromPidl(pidlTmp); 327 327 } 328 328 329 329 if(!psfTmp) 330 330 { … … 333 333 } 334 334 335 /* If the pidl to browse to is equal to the actual pidl ... 335 /* If the pidl to browse to is equal to the actual pidl ... 336 336 do nothing and pretend you did it*/ 337 337 if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent)) 338 338 { 339 339 IShellFolder_Release(psfTmp); 340 COMDLG32_SHFree(pidlTmp);340 COMDLG32_SHFree(pidlTmp); 341 341 TRACE("keep current folder\n"); 342 342 return NOERROR; … … 395 395 396 396 /* changes the tab order of the ListView to reflect the window's File Dialog */ 397 hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN); 397 hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN); 398 398 SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); 399 399 … … 402 402 SetFocus(fodInfos->ShellInfos.hwndView); 403 403 404 return hRes; 404 return hRes; 405 405 error: 406 406 ERR("Failed with error 0x%08lx\n", hRes); … … 411 411 * IShellBrowserImpl_EnableModelessSB 412 412 */ 413 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, 413 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, 414 414 BOOL fEnable) 415 415 416 416 { 417 417 ICOM_THIS(IShellBrowserImpl, iface); … … 426 426 * IShellBrowserImpl_GetControlWindow 427 427 */ 428 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, 429 UINT id, 428 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, 429 UINT id, 430 430 HWND *lphwnd) 431 431 432 432 { 433 433 ICOM_THIS(IShellBrowserImpl, iface); … … 442 442 */ 443 443 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface, 444 DWORD grfMode, 444 DWORD grfMode, 445 445 LPSTREAM *ppStrm) 446 446 447 447 { 448 448 ICOM_THIS(IShellBrowserImpl, iface); … … 452 452 /* Feature not implemented */ 453 453 return E_NOTIMPL; 454 } 454 } 455 455 /************************************************************************** 456 456 * IShellBrowserImpl_InsertMenusSB … … 459 459 HMENU hmenuShared, 460 460 LPOLEMENUGROUPWIDTHS lpMenuWidths) 461 461 462 462 { 463 463 ICOM_THIS(IShellBrowserImpl, iface); … … 473 473 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface, 474 474 IShellView *ppshv) 475 476 { 477 ICOM_THIS(IShellBrowserImpl, iface); 478 479 TRACE("(%p)\n", This); 480 481 /* Feature not implemented */ 482 return E_NOTIMPL; 483 } 475 476 { 477 ICOM_THIS(IShellBrowserImpl, iface); 478 479 TRACE("(%p)\n", This); 480 481 /* Feature not implemented */ 482 return E_NOTIMPL; 483 } 484 484 /************************************************************************** 485 485 * IShellBrowserImpl_QueryActiveShellView … … 487 487 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface, 488 488 IShellView **ppshv) 489 489 490 490 { 491 491 ICOM_THIS(IShellBrowserImpl, iface); … … 503 503 IShellView_AddRef(fodInfos->Shell.FOIShellView); 504 504 return NOERROR; 505 } 505 } 506 506 /************************************************************************** 507 507 * IShellBrowserImpl_RemoveMenusSB … … 509 509 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface, 510 510 HMENU hmenuShared) 511 512 { 513 ICOM_THIS(IShellBrowserImpl, iface); 514 515 TRACE("(%p)\n", This); 516 517 /* Feature not implemented */ 518 return E_NOTIMPL; 519 } 511 512 { 513 ICOM_THIS(IShellBrowserImpl, iface); 514 515 TRACE("(%p)\n", This); 516 517 /* Feature not implemented */ 518 return E_NOTIMPL; 519 } 520 520 /************************************************************************** 521 521 * IShellBrowserImpl_SendControlMsg 522 522 */ 523 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, 524 UINT id, 525 UINT uMsg, 526 WPARAM wParam, 523 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, 524 UINT id, 525 UINT uMsg, 526 WPARAM wParam, 527 527 LPARAM lParam, 528 528 LRESULT *pret) 529 529 530 530 { 531 531 ICOM_THIS(IShellBrowserImpl, iface); 532 532 LRESULT lres; 533 533 534 534 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret); 535 535 … … 538 538 case FCW_TOOLBAR: 539 539 lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam); 540 break;540 break; 541 541 default: 542 542 FIXME("ctrl id: %x\n", id); … … 550 550 */ 551 551 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface, 552 HMENU hmenuShared, 552 HMENU hmenuShared, 553 553 HOLEMENU holemenuReserved, 554 554 HWND hwndActiveObject) 555 556 { 557 ICOM_THIS(IShellBrowserImpl, iface); 558 559 TRACE("(%p)\n", This); 560 561 /* Feature not implemented */ 562 return E_NOTIMPL; 563 } 555 556 { 557 ICOM_THIS(IShellBrowserImpl, iface); 558 559 TRACE("(%p)\n", This); 560 561 /* Feature not implemented */ 562 return E_NOTIMPL; 563 } 564 564 /************************************************************************** 565 565 * IShellBrowserImpl_SetStatusTextSB … … 567 567 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface, 568 568 LPCOLESTR lpszStatusText) 569 570 { 571 ICOM_THIS(IShellBrowserImpl, iface); 572 573 TRACE("(%p)\n", This); 574 575 /* Feature not implemented */ 576 return E_NOTIMPL; 577 } 569 570 { 571 ICOM_THIS(IShellBrowserImpl, iface); 572 573 TRACE("(%p)\n", This); 574 575 /* Feature not implemented */ 576 return E_NOTIMPL; 577 } 578 578 /************************************************************************** 579 579 * IShellBrowserImpl_SetToolbarItems 580 580 */ 581 581 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface, 582 LPTBBUTTON lpButtons, 583 UINT nButtons, 582 LPTBBUTTON lpButtons, 583 UINT nButtons, 584 584 UINT uFlags) 585 586 { 587 ICOM_THIS(IShellBrowserImpl, iface); 588 589 TRACE("(%p)\n", This); 590 591 /* Feature not implemented */ 592 return E_NOTIMPL; 593 } 585 586 { 587 ICOM_THIS(IShellBrowserImpl, iface); 588 589 TRACE("(%p)\n", This); 590 591 /* Feature not implemented */ 592 return E_NOTIMPL; 593 } 594 594 /************************************************************************** 595 595 * IShellBrowserImpl_TranslateAcceleratorSB 596 596 */ 597 597 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface, 598 LPMSG lpmsg, 598 LPMSG lpmsg, 599 599 WORD wID) 600 600 601 601 { 602 602 ICOM_THIS(IShellBrowserImpl, iface); … … 644 644 */ 645 645 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface( 646 ICommDlgBrowser *iface,647 REFIID riid, 648 LPVOID *ppvObj)646 ICommDlgBrowser *iface, 647 REFIID riid, 648 LPVOID *ppvObj) 649 649 { 650 650 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface); … … 693 693 TRACE("(%p)\n", This); 694 694 695 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 696 695 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 696 697 697 /* If the selected object is not a folder, send a IDOK command to parent window */ 698 698 if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1))) … … 702 702 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 703 703 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); 704 if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )705 {704 if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) ) 705 { 706 706 hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE); 707 }707 } 708 708 else 709 {709 { 710 710 /* Tell the dialog that the user selected a file */ 711 hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);712 }711 hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L); 712 } 713 713 714 714 /* Free memory used by pidl */ … … 737 737 case CDBOSC_SETFOCUS: 738 738 /* FIXME: Reset the default button. 739 This should be taken care of by defdlg. If control740 other than button receives focus the default button741 should be restored. */739 This should be taken care of by defdlg. If control 740 other than button receives focus the default button 741 should be restored. */ 742 742 SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0); 743 743 744 744 break; 745 case CDBOSC_KILLFOCUS: 746 {747 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);748 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)749 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");745 case CDBOSC_KILLFOCUS: 746 { 747 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 748 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 749 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 750 750 } 751 751 break; … … 753 753 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv); 754 754 case CDBOSC_RENAME: 755 /* nothing to do */755 /* nothing to do */ 756 756 break; 757 757 } 758 758 759 return NOERROR; 759 return NOERROR; 760 760 } 761 761 … … 763 763 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject 764 764 */ 765 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 765 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 766 766 IShellView * ppshv, 767 767 LPCITEMIDLIST pidl) … … 780 780 ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK; 781 781 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); 782 782 783 783 if( (ulAttr & SFGAO_HIDDEN) /* hidden */ 784 784 | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */ … … 786 786 787 787 /* always include directorys and links */ 788 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) 788 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) 789 789 return S_OK; 790 790 … … 797 797 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl))) 798 798 { 799 if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))799 if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter)) 800 800 return S_OK; 801 801 } … … 807 807 /************************************************************************** 808 808 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange 809 */ 809 */ 810 810 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv) 811 811 { … … 816 816 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 817 817 TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView); 818 818 819 819 /* release old selections */ 820 820 if (fodInfos->Shell.FOIDataObject) 821 821 IDataObject_Release(fodInfos->Shell.FOIDataObject); 822 822 823 823 /* get a new DataObject from the ShellView */ 824 824 if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION, 825 825 &IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject))) 826 826 return E_FAIL; 827 827 828 828 FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner); 829 829 … … 856 856 */ 857 857 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface( 858 IServiceProvider *iface,859 REFIID riid, 860 LPVOID *ppvObj)858 IServiceProvider *iface, 859 REFIID riid, 860 LPVOID *ppvObj) 861 861 { 862 862 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface); … … 895 895 * 896 896 * NOTES 897 * the w2k shellview asks for 897 * the w2k shellview asks for 898 898 * guidService = SID_STopLevelBrowser 899 899 * riid = IShellBrowser … … 904 904 905 905 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService( 906 IServiceProvider * iface,907 REFGUID guidService,908 REFIID riid,909 void** ppv)906 IServiceProvider * iface, 907 REFGUID guidService, 908 REFIID riid, 909 void** ppv) 910 910 { 911 911 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface); -
trunk/src/comdlg32/filetitle.c
r6708 r6709 13 13 #include "debugtools.h" 14 14 15 #include "heap.h" /* Has to go */15 #include "heap.h" /* Has to go */ 16 16 17 17 DEFAULT_DEBUG_CHANNEL(commdlg) … … 20 20 21 21 /*********************************************************************** 22 * GetFileTitleA(COMDLG32.8)22 * GetFileTitleA (COMDLG32.8) 23 23 * 24 24 */ 25 25 short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf) 26 26 { 27 int i, len;27 int i, len; 28 28 29 TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf);29 TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf); 30 30 31 if(lpFile == NULL || lpTitle == NULL)32 return -1;31 if(lpFile == NULL || lpTitle == NULL) 32 return -1; 33 33 34 len = strlen(lpFile);34 len = strlen(lpFile); 35 35 36 if (len == 0)37 return -1;36 if (len == 0) 37 return -1; 38 38 39 if(strpbrk(lpFile, "*[]"))40 return -1;39 if(strpbrk(lpFile, "*[]")) 40 return -1; 41 41 42 len--;42 len--; 43 43 44 if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')45 return -1;44 if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':') 45 return -1; 46 46 47 for(i = len; i >= 0; i--)48 {49 if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':')50 {51 i++;52 break;53 }54 }47 for(i = len; i >= 0; i--) 48 { 49 if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':') 50 { 51 i++; 52 break; 53 } 54 } 55 55 56 if(i == -1)57 i++;56 if(i == -1) 57 i++; 58 58 59 TRACE("---> '%s' \n", &lpFile[i]); 59 TRACE("---> '%s' \n", &lpFile[i]); 60 61 len = strlen(lpFile+i)+1; 62 if(cbBuf < len) 63 return len; 60 64 61 len = strlen(lpFile+i)+1; 62 if(cbBuf < len) 63 return len; 64 65 strncpy(lpTitle, &lpFile[i], len); 66 return 0; 65 strncpy(lpTitle, &lpFile[i], len); 66 return 0; 67 67 } 68 68 69 69 70 70 /*********************************************************************** 71 * GetFileTitleW(COMDLG32.9)71 * GetFileTitleW (COMDLG32.9) 72 72 * 73 73 */ 74 74 short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, UINT cbBuf) 75 75 { 76 LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);/* Has to go */77 LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf);78 shortret;76 LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile); /* Has to go */ 77 LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf); 78 short ret; 79 79 80 ret = GetFileTitleA(file, title, cbBuf);80 ret = GetFileTitleA(file, title, cbBuf); 81 81 82 lstrcpynAtoW(lpTitle, title, cbBuf);83 HeapFree(GetProcessHeap(), 0, file);84 HeapFree(GetProcessHeap(), 0, title);85 return ret;82 lstrcpynAtoW(lpTitle, title, cbBuf); 83 HeapFree(GetProcessHeap(), 0, file); 84 HeapFree(GetProcessHeap(), 0, title); 85 return ret; 86 86 } 87 87 … … 89 89 #ifndef __WIN32OS2__ 90 90 /*********************************************************************** 91 * GetFileTitle16(COMMDLG.27)91 * GetFileTitle16 (COMMDLG.27) 92 92 */ 93 93 short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf) 94 94 { 95 return GetFileTitleA(lpFile, lpTitle, cbBuf);95 return GetFileTitleA(lpFile, lpTitle, cbBuf); 96 96 } 97 97 #endif -
trunk/src/comdlg32/finddlg32.c
r6708 r6709 24 24 /*-----------------------------------------------------------------------*/ 25 25 26 static UINT FindReplaceMessage;27 static UINT HelpMessage;28 29 #define FR_MASK (FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD | FR_REPLACEALL | FR_REPLACE | FR_FINDNEXT | FR_DIALOGTERM)26 static UINT FindReplaceMessage; 27 static UINT HelpMessage; 28 29 #define FR_MASK (FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD | FR_REPLACEALL | FR_REPLACE | FR_FINDNEXT | FR_DIALOGTERM) 30 30 /* CRITICAL_SECTION COMDLG32_CritSect; */ 31 31 … … 49 49 50 50 /*********************************************************************** 51 * COMDLG32_FR_GetFlags[internal]51 * COMDLG32_FR_GetFlags [internal] 52 52 * Returns the button state that needs to be reported to the caller. 53 * RETURNS54 * Current state of check and radio buttons53 * RETURNS 54 * Current state of check and radio buttons 55 55 */ 56 56 static DWORD COMDLG32_FR_GetFlags(HWND hDlgWnd) 57 57 { 58 DWORD flags = 0;59 if(IsDlgButtonChecked(hDlgWnd, rad2) == BST_CHECKED)60 flags |= FR_DOWN;61 if(IsDlgButtonChecked(hDlgWnd, chx1) == BST_CHECKED)62 flags |= FR_WHOLEWORD;63 if(IsDlgButtonChecked(hDlgWnd, chx2) == BST_CHECKED)64 flags |= FR_MATCHCASE;58 DWORD flags = 0; 59 if(IsDlgButtonChecked(hDlgWnd, rad2) == BST_CHECKED) 60 flags |= FR_DOWN; 61 if(IsDlgButtonChecked(hDlgWnd, chx1) == BST_CHECKED) 62 flags |= FR_WHOLEWORD; 63 if(IsDlgButtonChecked(hDlgWnd, chx2) == BST_CHECKED) 64 flags |= FR_MATCHCASE; 65 65 return flags; 66 66 } 67 67 68 68 /*********************************************************************** 69 * COMDLG32_FR_HandleWMCommand[internal]69 * COMDLG32_FR_HandleWMCommand [internal] 70 70 * Handle WM_COMMAND messages... 71 71 */ 72 72 static void COMDLG32_FR_HandleWMCommand(HWND hDlgWnd, COMDLG32_FR_Data *pData, int Id, int NotifyCode) 73 73 { 74 DWORD flag;75 76 pData->user_fr.fra->Flags &= ~FR_MASK;/* Clear return flags */77 if(pData->fr.Flags & FR_WINE_REPLACE)/* Replace always goes down... */78 pData->user_fr.fra->Flags |= FR_DOWN;79 80 if(NotifyCode == BN_CLICKED)81 { 82 switch(Id)83 {84 case IDOK: /* Find Next */85 if(GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0)74 DWORD flag; 75 76 pData->user_fr.fra->Flags &= ~FR_MASK; /* Clear return flags */ 77 if(pData->fr.Flags & FR_WINE_REPLACE) /* Replace always goes down... */ 78 pData->user_fr.fra->Flags |= FR_DOWN; 79 80 if(NotifyCode == BN_CLICKED) 81 { 82 switch(Id) 83 { 84 case IDOK: /* Find Next */ 85 if(GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0) 86 86 { 87 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_FINDNEXT;87 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_FINDNEXT; 88 88 if(pData->fr.Flags & FR_WINE_UNICODE) 89 89 { … … 94 94 else 95 95 { 96 strcpy(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);96 strcpy(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat); 97 97 } 98 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);98 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra); 99 99 } 100 break;101 102 case IDCANCEL:103 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_DIALOGTERM;104 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);105 DestroyWindow(hDlgWnd);106 break;100 break; 101 102 case IDCANCEL: 103 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_DIALOGTERM; 104 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra); 105 DestroyWindow(hDlgWnd); 106 break; 107 107 108 108 case psh2: /* Replace All */ 109 flag = FR_REPLACEALL;109 flag = FR_REPLACEALL; 110 110 goto Replace; 111 111 112 112 case psh1: /* Replace */ 113 flag = FR_REPLACE;113 flag = FR_REPLACE; 114 114 Replace: 115 if((pData->fr.Flags & FR_WINE_REPLACE)115 if((pData->fr.Flags & FR_WINE_REPLACE) 116 116 && GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0) 117 117 { 118 pData->fr.lpstrReplaceWith[0] = 0; /* In case the next GetDlgItemText Fails */119 GetDlgItemTextA(hDlgWnd, edt2, pData->fr.lpstrReplaceWith, pData->fr.wReplaceWithLen);120 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | flag;118 pData->fr.lpstrReplaceWith[0] = 0; /* In case the next GetDlgItemText Fails */ 119 GetDlgItemTextA(hDlgWnd, edt2, pData->fr.lpstrReplaceWith, pData->fr.wReplaceWithLen); 120 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | flag; 121 121 if(pData->fr.Flags & FR_WINE_UNICODE) 122 122 { … … 130 130 else 131 131 { 132 strcpy(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);133 strcpy(pData->user_fr.fra->lpstrReplaceWith, pData->fr.lpstrReplaceWith);132 strcpy(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat); 133 strcpy(pData->user_fr.fra->lpstrReplaceWith, pData->fr.lpstrReplaceWith); 134 134 } 135 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);135 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra); 136 136 } 137 break;138 139 case pshHelp:140 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd);141 SendMessageA(pData->fr.hwndOwner, HelpMessage, (WPARAM)hDlgWnd, (LPARAM)pData->user_fr.fra);142 break;137 break; 138 139 case pshHelp: 140 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd); 141 SendMessageA(pData->fr.hwndOwner, HelpMessage, (WPARAM)hDlgWnd, (LPARAM)pData->user_fr.fra); 142 break; 143 143 } 144 144 } 145 145 else if(NotifyCode == EN_CHANGE && Id == edt1) 146 {147 BOOL enable = SendDlgItemMessageA(hDlgWnd, edt1, WM_GETTEXTLENGTH, 0, 0) > 0;148 EnableWindow(GetDlgItem(hDlgWnd, IDOK), enable);146 { 147 BOOL enable = SendDlgItemMessageA(hDlgWnd, edt1, WM_GETTEXTLENGTH, 0, 0) > 0; 148 EnableWindow(GetDlgItem(hDlgWnd, IDOK), enable); 149 149 if(pData->fr.Flags & FR_WINE_REPLACE) 150 150 { 151 EnableWindow(GetDlgItem(hDlgWnd, psh1), enable);152 EnableWindow(GetDlgItem(hDlgWnd, psh2), enable);151 EnableWindow(GetDlgItem(hDlgWnd, psh1), enable); 152 EnableWindow(GetDlgItem(hDlgWnd, psh2), enable); 153 153 } 154 }155 } 156 157 /*********************************************************************** 158 * COMDLG32_FindReplaceDlgProc[internal]154 } 155 } 156 157 /*********************************************************************** 158 * COMDLG32_FindReplaceDlgProc [internal] 159 159 * [Find/Replace]Text32[A/W] window procedure. 160 160 */ 161 161 static BOOL CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) 162 162 { 163 COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom);164 BOOL retval = TRUE;;165 166 if(iMsg == WM_INITDIALOG)163 COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom); 164 BOOL retval = TRUE;; 165 166 if(iMsg == WM_INITDIALOG) 167 167 { 168 168 pdata = (COMDLG32_FR_Data *)lParam; 169 if(!SetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom, (HANDLE)pdata))169 if(!SetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom, (HANDLE)pdata)) 170 170 { 171 ERR("Could not Set prop; invent a gracefull exit?...\n");172 DestroyWindow(hDlgWnd);171 ERR("Could not Set prop; invent a gracefull exit?...\n"); 172 DestroyWindow(hDlgWnd); 173 173 return FALSE; 174 174 } 175 SendDlgItemMessageA(hDlgWnd, edt1, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wFindWhatLen, 0);176 SendDlgItemMessageA(hDlgWnd, edt1, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrFindWhat);175 SendDlgItemMessageA(hDlgWnd, edt1, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wFindWhatLen, 0); 176 SendDlgItemMessageA(hDlgWnd, edt1, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrFindWhat); 177 177 if(pdata->fr.Flags & FR_WINE_REPLACE) 178 178 { 179 SendDlgItemMessageA(hDlgWnd, edt2, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wReplaceWithLen, 0);180 SendDlgItemMessageA(hDlgWnd, edt2, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrReplaceWith);179 SendDlgItemMessageA(hDlgWnd, edt2, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wReplaceWithLen, 0); 180 SendDlgItemMessageA(hDlgWnd, edt2, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrReplaceWith); 181 181 } 182 182 183 if(!(pdata->fr.Flags & FR_SHOWHELP))184 ShowWindow(GetDlgItem(hDlgWnd, pshHelp), SW_HIDE);185 if(pdata->fr.Flags & FR_HIDEUPDOWN)186 {187 ShowWindow(GetDlgItem(hDlgWnd, rad1), SW_HIDE);188 ShowWindow(GetDlgItem(hDlgWnd, rad2), SW_HIDE);189 ShowWindow(GetDlgItem(hDlgWnd, grp1), SW_HIDE);190 }191 else if(pdata->fr.Flags & FR_NOUPDOWN)192 {193 EnableWindow(GetDlgItem(hDlgWnd, rad1), FALSE);194 EnableWindow(GetDlgItem(hDlgWnd, rad2), FALSE);195 EnableWindow(GetDlgItem(hDlgWnd, grp1), FALSE);196 }183 if(!(pdata->fr.Flags & FR_SHOWHELP)) 184 ShowWindow(GetDlgItem(hDlgWnd, pshHelp), SW_HIDE); 185 if(pdata->fr.Flags & FR_HIDEUPDOWN) 186 { 187 ShowWindow(GetDlgItem(hDlgWnd, rad1), SW_HIDE); 188 ShowWindow(GetDlgItem(hDlgWnd, rad2), SW_HIDE); 189 ShowWindow(GetDlgItem(hDlgWnd, grp1), SW_HIDE); 190 } 191 else if(pdata->fr.Flags & FR_NOUPDOWN) 192 { 193 EnableWindow(GetDlgItem(hDlgWnd, rad1), FALSE); 194 EnableWindow(GetDlgItem(hDlgWnd, rad2), FALSE); 195 EnableWindow(GetDlgItem(hDlgWnd, grp1), FALSE); 196 } 197 197 else 198 198 { 199 SendDlgItemMessageA(hDlgWnd, rad1, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? 0 : BST_CHECKED, 0);200 SendDlgItemMessageA(hDlgWnd, rad2, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? BST_CHECKED : 0, 0);199 SendDlgItemMessageA(hDlgWnd, rad1, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? 0 : BST_CHECKED, 0); 200 SendDlgItemMessageA(hDlgWnd, rad2, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? BST_CHECKED : 0, 0); 201 201 } 202 202 203 if(pdata->fr.Flags & FR_HIDEMATCHCASE)204 ShowWindow(GetDlgItem(hDlgWnd, chx2), SW_HIDE);205 else if(pdata->fr.Flags & FR_NOMATCHCASE)206 EnableWindow(GetDlgItem(hDlgWnd, chx2), FALSE);203 if(pdata->fr.Flags & FR_HIDEMATCHCASE) 204 ShowWindow(GetDlgItem(hDlgWnd, chx2), SW_HIDE); 205 else if(pdata->fr.Flags & FR_NOMATCHCASE) 206 EnableWindow(GetDlgItem(hDlgWnd, chx2), FALSE); 207 207 else 208 SendDlgItemMessageA(hDlgWnd, chx2, BM_SETCHECK, pdata->fr.Flags & FR_MATCHCASE ? BST_CHECKED : 0, 0);209 210 if(pdata->fr.Flags & FR_HIDEWHOLEWORD)211 ShowWindow(GetDlgItem(hDlgWnd, chx1), SW_HIDE);212 else if(pdata->fr.Flags & FR_NOWHOLEWORD)213 EnableWindow(GetDlgItem(hDlgWnd, chx1), FALSE);208 SendDlgItemMessageA(hDlgWnd, chx2, BM_SETCHECK, pdata->fr.Flags & FR_MATCHCASE ? BST_CHECKED : 0, 0); 209 210 if(pdata->fr.Flags & FR_HIDEWHOLEWORD) 211 ShowWindow(GetDlgItem(hDlgWnd, chx1), SW_HIDE); 212 else if(pdata->fr.Flags & FR_NOWHOLEWORD) 213 EnableWindow(GetDlgItem(hDlgWnd, chx1), FALSE); 214 214 else 215 SendDlgItemMessageA(hDlgWnd, chx1, BM_SETCHECK, pdata->fr.Flags & FR_WHOLEWORD ? BST_CHECKED : 0, 0); 216 217 /* We did the init here, now call the hook if requested */ 218 219 /* We do not do ShowWindow if hook exists and is FALSE */ 220 /* per MSDN Article Q96135 */ 221 if((pdata->fr.Flags & FR_ENABLEHOOK) 222 && ! pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, (LPARAM) &pdata->fr)) 215 SendDlgItemMessageA(hDlgWnd, chx1, BM_SETCHECK, pdata->fr.Flags & FR_WHOLEWORD ? BST_CHECKED : 0, 0); 216 217 /* We did the init here, now call the hook if requested */ 218 219 /* We do not do ShowWindow if hook exists and is FALSE */ 220 /* per MSDN Article Q96135 */ 221 if((pdata->fr.Flags & FR_ENABLEHOOK) 222 && ! pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, (LPARAM) &pdata->fr)) 223 return TRUE; 224 ShowWindow(hDlgWnd, SW_SHOWNORMAL); 225 UpdateWindow(hDlgWnd); 223 226 return TRUE; 224 ShowWindow(hDlgWnd, SW_SHOWNORMAL); 225 UpdateWindow(hDlgWnd); 226 return TRUE; 227 } 228 229 if(pdata && (pdata->fr.Flags & FR_ENABLEHOOK)) 230 { 231 retval = pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, lParam); 232 } 233 else 234 retval = FALSE; 235 236 if(pdata && !retval) 237 { 238 retval = TRUE; 239 switch(iMsg) 240 { 241 case WM_COMMAND: 242 COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, LOWORD(wParam), HIWORD(wParam)); 243 break; 244 245 case WM_CLOSE: 246 COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, IDCANCEL, BN_CLICKED); 247 break; 248 249 case WM_HELP: 250 /* Heeeeelp! */ 251 FIXME("Got WM_HELP. Who is gonna supply it?\n"); 252 break; 253 254 case WM_CONTEXTMENU: 255 /* Heeeeelp! */ 256 FIXME("Got WM_CONTEXTMENU. Who is gonna supply it?\n"); 257 break; 258 /* FIXME: Handle F1 help */ 259 260 default: 261 retval = FALSE; /* We did not handle the message */ 262 } 227 } 228 229 if(pdata && (pdata->fr.Flags & FR_ENABLEHOOK)) 230 { 231 retval = pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, lParam); 232 } 233 else 234 retval = FALSE; 235 236 if(pdata && !retval) 237 { 238 retval = TRUE; 239 switch(iMsg) 240 { 241 case WM_COMMAND: 242 COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, LOWORD(wParam), HIWORD(wParam)); 243 break; 244 245 case WM_CLOSE: 246 COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, IDCANCEL, BN_CLICKED); 247 break; 248 249 case WM_HELP: 250 /* Heeeeelp! */ 251 FIXME("Got WM_HELP. Who is gonna supply it?\n"); 252 break; 253 254 case WM_CONTEXTMENU: 255 /* Heeeeelp! */ 256 FIXME("Got WM_CONTEXTMENU. Who is gonna supply it?\n"); 257 break; 258 /* FIXME: Handle F1 help */ 259 260 default: 261 retval = FALSE; /* We did not handle the message */ 262 } 263 263 } 264 264 … … 269 269 if(iMsg == WM_DESTROY) 270 270 { 271 RemovePropA(hDlgWnd, (LPSTR)COMDLG32_Atom);272 HeapFree(GetProcessHeap(), 0, pdata);271 RemovePropA(hDlgWnd, (LPSTR)COMDLG32_Atom); 272 HeapFree(GetProcessHeap(), 0, pdata); 273 273 } 274 274 … … 277 277 278 278 /*********************************************************************** 279 * COMDLG32_FR_CheckPartial[internal]279 * COMDLG32_FR_CheckPartial [internal] 280 280 * Check various fault conditions in the supplied parameters that 281 281 * cause an extended error to be reported. 282 * RETURNS283 * TRUE: Success284 * FALSE: Failure282 * RETURNS 283 * TRUE: Success 284 * FALSE: Failure 285 285 */ 286 286 static BOOL COMDLG32_FR_CheckPartial( 287 LPFINDREPLACEA pfr,/* [in] Find structure */288 BOOL Replace /* [in] True if called as replace */287 LPFINDREPLACEA pfr, /* [in] Find structure */ 288 BOOL Replace /* [in] True if called as replace */ 289 289 ) { 290 if(!pfr)291 { 292 COMDLG32_SetCommDlgExtendedError(CDERR_GENERALCODES);293 return FALSE; 294 }290 if(!pfr) 291 { 292 COMDLG32_SetCommDlgExtendedError(CDERR_GENERALCODES); 293 return FALSE; 294 } 295 295 296 296 if(pfr->lStructSize != sizeof(FINDREPLACEA)) 297 297 { 298 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE);299 return FALSE;298 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE); 299 return FALSE; 300 300 } 301 301 302 302 if(!IsWindow(pfr->hwndOwner)) 303 303 { 304 COMDLG32_SetCommDlgExtendedError(CDERR_DIALOGFAILURE);305 return FALSE;306 } 307 308 if((pfr->wFindWhatLen < 1 || !pfr->lpstrFindWhat)304 COMDLG32_SetCommDlgExtendedError(CDERR_DIALOGFAILURE); 305 return FALSE; 306 } 307 308 if((pfr->wFindWhatLen < 1 || !pfr->lpstrFindWhat) 309 309 ||(Replace && (pfr->wReplaceWithLen < 1 || !pfr->lpstrReplaceWith))) 310 310 { 311 COMDLG32_SetCommDlgExtendedError(FRERR_BUFFERLENGTHZERO);312 return FALSE; 313 } 314 315 if((FindReplaceMessage = RegisterWindowMessageA(FINDMSGSTRINGA)) == 0)316 { 317 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);318 return FALSE; 319 } 320 if((HelpMessage = RegisterWindowMessageA(HELPMSGSTRINGA)) == 0)321 { 322 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);311 COMDLG32_SetCommDlgExtendedError(FRERR_BUFFERLENGTHZERO); 312 return FALSE; 313 } 314 315 if((FindReplaceMessage = RegisterWindowMessageA(FINDMSGSTRINGA)) == 0) 316 { 317 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL); 318 return FALSE; 319 } 320 if((HelpMessage = RegisterWindowMessageA(HELPMSGSTRINGA)) == 0) 321 { 322 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL); 323 323 return FALSE; 324 324 } … … 326 326 if((pfr->Flags & FR_ENABLEHOOK) && !pfr->lpfnHook) 327 327 { 328 COMDLG32_SetCommDlgExtendedError(CDERR_NOHOOK);328 COMDLG32_SetCommDlgExtendedError(CDERR_NOHOOK); 329 329 return FALSE; 330 330 } … … 332 332 if((pfr->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE)) && !pfr->hInstance) 333 333 { 334 COMDLG32_SetCommDlgExtendedError(CDERR_NOHINSTANCE);334 COMDLG32_SetCommDlgExtendedError(CDERR_NOHINSTANCE); 335 335 return FALSE; 336 336 } … … 338 338 if((pfr->Flags & FR_ENABLETEMPLATE) && !pfr->lpTemplateName) 339 339 { 340 COMDLG32_SetCommDlgExtendedError(CDERR_NOTEMPLATE);341 return FALSE; 342 } 343 344 return TRUE;345 } 346 347 /*********************************************************************** 348 * COMDLG32_FR_DoFindReplace[internal]340 COMDLG32_SetCommDlgExtendedError(CDERR_NOTEMPLATE); 341 return FALSE; 342 } 343 344 return TRUE; 345 } 346 347 /*********************************************************************** 348 * COMDLG32_FR_DoFindReplace [internal] 349 349 * Actual load and creation of the Find/Replace dialog. 350 * RETURNS351 * Window handle to created dialog:Success352 * NULL:Failure350 * RETURNS 351 * Window handle to created dialog:Success 352 * NULL:Failure 353 353 */ 354 354 static HWND COMDLG32_FR_DoFindReplace( 355 COMDLG32_FR_Data *pdata/* [in] Internal data structure */355 COMDLG32_FR_Data *pdata /* [in] Internal data structure */ 356 356 ) { 357 HWND hdlgwnd = 0;357 HWND hdlgwnd = 0; 358 358 HGLOBAL loadrc; 359 359 DWORD error; 360 360 LPDLGTEMPLATEW rcs; 361 361 362 TRACE("hInst=%08x, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags);362 TRACE("hInst=%08x, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags); 363 363 364 364 if(!(pdata->fr.Flags & FR_ENABLETEMPLATEHANDLE)) 365 365 { 366 HMODULE hmod = COMDLG32_hInstance;367 HRSRC htemplate;368 if(pdata->fr.Flags & FR_ENABLETEMPLATE)369 {370 hmod = (HMODULE)pdata->fr.hInstance;366 HMODULE hmod = COMDLG32_hInstance; 367 HRSRC htemplate; 368 if(pdata->fr.Flags & FR_ENABLETEMPLATE) 369 { 370 hmod = (HMODULE)pdata->fr.hInstance; 371 371 if(pdata->fr.Flags & FR_WINE_UNICODE) 372 372 { 373 htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOGA);373 htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOGA); 374 374 } 375 375 else 376 376 { 377 htemplate = FindResourceA(hmod, pdata->fr.lpTemplateName, (LPCSTR)RT_DIALOGA);377 htemplate = FindResourceA(hmod, pdata->fr.lpTemplateName, (LPCSTR)RT_DIALOGA); 378 378 } 379 } 379 } 380 else 381 { 382 int rcid = pdata->fr.Flags & FR_WINE_REPLACE ? REPLACEDLGORD 383 : FINDDLGORD; 384 htemplate = FindResourceA(hmod, MAKEINTRESOURCEA(rcid), (LPCSTR)RT_DIALOGA); 385 } 386 if(!htemplate) 387 { 388 error = CDERR_FINDRESFAILURE; 389 goto cleanup; 390 } 391 392 loadrc = LoadResource(hmod, htemplate); 393 } 380 394 else 381 { 382 int rcid = pdata->fr.Flags & FR_WINE_REPLACE ? REPLACEDLGORD 383 : FINDDLGORD; 384 htemplate = FindResourceA(hmod, MAKEINTRESOURCEA(rcid), (LPCSTR)RT_DIALOGA); 385 } 386 if(!htemplate) 387 { 388 error = CDERR_FINDRESFAILURE; 389 goto cleanup; 390 } 391 392 loadrc = LoadResource(hmod, htemplate); 393 } 394 else 395 { 396 loadrc = (HGLOBAL)pdata->fr.hInstance; 395 { 396 loadrc = (HGLOBAL)pdata->fr.hInstance; 397 397 } 398 398 399 399 if(!loadrc) 400 400 { 401 error = CDERR_LOADRESFAILURE;402 goto cleanup;403 }401 error = CDERR_LOADRESFAILURE; 402 goto cleanup; 403 } 404 404 405 405 if((rcs = (LPDLGTEMPLATEW)LockResource(loadrc)) == NULL) 406 406 { 407 error = CDERR_LOCKRESFAILURE;408 goto cleanup;407 error = CDERR_LOCKRESFAILURE; 408 goto cleanup; 409 409 } 410 410 411 411 hdlgwnd = CreateDialogIndirectParamA(COMDLG32_hInstance, 412 rcs,412 rcs, 413 413 pdata->fr.hwndOwner, 414 414 (DLGPROC)COMDLG32_FindReplaceDlgProc, 415 415 (LPARAM)pdata); 416 if(!hdlgwnd)417 { 418 error = CDERR_DIALOGFAILURE;416 if(!hdlgwnd) 417 { 418 error = CDERR_DIALOGFAILURE; 419 419 cleanup: 420 COMDLG32_SetCommDlgExtendedError(error);420 COMDLG32_SetCommDlgExtendedError(error); 421 421 HeapFree(GetProcessHeap(), 0, pdata); 422 422 } … … 425 425 426 426 /*********************************************************************** 427 * FindTextA[COMDLG32.6]428 * RETURNS429 * Window handle to created dialog: Success430 * NULL: Failure427 * FindTextA [COMDLG32.6] 428 * RETURNS 429 * Window handle to created dialog: Success 430 * NULL: Failure 431 431 */ 432 432 HWND WINAPI FindTextA( 433 LPFINDREPLACEA pfr/* [in] Find/replace structure*/433 LPFINDREPLACEA pfr /* [in] Find/replace structure*/ 434 434 ) { 435 COMDLG32_FR_Data *pdata;435 COMDLG32_FR_Data *pdata; 436 436 437 437 TRACE("LPFINDREPLACE=%p\n", pfr); 438 438 439 if(!COMDLG32_FR_CheckPartial(pfr, FALSE))440 return 0;441 442 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)443 return 0; /* Error has been set */439 if(!COMDLG32_FR_CheckPartial(pfr, FALSE)) 440 return 0; 441 442 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL) 443 return 0; /* Error has been set */ 444 444 445 445 pdata->user_fr.fra = pfr; 446 446 pdata->fr = *pfr; 447 return COMDLG32_FR_DoFindReplace(pdata);448 } 449 450 /*********************************************************************** 451 * ReplaceTextA[COMDLG32.19]452 * RETURNS453 * Window handle to created dialog: Success454 * NULL: Failure447 return COMDLG32_FR_DoFindReplace(pdata); 448 } 449 450 /*********************************************************************** 451 * ReplaceTextA [COMDLG32.19] 452 * RETURNS 453 * Window handle to created dialog: Success 454 * NULL: Failure 455 455 */ 456 456 HWND WINAPI ReplaceTextA( 457 LPFINDREPLACEA pfr/* [in] Find/replace structure*/457 LPFINDREPLACEA pfr /* [in] Find/replace structure*/ 458 458 ) { 459 COMDLG32_FR_Data *pdata;459 COMDLG32_FR_Data *pdata; 460 460 461 461 TRACE("LPFINDREPLACE=%p\n", pfr); 462 462 463 if(!COMDLG32_FR_CheckPartial(pfr, TRUE))464 return 0;465 466 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)467 return 0; /* Error has been set */463 if(!COMDLG32_FR_CheckPartial(pfr, TRUE)) 464 return 0; 465 466 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL) 467 return 0; /* Error has been set */ 468 468 469 469 pdata->user_fr.fra = pfr; 470 470 pdata->fr = *pfr; 471 pdata->fr.Flags |= FR_WINE_REPLACE;472 return COMDLG32_FR_DoFindReplace(pdata);473 } 474 475 /*********************************************************************** 476 * FindTextW[COMDLG32.7]477 * RETURNS478 * Window handle to created dialog: Success479 * NULL: Failure471 pdata->fr.Flags |= FR_WINE_REPLACE; 472 return COMDLG32_FR_DoFindReplace(pdata); 473 } 474 475 /*********************************************************************** 476 * FindTextW [COMDLG32.7] 477 * RETURNS 478 * Window handle to created dialog: Success 479 * NULL: Failure 480 480 */ 481 481 HWND WINAPI FindTextW( 482 LPFINDREPLACEW pfr/* [in] Find/replace structure*/482 LPFINDREPLACEW pfr /* [in] Find/replace structure*/ 483 483 ) { 484 COMDLG32_FR_Data *pdata;484 COMDLG32_FR_Data *pdata; 485 485 DWORD len; 486 486 487 487 TRACE("LPFINDREPLACE=%p\n", pfr); 488 488 489 if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))490 return 0;489 if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE)) 490 return 0; 491 491 492 492 len = WideCharToMultiByte( CP_ACP, 0, pfr->lpstrFindWhat, pfr->wFindWhatLen, … … 496 496 497 497 pdata->user_fr.frw = pfr; 498 pdata->fr = *(LPFINDREPLACEA)pfr; /* FINDREPLACEx have same size */499 pdata->fr.Flags |= FR_WINE_UNICODE;498 pdata->fr = *(LPFINDREPLACEA)pfr; /* FINDREPLACEx have same size */ 499 pdata->fr.Flags |= FR_WINE_UNICODE; 500 500 pdata->fr.lpstrFindWhat = (LPSTR)(pdata + 1); /* Set string pointer */ 501 501 WideCharToMultiByte( CP_ACP, 0, pfr->lpstrFindWhat, pfr->wFindWhatLen, … … 505 505 506 506 /*********************************************************************** 507 * ReplaceTextW[COMDLG32.20]508 * RETURNS509 * Window handle to created dialog: Success510 * NULL: Failure507 * ReplaceTextW [COMDLG32.20] 508 * RETURNS 509 * Window handle to created dialog: Success 510 * NULL: Failure 511 511 */ 512 512 HWND WINAPI ReplaceTextW( 513 LPFINDREPLACEW pfr/* [in] Find/replace structure*/513 LPFINDREPLACEW pfr /* [in] Find/replace structure*/ 514 514 ) { 515 COMDLG32_FR_Data *pdata;515 COMDLG32_FR_Data *pdata; 516 516 DWORD len1, len2; 517 517 518 518 TRACE("LPFINDREPLACE=%p\n", pfr); 519 519 520 if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))521 return 0;520 if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE)) 521 return 0; 522 522 523 523 len1 = WideCharToMultiByte( CP_ACP, 0, pfr->lpstrFindWhat, pfr->wFindWhatLen, … … 525 525 len2 = WideCharToMultiByte( CP_ACP, 0, pfr->lpstrReplaceWith, pfr->wReplaceWithLen, 526 526 NULL, 0, NULL, NULL ); 527 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data)527 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data) 528 528 + len1 + len2)) == NULL) 529 529 return 0; /* Error has been set */ 530 530 531 531 pdata->user_fr.frw = pfr; 532 pdata->fr = *(LPFINDREPLACEA)pfr; /* FINDREPLACEx have same size */533 pdata->fr.Flags |= FR_WINE_REPLACE | FR_WINE_UNICODE;532 pdata->fr = *(LPFINDREPLACEA)pfr; /* FINDREPLACEx have same size */ 533 pdata->fr.Flags |= FR_WINE_REPLACE | FR_WINE_UNICODE; 534 534 pdata->fr.lpstrFindWhat = (LPSTR)(pdata + 1); /* Set string pointer */ 535 535 pdata->fr.lpstrReplaceWith = pdata->fr.lpstrFindWhat + len1; -
trunk/src/comdlg32/fontdlg.c
r6708 r6709 45 45 46 46 #ifdef __WIN32OS2__ 47 static HBITMAP hBitmapTT = 0; 47 static HBITMAP hBitmapTT = 0; 48 48 #else 49 static HBITMAP16 hBitmapTT = 0; 49 static HBITMAP16 hBitmapTT = 0; 50 50 #endif 51 51 52 52 LRESULT WINAPI FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, 53 LPARAM lParam);53 LPARAM lParam); 54 54 LRESULT WINAPI FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, 55 LPARAM lParam);55 LPARAM lParam); 56 56 57 57 #ifndef __WIN32OS2__ … … 79 79 80 80 /*********************************************************************** 81 * ChooseFont16 (COMMDLG.15) 81 * ChooseFont16 (COMMDLG.15) 82 82 */ 83 83 BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont) … … 92 92 LOGFONTA lf32a; 93 93 SEGPTR lpTemplateName; 94 94 95 95 cf32a.lpLogFont=&lf32a; 96 96 CFn_CHOOSEFONT16to32A(lpChFont, &cf32a); 97 97 98 98 TRACE("ChooseFont\n"); 99 if (!lpChFont) return FALSE; 99 if (!lpChFont) return FALSE; 100 100 101 101 if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE) … … 157 157 } 158 158 ConvertDialog32To16((LPVOID)template32, size, (LPVOID)template); 159 hDlgTmpl16 = hGlobal16; 159 hDlgTmpl16 = hGlobal16; 160 160 161 161 } … … 204 204 if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE | 205 205 CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n"); 206 return DialogBoxIndirectParamA(COMMDLG_hInstance32, template, 206 return DialogBoxIndirectParamA(COMMDLG_hInstance32, template, 207 207 lpChFont->hwndOwner, (DLGPROC)FormatCharDlgProcA, (LPARAM)lpChFont ); 208 208 } … … 239 239 cf32a.lpszStyle=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont->lpszStyle); 240 240 lpChFont->lpTemplateName=(LPWSTR)&cf32a; 241 bRet = DialogBoxIndirectParamW(COMMDLG_hInstance32, template, 241 bRet = DialogBoxIndirectParamW(COMMDLG_hInstance32, template, 242 242 lpChFont->hwndOwner, (DLGPROC)FormatCharDlgProcW, (LPARAM)lpChFont ); 243 243 HeapFree(GetProcessHeap(), 0, cf32a.lpszStyle); … … 288 288 * AddFontFamily [internal] 289 289 */ 290 static INT AddFontFamily(LPLOGFONTA lplf, UINT nFontType, 290 static INT AddFontFamily(LPLOGFONTA lplf, UINT nFontType, 291 291 LPCHOOSEFONTA lpcf, HWND hwnd) 292 292 { … … 304 304 if (lpcf->Flags & CF_TTONLY) 305 305 if (!(nFontType & TRUETYPE_FONTTYPE)) 306 return 1; 306 return 1; 307 307 308 308 i=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName); … … 327 327 * FontFamilyEnumProc32 [internal] 328 328 */ 329 static INT WINAPI FontFamilyEnumProc(LPENUMLOGFONTA lpEnumLogFont, 330 LPNEWTEXTMETRICA metrics, UINT nFontType, LPARAM lParam)329 static INT WINAPI FontFamilyEnumProc(LPENUMLOGFONTA lpEnumLogFont, 330 LPNEWTEXTMETRICA metrics, UINT nFontType, LPARAM lParam) 331 331 { 332 332 LPCFn_ENUMSTRUCT e; … … 344 344 HWND16 hwnd=LOWORD(lParam); 345 345 HWND hDlg=GetParent(hwnd); 346 LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); 346 LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); 347 347 LOGFONT16 *lplf = (LOGFONT16 *)PTR_SEG_TO_LIN( logfont ); 348 348 LOGFONTA lf32a; … … 362 362 #define FSTYLES 4 363 363 struct FONTSTYLE 364 { int italic; 364 { int italic; 365 365 int weight; 366 366 char stname[20]; }; 367 static struct FONTSTYLE fontstyles[FSTYLES]={ 367 static struct FONTSTYLE fontstyles[FSTYLES]={ 368 368 { 0,FW_NORMAL,"Regular"},{0,FW_BOLD,"Bold"}, 369 369 { 1,FW_NORMAL,"Italic"}, {1,FW_BOLD,"Bold Italic"}}; … … 389 389 j=SendMessageA(hwnd,CB_ADDSTRING,0,(LPARAM)str ); 390 390 if (j==CB_ERR) return 1; 391 j=SendMessageA(hwnd, CB_SETITEMDATA, j, 391 j=SendMessageA(hwnd, CB_SETITEMDATA, j, 392 392 MAKELONG(fontstyles[i].weight,fontstyles[i].italic)); 393 393 #else … … 396 396 SEGPTR_FREE(str); 397 397 if (j==CB_ERR) return 1; 398 j=SendMessage16(hwnd, CB_SETITEMDATA16, j, 398 j=SendMessage16(hwnd, CB_SETITEMDATA16, j, 399 399 MAKELONG(fontstyles[i].weight,fontstyles[i].italic)); 400 400 #endif 401 if (j==CB_ERR) return 1; 401 if (j==CB_ERR) return 1; 402 402 } 403 } 403 } 404 404 return 0; 405 405 } … … 417 417 { 418 418 sprintf(buffer, "%2d", h); 419 j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer);420 if (j==CB_ERR)421 {422 j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer);423 if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h);424 if (j==CB_ERR) return 1;425 }419 j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer); 420 if (j==CB_ERR) 421 { 422 j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer); 423 if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h); 424 if (j==CB_ERR) return 1; 425 } 426 426 } 427 427 return 0; 428 } 429 428 } 429 430 430 /************************************************************************* 431 431 * SetFontSizesToCombo3 [internal] … … 444 444 * AddFontStyle [internal] 445 445 */ 446 static INT AddFontStyle(LPLOGFONTA lplf, UINT nFontType, 446 static INT AddFontStyle(LPLOGFONTA lplf, UINT nFontType, 447 447 LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg) 448 448 { 449 449 int i; 450 450 451 451 TRACE("(nFontType=%d)\n",nFontType); 452 452 TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d" 453 " ch=%d op=%d cp=%d q=%d pf=%xh\n",454 lplf->lfFaceName,lplf->lfHeight,lplf->lfWidth,455 lplf->lfEscapement,lplf->lfOrientation,456 lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline,457 lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision,458 lplf->lfClipPrecision,lplf->lfQuality, lplf->lfPitchAndFamily);453 " ch=%d op=%d cp=%d q=%d pf=%xh\n", 454 lplf->lfFaceName,lplf->lfHeight,lplf->lfWidth, 455 lplf->lfEscapement,lplf->lfOrientation, 456 lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline, 457 lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision, 458 lplf->lfClipPrecision,lplf->lfQuality, lplf->lfPitchAndFamily); 459 459 if (nFontType & RASTER_FONTTYPE) 460 460 { … … 473 473 return 1 ; 474 474 475 } 475 } 476 476 477 477 #ifndef __WIN32OS2__ … … 485 485 HWND16 hcmb3=HIWORD(lParam); 486 486 HWND hDlg=GetParent(hcmb3); 487 LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); 487 LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); 488 488 LOGFONT16 *lplf = (LOGFONT16 *)PTR_SEG_TO_LIN(logfont); 489 489 LOGFONTA lf32a; … … 497 497 * FontStyleEnumProc32 [internal] 498 498 */ 499 static INT WINAPI FontStyleEnumProc( LPENUMLOGFONTA lpFont, 499 static INT WINAPI FontStyleEnumProc( LPENUMLOGFONTA lpFont, 500 500 LPNEWTEXTMETRICA metrics, UINT nFontType, LPARAM lParam ) 501 501 { … … 520 520 HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA)); 521 521 522 SetWindowLongA(hDlg, DWL_USER, lParam); 522 SetWindowLongA(hDlg, DWL_USER, lParam); 523 523 lpxx=lpcf->lpLogFont; 524 524 TRACE("WM_INITDIALOG lParam=%08lX\n", lParam); … … 527 527 { 528 528 ERR("structure size failure !!!\n"); 529 EndDialog (hDlg, 0); 529 EndDialog (hDlg, 0); 530 530 return FALSE; 531 531 } … … 536 536 SendDlgItemMessageA(hDlg,stc6,WM_SETFONT, 537 537 CreateFontA(0, 0, 1, 1, 400, 0, 0, 0, 0, 0, 0, 0, 0, NULL),FALSE); 538 538 539 539 if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner)) 540 540 ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE); … … 582 582 { 583 583 SendDlgItemMessageA(hDlg, cmb1, CB_SETCURSEL, j, 0); 584 SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),584 SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), 585 585 GetDlgItem(hDlg,cmb1)); 586 586 init=1; … … 592 592 SendDlgItemMessageA(hDlg, cmb2, CB_SETCURSEL, i, 0); 593 593 } 594 594 595 595 /* look for fitting font size in combobox3 */ 596 596 j=SendDlgItemMessageA(hDlg, cmb3, CB_GETCOUNT, 0, 0); … … 607 607 SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), 608 608 GetDlgItem(hDlg,cmb1)); 609 } 609 } 610 610 if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle) 611 611 { … … 622 622 { 623 623 WARN("HDC failure !!!\n"); 624 EndDialog (hDlg, 0); 624 EndDialog (hDlg, 0); 625 625 return FALSE; 626 626 } … … 628 628 if (!(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC)) 629 629 ReleaseDC(hDlg,hdc); 630 SetCursor(hcursor); 630 SetCursor(hcursor); 631 631 return TRUE; 632 632 } … … 659 659 COLORREF cr, oldText=0, oldBk=0; 660 660 RECT rect; 661 #if 0 661 #if 0 662 662 HDC hMemDC; 663 663 int nFontType; 664 664 HBITMAP hBitmap; /* for later TT usage */ 665 #endif 665 #endif 666 666 LPDRAWITEMSTRUCT lpdi = (LPDRAWITEMSTRUCT)lParam; 667 667 668 if (lpdi->itemID == 0xFFFF) /* got no items */668 if (lpdi->itemID == 0xFFFF) /* got no items */ 669 669 DrawFocusRect(lpdi->hDC, &lpdi->rcItem); 670 670 else … … 685 685 } 686 686 else 687 return TRUE; /* this should never happen */687 return TRUE; /* this should never happen */ 688 688 689 689 rect=lpdi->rcItem; 690 690 switch (lpdi->CtlID) 691 691 { 692 case cmb1: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */693 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,694 (LPARAM)buffer); 695 GetObjectA( hBitmapTT, sizeof(bm), &bm );696 TextOutA(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10,692 case cmb1: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */ 693 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, 694 (LPARAM)buffer); 695 GetObjectA( hBitmapTT, sizeof(bm), &bm ); 696 TextOutA(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10, 697 697 lpdi->rcItem.top, buffer, strlen(buffer)); 698 698 #if 0 699 nFontType = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);700 /* FIXME: draw bitmap if truetype usage */701 if (nFontType&TRUETYPE_FONTTYPE)702 {703 hMemDC = CreateCompatibleDC(lpdi->hDC);704 hBitmap = SelectObject(hMemDC, hBitmapTT);705 BitBlt(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top,699 nFontType = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); 700 /* FIXME: draw bitmap if truetype usage */ 701 if (nFontType&TRUETYPE_FONTTYPE) 702 { 703 hMemDC = CreateCompatibleDC(lpdi->hDC); 704 hBitmap = SelectObject(hMemDC, hBitmapTT); 705 BitBlt(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, 706 706 bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); 707 SelectObject(hMemDC, hBitmap);708 DeleteDC(hMemDC);709 }707 SelectObject(hMemDC, hBitmap); 708 DeleteDC(hMemDC); 709 } 710 710 #endif 711 break;711 break; 712 712 case cmb2: 713 case cmb3: /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */714 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,715 (LPARAM)buffer);716 TextOutA(lpdi->hDC, lpdi->rcItem.left,713 case cmb3: /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */ 714 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, 715 (LPARAM)buffer); 716 TextOutA(lpdi->hDC, lpdi->rcItem.left, 717 717 lpdi->rcItem.top, buffer, strlen(buffer)); 718 break;719 720 case cmb4: /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */721 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,722 (LPARAM)buffer);723 TextOutA(lpdi->hDC, lpdi->rcItem.left + 25+5,718 break; 719 720 case cmb4: /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */ 721 SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, 722 (LPARAM)buffer); 723 TextOutA(lpdi->hDC, lpdi->rcItem.left + 25+5, 724 724 lpdi->rcItem.top, buffer, strlen(buffer)); 725 cr = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L);726 hBrush = CreateSolidBrush(cr);727 if (hBrush)728 {729 hBrush = SelectObject (lpdi->hDC, hBrush) ;730 rect.right=rect.left+25;731 rect.top++;732 rect.left+=5;733 rect.bottom--;734 Rectangle( lpdi->hDC, rect.left, rect.top,725 cr = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); 726 hBrush = CreateSolidBrush(cr); 727 if (hBrush) 728 { 729 hBrush = SelectObject (lpdi->hDC, hBrush) ; 730 rect.right=rect.left+25; 731 rect.top++; 732 rect.left+=5; 733 rect.bottom--; 734 Rectangle( lpdi->hDC, rect.left, rect.top, 735 735 rect.right, rect.bottom ); 736 DeleteObject( SelectObject (lpdi->hDC, hBrush)) ;737 }738 rect=lpdi->rcItem;739 rect.left+=25+5;740 break;741 742 default: return TRUE;/* this should never happen */736 DeleteObject( SelectObject (lpdi->hDC, hBrush)) ; 737 } 738 rect=lpdi->rcItem; 739 rect.left+=25+5; 740 break; 741 742 default: return TRUE; /* this should never happen */ 743 743 } 744 744 if (lpdi->itemState == ODS_SELECTED) … … 777 777 HDC hdc; 778 778 LPLOGFONTA lpxx=lpcf->lpLogFont; 779 779 780 780 TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG)wParam, lParam); 781 781 switch (LOWORD(wParam)) 782 782 { 783 case cmb1:if (HIWORD(wParam)==CBN_SELCHANGE)784 {785 hdc=(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);786 if (hdc)787 {783 case cmb1:if (HIWORD(wParam)==CBN_SELCHANGE) 784 { 785 hdc=(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg); 786 if (hdc) 787 { 788 788 #ifdef __WIN32OS2__ 789 SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT, 0, 0); 790 SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT, 0, 0);791 i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL, 0, 0);789 SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT, 0, 0); 790 SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT, 0, 0); 791 i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL, 0, 0); 792 792 #else 793 SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT16, 0, 0); 794 SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT16, 0, 0);795 i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL16, 0, 0);793 SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT16, 0, 0); 794 SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT16, 0, 0); 795 i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL16, 0, 0); 796 796 #endif 797 if (i!=CB_ERR)798 {799 HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA));800 CFn_ENUMSTRUCT s;797 if (i!=CB_ERR) 798 { 799 HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA)); 800 CFn_ENUMSTRUCT s; 801 801 char str[256]; 802 802 SendDlgItemMessageA(hDlg, cmb1, CB_GETLBTEXT, i, 803 803 (LPARAM)str); 804 TRACE("WM_COMMAND/cmb1 =>%s\n",str);805 s.hWnd1=GetDlgItem(hDlg, cmb2);806 s.hWnd2=GetDlgItem(hDlg, cmb3);807 s.lpcf32a=lpcf;808 EnumFontFamiliesA(hdc, str, FontStyleEnumProc, (LPARAM)&s);809 SetCursor(hcursor);810 }811 if (!(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC))812 ReleaseDC(hDlg,hdc);813 }814 else804 TRACE("WM_COMMAND/cmb1 =>%s\n",str); 805 s.hWnd1=GetDlgItem(hDlg, cmb2); 806 s.hWnd2=GetDlgItem(hDlg, cmb3); 807 s.lpcf32a=lpcf; 808 EnumFontFamiliesA(hdc, str, FontStyleEnumProc, (LPARAM)&s); 809 SetCursor(hcursor); 810 } 811 if (!(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC)) 812 ReleaseDC(hDlg,hdc); 813 } 814 else 815 815 { 816 816 WARN("HDC failure !!!\n"); 817 EndDialog (hDlg, 0); 817 EndDialog (hDlg, 0); 818 818 return TRUE; 819 819 } 820 }821 case chx1:822 case chx2:823 case cmb2:824 case cmb3:if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED )825 {820 } 821 case chx1: 822 case chx2: 823 case cmb2: 824 case cmb3:if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED ) 825 { 826 826 char str[256]; 827 827 TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam); 828 i=SendDlgItemMessageA(hDlg,cmb1,CB_GETCURSEL,0,0);829 if (i==CB_ERR)828 i=SendDlgItemMessageA(hDlg,cmb1,CB_GETCURSEL,0,0); 829 if (i==CB_ERR) 830 830 i=GetDlgItemTextA( hDlg, cmb1, str, 256 ); 831 831 else 832 832 { 833 SendDlgItemMessageA(hDlg,cmb1,CB_GETLBTEXT,i,834 (LPARAM)str);835 l=SendDlgItemMessageA(hDlg,cmb1,CB_GETITEMDATA,i,0);836 j=HIWORD(l);837 lpcf->nFontType = LOWORD(l);838 /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */839 /* same value reported to the EnumFonts840 call back with the extra FONTTYPE_... bits added */841 lpxx->lfPitchAndFamily=j&0xff;842 lpxx->lfCharSet=j>>8;833 SendDlgItemMessageA(hDlg,cmb1,CB_GETLBTEXT,i, 834 (LPARAM)str); 835 l=SendDlgItemMessageA(hDlg,cmb1,CB_GETITEMDATA,i,0); 836 j=HIWORD(l); 837 lpcf->nFontType = LOWORD(l); 838 /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */ 839 /* same value reported to the EnumFonts 840 call back with the extra FONTTYPE_... bits added */ 841 lpxx->lfPitchAndFamily=j&0xff; 842 lpxx->lfCharSet=j>>8; 843 843 } 844 844 strcpy(lpxx->lfFaceName,str); 845 i=SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0);846 if (i!=CB_ERR)847 {848 l=SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0);849 if (0!=(lpxx->lfItalic=HIWORD(l)))850 lpcf->nFontType |= ITALIC_FONTTYPE;851 if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM)852 lpcf->nFontType |= BOLD_FONTTYPE;853 }854 i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0);855 if (i!=CB_ERR)856 lpxx->lfHeight=-LOWORD(SendDlgItemMessageA(hDlg, cmb3, CB_GETITEMDATA, i, 0));857 else858 lpxx->lfHeight=0;859 lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1);860 lpxx->lfUnderline=IsDlgButtonChecked(hDlg,chx2);861 lpxx->lfWidth=lpxx->lfOrientation=lpxx->lfEscapement=0;862 lpxx->lfOutPrecision=OUT_DEFAULT_PRECIS;863 lpxx->lfClipPrecision=CLIP_DEFAULT_PRECIS;864 lpxx->lfQuality=DEFAULT_QUALITY;845 i=SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0); 846 if (i!=CB_ERR) 847 { 848 l=SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0); 849 if (0!=(lpxx->lfItalic=HIWORD(l))) 850 lpcf->nFontType |= ITALIC_FONTTYPE; 851 if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM) 852 lpcf->nFontType |= BOLD_FONTTYPE; 853 } 854 i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0); 855 if (i!=CB_ERR) 856 lpxx->lfHeight=-LOWORD(SendDlgItemMessageA(hDlg, cmb3, CB_GETITEMDATA, i, 0)); 857 else 858 lpxx->lfHeight=0; 859 lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1); 860 lpxx->lfUnderline=IsDlgButtonChecked(hDlg,chx2); 861 lpxx->lfWidth=lpxx->lfOrientation=lpxx->lfEscapement=0; 862 lpxx->lfOutPrecision=OUT_DEFAULT_PRECIS; 863 lpxx->lfClipPrecision=CLIP_DEFAULT_PRECIS; 864 lpxx->lfQuality=DEFAULT_QUALITY; 865 865 lpcf->iPointSize= -10*lpxx->lfHeight; 866 866 867 hFont=CreateFontIndirectA(lpxx);868 if (hFont)869 {870 HFONT oldFont=SendDlgItemMessageA(hDlg, stc6, 871 WM_GETFONT, 0, 0);872 SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,hFont,TRUE);873 DeleteObject(oldFont);874 }867 hFont=CreateFontIndirectA(lpxx); 868 if (hFont) 869 { 870 HFONT oldFont=SendDlgItemMessageA(hDlg, stc6, 871 WM_GETFONT, 0, 0); 872 SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,hFont,TRUE); 873 DeleteObject(oldFont); 874 } 875 875 } 876 876 break; 877 877 878 case cmb4:i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0);879 if (i!=CB_ERR)880 {881 lpcf->rgbColors=textcolors[i];882 InvalidateRect( GetDlgItem(hDlg,stc6), NULL, 0 );883 }884 break;885 886 case psh15:i=RegisterWindowMessageA( HELPMSGSTRINGA );887 if (lpcf->hwndOwner)888 SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetWindowLongA(hDlg, DWL_USER));889 /* if (CFn_HookCallChk(lpcf))890 CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/891 break;892 893 case IDOK:if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||894 ( (lpcf->Flags & CF_LIMITSIZE) && 895 (-lpxx->lfHeight >= lpcf->nSizeMin) && 878 case cmb4:i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0); 879 if (i!=CB_ERR) 880 { 881 lpcf->rgbColors=textcolors[i]; 882 InvalidateRect( GetDlgItem(hDlg,stc6), NULL, 0 ); 883 } 884 break; 885 886 case psh15:i=RegisterWindowMessageA( HELPMSGSTRINGA ); 887 if (lpcf->hwndOwner) 888 SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetWindowLongA(hDlg, DWL_USER)); 889 /* if (CFn_HookCallChk(lpcf)) 890 CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/ 891 break; 892 893 case IDOK:if ( (!(lpcf->Flags & CF_LIMITSIZE)) || 894 ( (lpcf->Flags & CF_LIMITSIZE) && 895 (-lpxx->lfHeight >= lpcf->nSizeMin) && 896 896 (-lpxx->lfHeight <= lpcf->nSizeMax))) 897 EndDialog(hDlg, TRUE);898 else899 {897 EndDialog(hDlg, TRUE); 898 else 899 { 900 900 char buffer[80]; 901 sprintf(buffer,"Select a font size between %d and %d points.",901 sprintf(buffer,"Select a font size between %d and %d points.", 902 902 lpcf->nSizeMin,lpcf->nSizeMax); 903 MessageBoxA(hDlg, buffer, NULL, MB_OK);904 } 905 return(TRUE);906 case IDCANCEL:EndDialog(hDlg, FALSE);907 return(TRUE);908 }903 MessageBoxA(hDlg, buffer, NULL, MB_OK); 904 } 905 return(TRUE); 906 case IDCANCEL:EndDialog(hDlg, FALSE); 907 return(TRUE); 908 } 909 909 return(FALSE); 910 910 } … … 930 930 UINT uMsg32; 931 931 WPARAM wParam32; 932 LRESULT res=0; 932 LRESULT res=0; 933 933 if (message!=WM_INITDIALOG) 934 934 { 935 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); 935 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); 936 936 if (!lpcf) 937 937 return FALSE; … … 945 945 lpcf=(LPCHOOSEFONT16)lParam; 946 946 lpcf32a=(LPCHOOSEFONTA)lpcf->lpTemplateName; 947 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a)) 947 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a)) 948 948 { 949 949 TRACE("CFn_WMInitDialog returned FALSE\n"); 950 950 return FALSE; 951 } 951 } 952 952 if (CFn_HookCallChk(lpcf)) 953 953 return CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); … … 959 959 case WM_MEASUREITEM: 960 960 res=CFn_WMMeasureItem(hDlg, wParam32, lParam); 961 break;961 break; 962 962 case WM_DRAWITEM: 963 963 res=CFn_WMDrawItem(hDlg, wParam32, lParam); 964 break;964 break; 965 965 case WM_CTLCOLORSTATIC: 966 966 res=CFn_WMCtlColorStatic(hDlg, wParam32, lParam, lpcf32a); 967 break;967 break; 968 968 case WM_COMMAND: 969 969 res=CFn_WMCommand(hDlg, wParam32, lParam, lpcf32a); 970 break;970 break; 971 971 case WM_DESTROY: 972 972 res=CFn_WMDestroy(hDlg, wParam32, lParam); 973 break;974 case WM_CHOOSEFONT_GETLOGFONT: 973 break; 974 case WM_CHOOSEFONT_GETLOGFONT: 975 975 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", 976 lParam);977 FIXME("current logfont back to caller\n");976 lParam); 977 FIXME("current logfont back to caller\n"); 978 978 break; 979 979 } 980 WINPROC_UnmapMsg16To32A(hDlg,uMsg32, wParam32, lParam, res); 980 WINPROC_UnmapMsg16To32A(hDlg,uMsg32, wParam32, lParam, res); 981 981 return res; 982 982 } … … 993 993 if (uMsg!=WM_INITDIALOG) 994 994 { 995 lpcf=(LPCHOOSEFONTA)GetWindowLongA(hDlg, DWL_USER); 995 lpcf=(LPCHOOSEFONTA)GetWindowLongA(hDlg, DWL_USER); 996 996 if (!lpcf) 997 997 return FALSE; … … 1004 1004 { 1005 1005 lpcf=(LPCHOOSEFONTA)lParam; 1006 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf)) 1006 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf)) 1007 1007 { 1008 1008 TRACE("CFn_WMInitDialog returned FALSE\n"); 1009 1009 return FALSE; 1010 } 1010 } 1011 1011 if (CFn_HookCallChk32(lpcf)) 1012 1012 return CallWindowProcA((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); … … 1026 1026 case WM_CHOOSEFONT_GETLOGFONT: 1027 1027 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", 1028 lParam);1029 FIXME("current logfont back to caller\n");1028 lParam); 1029 FIXME("current logfont back to caller\n"); 1030 1030 break; 1031 1031 } … … 1044 1044 if (uMsg!=WM_INITDIALOG) 1045 1045 { 1046 lpcf32w=(LPCHOOSEFONTW)GetWindowLongA(hDlg, DWL_USER); 1046 lpcf32w=(LPCHOOSEFONTW)GetWindowLongA(hDlg, DWL_USER); 1047 1047 if (!lpcf32w) 1048 1048 return FALSE; … … 1056 1056 lpcf32w=(LPCHOOSEFONTW)lParam; 1057 1057 lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName; 1058 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a)) 1058 if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a)) 1059 1059 { 1060 1060 TRACE("CFn_WMInitDialog returned FALSE\n"); 1061 1061 return FALSE; 1062 } 1062 } 1063 1063 if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w)) 1064 1064 return CallWindowProcW((WNDPROC)lpcf32w->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); … … 1077 1077 case WM_DESTROY: 1078 1078 return CFn_WMDestroy(hDlg, wParam, lParam); 1079 case WM_CHOOSEFONT_GETLOGFONT: 1079 case WM_CHOOSEFONT_GETLOGFONT: 1080 1080 TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", 1081 lParam);1082 FIXME("current logfont back to caller\n");1081 lParam); 1082 FIXME("current logfont back to caller\n"); 1083 1083 break; 1084 1084 } -
trunk/src/comdlg32/printdlg.c
r6708 r6709 30 30 /* This PRINTDLGA internal structure stores 31 31 * pointers to several throughout useful structures. 32 * 33 */ 34 typedef struct 32 * 33 */ 34 typedef struct 35 35 { 36 36 LPDEVMODEA lpDevMode; 37 37 struct { 38 38 LPPRINTDLGA lpPrintDlg; 39 LPPRINTDLG16 lpPrintDlg16;39 LPPRINTDLG16 lpPrintDlg16; 40 40 } dlg; 41 41 LPPRINTER_INFO_2A lpPrinterInfo; … … 108 108 * 109 109 * Returns the default printer name in buf. 110 * Even under WinNT/2000 default printer is retrieved via GetProfileString - 110 * Even under WinNT/2000 default printer is retrieved via GetProfileString - 111 111 * these entries are mapped somewhere in the registry rather than win.ini. 112 112 * … … 118 118 119 119 if(!GetProfileStringA("windows", "device", "", buf, len)) { 120 TRACE("No profile entry for default printer found.\n");121 return FALSE;120 TRACE("No profile entry for default printer found.\n"); 121 return FALSE; 122 122 } 123 123 if((ptr = strchr(buf, ',')) == NULL) { 124 FIXME("bad format for default printer (%s)!\n",buf);125 return FALSE;124 FIXME("bad format for default printer (%s)!\n",buf); 125 return FALSE; 126 126 } 127 127 *ptr = '\0'; … … 145 145 res = OpenPrinterA(buf, hprn, NULL); 146 146 if (!res) 147 FIXME("Could not open printer %s?!\n",buf);147 FIXME("Could not open printer %s?!\n",buf); 148 148 return res; 149 149 } … … 169 169 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num); 170 170 pi = HeapAlloc(GetProcessHeap(), 0, needed); 171 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pi, needed, &needed, 172 &num);171 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pi, needed, &needed, 172 &num); 173 173 174 174 for(i = 0; i < num; i++) { 175 175 SendDlgItemMessageA(hDlg, id, CB_ADDSTRING, 0, 176 (LPARAM)pi[i].pPrinterName );176 (LPARAM)pi[i].pPrinterName ); 177 177 } 178 178 HeapFree(GetProcessHeap(), 0, pi); 179 179 if(!name || 180 180 (i = SendDlgItemMessageA(hDlg, id, CB_FINDSTRINGEXACT, -1, 181 (LPARAM)name)) == CB_ERR) {181 (LPARAM)name)) == CB_ERR) { 182 182 183 183 char buf[260]; 184 184 FIXME("Can't find '%s' in printer list so trying to find default\n", 185 name);186 if(!PRINTDLG_GetDefaultPrinterName(buf, sizeof(buf)))187 return num;188 i = SendDlgItemMessageA(hDlg, id, CB_FINDSTRINGEXACT, -1, (LPARAM)buf);189 if(i == CB_ERR)190 FIXME("Can't find default printer in printer list\n");185 name); 186 if(!PRINTDLG_GetDefaultPrinterName(buf, sizeof(buf))) 187 return num; 188 i = SendDlgItemMessageA(hDlg, id, CB_FINDSTRINGEXACT, -1, (LPARAM)buf); 189 if(i == CB_ERR) 190 FIXME("Can't find default printer in printer list\n"); 191 191 } 192 192 SendDlgItemMessageA(hDlg, id, CB_SETCURSEL, i, 0); … … 202 202 * (NB. when we handle unicode the offsets will be in wchars). 203 203 */ 204 static BOOL PRINTDLG_CreateDevNames(HGLOBAL *hmem, char* DeviceDriverName, 205 char* DeviceName, char* OutputPort)204 static BOOL PRINTDLG_CreateDevNames(HGLOBAL *hmem, char* DeviceDriverName, 205 char* DeviceName, char* OutputPort) 206 206 { 207 207 long size; … … 215 215 + strlen(OutputPort) + 1 216 216 + sizeof(DEVNAMES); 217 217 218 218 if(*hmem) 219 219 *hmem = GlobalReAlloc(*hmem, size, GMEM_MOVEABLE); … … 233 233 strcpy(pTempPtr, DeviceName); 234 234 lpDevNames->wDeviceOffset = pTempPtr - pDevNamesSpace; 235 235 236 236 pTempPtr += strlen(DeviceName) + 1; 237 237 strcpy(pTempPtr, OutputPort); … … 244 244 } 245 245 #ifndef __WIN32OS2__ 246 static BOOL PRINTDLG_CreateDevNames16(HGLOBAL16 *hmem, char* DeviceDriverName, 247 char* DeviceName, char* OutputPort)246 static BOOL PRINTDLG_CreateDevNames16(HGLOBAL16 *hmem, char* DeviceDriverName, 247 char* DeviceName, char* OutputPort) 248 248 { 249 249 long size; … … 257 257 + strlen(OutputPort) + 1 258 258 + sizeof(DEVNAMES); 259 259 260 260 if(*hmem) 261 261 *hmem = GlobalReAlloc16(*hmem, size, GMEM_MOVEABLE); … … 275 275 strcpy(pTempPtr, DeviceName); 276 276 lpDevNames->wDeviceOffset = pTempPtr - pDevNamesSpace; 277 277 278 278 pTempPtr += strlen(DeviceName) + 1; 279 279 strcpy(pTempPtr, OutputPort); … … 292 292 * 293 293 * updates the PrintDlg structure for returnvalues. 294 * 294 * 295 295 * RETURNS 296 296 * FALSE if user is not allowed to close (i.e. wrong nTo or nFrom values) 297 297 * TRUE if succesful. 298 298 */ 299 static BOOL PRINTDLG_UpdatePrintDlg(HWND hDlg, 300 PRINT_PTRA* PrintStructures)299 static BOOL PRINTDLG_UpdatePrintDlg(HWND hDlg, 300 PRINT_PTRA* PrintStructures) 301 301 { 302 302 LPPRINTDLGA lppd = PrintStructures->dlg.lpPrintDlg; … … 306 306 307 307 if(!lpdm) { 308 FIXME("No lpdm ptr?\n");309 return FALSE;308 FIXME("No lpdm ptr?\n"); 309 return FALSE; 310 310 } 311 311 … … 313 313 if(!(lppd->Flags & PD_PRINTSETUP)) { 314 314 /* check whether nFromPage and nToPage are within range defined by 315 * nMinPage and nMaxPage316 */315 * nMinPage and nMaxPage 316 */ 317 317 if (IsDlgButtonChecked(hDlg, rad3) == BST_CHECKED) { /* Pages */ 318 WORD nToPage;319 WORD nFromPage;320 nFromPage = GetDlgItemInt(hDlg, edt1, NULL, FALSE);321 nToPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE);322 if (nFromPage < lppd->nMinPage || nFromPage > lppd->nMaxPage ||323 nToPage < lppd->nMinPage || nToPage > lppd->nMaxPage) {324 char resourcestr[256];325 char resultstr[256];326 LoadStringA(COMDLG32_hInstance, PD32_INVALID_PAGE_RANGE, 327 resourcestr, 255);328 sprintf(resultstr,resourcestr, lppd->nMinPage, lppd->nMaxPage);329 LoadStringA(COMDLG32_hInstance, PD32_PRINT_TITLE, 330 resourcestr, 255);331 MessageBoxA(hDlg, resultstr, resourcestr,332 MB_OK | MB_ICONWARNING);333 return FALSE;334 }335 lppd->nFromPage = nFromPage;336 lppd->nToPage = nToPage;337 }338 339 if (IsDlgButtonChecked(hDlg, chx1) == BST_CHECKED) {/* Print to file */340 lppd->Flags |= PD_PRINTTOFILE;341 pi->pPortName = "FILE:";342 }343 344 if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED) { /* Collate */345 FIXME("Collate lppd not yet implemented as output\n");346 }347 348 /* set PD_Collate and nCopies */349 if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {350 /* The application doesn't support multiple copies or collate...351 */352 lppd->Flags &= ~PD_COLLATE;353 lppd->nCopies = 1;354 /* if the printer driver supports it... store info there355 * otherwise no collate & multiple copies !356 */357 if (lpdm->dmFields & DM_COLLATE)358 lpdm->dmCollate = 359 (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED);360 if (lpdm->dmFields & DM_COPIES)361 lpdm->dmCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);362 } else {363 if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED)364 lppd->Flags |= PD_COLLATE;318 WORD nToPage; 319 WORD nFromPage; 320 nFromPage = GetDlgItemInt(hDlg, edt1, NULL, FALSE); 321 nToPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE); 322 if (nFromPage < lppd->nMinPage || nFromPage > lppd->nMaxPage || 323 nToPage < lppd->nMinPage || nToPage > lppd->nMaxPage) { 324 char resourcestr[256]; 325 char resultstr[256]; 326 LoadStringA(COMDLG32_hInstance, PD32_INVALID_PAGE_RANGE, 327 resourcestr, 255); 328 sprintf(resultstr,resourcestr, lppd->nMinPage, lppd->nMaxPage); 329 LoadStringA(COMDLG32_hInstance, PD32_PRINT_TITLE, 330 resourcestr, 255); 331 MessageBoxA(hDlg, resultstr, resourcestr, 332 MB_OK | MB_ICONWARNING); 333 return FALSE; 334 } 335 lppd->nFromPage = nFromPage; 336 lppd->nToPage = nToPage; 337 } 338 339 if (IsDlgButtonChecked(hDlg, chx1) == BST_CHECKED) {/* Print to file */ 340 lppd->Flags |= PD_PRINTTOFILE; 341 pi->pPortName = "FILE:"; 342 } 343 344 if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED) { /* Collate */ 345 FIXME("Collate lppd not yet implemented as output\n"); 346 } 347 348 /* set PD_Collate and nCopies */ 349 if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) { 350 /* The application doesn't support multiple copies or collate... 351 */ 352 lppd->Flags &= ~PD_COLLATE; 353 lppd->nCopies = 1; 354 /* if the printer driver supports it... store info there 355 * otherwise no collate & multiple copies ! 356 */ 357 if (lpdm->dmFields & DM_COLLATE) 358 lpdm->dmCollate = 359 (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED); 360 if (lpdm->dmFields & DM_COPIES) 361 lpdm->dmCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE); 362 } else { 363 if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED) 364 lppd->Flags |= PD_COLLATE; 365 365 else 366 366 lppd->Flags &= ~PD_COLLATE; 367 367 lppd->nCopies = GetDlgItemInt(hDlg, edt3, NULL, FALSE); 368 }368 } 369 369 } 370 370 return TRUE; … … 372 372 373 373 static BOOL PRINTDLG_PaperSize( 374 PRINTDLGA*pdlga,const char *PaperSize,LPPOINT size374 PRINTDLGA *pdlga,const char *PaperSize,LPPOINT size 375 375 ) { 376 DEVNAMES *dn;377 DEVMODEA *dm;378 LPSTR devname,portname;379 int i;380 DWORD NrOfEntries,ret;381 char *Names = NULL;382 POINT *points = NULL;383 BOOL retval = FALSE;384 376 DEVNAMES *dn; 377 DEVMODEA *dm; 378 LPSTR devname,portname; 379 int i; 380 DWORD NrOfEntries,ret; 381 char *Names = NULL; 382 POINT *points = NULL; 383 BOOL retval = FALSE; 384 385 385 dn = GlobalLock(pdlga->hDevNames); 386 386 dm = GlobalLock(pdlga->hDevMode); 387 devname = ((char*)dn)+dn->wDeviceOffset;388 portname = ((char*)dn)+dn->wOutputOffset;387 devname = ((char*)dn)+dn->wDeviceOffset; 388 portname = ((char*)dn)+dn->wOutputOffset; 389 389 390 390 391 391 NrOfEntries = DeviceCapabilitiesA(devname,portname,DC_PAPERNAMES,NULL,dm); 392 392 if (!NrOfEntries) { 393 FIXME("No papernames found for %s/%s\n",devname,portname);394 goto out;393 FIXME("No papernames found for %s/%s\n",devname,portname); 394 goto out; 395 395 } 396 396 Names = (char*)HeapAlloc(GetProcessHeap(),0,NrOfEntries*64); 397 397 if (NrOfEntries != (ret=DeviceCapabilitiesA(devname,portname,DC_PAPERNAMES,Names,dm))) { 398 FIXME("Number of returned vals %ld is not %ld\n",NrOfEntries,ret);399 goto out;398 FIXME("Number of returned vals %ld is not %ld\n",NrOfEntries,ret); 399 goto out; 400 400 } 401 401 for (i=0;i<NrOfEntries;i++) 402 if (!strcmp(PaperSize,Names+(64*i)))403 break;402 if (!strcmp(PaperSize,Names+(64*i))) 403 break; 404 404 HeapFree(GetProcessHeap(),0,Names); 405 405 if (i==NrOfEntries) { 406 FIXME("Papersize %s not found in list?\n",PaperSize);407 goto out;406 FIXME("Papersize %s not found in list?\n",PaperSize); 407 goto out; 408 408 } 409 409 points = HeapAlloc(GetProcessHeap(),0,sizeof(points[0])*NrOfEntries); 410 410 if (NrOfEntries!=(ret=DeviceCapabilitiesA(devname,portname,DC_PAPERSIZE,(LPBYTE)points,dm))) { 411 FIXME("Number of returned sizes %ld is not %ld?\n",NrOfEntries,ret);412 goto out;411 FIXME("Number of returned sizes %ld is not %ld?\n",NrOfEntries,ret); 412 goto out; 413 413 } 414 414 /* this is _10ths_ of a millimeter */ … … 434 434 */ 435 435 static BOOL PRINTDLG_SetUpPaperComboBox(HWND hDlg, 436 int nIDComboBox,437 char* PrinterName, 438 char* PortName,439 LPDEVMODEA dm)436 int nIDComboBox, 437 char* PrinterName, 438 char* PortName, 439 LPDEVMODEA dm) 440 440 { 441 441 int i; … … 448 448 int fwCapability_Names; 449 449 int fwCapability_Words; 450 450 451 451 TRACE(" Printer: %s, ComboID: %d\n",PrinterName,nIDComboBox); 452 452 453 453 /* query the dialog box for the current selected value */ 454 454 Sel = SendDlgItemMessageA(hDlg, nIDComboBox, CB_GETCURSEL, 0, 0); … … 498 498 fwCapability_Words = DC_BINS; 499 499 } 500 501 /* for some printer drivers, DeviceCapabilities calls a VXD to obtain the 500 501 /* for some printer drivers, DeviceCapabilities calls a VXD to obtain the 502 502 * paper settings. As Wine doesn't allow VXDs, this results in a crash. 503 503 */ … … 511 511 != NrOfEntries) { 512 512 ERR("Number of caps is different\n"); 513 NrOfEntries = 0;513 NrOfEntries = 0; 514 514 } 515 515 … … 519 519 fwCapability_Names, Names, dm); 520 520 NrOfEntries = DeviceCapabilitiesA(PrinterName, PortName, 521 fwCapability_Words, (LPSTR)Words, dm);521 fwCapability_Words, (LPSTR)Words, dm); 522 522 523 523 /* reset any current content in the combobox */ 524 524 SendDlgItemMessageA(hDlg, nIDComboBox, CB_RESETCONTENT, 0, 0); 525 525 526 526 /* store new content */ 527 527 for (i = 0; i < NrOfEntries; i++) { 528 528 DWORD pos = SendDlgItemMessageA(hDlg, nIDComboBox, CB_ADDSTRING, 0, 529 (LPARAM)(&Names[i*NamesSize]) );530 SendDlgItemMessageA(hDlg, nIDComboBox, CB_SETITEMDATA, pos, 531 Words[i]);529 (LPARAM)(&Names[i*NamesSize]) ); 530 SendDlgItemMessageA(hDlg, nIDComboBox, CB_SETITEMDATA, pos, 531 Words[i]); 532 532 } 533 533 … … 537 537 for (i = 0; i < NrOfEntries; i++) { 538 538 if(SendDlgItemMessageA(hDlg, nIDComboBox, CB_GETITEMDATA, i, 0) == 539 oldWord) {540 Sel = i;541 break;542 }539 oldWord) { 540 Sel = i; 541 break; 542 } 543 543 } 544 544 SendDlgItemMessageA(hDlg, nIDComboBox, CB_SETCURSEL, Sel, 0); … … 564 564 for (i = 0; i < 25; i++) { 565 565 if (pi->Status & (1<<i)) { 566 LoadStringA(COMDLG32_hInstance, PD32_PRINTER_STATUS_PAUSED+i, 567 ResourceString, 255);568 strcat(StatusMsg,ResourceString);566 LoadStringA(COMDLG32_hInstance, PD32_PRINTER_STATUS_PAUSED+i, 567 ResourceString, 255); 568 strcat(StatusMsg,ResourceString); 569 569 } 570 570 } 571 571 /* append "ready" */ 572 /* FIXME: status==ready must only be appended if really so. 572 /* FIXME: status==ready must only be appended if really so. 573 573 but how to detect? */ 574 LoadStringA(COMDLG32_hInstance, PD32_PRINTER_STATUS_READY, 575 ResourceString, 255);574 LoadStringA(COMDLG32_hInstance, PD32_PRINTER_STATUS_READY, 575 ResourceString, 255); 576 576 strcat(StatusMsg,ResourceString); 577 577 578 578 SendDlgItemMessageA(hDlg, stc12, WM_SETTEXT, 0, (LPARAM)StatusMsg); 579 579 … … 585 585 SendDlgItemMessageA(hDlg, stc14, WM_SETTEXT, 0,(LPARAM)pi->pPortName); 586 586 SendDlgItemMessageA(hDlg, stc13, WM_SETTEXT, 0, (LPARAM)(pi->pComment ? 587 pi->pComment : ""));587 pi->pComment : "")); 588 588 return; 589 589 } … … 596 596 */ 597 597 static BOOL PRINTDLG_ChangePrinter(HWND hDlg, char *name, 598 PRINT_PTRA *PrintStructures)598 PRINT_PTRA *PrintStructures) 599 599 { 600 600 LPPRINTDLGA lppd = PrintStructures->dlg.lpPrintDlg; … … 610 610 if(!OpenPrinterA(name, &hprn, NULL)) { 611 611 ERR("Can't open printer %s\n", name); 612 return FALSE;612 return FALSE; 613 613 } 614 614 GetPrinterA(hprn, 2, NULL, 0, &needed); 615 615 PrintStructures->lpPrinterInfo = HeapAlloc(GetProcessHeap(),0,needed); 616 616 GetPrinterA(hprn, 2, (LPBYTE)PrintStructures->lpPrinterInfo, needed, 617 &needed);617 &needed); 618 618 GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed); 619 619 PrintStructures->lpDriverInfo = HeapAlloc(GetProcessHeap(),0,needed); 620 620 if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)PrintStructures->lpDriverInfo, 621 needed, &needed)) {622 ERR("GetPrinterDriverA failed for %s, fix your config!\n",PrintStructures->lpPrinterInfo->pPrinterName);623 return FALSE;621 needed, &needed)) { 622 ERR("GetPrinterDriverA failed for %s, fix your config!\n",PrintStructures->lpPrinterInfo->pPrinterName); 623 return FALSE; 624 624 } 625 625 ClosePrinter(hprn); … … 629 629 if(PrintStructures->lpDevMode) { 630 630 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode); 631 PrintStructures->lpDevMode = NULL;631 PrintStructures->lpDevMode = NULL; 632 632 } 633 633 … … 635 635 if(dmSize == -1) { 636 636 ERR("DocumentProperties fails on %s\n", debugstr_a(name)); 637 return FALSE;637 return FALSE; 638 638 } 639 639 PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(), 0, dmSize); 640 640 dmSize = DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, NULL, 641 DM_OUT_BUFFER);641 DM_OUT_BUFFER); 642 642 if(lppd->hDevMode && (lpdm = GlobalLock(lppd->hDevMode)) && 643 !strcmp(lpdm->dmDeviceName,644 PrintStructures->lpDevMode->dmDeviceName)) {643 !strcmp(lpdm->dmDeviceName, 644 PrintStructures->lpDevMode->dmDeviceName)) { 645 645 /* Supplied devicemode matches current printer so try to use it */ 646 646 DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, lpdm, 647 DM_OUT_BUFFER | DM_IN_BUFFER);647 DM_OUT_BUFFER | DM_IN_BUFFER); 648 648 } 649 649 if(lpdm) … … 655 655 /* Print range (All/Range/Selection) */ 656 656 SetDlgItemInt(hDlg, edt1, lppd->nFromPage, FALSE); 657 SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE);658 CheckRadioButton(hDlg, rad1, rad3, rad1);/* default */659 if (lppd->Flags & PD_NOSELECTION)660 EnableWindow(GetDlgItem(hDlg, rad2), FALSE);661 else662 if (lppd->Flags & PD_SELECTION)663 CheckRadioButton(hDlg, rad1, rad3, rad2);664 if (lppd->Flags & PD_NOPAGENUMS) {665 EnableWindow(GetDlgItem(hDlg, rad3), FALSE);666 EnableWindow(GetDlgItem(hDlg, stc2),FALSE);667 EnableWindow(GetDlgItem(hDlg, edt1), FALSE);668 EnableWindow(GetDlgItem(hDlg, stc3),FALSE);669 EnableWindow(GetDlgItem(hDlg, edt2), FALSE);670 } else {671 if (lppd->Flags & PD_PAGENUMS)672 CheckRadioButton(hDlg, rad1, rad3, rad3);673 }674 /* "All xxx pages"... */675 {676 char resourcestr[64];677 char result[64];678 LoadStringA(COMDLG32_hInstance, PD32_PRINT_ALL_X_PAGES, 679 resourcestr, 49);680 sprintf(result,resourcestr,lppd->nMaxPage - lppd->nMinPage + 1);681 SendDlgItemMessageA(hDlg, rad1, WM_SETTEXT, 0, (LPARAM) result);682 }683 684 /* Collate pages 685 *686 * FIXME: The ico3 is not displayed for some reason. I don't know why.687 */688 if (lppd->Flags & PD_COLLATE) {689 SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 690 (LPARAM)PrintStructures->hCollateIcon);691 CheckDlgButton(hDlg, chx2, 1);692 } else {693 SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 694 (LPARAM)PrintStructures->hNoCollateIcon);695 CheckDlgButton(hDlg, chx2, 0);696 }697 698 if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {699 /* if printer doesn't support it: no Collate */700 if (!(lpdm->dmFields & DM_COLLATE)) {701 EnableWindow(GetDlgItem(hDlg, chx2), FALSE); 702 EnableWindow(GetDlgItem(hDlg, ico3), FALSE); 703 }704 }705 706 /* nCopies */707 {708 INT copies;709 if (lppd->hDevMode == 0)710 copies = lppd->nCopies;711 else712 copies = lpdm->dmCopies;713 if(copies == 0) copies = 1;714 else if(copies < 0) copies = MAX_COPIES;715 SetDlgItemInt(hDlg, edt3, copies, FALSE);716 }717 718 if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {719 /* if printer doesn't support it: no nCopies */720 if (!(lpdm->dmFields & DM_COPIES)) {721 EnableWindow(GetDlgItem(hDlg, edt3), FALSE); 722 EnableWindow(GetDlgItem(hDlg, stc5), FALSE); 723 }724 }725 726 /* print to file */727 CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0);728 if (lppd->Flags & PD_DISABLEPRINTTOFILE)729 EnableWindow(GetDlgItem(hDlg, chx1), FALSE); 730 if (lppd->Flags & PD_HIDEPRINTTOFILE)657 SetDlgItemInt(hDlg, edt2, lppd->nToPage, FALSE); 658 CheckRadioButton(hDlg, rad1, rad3, rad1); /* default */ 659 if (lppd->Flags & PD_NOSELECTION) 660 EnableWindow(GetDlgItem(hDlg, rad2), FALSE); 661 else 662 if (lppd->Flags & PD_SELECTION) 663 CheckRadioButton(hDlg, rad1, rad3, rad2); 664 if (lppd->Flags & PD_NOPAGENUMS) { 665 EnableWindow(GetDlgItem(hDlg, rad3), FALSE); 666 EnableWindow(GetDlgItem(hDlg, stc2),FALSE); 667 EnableWindow(GetDlgItem(hDlg, edt1), FALSE); 668 EnableWindow(GetDlgItem(hDlg, stc3),FALSE); 669 EnableWindow(GetDlgItem(hDlg, edt2), FALSE); 670 } else { 671 if (lppd->Flags & PD_PAGENUMS) 672 CheckRadioButton(hDlg, rad1, rad3, rad3); 673 } 674 /* "All xxx pages"... */ 675 { 676 char resourcestr[64]; 677 char result[64]; 678 LoadStringA(COMDLG32_hInstance, PD32_PRINT_ALL_X_PAGES, 679 resourcestr, 49); 680 sprintf(result,resourcestr,lppd->nMaxPage - lppd->nMinPage + 1); 681 SendDlgItemMessageA(hDlg, rad1, WM_SETTEXT, 0, (LPARAM) result); 682 } 683 684 /* Collate pages 685 * 686 * FIXME: The ico3 is not displayed for some reason. I don't know why. 687 */ 688 if (lppd->Flags & PD_COLLATE) { 689 SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 690 (LPARAM)PrintStructures->hCollateIcon); 691 CheckDlgButton(hDlg, chx2, 1); 692 } else { 693 SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 694 (LPARAM)PrintStructures->hNoCollateIcon); 695 CheckDlgButton(hDlg, chx2, 0); 696 } 697 698 if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) { 699 /* if printer doesn't support it: no Collate */ 700 if (!(lpdm->dmFields & DM_COLLATE)) { 701 EnableWindow(GetDlgItem(hDlg, chx2), FALSE); 702 EnableWindow(GetDlgItem(hDlg, ico3), FALSE); 703 } 704 } 705 706 /* nCopies */ 707 { 708 INT copies; 709 if (lppd->hDevMode == 0) 710 copies = lppd->nCopies; 711 else 712 copies = lpdm->dmCopies; 713 if(copies == 0) copies = 1; 714 else if(copies < 0) copies = MAX_COPIES; 715 SetDlgItemInt(hDlg, edt3, copies, FALSE); 716 } 717 718 if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) { 719 /* if printer doesn't support it: no nCopies */ 720 if (!(lpdm->dmFields & DM_COPIES)) { 721 EnableWindow(GetDlgItem(hDlg, edt3), FALSE); 722 EnableWindow(GetDlgItem(hDlg, stc5), FALSE); 723 } 724 } 725 726 /* print to file */ 727 CheckDlgButton(hDlg, chx1, (lppd->Flags & PD_PRINTTOFILE) ? 1 : 0); 728 if (lppd->Flags & PD_DISABLEPRINTTOFILE) 729 EnableWindow(GetDlgItem(hDlg, chx1), FALSE); 730 if (lppd->Flags & PD_HIDEPRINTTOFILE) 731 731 ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE); 732 732 … … 739 739 740 740 PRINTDLG_SetUpPaperComboBox(hDlg, cmb2, 741 PrintStructures->lpPrinterInfo->pPrinterName,742 PrintStructures->lpPrinterInfo->pPortName,743 lpdm);741 PrintStructures->lpPrinterInfo->pPrinterName, 742 PrintStructures->lpPrinterInfo->pPortName, 743 lpdm); 744 744 PRINTDLG_SetUpPaperComboBox(hDlg, cmb3, 745 PrintStructures->lpPrinterInfo->pPrinterName,746 PrintStructures->lpPrinterInfo->pPortName,747 lpdm);745 PrintStructures->lpPrinterInfo->pPrinterName, 746 PrintStructures->lpPrinterInfo->pPortName, 747 lpdm); 748 748 CheckRadioButton(hDlg, rad1, rad2, bPortrait ? rad1: rad2); 749 749 SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 750 750 (LPARAM)(bPortrait ? PrintStructures->hPortraitIcon : 751 751 PrintStructures->hLandscapeIcon)); 752 752 753 753 } 754 754 … … 756 756 if ((lppd->Flags & PD_SHOWHELP)==0) { 757 757 /* hide if PD_SHOWHELP not specified */ 758 ShowWindow(GetDlgItem(hDlg, pshHelp), SW_HIDE); 758 ShowWindow(GetDlgItem(hDlg, pshHelp), SW_HIDE); 759 759 } 760 760 return TRUE; … … 765 765 */ 766 766 static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, 767 PRINT_PTRA* PrintStructures)767 PRINT_PTRA* PrintStructures) 768 768 { 769 769 LPPRINTDLGA lppd = PrintStructures->dlg.lpPrintDlg; … … 778 778 PrintStructures->hCollateIcon = 779 779 LoadImageA(COMDLG32_hInstance, "PD32_COLLATE", IMAGE_ICON, 0, 0, 0); 780 PrintStructures->hNoCollateIcon = 780 PrintStructures->hNoCollateIcon = 781 781 LoadImageA(COMDLG32_hInstance, "PD32_NOCOLLATE", IMAGE_ICON, 0, 0, 0); 782 782 … … 792 792 PrintStructures->hLandscapeIcon == 0) { 793 793 ERR("no icon in resourcefile\n"); 794 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);795 EndDialog(hDlg, FALSE);794 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 795 EndDialog(hDlg, FALSE); 796 796 } 797 797 … … 801 801 */ 802 802 if (lppd->Flags & PD_SHOWHELP) { 803 if((PrintStructures->HelpMessageID = 804 RegisterWindowMessageA(HELPMSGSTRINGA)) == 0) {805 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);806 return FALSE;807 }803 if((PrintStructures->HelpMessageID = 804 RegisterWindowMessageA(HELPMSGSTRINGA)) == 0) { 805 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL); 806 return FALSE; 807 } 808 808 } else 809 809 PrintStructures->HelpMessageID = 0; … … 811 811 if(!(lppd->Flags &PD_PRINTSETUP)) { 812 812 PrintStructures->hwndUpDown = 813 CreateUpDownControl(WS_CHILD | WS_VISIBLE | WS_BORDER |814 UDS_NOTHOUSANDS | UDS_ARROWKEYS |815 UDS_ALIGNRIGHT | UDS_SETBUDDYINT, 0, 0, 0, 0,816 hDlg, UPDOWN_ID, COMDLG32_hInstance,817 GetDlgItem(hDlg, edt3), MAX_COPIES, 1, 1);813 CreateUpDownControl(WS_CHILD | WS_VISIBLE | WS_BORDER | 814 UDS_NOTHOUSANDS | UDS_ARROWKEYS | 815 UDS_ALIGNRIGHT | UDS_SETBUDDYINT, 0, 0, 0, 0, 816 hDlg, UPDOWN_ID, COMDLG32_hInstance, 817 GetDlgItem(hDlg, edt3), MAX_COPIES, 1, 1); 818 818 } 819 819 … … 823 823 */ 824 824 if (lppd->nMaxPage < lppd->nMinPage) 825 lppd->nMaxPage = lppd->nMinPage;826 if (lppd->nMinPage == lppd->nMaxPage) 827 lppd->Flags |= PD_NOPAGENUMS;825 lppd->nMaxPage = lppd->nMinPage; 826 if (lppd->nMinPage == lppd->nMaxPage) 827 lppd->Flags |= PD_NOPAGENUMS; 828 828 if (lppd->nToPage < lppd->nMinPage) 829 829 lppd->nToPage = lppd->nMinPage; … … 837 837 /* if we have the combo box, fill it */ 838 838 if (GetDlgItem(hDlg,comboID)) { 839 /* Fill Combobox 840 */841 pdn = GlobalLock(lppd->hDevNames);842 pdm = GlobalLock(lppd->hDevMode);843 if(pdn)844 name = (char*)pdn + pdn->wDeviceOffset;845 else if(pdm)846 name = pdm->dmDeviceName;847 PRINTDLG_SetUpPrinterListCombo(hDlg, comboID, name);848 if(pdm) GlobalUnlock(lppd->hDevMode);849 if(pdn) GlobalUnlock(lppd->hDevNames);850 851 /* Now find selected printer and update rest of dlg */852 name = HeapAlloc(GetProcessHeap(),0,256);853 if (GetDlgItemTextA(hDlg, comboID, name, 255))854 PRINTDLG_ChangePrinter(hDlg, name, PrintStructures);855 HeapFree(GetProcessHeap(),0,name);839 /* Fill Combobox 840 */ 841 pdn = GlobalLock(lppd->hDevNames); 842 pdm = GlobalLock(lppd->hDevMode); 843 if(pdn) 844 name = (char*)pdn + pdn->wDeviceOffset; 845 else if(pdm) 846 name = pdm->dmDeviceName; 847 PRINTDLG_SetUpPrinterListCombo(hDlg, comboID, name); 848 if(pdm) GlobalUnlock(lppd->hDevMode); 849 if(pdn) GlobalUnlock(lppd->hDevNames); 850 851 /* Now find selected printer and update rest of dlg */ 852 name = HeapAlloc(GetProcessHeap(),0,256); 853 if (GetDlgItemTextA(hDlg, comboID, name, 255)) 854 PRINTDLG_ChangePrinter(hDlg, name, PrintStructures); 855 HeapFree(GetProcessHeap(),0,name); 856 856 } else { 857 /* else use default printer */858 char name[200];859 BOOL ret = PRINTDLG_GetDefaultPrinterName(name, sizeof(name));860 861 if (ret)862 PRINTDLG_ChangePrinter(hDlg, name, PrintStructures);863 else864 FIXME("No default printer found, expect problems!\n");857 /* else use default printer */ 858 char name[200]; 859 BOOL ret = PRINTDLG_GetDefaultPrinterName(name, sizeof(name)); 860 861 if (ret) 862 PRINTDLG_ChangePrinter(hDlg, name, PrintStructures); 863 else 864 FIXME("No default printer found, expect problems!\n"); 865 865 } 866 866 return TRUE; … … 872 872 */ 873 873 static LRESULT PRINTDLG_WMInitDialog16(HWND hDlg, WPARAM wParam, 874 PRINT_PTRA* PrintStructures)874 PRINT_PTRA* PrintStructures) 875 875 { 876 876 LPPRINTDLG16 lppd = PrintStructures->dlg.lpPrintDlg16; … … 883 883 PrintStructures->hCollateIcon = 884 884 LoadIconA(COMDLG32_hInstance, "PD32_COLLATE"); 885 PrintStructures->hNoCollateIcon = 885 PrintStructures->hNoCollateIcon = 886 886 LoadIconA(COMDLG32_hInstance, "PD32_NOCOLLATE"); 887 887 if(PrintStructures->hCollateIcon == 0 || 888 888 PrintStructures->hNoCollateIcon == 0) { 889 889 ERR("no icon in resourcefile\n"); 890 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);891 EndDialog(hDlg, FALSE);890 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 891 EndDialog(hDlg, FALSE); 892 892 } 893 893 … … 900 900 */ 901 901 if (lppd->Flags & PD_SHOWHELP) { 902 if((PrintStructures->HelpMessageID = 903 RegisterWindowMessageA(HELPMSGSTRINGA)) == 0) {904 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);905 return FALSE;906 }902 if((PrintStructures->HelpMessageID = 903 RegisterWindowMessageA(HELPMSGSTRINGA)) == 0) { 904 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL); 905 return FALSE; 906 } 907 907 } else 908 908 PrintStructures->HelpMessageID = 0; 909 909 910 910 if (!(lppd->Flags & PD_PRINTSETUP)) { 911 /* We have a print quality combo box. What shall we do? */912 if (GetDlgItem(hDlg,cmb1)) {913 char buf [20];914 915 FIXME("Print quality only displaying currently.\n");916 917 pdm = GlobalLock16(lppd->hDevMode);918 if(pdm) {919 switch (pdm->dmPrintQuality) {920 case DMRES_HIGH: strcpy(buf,"High");break;921 case DMRES_MEDIUM: strcpy(buf,"Medium");break;922 case DMRES_LOW: strcpy(buf,"Low");break;923 case DMRES_DRAFT: strcpy(buf,"Draft");break;924 case 0: strcpy(buf,"Default");break;925 default: sprintf(buf,"%ddpi",pdm->dmPrintQuality);break;926 }927 GlobalUnlock16(lppd->hDevMode);928 } else 929 strcpy(buf,"Default");930 SendDlgItemMessageA(hDlg,cmb1,CB_ADDSTRING,0,(LPARAM)buf);931 SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0);932 EnableWindow(GetDlgItem(hDlg,cmb1),FALSE);933 }911 /* We have a print quality combo box. What shall we do? */ 912 if (GetDlgItem(hDlg,cmb1)) { 913 char buf [20]; 914 915 FIXME("Print quality only displaying currently.\n"); 916 917 pdm = GlobalLock16(lppd->hDevMode); 918 if(pdm) { 919 switch (pdm->dmPrintQuality) { 920 case DMRES_HIGH : strcpy(buf,"High");break; 921 case DMRES_MEDIUM : strcpy(buf,"Medium");break; 922 case DMRES_LOW : strcpy(buf,"Low");break; 923 case DMRES_DRAFT : strcpy(buf,"Draft");break; 924 case 0 : strcpy(buf,"Default");break; 925 default : sprintf(buf,"%ddpi",pdm->dmPrintQuality);break; 926 } 927 GlobalUnlock16(lppd->hDevMode); 928 } else 929 strcpy(buf,"Default"); 930 SendDlgItemMessageA(hDlg,cmb1,CB_ADDSTRING,0,(LPARAM)buf); 931 SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0); 932 EnableWindow(GetDlgItem(hDlg,cmb1),FALSE); 933 } 934 934 } 935 935 … … 939 939 */ 940 940 if (lppd->nMaxPage < lppd->nMinPage) 941 lppd->nMaxPage = lppd->nMinPage;942 if (lppd->nMinPage == lppd->nMaxPage) 943 lppd->Flags |= PD_NOPAGENUMS;941 lppd->nMaxPage = lppd->nMinPage; 942 if (lppd->nMinPage == lppd->nMaxPage) 943 lppd->Flags |= PD_NOPAGENUMS; 944 944 if (lppd->nToPage < lppd->nMinPage) 945 945 lppd->nToPage = lppd->nMinPage; … … 953 953 /* If the printer combo box is in the dialog, fill it */ 954 954 if (GetDlgItem(hDlg,comboID)) { 955 /* Fill Combobox 956 */957 pdn = GlobalLock16(lppd->hDevNames);958 pdm = GlobalLock16(lppd->hDevMode);959 if(pdn)960 name = (char*)pdn + pdn->wDeviceOffset;961 else if(pdm)962 name = pdm->dmDeviceName;963 PRINTDLG_SetUpPrinterListCombo(hDlg, comboID, name);964 if(pdm) GlobalUnlock16(lppd->hDevMode);965 if(pdn) GlobalUnlock16(lppd->hDevNames);966 967 /* Now find selected printer and update rest of dlg */968 name = HeapAlloc(GetProcessHeap(),0,256);969 if (GetDlgItemTextA(hDlg, comboID, name, 255))970 PRINTDLG_ChangePrinter(hDlg, name, PrintStructures);955 /* Fill Combobox 956 */ 957 pdn = GlobalLock16(lppd->hDevNames); 958 pdm = GlobalLock16(lppd->hDevMode); 959 if(pdn) 960 name = (char*)pdn + pdn->wDeviceOffset; 961 else if(pdm) 962 name = pdm->dmDeviceName; 963 PRINTDLG_SetUpPrinterListCombo(hDlg, comboID, name); 964 if(pdm) GlobalUnlock16(lppd->hDevMode); 965 if(pdn) GlobalUnlock16(lppd->hDevNames); 966 967 /* Now find selected printer and update rest of dlg */ 968 name = HeapAlloc(GetProcessHeap(),0,256); 969 if (GetDlgItemTextA(hDlg, comboID, name, 255)) 970 PRINTDLG_ChangePrinter(hDlg, name, PrintStructures); 971 971 } else { 972 /* else just use default printer */973 char name[200];974 BOOL ret = PRINTDLG_GetDefaultPrinterName(name, sizeof(name));975 976 if (ret)977 PRINTDLG_ChangePrinter(hDlg, name, PrintStructures);978 else979 FIXME("No default printer found, expect problems!\n");972 /* else just use default printer */ 973 char name[200]; 974 BOOL ret = PRINTDLG_GetDefaultPrinterName(name, sizeof(name)); 975 976 if (ret) 977 PRINTDLG_ChangePrinter(hDlg, name, PrintStructures); 978 else 979 FIXME("No default printer found, expect problems!\n"); 980 980 } 981 981 HeapFree(GetProcessHeap(),0,name); … … 988 988 * PRINTDLG_WMCommand [internal] 989 989 */ 990 static LRESULT PRINTDLG_WMCommand(HWND hDlg, WPARAM wParam, 991 LPARAM lParam, PRINT_PTRA* PrintStructures)990 static LRESULT PRINTDLG_WMCommand(HWND hDlg, WPARAM wParam, 991 LPARAM lParam, PRINT_PTRA* PrintStructures) 992 992 { 993 993 LPPRINTDLGA lppd = PrintStructures->dlg.lpPrintDlg; … … 999 999 TRACE(" OK button was hit\n"); 1000 1000 if (PRINTDLG_UpdatePrintDlg(hDlg, PrintStructures)!=TRUE) { 1001 FIXME("Update printdlg was not successful!\n");1002 return(FALSE);1003 }1004 EndDialog(hDlg, TRUE);1005 return(TRUE);1001 FIXME("Update printdlg was not successful!\n"); 1002 return(FALSE); 1003 } 1004 EndDialog(hDlg, TRUE); 1005 return(TRUE); 1006 1006 1007 1007 case IDCANCEL: 1008 1008 TRACE(" CANCEL button was hit\n"); 1009 1009 EndDialog(hDlg, FALSE); 1010 return(FALSE);1010 return(FALSE); 1011 1011 1012 1012 case pshHelp: 1013 1013 TRACE(" HELP button was hit\n"); 1014 SendMessageA(lppd->hwndOwner, PrintStructures->HelpMessageID, 1015 (WPARAM) hDlg, (LPARAM) lppd);1014 SendMessageA(lppd->hwndOwner, PrintStructures->HelpMessageID, 1015 (WPARAM) hDlg, (LPARAM) lppd); 1016 1016 break; 1017 1017 1018 1018 case chx2: /* collate pages checkbox */ 1019 1019 if (IsDlgButtonChecked(hDlg, chx2) == BST_CHECKED) 1020 SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 1020 SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 1021 1021 (LPARAM)PrintStructures->hCollateIcon); 1022 1022 else 1023 SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 1023 SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, (WPARAM) IMAGE_ICON, 1024 1024 (LPARAM)PrintStructures->hNoCollateIcon); 1025 break; 1025 break; 1026 1026 case edt1: /* from page nr editbox */ 1027 1027 case edt2: /* to page nr editbox */ 1028 1028 if (HIWORD(wParam)==EN_CHANGE) { 1029 WORD nToPage;1030 WORD nFromPage;1031 nFromPage = GetDlgItemInt(hDlg, edt1, NULL, FALSE);1032 nToPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE);1029 WORD nToPage; 1030 WORD nFromPage; 1031 nFromPage = GetDlgItemInt(hDlg, edt1, NULL, FALSE); 1032 nToPage = GetDlgItemInt(hDlg, edt2, NULL, FALSE); 1033 1033 if (nFromPage != lppd->nFromPage || nToPage != lppd->nToPage) 1034 CheckRadioButton(hDlg, rad1, rad3, rad3);1035 }1034 CheckRadioButton(hDlg, rad1, rad3, rad3); 1035 } 1036 1036 break; 1037 1037 1038 1038 case edt3: 1039 1039 if(HIWORD(wParam) == EN_CHANGE) { 1040 INT copies = GetDlgItemInt(hDlg, edt3, NULL, FALSE);1041 if(copies <= 1)1042 EnableWindow(GetDlgItem(hDlg, chx2), FALSE);1043 else1044 EnableWindow(GetDlgItem(hDlg, chx2), TRUE);1045 }1046 break;1040 INT copies = GetDlgItemInt(hDlg, edt3, NULL, FALSE); 1041 if(copies <= 1) 1042 EnableWindow(GetDlgItem(hDlg, chx2), FALSE); 1043 else 1044 EnableWindow(GetDlgItem(hDlg, chx2), TRUE); 1045 } 1046 break; 1047 1047 1048 1048 #ifndef __WIN32OS2__ 1049 1049 case psh1: /* Print Setup */ 1050 {1051 PRINTDLG16pdlg;1052 1053 if (!PrintStructures->dlg.lpPrintDlg16) {1054 FIXME("The 32bit print dialog does not have this button!?\n");1055 break;1056 }1057 1058 memcpy(&pdlg,PrintStructures->dlg.lpPrintDlg16,sizeof(pdlg));1059 pdlg.Flags |= PD_PRINTSETUP;1060 pdlg.hwndOwner = hDlg;1061 if (!PrintDlg16(&pdlg))1062 break;1063 }1064 break;1050 { 1051 PRINTDLG16 pdlg; 1052 1053 if (!PrintStructures->dlg.lpPrintDlg16) { 1054 FIXME("The 32bit print dialog does not have this button!?\n"); 1055 break; 1056 } 1057 1058 memcpy(&pdlg,PrintStructures->dlg.lpPrintDlg16,sizeof(pdlg)); 1059 pdlg.Flags |= PD_PRINTSETUP; 1060 pdlg.hwndOwner = hDlg; 1061 if (!PrintDlg16(&pdlg)) 1062 break; 1063 } 1064 break; 1065 1065 #endif 1066 1066 … … 1072 1072 GetDlgItemTextA(hDlg, PrinterComboID, PrinterName, 255); 1073 1073 if (!OpenPrinterA(PrinterName, &hPrinter, NULL)) { 1074 FIXME(" Call to OpenPrinter did not succeed!\n");1075 break;1076 }1077 DocumentPropertiesA(hDlg, hPrinter, PrinterName, 1078 PrintStructures->lpDevMode,1079 PrintStructures->lpDevMode,1080 DM_IN_BUFFER | DM_OUT_BUFFER | DM_IN_PROMPT);1081 ClosePrinter(hPrinter);1074 FIXME(" Call to OpenPrinter did not succeed!\n"); 1075 break; 1076 } 1077 DocumentPropertiesA(hDlg, hPrinter, PrinterName, 1078 PrintStructures->lpDevMode, 1079 PrintStructures->lpDevMode, 1080 DM_IN_BUFFER | DM_OUT_BUFFER | DM_IN_PROMPT); 1081 ClosePrinter(hPrinter); 1082 1082 break; 1083 1083 } … … 1095 1095 } 1096 1096 break; 1097 1097 1098 1098 case rad2: /* Paperorientation */ 1099 1099 if (lppd->Flags & PD_PRINTSETUP) … … 1108 1108 } 1109 1109 break; 1110 1110 1111 1111 case cmb1: /* Printer Combobox in PRINT SETUP, quality combobox in PRINT */ 1112 if (PrinterComboID != wParam) {1113 FIXME("No handling for print quality combo box yet.\n");1114 break;1115 }1116 /* FALLTHROUGH */1112 if (PrinterComboID != wParam) { 1113 FIXME("No handling for print quality combo box yet.\n"); 1114 break; 1115 } 1116 /* FALLTHROUGH */ 1117 1117 case cmb4: /* Printer combobox */ 1118 1118 if (HIWORD(wParam)==CBN_SELCHANGE) { 1119 char PrinterName[256];1120 GetDlgItemTextA(hDlg, LOWORD(wParam), PrinterName, 255);1121 PRINTDLG_ChangePrinter(hDlg, PrinterName, PrintStructures);1122 }1123 break;1119 char PrinterName[256]; 1120 GetDlgItemTextA(hDlg, LOWORD(wParam), PrinterName, 255); 1121 PRINTDLG_ChangePrinter(hDlg, PrinterName, PrintStructures); 1122 } 1123 break; 1124 1124 1125 1125 case cmb2: /* Papersize */ 1126 1126 { 1127 DWORD Sel = SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0);1128 if(Sel != CB_ERR)1127 DWORD Sel = SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0); 1128 if(Sel != CB_ERR) 1129 1129 #ifdef __WIN32OS2__ 1130 lpdm->dmPaperSize = SendDlgItemMessageA(hDlg, cmb2,1130 lpdm->dmPaperSize = SendDlgItemMessageA(hDlg, cmb2, 1131 1131 #else 1132 lpdm->u1.s1.dmPaperSize = SendDlgItemMessageA(hDlg, cmb2,1132 lpdm->u1.s1.dmPaperSize = SendDlgItemMessageA(hDlg, cmb2, 1133 1133 #endif 1134 CB_GETITEMDATA,1135 Sel, 0);1134 CB_GETITEMDATA, 1135 Sel, 0); 1136 1136 } 1137 1137 break; … … 1139 1139 case cmb3: /* Bin */ 1140 1140 { 1141 DWORD Sel = SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0);1142 if(Sel != CB_ERR)1143 lpdm->dmDefaultSource = SendDlgItemMessageA(hDlg, cmb3,1144 CB_GETITEMDATA, Sel,1145 0);1141 DWORD Sel = SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0); 1142 if(Sel != CB_ERR) 1143 lpdm->dmDefaultSource = SendDlgItemMessageA(hDlg, cmb3, 1144 CB_GETITEMDATA, Sel, 1145 0); 1146 1146 } 1147 break; 1147 break; 1148 1148 } 1149 1149 if(lppd->Flags & PD_PRINTSETUP) { 1150 1150 switch (LOWORD(wParam)) { 1151 case rad1: /* orientation */1152 case rad2:1153 if (IsDlgButtonChecked(hDlg, rad1) == BST_CHECKED) {1151 case rad1: /* orientation */ 1152 case rad2: 1153 if (IsDlgButtonChecked(hDlg, rad1) == BST_CHECKED) { 1154 1154 #ifdef __WIN32OS2__ 1155 if(lpdm->dmOrientation != DMORIENT_PORTRAIT) {1156 lpdm->dmOrientation = DMORIENT_PORTRAIT;1155 if(lpdm->dmOrientation != DMORIENT_PORTRAIT) { 1156 lpdm->dmOrientation = DMORIENT_PORTRAIT; 1157 1157 #else 1158 if(lpdm->u1.s1.dmOrientation != DMORIENT_PORTRAIT) {1159 lpdm->u1.s1.dmOrientation = DMORIENT_PORTRAIT;1158 if(lpdm->u1.s1.dmOrientation != DMORIENT_PORTRAIT) { 1159 lpdm->u1.s1.dmOrientation = DMORIENT_PORTRAIT; 1160 1160 #endif 1161 SendDlgItemMessageA(hDlg, stc10, STM_SETIMAGE,1162 (WPARAM)IMAGE_ICON,1163 (LPARAM)PrintStructures->hPortraitIcon);1164 SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE,1165 (WPARAM)IMAGE_ICON,1166 (LPARAM)PrintStructures->hPortraitIcon);1167 }1168 } else {1161 SendDlgItemMessageA(hDlg, stc10, STM_SETIMAGE, 1162 (WPARAM)IMAGE_ICON, 1163 (LPARAM)PrintStructures->hPortraitIcon); 1164 SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE, 1165 (WPARAM)IMAGE_ICON, 1166 (LPARAM)PrintStructures->hPortraitIcon); 1167 } 1168 } else { 1169 1169 #ifdef __WIN32OS2__ 1170 if(lpdm->dmOrientation != DMORIENT_LANDSCAPE) {1171 lpdm->dmOrientation = DMORIENT_LANDSCAPE;1170 if(lpdm->dmOrientation != DMORIENT_LANDSCAPE) { 1171 lpdm->dmOrientation = DMORIENT_LANDSCAPE; 1172 1172 #else 1173 if(lpdm->u1.s1.dmOrientation != DMORIENT_LANDSCAPE) {1174 lpdm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE;1173 if(lpdm->u1.s1.dmOrientation != DMORIENT_LANDSCAPE) { 1174 lpdm->u1.s1.dmOrientation = DMORIENT_LANDSCAPE; 1175 1175 #endif 1176 SendDlgItemMessageA(hDlg, stc10, STM_SETIMAGE,1177 (WPARAM)IMAGE_ICON,1178 (LPARAM)PrintStructures->hLandscapeIcon);1179 SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE,1180 (WPARAM)IMAGE_ICON,1181 (LPARAM)PrintStructures->hLandscapeIcon);1182 }1183 }1184 break;1185 }1176 SendDlgItemMessageA(hDlg, stc10, STM_SETIMAGE, 1177 (WPARAM)IMAGE_ICON, 1178 (LPARAM)PrintStructures->hLandscapeIcon); 1179 SendDlgItemMessageA(hDlg, ico1, STM_SETIMAGE, 1180 (WPARAM)IMAGE_ICON, 1181 (LPARAM)PrintStructures->hLandscapeIcon); 1182 } 1183 } 1184 break; 1185 } 1186 1186 } 1187 1187 return FALSE; 1188 } 1188 } 1189 1189 1190 1190 /*********************************************************************** 1191 * PrintDlgProcA [internal]1191 * PrintDlgProcA [internal] 1192 1192 */ 1193 1193 #ifdef __WIN32OS2__ 1194 1194 LRESULT WINAPI PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, 1195 LPARAM lParam)1195 LPARAM lParam) 1196 1196 #else 1197 1197 BOOL WINAPI PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, 1198 LPARAM lParam)1198 LPARAM lParam) 1199 1199 #endif 1200 1200 { … … 1203 1203 1204 1204 if (uMsg!=WM_INITDIALOG) { 1205 PrintStructures = (PRINT_PTRA*) GetWindowLongA(hDlg, DWL_USER); 1206 if (!PrintStructures)1207 return FALSE;1205 PrintStructures = (PRINT_PTRA*) GetWindowLongA(hDlg, DWL_USER); 1206 if (!PrintStructures) 1207 return FALSE; 1208 1208 } else { 1209 1209 PrintStructures = (PRINT_PTRA*) lParam; 1210 SetWindowLongA(hDlg, DWL_USER, lParam); 1211 res = PRINTDLG_WMInitDialog(hDlg, wParam, PrintStructures);1212 1213 if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK)1214 res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook(1215 hDlg, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg1216 ); 1217 return res;1218 } 1219 1210 SetWindowLongA(hDlg, DWL_USER, lParam); 1211 res = PRINTDLG_WMInitDialog(hDlg, wParam, PrintStructures); 1212 1213 if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) 1214 res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook( 1215 hDlg, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg 1216 ); 1217 return res; 1218 } 1219 1220 1220 if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) { 1221 1221 res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook(hDlg,uMsg,wParam, 1222 lParam);1223 if(res) return res;1222 lParam); 1223 if(res) return res; 1224 1224 } 1225 1225 … … 1229 1229 1230 1230 case WM_DESTROY: 1231 DestroyIcon(PrintStructures->hCollateIcon);1232 DestroyIcon(PrintStructures->hNoCollateIcon);1231 DestroyIcon(PrintStructures->hCollateIcon); 1232 DestroyIcon(PrintStructures->hNoCollateIcon); 1233 1233 DestroyIcon(PrintStructures->hPortraitIcon); 1234 1234 DestroyIcon(PrintStructures->hLandscapeIcon); 1235 if(PrintStructures->hwndUpDown)1236 DestroyWindow(PrintStructures->hwndUpDown);1235 if(PrintStructures->hwndUpDown) 1236 DestroyWindow(PrintStructures->hwndUpDown); 1237 1237 return FALSE; 1238 } 1238 } 1239 1239 return res; 1240 1240 } … … 1255 1255 HGLOBAL16 hGlobal16; 1256 1256 LPVOID template; 1257 1257 1258 1258 if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, 1259 1259 PrintResourceName, RT_DIALOGA))) … … 1300 1300 1301 1301 if (lppd->Flags & PD_PRINTSETUP) { 1302 if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) { 1303 hDlgTmpl = lppd->hSetupTemplate; 1304 } else if(lppd->Flags & PD_ENABLESETUPTEMPLATE) { 1305 hResInfo = FindResourceA(lppd->hInstance, 1306 lppd->lpSetupTemplateName, RT_DIALOGA); 1307 hDlgTmpl = LoadResource(lppd->hInstance, hResInfo); 1302 if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) { 1303 hDlgTmpl = lppd->hSetupTemplate; 1304 } else if(lppd->Flags & PD_ENABLESETUPTEMPLATE) { 1305 hResInfo = FindResourceA(lppd->hInstance, 1306 lppd->lpSetupTemplateName, RT_DIALOGA); 1307 hDlgTmpl = LoadResource(lppd->hInstance, hResInfo); 1308 } else { 1309 hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32_SETUP", 1310 RT_DIALOGA); 1311 hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo); 1312 } 1308 1313 } else { 1309 hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32_SETUP", 1310 RT_DIALOGA); 1311 hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo); 1312 } 1313 } else { 1314 if(lppd->Flags & PD_ENABLEPRINTTEMPLATEHANDLE) { 1315 hDlgTmpl = lppd->hPrintTemplate; 1316 } else if(lppd->Flags & PD_ENABLEPRINTTEMPLATE) { 1317 hResInfo = FindResourceA(lppd->hInstance, 1318 lppd->lpPrintTemplateName, 1319 RT_DIALOGA); 1320 hDlgTmpl = LoadResource(lppd->hInstance, hResInfo); 1321 } else { 1322 hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32", 1323 RT_DIALOGA); 1324 hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo); 1325 } 1314 if(lppd->Flags & PD_ENABLEPRINTTEMPLATEHANDLE) { 1315 hDlgTmpl = lppd->hPrintTemplate; 1316 } else if(lppd->Flags & PD_ENABLEPRINTTEMPLATE) { 1317 hResInfo = FindResourceA(lppd->hInstance, 1318 lppd->lpPrintTemplateName, 1319 RT_DIALOGA); 1320 hDlgTmpl = LoadResource(lppd->hInstance, hResInfo); 1321 } else { 1322 hResInfo = FindResourceA(COMDLG32_hInstance, "PRINT32", 1323 RT_DIALOGA); 1324 hDlgTmpl = LoadResource(COMDLG32_hInstance, hResInfo); 1325 } 1326 1326 } 1327 1327 return hDlgTmpl; … … 1340 1340 1341 1341 if (lppd->Flags & PD_PRINTSETUP) { 1342 if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) { 1343 hDlgTmpl = lppd->hSetupTemplate; 1344 } else if(lppd->Flags & PD_ENABLESETUPTEMPLATE) { 1345 hResInfo = FindResource16(lppd->hInstance, 1346 MapSL(lppd->lpSetupTemplateName), RT_DIALOGA); 1347 hDlgTmpl = LoadResource16(lppd->hInstance, hResInfo); 1342 if(lppd->Flags & PD_ENABLESETUPTEMPLATEHANDLE) { 1343 hDlgTmpl = lppd->hSetupTemplate; 1344 } else if(lppd->Flags & PD_ENABLESETUPTEMPLATE) { 1345 hResInfo = FindResource16(lppd->hInstance, 1346 MapSL(lppd->lpSetupTemplateName), RT_DIALOGA); 1347 hDlgTmpl = LoadResource16(lppd->hInstance, hResInfo); 1348 } else { 1349 hDlgTmpl = PRINTDLG_Get16TemplateFrom32("PRINT32_SETUP"); 1350 } 1348 1351 } else { 1349 hDlgTmpl = PRINTDLG_Get16TemplateFrom32("PRINT32_SETUP"); 1350 } 1351 } else { 1352 if(lppd->Flags & PD_ENABLEPRINTTEMPLATEHANDLE) { 1353 hDlgTmpl = lppd->hPrintTemplate; 1354 } else if(lppd->Flags & PD_ENABLEPRINTTEMPLATE) { 1355 hResInfo = FindResource16(lppd->hInstance, 1356 MapSL(lppd->lpPrintTemplateName), 1357 RT_DIALOGA); 1358 hDlgTmpl = LoadResource16(lppd->hInstance, hResInfo); 1359 } else { 1360 hDlgTmpl = PRINTDLG_Get16TemplateFrom32("PRINT32"); 1361 } 1352 if(lppd->Flags & PD_ENABLEPRINTTEMPLATEHANDLE) { 1353 hDlgTmpl = lppd->hPrintTemplate; 1354 } else if(lppd->Flags & PD_ENABLEPRINTTEMPLATE) { 1355 hResInfo = FindResource16(lppd->hInstance, 1356 MapSL(lppd->lpPrintTemplateName), 1357 RT_DIALOGA); 1358 hDlgTmpl = LoadResource16(lppd->hInstance, hResInfo); 1359 } else { 1360 hDlgTmpl = PRINTDLG_Get16TemplateFrom32("PRINT32"); 1361 } 1362 1362 } 1363 1363 return hDlgTmpl; … … 1377 1377 if(lppd->Flags & PD_RETURNDC) { 1378 1378 lppd->hDC = CreateDCA((char*)pdn + pdn->wDriverOffset, 1379 (char*)pdn + pdn->wDeviceOffset,1380 (char*)pdn + pdn->wOutputOffset,1381 pdm );1379 (char*)pdn + pdn->wDeviceOffset, 1380 (char*)pdn + pdn->wOutputOffset, 1381 pdm ); 1382 1382 } else if(lppd->Flags & PD_RETURNIC) { 1383 1383 lppd->hDC = CreateICA((char*)pdn + pdn->wDriverOffset, 1384 (char*)pdn + pdn->wDeviceOffset,1385 (char*)pdn + pdn->wOutputOffset,1386 pdm );1384 (char*)pdn + pdn->wDeviceOffset, 1385 (char*)pdn + pdn->wOutputOffset, 1386 pdm ); 1387 1387 } 1388 1388 GlobalUnlock(lppd->hDevNames); … … 1399 1399 if(lppd->Flags & PD_RETURNDC) { 1400 1400 lppd->hDC = CreateDCA((char*)pdn + pdn->wDriverOffset, 1401 (char*)pdn + pdn->wDeviceOffset,1402 (char*)pdn + pdn->wOutputOffset,1403 pdm );1401 (char*)pdn + pdn->wDeviceOffset, 1402 (char*)pdn + pdn->wOutputOffset, 1403 pdm ); 1404 1404 } else if(lppd->Flags & PD_RETURNIC) { 1405 1405 lppd->hDC = CreateICA((char*)pdn + pdn->wDriverOffset, 1406 (char*)pdn + pdn->wDeviceOffset,1407 (char*)pdn + pdn->wOutputOffset,1408 pdm );1406 (char*)pdn + pdn->wDeviceOffset, 1407 (char*)pdn + pdn->wOutputOffset, 1408 pdm ); 1409 1409 } 1410 1410 GlobalUnlock16(lppd->hDevNames); … … 1431 1431 * * The Paper Orientation Icons are not implemented yet. 1432 1432 * * The Properties Button(s) should call DocumentPropertiesA(). 1433 * * Settings are not yet taken from a provided DevMode or 1433 * * Settings are not yet taken from a provided DevMode or 1434 1434 * default printer settings. 1435 1435 */ 1436 1436 BOOL WINAPI PrintDlgA( 1437 LPPRINTDLGA lppd /* [in/out] ptr to PRINTDLG32 struct */1438 )1437 LPPRINTDLGA lppd /* [in/out] ptr to PRINTDLG32 struct */ 1438 ) 1439 1439 { 1440 1440 BOOL bRet = FALSE; … … 1448 1448 if(TRACE_ON(commdlg)) { 1449 1449 char flagstr[1000] = ""; 1450 struct pd_flags *pflag = pd_flags;1451 for( ; pflag->name; pflag++) {1452 if(lppd->Flags & pflag->flag)1453 strcat(flagstr, pflag->name);1454 }1455 TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n"1456 "pp. %d-%d, min p %d, max p %d, copies %d, hinst %08x\n"1457 "flags %08lx (%s)\n",1458 lppd, lppd->hwndOwner, lppd->hDevMode, lppd->hDevNames,1459 lppd->nFromPage, lppd->nToPage, lppd->nMinPage, lppd->nMaxPage,1460 lppd->nCopies, lppd->hInstance, lppd->Flags, flagstr);1450 struct pd_flags *pflag = pd_flags; 1451 for( ; pflag->name; pflag++) { 1452 if(lppd->Flags & pflag->flag) 1453 strcat(flagstr, pflag->name); 1454 } 1455 TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n" 1456 "pp. %d-%d, min p %d, max p %d, copies %d, hinst %08x\n" 1457 "flags %08lx (%s)\n", 1458 lppd, lppd->hwndOwner, lppd->hDevMode, lppd->hDevNames, 1459 lppd->nFromPage, lppd->nToPage, lppd->nMinPage, lppd->nMaxPage, 1460 lppd->nCopies, lppd->hInstance, lppd->Flags, flagstr); 1461 1461 } 1462 1462 1463 1463 if(lppd->lStructSize != sizeof(PRINTDLGA)) { 1464 1464 WARN("structure size failure !!!\n"); 1465 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE);1466 return FALSE; 1465 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE); 1466 return FALSE; 1467 1467 } 1468 1468 1469 1469 if(lppd->Flags & PD_RETURNDEFAULT) { 1470 1470 PRINTER_INFO_2A *pbuf; 1471 DRIVER_INFO_3A*dbuf;1472 HANDLE hprn;1473 DWORD needed;1474 1475 if(lppd->hDevMode || lppd->hDevNames) {1476 WARN("hDevMode or hDevNames non-zero for PD_RETURNDEFAULT\n");1477 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE); 1478 return FALSE;1479 }1471 DRIVER_INFO_3A *dbuf; 1472 HANDLE hprn; 1473 DWORD needed; 1474 1475 if(lppd->hDevMode || lppd->hDevNames) { 1476 WARN("hDevMode or hDevNames non-zero for PD_RETURNDEFAULT\n"); 1477 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE); 1478 return FALSE; 1479 } 1480 1480 if(!PRINTDLG_OpenDefaultPrinter(&hprn)) { 1481 WARN("Can't find default printer\n");1482 COMDLG32_SetCommDlgExtendedError(PDERR_NODEFAULTPRN); 1483 return FALSE;1484 }1485 1486 GetPrinterA(hprn, 2, NULL, 0, &needed);1487 pbuf = HeapAlloc(GetProcessHeap(), 0, needed);1488 GetPrinterA(hprn, 2, (LPBYTE)pbuf, needed, &needed);1489 1490 GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed);1491 dbuf = HeapAlloc(GetProcessHeap(),0,needed);1492 if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)dbuf, needed, &needed)) {1493 ERR("GetPrinterDriverA failed, le %ld, fix your config for printer %s!\n",GetLastError(),pbuf->pPrinterName);1494 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE); 1495 return FALSE;1496 }1497 ClosePrinter(hprn);1498 1499 PRINTDLG_CreateDevNames(&(lppd->hDevNames),1500 dbuf->pDriverPath,1501 pbuf->pPrinterName,1502 pbuf->pPortName);1503 lppd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, pbuf->pDevMode->dmSize +1504 pbuf->pDevMode->dmDriverExtra);1505 ptr = GlobalLock(lppd->hDevMode);1506 memcpy(ptr, pbuf->pDevMode, pbuf->pDevMode->dmSize +1507 pbuf->pDevMode->dmDriverExtra);1508 GlobalUnlock(lppd->hDevMode);1509 HeapFree(GetProcessHeap(), 0, pbuf);1510 HeapFree(GetProcessHeap(), 0, dbuf);1511 bRet = TRUE;1481 WARN("Can't find default printer\n"); 1482 COMDLG32_SetCommDlgExtendedError(PDERR_NODEFAULTPRN); 1483 return FALSE; 1484 } 1485 1486 GetPrinterA(hprn, 2, NULL, 0, &needed); 1487 pbuf = HeapAlloc(GetProcessHeap(), 0, needed); 1488 GetPrinterA(hprn, 2, (LPBYTE)pbuf, needed, &needed); 1489 1490 GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed); 1491 dbuf = HeapAlloc(GetProcessHeap(),0,needed); 1492 if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)dbuf, needed, &needed)) { 1493 ERR("GetPrinterDriverA failed, le %ld, fix your config for printer %s!\n",GetLastError(),pbuf->pPrinterName); 1494 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE); 1495 return FALSE; 1496 } 1497 ClosePrinter(hprn); 1498 1499 PRINTDLG_CreateDevNames(&(lppd->hDevNames), 1500 dbuf->pDriverPath, 1501 pbuf->pPrinterName, 1502 pbuf->pPortName); 1503 lppd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, pbuf->pDevMode->dmSize + 1504 pbuf->pDevMode->dmDriverExtra); 1505 ptr = GlobalLock(lppd->hDevMode); 1506 memcpy(ptr, pbuf->pDevMode, pbuf->pDevMode->dmSize + 1507 pbuf->pDevMode->dmDriverExtra); 1508 GlobalUnlock(lppd->hDevMode); 1509 HeapFree(GetProcessHeap(), 0, pbuf); 1510 HeapFree(GetProcessHeap(), 0, dbuf); 1511 bRet = TRUE; 1512 1512 } else { 1513 HGLOBAL hDlgTmpl;1514 PRINT_PTRA *PrintStructures;1515 1516 /* load Dialog resources, 1517 * depending on Flags indicates Print32 or Print32_setup dialog 1513 HGLOBAL hDlgTmpl; 1514 PRINT_PTRA *PrintStructures; 1515 1516 /* load Dialog resources, 1517 * depending on Flags indicates Print32 or Print32_setup dialog 1518 1518 */ 1519 hDlgTmpl = PRINTDLG_GetDlgTemplate(lppd);1520 if (!hDlgTmpl) {1521 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);1522 return FALSE;1523 }1524 ptr = LockResource( hDlgTmpl );1525 if (!ptr) {1526 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);1527 return FALSE;1528 }1519 hDlgTmpl = PRINTDLG_GetDlgTemplate(lppd); 1520 if (!hDlgTmpl) { 1521 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 1522 return FALSE; 1523 } 1524 ptr = LockResource( hDlgTmpl ); 1525 if (!ptr) { 1526 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 1527 return FALSE; 1528 } 1529 1529 1530 1530 PrintStructures = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 1531 sizeof(PRINT_PTRA));1532 PrintStructures->dlg.lpPrintDlg = lppd;1533 1534 /* and create & process the dialog .1535 * -1 is failure, 0 is broken hwnd, everything else is ok.1536 */1537 bRet = (0<DialogBoxIndirectParamA(hInst, ptr, lppd->hwndOwner,1538 PrintDlgProcA,1539 (LPARAM)PrintStructures));1540 1541 if(bRet) {1542 DEVMODEA *lpdm = PrintStructures->lpDevMode, *lpdmReturn;1543 PRINTER_INFO_2A *pi = PrintStructures->lpPrinterInfo;1544 DRIVER_INFO_3A *di = PrintStructures->lpDriverInfo;1545 1546 if (lppd->hDevMode == 0) {1547 TRACE(" No hDevMode yet... Need to create my own\n");1548 lppd->hDevMode = GlobalAlloc(GMEM_MOVEABLE,1549 lpdm->dmSize + lpdm->dmDriverExtra);1550 } else {1551 WORD locks;1552 if((locks = (GlobalFlags(lppd->hDevMode) & GMEM_LOCKCOUNT))) {1553 WARN("hDevMode has %d locks on it. Unlocking it now\n", locks);1554 while(locks--) {1555 GlobalUnlock(lppd->hDevMode);1556 TRACE("Now got %d locks\n", locks);1557 }1558 }1559 lppd->hDevMode = GlobalReAlloc(lppd->hDevMode,1560 lpdm->dmSize + lpdm->dmDriverExtra,1561 GMEM_MOVEABLE);1562 }1563 lpdmReturn = GlobalLock(lppd->hDevMode);1564 memcpy(lpdmReturn, lpdm, lpdm->dmSize + lpdm->dmDriverExtra);1565 1566 if (lppd->hDevNames != 0) {1567 WORD locks;1568 if((locks = (GlobalFlags(lppd->hDevNames) & GMEM_LOCKCOUNT))) {1569 WARN("hDevNames has %d locks on it. Unlocking it now\n", locks);1570 while(locks--)1571 GlobalUnlock(lppd->hDevNames);1572 }1573 }1574 PRINTDLG_CreateDevNames(&(lppd->hDevNames),1575 di->pDriverPath,1576 pi->pPrinterName,1577 pi->pPortName1578 );1579 GlobalUnlock(lppd->hDevMode);1580 }1581 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);1582 HeapFree(GetProcessHeap(), 0, PrintStructures->lpPrinterInfo);1583 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDriverInfo);1584 HeapFree(GetProcessHeap(), 0, PrintStructures);1531 sizeof(PRINT_PTRA)); 1532 PrintStructures->dlg.lpPrintDlg = lppd; 1533 1534 /* and create & process the dialog . 1535 * -1 is failure, 0 is broken hwnd, everything else is ok. 1536 */ 1537 bRet = (0<DialogBoxIndirectParamA(hInst, ptr, lppd->hwndOwner, 1538 PrintDlgProcA, 1539 (LPARAM)PrintStructures)); 1540 1541 if(bRet) { 1542 DEVMODEA *lpdm = PrintStructures->lpDevMode, *lpdmReturn; 1543 PRINTER_INFO_2A *pi = PrintStructures->lpPrinterInfo; 1544 DRIVER_INFO_3A *di = PrintStructures->lpDriverInfo; 1545 1546 if (lppd->hDevMode == 0) { 1547 TRACE(" No hDevMode yet... Need to create my own\n"); 1548 lppd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, 1549 lpdm->dmSize + lpdm->dmDriverExtra); 1550 } else { 1551 WORD locks; 1552 if((locks = (GlobalFlags(lppd->hDevMode) & GMEM_LOCKCOUNT))) { 1553 WARN("hDevMode has %d locks on it. Unlocking it now\n", locks); 1554 while(locks--) { 1555 GlobalUnlock(lppd->hDevMode); 1556 TRACE("Now got %d locks\n", locks); 1557 } 1558 } 1559 lppd->hDevMode = GlobalReAlloc(lppd->hDevMode, 1560 lpdm->dmSize + lpdm->dmDriverExtra, 1561 GMEM_MOVEABLE); 1562 } 1563 lpdmReturn = GlobalLock(lppd->hDevMode); 1564 memcpy(lpdmReturn, lpdm, lpdm->dmSize + lpdm->dmDriverExtra); 1565 1566 if (lppd->hDevNames != 0) { 1567 WORD locks; 1568 if((locks = (GlobalFlags(lppd->hDevNames) & GMEM_LOCKCOUNT))) { 1569 WARN("hDevNames has %d locks on it. Unlocking it now\n", locks); 1570 while(locks--) 1571 GlobalUnlock(lppd->hDevNames); 1572 } 1573 } 1574 PRINTDLG_CreateDevNames(&(lppd->hDevNames), 1575 di->pDriverPath, 1576 pi->pPrinterName, 1577 pi->pPortName 1578 ); 1579 GlobalUnlock(lppd->hDevMode); 1580 } 1581 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode); 1582 HeapFree(GetProcessHeap(), 0, PrintStructures->lpPrinterInfo); 1583 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDriverInfo); 1584 HeapFree(GetProcessHeap(), 0, PrintStructures); 1585 1585 } 1586 1586 if(bRet && (lppd->Flags & PD_RETURNDC || lppd->Flags & PD_RETURNIC)) 1587 1587 bRet = PRINTDLG_CreateDC(lppd); 1588 1588 1589 TRACE("exit! (%d)\n", bRet); 1590 return bRet; 1589 TRACE("exit! (%d)\n", bRet); 1590 return bRet; 1591 1591 } 1592 1592 … … 1594 1594 /*********************************************************************** 1595 1595 * PrintDlg (COMMDLG.20) 1596 * 1596 * 1597 1597 * Displays the the PRINT dialog box, which enables the user to specify 1598 1598 * specific properties of the print job. … … 1608 1608 1609 1609 BOOL16 WINAPI PrintDlg16( 1610 LPPRINTDLG16 lppd /* [in/out] ptr to PRINTDLG struct */1610 LPPRINTDLG16 lppd /* [in/out] ptr to PRINTDLG struct */ 1611 1611 ) { 1612 1612 BOOL bRet = FALSE; … … 1616 1616 if(TRACE_ON(commdlg)) { 1617 1617 char flagstr[1000] = ""; 1618 struct pd_flags *pflag = pd_flags;1619 for( ; pflag->name; pflag++) {1620 if(lppd->Flags & pflag->flag)1621 strcat(flagstr, pflag->name);1622 }1623 TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n"1624 "pp. %d-%d, min p %d, max p %d, copies %d, hinst %08x\n"1625 "flags %08lx (%s)\n",1626 lppd, lppd->hwndOwner, lppd->hDevMode, lppd->hDevNames,1627 lppd->nFromPage, lppd->nToPage, lppd->nMinPage, lppd->nMaxPage,1628 lppd->nCopies, lppd->hInstance, lppd->Flags, flagstr);1618 struct pd_flags *pflag = pd_flags; 1619 for( ; pflag->name; pflag++) { 1620 if(lppd->Flags & pflag->flag) 1621 strcat(flagstr, pflag->name); 1622 } 1623 TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n" 1624 "pp. %d-%d, min p %d, max p %d, copies %d, hinst %08x\n" 1625 "flags %08lx (%s)\n", 1626 lppd, lppd->hwndOwner, lppd->hDevMode, lppd->hDevNames, 1627 lppd->nFromPage, lppd->nToPage, lppd->nMinPage, lppd->nMaxPage, 1628 lppd->nCopies, lppd->hInstance, lppd->Flags, flagstr); 1629 1629 } 1630 1630 1631 1631 if(lppd->lStructSize != sizeof(PRINTDLG16)) { 1632 1632 ERR("structure size (%ld/%d)\n",lppd->lStructSize,sizeof(PRINTDLG16)); 1633 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE);1634 return FALSE;1633 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE); 1634 return FALSE; 1635 1635 } 1636 1636 1637 1637 if(lppd->Flags & PD_RETURNDEFAULT) { 1638 1638 PRINTER_INFO_2A *pbuf; 1639 DRIVER_INFO_3A*dbuf;1640 HANDLE hprn;1641 DWORD needed;1642 1643 if(lppd->hDevMode || lppd->hDevNames) {1644 WARN("hDevMode or hDevNames non-zero for PD_RETURNDEFAULT\n");1645 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE); 1646 return FALSE;1647 }1639 DRIVER_INFO_3A *dbuf; 1640 HANDLE hprn; 1641 DWORD needed; 1642 1643 if(lppd->hDevMode || lppd->hDevNames) { 1644 WARN("hDevMode or hDevNames non-zero for PD_RETURNDEFAULT\n"); 1645 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE); 1646 return FALSE; 1647 } 1648 1648 if(!PRINTDLG_OpenDefaultPrinter(&hprn)) { 1649 WARN("Can't find default printer\n");1650 COMDLG32_SetCommDlgExtendedError(PDERR_NODEFAULTPRN); 1651 return FALSE;1652 }1653 1654 GetPrinterA(hprn, 2, NULL, 0, &needed);1655 pbuf = HeapAlloc(GetProcessHeap(), 0, needed);1656 GetPrinterA(hprn, 2, (LPBYTE)pbuf, needed, &needed);1657 GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed);1658 dbuf = HeapAlloc(GetProcessHeap(),0,needed);1659 if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)dbuf, needed, &needed)) {1660 ERR("GetPrinterDriverA failed for %s, le %ld, fix your config!\n",1661 pbuf->pPrinterName,GetLastError());1662 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE); 1663 return FALSE;1664 }1665 ClosePrinter(hprn);1666 PRINTDLG_CreateDevNames16(&(lppd->hDevNames),1667 dbuf->pDriverPath,1668 pbuf->pPrinterName,1669 pbuf->pPortName);1670 lppd->hDevMode = GlobalAlloc16(GMEM_MOVEABLE,pbuf->pDevMode->dmSize+1671 pbuf->pDevMode->dmDriverExtra);1672 ptr = GlobalLock16(lppd->hDevMode);1673 memcpy(ptr, pbuf->pDevMode, pbuf->pDevMode->dmSize +1674 pbuf->pDevMode->dmDriverExtra);1675 GlobalUnlock16(lppd->hDevMode);1676 HeapFree(GetProcessHeap(), 0, pbuf);1677 HeapFree(GetProcessHeap(), 0, dbuf);1678 bRet = TRUE;1649 WARN("Can't find default printer\n"); 1650 COMDLG32_SetCommDlgExtendedError(PDERR_NODEFAULTPRN); 1651 return FALSE; 1652 } 1653 1654 GetPrinterA(hprn, 2, NULL, 0, &needed); 1655 pbuf = HeapAlloc(GetProcessHeap(), 0, needed); 1656 GetPrinterA(hprn, 2, (LPBYTE)pbuf, needed, &needed); 1657 GetPrinterDriverA(hprn, NULL, 3, NULL, 0, &needed); 1658 dbuf = HeapAlloc(GetProcessHeap(),0,needed); 1659 if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)dbuf, needed, &needed)) { 1660 ERR("GetPrinterDriverA failed for %s, le %ld, fix your config!\n", 1661 pbuf->pPrinterName,GetLastError()); 1662 COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE); 1663 return FALSE; 1664 } 1665 ClosePrinter(hprn); 1666 PRINTDLG_CreateDevNames16(&(lppd->hDevNames), 1667 dbuf->pDriverPath, 1668 pbuf->pPrinterName, 1669 pbuf->pPortName); 1670 lppd->hDevMode = GlobalAlloc16(GMEM_MOVEABLE,pbuf->pDevMode->dmSize+ 1671 pbuf->pDevMode->dmDriverExtra); 1672 ptr = GlobalLock16(lppd->hDevMode); 1673 memcpy(ptr, pbuf->pDevMode, pbuf->pDevMode->dmSize + 1674 pbuf->pDevMode->dmDriverExtra); 1675 GlobalUnlock16(lppd->hDevMode); 1676 HeapFree(GetProcessHeap(), 0, pbuf); 1677 HeapFree(GetProcessHeap(), 0, dbuf); 1678 bRet = TRUE; 1679 1679 } else { 1680 HGLOBAL hDlgTmpl;1681 PRINT_PTRA *PrintStructures;1682 1683 /* load Dialog resources, 1684 * depending on Flags indicates Print32 or Print32_setup dialog 1680 HGLOBAL hDlgTmpl; 1681 PRINT_PTRA *PrintStructures; 1682 1683 /* load Dialog resources, 1684 * depending on Flags indicates Print32 or Print32_setup dialog 1685 1685 */ 1686 hDlgTmpl = PRINTDLG_GetDlgTemplate16(lppd);1687 if (!hDlgTmpl) {1688 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);1689 return FALSE;1690 }1686 hDlgTmpl = PRINTDLG_GetDlgTemplate16(lppd); 1687 if (!hDlgTmpl) { 1688 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 1689 return FALSE; 1690 } 1691 1691 PrintStructures = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 1692 sizeof(PRINT_PTRA));1693 PrintStructures->dlg.lpPrintDlg16 = lppd;1694 PrintStructures->dlg.lpPrintDlg = (LPPRINTDLGA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA));1695 #define CVAL(x) PrintStructures->dlg.lpPrintDlg->x = lppd->x;1696 #define MVAL(x) PrintStructures->dlg.lpPrintDlg->x = MapSL(lppd->x);1697 CVAL(Flags);CVAL(hwndOwner);CVAL(hDC);1698 CVAL(nFromPage);CVAL(nToPage);CVAL(nMinPage);CVAL(nMaxPage);1699 CVAL(nCopies);CVAL(hInstance);CVAL(lCustData);1700 MVAL(lpPrintTemplateName);MVAL(lpSetupTemplateName);1701 /* Don't copy rest, it is 16 bit specific */1692 sizeof(PRINT_PTRA)); 1693 PrintStructures->dlg.lpPrintDlg16 = lppd; 1694 PrintStructures->dlg.lpPrintDlg = (LPPRINTDLGA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA)); 1695 #define CVAL(x) PrintStructures->dlg.lpPrintDlg->x = lppd->x; 1696 #define MVAL(x) PrintStructures->dlg.lpPrintDlg->x = MapSL(lppd->x); 1697 CVAL(Flags);CVAL(hwndOwner);CVAL(hDC); 1698 CVAL(nFromPage);CVAL(nToPage);CVAL(nMinPage);CVAL(nMaxPage); 1699 CVAL(nCopies);CVAL(hInstance);CVAL(lCustData); 1700 MVAL(lpPrintTemplateName);MVAL(lpSetupTemplateName); 1701 /* Don't copy rest, it is 16 bit specific */ 1702 1702 #undef MVAL 1703 1703 #undef CVAL 1704 1704 1705 PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(),0,sizeof(DEVMODEA));1706 1707 /* and create & process the dialog .1708 * -1 is failure, 0 is broken hwnd, everything else is ok.1709 */1710 bRet =(0<DialogBoxIndirectParam16(1711 hInst, hDlgTmpl, lppd->hwndOwner,1712 (DLGPROC16)GetProcAddress16(GetModuleHandle16("COMMDLG"),(LPCSTR)21),1713 (LPARAM)PrintStructures1714 )1715 );1716 if (!PrintStructures->lpPrinterInfo) bRet = FALSE;1717 if(bRet) {1718 DEVMODEA *lpdm = PrintStructures->lpDevMode, *lpdmReturn;1719 PRINTER_INFO_2A *pi = PrintStructures->lpPrinterInfo;1720 DRIVER_INFO_3A *di = PrintStructures->lpDriverInfo;1721 1722 if (lppd->hDevMode == 0) {1723 TRACE(" No hDevMode yet... Need to create my own\n");1724 lppd->hDevMode = GlobalAlloc16(GMEM_MOVEABLE,1725 lpdm->dmSize + lpdm->dmDriverExtra);1726 } else {1727 WORD locks;1728 if((locks = (GlobalFlags16(lppd->hDevMode)&GMEM_LOCKCOUNT))) {1729 WARN("hDevMode has %d locks on it. Unlocking it now\n", locks);1730 while(locks--) {1731 GlobalUnlock16(lppd->hDevMode);1732 TRACE("Now got %d locks\n", locks);1733 }1734 }1735 lppd->hDevMode = GlobalReAlloc16(lppd->hDevMode,1736 lpdm->dmSize + lpdm->dmDriverExtra,1737 GMEM_MOVEABLE);1738 }1739 lpdmReturn = GlobalLock16(lppd->hDevMode);1740 memcpy(lpdmReturn, lpdm, lpdm->dmSize + lpdm->dmDriverExtra);1741 1742 if (lppd->hDevNames != 0) {1743 WORD locks;1744 if((locks = (GlobalFlags16(lppd->hDevNames)&GMEM_LOCKCOUNT))) {1745 WARN("hDevNames has %d locks on it. Unlocking it now\n", locks);1746 while(locks--)1747 GlobalUnlock16(lppd->hDevNames);1748 }1749 }1750 PRINTDLG_CreateDevNames16(&(lppd->hDevNames),1751 di->pDriverPath,1752 pi->pPrinterName,1753 pi->pPortName1754 );1755 GlobalUnlock16(lppd->hDevMode);1756 }1757 if (!(lppd->Flags & (PD_ENABLESETUPTEMPLATEHANDLE | PD_ENABLESETUPTEMPLATE)))1705 PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(),0,sizeof(DEVMODEA)); 1706 1707 /* and create & process the dialog . 1708 * -1 is failure, 0 is broken hwnd, everything else is ok. 1709 */ 1710 bRet = (0<DialogBoxIndirectParam16( 1711 hInst, hDlgTmpl, lppd->hwndOwner, 1712 (DLGPROC16)GetProcAddress16(GetModuleHandle16("COMMDLG"),(LPCSTR)21), 1713 (LPARAM)PrintStructures 1714 ) 1715 ); 1716 if (!PrintStructures->lpPrinterInfo) bRet = FALSE; 1717 if(bRet) { 1718 DEVMODEA *lpdm = PrintStructures->lpDevMode, *lpdmReturn; 1719 PRINTER_INFO_2A *pi = PrintStructures->lpPrinterInfo; 1720 DRIVER_INFO_3A *di = PrintStructures->lpDriverInfo; 1721 1722 if (lppd->hDevMode == 0) { 1723 TRACE(" No hDevMode yet... Need to create my own\n"); 1724 lppd->hDevMode = GlobalAlloc16(GMEM_MOVEABLE, 1725 lpdm->dmSize + lpdm->dmDriverExtra); 1726 } else { 1727 WORD locks; 1728 if((locks = (GlobalFlags16(lppd->hDevMode)&GMEM_LOCKCOUNT))) { 1729 WARN("hDevMode has %d locks on it. Unlocking it now\n", locks); 1730 while(locks--) { 1731 GlobalUnlock16(lppd->hDevMode); 1732 TRACE("Now got %d locks\n", locks); 1733 } 1734 } 1735 lppd->hDevMode = GlobalReAlloc16(lppd->hDevMode, 1736 lpdm->dmSize + lpdm->dmDriverExtra, 1737 GMEM_MOVEABLE); 1738 } 1739 lpdmReturn = GlobalLock16(lppd->hDevMode); 1740 memcpy(lpdmReturn, lpdm, lpdm->dmSize + lpdm->dmDriverExtra); 1741 1742 if (lppd->hDevNames != 0) { 1743 WORD locks; 1744 if((locks = (GlobalFlags16(lppd->hDevNames)&GMEM_LOCKCOUNT))) { 1745 WARN("hDevNames has %d locks on it. Unlocking it now\n", locks); 1746 while(locks--) 1747 GlobalUnlock16(lppd->hDevNames); 1748 } 1749 } 1750 PRINTDLG_CreateDevNames16(&(lppd->hDevNames), 1751 di->pDriverPath, 1752 pi->pPrinterName, 1753 pi->pPortName 1754 ); 1755 GlobalUnlock16(lppd->hDevMode); 1756 } 1757 if (!(lppd->Flags & (PD_ENABLESETUPTEMPLATEHANDLE | PD_ENABLESETUPTEMPLATE))) 1758 1758 GlobalFree16(hDlgTmpl); /* created from the 32 bits resource */ 1759 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);1760 HeapFree(GetProcessHeap(), 0, PrintStructures->lpPrinterInfo);1761 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDriverInfo);1762 HeapFree(GetProcessHeap(), 0, PrintStructures);1759 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode); 1760 HeapFree(GetProcessHeap(), 0, PrintStructures->lpPrinterInfo); 1761 HeapFree(GetProcessHeap(), 0, PrintStructures->lpDriverInfo); 1762 HeapFree(GetProcessHeap(), 0, PrintStructures); 1763 1763 } 1764 1764 if(bRet && (lppd->Flags & PD_RETURNDC || lppd->Flags & PD_RETURNIC)) 1765 1765 bRet = PRINTDLG_CreateDC16(lppd); 1766 1766 1767 TRACE("exit! (%d)\n", bRet); 1768 return bRet; 1767 TRACE("exit! (%d)\n", bRet); 1768 return bRet; 1769 1769 } 1770 1770 #endif … … 1798 1798 1799 1799 typedef struct { 1800 LPPAGESETUPDLGA dlga;1801 1802 PRINTDLGA pdlg;1800 LPPAGESETUPDLGA dlga; 1801 1802 PRINTDLGA pdlg; 1803 1803 } PageSetupData; 1804 1804 … … 1808 1808 1809 1809 if(lppd->Flags & PSD_ENABLEPAGESETUPTEMPLATEHANDLE) { 1810 hDlgTmpl = lppd->hPageSetupTemplate;1811 } else if(lppd->Flags & PSD_ENABLEPAGESETUPTEMPLATE) { 1812 hResInfo = FindResourceA(lppd->hInstance,1813 lppd->lpPageSetupTemplateName, RT_DIALOGA);1814 hDlgTmpl = LoadResource(lppd->hInstance, hResInfo);1810 hDlgTmpl = lppd->hPageSetupTemplate; 1811 } else if(lppd->Flags & PSD_ENABLEPAGESETUPTEMPLATE) { 1812 hResInfo = FindResourceA(lppd->hInstance, 1813 lppd->lpPageSetupTemplateName, RT_DIALOGA); 1814 hDlgTmpl = LoadResource(lppd->hInstance, hResInfo); 1815 1815 } else { 1816 hResInfo = FindResourceA(COMDLG32_hInstance,(LPCSTR)PAGESETUPDLGORD,RT_DIALOGA);1817 hDlgTmpl = LoadResource(COMDLG32_hInstance,hResInfo);1816 hResInfo = FindResourceA(COMDLG32_hInstance,(LPCSTR)PAGESETUPDLGORD,RT_DIALOGA); 1817 hDlgTmpl = LoadResource(COMDLG32_hInstance,hResInfo); 1818 1818 } 1819 1819 return hDlgTmpl; … … 1823 1823 _c_10mm2size(PAGESETUPDLGA *dlga,DWORD size) { 1824 1824 if (dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) 1825 return 10*size*10/25.4;1825 return 10*size*10/25.4; 1826 1826 /* If we don't have a flag, we can choose one. Use millimeters 1827 1827 * to avoid confusing me … … 1836 1836 _c_inch2size(PAGESETUPDLGA *dlga,DWORD size) { 1837 1837 if (dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) 1838 return size;1838 return size; 1839 1839 if (dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS) 1840 return (size*254)/10;1840 return (size*254)/10; 1841 1841 /* if we don't have a flag, we can choose one. Use millimeters 1842 1842 * to avoid confusing me … … 1850 1850 strcpy(strout,"<undef>"); 1851 1851 if (pda->dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS) { 1852 sprintf(strout,"%.2fmm",(size*1.0)/100.0);1853 return;1852 sprintf(strout,"%.2fmm",(size*1.0)/100.0); 1853 return; 1854 1854 } 1855 1855 if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) { 1856 sprintf(strout,"%.2fin",(size*1.0)/1000.0);1857 return;1856 sprintf(strout,"%.2fin",(size*1.0)/1000.0); 1857 return; 1858 1858 } 1859 1859 pda->dlga->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS; … … 1864 1864 static DWORD 1865 1865 _c_str2size(PageSetupData *pda,LPCSTR strin) { 1866 float val;1867 char rest[200];1866 float val; 1867 char rest[200]; 1868 1868 1869 1869 rest[0]='\0'; 1870 1870 if (!sscanf(strin,"%f%s",&val,rest)) 1871 return 0;1871 return 0; 1872 1872 1873 1873 if (!strcmp(rest,"in") || !strcmp(rest,"inch")) { 1874 if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES)1875 return 1000*val;1876 else1877 return val*25.4*100;1874 if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) 1875 return 1000*val; 1876 else 1877 return val*25.4*100; 1878 1878 } 1879 1879 if (!strcmp(rest,"cm")) { rest[0]='m'; val = val*10.0; } … … 1881 1881 1882 1882 if (!strcmp(rest,"mm")) { 1883 if (pda->dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS)1884 return 100*val;1885 else1886 return 1000.0*val/25.4;1883 if (pda->dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS) 1884 return 100*val; 1885 else 1886 return 1000.0*val/25.4; 1887 1887 } 1888 1888 if (rest[0]=='\0') { 1889 /* use application supplied default */1890 if (pda->dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS) {1891 /* 100*mm */1892 return 100.0*val;1893 }1894 if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) {1895 /* 1000*inch */1896 return 1000.0*val;1897 }1889 /* use application supplied default */ 1890 if (pda->dlga->Flags & PSD_INHUNDREDTHSOFMILLIMETERS) { 1891 /* 100*mm */ 1892 return 100.0*val; 1893 } 1894 if (pda->dlga->Flags & PSD_INTHOUSANDTHSOFINCHES) { 1895 /* 1000*inch */ 1896 return 1000.0*val; 1897 } 1898 1898 } 1899 1899 ERR("Did not find a conversion for type '%s'!\n",rest); … … 1908 1908 static BOOL 1909 1909 PRINTDLG_PS_UpdateDlgStruct(HWND hDlg, PageSetupData *pda) { 1910 DEVNAMES *dn;1911 DEVMODEA *dm;1912 LPSTR devname,portname;1913 char papername[64];1914 char buf[200];1915 1910 DEVNAMES *dn; 1911 DEVMODEA *dm; 1912 LPSTR devname,portname; 1913 char papername[64]; 1914 char buf[200]; 1915 1916 1916 dn = GlobalLock(pda->pdlg.hDevNames); 1917 1917 dm = GlobalLock(pda->pdlg.hDevMode); 1918 devname = ((char*)dn)+dn->wDeviceOffset;1919 portname = ((char*)dn)+dn->wOutputOffset;1918 devname = ((char*)dn)+dn->wDeviceOffset; 1919 portname = ((char*)dn)+dn->wOutputOffset; 1920 1920 PRINTDLG_SetUpPaperComboBox(hDlg,cmb2,devname,portname,dm); 1921 1921 PRINTDLG_SetUpPaperComboBox(hDlg,cmb3,devname,portname,dm); 1922 1922 1923 1923 if (GetDlgItemTextA(hDlg,cmb2,papername,sizeof(papername))>0) { 1924 PRINTDLG_PaperSize(&(pda->pdlg),papername,&(pda->dlga->ptPaperSize));1925 pda->dlga->ptPaperSize.x = _c_10mm2size(pda->dlga,pda->dlga->ptPaperSize.x);1926 pda->dlga->ptPaperSize.y = _c_10mm2size(pda->dlga,pda->dlga->ptPaperSize.y);1924 PRINTDLG_PaperSize(&(pda->pdlg),papername,&(pda->dlga->ptPaperSize)); 1925 pda->dlga->ptPaperSize.x = _c_10mm2size(pda->dlga,pda->dlga->ptPaperSize.x); 1926 pda->dlga->ptPaperSize.y = _c_10mm2size(pda->dlga,pda->dlga->ptPaperSize.y); 1927 1927 } else 1928 FIXME("could not get dialog text for papersize cmbbox?\n");1928 FIXME("could not get dialog text for papersize cmbbox?\n"); 1929 1929 #define GETVAL(id,val) if (GetDlgItemTextA(hDlg,id,buf,sizeof(buf))>0) { val = _c_str2size(pda,buf); } else { FIXME("could not get dlgitemtexta for %x\n",id); } 1930 1930 GETVAL(edt4,pda->dlga->rtMargin.left); … … 1936 1936 /* If we are in landscape, swap x and y of page size */ 1937 1937 if (IsDlgButtonChecked(hDlg, rad2)) { 1938 DWORD tmp;1939 tmp = pda->dlga->ptPaperSize.x;1940 pda->dlga->ptPaperSize.x = pda->dlga->ptPaperSize.y;1941 pda->dlga->ptPaperSize.y = tmp;1938 DWORD tmp; 1939 tmp = pda->dlga->ptPaperSize.x; 1940 pda->dlga->ptPaperSize.x = pda->dlga->ptPaperSize.y; 1941 pda->dlga->ptPaperSize.y = tmp; 1942 1942 } 1943 1943 GlobalUnlock(pda->pdlg.hDevNames); … … 1951 1951 static BOOL 1952 1952 PRINTDLG_PS_ChangePrinter(HWND hDlg, PageSetupData *pda) { 1953 DEVNAMES *dn;1954 DEVMODEA *dm;1955 LPSTR devname,portname;1956 1953 DEVNAMES *dn; 1954 DEVMODEA *dm; 1955 LPSTR devname,portname; 1956 1957 1957 dn = GlobalLock(pda->pdlg.hDevNames); 1958 1958 dm = GlobalLock(pda->pdlg.hDevMode); 1959 devname = ((char*)dn)+dn->wDeviceOffset;1960 portname = ((char*)dn)+dn->wOutputOffset;1959 devname = ((char*)dn)+dn->wDeviceOffset; 1960 portname = ((char*)dn)+dn->wOutputOffset; 1961 1961 PRINTDLG_SetUpPaperComboBox(hDlg,cmb2,devname,portname,dm); 1962 1962 PRINTDLG_SetUpPaperComboBox(hDlg,cmb3,devname,portname,dm); … … 1973 1973 case IDOK: 1974 1974 if (!PRINTDLG_PS_UpdateDlgStruct(hDlg, pda)) 1975 return(FALSE);1976 EndDialog(hDlg, TRUE);1977 return TRUE ;1975 return(FALSE); 1976 EndDialog(hDlg, TRUE); 1977 return TRUE ; 1978 1978 1979 1979 case IDCANCEL: 1980 1980 EndDialog(hDlg, FALSE); 1981 return FALSE ;1981 return FALSE ; 1982 1982 1983 1983 case psh3: { 1984 pda->pdlg.Flags= 0;1985 pda->pdlg.hwndOwner= hDlg;1986 if (PrintDlgA(&(pda->pdlg)))1987 PRINTDLG_PS_ChangePrinter(hDlg,pda);1988 return TRUE;1984 pda->pdlg.Flags = 0; 1985 pda->pdlg.hwndOwner = hDlg; 1986 if (PrintDlgA(&(pda->pdlg))) 1987 PRINTDLG_PS_ChangePrinter(hDlg,pda); 1988 return TRUE; 1989 1989 } 1990 1990 } 1991 1991 FIXME("loword (lparam) %d, wparam 0x%x, lparam %08lx, STUB mostly.\n", 1992 LOWORD(lParam),wParam,lParam1992 LOWORD(lParam),wParam,lParam 1993 1993 ); 1994 1994 return FALSE; … … 1999 1999 PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) 2000 2000 { 2001 PageSetupData *pda;2002 BOOL res = FALSE;2001 PageSetupData *pda; 2002 BOOL res = FALSE; 2003 2003 2004 2004 if (uMsg==WM_INITDIALOG) { 2005 res = TRUE;2005 res = TRUE; 2006 2006 pda = (PageSetupData*)lParam; 2007 SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",lParam);2008 if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) {2009 res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,lParam);2010 if (!res) {2011 FIXME("Setup page hook failed?\n");2012 res = TRUE;2013 }2014 }2015 if (pda->dlga->Flags & PSD_ENABLEPAGEPAINTHOOK) {2016 FIXME("PagePaintHook not yet implemented!\n");2017 }2018 if (pda->dlga->Flags & PSD_DISABLEPRINTER)2019 EnableWindow(GetDlgItem(hDlg, psh3), FALSE); 2020 if (pda->dlga->Flags & PSD_DISABLEMARGINS) {2021 EnableWindow(GetDlgItem(hDlg, edt4), FALSE); 2022 EnableWindow(GetDlgItem(hDlg, edt5), FALSE); 2023 EnableWindow(GetDlgItem(hDlg, edt6), FALSE); 2024 EnableWindow(GetDlgItem(hDlg, edt7), FALSE); 2025 }2026 /* width larger as height -> landscape */2027 if (pda->dlga->ptPaperSize.x > pda->dlga->ptPaperSize.y)2007 SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",lParam); 2008 if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) { 2009 res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,lParam); 2010 if (!res) { 2011 FIXME("Setup page hook failed?\n"); 2012 res = TRUE; 2013 } 2014 } 2015 if (pda->dlga->Flags & PSD_ENABLEPAGEPAINTHOOK) { 2016 FIXME("PagePaintHook not yet implemented!\n"); 2017 } 2018 if (pda->dlga->Flags & PSD_DISABLEPRINTER) 2019 EnableWindow(GetDlgItem(hDlg, psh3), FALSE); 2020 if (pda->dlga->Flags & PSD_DISABLEMARGINS) { 2021 EnableWindow(GetDlgItem(hDlg, edt4), FALSE); 2022 EnableWindow(GetDlgItem(hDlg, edt5), FALSE); 2023 EnableWindow(GetDlgItem(hDlg, edt6), FALSE); 2024 EnableWindow(GetDlgItem(hDlg, edt7), FALSE); 2025 } 2026 /* width larger as height -> landscape */ 2027 if (pda->dlga->ptPaperSize.x > pda->dlga->ptPaperSize.y) 2028 2028 CheckRadioButton(hDlg, rad1, rad2, rad2); 2029 else /* this is default if papersize is not set */2029 else /* this is default if papersize is not set */ 2030 2030 CheckRadioButton(hDlg, rad1, rad2, rad1); 2031 if (pda->dlga->Flags & PSD_DISABLEORIENTATION) { 2032 EnableWindow(GetDlgItem(hDlg,rad1),FALSE); 2033 EnableWindow(GetDlgItem(hDlg,rad2),FALSE); 2034 } 2035 /* We fill them out enabled or not */ 2036 if (pda->dlga->Flags & PSD_MARGINS) { 2037 char str[100]; 2038 _c_size2str(pda,pda->dlga->rtMargin.left,str); 2039 SetDlgItemTextA(hDlg,edt4,str); 2040 _c_size2str(pda,pda->dlga->rtMargin.top,str); 2041 SetDlgItemTextA(hDlg,edt5,str); 2042 _c_size2str(pda,pda->dlga->rtMargin.right,str); 2043 SetDlgItemTextA(hDlg,edt6,str); 2044 _c_size2str(pda,pda->dlga->rtMargin.bottom,str); 2045 SetDlgItemTextA(hDlg,edt7,str); 2031 if (pda->dlga->Flags & PSD_DISABLEORIENTATION) { 2032 EnableWindow(GetDlgItem(hDlg,rad1),FALSE); 2033 EnableWindow(GetDlgItem(hDlg,rad2),FALSE); 2034 } 2035 /* We fill them out enabled or not */ 2036 if (pda->dlga->Flags & PSD_MARGINS) { 2037 char str[100]; 2038 _c_size2str(pda,pda->dlga->rtMargin.left,str); 2039 SetDlgItemTextA(hDlg,edt4,str); 2040 _c_size2str(pda,pda->dlga->rtMargin.top,str); 2041 SetDlgItemTextA(hDlg,edt5,str); 2042 _c_size2str(pda,pda->dlga->rtMargin.right,str); 2043 SetDlgItemTextA(hDlg,edt6,str); 2044 _c_size2str(pda,pda->dlga->rtMargin.bottom,str); 2045 SetDlgItemTextA(hDlg,edt7,str); 2046 } else { 2047 /* default is 1 inch */ 2048 DWORD size = _c_inch2size(pda->dlga,1000); 2049 char str[20]; 2050 _c_size2str(pda,size,str); 2051 SetDlgItemTextA(hDlg,edt4,str); 2052 SetDlgItemTextA(hDlg,edt5,str); 2053 SetDlgItemTextA(hDlg,edt6,str); 2054 SetDlgItemTextA(hDlg,edt7,str); 2055 } 2056 PRINTDLG_PS_ChangePrinter(hDlg,pda); 2057 if (pda->dlga->Flags & PSD_DISABLEPAPER) { 2058 EnableWindow(GetDlgItem(hDlg,cmb2),FALSE); 2059 EnableWindow(GetDlgItem(hDlg,cmb3),FALSE); 2060 } 2061 return TRUE; 2046 2062 } else { 2047 /* default is 1 inch */ 2048 DWORD size = _c_inch2size(pda->dlga,1000); 2049 char str[20]; 2050 _c_size2str(pda,size,str); 2051 SetDlgItemTextA(hDlg,edt4,str); 2052 SetDlgItemTextA(hDlg,edt5,str); 2053 SetDlgItemTextA(hDlg,edt6,str); 2054 SetDlgItemTextA(hDlg,edt7,str); 2055 } 2056 PRINTDLG_PS_ChangePrinter(hDlg,pda); 2057 if (pda->dlga->Flags & PSD_DISABLEPAPER) { 2058 EnableWindow(GetDlgItem(hDlg,cmb2),FALSE); 2059 EnableWindow(GetDlgItem(hDlg,cmb3),FALSE); 2060 } 2061 return TRUE; 2062 } else { 2063 pda = (PageSetupData*)GetPropA(hDlg,"__WINE_PAGESETUPDLGDATA"); 2064 if (!pda) { 2065 WARN("__WINE_PAGESETUPDLGDATA prop not set?\n"); 2066 return FALSE; 2067 } 2068 if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) { 2069 res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,lParam); 2070 if (res) return res; 2071 } 2063 pda = (PageSetupData*)GetPropA(hDlg,"__WINE_PAGESETUPDLGDATA"); 2064 if (!pda) { 2065 WARN("__WINE_PAGESETUPDLGDATA prop not set?\n"); 2066 return FALSE; 2067 } 2068 if (pda->dlga->Flags & PSD_ENABLEPAGESETUPHOOK) { 2069 res = pda->dlga->lpfnPageSetupHook(hDlg,uMsg,wParam,lParam); 2070 if (res) return res; 2071 } 2072 2072 } 2073 2073 switch (uMsg) { … … 2082 2082 */ 2083 2083 BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) { 2084 HGLOBAL hDlgTmpl;2085 LPVOID ptr;2086 BOOL bRet;2087 PageSetupData *pda;2088 PRINTDLGA pdlg;2084 HGLOBAL hDlgTmpl; 2085 LPVOID ptr; 2086 BOOL bRet; 2087 PageSetupData *pda; 2088 PRINTDLGA pdlg; 2089 2089 2090 2090 #ifdef __WIN32OS2__ … … 2094 2094 if(TRACE_ON(commdlg)) { 2095 2095 char flagstr[1000] = ""; 2096 struct pd_flags *pflag = psd_flags;2097 for( ; pflag->name; pflag++) {2098 if(setupdlg->Flags & pflag->flag) {2099 strcat(flagstr, pflag->name);2100 strcat(flagstr, "|");2101 }2102 }2103 TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n"2104 "hinst %08x, flags %08lx (%s)\n",2105 setupdlg, setupdlg->hwndOwner, setupdlg->hDevMode,2106 setupdlg->hDevNames, 2107 setupdlg->hInstance, setupdlg->Flags, flagstr);2096 struct pd_flags *pflag = psd_flags; 2097 for( ; pflag->name; pflag++) { 2098 if(setupdlg->Flags & pflag->flag) { 2099 strcat(flagstr, pflag->name); 2100 strcat(flagstr, "|"); 2101 } 2102 } 2103 TRACE("(%p): hwndOwner = %08x, hDevMode = %08x, hDevNames = %08x\n" 2104 "hinst %08x, flags %08lx (%s)\n", 2105 setupdlg, setupdlg->hwndOwner, setupdlg->hDevMode, 2106 setupdlg->hDevNames, 2107 setupdlg->hInstance, setupdlg->Flags, flagstr); 2108 2108 } 2109 2109 2110 2110 /* First get default printer data, we need it right after that. */ 2111 2111 memset(&pdlg,0,sizeof(pdlg)); 2112 pdlg.lStructSize = sizeof(pdlg);2113 pdlg.Flags = PD_RETURNDEFAULT;2112 pdlg.lStructSize = sizeof(pdlg); 2113 pdlg.Flags = PD_RETURNDEFAULT; 2114 2114 bRet = PrintDlgA(&pdlg); 2115 2115 if (!bRet) return FALSE; … … 2117 2117 /* short cut exit, just return default values */ 2118 2118 if (setupdlg->Flags & PSD_RETURNDEFAULT) { 2119 setupdlg->hDevMode= pdlg.hDevMode;2120 setupdlg->hDevNames= pdlg.hDevNames;2121 /* FIXME: Just return "A4" for now. */2122 PRINTDLG_PaperSize(&pdlg,"A4",&setupdlg->ptPaperSize);2123 setupdlg->ptPaperSize.x=_c_10mm2size(setupdlg,setupdlg->ptPaperSize.x);2124 setupdlg->ptPaperSize.y=_c_10mm2size(setupdlg,setupdlg->ptPaperSize.y);2125 return TRUE;2119 setupdlg->hDevMode = pdlg.hDevMode; 2120 setupdlg->hDevNames = pdlg.hDevNames; 2121 /* FIXME: Just return "A4" for now. */ 2122 PRINTDLG_PaperSize(&pdlg,"A4",&setupdlg->ptPaperSize); 2123 setupdlg->ptPaperSize.x=_c_10mm2size(setupdlg,setupdlg->ptPaperSize.x); 2124 setupdlg->ptPaperSize.y=_c_10mm2size(setupdlg,setupdlg->ptPaperSize.y); 2125 return TRUE; 2126 2126 } 2127 2127 hDlgTmpl = PRINTDLG_GetPGSTemplate(setupdlg); 2128 2128 if (!hDlgTmpl) { 2129 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);2130 return FALSE;2129 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 2130 return FALSE; 2131 2131 } 2132 2132 ptr = LockResource( hDlgTmpl ); 2133 2133 if (!ptr) { 2134 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);2135 return FALSE;2134 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 2135 return FALSE; 2136 2136 } 2137 2137 pda = HeapAlloc(GetProcessHeap(),0,sizeof(*pda)); … … 2140 2140 2141 2141 bRet = (0<DialogBoxIndirectParamA( 2142 setupdlg->hInstance,2143 ptr,2144 setupdlg->hwndOwner,2145 PageDlgProcA,2146 (LPARAM)pda)2142 setupdlg->hInstance, 2143 ptr, 2144 setupdlg->hwndOwner, 2145 PageDlgProcA, 2146 (LPARAM)pda) 2147 2147 ); 2148 2148 return bRet; … … 2155 2155 dprintf(("PageSetupDlgA %x NOT IMPLEMENTED", setupdlg)); 2156 2156 #endif 2157 FIXME("(%p), stub!\n",setupdlg);2158 return FALSE;2157 FIXME("(%p), stub!\n",setupdlg); 2158 return FALSE; 2159 2159 } 2160 2160 … … 2175 2175 2176 2176 if (uMsg!=WM_INITDIALOG) { 2177 PrintStructures = (PRINT_PTRA*) GetWindowLongA(hDlg, DWL_USER); 2178 if (!PrintStructures)2179 return FALSE;2177 PrintStructures = (PRINT_PTRA*) GetWindowLongA(hDlg, DWL_USER); 2178 if (!PrintStructures) 2179 return FALSE; 2180 2180 } else { 2181 2181 PrintStructures = (PRINT_PTRA*) lParam; 2182 SetWindowLongA(hDlg, DWL_USER, lParam); 2183 res = PRINTDLG_WMInitDialog16(hDlg, wParam, PrintStructures); 2184 2182 SetWindowLongA(hDlg, DWL_USER, lParam); 2183 res = PRINTDLG_WMInitDialog16(hDlg, wParam, PrintStructures); 2184 2185 if(PrintStructures->dlg.lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) { 2186 res = CallWindowProc16( 2187 (WNDPROC16)PrintStructures->dlg.lpPrintDlg16->lpfnPrintHook, 2188 hDlg, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg16 2189 ); 2190 } 2191 return res; 2192 } 2193 2185 2194 if(PrintStructures->dlg.lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) { 2186 2195 res = CallWindowProc16( 2187 (WNDPROC16)PrintStructures->dlg.lpPrintDlg16->lpfnPrintHook, 2188 hDlg, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg16 2189 ); 2190 } 2191 return res; 2192 } 2193 2194 if(PrintStructures->dlg.lpPrintDlg16->Flags & PD_ENABLEPRINTHOOK) { 2195 res = CallWindowProc16( 2196 (WNDPROC16)PrintStructures->dlg.lpPrintDlg16->lpfnPrintHook, 2197 hDlg,uMsg, wParam, lParam 2198 ); 2199 if(LOWORD(res)) return res; 2196 (WNDPROC16)PrintStructures->dlg.lpPrintDlg16->lpfnPrintHook, 2197 hDlg,uMsg, wParam, lParam 2198 ); 2199 if(LOWORD(res)) return res; 2200 2200 } 2201 2201 2202 2202 switch (uMsg) { 2203 2203 case WM_COMMAND: { 2204 /* We need to map those for the 32bit window procedure, compare2205 * with 32Ato16 mapper in winproc.c2206 */2204 /* We need to map those for the 32bit window procedure, compare 2205 * with 32Ato16 mapper in winproc.c 2206 */ 2207 2207 return PRINTDLG_WMCommand( 2208 hDlg,2209 MAKEWPARAM(wParam,HIWORD(lParam)),2210 LOWORD(lParam),2211 PrintStructures2212 );2208 hDlg, 2209 MAKEWPARAM(wParam,HIWORD(lParam)), 2210 LOWORD(lParam), 2211 PrintStructures 2212 ); 2213 2213 } 2214 2214 case WM_DESTROY: 2215 DestroyIcon(PrintStructures->hCollateIcon);2216 DestroyIcon(PrintStructures->hNoCollateIcon);2215 DestroyIcon(PrintStructures->hCollateIcon); 2216 DestroyIcon(PrintStructures->hNoCollateIcon); 2217 2217 /* FIXME: don't forget to delete the paper orientation icons here! */ 2218 2218 2219 2219 return FALSE; 2220 } 2220 } 2221 2221 return res; 2222 2222 } … … 2227 2227 */ 2228 2228 LRESULT WINAPI PrintSetupDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, 2229 LPARAM lParam)2229 LPARAM lParam) 2230 2230 { 2231 2231 switch (wMsg) … … 2238 2238 switch (wParam) { 2239 2239 case IDOK: 2240 EndDialog(hWnd, TRUE);2241 return(TRUE);2240 EndDialog(hWnd, TRUE); 2241 return(TRUE); 2242 2242 case IDCANCEL: 2243 EndDialog(hWnd, FALSE);2244 return(TRUE);2243 EndDialog(hWnd, FALSE); 2244 return(TRUE); 2245 2245 } 2246 2246 return(FALSE); … … 2251 2251 2252 2252 /*********************************************************************** 2253 * PrintDlgExA (COMDLG32.@)2253 * PrintDlgExA (COMDLG32.@) 2254 2254 */ 2255 2255 HRESULT WINAPI PrintDlgExA(LPVOID lpPrintDlgExA) /* [???] FIXME: LPPRINTDLGEXA */ 2256 2256 { 2257 FIXME("stub\n");2258 return E_NOTIMPL;2257 FIXME("stub\n"); 2258 return E_NOTIMPL; 2259 2259 } 2260 2260 /*********************************************************************** 2261 * PrintDlgExW (COMDLG32.@)2261 * PrintDlgExW (COMDLG32.@) 2262 2262 */ 2263 2263 HRESULT WINAPI PrintDlgExW(LPVOID lpPrintDlgExW) /* [???] FIXME: LPPRINTDLGEXW */ 2264 2264 { 2265 FIXME("stub\n");2266 return E_NOTIMPL;2267 } 2265 FIXME("stub\n"); 2266 return E_NOTIMPL; 2267 }
Note:
See TracChangeset
for help on using the changeset viewer.
