From cb7d73757f9e8771e7d8fc6b22f1acf27aac35bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Thu, 27 Oct 2005 16:01:45 +0000 Subject: [PATCH] Support for automatic setup.h in OS/2 with OW builds. __WXOS2__ final removal. Source cleaning. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/cppconst.tex | 23 ++++--- include/wx/chkconf.h | 2 + include/wx/os2/chkconf.h | 36 +++++++++++ include/wx/os2/private.h | 13 ++++ include/wx/platform.h | 2 +- include/wx/wxprec.h | 7 ++- samples/nativdlg/nativdlg.cpp | 6 +- samples/vscroll/vstest.cpp | 4 +- src/common/prntbase.cpp | 3 +- src/os2/clipbrd.cpp | 74 +++++++++++----------- src/os2/dataobj.cpp | 20 +++--- src/os2/dc.cpp | 6 +- src/os2/dcprint.cpp | 112 ++++++++++++++-------------------- src/os2/dnd.cpp | 25 +++----- src/os2/frame.cpp | 31 ++-------- src/os2/icon.cpp | 38 +++++------- src/os2/print.cpp | 24 +++++--- src/os2/window.cpp | 40 +++++------- 18 files changed, 231 insertions(+), 235 deletions(-) create mode 100644 include/wx/os2/chkconf.h diff --git a/docs/latex/wx/cppconst.tex b/docs/latex/wx/cppconst.tex index 9891f0a1c7..4863cb479b 100644 --- a/docs/latex/wx/cppconst.tex +++ b/docs/latex/wx/cppconst.tex @@ -1,4 +1,15 @@ -\section{Preprocesser symbols defined by wxWidgets}\label{cppconst} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: cppconst.tex +%% Purpose: Peprocessor symbols +%% Author: +%% Modified by: +%% Created: +%% RCS-ID: $Id$ +%% Copyright: (c) wxWidgets +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section{Preprocessor symbols defined by wxWidgets}\label{cppconst} These are preprocessor symbols used in the wxWidgets source, grouped by category (and sorted by alphabetical order inside each category). All of @@ -28,7 +39,6 @@ always tested using \texttt{#ifdef} and not \texttt{#if}. \twocolitem{\_\_WXMGL\_\_}{SciTech Soft MGL (\_\_WXUNIVERSAL\_\_ will be also defined)} \twocolitem{\_\_WXMSW\_\_}{Any Windows} -\twocolitem{\_\_WXOS2\_\_}{Identical to \_\_WXPM\_\_} \twocolitem{\_\_WXOSX\_\_}{Any Mac OS X port (either Carbon or Cocoa)} \twocolitem{\_\_WXPALMOS\_\_}{PalmOS} \twocolitem{\_\_WXPM\_\_}{OS/2 native Presentation Manager} @@ -52,7 +62,7 @@ summarize: \begin{itemize} \item If you want to test for all Mac platforms, classic and OS X, you should test both \texttt{\_\_WXMAC\_\_} and \texttt{\_\_WXCOCOA\_\_}. -\item If you want to test for any GUI Mac port under OS X, use +\item If you want to test for any GUI Mac port under OS X, use \texttt{\_\_WXOSX\_\_}. \item If you want to test for any port under Mac OS X, including, for example, wxGTK and also wxBase, use \texttt{\_\_DARWIN\_\_} (see below). @@ -125,9 +135,9 @@ compiler used. to the compiler version: $500$ is $5.0$.} \twocolitem{\_\_DJGPP\_\_}{DJGPP} \twocolitem{\_\_DIGITALMARS\_\_}{Digital Mars} -\twocolitem{\_\_GNUG\_\_}{Gnu C++ on any platform, see also +\twocolitem{\_\_GNUG\_\_}{Gnu C++ on any platform, see also \helpref{wxCHECK\_GCC\_VERSION}{wxcheckgccversion}} -\twocolitem{\_\_GNUWIN32\_\_}{Gnu-Win32 compiler, see also +\twocolitem{\_\_GNUWIN32\_\_}{Gnu-Win32 compiler, see also \helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}} \twocolitem{\_\_MINGW32\_\_}{MinGW} \twocolitem{\_\_MWERKS\_\_}{CodeWarrior MetroWerks compiler} @@ -157,7 +167,7 @@ also \helpref{wxCHECK\_VERSION}{wxcheckversion}} this case, \texttt{wx/wxprec.h} includes \texttt{wx/wx.h} which, in turn, includes a number of wxWidgets headers thus making it unnecessary to include them explicitly. However if this is not defined, you do need to include them -and so the usual idiom which allows to support both cases is to first include +and so the usual idiom which allows to support both cases is to first include \texttt{wx/wxprec.h} and then, inside \texttt{#ifndef WX\_PRECOMP}, individual headers you need.} \twocolitem{\_UNICODE and UNICODE}{both are defined if wxUSE\_UNICODE is set to $1$} @@ -175,4 +185,3 @@ don't include compiler flags needed for multithreaded code generation. This implies that wxUSE\_THREADS is $0$ and also that other (non wx-based) threading packages cannot be used neither.} \end{twocollist} - diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index a991742cb7..d5766c93d3 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -23,6 +23,8 @@ # include "wx/msw/chkconf.h" #elif defined(__WXMAC__) # include "wx/mac/chkconf.h" +#elif defined(__OS2__) +# include "wx/os2/chkconf.h" #elif defined(__WXMOTIF__) # include "wx/motif/chkconf.h" #endif diff --git a/include/wx/os2/chkconf.h b/include/wx/os2/chkconf.h new file mode 100644 index 0000000000..ea0ac4db7a --- /dev/null +++ b/include/wx/os2/chkconf.h @@ -0,0 +1,36 @@ +/* + * Name: wx/os2/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Julian Smart + * Modified by: + * Created: 01/02/97 + * RCS-ID: $Id$ + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_OS2_CHKCONF_H_ +#define _WX_OS2_CHKCONF_H_ + +#ifdef __WATCOMC__ + +/* Watcom builds for OS/2 port are setup.h driven and setup.h is + automatically generated from include/wx/setup_inc.h so we have + to disable here features not supported currently or enable + features required */ + +#if wxUSE_STACKWALKER +# undef wxUSE_STACKWALKER +# define wxUSE_STACKWALKER 0 +#endif /* wxUSE_STACKWALKER */ + +#if !wxUSE_POSTSCRIPT +# undef wxUSE_POSTSCRIPT +# define wxUSE_POSTSCRIPT 1 +#endif + +#endif /* __WATCOM__ */ + +#endif /* _WX_OS2_CHKCONF_H_ */ diff --git a/include/wx/os2/private.h b/include/wx/os2/private.h index d0773e6e6a..d5481d7add 100644 --- a/include/wx/os2/private.h +++ b/include/wx/os2/private.h @@ -20,8 +20,21 @@ #define INCL_WINSYS #define INCL_SHLERRORS #define INCL_DOS +#define INCL_WINATOM +#define INCL_WIN #include +#if defined(__WATCOMC__) && ( __WATCOMC__ < 1240 ) + // missing in OpenWatcom 1.3 but added in 1.4 + inline HATOMTBL APIENTRY WinQuerySystemAtomTable(VOID){return NULL;} + inline ULONG APIENTRY WinQueryAtomName(HATOMTBL,ATOM,PCSZ,ULONG){return 0;} + inline LONG APIENTRY GpiPointArc(HPS,PPOINTL){return GPI_ERROR;} + inline BOOL APIENTRY WinDrawPointer(HPS,LONG,LONG,HPOINTER,ULONG){return FALSE;} + inline HPOINTER APIENTRY WinCreatePointerIndirect(HWND,PPOINTERINFO){return NULLHANDLE;} + inline BOOL APIENTRY WinGetMaxPosition(HWND,PSWP){return FALSE;} + inline BOOL APIENTRY WinGetMinPosition(HWND,PSWP,PPOINTL){return FALSE;} +#endif + #if defined(__WATCOMC__) && defined(__WXMOTIF__) #include #define I_NEED_OS2_H diff --git a/include/wx/platform.h b/include/wx/platform.h index f91591ed01..50b2c69ce2 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -519,7 +519,7 @@ ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) || \ (defined(__WATCOMC__) && __WATCOMC__ >= 1200) ) && \ !defined(__DOS__) && \ - !defined(__WXOS2__) && \ + !defined(__WXPM__) && \ !defined(__WXMOTIF__) && \ !defined(__WXGTK__) && \ !defined(__WXX11__) && \ diff --git a/include/wx/wxprec.h b/include/wx/wxprec.h index 1d3844dd9c..abdb7d02a2 100644 --- a/include/wx/wxprec.h +++ b/include/wx/wxprec.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wxprec.h +// Name: wx/wxprec.h // Purpose: Includes the appropriate files for precompiled headers // Author: Julian Smart // Modified by: @@ -50,6 +50,11 @@ # include #endif +// include +#ifdef __OS2__ +# include "wx/os2/private.h" +#endif + // include the most common wx headers #include "wx/wx.h" diff --git a/samples/nativdlg/nativdlg.cpp b/samples/nativdlg/nativdlg.cpp index 4e52a9ad23..16e810f785 100644 --- a/samples/nativdlg/nativdlg.cpp +++ b/samples/nativdlg/nativdlg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: nativdlg.cpp +// Name: samples/nativdlg/nativdlg.cpp // Purpose: Native Windows dialog sample // Author: Julian Smart // Modified by: @@ -82,7 +82,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) { -#if ( defined(__WXOS2__) || defined(__WXMSW__) ) && !defined(__WXUNIVERSAL__) +#if ( defined(__WXPM__) || defined(__WXMSW__) ) && !defined(__WXUNIVERSAL__) MyDialog dialog; if (dialog.LoadNativeDialog(this, _T("dialog1"))) { @@ -108,5 +108,3 @@ void MyDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { EndModal(wxID_CANCEL); } - - diff --git a/samples/vscroll/vstest.cpp b/samples/vscroll/vstest.cpp index cddf8b9c6b..ff4b716705 100644 --- a/samples/vscroll/vstest.cpp +++ b/samples/vscroll/vstest.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: vscroll.cpp +// Name: samples/vscroll/vstest.cpp // Purpose: VScroll wxWidgets sample // Author: Vadim Zeitlin // Modified by: @@ -40,7 +40,7 @@ // ---------------------------------------------------------------------------- // the application icon (under Windows and OS/2 it is in resources) -#if !defined(__WXMSW__) && !defined(__WXOS2__) +#if !defined(__WXMSW__) && !defined(__WXPM__) #include "../sample.xpm" #endif diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 2a46570fa0..0f2e078466 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: prntbase.cpp +// Name: src/common/prntbase.cpp // Purpose: Printing framework base class implementation // Author: Julian Smart // Modified by: @@ -1513,5 +1513,4 @@ void wxPrintPreview::DetermineScaling() m_pimpl->DetermineScaling(); } - #endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/os2/clipbrd.cpp b/src/os2/clipbrd.cpp index 3474d380ab..e2c6f65912 100644 --- a/src/os2/clipbrd.cpp +++ b/src/os2/clipbrd.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: clipbrd.cpp +// Name: src/os2/clipbrd.cpp // Purpose: Clipboard functionality // Author: David Webster // Modified by: @@ -55,7 +55,7 @@ // old-style clipboard functions using Windows API // --------------------------------------------------------------------------- -static bool gs_wxClipboardIsOpen = FALSE; +static bool gs_wxClipboardIsOpen = false; bool wxOpenClipboard() { @@ -76,24 +76,24 @@ bool wxOpenClipboard() { wxLogDebug(wxT("Can not open clipboard without a main window.")); - return FALSE; + return false; } */ - return FALSE; + return false; } bool wxCloseClipboard() { - wxCHECK_MSG( gs_wxClipboardIsOpen, FALSE, wxT("clipboard is not opened") ); + wxCHECK_MSG( gs_wxClipboardIsOpen, false, wxT("clipboard is not opened") ); // TODO: /* - gs_wxClipboardIsOpen = FALSE; + gs_wxClipboardIsOpen = false; if ( ::CloseClipboard() == 0 ) { wxLogSysError(_("Failed to close the clipboard.")); - return FALSE; + return false; } */ return true; @@ -107,7 +107,7 @@ bool wxEmptyClipboard() { wxLogSysError(_("Failed to empty the clipboard.")); - return FALSE; + return false; } */ return true; @@ -137,7 +137,7 @@ static bool wxSetClipboardData(wxDataObject *data) wxLogSysError(_("Failed to allocate %dKb of memory for clipboard " "transfer."), size / 1024); - return FALSE; + return false; } LPVOID lpGlobalMemory = ::GlobalLock(hGlobal); @@ -152,7 +152,7 @@ static bool wxSetClipboardData(wxDataObject *data) wxLogSysError(_("Failed to set clipboard data in format %s"), wxDataObject::GetFormatName(format)); - return FALSE; + return false; } */ return true; @@ -160,9 +160,9 @@ static bool wxSetClipboardData(wxDataObject *data) #endif // wxUSE_DRAG_AND_DROP #endif -bool wxSetClipboardData(wxDataFormat dataFormat, - const void *data, - int width, int height) +bool wxSetClipboardData(wxDataFormat WXUNUSED(dataFormat), + const void *WXUNUSED(data), + int WXUNUSED(width), int WXUNUSED(height)) { // TODO: /* @@ -185,7 +185,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, SelectObject(hdcSrc, old); DeleteDC(hdcMem); DeleteDC(hdcSrc); - return FALSE; + return false; } HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap); @@ -242,7 +242,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, default: { wxLogError(_("Unsupported clipboard format.")); - return FALSE; + return false; } case wxDF_OEMTEXT: @@ -275,13 +275,13 @@ bool wxSetClipboardData(wxDataFormat dataFormat, { wxLogSysError(_("Failed to set clipboard data.")); - return FALSE; + return false; } */ return true; } -void *wxGetClipboardData(wxDataFormat dataFormat, long *len) +void *wxGetClipboardData(wxDataFormat WXUNUSED(dataFormat), long *WXUNUSED(len)) { // void *retval = NULL; // TODO: @@ -342,7 +342,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) case wxDF_DIB: { wxLogError(_("Unsupported clipboard format.")); - return FALSE; + return NULL; } case wxDF_OEMTEXT: @@ -414,15 +414,15 @@ wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat) return dataFormat; } -int wxRegisterClipboardFormat(wxChar *formatName) +int wxRegisterClipboardFormat(wxChar *WXUNUSED(formatName)) { // TODO: return ::RegisterClipboardFormat(formatName); return 0; } -bool wxGetClipboardFormatName(wxDataFormat dataFormat, - wxChar *formatName, - int maxCount) +bool wxGetClipboardFormatName(wxDataFormat WXUNUSED(dataFormat), + wxChar *WXUNUSED(formatName), + int WXUNUSED(maxCount)) { // TODO: return ::GetClipboardFormatName((int)dataFormat, formatName, maxCount) > 0; return 0; @@ -450,7 +450,7 @@ void wxClipboard::Clear() bool wxClipboard::Flush() { // TODO: - return FALSE; + return false; } bool wxClipboard::Open() @@ -463,7 +463,7 @@ bool wxClipboard::IsOpened() const return wxIsClipboardOpened(); } -bool wxClipboard::SetData( wxDataObject *data ) +bool wxClipboard::SetData( wxDataObject *WXUNUSED(data) ) { (void)wxEmptyClipboard(); // TODO: @@ -478,10 +478,10 @@ bool wxClipboard::SetData( wxDataObject *data ) bool wxClipboard::AddData( wxDataObject *data ) { - wxCHECK_MSG( data, FALSE, wxT("data is invalid") ); + wxCHECK_MSG( data, false, wxT("data is invalid") ); #if wxUSE_DRAG_AND_DROP - wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") ); + wxCHECK_MSG( wxIsClipboardOpened(), false, wxT("clipboard not open") ); // wxDataFormat format = data->GetPreferredFormat(); // TODO: @@ -521,9 +521,9 @@ bool wxClipboard::AddData( wxDataObject *data ) } #else // !wxUSE_DRAG_AND_DROP */ - return FALSE; + return false; #else - return FALSE; + return false; #endif // wxUSE_DRAG_AND_DROP/!wxUSE_DRAG_AND_DROP } @@ -537,9 +537,9 @@ bool wxClipboard::IsSupported( const wxDataFormat& format ) return wxIsClipboardFormatAvailable(format); } -bool wxClipboard::GetData( wxDataObject& data ) +bool wxClipboard::GetData( wxDataObject& WXUNUSED(data) ) { - wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") ); + wxCHECK_MSG( wxIsClipboardOpened(), false, wxT("clipboard not open") ); #if wxUSE_DRAG_AND_DROP // wxDataFormat format = data.GetPreferredFormat(); @@ -559,7 +559,7 @@ bool wxClipboard::GetData( wxDataObject& data ) return true; } else - return FALSE; + return false; } case wxDF_BITMAP: @@ -574,7 +574,7 @@ bool wxClipboard::GetData( wxDataObject& data ) return true; } else - return FALSE; + return false; } #if wxUSE_METAFILE case wxDF_METAFILE: @@ -588,7 +588,7 @@ bool wxClipboard::GetData( wxDataObject& data ) return true; } else - return FALSE; + return false; } #endif default: @@ -597,7 +597,7 @@ bool wxClipboard::GetData( wxDataObject& data ) void *buf = wxGetClipboardData(format, &len); if ( buf ) { - // FIXME this is for testing only!! + // FIXME this is for testing only! ((wxPrivateDataObject &)data).SetData(buf, len); free(buf); @@ -605,13 +605,13 @@ bool wxClipboard::GetData( wxDataObject& data ) } } - return FALSE; + return false; } #else */ - return FALSE; + return false; #else - return FALSE; + return false; #endif } diff --git a/src/os2/dataobj.cpp b/src/os2/dataobj.cpp index 6633b8b128..137101f053 100644 --- a/src/os2/dataobj.cpp +++ b/src/os2/dataobj.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: os2/dataobj.cpp +// Name: src/os2/dataobj.cpp // Purpose: implementation of wx[I]DataObject class // Author: David Webster // Modified by: @@ -32,8 +32,7 @@ #include "wx/mstream.h" #include "wx/image.h" -#define INCL_DOS -#include +#include "wx/os2/private.h" // ---------------------------------------------------------------------------- // functions @@ -98,7 +97,7 @@ bool CIDataObject::GetData ( const wxDataFormat& rFormat, { QueryGetData(rFormat); if (rFormat.GetType() == wxDF_INVALID) - return FALSE; + return false; ULONG ulSize = m_pDataObject->GetDataSize(rFormat); @@ -107,7 +106,7 @@ bool CIDataObject::GetData ( const wxDataFormat& rFormat, // // It probably means that the method is just not implemented // - return FALSE; + return false; } if (rFormat.GetType() == wxDF_PRIVATE) { @@ -119,7 +118,7 @@ bool CIDataObject::GetData ( const wxDataFormat& rFormat, } if (ulSize > ulLen) // not enough room to copy - return FALSE; + return false; // // Copy the data @@ -303,16 +302,13 @@ bool wxBitmapDataObject::GetDataHere( void* pBuf ) const if (!m_pngSize) { wxFAIL_MSG(wxT("attempt to copy empty bitmap failed")); - return FALSE; + return false; } memcpy(pBuf, m_pngData, m_pngSize); return true; } -bool wxBitmapDataObject::SetData( - size_t nSize -, const void* pBuf -) +bool wxBitmapDataObject::SetData( size_t nSize, const void* pBuf) { Clear(); m_pngSize = nSize; @@ -327,7 +323,7 @@ bool wxBitmapDataObject::SetData( if (!vHandler.LoadFile(&vImage, vMstream)) { - return FALSE; + return false; } m_bitmap = wxBitmap(vImage); diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index e215660198..c0f2f0b666 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dc.cpp +// Name: src/os2/dc.cpp // Purpose: wxDC class // Author: David Webster // Modified by: @@ -774,11 +774,7 @@ void wxDC::DoDrawArc( vPtlArc[0].y = vYm; vPtlArc[1].x = vX2; vPtlArc[1].y = vY2; -#if !(defined(__WATCOMC__) && __WATCOMC__ < 1240 ) -// Open Watcom 1.3 had incomplete headers -// that's reported and should be fixed for OW 1.4 ::GpiPointArc(m_hPS, vPtlArc); // Draws the arc -#endif CalcBoundingBox( (wxCoord)(vXc - dRadius) ,(wxCoord)(vYc - dRadius) ); diff --git a/src/os2/dcprint.cpp b/src/os2/dcprint.cpp index fc49df9d04..87c745f2e8 100644 --- a/src/os2/dcprint.cpp +++ b/src/os2/dcprint.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dcprint.cpp +// Name: src/os2/dcprint.cpp // Purpose: wxPrinterDC class // Author: David Webster // Modified by: @@ -34,13 +34,11 @@ IMPLEMENT_CLASS(wxPrinterDC, wxDC) // This form is deprecated -wxPrinterDC::wxPrinterDC( - const wxString& rsDriverName -, const wxString& rsDeviceName -, const wxString& rsFile -, bool bInteractive -, int nOrientation -) +wxPrinterDC::wxPrinterDC( const wxString& rsDriverName, + const wxString& rsDeviceName, + const wxString& rsFile, + bool bInteractive, + int nOrientation ) { DEVOPENSTRUC vDevOpen = { (char*)rsDeviceName.c_str() ,(char*)rsDriverName.c_str() @@ -55,7 +53,7 @@ wxPrinterDC::wxPrinterDC( m_isInteractive = bInteractive; - if (!rsFile.IsNull() && rsFile != wxT("")) + if (!rsFile.IsNull() && !rsFile.empty()) m_printData.SetFilename(rsFile); /* @@ -80,22 +78,20 @@ wxPrinterDC::wxPrinterDC( if ( PrintDlg( &pd ) != 0 ) { m_hDC = (WXHDC) pd.hDC; - m_ok = TRUE; + m_ok = true; } else { - m_ok = FALSE; + m_ok = false; return; } - - // m_dontDelete = TRUE; } else #endif */ - if ((!rsDriverName.IsNull() && rsDriverName != wxT("")) && - (!rsDeviceName.IsNull() && rsDeviceName != wxT("")) && - (!rsFile.IsNull() && rsFile != wxT(""))) + if ( !rsDriverName.empty() && + !rsDeviceName.empty() && + !rsFile.empty() ) { m_hDC = (WXHDC) ::DevOpenDC( vHabmain ,OD_QUEUED @@ -104,7 +100,7 @@ wxPrinterDC::wxPrinterDC( ,(PDEVOPENDATA)&vDevOpen ,NULLHANDLE ); - m_ok = m_hDC ? TRUE: FALSE; + m_ok = m_hDC ? true: false; } else { @@ -112,7 +108,7 @@ wxPrinterDC::wxPrinterDC( vPrintData.SetOrientation(nOrientation); m_hDC = wxGetPrinterDC(vPrintData); - m_ok = m_hDC ? TRUE: FALSE; + m_ok = m_hDC ? true: false; } if (m_hDC) @@ -125,12 +121,10 @@ wxPrinterDC::wxPrinterDC( SetPen(*wxBLACK_PEN); } // end of wxPrinterDC::wxPrinterDC -wxPrinterDC::wxPrinterDC( - const wxPrintData& rPrintData -) +wxPrinterDC::wxPrinterDC( const wxPrintData& rPrintData ) { m_printData = rPrintData; - m_isInteractive = FALSE; + m_isInteractive = false; m_hDC = wxGetPrinterDC(rPrintData); m_ok = (m_hDC != 0); if (m_hDC) @@ -139,13 +133,11 @@ wxPrinterDC::wxPrinterDC( SetPen(*wxBLACK_PEN); } // end of wxPrinterDC::wxPrinterDC -wxPrinterDC::wxPrinterDC( - WXHDC hTheDC -) +wxPrinterDC::wxPrinterDC( WXHDC hTheDC ) { - m_isInteractive = FALSE; + m_isInteractive = false; m_hDC = hTheDC; - m_ok = TRUE; + m_ok = true; if (m_hDC) { SetMapMode(wxMM_TEXT); @@ -165,9 +157,7 @@ void wxPrinterDC::Init() } } // end of wxPrinterDC::Init -bool wxPrinterDC::StartDoc( - const wxString& rsMessage -) +bool wxPrinterDC::StartDoc(const wxString& WXUNUSED(rsMessage)) { /* TODO: PM's implementation DOCINFO docinfo; @@ -176,7 +166,7 @@ bool wxPrinterDC::StartDoc( wxString filename(m_printData.GetFilename()); - if (filename.IsEmpty()) + if (filename.empty()) docinfo.lpszOutput = NULL; else docinfo.lpszOutput = (const wxChar *) filename; @@ -187,7 +177,7 @@ bool wxPrinterDC::StartDoc( #endif if (!m_hDC) - return FALSE; + return false; int ret = #ifndef __WIN32__ @@ -213,7 +203,7 @@ bool wxPrinterDC::StartDoc( #endif return (ret > 0); */ - return(TRUE); + return true; } // end of wxPrinterDC::StartDoc void wxPrinterDC::EndDoc() @@ -234,12 +224,9 @@ void wxPrinterDC::EndPage() } // end of wxPrinterDC::EndPage #if 0 // Returns default device and port names -static bool wxGetDefaultDeviceName( - wxString& rsDeviceName -, wxString& rsPortName -) +static bool wxGetDefaultDeviceName( wxString& rsDeviceName, wxString& rsPortName ) { - rsDeviceName = ""; + rsDeviceName = wxEmptyString; /* LPDEVNAMES lpDevNames; LPSTR lpszDriverName; @@ -268,7 +255,7 @@ static bool wxGetDefaultDeviceName( if (pd.hDevNames) GlobalFree(pd.hDevNames); - return FALSE; + return false; } if (pd.hDevNames) @@ -292,14 +279,12 @@ static bool wxGetDefaultDeviceName( } return ( deviceName != wxT("") ); */ - return(TRUE); + return true; } // end of wxGetDefaultDeviceName #endif // Gets an HDC for the specified printer configuration -WXHDC WXDLLEXPORT wxGetPrinterDC( - const wxPrintData& rPrintDataConst -) +WXHDC WXDLLEXPORT wxGetPrinterDC( const wxPrintData& WXUNUSED(rPrintDataConst) ) { HDC hDC = NULLHANDLE; /* @@ -312,7 +297,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC( wxChar* deviceName; wxChar* portName = (wxChar*) NULL; // Obsolete in WIN32 - if (devNameStr == wxT("")) + if (devNameStr.empty()) deviceName = (wxChar*) NULL; else deviceName = WXSTRINGCAST devNameStr; @@ -324,7 +309,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC( if ( hDevMode ) lpDevMode = (DEVMODE*) GlobalLock(hDevMode); - if (devNameStr == wxT("")) + if (devNameStr.empty()) { // Retrieve the default device name wxString portName; @@ -347,12 +332,10 @@ WXHDC WXDLLEXPORT wxGetPrinterDC( return (WXHDC) hDC; } // end of wxGetPrinterDC -void wxPrinterDC::DoDrawBitmap( - const wxBitmap& rBmp -, wxCoord vX -, wxCoord vY -, bool bUseMask -) +void wxPrinterDC::DoDrawBitmap( const wxBitmap& rBmp, + wxCoord WXUNUSED(vX), + wxCoord WXUNUSED(vY), + bool WXUNUSED(bUseMask)) { wxCHECK_RET( rBmp.Ok(), _T("invalid bitmap in wxPrinterDC::DrawBitmap") ); @@ -363,26 +346,23 @@ void wxPrinterDC::DoDrawBitmap( } // end of wxPrinterDC::DoDrawBitmap -bool wxPrinterDC::DoBlit( - wxCoord vXdest -, wxCoord vYdest -, wxCoord vWidth -, wxCoord vHeight -, wxDC* pSource -, wxCoord vXsrc -, wxCoord vYsrc -, int nRop -, bool bUseMask -, wxCoord xsrcMask -, wxCoord ysrcMask -) +bool wxPrinterDC::DoBlit( wxCoord WXUNUSED(vXdest), + wxCoord WXUNUSED(vYdest), + wxCoord WXUNUSED(vWidth), + wxCoord WXUNUSED(vHeight), + wxDC* WXUNUSED(pSource), + wxCoord WXUNUSED(vXsrc), + wxCoord WXUNUSED(vYsrc), + int WXUNUSED(nRop), + bool WXUNUSED(bUseMask), + wxCoord WXUNUSED(xsrcMask), + wxCoord WXUNUSED(ysrcMask) ) { - bool bSuccess = TRUE; + bool bSuccess = true; // TODO: return bSuccess; } // end of wxPrintDC::DoBlit - #endif //wxUSE_PRINTING_ARCHITECTURE diff --git a/src/os2/dnd.cpp b/src/os2/dnd.cpp index 35d5717f78..9100811fc9 100644 --- a/src/os2/dnd.cpp +++ b/src/os2/dnd.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: dnd.cpp +// Name: src/os2/dnd.cpp // Purpose: wxDropTarget, wxDropSource, wxDataObject implementation // Author: David Webster // Modified by: @@ -440,17 +440,12 @@ bool wxDropTarget::OnDrop ( // wxDropSource //------------------------------------------------------------------------- -wxDropSource::wxDropSource ( - wxWindow* pWin -) +wxDropSource::wxDropSource ( wxWindow* WXUNUSED(pWin) ) { Init(); } // end of wxDropSource::wxDropSource -wxDropSource::wxDropSource ( - wxDataObject& rData -, wxWindow* pWin -) +wxDropSource::wxDropSource ( wxDataObject& rData, wxWindow* WXUNUSED(pWin) ) { Init(); SetData(rData); @@ -548,13 +543,13 @@ void wxDropSource::Init () m_vDragImage.cxOffset = 0; m_vDragImage.cyOffset = 0; - HSTR hStrType = ::DrgAddStrHandle(DRT_UNKNOWN); - HSTR hStrRMF; - HSTR hStrContainer; - wxChar zFormats[128]; - wxChar zContainer[128]; - USHORT uSize = GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1; - wxChar* pzBuffer = new wxChar[uSize]; + HSTR hStrType = ::DrgAddStrHandle(DRT_UNKNOWN); + HSTR hStrRMF; + HSTR hStrContainer; + wxChar zFormats[128]; + wxChar zContainer[128]; + USHORT uSize = (USHORT)(GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat()) + 1); + wxChar* pzBuffer = new wxChar[uSize]; memset(pzBuffer, '\0', GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat())); pzBuffer[GetDataObject()->GetDataSize(GetDataObject()->GetPreferredFormat())] = '\0'; diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 85f39c89ca..f7e2e23b6f 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: frame.cpp +// Name: src/os2/frame.cpp // Purpose: wxFrame // Author: David Webster // Modified by: @@ -242,13 +242,8 @@ wxStatusBar* wxFrame::OnCreateStatusBar( ,nHeight ); - ::WinSetParent( pStatusBar->GetHWND() - ,m_hFrame - ,FALSE - ); - ::WinSetOwner( pStatusBar->GetHWND() - ,m_hFrame - ); + ::WinSetParent( pStatusBar->GetHWND(), m_hFrame, FALSE ); + ::WinSetOwner( pStatusBar->GetHWND(), m_hFrame); // // to show statusbar // @@ -310,24 +305,15 @@ void wxFrame::PositionStatusBar() #endif // wxUSE_STATUSBAR #if wxUSE_TOOLBAR -wxToolBar* wxFrame::OnCreateToolBar( - long lStyle -, wxWindowID vId -, const wxString& rsName -) +wxToolBar* wxFrame::OnCreateToolBar( long lStyle, wxWindowID vId, const wxString& rsName ) { wxToolBar* pToolBar = wxFrameBase::OnCreateToolBar( lStyle ,vId ,rsName ); - ::WinSetParent( pToolBar->GetHWND() - ,m_hFrame - ,FALSE - ); - ::WinSetOwner( pToolBar->GetHWND() - ,m_hFrame - ); + ::WinSetParent( pToolBar->GetHWND(), m_hFrame, FALSE); + ::WinSetOwner( pToolBar->GetHWND(), m_hFrame); return pToolBar; } // end of WinGuiBase_CFrame::OnCreateToolBar #endif @@ -875,17 +861,12 @@ bool wxFrame::HandlePaint() ::WinQueryWindowRect(GetHwnd(), &vRect3); -#if !(defined(__WATCOMC__) && __WATCOMC__ < 1240 ) -// Open Watcom 1.3 had incomplete headers -// that's reported and should be fixed for OW 1.4 - static const int nIconWidth = 32; static const int nIconHeight = 32; int nIconX = (int)((vRect3.xRight - nIconWidth)/2); int nIconY = (int)((vRect3.yBottom + nIconHeight)/2); ::WinDrawPointer(hPs, nIconX, nIconY, hIcon, DP_NORMAL); -#endif } ::WinEndPaint(hPs); } diff --git a/src/os2/icon.cpp b/src/os2/icon.cpp index 0c257d02c9..a7a27c525f 100644 --- a/src/os2/icon.cpp +++ b/src/os2/icon.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: icon.cpp +// Name: src/os2/icon.cpp // Purpose: wxIcon class // Author: David Webster // Modified by: @@ -73,7 +73,7 @@ wxIcon::wxIcon( const wxString& rIconFile, // So we have a modified name where replace the last three characters // with os2. Also need the extension. // - wxString sOs2Name = rIconFile.Mid(0, rIconFile.Length() - 3); + wxString sOs2Name = rIconFile.Mid(0, rIconFile.length() - 3); sOs2Name += wxT("Os2.ico"); LoadFile( sOs2Name @@ -122,21 +122,20 @@ void wxIcon::CopyFromBitmap( const wxBitmap& rBmp ) ); } - BITMAPINFOHEADER2 vHeader; - SIZEL vSize = {0, 0}; - DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L}; - HDC hDCSrc = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE); - HDC hDCDst = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE); - HPS hPSSrc = ::GpiCreatePS(vHabmain, hDCSrc, &vSize, PU_PELS | GPIA_ASSOC); - HPS hPSDst = ::GpiCreatePS(vHabmain, hDCDst, &vSize, PU_PELS | GPIA_ASSOC); - POINTL vPoint[4] = { {0, 0}, {rBmp.GetWidth(), rBmp.GetHeight()}, - {0, 0}, {rBmp.GetWidth(), rBmp.GetHeight()} - }; - POINTL vPointMask[4] = { {0, 0}, {rBmp.GetWidth(), rBmp.GetHeight() * 2}, - {0, 0}, {rBmp.GetWidth(), rBmp.GetHeight()} - }; - - POINTERINFO vIconInfo; + BITMAPINFOHEADER2 vHeader; + SIZEL vSize = {0, 0}; + DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L}; + HDC hDCSrc = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE); + HDC hDCDst = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE); + HPS hPSSrc = ::GpiCreatePS(vHabmain, hDCSrc, &vSize, PU_PELS | GPIA_ASSOC); + HPS hPSDst = ::GpiCreatePS(vHabmain, hDCDst, &vSize, PU_PELS | GPIA_ASSOC); + POINTL vPoint[4] = { {0, 0}, {rBmp.GetWidth(), rBmp.GetHeight()}, + {0, 0}, {rBmp.GetWidth(), rBmp.GetHeight()} + }; + POINTL vPointMask[4] = { {0, 0}, {rBmp.GetWidth(), rBmp.GetHeight() * 2}, + {0, 0}, {rBmp.GetWidth(), rBmp.GetHeight()} + }; + POINTERINFO vIconInfo; memset(&vIconInfo, '\0', sizeof(POINTERINFO)); vIconInfo.fPointer = FALSE; // we want an icon, not a pointer @@ -230,10 +229,6 @@ void wxIcon::CopyFromBitmap( const wxBitmap& rBmp ) vIconInfo.hbmPointer = hBmpMask; -#if !(defined(__WATCOMC__) && __WATCOMC__ < 1240 ) -// Open Watcom 1.3 had incomplete headers -// that's reported and should be fixed for OW 1.4 - HICON hIcon = ::WinCreatePointerIndirect( HWND_DESKTOP, &vIconInfo); if (!hIcon) @@ -249,7 +244,6 @@ void wxIcon::CopyFromBitmap( const wxBitmap& rBmp ) ,rBmp.GetHeight() ); } -#endif if (!rBmp.GetMask()) { diff --git a/src/os2/print.cpp b/src/os2/print.cpp index ae86ae556a..99050676ed 100644 --- a/src/os2/print.cpp +++ b/src/os2/print.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: print.cpp +// Name: src/os2/print.cpp // Purpose: Print framework // Author: David Webster // Modified by: @@ -40,13 +40,15 @@ wxOS2Printer::~wxOS2Printer() { } -bool wxOS2Printer::Print(wxWindow *parent, wxPrintout *printout, bool prompt) +bool wxOS2Printer::Print(wxWindow *WXUNUSED(parent), + wxPrintout *WXUNUSED(printout), + bool WXUNUSED(prompt)) { // TODO. See wxPostScriptPrinter::Print for hints. - return FALSE; + return false; } -wxDC* wxOS2Printer::PrintDialog(wxWindow *parent) +wxDC* wxOS2Printer::PrintDialog(wxWindow *WXUNUSED(parent)) { // TODO: /* @@ -56,15 +58,17 @@ wxDC* wxOS2Printer::PrintDialog(wxWindow *parent) return NULL; } -bool wxOS2Printer::Setup(wxWindow *parent) +bool wxOS2Printer::Setup(wxWindow *WXUNUSED(parent)) { // TODO: /* wxPrintDialog dialog(parent, & m_printData); - dialog.GetPrintData().SetSetupDialog(TRUE); +#if WXWIN_COMPATIBILITY_2_4 + dialog.GetPrintData().SetSetupDialog(true); +#endif return (dialog.ShowModal() == wxID_OK); */ - return FALSE; + return false; } /* @@ -87,13 +91,13 @@ wxOS2PrintPreview::~wxOS2PrintPreview() { } -bool wxOS2PrintPreview::Print(bool interactive) +bool wxOS2PrintPreview::Print(bool WXUNUSED(interactive)) { if (!m_printPrintout) - return FALSE; + return false; // wxOS2Printer printer(&m_printData); // return printer.Print(m_previewFrame, m_printPrintout, interactive); - return FALSE; + return false; } void wxOS2PrintPreview::DetermineScaling() diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 502e81356e..076a38ac07 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: windows.cpp +// Name: src/os2/window.cpp // Purpose: wxWindow // Author: David Webster // Modified by: @@ -1809,7 +1809,7 @@ void wxWindowOS2::GetTextExtent( const wxString& rString, hPS = ::WinGetPS(GetHwnd()); - l = rString.Length(); + l = rString.length(); if (l > 0L) { pStr = (PCH)rString.c_str(); @@ -1817,12 +1817,12 @@ void wxWindowOS2::GetTextExtent( const wxString& rString, // // In world coordinates. // - bRc = ::GpiQueryTextBox( hPS - ,l - ,pStr - ,TXTBOX_COUNT // return maximum information - ,avPoint // array of coordinates points - ); + bRc = ::GpiQueryTextBox( hPS, + l, + pStr, + TXTBOX_COUNT,// return maximum information + avPoint // array of coordinates points + ); if (bRc) { vPtMin.x = avPoint[0].x; @@ -1910,9 +1910,7 @@ bool wxWindowOS2::IsMouseInWindow() const // --------------------------------------------------------------------------- // #if wxUSE_MENUS_NATIVE -bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, - int nX, - int nY ) +bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, int nX, int nY ) { HWND hWndOwner = GetHwnd(); HWND hWndParent = GetHwnd(); @@ -3878,25 +3876,15 @@ bool wxWindowOS2::HandleGetMinMaxInfo( PSWP pSwp ) switch(pSwp->fl) { case SWP_MAXIMIZE: -#if !(defined(__WATCOMC__) && __WATCOMC__ < 1240 ) -// Open Watcom 1.3 had incomplete headers -// that's reported and should be fixed for OW 1.4 ::WinGetMaxPosition(GetHwnd(), pSwp); m_maxWidth = pSwp->cx; m_maxHeight = pSwp->cy; -#endif break; case SWP_MINIMIZE: -#if !(defined(__WATCOMC__) && __WATCOMC__ < 1240 ) -// Open Watcom 1.3 had incomplete headers -// that's reported and should be fixed for OW 1.4 ::WinGetMinPosition(GetHwnd(), pSwp, &vPoint); m_minWidth = pSwp->cx; m_minHeight = pSwp->cy; -#else - wxUnusedVar(vPoint); -#endif break; default: @@ -3955,7 +3943,7 @@ bool wxWindowOS2::HandleSysCommand( WXWPARAM wParam, // --------------------------------------------------------------------------- // mouse events // --------------------------------------------------------------------------- -//TODO!!! check against MSW +//TODO: check against MSW void wxWindowOS2::InitMouseEvent( wxMouseEvent& rEvent , int nX @@ -5168,14 +5156,14 @@ wxWindow* wxFindWindowAtPointer(wxPoint& WXUNUSED(rPt)) wxWindow* wxFindWindowAtPoint(const wxPoint& rPt) { - POINTL vPt2; + POINTL vPt2; vPt2.x = rPt.x; vPt2.y = rPt.y; - HWND hWndHit = ::WinWindowFromPoint(HWND_DESKTOP, &vPt2, FALSE); - wxWindow* pWin = wxFindWinFromHandle((WXHWND)hWndHit) ; - HWND hWnd = hWndHit; + HWND hWndHit = ::WinWindowFromPoint(HWND_DESKTOP, &vPt2, FALSE); + wxWindow* pWin = wxFindWinFromHandle((WXHWND)hWndHit) ; + HWND hWnd = hWndHit; // // Try to find a window with a wxWindow associated with it -- 2.45.2