- Timestamp:
- Apr 30, 2004, 3:25:59 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/printdlg.c
r10267 r10593 135 135 136 136 137 #ifdef __WIN32OS2__138 /***********************************************************************139 * PrnNameToQueue140 *141 * Odin helper function that gets Queue Name from Printer Name142 *143 * Returns TRUE on success else FALSE144 */145 146 BOOL PrnNameToQueue(char* PrnName, char* QueueName)147 {148 BOOL rc = FALSE;149 150 if (PrnName && QueueName)151 {152 LPPRINTER_INFO_2A pi;153 DWORD needed, num;154 INT i;155 156 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num);157 pi = HeapAlloc(GetProcessHeap(), 0, needed);158 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pi, needed, &needed,159 &num);160 161 for(i = 0; i < num; i++)162 if (!strcmp(pi[i].pComment, PrnName))163 {164 strcpy(QueueName, pi[i].pPrinterName);165 rc = TRUE;166 }167 HeapFree(GetProcessHeap(), 0, pi);168 }169 return rc;170 }171 #endif172 173 137 /*********************************************************************** 174 138 * PRINTDLG_GetDefaultPrinterName … … 255 219 INT i; 256 220 LPPRINTER_INFO_2A pi; 257 #ifdef __WIN32OS2__258 char substName[260];259 #endif260 221 261 222 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num); … … 264 225 &num); 265 226 266 #ifndef __WIN32OS2__267 227 for(i = 0; i < num; i++) { 268 228 SendDlgItemMessageA(hDlg, id, CB_ADDSTRING, 0, … … 270 230 } 271 231 HeapFree(GetProcessHeap(), 0, pi); 272 #else273 substName[0] = 0;274 275 for(i = 0; i < num; i++)276 {277 SendDlgItemMessageA(hDlg, id, CB_ADDSTRING, 0,278 (LPARAM)pi[i].pComment );279 if (!name || !strcmp(pi[i].pPrinterName, name))280 strcpy(substName, pi[i].pComment);281 }282 #endif283 232 284 233 if(!name || 285 234 (i = SendDlgItemMessageA(hDlg, id, CB_FINDSTRINGEXACT, -1, 286 #ifndef __WIN32OS2__287 235 (LPARAM)name)) == CB_ERR) { 288 #else289 (LPARAM)substName)) == CB_ERR) {290 #endif291 236 char buf[260]; 292 237 FIXME("Can't find '%s' in printer list so trying to find default\n", … … 294 239 if(!PRINTDLG_GetDefaultPrinterNameA(buf, sizeof(buf))) 295 240 return num; 296 #ifndef __WIN32OS2__297 241 i = SendDlgItemMessageA(hDlg, id, CB_FINDSTRINGEXACT, -1, (LPARAM)buf); 298 #else299 for(i = 0; i < num; i++)300 if (!strcmp(pi[i].pComment, buf))301 break;302 HeapFree(GetProcessHeap(), 0, pi);303 #endif304 242 305 243 if(i == CB_ERR) … … 1193 1131 1194 1132 if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) { 1133 #ifdef __WIN32OS2__ 1134 EnableWindow(GetDlgItem(hDlg, chx2), FALSE); 1135 EnableWindow(GetDlgItem(hDlg, ico3), FALSE); 1136 ShowWindow(GetDlgItem(hDlg, chx2), SW_HIDE); 1137 #else 1195 1138 /* if printer doesn't support it: no Collate */ 1196 1139 if (!(lpdm->dmFields & DM_COLLATE)) { … … 1198 1141 EnableWindow(GetDlgItem(hDlg, ico3), FALSE); 1199 1142 } 1143 #endif 1200 1144 } 1201 1145 … … 1356 1300 1357 1301 if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) { 1302 #ifdef __WIN32OS2__ 1303 EnableWindow(GetDlgItem(hDlg, chx2), FALSE); 1304 EnableWindow(GetDlgItem(hDlg, ico3), FALSE); 1305 ShowWindow(GetDlgItem(hDlg, chx2), SW_HIDE); 1306 #else 1358 1307 /* if printer doesn't support it: no Collate */ 1359 1308 if (!(lpdm->dmFields & DM_COLLATE)) { … … 1361 1310 EnableWindow(GetDlgItem(hDlg, ico3), FALSE); 1362 1311 } 1312 #endif 1363 1313 } 1364 1314 … … 1507 1457 name = HeapAlloc(GetProcessHeap(),0,256); 1508 1458 if (GetDlgItemTextA(hDlg, comboID, name, 255)) 1509 #ifdef __WIN32OS2__1510 PrnNameToQueue(name, name);1511 #endif1512 1459 PRINTDLG_ChangePrinterA(hDlg, name, PrintStructures); 1513 1460 HeapFree(GetProcessHeap(),0,name); … … 1516 1463 char name[200]; 1517 1464 BOOL ret = PRINTDLG_GetDefaultPrinterNameA(name, sizeof(name)); 1518 #ifdef __WIN32OS2__1519 PrnNameToQueue(name, name);1520 #endif1521 1465 if (ret) 1522 1466 PRINTDLG_ChangePrinterA(hDlg, name, PrintStructures); … … 1808 1752 1809 1753 case edt3: 1754 #ifndef __WIN32OS2__ 1810 1755 if(HIWORD(wParam) == EN_CHANGE) { 1811 1756 INT copies = GetDlgItemInt(hDlg, edt3, NULL, FALSE); … … 1815 1760 EnableWindow(GetDlgItem(hDlg, chx2), TRUE); 1816 1761 } 1762 #endif 1817 1763 break; 1818 1764 … … 1842 1788 1843 1789 GetDlgItemTextA(hDlg, PrinterComboID, PrinterName, 255); 1844 #ifdef __WIN32OS2__1845 PrnNameToQueue(PrinterName, PrinterName);1846 #endif1847 1790 if (!OpenPrinterA(PrinterName, &hPrinter, NULL)) { 1848 1791 FIXME(" Call to OpenPrinter did not succeed!\n"); … … 1891 1834 char PrinterName[256]; 1892 1835 GetDlgItemTextA(hDlg, LOWORD(wParam), PrinterName, 255); 1893 #ifdef __WIN32OS2__1894 PrnNameToQueue(PrinterName, PrinterName);1895 #endif1896 1836 PRINTDLG_ChangePrinterA(hDlg, PrinterName, PrintStructures); 1897 1837 } … … 1998 1938 1999 1939 case edt3: 1940 #ifndef __WIN32OS2__ 2000 1941 if(HIWORD(wParam) == EN_CHANGE) { 2001 1942 INT copies = GetDlgItemInt(hDlg, edt3, NULL, FALSE); … … 2005 1946 EnableWindow(GetDlgItem(hDlg, chx2), TRUE); 2006 1947 } 1948 #endif 2007 1949 break; 2008 1950 … … 2137 2079 res = PRINTDLG_WMInitDialog(hDlg, wParam, PrintStructures); 2138 2080 2139 if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) 2081 if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) { 2140 2082 res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook( 2141 2083 hDlg, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg 2142 2084 ); 2085 #ifdef __WIN32OS2__ 2086 EnableWindow(GetDlgItem(hDlg, chx2), FALSE); 2087 EnableWindow(GetDlgItem(hDlg, ico3), FALSE); 2088 ShowWindow(GetDlgItem(hDlg, chx2), SW_HIDE); 2089 #endif 2090 } 2143 2091 return res; 2144 2092 } … … 2182 2130 2183 2131 if(PrintStructures->dlg.lpPrintDlg->Flags & PD_ENABLEPRINTHOOK) 2132 { 2184 2133 res = PrintStructures->dlg.lpPrintDlg->lpfnPrintHook( 2185 2134 hDlg, uMsg, wParam, (LPARAM)PrintStructures->dlg.lpPrintDlg 2186 2135 ); 2136 #ifdef __WIN32OS2__ 2137 EnableWindow(GetDlgItem(hDlg, chx2), FALSE); 2138 EnableWindow(GetDlgItem(hDlg, ico3), FALSE); 2139 ShowWindow(GetDlgItem(hDlg, chx2), SW_HIDE); 2140 #endif 2141 } 2187 2142 return res; 2188 2143 }
Note:
See TracChangeset
for help on using the changeset viewer.