Ignore:
Timestamp:
Apr 26, 2011, 9:00:45 PM (14 years ago)
Author:
dmik
Message:

comdlg32: Made PrintDlg() use the native PM print dialog instead of the Win32 clone. This looks much more native and gives access to all printer settings. Note that PageSetupDlg() is a no-op now (always returns FALSE) but it's not really necessary since thew native dialog gives access to page settings as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/devcontext.cpp

    r21304 r21630  
    5454//
    5555//******************************************************************************
    56 static BOOL GetPMQueueName(LPSTR pDeviceName, LPSTR lpszPMQueue, INT cbPMQueue)
     56BOOL WIN32API GetPMQueueName(LPSTR pDeviceName, LPSTR lpszPMQueue, INT cbPMQueue)
    5757{
    5858    static HINSTANCE                hInstance = 0;
     
    8686    else
    8787    { //Check if it's a printer device
    88         if(GetPMQueueName((LPSTR)lpszDevice, szDevice, sizeof(szDevice)) == TRUE) 
     88        if(GetPMQueueName((LPSTR)lpszDevice, szDevice, sizeof(szDevice)) == TRUE)
    8989        {
    9090            dprintf(("Rename printer %s to PM Queue %s", lpszDevice, szDevice));
     
    149149      devmode.dmPaperSize     = arg4->dmPaperSize;
    150150      devmode.dmPaperLength   = arg4->dmPaperLength;
    151       devmode.dmPaperWidth    = arg4->dmPaperWidth;
    152 #else
    153       devmode.s1.dmOrientation   = arg4->s1.dmOrientation;
    154       devmode.s1.dmPaperSize     = arg4->s1.dmPaperSize;
    155       devmode.s1.dmPaperLength   = arg4->s1.dmPaperLength;
    156       devmode.s1.dmPaperWidth    = arg4->s1.dmPaperWidth;
    157 #endif
    158       devmode.dmScale            = arg4->dmScale;
    159       devmode.dmCopies           = arg4->dmCopies;
    160       devmode.dmDefaultSource    = arg4->dmDefaultSource;
    161       devmode.dmPrintQuality     = arg4->dmPrintQuality;
    162       devmode.dmColor            = arg4->dmColor;
    163       devmode.dmDuplex           = arg4->dmDuplex;
    164       devmode.dmYResolution      = arg4->dmYResolution;
    165       devmode.dmTTOption         = arg4->dmTTOption;
    166       devmode.dmCollate          = arg4->dmCollate;
    167       devmode.dmLogPixels        = arg4->dmLogPixels;
    168       devmode.dmBitsPerPel       = arg4->dmBitsPerPel;
    169       devmode.dmPelsWidth        = arg4->dmPelsWidth;
    170       devmode.dmPelsHeight       = arg4->dmPelsHeight;
    171       devmode.dmDisplayFlags     = arg4->dmDisplayFlags;
    172       devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
    173       devmode.dmICMMethod        = arg4->dmICMMethod;
    174       devmode.dmICMIntent        = arg4->dmICMIntent;
    175       devmode.dmMediaType        = arg4->dmMediaType;
    176       devmode.dmDitherType       = arg4->dmDitherType;
    177       devmode.dmReserved1        = arg4->dmReserved1;
    178       devmode.dmReserved2        = arg4->dmReserved2;
    179       rc = CreateDCA(astring1,astring2,astring3,&devmode);
    180     }
    181     else
    182       rc = CreateDCA(astring1,astring2,astring3, NULL);
    183 
    184     FreeAsciiString(astring1);
    185     FreeAsciiString(astring2);
    186     FreeAsciiString(astring3);
    187 
    188     if(arg4)
    189     {
    190       FreeAsciiString(astring4);
    191       FreeAsciiString(astring5);
    192     }
    193 
    194     return rc;
    195 }
    196 //******************************************************************************
    197 //******************************************************************************
    198 HDC WIN32API CreateICA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
    199                        const DEVMODEA *lpdvmInit)
    200 {
    201     HDC  hdc;
    202     char szDevice[256];
    203 
    204     //SvL: Open32 tests for "DISPLAY"
    205     if(lpszDriver && !stricmp(lpszDriver, szDisplay)) {
    206         lpszDriver = szDisplay;
    207     }
    208     else
    209     { //Check if it's a printer device
    210         if(GetPMQueueName((LPSTR)lpszDevice, szDevice, sizeof(szDevice)) == TRUE)
    211         {
    212             dprintf(("Rename printer %s to PM Queue %s", lpszDevice, szDevice));
    213             lpszDevice = szDevice;
    214             //Must ignore port name here or else the wrong queue might be used
    215             //(unless we are told to print to file)
    216             if (lpszOutput && strcmp(lpszOutput, "FILE:") != 0 && strcmp(lpszOutput, "FILE") != 0)
    217                 lpszOutput = NULL;
    218         }
    219     }
    220  
    221     //SvL: Open32 tests lpszDriver for NULL even though it's ignored
    222     if(lpszDriver == NULL) {
    223         lpszDriver = lpszDevice;
    224     }
    225     hdc = O32_CreateIC(lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
    226 
    227     dprintf(("GDI32: CreateICA %s %s %s %x returned %x", lpszDriver, lpszDevice, lpszOutput, lpdvmInit, hdc));
    228 
    229     if(hdc) STATS_CreateICA(hdc, lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
    230     return hdc;
    231 }
    232 //******************************************************************************
    233 //******************************************************************************
    234 HDC WIN32API CreateICW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
    235 {
    236     char *astring4, *astring5;
    237 
    238     char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
    239     char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
    240     char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
    241     if(arg4)
    242     {
    243       astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
    244       astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
    245     }
    246 
    247     HDC   rc;
    248     DEVMODEA devmode;
    249 
    250     if(arg4)
    251     {
    252       strcpy((char*)devmode.dmDeviceName, astring4);
    253       strcpy((char*)devmode.dmFormName, astring5);
    254 
    255       devmode.dmSpecVersion      = arg4->dmSpecVersion;
    256       devmode.dmDriverVersion    = arg4->dmDriverVersion;
    257       devmode.dmSize             = arg4->dmSize;
    258       devmode.dmDriverExtra      = arg4->dmDriverExtra;
    259       devmode.dmFields           = arg4->dmFields;
    260 #if (__IBMCPP__ == 360)
    261       devmode.dmOrientation      = arg4->dmOrientation;
    262       devmode.dmPaperSize        = arg4->dmPaperSize;
    263       devmode.dmPaperLength      = arg4->dmPaperLength;
    264       devmode.dmPaperWidth       = arg4->dmPaperWidth;
     151      devmode.dmPaperWidth    = arg4->dmPaperWidth;
    265152#else
    266153      devmode.s1.dmOrientation   = arg4->s1.dmOrientation;
     
    290177      devmode.dmReserved1        = arg4->dmReserved1;
    291178      devmode.dmReserved2        = arg4->dmReserved2;
     179      rc = CreateDCA(astring1,astring2,astring3,&devmode);
     180    }
     181    else
     182      rc = CreateDCA(astring1,astring2,astring3, NULL);
     183
     184    FreeAsciiString(astring1);
     185    FreeAsciiString(astring2);
     186    FreeAsciiString(astring3);
     187
     188    if(arg4)
     189    {
     190      FreeAsciiString(astring4);
     191      FreeAsciiString(astring5);
     192    }
     193
     194    return rc;
     195}
     196//******************************************************************************
     197//******************************************************************************
     198HDC WIN32API CreateICA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput,
     199                       const DEVMODEA *lpdvmInit)
     200{
     201    HDC  hdc;
     202    char szDevice[256];
     203
     204    //SvL: Open32 tests for "DISPLAY"
     205    if(lpszDriver && !stricmp(lpszDriver, szDisplay)) {
     206        lpszDriver = szDisplay;
     207    }
     208    else
     209    { //Check if it's a printer device
     210        if(GetPMQueueName((LPSTR)lpszDevice, szDevice, sizeof(szDevice)) == TRUE)
     211        {
     212            dprintf(("Rename printer %s to PM Queue %s", lpszDevice, szDevice));
     213            lpszDevice = szDevice;
     214            //Must ignore port name here or else the wrong queue might be used
     215            //(unless we are told to print to file)
     216            if (lpszOutput && strcmp(lpszOutput, "FILE:") != 0 && strcmp(lpszOutput, "FILE") != 0)
     217                lpszOutput = NULL;
     218        }
     219    }
     220
     221    //SvL: Open32 tests lpszDriver for NULL even though it's ignored
     222    if(lpszDriver == NULL) {
     223        lpszDriver = lpszDevice;
     224    }
     225    hdc = O32_CreateIC(lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
     226
     227    dprintf(("GDI32: CreateICA %s %s %s %x returned %x", lpszDriver, lpszDevice, lpszOutput, lpdvmInit, hdc));
     228
     229    if(hdc) STATS_CreateICA(hdc, lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
     230    return hdc;
     231}
     232//******************************************************************************
     233//******************************************************************************
     234HDC WIN32API CreateICW( LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3, const DEVMODEW * arg4)
     235{
     236    char *astring4, *astring5;
     237
     238    char *astring1 = UnicodeToAsciiString((LPWSTR)arg1);
     239    char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
     240    char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
     241    if(arg4)
     242    {
     243      astring4 = UnicodeToAsciiString((LPWSTR)(arg4->dmDeviceName));
     244      astring5 = UnicodeToAsciiString((LPWSTR)(arg4->dmFormName));
     245    }
     246
     247    HDC   rc;
     248    DEVMODEA devmode;
     249
     250    if(arg4)
     251    {
     252      strcpy((char*)devmode.dmDeviceName, astring4);
     253      strcpy((char*)devmode.dmFormName, astring5);
     254
     255      devmode.dmSpecVersion      = arg4->dmSpecVersion;
     256      devmode.dmDriverVersion    = arg4->dmDriverVersion;
     257      devmode.dmSize             = arg4->dmSize;
     258      devmode.dmDriverExtra      = arg4->dmDriverExtra;
     259      devmode.dmFields           = arg4->dmFields;
     260#if (__IBMCPP__ == 360)
     261      devmode.dmOrientation      = arg4->dmOrientation;
     262      devmode.dmPaperSize        = arg4->dmPaperSize;
     263      devmode.dmPaperLength      = arg4->dmPaperLength;
     264      devmode.dmPaperWidth       = arg4->dmPaperWidth;
     265#else
     266      devmode.s1.dmOrientation   = arg4->s1.dmOrientation;
     267      devmode.s1.dmPaperSize     = arg4->s1.dmPaperSize;
     268      devmode.s1.dmPaperLength   = arg4->s1.dmPaperLength;
     269      devmode.s1.dmPaperWidth    = arg4->s1.dmPaperWidth;
     270#endif
     271      devmode.dmScale            = arg4->dmScale;
     272      devmode.dmCopies           = arg4->dmCopies;
     273      devmode.dmDefaultSource    = arg4->dmDefaultSource;
     274      devmode.dmPrintQuality     = arg4->dmPrintQuality;
     275      devmode.dmColor            = arg4->dmColor;
     276      devmode.dmDuplex           = arg4->dmDuplex;
     277      devmode.dmYResolution      = arg4->dmYResolution;
     278      devmode.dmTTOption         = arg4->dmTTOption;
     279      devmode.dmCollate          = arg4->dmCollate;
     280      devmode.dmLogPixels        = arg4->dmLogPixels;
     281      devmode.dmBitsPerPel       = arg4->dmBitsPerPel;
     282      devmode.dmPelsWidth        = arg4->dmPelsWidth;
     283      devmode.dmPelsHeight       = arg4->dmPelsHeight;
     284      devmode.dmDisplayFlags     = arg4->dmDisplayFlags;
     285      devmode.dmDisplayFrequency = arg4->dmDisplayFrequency;
     286      devmode.dmICMMethod        = arg4->dmICMMethod;
     287      devmode.dmICMIntent        = arg4->dmICMIntent;
     288      devmode.dmMediaType        = arg4->dmMediaType;
     289      devmode.dmDitherType       = arg4->dmDitherType;
     290      devmode.dmReserved1        = arg4->dmReserved1;
     291      devmode.dmReserved2        = arg4->dmReserved2;
    292292
    293293      rc = CreateICA(astring1,astring2,astring3,&devmode);
     
    370370    if(pHps->hrgnWin32Clip) {
    371371        // Make a copy of our current clip region
    372         // (the visible region remains untouched!)     
     372        // (the visible region remains untouched!)
    373373        hClipRgn = GdiCopyClipRgn(pHps);
    374374    }
     
    420420HDC WIN32API ResetDCA(HDC hdc, const DEVMODEA *lpInitData)
    421421{
    422     if(lpInitData) 
     422    if(lpInitData)
    423423    {
    424424        dprintfDEVMODE((DEVMODEA *)lpInitData);
Note: See TracChangeset for help on using the changeset viewer.