diff options
author | miniak <milan.burda@gmail.com> | 2009-07-01 09:49:54 (GMT) |
---|---|---|
committer | Marius Storm-Olsen <marius@trolltech.com> | 2009-07-01 09:51:14 (GMT) |
commit | 55137901012db28857fe7638e63c78743e277c56 (patch) | |
tree | 2361eb3eea67287bb22b9e3fb0690733ab76625f /src/gui/dialogs/qprintdialog_win.cpp | |
parent | cfadf08a6c06ce319f6144e724f45e4923e72778 (diff) | |
download | Qt-55137901012db28857fe7638e63c78743e277c56.zip Qt-55137901012db28857fe7638e63c78743e277c56.tar.gz Qt-55137901012db28857fe7638e63c78743e277c56.tar.bz2 |
src/gui: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support
Also - Make winPeekMessage() & winPostMessage() obsolete
- FlashWindowEx, IsValidLanguageGroup functions no longer resolved
dynamically (available on >= Windows 2000)
- LoadIcon/LoadCursor -> LoadImage w/LR_SHARED for system
icons/cursors
- qsystemtrayicon_win: use Shell_NotifyIconGetRect if available
(Windows 7)
Merge-request: 604
Reviewed-by: Marius Storm-Olsen <marius@trolltech.com>
Diffstat (limited to 'src/gui/dialogs/qprintdialog_win.cpp')
-rw-r--r-- | src/gui/dialogs/qprintdialog_win.cpp | 76 |
1 files changed, 22 insertions, 54 deletions
diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index e89ce90..6022a66 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -77,27 +77,22 @@ public: QWin32PrintEnginePrivate *ep; }; -#ifndef Q_OS_WINCE -// If you change this function, make sure you also change the unicode equivalent -template <class PrintDialog, class DeviceMode> -static PrintDialog *qt_win_make_PRINTDLG(QWidget *parent, - QPrintDialog *pdlg, - QPrintDialogPrivate *d, HGLOBAL *tempDevNames) +static PRINTDLG* qt_win_make_PRINTDLG(QWidget *parent, + QPrintDialog *pdlg, + QPrintDialogPrivate *d, HGLOBAL *tempDevNames) { - PrintDialog *pd = new PrintDialog; - memset(pd, 0, sizeof(PrintDialog)); - pd->lStructSize = sizeof(PrintDialog); + PRINTDLG *pd = new PRINTDLG; + memset(pd, 0, sizeof(PRINTDLG)); + pd->lStructSize = sizeof(PRINTDLG); - void *devMode = sizeof(DeviceMode) == sizeof(DEVMODEA) - ? (void *) d->ep->devModeA() - : (void *) d->ep->devModeW(); + DEVMODE *devMode = d->ep->devMode; if (devMode) { - int size = sizeof(DeviceMode) + ((DeviceMode *) devMode)->dmDriverExtra; + int size = sizeof(DEVMODE) + devMode->dmDriverExtra; pd->hDevMode = GlobalAlloc(GHND, size); { void *dest = GlobalLock(pd->hDevMode); - memcpy(dest, d->ep->devMode, size); + memcpy(dest, devMode, size); GlobalUnlock(pd->hDevMode); } } else { @@ -140,20 +135,14 @@ static PrintDialog *qt_win_make_PRINTDLG(QWidget *parent, return pd; } -#endif // Q_OS_WINCE -// If you change this function, make sure you also change the ansi equivalent -template <typename T> -static void qt_win_clean_up_PRINTDLG(T **pd) +static void qt_win_clean_up_PRINTDLG(PRINTDLG **pd) { delete *pd; *pd = 0; } - -// If you change this function, make sure you also change the ansi equivalent -template <typename T> -static void qt_win_read_back_PRINTDLG(T *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d) +static void qt_win_read_back_PRINTDLG(PRINTDLG *pd, QPrintDialog *pdlg, QPrintDialogPrivate *d) { if (pd->Flags & PD_SELECTION) { pdlg->setPrintRange(QPrintDialog::Selection); @@ -236,32 +225,18 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() bool result; bool done; - void *pd = QT_WA_INLINE( - (void*)(qt_win_make_PRINTDLG<PRINTDLGW, DEVMODEW>(parent, q, this, tempDevNames)), - (void*)(qt_win_make_PRINTDLG<PRINTDLGA, DEVMODEA>(parent, q, this, tempDevNames)) - ); + PRINTDLG *pd = qt_win_make_PRINTDLG(parent, q, this, tempDevNames); do { done = true; - QT_WA({ - PRINTDLGW *pdw = reinterpret_cast<PRINTDLGW *>(pd); - result = PrintDlgW(pdw); - if ((pdw->Flags & PD_PAGENUMS) && (pdw->nFromPage > pdw->nToPage)) - done = false; - if (result && pdw->hDC == 0) - result = false; - else if (!result) - done = true; - }, { - PRINTDLGA *pda = reinterpret_cast<PRINTDLGA *>(pd); - result = PrintDlgA(pda); - if ((pda->Flags & PD_PAGENUMS) && (pda->nFromPage > pda->nToPage)) - done = false; - if (result && pda->hDC == 0) - result = false; - else if (!result) - done = true; - }); + result = PrintDlg(pd); + if ((pd->Flags & PD_PAGENUMS) && (pd->nFromPage > pd->nToPage)) + done = false; + if (result && pd->hDC == 0) + result = false; + else if (!result) + done = true; + if (!done) { QMessageBox::warning(0, QPrintDialog::tr("Print"), QPrintDialog::tr("The 'From' value cannot be greater than the 'To' value."), @@ -275,15 +250,8 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally() // write values back... if (result) { - QT_WA({ - PRINTDLGW *pdw = reinterpret_cast<PRINTDLGW *>(pd); - qt_win_read_back_PRINTDLG(pdw, q, this); - qt_win_clean_up_PRINTDLG(&pdw); - }, { - PRINTDLGA *pda = reinterpret_cast<PRINTDLGA *>(pd); - qt_win_read_back_PRINTDLG(pda, q, this); - qt_win_clean_up_PRINTDLG(&pda); - }); + qt_win_read_back_PRINTDLG(pd, q, this); + qt_win_clean_up_PRINTDLG(&pd); // update printer validity printer->d_func()->validPrinter = !ep->name.isEmpty(); } |