From 6670f56440ae9209b3e2e51e06acf3bc5aaf1905 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Thu, 21 Jul 2005 17:00:07 +0000 Subject: [PATCH] wxOS2 with Open Watcom: correct PCH usage, missing headers, warning fixes, source cleaning and other Watcom adjustements. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34901 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/accel.cpp | 24 ++-- src/os2/app.cpp | 15 +-- src/os2/bitmap.cpp | 39 +++--- src/os2/bmpbuttn.cpp | 55 ++++----- src/os2/brush.cpp | 29 ++--- src/os2/button.cpp | 81 +++++------- src/os2/checkbox.cpp | 45 +++---- src/os2/choice.cpp | 14 +-- src/os2/clipbrd.cpp | 31 +++-- src/os2/combobox.cpp | 26 ++-- src/os2/control.cpp | 48 ++++---- src/os2/cursor.cpp | 13 +- src/os2/dataobj.cpp | 45 +++---- src/os2/dc.cpp | 81 ++++++------ src/os2/dcmemory.cpp | 19 ++- src/os2/dialog.cpp | 48 +++----- src/os2/dnd.cpp | 7 +- src/os2/filedlg.cpp | 8 +- src/os2/font.cpp | 72 +++++------ src/os2/fontenum.cpp | 16 +-- src/os2/fontutil.cpp | 66 +++++----- src/os2/frame.cpp | 104 +++++++--------- src/os2/gdiimage.cpp | 130 +++++++++----------- src/os2/gsockpm.cpp | 15 ++- src/os2/helpwin.cpp | 74 ++++++----- src/os2/icon.cpp | 15 ++- src/os2/iniconf.cpp | 242 ++++++++++++++++++------------------ src/os2/joystick.cpp | 30 +++-- src/os2/listbox.cpp | 22 +--- src/os2/menu.cpp | 110 ++++++++--------- src/os2/menuitem.cpp | 25 ++-- src/os2/metafile.cpp | 286 +++++++++++++++++++++++-------------------- src/os2/mimetype.cpp | 55 +++++---- src/os2/msgdlg.cpp | 13 +- src/os2/notebook.cpp | 88 ++++++------- src/os2/ownerdrw.cpp | 67 +++++----- src/os2/palette.cpp | 27 ++-- src/os2/pen.cpp | 27 ++-- src/os2/popupwin.cpp | 26 ++-- src/os2/radiobox.cpp | 108 +++++++--------- src/os2/radiobut.cpp | 20 ++- src/os2/scrolbar.cpp | 73 +++++------ src/os2/settings.cpp | 30 ++--- src/os2/slider.cpp | 116 ++++++++---------- src/os2/sound.cpp | 22 ++-- src/os2/spinbutt.cpp | 29 ++--- src/os2/spinctrl.cpp | 40 +++--- src/os2/statbmp.cpp | 20 ++- src/os2/tabctrl.cpp | 58 +++++---- src/os2/textctrl.cpp | 165 +++++++++---------------- src/os2/thread.cpp | 85 ++++++------- src/os2/toolbar.cpp | 120 +++++++----------- src/os2/toplevel.cpp | 58 ++++----- src/os2/utils.cpp | 62 ++++------ src/os2/utilsexc.cpp | 57 ++++----- src/os2/window.cpp | 282 +++++++++++++++++++----------------------- 56 files changed, 1547 insertions(+), 1936 deletions(-) diff --git a/src/os2/accel.cpp b/src/os2/accel.cpp index 044c1b28d4..34be764815 100644 --- a/src/os2/accel.cpp +++ b/src/os2/accel.cpp @@ -135,20 +135,19 @@ wxAcceleratorTable::wxAcceleratorTable( uVirt |= AF_VIRTUALKEY; } - bool bIsVirtual; - USHORT uKey = wxCharCodeWXToOS2( vaEntries[i].GetKeyCode() - ,&bIsVirtual - ); + bool bIsVirtual; + USHORT uKey = (USHORT)wxCharCodeWXToOS2( vaEntries[i].GetKeyCode(), + &bIsVirtual); if (bIsVirtual) uVirt = AF_CHAR | AF_VIRTUALKEY; - USHORT uCmd = vaEntries[i].GetCommand(); + USHORT uCmd = (USHORT)vaEntries[i].GetCommand(); pArr->aaccel[i].fs = uVirt; pArr->aaccel[i].key = uKey; pArr->aaccel[i].cmd = uCmd; } - pArr->codepage = ::WinQueryCp(wxTheApp->m_hMq); + pArr->codepage = (USHORT)::WinQueryCp(wxTheApp->m_hMq); pArr->cAccel = (USHORT)n; M_ACCELDATA->m_hAccel = ::WinCreateAccelTable( vHabmain ,pArr @@ -158,7 +157,7 @@ wxAcceleratorTable::wxAcceleratorTable( // // If we have accelerators the top window is the frame // - wxFrame* pFrame = (wxFrame*)wxTheApp->GetTopWindow(); + wxFrame* pFrame = (wxFrame*)wxTheApp->GetTopWindow(); ::WinSetAccelTable( vHabmain ,M_ACCELDATA->m_hAccel @@ -210,14 +209,12 @@ bool wxAcceleratorTable::Translate( // function for translating labels // --------------------------------------------------------------------------- -wxString wxPMTextToLabel( - const wxString& rsTitle -) +wxString wxPMTextToLabel( const wxString& rsTitle ) { - wxString sTitle; - const wxChar* zPc; + wxString sTitle; + const wxChar* zPc; - if (rsTitle.IsEmpty()) + if (rsTitle.empty()) return(sTitle); for (zPc = rsTitle.c_str(); *zPc != wxT('\0'); zPc++) @@ -247,4 +244,3 @@ wxString wxPMTextToLabel( } return(sTitle); } // end of wxPMTextToLabel - diff --git a/src/os2/app.cpp b/src/os2/app.cpp index 33d8af6bbf..7ea40472f2 100644 --- a/src/os2/app.cpp +++ b/src/os2/app.cpp @@ -56,7 +56,11 @@ #endif // -#ifndef __EMX__ +#if defined(__WATCOMC__) + +#include + +#elif !defined(__EMX__) #define select(a,b,c,d,e) bsdselect(a,b,c,d,e) extern "C" int _System bsdselect(int, @@ -488,8 +492,8 @@ void wxApp::OnIdle( if (gbInOnIdle) return; - gbInOnIdle = TRUE; - + gbInOnIdle = true; + wxAppBase::OnIdle(rEvent); #if wxUSE_DC_CACHEING @@ -661,10 +665,7 @@ HAB wxGetInstance() return vHabmain; } -void wxSetInstance( - HAB vHab -) +void wxSetInstance( HAB vHab ) { vHabmain = vHab; } - diff --git a/src/os2/bitmap.cpp b/src/os2/bitmap.cpp index a5d4955403..51b5cfdc4c 100644 --- a/src/os2/bitmap.cpp +++ b/src/os2/bitmap.cpp @@ -211,14 +211,14 @@ wxBitmap::wxBitmap( { for (nCols = 0; nCols < nBytesPerLine; nCols++) { - unsigned char ucVal = *pzSrc++; - unsigned char ucReversed = 0; - int nBits; + unsigned char ucVal = *pzSrc++; + unsigned char ucReversed = 0; + int nBits; for (nBits = 0; nBits < 8; nBits++) { ucReversed <<= 1; - ucReversed |= (ucVal & 0x01); + ucReversed = (unsigned char)(ucReversed | (ucVal & 0x01)); ucVal >>= 1; } *pzDst++ = ucReversed; @@ -242,7 +242,7 @@ wxBitmap::wxBitmap( vHeader.cx = (USHORT)nWidth; vHeader.cy = (USHORT)nHeight; vHeader.cPlanes = 1L; - vHeader.cBitCount = nDepth; + vHeader.cBitCount = (USHORT)nDepth; vHeader.usReserved = 0; memset(&vInfo, '\0', 16); @@ -250,7 +250,7 @@ wxBitmap::wxBitmap( vInfo.cx = (USHORT)nWidth; vInfo.cy = (USHORT)nHeight; vInfo.cPlanes = 1L; - vInfo.cBitCount = nDepth; + vInfo.cBitCount = (USHORT)nDepth; HBITMAP hBmp = ::GpiCreateBitmap(hPs, &vHeader, CBM_INIT, (PBYTE)pzData, &vInfo); @@ -369,7 +369,7 @@ bool wxBitmap::Create( vHeader.cx = nW; vHeader.cy = nH; vHeader.cPlanes = 1; - vHeader.cBitCount = lBitCount; + vHeader.cBitCount = (USHORT)lBitCount; hBmp = ::GpiCreateBitmap( hPSScreen ,&vHeader @@ -1181,9 +1181,7 @@ void wxBitmap::SetMask( GetBitmapData()->m_pBitmapMask = pMask; } // end of wxBitmap::SetMask -wxBitmap wxBitmap::GetBitmapForDC( - wxDC& rDc -) const +wxBitmap wxBitmap::GetBitmapForDC(wxDC& WXUNUSED(rDc)) const { return(*this); } // end of wxBitmap::GetBitmapForDC @@ -1429,18 +1427,16 @@ bool wxMask::Create( // wxBitmapHandler // ---------------------------------------------------------------------------- -bool wxBitmapHandler::Create( - wxGDIImage* pImage -, void* pData -, long lFlags -, int nWidth -, int nHeight -, int nDepth -) +bool wxBitmapHandler::Create( wxGDIImage* pImage, + void* pData, + long WXUNUSED(lFlags), + int nWidth, + int nHeight, + int nDepth) { - wxBitmap* pBitmap = wxDynamicCast( pImage - ,wxBitmap - ); + wxBitmap* pBitmap = wxDynamicCast( pImage + ,wxBitmap + ); return(pBitmap ? Create( pBitmap ,pData @@ -1589,4 +1585,3 @@ HBITMAP wxInvertMask( return hBmpInvMask; } // end of WxWinGdi_InvertMask - diff --git a/src/os2/bmpbuttn.cpp b/src/os2/bmpbuttn.cpp index af6dae09c1..ed319ad85a 100644 --- a/src/os2/bmpbuttn.cpp +++ b/src/os2/bmpbuttn.cpp @@ -25,16 +25,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) #define BUTTON_HEIGHT_FACTOR (EDIT_CONTROL_FACTOR * 1.1) -bool wxBitmapButton::Create( - wxWindow* pParent -, wxWindowID vId -, const wxBitmap& rBitmap -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, const wxValidator& rValidator -, const wxString& rsName -) +bool wxBitmapButton::Create( wxWindow* pParent, + wxWindowID vId, + const wxBitmap& rBitmap, + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + const wxValidator& rValidator, + const wxString& rsName ) { m_bmpNormal = rBitmap; SetName(rsName); @@ -97,12 +95,10 @@ bool wxBitmapButton::Create( ,nWidth ,nHeight ); - return TRUE; + return true; } // end of wxBitmapButton::Create -bool wxBitmapButton::OS2OnDraw( - WXDRAWITEMSTRUCT* pItem -) +bool wxBitmapButton::OS2OnDraw( WXDRAWITEMSTRUCT* pItem) { PUSERBUTTON pUser = (PUSERBUTTON)pItem; bool bAutoDraw = (GetWindowStyleFlag() & wxBU_AUTODRAW) != 0; @@ -159,11 +155,7 @@ bool wxBitmapButton::OS2OnDraw( // // Draw the bitmap // - vDc.DrawBitmap( *pBitmap - ,nX1 - ,nY1 - ,TRUE - ); + vDc.DrawBitmap( *pBitmap, nX1, nY1, true ); // // Draw focus / disabled state, if auto-drawing @@ -178,20 +170,18 @@ bool wxBitmapButton::OS2OnDraw( { DrawButtonFocus(vDc); } - return TRUE; + return true; } // end of wxBitmapButton::OS2OnDraw -void wxBitmapButton::DrawFace ( - wxClientDC& rDC -, bool bSel -) +void wxBitmapButton::DrawFace (wxClientDC& rDC, bool bSel) { // // Set up drawing colors // - wxPen vHiLitePen(wxColour(255, 255, 255), 2, wxSOLID); // White - wxPen vDarkShadowPen(wxColour(85, 85, 85), 2, wxSOLID); - wxColour vFaceColor(wxColour(204, 204, 204)); // Light Grey + wxPen vHiLitePen(*wxWHITE, 2, wxSOLID); // White + wxColour gray85(85, 85, 85); + wxPen vDarkShadowPen(gray85, 2, wxSOLID); + wxColour vFaceColor(204, 204, 204); // Light Grey // // Draw the main button face @@ -231,7 +221,7 @@ void wxBitmapButton::DrawButtonFocus ( wxClientDC& rDC ) { - wxPen vBlackPen(wxColour(0, 0, 0), 2, wxSOLID); + wxPen vBlackPen(*wxBLACK, 2, wxSOLID); // // Draw a thick black line around the outside of the button @@ -259,12 +249,10 @@ void wxBitmapButton::DrawButtonFocus ( ); } // end of wxBitmapButton::DrawButtonFocus -void wxBitmapButton::DrawButtonDisable( - wxClientDC& rDC -, wxBitmap& rBmp -) +void wxBitmapButton::DrawButtonDisable( wxClientDC& rDC, + wxBitmap& rBmp ) { - wxPen vGreyPen(wxColour(128, 128, 128), 2, wxSOLID); + wxPen vGreyPen(wxT("GREY"), 2, wxSOLID); // // Draw a thick black line around the outside of the button @@ -299,4 +287,3 @@ void wxBitmapButton::SetDefault() } #endif // ndef for wxUSE_BMPBUTTON - diff --git a/src/os2/brush.cpp b/src/os2/brush.cpp index 308d5bb1d4..45fadb451a 100644 --- a/src/os2/brush.cpp +++ b/src/os2/brush.cpp @@ -102,9 +102,9 @@ wxBrush::wxBrush( bool wxBrush::RealizeResource() { - BOOL bOk; - ERRORID vError; - wxString sError; + bool bOk; + ERRORID vError; + wxString sError; if (M_BRUSHDATA && M_BRUSHDATA->m_hBrush == 0L) { @@ -144,7 +144,7 @@ bool wxBrush::RealizeResource() if (M_BRUSHDATA->m_nStyle==wxTRANSPARENT) { - return TRUE; + return true; } COLORREF vPmColour = 0L; @@ -209,13 +209,13 @@ bool wxBrush::RealizeResource() M_BRUSHDATA->m_vBundle.usMixMode = FM_OVERPAINT; M_BRUSHDATA->m_vBundle.usBackMixMode = BM_OVERPAINT; - bOk = ::GpiSetAttrs( M_BRUSHDATA->m_hBrush - ,PRIM_AREA - ,ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | - ABB_SET | ABB_SYMBOL - ,ABB_REF_POINT - ,&M_BRUSHDATA->m_vBundle - ); + bOk = (bool)::GpiSetAttrs( M_BRUSHDATA->m_hBrush + ,PRIM_AREA + ,ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | + ABB_SET | ABB_SYMBOL + ,ABB_REF_POINT + ,&M_BRUSHDATA->m_vBundle + ); if (!bOk) { vError = ::WinGetLastError(vHabmain); @@ -234,14 +234,12 @@ WXHANDLE wxBrush::GetResourceHandle() return (WXHANDLE)M_BRUSHDATA->m_hBrush; } // end of wxBrush::GetResourceHandle -bool wxBrush::FreeResource( - bool WXUNUSED(bForce) -) +bool wxBrush::FreeResource( bool WXUNUSED(bForce) ) { if (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush != 0)) { M_BRUSHDATA->m_hBrush = 0; - return TRUE; + return true; } else return FALSE; } // end of wxBrush::FreeResource @@ -319,4 +317,3 @@ void wxBrush::SetPS( M_BRUSHDATA->m_hBrush = hPS; RealizeResource(); } // end of WxWinGdi_CPen::SetPS - diff --git a/src/os2/button.cpp b/src/os2/button.cpp index d75aa8258a..3e831bcf91 100644 --- a/src/os2/button.cpp +++ b/src/os2/button.cpp @@ -41,16 +41,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) // Button -bool wxButton::Create( - wxWindow* pParent -, wxWindowID vId -, const wxString& rsLbl -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, const wxValidator& rValidator -, const wxString& rsName -) +bool wxButton::Create( wxWindow* pParent, + wxWindowID vId, + const wxString& rsLbl, + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + const wxValidator& rValidator, + const wxString& rsName) { wxString rsLabel(rsLbl); if (rsLabel.empty() && wxIsStockID(vId)) @@ -112,7 +110,7 @@ bool wxButton::Create( ,rSize.y ); delete pButtonFont; - return TRUE; + return true; } // end of wxButton::Create wxButton::~wxButton() @@ -242,12 +240,8 @@ void wxButton::SetDefault() // wxWindow* pWinOldDefault = pParent->SetDefaultItem(this); - SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton) - ,FALSE - ); - SetDefaultStyle( this - ,TRUE - ); + SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton), false); + SetDefaultStyle( this, true ); } // end of wxButton::SetDefault void wxButton::SetTmpDefault() @@ -259,12 +253,8 @@ void wxButton::SetTmpDefault() wxWindow* pWinOldDefault = pParent->GetDefaultItem(); pParent->SetTmpDefaultItem(this); - SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton) - ,FALSE - ); - SetDefaultStyle( this - ,TRUE - ); + SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton), false); + SetDefaultStyle( this, true ); } // end of wxButton::SetTmpDefault void wxButton::UnsetTmpDefault() @@ -277,12 +267,8 @@ void wxButton::UnsetTmpDefault() wxWindow* pWinOldDefault = pParent->GetDefaultItem(); - SetDefaultStyle( this - ,FALSE - ); - SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton) - ,TRUE - ); + SetDefaultStyle( this, false ); + SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton), true ); } // end of wxButton::UnsetTmpDefault void wxButton::SetDefaultStyle( @@ -339,12 +325,9 @@ void wxButton::SetDefaultStyle( // event/message handlers // ---------------------------------------------------------------------------- -bool wxButton::OS2Command( - WXUINT uParam -, WXWORD wId -) +bool wxButton::OS2Command(WXUINT uParam, WXWORD WXUNUSED(wId)) { - bool bProcessed = FALSE; + bool bProcessed = false; switch (uParam) { @@ -353,21 +336,20 @@ bool wxButton::OS2Command( bProcessed = SendClickEvent(); break; } + return bProcessed; } // end of wxButton::OS2Command -WXHBRUSH wxButton::OnCtlColor( - WXHDC pDC -, WXHWND pWnd -, WXUINT nCtlColor -, WXUINT uMessage -, WXWPARAM wParam -, WXLPARAM lParam -) +WXHBRUSH wxButton::OnCtlColor( WXHDC WXUNUSED(pDC), + WXHWND WXUNUSED(pWnd), + WXUINT WXUNUSED(nCtlColor), + WXUINT WXUNUSED(uMessage), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam) ) { - wxBrush* pBackgroundBrush = wxTheBrushList->FindOrCreateBrush( GetBackgroundColour() - ,wxSOLID - ); + wxBrush* pBackgroundBrush = wxTheBrushList->FindOrCreateBrush( GetBackgroundColour() + ,wxSOLID + ); return (WXHBRUSH)pBackgroundBrush->GetResourceHandle(); } // end of wxButton::OnCtlColor @@ -408,11 +390,9 @@ WXDWORD wxButton::OS2GetStyle( return dwStyle; } // end of wxButton::OS2GetStyle -MRESULT wxButton::WindowProc( - WXUINT uMsg -, WXWPARAM wParam -, WXLPARAM lParam -) +MRESULT wxButton::WindowProc( WXUINT uMsg, + WXWPARAM wParam, + WXLPARAM lParam ) { // // When we receive focus, we want to temporary become the default button in @@ -455,4 +435,3 @@ MRESULT wxButton::WindowProc( ,lParam )); } // end of wxWindowProc - diff --git a/src/os2/checkbox.cpp b/src/os2/checkbox.cpp index e4df892446..b83deaa481 100644 --- a/src/os2/checkbox.cpp +++ b/src/os2/checkbox.cpp @@ -41,18 +41,14 @@ extern void wxAssociateWinWithHandle( HWND hWnd // wxCheckBox // ---------------------------------------------------------------------------- -bool wxCheckBox::OS2Command( - WXUINT WXUNUSED(uParam) -, WXWORD WXUNUSED(wId) -) +bool wxCheckBox::OS2Command( WXUINT WXUNUSED(uParam), + WXWORD WXUNUSED(wId) ) { - wxCommandEvent rEvent( wxEVT_COMMAND_CHECKBOX_CLICKED - ,m_windowId - ); + wxCommandEvent rEvent( wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId ); rEvent.SetInt(GetValue()); rEvent.SetEventObject(this); ProcessCommand(rEvent); - return TRUE; + return true; } // end of wxCheckBox::OS2Command bool wxCheckBox::Create( @@ -128,11 +124,11 @@ wxSize wxCheckBox::DoGetBestSize() const nCheckSize = vDc.GetCharHeight(); } - int nWidthCheckbox; - int nHeightCheckbox; - wxString sStr = wxGetWindowText(GetHWND()); + int nWidthCheckbox; + int nHeightCheckbox; + wxString sStr = wxGetWindowText(GetHWND()); - if (!sStr.IsEmpty()) + if (!sStr.empty()) { GetTextExtent( sStr ,&nWidthCheckbox @@ -182,16 +178,14 @@ void wxCheckBox::Command ( // wxBitmapCheckBox // ---------------------------------------------------------------------------- -bool wxBitmapCheckBox::Create( - wxWindow* pParent -, wxWindowID vId -, const wxBitmap* pLabel -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, const wxValidator& rValidator -, const wxString& rsName -) +bool wxBitmapCheckBox::Create( wxWindow* pParent, + wxWindowID vId, + const wxBitmap* WXUNUSED(pLabel), + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + const wxValidator& rValidator, + const wxString& rsName) { SetName(rsName); #if wxUSE_VALIDATORS @@ -234,13 +228,10 @@ bool wxBitmapCheckBox::Create( ); ::WinShowWindow(hButton, TRUE); - return TRUE; + return true; } // end of wxBitmapCheckBox::Create -void wxBitmapCheckBox::SetLabel( - const wxBitmap& rBitmap -) +void wxBitmapCheckBox::SetLabel( const wxBitmap& WXUNUSED(rBitmap) ) { wxFAIL_MSG(wxT("not implemented")); } // end of wxBitmapCheckBox::SetLabel - diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp index 7a5cee5085..f150164252 100644 --- a/src/os2/choice.cpp +++ b/src/os2/choice.cpp @@ -327,13 +327,11 @@ wxClientData* wxChoice::DoGetItemClientObject( // wxOS2 specific helpers // ---------------------------------------------------------------------------- -void wxChoice::DoSetSize( - int nX -, int nY -, int nWidth -, int nHeight -, int nSizeFlags -) +void wxChoice::DoSetSize(int nX, + int nY, + int nWidth, + int WXUNUSED(nHeight), + int nSizeFlags) { // // Ignore height parameter because height doesn't mean 'initially @@ -345,7 +343,7 @@ void wxChoice::DoSetSize( wxControl::DoSetSize( nX ,nY ,nWidth - ,-1 + ,wxDefaultCoord ,nSizeFlags ); } // end of wxChoice::DoSetSize diff --git a/src/os2/clipbrd.cpp b/src/os2/clipbrd.cpp index efb52d4ea3..3474d380ab 100644 --- a/src/os2/clipbrd.cpp +++ b/src/os2/clipbrd.cpp @@ -59,7 +59,7 @@ static bool gs_wxClipboardIsOpen = FALSE; bool wxOpenClipboard() { - wxCHECK_MSG( !gs_wxClipboardIsOpen, TRUE, wxT("clipboard already opened.") ); + wxCHECK_MSG( !gs_wxClipboardIsOpen, true, wxT("clipboard already opened.") ); // TODO: /* wxWindow *win = wxTheApp->GetTopWindow(); @@ -96,7 +96,7 @@ bool wxCloseClipboard() return FALSE; } */ - return TRUE; + return true; } bool wxEmptyClipboard() @@ -110,7 +110,7 @@ bool wxEmptyClipboard() return FALSE; } */ - return TRUE; + return true; } bool wxIsClipboardOpened() @@ -118,10 +118,10 @@ bool wxIsClipboardOpened() return gs_wxClipboardIsOpen; } -bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) +bool wxIsClipboardFormatAvailable(wxDataFormat WXUNUSED(dataFormat)) { // TODO: return ::IsClipboardFormatAvailable(dataFormat) != 0; - return FALSE; + return false; } #if 0 @@ -155,7 +155,7 @@ static bool wxSetClipboardData(wxDataObject *data) return FALSE; } */ - return TRUE; + return true; } #endif // wxUSE_DRAG_AND_DROP #endif @@ -278,7 +278,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, return FALSE; } */ - return TRUE; + return true; } void *wxGetClipboardData(wxDataFormat dataFormat, long *len) @@ -329,7 +329,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) wxBM->SetWidth(bm.bmWidth); wxBM->SetHeight(bm.bmHeight); wxBM->SetDepth(bm.bmPlanes); - wxBM->SetOk(TRUE); + wxBM->SetOk(true); retval = wxBM; break; } @@ -471,9 +471,9 @@ bool wxClipboard::SetData( wxDataObject *data ) if ( data ) return AddData(data); else - return TRUE; + return true; */ - return TRUE; + return true; } bool wxClipboard::AddData( wxDataObject *data ) @@ -556,7 +556,7 @@ bool wxClipboard::GetData( wxDataObject& data ) { textDataObject.SetText(s); delete[] s; - return TRUE; + return true; } else return FALSE; @@ -571,7 +571,7 @@ bool wxClipboard::GetData( wxDataObject& data ) { bitmapDataObject.SetBitmap(* bitmap); delete bitmap; - return TRUE; + return true; } else return FALSE; @@ -585,7 +585,7 @@ bool wxClipboard::GetData( wxDataObject& data ) { metaFileDataObject.SetMetafile(*metaFile); delete metaFile; - return TRUE; + return true; } else return FALSE; @@ -601,7 +601,7 @@ bool wxClipboard::GetData( wxDataObject& data ) ((wxPrivateDataObject &)data).SetData(buf, len); free(buf); - return TRUE; + return true; } } @@ -615,7 +615,4 @@ bool wxClipboard::GetData( wxDataObject& data ) #endif } -#else - #error "Please turn wxUSE_CLIPBOARD on to compile this file." #endif // wxUSE_CLIPBOARD - diff --git a/src/os2/combobox.cpp b/src/os2/combobox.cpp index 6f342c5506..ccd8e120d9 100644 --- a/src/os2/combobox.cpp +++ b/src/os2/combobox.cpp @@ -9,13 +9,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/combobox.h" - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifndef WX_PRECOMP - #include "wx/setup.h" + #include "wx/defs.h" #include "wx/settings.h" #endif @@ -279,11 +277,9 @@ wxTextPos wxComboBox::GetLastPosition() const return lLineLength; } // end of wxComboBox::GetLastPosition -void wxComboBox::Replace( - long lFrom -, long lTo -, const wxString& rsValue -) +void wxComboBox::Replace( long lFrom, + long lTo, + const wxString& rsValue ) { #if wxUSE_CLIPBOARD HWND hWnd = GetHwnd(); @@ -307,19 +303,23 @@ void wxComboBox::Replace( // Paste into edit control // ::WinSendMsg(hWnd, EM_PASTE, (MPARAM)0, (MPARAM)0L); +#else + wxUnusedVar(lFrom); + wxUnusedVar(lTo); + wxUnusedVar(rsValue); #endif } // end of wxComboBox::Replace -void wxComboBox::Remove( - long lFrom -, long lTo -) +void wxComboBox::Remove( long lFrom, long lTo) { #if wxUSE_CLIPBOARD HWND hWnd = GetHwnd(); ::WinSendMsg(hWnd, EM_SETSEL, MPFROM2SHORT((USHORT)lFrom, (USHORT)lTo), 0); ::WinSendMsg(hWnd, EM_CUT, (MPARAM)0, (MPARAM)0); +#else + wxUnusedVar(lFrom); + wxUnusedVar(lTo); #endif } // end of wxComboBox::Remove @@ -401,7 +401,6 @@ bool wxComboBox::ProcessEditMsg( return(HandleSetFocus((WXHWND)(HWND)wParam)); else return(HandleKillFocus((WXHWND)(HWND)wParam)); - break; } return false; } // end of WinGuiBase_CComboBox::ProcessEditMsg @@ -442,4 +441,3 @@ MRESULT EXPENTRY wxComboEditWndProc( #endif // wxUSE_COMBOBOX - diff --git a/src/os2/control.cpp b/src/os2/control.cpp index 83a67ce7ee..0b16771501 100644 --- a/src/os2/control.cpp +++ b/src/os2/control.cpp @@ -65,7 +65,7 @@ bool wxControl::Create( wxControl::~wxControl() { - m_isBeingDeleted = TRUE; + m_isBeingDeleted = true; } bool wxControl::OS2CreateControl( @@ -90,14 +90,12 @@ bool wxControl::OS2CreateControl( ); } // end of wxControl::OS2CreateControl -bool wxControl::OS2CreateControl( - const wxChar* zClassname -, WXDWORD dwStyle -, const wxPoint& rPos -, const wxSize& rSize -, const wxString& rsLabel -, WXDWORD dwExstyle -) +bool wxControl::OS2CreateControl( const wxChar* zClassname, + WXDWORD dwStyle, + const wxPoint& rPos, + const wxSize& rSize, + const wxString& rsLabel, + WXDWORD dwExstyle ) { // // Doesn't do anything at all under OS/2 @@ -105,7 +103,7 @@ bool wxControl::OS2CreateControl( if (dwExstyle == (WXDWORD)-1) { dwExstyle = 0; - (void) OS2GetStyle(GetWindowStyle(), &dwExstyle); + (void) OS2GetStyle(GetWindowStyle(), &dwExstyle); } // // All controls should have these styles (wxWidgets creates all controls @@ -178,7 +176,7 @@ bool wxControl::OS2CreateControl( ,rSize.x ,rSize.y ); - return TRUE; + return true; } // end of wxControl::OS2CreateControl wxSize wxControl::DoGetBestSize() const @@ -191,18 +189,16 @@ bool wxControl::ProcessCommand(wxCommandEvent& event) return GetEventHandler()->ProcessEvent(event); } -WXHBRUSH wxControl::OnCtlColor( - WXHDC hWxDC -, WXHWND hWnd -, WXUINT uCtlColor -, WXUINT uMessage -, WXWPARAM wParam -, WXLPARAM lParam -) +WXHBRUSH wxControl::OnCtlColor(WXHDC hWxDC, + WXHWND WXUNUSED(hWnd), + WXUINT WXUNUSED(uCtlColor), + WXUINT WXUNUSED(uMessage), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam)) { - HPS hPS = (HPS)hWxDC; // pass in a PS handle in OS/2 - wxColour vColFore = GetForegroundColour(); - wxColour vColBack = GetBackgroundColour(); + HPS hPS = (HPS)hWxDC; // pass in a PS handle in OS/2 + wxColour vColFore = GetForegroundColour(); + wxColour vColBack = GetBackgroundColour(); if (GetParent()->GetTransparentBackground()) ::GpiSetBackMix(hPS, BM_LEAVEALONE); @@ -212,9 +208,9 @@ WXHBRUSH wxControl::OnCtlColor( ::GpiSetBackColor(hPS, vColBack.GetPixel()); ::GpiSetColor(hPS, vColFore.GetPixel()); - wxBrush* pBrush = wxTheBrushList->FindOrCreateBrush( vColBack - ,wxSOLID - ); + wxBrush* pBrush = wxTheBrushList->FindOrCreateBrush( vColBack + ,wxSOLID + ); return (WXHBRUSH)pBrush->GetResourceHandle(); } // end of wxControl::OnCtlColor @@ -292,5 +288,3 @@ void wxFindMaxSize( if (nBottom < pRect->yBottom) pRect->yBottom = nBottom; } // end of wxFindMaxSize - - diff --git a/src/os2/cursor.cpp b/src/os2/cursor.cpp index b2413b0df2..f1b3bed9c2 100644 --- a/src/os2/cursor.cpp +++ b/src/os2/cursor.cpp @@ -97,14 +97,12 @@ wxCursor::wxCursor( } // end of wxCursor::wxCursor -wxCursor::wxCursor( - const wxString& rsCursorFile -, long lFlags -, int nHotSpotX -, int nHotSpotY -) +wxCursor::wxCursor( const wxString& WXUNUSED(rsCursorFile), + long lFlags, + int WXUNUSED(nHotSpotX), + int WXUNUSED(nHotSpotY) ) { - wxCursorRefData* pRefData = new wxCursorRefData; + wxCursorRefData* pRefData = new wxCursorRefData; pRefData = new wxCursorRefData; m_refData = pRefData; @@ -324,4 +322,3 @@ void wxSetCursor(const wxCursor& cursor) (*g_globalCursor) = cursor; } } - diff --git a/src/os2/dataobj.cpp b/src/os2/dataobj.cpp index e0941f6268..683c8a4ed4 100644 --- a/src/os2/dataobj.cpp +++ b/src/os2/dataobj.cpp @@ -25,11 +25,13 @@ #include "wx/wxprec.h" #ifndef WX_PRECOMP -#include "wx/intl.h" + #include "wx/defs.h" + #include "wx/intl.h" + #include "wx/log.h" #endif -#include "wx/defs.h" -#include "wx/log.h" +#if wxUSE_DATAOBJ + #include "wx/dataobj.h" #include "wx/mstream.h" #include "wx/image.h" @@ -94,11 +96,9 @@ private: DRAGITEM m_vDragItem; }; // end of CLASS CIDataObject -bool CIDataObject::GetData ( - const wxDataFormat& rFormat -, char* pzBuffer -, ULONG ulLen -) +bool CIDataObject::GetData ( const wxDataFormat& rFormat, + char* pzBuffer, + ULONG ulLen ) { QueryGetData(rFormat); if (rFormat.GetType() == wxDF_INVALID) @@ -132,7 +132,7 @@ bool CIDataObject::GetData ( ,pzBuffer ,ulSize ); - return TRUE; + return true; } // end of CIDataObject::GetData void CIDataObject::GetDataHere( @@ -225,9 +225,7 @@ wxDataObject::~wxDataObject () // wxFileDataObject // ---------------------------------------------------------------------------- -bool wxFileDataObject::GetDataHere( - void* pBuf -) const +bool wxFileDataObject::GetDataHere( void* pBuf ) const { wxString sFilenames; @@ -238,7 +236,7 @@ bool wxFileDataObject::GetDataHere( } memcpy(pBuf, sFilenames.mbc_str(), sFilenames.Len() + 1); - return TRUE; + return true; } size_t wxFileDataObject::GetDataSize() const @@ -254,18 +252,16 @@ size_t wxFileDataObject::GetDataSize() const return nRes + 1; } -bool wxFileDataObject::SetData( - size_t WXUNUSED(nSize) -, const void* pBuf -) +bool wxFileDataObject::SetData( size_t WXUNUSED(nSize), + const void* pBuf ) { /* TODO */ - wxString sFile((const wxChar *)pBuf); /* char, not wxChar */ + wxString sFile((const wxChar *)pBuf); /* char, not wxChar */ AddFile(sFile); - return TRUE; + return true; } void wxFileDataObject::AddFile( @@ -299,18 +295,14 @@ wxBitmapDataObject::~wxBitmapDataObject() Clear(); } -void wxBitmapDataObject::SetBitmap( - const wxBitmap& rBitmap -) +void wxBitmapDataObject::SetBitmap( const wxBitmap& rBitmap ) { ClearAll(); wxBitmapDataObjectBase::SetBitmap(rBitmap); DoConvertToPng(); } -bool wxBitmapDataObject::GetDataHere( - void* pBuf -) const +bool wxBitmapDataObject::GetDataHere( void* pBuf ) const { if (!m_pngSize) { @@ -318,7 +310,7 @@ bool wxBitmapDataObject::GetDataHere( return FALSE; } memcpy(pBuf, m_pngData, m_pngSize); - return TRUE; + return true; } bool wxBitmapDataObject::SetData( @@ -369,3 +361,4 @@ void wxBitmapDataObject::DoConvertToPng() #endif } +#endif // wxUSE_DATAOBJ diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index c433083e44..d4d149e747 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -221,7 +221,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache( vBmpHdr.cx = nWidth; vBmpHdr.cy = nHeight; vBmpHdr.cPlanes = 1; - vBmpHdr.cBitCount = nDepth; + vBmpHdr.cBitCount = (USHORT)nDepth; pEntry->m_hBitmap = (WXHBITMAP) ::GpiCreateBitmap( hPS ,&vBmpHdr @@ -244,7 +244,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache( vBmpHdr.cx = nWidth; vBmpHdr.cy = nHeight; vBmpHdr.cPlanes = 1; - vBmpHdr.cBitCount = nDepth; + vBmpHdr.cBitCount = (USHORT)nDepth; WXHBITMAP hBitmap = (WXHBITMAP) ::GpiCreateBitmap( hPS ,&vBmpHdr @@ -774,7 +774,10 @@ void wxDC::DoDrawArc( vPtlArc[0].y = vYm; vPtlArc[1].x = vX2; vPtlArc[1].y = vY2; +#ifndef __WATCOMC__ + // FIXME: incomplete headers ??? ::GpiPointArc(m_hPS, vPtlArc); // Draws the arc +#endif CalcBoundingBox( (wxCoord)(vXc - dRadius) ,(wxCoord)(vYc - dRadius) ); @@ -1291,7 +1294,9 @@ void wxDC::DoDrawBitmap( , bool bUseMask ) { +#if wxUSE_PRINTING_ARCHITECTURE if (!IsKindOf(CLASSINFO(wxPrinterDC))) +#endif { HBITMAP hBitmap = (HBITMAP)rBmp.GetHBITMAP(); HBITMAP hBitmapOld = NULLHANDLE; @@ -1871,9 +1876,7 @@ void wxDC::DoDrawRotatedText( // set GDI objects // --------------------------------------------------------------------------- -void wxDC::DoSelectPalette( - bool bRealize -) +void wxDC::DoSelectPalette( bool WXUNUSED(bRealize) ) { // // Set the old object temporarily, in case the assignment deletes an object @@ -2166,9 +2169,7 @@ void wxDC::SetRop( ::GpiSetMix((HPS)hDC, lCRop); } // end of wxDC::SetRop -bool wxDC::StartDoc( - const wxString& rsMessage -) +bool wxDC::StartDoc( const wxString& WXUNUSED(rsMessage) ) { // We might be previewing, so return true to let it continue. return true; @@ -2488,19 +2489,17 @@ wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const // bit blit // --------------------------------------------------------------------------- -bool wxDC::DoBlit( - wxCoord vXdest -, wxCoord vYdest -, wxCoord vWidth -, wxCoord vHeight -, wxDC* pSource -, wxCoord vXsrc -, wxCoord vYsrc -, int nRop -, bool bUseMask -, wxCoord vXsrcMask -, wxCoord vYsrcMask -) +bool wxDC::DoBlit( wxCoord vXdest, + wxCoord vYdest, + wxCoord vWidth, + wxCoord vHeight, + wxDC* pSource, + wxCoord vXsrc, + wxCoord vYsrc, + int nRop, + bool bUseMask, + wxCoord WXUNUSED(vXsrcMask), + wxCoord WXUNUSED(vYsrcMask) ) { wxMask* pMask = NULL; CHARBUNDLE vCbnd; @@ -2594,7 +2593,6 @@ bool wxDC::DoBlit( vBmpHdr.cBitCount = 24; #if wxUSE_DC_CACHEING - if (true) { // // create a temp buffer bitmap and DCs to access it and the mask @@ -2613,9 +2611,9 @@ bool wxDC::DoBlit( hPSMask = pDCCacheEntry1->m_hPS; hDCBuffer = (HDC)pDCCacheEntry2->m_hPS; hBufBitmap = (HBITMAP)pBitmapCacheEntry->m_hBitmap; + wxUnusedVar(hDCMask); } - else -#endif +#else { hDCMask = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDOP, NULLHANDLE); hDCBuffer = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDOP, NULLHANDLE); @@ -2623,6 +2621,7 @@ bool wxDC::DoBlit( hPSBuffer = ::GpiCreatePS(vHabmain, hDCBuffer, &vSize, PU_PELS | GPIT_MICRO | GPIA_ASSOC); hBufBitmap = ::GpiCreateBitmap(GetHPS(), &vBmpHdr, 0L, NULL, NULL); } +#endif POINTL aPoint1[4] = { {0, 0} ,{vWidth, vHeight} @@ -2800,10 +2799,8 @@ void wxDC::DoGetSize( } }; // end of wxDC::DoGetSize( -void wxDC::DoGetSizeMM( - int* pnWidth -, int* pnHeight -) const +void wxDC::DoGetSizeMM( int* pnWidth, + int* pnHeight ) const { LONG lArray[CAPS_VERTICAL_RESOLUTION]; @@ -2813,17 +2810,19 @@ void wxDC::DoGetSizeMM( ,lArray )) { - int nWidth; - int nHeight; - int nHorzRes; - int nVertRes; + if(pnWidth) + { + int nWidth = lArray[CAPS_WIDTH]; + int nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter + *pnWidth = (nHorzRes/1000) * nWidth; + } - nWidth = lArray[CAPS_WIDTH]; - nHeight = lArray[CAPS_HEIGHT]; - nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter - nVertRes = lArray[CAPS_VERTICAL_RESOLUTION]; // returns pel/meter - nWidth = (nHorzRes/1000) * nWidth; - nHeight = (nVertRes/1000) * nHeight; + if(pnHeight) + { + int nHeight = lArray[CAPS_HEIGHT]; + int nVertRes = lArray[CAPS_VERTICAL_RESOLUTION]; // returns pel/meter + *pnHeight = (nVertRes/1000) * nHeight; + } } }; // end of wxDC::DoGetSizeMM @@ -2851,7 +2850,8 @@ wxSize wxDC::GetPPI() const nWidth = (int)((nHorzRes/39.3) * nPelWidth); nHeight = (int)((nVertRes/39.3) * nPelHeight); } - return (wxSize(nWidth,nHeight)); + wxSize ppisize(nWidth, nHeight); + return ppisize; } // end of wxDC::GetPPI void wxDC::SetLogicalScale( @@ -2862,6 +2862,3 @@ void wxDC::SetLogicalScale( m_logicalScaleX = dX; m_logicalScaleY = dY; }; // end of wxDC::SetLogicalScale - - - diff --git a/src/os2/dcmemory.cpp b/src/os2/dcmemory.cpp index 95c5e30a56..26e11bfe8d 100644 --- a/src/os2/dcmemory.cpp +++ b/src/os2/dcmemory.cpp @@ -58,14 +58,12 @@ void wxMemoryDC::Init() memset(&m_vRclPaint, 0, sizeof(m_vRclPaint)); } // end of wxMemoryDC::Init -bool wxMemoryDC::CreateCompatible( - wxDC* pDC -) +bool wxMemoryDC::CreateCompatible( wxDC* WXUNUSED(pDC) ) { - HDC hDC; - HPS hPS; - DEVOPENSTRUC vDOP = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L}; - SIZEL vSize = {0, 0}; + HDC hDC; + HPS hPS; + DEVOPENSTRUC vDOP = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L}; + SIZEL vSize = {0, 0}; // // Create a memory device context @@ -78,8 +76,8 @@ bool wxMemoryDC::CreateCompatible( { m_hPS = hPS; m_hDC = hDC; - m_ok = TRUE; - m_bOwnsDC = TRUE; + m_ok = true; + m_bOwnsDC = true; // // Set the wxWidgets color table // @@ -117,7 +115,7 @@ bool wxMemoryDC::CreateCompatible( // // As we created the DC, we must delete it in the dtor // - m_bOwnsDC = TRUE; + m_bOwnsDC = true; m_ok = m_hDC != 0; return m_ok; } // end of wxMemoryDC::CreateCompatible @@ -202,4 +200,3 @@ void wxMemoryDC::DoGetSize( *pWidth = m_vSelectedBitmap.GetWidth(); *pHeight = m_vSelectedBitmap.GetHeight(); } // end of wxMemoryDC::DoGetSize - diff --git a/src/os2/dialog.cpp b/src/os2/dialog.cpp index 81a0ff45e7..1872c4fd4e 100644 --- a/src/os2/dialog.cpp +++ b/src/os2/dialog.cpp @@ -89,15 +89,13 @@ void wxDialog::Init() SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); } // end of wxDialog::Init -bool wxDialog::Create( - wxWindow* pParent -, wxWindowID vId -, const wxString& rsTitle -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, const wxString& rsName -) +bool wxDialog::Create( wxWindow* pParent, + wxWindowID vId, + const wxString& rsTitle, + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + const wxString& rsName ) { Init(); SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); @@ -120,7 +118,8 @@ bool wxDialog::Create( ,lStyle ,rsName )) - return FALSE; + return false; + SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); // @@ -128,7 +127,7 @@ bool wxDialog::Create( // if (!rsTitle.IsNull()) SetTitle(rsTitle); - return TRUE; + return true; } // end of wxDialog::Create // deprecated ctor @@ -156,7 +155,7 @@ void wxDialog::SetModal( wxDialog::~wxDialog() { - m_isBeingDeleted = TRUE; + m_isBeingDeleted = true; // this will also reenable all the other windows for a modal dialog Show(false); @@ -280,7 +279,7 @@ bool wxDialog::Show( } // end of wxDialog::Show // -// Replacement for Show(TRUE) for modal dialogs - returns return code +// Replacement for Show(true) for modal dialogs - returns return code // int wxDialog::ShowModal() { @@ -372,18 +371,14 @@ void wxDialog::EndDialog(int rc) // wxWin event handlers // ---------------------------------------------------------------------------- -void wxDialog::OnApply( - wxCommandEvent& rEvent -) +void wxDialog::OnApply( wxCommandEvent& WXUNUSED(rEvent) ) { if (Validate()) TransferDataFromWindow(); } // end of wxDialog::OnApply // Standard buttons -void wxDialog::OnOK( - wxCommandEvent& rEvent -) +void wxDialog::OnOK( wxCommandEvent& WXUNUSED(rEvent) ) { if ( Validate() && TransferDataFromWindow() ) { @@ -391,16 +386,12 @@ void wxDialog::OnOK( } } // end of wxDialog::OnOK -void wxDialog::OnCancel( - wxCommandEvent& rEvent -) +void wxDialog::OnCancel( wxCommandEvent& WXUNUSED(rEvent) ) { EndDialog(wxID_CANCEL); } // end of wxDialog::OnCancel -void wxDialog::OnCloseWindow( - wxCloseEvent& rEvent -) +void wxDialog::OnCloseWindow( wxCloseEvent& WXUNUSED(rEvent) ) { // // We'll send a Cancel message by default, which may close the dialog. @@ -427,7 +418,7 @@ void wxDialog::OnCloseWindow( closing.Append(this); - wxCommandEvent vCancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); + wxCommandEvent vCancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); vCancelEvent.SetEventObject( this ); GetEventHandler()->ProcessEvent(vCancelEvent); // This may close the dialog @@ -435,9 +426,7 @@ void wxDialog::OnCloseWindow( closing.DeleteObject(this); } // end of wxDialog::OnCloseWindow -void wxDialog::OnSysColourChanged( - wxSysColourChangedEvent& rEvent -) +void wxDialog::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(rEvent) ) { SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); Refresh(); @@ -470,4 +459,3 @@ MRESULT wxDialog::OS2WindowProc( ); return rc; } // end of wxDialog::OS2WindowProc - diff --git a/src/os2/dnd.cpp b/src/os2/dnd.cpp index d4f18cc809..3a2492f741 100644 --- a/src/os2/dnd.cpp +++ b/src/os2/dnd.cpp @@ -13,6 +13,11 @@ #pragma implementation "dnd.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if wxUSE_DRAG_AND_DROP + #include "wx/window.h" #include "wx/app.h" #include "wx/gdicmn.h" @@ -22,8 +27,6 @@ #define INCL_DOS #include -#if wxUSE_DRAG_AND_DROP - // ---------------------------------------------------------------------------- // global // ---------------------------------------------------------------------------- diff --git a/src/os2/filedlg.cpp b/src/os2/filedlg.cpp index c7e65a98a0..eb13f40443 100644 --- a/src/os2/filedlg.cpp +++ b/src/os2/filedlg.cpp @@ -16,6 +16,8 @@ #pragma hdrstop #endif +#if wxUSE_FILEDLG + #ifndef WX_PRECOMP #include "wx/utils.h" #include "wx/msgdlg.h" @@ -55,6 +57,7 @@ #ifndef MAXEXT # define MAXEXT 5 #endif + IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase) // ---------------------------------------------------------------------------- @@ -207,7 +210,7 @@ int wxFileDialog::ShowModal() } if (nCount == 0) sDir += m_fileName; - if (sDir.IsEmpty()) + if (sDir.empty()) sDir = wxT("*.*"); wxStrcpy((wxChar*)vFileDlg.szFullFile, sDir); sFilterBuffer = sDir; @@ -253,7 +256,7 @@ int wxFileDialog::ShowModal() ,&m_fileName ,&sExt ); - if (zFileNameBuffer[nIdx] == wxT('.') || sExt.IsEmpty()) + if (zFileNameBuffer[nIdx] == wxT('.') || sExt.empty()) { zFileNameBuffer[nIdx] = wxT('\0'); @@ -321,3 +324,4 @@ int wxFileDialog::ShowModal() return wxID_CANCEL; } // end of wxFileDialog::ShowModal +#endif // wxUSE_FILEDLG diff --git a/src/os2/font.cpp b/src/os2/font.cpp index cbb29b48a5..f4077c70f8 100644 --- a/src/os2/font.cpp +++ b/src/os2/font.cpp @@ -9,6 +9,9 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + // ============================================================================ // declarations // ============================================================================ @@ -17,10 +20,6 @@ // headers // ---------------------------------------------------------------------------- - #include -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - #ifndef WX_PRECOMP #include #include "wx/setup.h" @@ -39,6 +38,8 @@ #include "wx/tokenzr.h" +#include + IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) // ---------------------------------------------------------------------------- @@ -260,7 +261,7 @@ protected: ,WXHANDLE hPS = 0 ); // - // If TRUE, the pointer to the actual font is temporary and SHOULD NOT BE + // If true, the pointer to the actual font is temporary and SHOULD NOT BE // DELETED by destructor // bool m_bTemporary; @@ -347,13 +348,13 @@ void wxFontRefData::Init( m_hFont = hFont; m_nFontId = (int)hFont; - m_bNativeFontInfoOk = TRUE; + m_bNativeFontInfoOk = true; m_vNativeFontInfo = rInfo; if (hPS == NULLHANDLE) { m_hPS = ::WinGetPS(HWND_DESKTOP); - m_bInternalPS = TRUE; + m_bInternalPS = true; } else m_hPS = (HPS)hPS; @@ -369,9 +370,7 @@ wxFontRefData::~wxFontRefData() Free(); } -bool wxFontRefData::Alloc( - wxFont* pFont -) +bool wxFontRefData::Alloc( wxFont* pFont ) { wxString sFaceName; long flId = m_hFont; @@ -389,7 +388,7 @@ bool wxFontRefData::Alloc( ,sFaceName ,pFont ); - m_bNativeFontInfoOk = TRUE; + m_bNativeFontInfoOk = true; } else { @@ -514,7 +513,7 @@ bool wxFontRefData::Alloc( // Select the font into the Presentation space // ::GpiSetCharSet(m_hPS, flId); // sets font for presentation space - return TRUE; + return true; } // end of wxFontRefData::Alloc void wxFontRefData::Free() @@ -741,9 +740,7 @@ void wxNativeFontInfo::SetFamily( } } // end of wxNativeFontInfo::SetFamily -void wxNativeFontInfo::SetEncoding( - wxFontEncoding eEncoding -) +void wxNativeFontInfo::SetEncoding( wxFontEncoding eEncoding ) { wxNativeEncodingInfo vInfo; @@ -771,12 +768,10 @@ void wxNativeFontInfo::SetEncoding( vInfo.charset = 850; } } - fa.usCodePage = vInfo.charset; + fa.usCodePage = (USHORT)vInfo.charset; } // end of wxNativeFontInfo::SetFaceName -bool wxNativeFontInfo::FromString( - const wxString& rsStr -) +bool wxNativeFontInfo::FromString( const wxString& rsStr ) { long lVal; @@ -839,7 +834,7 @@ bool wxNativeFontInfo::FromString( if(!sToken) return FALSE; wxStrcpy((wxChar*)fa.szFacename, sToken.c_str()); - return TRUE; + return true; } // end of wxNativeFontInfo::FromString wxString wxNativeFontInfo::ToString() const @@ -870,17 +865,15 @@ void wxFont::Init() { } // end of wxFont::Init -bool wxFont::Create( - const wxNativeFontInfo& rInfo -, WXHFONT hFont -) +bool wxFont::Create( const wxNativeFontInfo& rInfo, + WXHFONT hFont ) { UnRef(); m_refData = new wxFontRefData( rInfo ,hFont ); RealizeResource(); - return TRUE; + return true; } // end of wxFont::Create wxFont::wxFont( @@ -897,15 +890,13 @@ wxFont::wxFont( // Constructor for a font. Note that the real construction is done // in wxDC::SetFont, when information is available about scaling etc. // ---------------------------------------------------------------------------- -bool wxFont::Create( - int nPointSize -, int nFamily -, int nStyle -, int nWeight -, bool bUnderlined -, const wxString& rsFaceName -, wxFontEncoding vEncoding -) +bool wxFont::Create( int nPointSize, + int nFamily, + int nStyle, + int nWeight, + bool bUnderlined, + const wxString& rsFaceName, + wxFontEncoding vEncoding ) { UnRef(); @@ -926,7 +917,7 @@ bool wxFont::Create( ,vEncoding ); RealizeResource(); - return TRUE; + return true; } // end of wxFont::Create wxFont::~wxFont() @@ -944,21 +935,19 @@ bool wxFont::RealizeResource() { if ( GetResourceHandle() ) { - return TRUE; + return true; } return M_FONTDATA->Alloc(this); } // end of wxFont::RealizeResource -bool wxFont::FreeResource( - bool bForce -) +bool wxFont::FreeResource( bool WXUNUSED(bForce) ) { if (GetResourceHandle()) { M_FONTDATA->Free(); - return TRUE; + return true; } - return FALSE; + return false; } // end of wxFont::FreeResource WXHANDLE wxFont::GetResourceHandle() @@ -1167,4 +1156,3 @@ void wxFont::SetPS( RealizeResource(); } // end of wxFont::SetPS - diff --git a/src/os2/fontenum.cpp b/src/os2/fontenum.cpp index d85e98f18e..fd03159a47 100644 --- a/src/os2/fontenum.cpp +++ b/src/os2/fontenum.cpp @@ -66,7 +66,7 @@ private: // if not empty, enum only the fonts with this facename wxString m_facename; - // if TRUE, enum only fixed fonts + // if true, enum only fixed fonts bool m_fixedOnly; }; @@ -109,7 +109,7 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) m_charset = info.charset; m_facename = info.facename; - return TRUE; + return true; } #define wxFONTENUMPROC FONTENUMPROC @@ -153,7 +153,7 @@ bool wxFontEnumeratorHelper::OnFont(/*const LPLOGFONT lf, if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH ) { // not a fixed pitch font - return TRUE; + return true; } } @@ -162,13 +162,13 @@ bool wxFontEnumeratorHelper::OnFont(/*const LPLOGFONT lf, // check that we have the right encoding if ( lf->lfCharSet != m_charset ) { - return TRUE; + return true; } } return m_fontEnum->OnFacename(lf->lfFaceName); */ - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -187,14 +187,14 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, } // else: no such fonts, unknown encoding - return TRUE; + return true; } -bool wxFontEnumerator::EnumerateEncodings(const wxString& family) +bool wxFontEnumerator::EnumerateEncodings(const wxString& WXUNUSED(family)) { wxFAIL_MSG(wxT("TODO")); - return TRUE; + return true; } // ---------------------------------------------------------------------------- diff --git a/src/os2/fontutil.cpp b/src/os2/fontutil.cpp index aac250ae03..ed91187204 100644 --- a/src/os2/fontutil.cpp +++ b/src/os2/fontutil.cpp @@ -8,10 +8,6 @@ // Copyright: (c) 1999 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#define DEBUG_PRINTF(NAME) { static int raz=0; \ - printf( #NAME " %i\n",raz); fflush(stdout); \ - raz++; \ - } // ============================================================================ // declarations @@ -28,6 +24,13 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#define DEBUG_PRINTF(NAME) \ + { \ + static int raz=0; \ + printf( #NAME " %i\n",raz); fflush(stdout); \ + raz++; \ + } + #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/string.h" @@ -54,9 +57,7 @@ // convert to/from the string representation: format is // encodingid;facename[;charset] -bool wxNativeEncodingInfo::FromString( - const wxString& rsStr -) +bool wxNativeEncodingInfo::FromString( const wxString& rsStr ) { wxStringTokenizer vTokenizer(rsStr, _T(";")); wxString sEncid = vTokenizer.GetNextToken(); @@ -83,7 +84,7 @@ bool wxNativeEncodingInfo::FromString( return FALSE; } } - return TRUE; + return true; } // end of wxNativeEncodingInfo::FromString wxString wxNativeEncodingInfo::ToString() const @@ -103,10 +104,8 @@ wxString wxNativeEncodingInfo::ToString() const // helper functions // ---------------------------------------------------------------------------- -bool wxGetNativeFontEncoding( - wxFontEncoding vEncoding -, wxNativeEncodingInfo* pInfo -) +bool wxGetNativeFontEncoding( wxFontEncoding vEncoding, + wxNativeEncodingInfo* pInfo ) { wxCHECK_MSG(pInfo, FALSE, _T("bad pointer in wxGetNativeFontEncoding") ); if (vEncoding == wxFONTENCODING_DEFAULT) @@ -168,7 +167,7 @@ bool wxGetNativeFontEncoding( pInfo->charset = 850; break; } - return TRUE; + return true; } // end of wxGetNativeFontEncoding wxFontEncoding wxGetFontEncFromCharSet( @@ -223,18 +222,16 @@ wxFontEncoding wxGetFontEncFromCharSet( return eFontEncoding; } // end of wxGetNativeFontEncoding -bool wxTestFontEncoding( - const wxNativeEncodingInfo& rInfo -) +bool wxTestFontEncoding( const wxNativeEncodingInfo& rInfo ) { - FATTRS vLogFont; - HPS hPS; + FATTRS vLogFont; + HPS hPS; hPS = ::WinGetPS(HWND_DESKTOP); memset(&vLogFont, '\0', sizeof(FATTRS)); // all default values vLogFont.usRecordLength = sizeof(FATTRS); - vLogFont.usCodePage = rInfo.charset; + vLogFont.usCodePage = (USHORT)rInfo.charset; vLogFont.lMaxBaselineExt = 0L; // Outline fonts should use 0 vLogFont.lAveCharWidth = 0L; // Outline fonts should use 0 vLogFont.fsFontUse = FATTR_FONTUSE_OUTLINE | // only outline fonts allowed @@ -252,7 +249,7 @@ bool wxTestFontEncoding( return FALSE; } ::WinReleasePS(hPS); - return TRUE; + return true; } // end of wxTestFontEncoding // ---------------------------------------------------------------------------- @@ -297,21 +294,19 @@ void wxConvertVectorFontSize( } // end of wxConvertVectorPointSize -void wxFillLogFont( - LOGFONT* pFattrs // OS2 GPI FATTRS -, PFACENAMEDESC pFaceName -, HPS* phPS -, bool* pbInternalPS -, long* pflId -, wxString& sFaceName -, wxFont* pFont -) +void wxFillLogFont( LOGFONT* pFattrs, // OS2 GPI FATTRS + PFACENAMEDESC pFaceName, + HPS* phPS, + bool* pbInternalPS, + long* pflId, + wxString& sFaceName, + wxFont* pFont ) { - LONG lNumFonts = 0L; // For system font count - ERRORID vError; // For logging API errors - LONG lTemp = 0L; - bool bInternalPS = FALSE; // if we have to create one - PFONTMETRICS pFM = NULL; + LONG lNumFonts = 0L; // For system font count + ERRORID vError; // For logging API errors + LONG lTemp = 0L; + bool bInternalPS = false; // if we have to create one + PFONTMETRICS pFM = NULL; // // Initial house cleaning to free data buffers and ensure we have a @@ -320,7 +315,7 @@ void wxFillLogFont( if (!*phPS) { *phPS = ::WinGetPS(HWND_DESKTOP); - bInternalPS = TRUE; + bInternalPS = true; } // @@ -712,4 +707,3 @@ int wxGpiStrcmp( } return rc; } - diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index a4258e5af6..df4efda67e 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -81,7 +81,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) #if wxUSE_STATUSBAR #if wxUSE_NATIVE_STATUSBAR - bool wxFrame::m_bUseNativeStatusBar = TRUE; + bool wxFrame::m_bUseNativeStatusBar = true; #else bool wxFrame::m_bUseNativeStatusBar = FALSE; #endif @@ -122,15 +122,13 @@ void wxFrame::Init() } // end of wxFrame::Init -bool wxFrame::Create( - wxWindow* pParent -, wxWindowID vId -, const wxString& rsTitle -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, const wxString& rsName -) +bool wxFrame::Create( wxWindow* pParent, + wxWindowID vId, + const wxString& rsTitle, + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + const wxString& rsName ) { if (!wxTopLevelWindow::Create( pParent ,vId @@ -140,13 +138,13 @@ bool wxFrame::Create( ,lStyle ,rsName )) - return FALSE; - return TRUE; + return false; + return true; } // end of wxFrame::Create wxFrame::~wxFrame() { - m_isBeingDeleted = TRUE; + m_isBeingDeleted = true; DeleteAllBars(); } // end of wxFrame::~wxFrame @@ -476,18 +474,15 @@ void wxFrame::OnSysColourChanged( wxWindow::OnSysColourChanged(rEvent); } // end of wxFrame::OnSysColourChanged -// Pass TRUE to show full screen, FALSE to restore. -bool wxFrame::ShowFullScreen( - bool bShow -, long lStyle -) +// Pass true to show full screen, false to restore. +bool wxFrame::ShowFullScreen( bool bShow, long lStyle ) { if (bShow) { if (IsFullScreen()) return FALSE; - m_bFsIsShowing = TRUE; + m_bFsIsShowing = true; m_lFsStyle = lStyle; #if wxUSE_TOOLBAR @@ -560,8 +555,8 @@ bool wxFrame::ShowFullScreen( // // Decide which window style flags to turn off // - LONG lNewStyle = m_lFsOldWindowStyle; - LONG lOffFlags = 0; + LONG lNewStyle = m_lFsOldWindowStyle; + LONG lOffFlags = 0; if (lStyle & wxFULLSCREEN_NOBORDER) lOffFlags |= FCF_BORDER; @@ -589,9 +584,7 @@ bool wxFrame::ShowFullScreen( // nHeight = vRect.yTop - vRect.yBottom; - SetSize( nWidth - ,nHeight - ); + SetSize( nWidth, nHeight); // // Now flush the window style cache and actually go full-screen @@ -605,21 +598,18 @@ bool wxFrame::ShowFullScreen( ,SWP_SIZE | SWP_SHOW ); - wxSizeEvent vEvent( wxSize( nWidth - ,nHeight - ) - ,GetId() - ); + wxSize sz( nWidth, nHeight ); + wxSizeEvent vEvent( sz, GetId() ); GetEventHandler()->ProcessEvent(vEvent); - return TRUE; + return true; } else { if (!IsFullScreen()) - return FALSE; + return false; - m_bFsIsShowing = FALSE; + m_bFsIsShowing = false; #if wxUSE_TOOLBAR wxToolBar* pTheToolBar = GetToolBar(); @@ -630,7 +620,7 @@ bool wxFrame::ShowFullScreen( if (pTheToolBar && (m_lFsStyle & wxFULLSCREEN_NOTOOLBAR)) { pTheToolBar->SetSize(-1, m_nFsToolBarHeight); - pTheToolBar->Show(TRUE); + pTheToolBar->Show(true); } #endif //wxUSE_TOOLBAR @@ -775,9 +765,7 @@ void wxFrame::PositionToolBar() // Windows behaviour where child frames float independently of the parent one // on the desktop, but are iconized/restored with it // -void wxFrame::IconizeChildFrames( - bool bIconize -) +void wxFrame::IconizeChildFrames( bool WXUNUSED(bIconize) ) { // FIXME: Generic MDI does not use Frames for the Childs, so this does _not_ // work. Possibly, the right thing is simply to eliminate this @@ -854,7 +842,7 @@ bool wxFrame::OS2TranslateMessage( // --------------------------------------------------------------------------- bool wxFrame::HandlePaint() { - RECTL vRect; + RECTL vRect; if (::WinQueryUpdateRect(GetHWND(), &vRect)) { @@ -889,15 +877,18 @@ bool wxFrame::HandlePaint() ::WinQueryWindowRect(GetHwnd(), &vRect3); +#ifndef __WATCOMC__ +// FIXME: incomplete headers ??? + 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); - return TRUE; } else { @@ -931,18 +922,13 @@ bool wxFrame::HandlePaint() ,&vRect ,GetBackgroundColour().GetPixel() ); - ::WinEndPaint(hPS); + ::WinEndPaint(hPS); } } - return TRUE; } } - else - { - // nothing to paint - processed - return TRUE; - } - return FALSE; + + return true; } // end of wxFrame::HandlePaint bool wxFrame::HandleSize( @@ -983,7 +969,7 @@ bool wxFrame::HandleSize( // IconizeChildFrames(TRUE); (void)SendIconizeEvent(); - m_bIconized = TRUE; + m_bIconized = true; break; } @@ -1019,11 +1005,9 @@ bool wxFrame::HandleSize( return bProcessed; } // end of wxFrame::HandleSize -bool wxFrame::HandleCommand( - WXWORD nId -, WXWORD nCmd -, WXHWND hControl -) +bool wxFrame::HandleCommand( WXWORD nId, + WXWORD nCmd, + WXHWND hControl ) { if (hControl) { @@ -1033,9 +1017,7 @@ bool wxFrame::HandleCommand( wxWindow* pWin = wxFindWinFromHandle(hControl); if (pWin) - return pWin->OS2Command( nCmd - ,nId - ); + return pWin->OS2Command( nCmd, nId ); } // @@ -1050,19 +1032,16 @@ bool wxFrame::HandleCommand( wxCurrentPopupMenu = NULL; - return pPopupMenu->OS2Command( nCmd - ,nId - ); - return TRUE; + return pPopupMenu->OS2Command( nCmd, nId ); } #endif if (ProcessCommand(nId)) { - return TRUE; + return true; } } - return FALSE; + return false; } // end of wxFrame::HandleCommand bool wxFrame::HandleMenuSelect( @@ -1343,7 +1322,7 @@ MRESULT wxFrame::OS2WindowProc( return (MRESULT)mRc; } // wxFrame::OS2WindowProc -void wxFrame::SetClient(WXHWND c_Hwnd) +void wxFrame::SetClient(WXHWND WXUNUSED(c_Hwnd)) { // Duh...nothing to do under OS/2 } @@ -1420,4 +1399,3 @@ void wxFrame::SendSizeEvent() ); } } - diff --git a/src/os2/gdiimage.cpp b/src/os2/gdiimage.cpp index 1c13465880..99e9bc724c 100644 --- a/src/os2/gdiimage.cpp +++ b/src/os2/gdiimage.cpp @@ -163,14 +163,13 @@ protected: ,int nDesiredHeight = -1 ) = 0; private: - inline virtual bool Load( wxGDIImage* pImage - ,int nId - ,long lFlags - ,int nDesiredWidth - ,int nDesiredHeight - ) + inline virtual bool Load( wxGDIImage* WXUNUSED(pImage), + int WXUNUSED(nId), + long WXUNUSED(lFlags), + int WXUNUSED(nDesiredWidth), + int WXUNUSED(nDesiredHeight) ) { - return FALSE; + return false; } }; @@ -237,9 +236,7 @@ wxGDIImageHandlerList wxGDIImage::ms_handlers; // wxGDIImage functions forwarded to wxGDIImageRefData // ---------------------------------------------------------------------------- -bool wxGDIImage::FreeResource( - bool WXUNUSED(bForce) -) +bool wxGDIImage::FreeResource( bool WXUNUSED(bForce) ) { if ( !IsNull() ) { @@ -247,7 +244,7 @@ bool wxGDIImage::FreeResource( GetGDIImageData()->m_hHandle = 0; } - return(TRUE); + return true; } WXHANDLE wxGDIImage::GetResourceHandle() @@ -259,33 +256,27 @@ WXHANDLE wxGDIImage::GetResourceHandle() // wxGDIImage handler stuff // ---------------------------------------------------------------------------- -void wxGDIImage::AddHandler( - wxGDIImageHandler* pHandler -) +void wxGDIImage::AddHandler( wxGDIImageHandler* pHandler ) { ms_handlers.Append(pHandler); } -void wxGDIImage::InsertHandler( - wxGDIImageHandler* pHandler -) +void wxGDIImage::InsertHandler( wxGDIImageHandler* pHandler ) { ms_handlers.Insert(pHandler); } -bool wxGDIImage::RemoveHandler( - const wxString& rName -) +bool wxGDIImage::RemoveHandler( const wxString& rName ) { wxGDIImageHandler* pHandler = FindHandler(rName); if (pHandler) { ms_handlers.DeleteObject(pHandler); - return(TRUE); + return true; } else - return(FALSE); + return false; } wxGDIImageHandler* wxGDIImage::FindHandler( @@ -369,13 +360,11 @@ void wxGDIImage::InitStandardHandlers() // wxBitmap handlers // ---------------------------------------------------------------------------- -bool wxBMPResourceHandler::LoadFile( - wxBitmap* pBitmap -, int nId -, long lFlags -, int nDesiredWidth -, int nDesiredHeight -) +bool wxBMPResourceHandler::LoadFile( wxBitmap* pBitmap, + int nId, + long WXUNUSED(lFlags), + int WXUNUSED(nDesiredWidth), + int WXUNUSED(nDesiredHeight) ) { SIZEL vSize = {0, 0}; DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L}; @@ -405,22 +394,20 @@ bool wxBMPResourceHandler::LoadFile( return(pBitmap->Ok()); } // end of wxBMPResourceHandler::LoadFile -bool wxBMPFileHandler::LoadFile( - wxBitmap* pBitmap -, const wxString& rName -, HPS hPs -, long WXUNUSED(lFlags) -, int WXUNUSED(nDesiredWidth) -, int WXUNUSED(nDesiredHeight) -) +bool wxBMPFileHandler::LoadFile( wxBitmap* pBitmap, + const wxString& WXUNUSED(rName), + HPS WXUNUSED(hPs), + long WXUNUSED(lFlags), + int WXUNUSED(nDesiredWidth), + int WXUNUSED(nDesiredHeight) ) { #if wxUSE_IMAGE_LOADING_IN_OS2 - wxPalette* pPalette = NULL; + wxPalette* pPalette = NULL; - bool bSuccess = FALSE; /* wxLoadIntoBitmap( WXSTRINGCAST rName - ,pBitmap - ,&pPalette - ) != 0; */ + bool bSuccess = false; /* wxLoadIntoBitmap( WXSTRINGCAST rName + ,pBitmap + ,&pPalette + ) != 0; */ if (bSuccess && pPalette) { pBitmap->SetPalette(*pPalette); @@ -431,19 +418,18 @@ bool wxBMPFileHandler::LoadFile( return(bSuccess); #else - return(FALSE); + wxUnusedVar(pBitmap); + return false; #endif } -bool wxBMPFileHandler::SaveFile( - wxBitmap* pBitmap -, const wxString& rName -, int WXUNUSED(nType) -, const wxPalette* pPal -) +bool wxBMPFileHandler::SaveFile( wxBitmap* pBitmap, + const wxString& WXUNUSED(rName), + int WXUNUSED(nType), + const wxPalette* pPal ) { #if wxUSE_IMAGE_LOADING_IN_OS2 - wxPalette* pActualPalette = (wxPalette *)pPal; + wxPalette* pActualPalette = (wxPalette *)pPal; if (!pActualPalette) pActualPalette = pBitmap->GetPalette(); @@ -451,9 +437,11 @@ bool wxBMPFileHandler::SaveFile( ,pBitmap ,pActualPalette ) != 0); */ - return(FALSE); + return false; #else - return(FALSE); + wxUnusedVar(pBitmap); + wxUnusedVar(pPal); + return false; #endif } @@ -461,35 +449,29 @@ bool wxBMPFileHandler::SaveFile( // wxIcon handlers // ---------------------------------------------------------------------------- -bool wxICOFileHandler::LoadIcon( - wxIcon* pIcon -, const wxString& rName -, HPS hPs -, long lFlags -, int nDesiredWidth -, int nDesiredHeight -) +bool wxICOFileHandler::LoadIcon( wxIcon* pIcon, + const wxString& WXUNUSED(rName), + HPS WXUNUSED(hPs), + long WXUNUSED(lFlags), + int WXUNUSED(nDesiredWidth), + int WXUNUSED(nDesiredHeight) ) { #if wxUSE_RESOURCE_LOADING_IN_OS2 pIcon->UnRef(); - // actual size - wxSize vSize; - - return(FALSE); + return false; #else - return(FALSE); + wxUnusedVar(pIcon); + return false; #endif } -bool wxICOResourceHandler::LoadIcon( - wxIcon* pIcon -, const wxString& rName -, HPS hPs -, long lFlags -, int WXUNUSED(nDesiredWidth) -, int WXUNUSED(nDesiredHeight) -) +bool wxICOResourceHandler::LoadIcon( wxIcon* pIcon, + const wxString& rName, + HPS WXUNUSED(hPs), + long WXUNUSED(lFlags), + int WXUNUSED(nDesiredWidth), + int WXUNUSED(nDesiredHeight) ) { HPOINTER hIcon; @@ -499,9 +481,7 @@ bool wxICOResourceHandler::LoadIcon( pIcon->SetSize(32, 32); // all OS/2 icons are 32 x 32 - pIcon->SetHICON((WXHICON)hIcon); return pIcon->Ok(); } // end of wxICOResourceHandler::LoadIcon - diff --git a/src/os2/gsockpm.cpp b/src/os2/gsockpm.cpp index e7af117f05..4258e637cf 100644 --- a/src/os2/gsockpm.cpp +++ b/src/os2/gsockpm.cpp @@ -6,7 +6,10 @@ * CVSID: $Id$ * ------------------------------------------------------------------------- */ -#include "wx/setup.h" +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#include "wx/defs.h" #if wxUSE_SOCKETS @@ -96,11 +99,11 @@ void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, GSock int c; switch (event) { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; + case GSOCK_LOST: /* fall-through */ + case GSOCK_INPUT: c = 0; break; + case GSOCK_OUTPUT: c = 1; break; + case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; + default: return; } if (m_id[c] != -1) wxTheApp->RemoveSocketHandler(m_id[c]); diff --git a/src/os2/helpwin.cpp b/src/os2/helpwin.cpp index 95f57925c1..32e7414401 100644 --- a/src/os2/helpwin.cpp +++ b/src/os2/helpwin.cpp @@ -9,6 +9,9 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #ifndef WX_PRECOMP #include "wx/defs.h" #endif @@ -43,37 +46,39 @@ bool wxWinHelpController::Initialize(const wxString& filename) { m_helpFile = filename; // TODO any other inits - return TRUE; + return true; } bool wxWinHelpController::LoadFile(const wxString& file) { m_helpFile = file; // TODO - return TRUE; + return true; } bool wxWinHelpController::DisplayContents() { - if (m_helpFile == wxT("")) return FALSE; + if (m_helpFile == wxT("")) + return false; wxString str = m_helpFile; size_t len = str.Length(); if (!(str[(size_t)(len-1)] == wxT('p') && str[(size_t)(len-2)] == wxT('l') && str[(size_t)(len-3)] == wxT('h') && str[(size_t)(len-4)] == wxT('.'))) - str += wxT(".hlp"); + str += wxT(".hlp"); if (wxTheApp->GetTopWindow()) { - // TODO : display the help - return TRUE; + // TODO : display the help + return true; } - return FALSE; + return FALSE; } -bool wxWinHelpController::DisplaySection(int section) +bool wxWinHelpController::DisplaySection(int WXUNUSED(section)) { // Use context number - if (m_helpFile == wxT("")) return FALSE; + if (m_helpFile == wxT("")) + return false; wxString str = m_helpFile; size_t len = str.Length(); @@ -81,18 +86,20 @@ bool wxWinHelpController::DisplaySection(int section) str += wxT(".hlp"); if (wxTheApp->GetTopWindow()) - { - // TODO :: - // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section); - return TRUE; - } - return FALSE; + { + // TODO :: + // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section); + return true; + } + + return false; } -bool wxWinHelpController::DisplayBlock(long block) +bool wxWinHelpController::DisplayBlock(long WXUNUSED(block)) { // Use context number -- a very rough equivalent to block id! - if (m_helpFile == wxT("")) return FALSE; + if (m_helpFile == wxT("")) + return false; wxString str = m_helpFile; size_t len = str.Length(); @@ -100,15 +107,15 @@ bool wxWinHelpController::DisplayBlock(long block) str += wxT(".hlp"); if (wxTheApp->GetTopWindow()) - { - // TODO: - // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block); - return TRUE; - } - return FALSE; + { + // TODO: + // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block); + return true; + } + return false; } -bool wxWinHelpController::KeywordSearch(const wxString& k, +bool wxWinHelpController::KeywordSearch(const wxString& WXUNUSED(k), wxHelpSearchMode WXUNUSED(mode)) { if (m_helpFile == wxEmptyString) return FALSE; @@ -122,7 +129,7 @@ bool wxWinHelpController::KeywordSearch(const wxString& k, { // TODO: // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k); - return TRUE; + return true; } return FALSE; } @@ -130,18 +137,17 @@ bool wxWinHelpController::KeywordSearch(const wxString& k, // Can't close the help window explicitly in WinHelp bool wxWinHelpController::Quit() { - if (wxTheApp->GetTopWindow()) - { - // TODO: - // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L); - return TRUE; - } - else - return FALSE; + if (wxTheApp->GetTopWindow()) + { + // TODO: + // WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), 0, HELP_QUIT, 0L); + return true; + } + + return false; } void wxWinHelpController::OnQuit() { } #endif // wxUSE_HELP - diff --git a/src/os2/icon.cpp b/src/os2/icon.cpp index 8b31bf4b08..6102683f1d 100644 --- a/src/os2/icon.cpp +++ b/src/os2/icon.cpp @@ -100,14 +100,12 @@ void wxIcon::CreateIconFromXpm( CopyFromBitmap(vBmp); if (GetHICON()) { - m_bIsXpm = TRUE; + m_bIsXpm = true; m_vXpmSrc = vBmp; } } // end of wxIcon::CreateIconFromXpm -void wxIcon::CopyFromBitmap( - const wxBitmap& rBmp -) +void wxIcon::CopyFromBitmap( const wxBitmap& rBmp ) { wxMask* pMask = rBmp.GetMask(); HBITMAP hBmp = NULLHANDLE; @@ -236,9 +234,10 @@ void wxIcon::CopyFromBitmap( vIconInfo.hbmPointer = hBmpMask; - HICON hIcon = ::WinCreatePointerIndirect( HWND_DESKTOP - ,&vIconInfo - ); +#ifndef __WATCOMC__ +// FIXME: incomplete headers ??? + + HICON hIcon = ::WinCreatePointerIndirect( HWND_DESKTOP, &vIconInfo); if (!hIcon) { @@ -253,6 +252,7 @@ void wxIcon::CopyFromBitmap( ,rBmp.GetHeight() ); } +#endif if (!rBmp.GetMask()) { @@ -293,4 +293,3 @@ bool wxIcon::LoadFile( else return(FALSE); } - diff --git a/src/os2/iniconf.cpp b/src/os2/iniconf.cpp index 214defa20d..9e01efedbd 100644 --- a/src/os2/iniconf.cpp +++ b/src/os2/iniconf.cpp @@ -58,7 +58,7 @@ wxIniConfig::wxIniConfig(const wxString& strAppName, localFilename, globalFilename, style) { m_strLocalFilename = localFilename; - if (m_strLocalFilename.IsEmpty()) + if (m_strLocalFilename.empty()) { m_strLocalFilename = GetAppName() + wxT(".ini"); } @@ -85,91 +85,100 @@ wxIniConfig::~wxIniConfig() void wxIniConfig::SetPath(const wxString& strPath) { - wxArrayString aParts; + wxArrayString aParts; - if ( strPath.IsEmpty() ) { - // nothing - } - else if ( strPath[(size_t) 0] == wxCONFIG_PATH_SEPARATOR ) { - // absolute path - wxSplitPath(aParts, strPath); - } - else { - // relative path, combine with current one - wxString strFullPath = GetPath(); - strFullPath << wxCONFIG_PATH_SEPARATOR << strPath; - wxSplitPath(aParts, strFullPath); - } + if ( strPath.empty() ) + { + // nothing + } + else if ( strPath[(size_t) 0] == wxCONFIG_PATH_SEPARATOR ) + { + // absolute path + wxSplitPath(aParts, strPath); + } + else + { + // relative path, combine with current one + wxString strFullPath = GetPath(); + strFullPath << wxCONFIG_PATH_SEPARATOR << strPath; + wxSplitPath(aParts, strFullPath); + } - size_t nPartsCount = aParts.Count(); - m_strPath.Empty(); - if ( nPartsCount == 0 ) { - // go to the root - m_strGroup = (wxChar*)PATH_SEP_REPLACE; - } - else { - // translate - m_strGroup = aParts[(size_t) 0]; - for ( size_t nPart = 1; nPart < nPartsCount; nPart++ ) { - if ( nPart > 1 ) - m_strPath << PATH_SEP_REPLACE; - m_strPath << aParts[nPart]; + size_t nPartsCount = aParts.Count(); + m_strPath.Empty(); + if ( nPartsCount == 0 ) + { + // go to the root + m_strGroup = (wxChar*)PATH_SEP_REPLACE; + } + else + { + // translate + m_strGroup = aParts[(size_t) 0]; + for ( size_t nPart = 1; nPart < nPartsCount; nPart++ ) + { + if ( nPart > 1 ) + m_strPath << PATH_SEP_REPLACE; + m_strPath << aParts[nPart]; + } } - } - // other functions assume that all this is true, i.e. there are no trailing - // underscores at the end except if the group is the root one - wxASSERT( (m_strPath.IsEmpty() || m_strPath.Last() != PATH_SEP_REPLACE) && - (m_strGroup == wxString((wxChar)PATH_SEP_REPLACE) || - m_strGroup.Last() != PATH_SEP_REPLACE) ); + // other functions assume that all this is true, i.e. there are no trailing + // underscores at the end except if the group is the root one + wxASSERT( (m_strPath.empty() || m_strPath.Last() != PATH_SEP_REPLACE) && + (m_strGroup == wxString((wxChar)PATH_SEP_REPLACE) || + m_strGroup.Last() != PATH_SEP_REPLACE) ); } const wxString& wxIniConfig::GetPath() const { - static wxString s_str; + static wxString s_str; - // always return abs path - s_str = wxCONFIG_PATH_SEPARATOR; + // always return abs path + s_str = wxCONFIG_PATH_SEPARATOR; - if ( m_strGroup == wxString((wxChar)PATH_SEP_REPLACE) ) { - // we're at the root level, nothing to do - } - else { - s_str << m_strGroup; - if ( !m_strPath.IsEmpty() ) - s_str << wxCONFIG_PATH_SEPARATOR; - for ( const wxChar *p = m_strPath; *p != '\0'; p++ ) { - s_str << (*p == PATH_SEP_REPLACE ? wxCONFIG_PATH_SEPARATOR : *p); + if ( m_strGroup == wxString((wxChar)PATH_SEP_REPLACE) ) + { + // we're at the root level, nothing to do + } + else + { + s_str << m_strGroup; + if ( !m_strPath.empty() ) + s_str << wxCONFIG_PATH_SEPARATOR; + for ( const wxChar *p = m_strPath; *p != '\0'; p++ ) + { + s_str << (*p == PATH_SEP_REPLACE ? wxCONFIG_PATH_SEPARATOR : *p); + } } - } - return s_str; + return s_str; } wxString wxIniConfig::GetPrivateKeyName(const wxString& szKey) const { - wxString strKey; + wxString strKey; - if ( !m_strPath.IsEmpty() ) - strKey << m_strPath << PATH_SEP_REPLACE; + if ( !m_strPath.empty() ) + strKey << m_strPath << PATH_SEP_REPLACE; - strKey << szKey; + strKey << szKey; - return strKey; + return strKey; } wxString wxIniConfig::GetKeyName(const wxString& szKey) const { - wxString strKey; + wxString strKey; - if (m_strGroup != wxString((wxChar)PATH_SEP_REPLACE)) - strKey << m_strGroup << PATH_SEP_REPLACE; - if ( !m_strPath.IsEmpty() ) - strKey << m_strPath << PATH_SEP_REPLACE; + if (m_strGroup != wxString((wxChar)PATH_SEP_REPLACE)) + strKey << m_strGroup << PATH_SEP_REPLACE; + if ( !m_strPath.empty() ) + strKey << m_strPath << PATH_SEP_REPLACE; - strKey << szKey; + strKey << szKey; - return strKey; + return strKey; } // ---------------------------------------------------------------------------- @@ -177,32 +186,32 @@ wxString wxIniConfig::GetKeyName(const wxString& szKey) const // ---------------------------------------------------------------------------- // not implemented -bool wxIniConfig::GetFirstGroup(wxString& str, long& lIndex) const +bool wxIniConfig::GetFirstGroup(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const { - wxFAIL_MSG(wxT("not implemeted")); + wxFAIL_MSG(wxT("not implemeted")); - return FALSE; + return false; } -bool wxIniConfig::GetNextGroup (wxString& str, long& lIndex) const +bool wxIniConfig::GetNextGroup(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const { - wxFAIL_MSG(wxT("not implemeted")); + wxFAIL_MSG(wxT("not implemeted")); - return FALSE; + return false; } -bool wxIniConfig::GetFirstEntry(wxString& str, long& lIndex) const +bool wxIniConfig::GetFirstEntry(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const { - wxFAIL_MSG(wxT("not implemeted")); + wxFAIL_MSG(wxT("not implemeted")); - return FALSE; + return false; } -bool wxIniConfig::GetNextEntry (wxString& str, long& lIndex) const +bool wxIniConfig::GetNextEntry(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const { - wxFAIL_MSG(wxT("not implemeted")); + wxFAIL_MSG(wxT("not implemeted")); - return FALSE; + return false; } // ---------------------------------------------------------------------------- @@ -210,49 +219,49 @@ bool wxIniConfig::GetNextEntry (wxString& str, long& lIndex) const // ---------------------------------------------------------------------------- // not implemented -size_t wxIniConfig::GetNumberOfEntries(bool bRecursive) const +size_t wxIniConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const { - wxFAIL_MSG(wxT("not implemeted")); + wxFAIL_MSG(wxT("not implemeted")); - return (size_t)-1; + return (size_t)-1; } -size_t wxIniConfig::GetNumberOfGroups(bool bRecursive) const +size_t wxIniConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const { - wxFAIL_MSG(wxT("not implemeted")); + wxFAIL_MSG(wxT("not implemeted")); - return (size_t)-1; + return (size_t)-1; } -bool wxIniConfig::HasGroup(const wxString& strName) const +bool wxIniConfig::HasGroup(const wxString& WXUNUSED(strName)) const { - wxFAIL_MSG(wxT("not implemeted")); + wxFAIL_MSG(wxT("not implemeted")); - return FALSE; + return false; } -bool wxIniConfig::HasEntry(const wxString& strName) const +bool wxIniConfig::HasEntry(const wxString& WXUNUSED(strName)) const { - wxFAIL_MSG(wxT("not implemeted")); + wxFAIL_MSG(wxT("not implemeted")); - return FALSE; + return false; } // is current group empty? bool wxIniConfig::IsEmpty() const { - char szBuf[1024]; + char szBuf[1024]; // GetPrivateProfileString(m_strGroup, NULL, "", // szBuf, WXSIZEOF(szBuf), m_strLocalFilename); - if ( !::IsEmpty(szBuf) ) - return FALSE; + if ( !::IsEmpty(szBuf) ) + return false; // GetProfileString(m_strGroup, NULL, "", szBuf, WXSIZEOF(szBuf)); // if ( !::IsEmpty(szBuf) ) - return FALSE; +// return false; - return TRUE; + return true; } // ---------------------------------------------------------------------------- @@ -261,29 +270,30 @@ bool wxIniConfig::IsEmpty() const bool wxIniConfig::Read(const wxString& szKey, wxString *pstr) const { - wxConfigPathChanger path(this, szKey); - wxString strKey = GetPrivateKeyName(path.Name()); + wxConfigPathChanger path(this, szKey); + wxString strKey = GetPrivateKeyName(path.Name()); - wxChar szBuf[1024]; // @@ should dynamically allocate memory... + wxChar szBuf[1024]; // @@ should dynamically allocate memory... - // first look in the private INI file + // first look in the private INI file - // NB: the lpDefault param to GetPrivateProfileString can't be NULL + // NB: the lpDefault param to GetPrivateProfileString can't be NULL // GetPrivateProfileString(m_strGroup, strKey, "", // szBuf, WXSIZEOF(szBuf), m_strLocalFilename); - if ( ::IsEmpty((PSZ)szBuf) ) { - // now look in win.ini - wxString strKey = GetKeyName(path.Name()); -// GetProfileString(m_strGroup, strKey, "", szBuf, WXSIZEOF(szBuf)); - } + if ( ::IsEmpty((PSZ)szBuf) ) + { + // now look in win.ini + wxString strKey = GetKeyName(path.Name()); + // GetProfileString(m_strGroup, strKey, "", szBuf, WXSIZEOF(szBuf)); + } + + if ( ::IsEmpty((PSZ)szBuf) ) + { + return false; + } - if ( ::IsEmpty((PSZ)szBuf) ) { - return FALSE; - } - else { *pstr = szBuf ; - return TRUE; - } + return true; } bool wxIniConfig::Read(const wxString& szKey, wxString *pstr, @@ -346,18 +356,18 @@ bool wxIniConfig::Read(const wxString& szKey, long *pl) const return TRUE; } -bool wxIniConfig::Write(const wxString& szKey, const wxString& szValue) +bool wxIniConfig::Write(const wxString& szKey, const wxString& WXUNUSED(szValue)) { - wxConfigPathChanger path(this, szKey); - wxString strKey = GetPrivateKeyName(path.Name()); + wxConfigPathChanger path(this, szKey); + wxString strKey = GetPrivateKeyName(path.Name()); - bool bOk = FALSE; // = WritePrivateProfileString(m_strGroup, strKey, + bool bOk = false; // = WritePrivateProfileString(m_strGroup, strKey, // szValue, m_strLocalFilename) != 0; - if ( !bOk ) - wxLogLastError(wxT("WritePrivateProfileString")); + if ( !bOk ) + wxLogLastError(wxT("WritePrivateProfileString")); - return bOk; + return bOk; } bool wxIniConfig::Write(const wxString& szKey, long lValue) @@ -452,16 +462,16 @@ bool wxIniConfig::DeleteAll() return TRUE; } -bool wxIniConfig::RenameEntry(const wxString& oldName, const wxString& newName) +bool wxIniConfig::RenameEntry(const wxString& WXUNUSED(oldName), const wxString& WXUNUSED(newName)) { // Not implemented - return FALSE; + return false; } -bool wxIniConfig::RenameGroup(const wxString& oldName, const wxString& newName) +bool wxIniConfig::RenameGroup(const wxString& WXUNUSED(oldName), const wxString& WXUNUSED(newName)) { // Not implemented - return FALSE; + return false; } #endif //wxUSE_CONFIG diff --git a/src/os2/joystick.cpp b/src/os2/joystick.cpp index e40b19826e..5f2110557e 100644 --- a/src/os2/joystick.cpp +++ b/src/os2/joystick.cpp @@ -9,6 +9,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// +// For compilers that support precompilation, includes "wx.h". +// +#include "wx/wxprec.h" + #include "wx/defs.h" #if wxUSE_JOYSTICK @@ -82,7 +87,7 @@ int wxJoystick::GetMovementThreshold() const return 0; } -void wxJoystick::SetMovementThreshold(int threshold) +void wxJoystick::SetMovementThreshold(int WXUNUSED(threshold)) { // TODO } @@ -93,7 +98,7 @@ void wxJoystick::SetMovementThreshold(int threshold) bool wxJoystick::IsOk() const { // TODO - return FALSE; + return false; } int wxJoystick::GetNumberJoysticks() const @@ -231,58 +236,57 @@ int wxJoystick::GetVMax() const bool wxJoystick::HasRudder() const { // TODO - return FALSE; + return false; } bool wxJoystick::HasZ() const { // TODO - return FALSE; + return false; } bool wxJoystick::HasU() const { // TODO - return FALSE; + return false; } bool wxJoystick::HasV() const { // TODO - return FALSE; + return false; } bool wxJoystick::HasPOV() const { // TODO - return FALSE; + return false; } bool wxJoystick::HasPOV4Dir() const { // TODO - return FALSE; + return false; } bool wxJoystick::HasPOVCTS() const { // TODO - return FALSE; + return false; } // Operations //////////////////////////////////////////////////////////////////////////// -bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq) +bool wxJoystick::SetCapture(wxWindow* WXUNUSED(win), int WXUNUSED(pollingFreq)) { // TODO - return FALSE; + return false; } bool wxJoystick::ReleaseCapture() { // TODO - return FALSE; + return false; } #endif // wxUSE_JOYSTICK - diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index dacc04c2b6..ec5c2588ed 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -65,9 +65,7 @@ wxListBoxItem::wxListBoxItem( SetMarginWidth(0); } // end of wxListBoxItem::wxListBoxItem -wxOwnerDrawn* wxListBox::CreateItem( - size_t n -) +wxOwnerDrawn* wxListBox::CreateItem( size_t WXUNUSED(n) ) { return new wxListBoxItem(); } // end of wxListBox::CreateItem @@ -508,9 +506,7 @@ bool wxListBox::HasMultipleSelection() const return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED); } // end of wxListBox::HasMultipleSelection -int wxListBox::GetSelections( - wxArrayInt& raSelections -) const +int wxListBox::GetSelections( wxArrayInt& raSelections ) const { int nCount = 0; LONG lItem; @@ -557,7 +553,6 @@ int wxListBox::GetSelections( } return nCount; } - return 0; } else // single-selection listbox { @@ -892,14 +887,10 @@ bool wxListBox::OS2OnDraw ( wxCHECK(pData, false ); - wxDC vDc; - wxRect vRect( wxPoint( pDrawStruct->rclItem.xLeft - ,pDrawStruct->rclItem.yTop - ) - ,wxPoint( pDrawStruct->rclItem.xRight - ,pDrawStruct->rclItem.yBottom - ) - ); + wxDC vDc; + wxPoint pt1( pDrawStruct->rclItem.xLeft, pDrawStruct->rclItem.yTop ); + wxPoint pt2( pDrawStruct->rclItem.xRight, pDrawStruct->rclItem.yBottom ); + wxRect vRect( pt1, pt2 ); vDc.SetHPS(pDrawStruct->hps); @@ -976,4 +967,3 @@ bool wxListBox::OS2OnDraw ( #endif // ndef for wxUSE_OWNER_DRAWN #endif // ndef for wxUSE_LISTBOX - diff --git a/src/os2/menu.cpp b/src/os2/menu.cpp index 3e25f5f0d2..0d64df1bfd 100644 --- a/src/os2/menu.cpp +++ b/src/os2/menu.cpp @@ -107,7 +107,7 @@ void wxMenu::Init() // // If we have a title, insert it in the beginning of the menu // - if (!m_title.IsEmpty()) + if (!m_title.empty()) { Append( idMenuTitle ,m_title @@ -146,7 +146,7 @@ wxMenu::~wxMenu() void wxMenu::Break() { // this will take effect during the next call to Append() - m_bDoBreak = TRUE; + m_bDoBreak = true; } // end of wxMenu::Break void wxMenu::Attach( @@ -189,7 +189,7 @@ void wxMenu::UpdateAccel( } else if (!pItem->IsSeparator()) { - // + // // Recurse upwards: we should only modify m_accels of the top level // menus, not of the submenus as wxMenuBar doesn't look at them // (alternative and arguable cleaner solution would be to recurse @@ -248,17 +248,15 @@ void wxMenu::UpdateAccel( // // Append a new item or submenu to the menu // -bool wxMenu::DoInsertOrAppend( - wxMenuItem* pItem -, size_t nPos -) +bool wxMenu::DoInsertOrAppend( wxMenuItem* pItem, + size_t nPos ) { - wxMenu* pSubmenu = pItem->GetSubMenu(); - MENUITEM& rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData: - pItem->m_vMenuData; + wxMenu* pSubmenu = pItem->GetSubMenu(); + MENUITEM& rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData: + pItem->m_vMenuData; - ERRORID vError; - wxString sError; + ERRORID vError; + wxString sError; #if wxUSE_ACCEL UpdateAccel(pItem); @@ -289,7 +287,7 @@ bool wxMenu::DoInsertOrAppend( } else { - rItem.id = pItem->GetId(); + rItem.id = (USHORT)pItem->GetId(); } BYTE* pData=NULL; @@ -337,7 +335,7 @@ bool wxMenu::DoInsertOrAppend( } else { - rItem.iPosition = nPos; + rItem.iPosition = (SHORT)nPos; } APIRET rc; @@ -361,26 +359,25 @@ bool wxMenu::DoInsertOrAppend( ); } #endif + if (rc == (APIRET)MIT_MEMERROR || rc == (APIRET)MIT_ERROR) { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); wxLogError(wxT("Error inserting or appending a menuitem. Error: %s\n"), sError.c_str()); wxLogLastError(wxT("Insert or AppendMenu")); - return FALSE; + return false; } - else + + // + // If we're already attached to the menubar, we must update it + // + if (IsAttached() && GetMenuBar()->IsAttached()) { - // - // If we're already attached to the menubar, we must update it - // - if (IsAttached() && GetMenuBar()->IsAttached()) - { - GetMenuBar()->Refresh(); - } - return TRUE; + GetMenuBar()->Refresh(); } - return FALSE; + + return true; } // end of wxMenu::DoInsertOrAppend void wxMenu::EndRadioGroup() @@ -391,13 +388,11 @@ void wxMenu::EndRadioGroup() m_nStartRadioGroup = -1; } // end of wxMenu::EndRadioGroup -wxMenuItem* wxMenu::DoAppend( - wxMenuItem* pItem -) +wxMenuItem* wxMenu::DoAppend( wxMenuItem* pItem ) { wxCHECK_MSG( pItem, NULL, _T("NULL item in wxMenu::DoAppend") ); - bool bCheck = FALSE; + bool bCheck = false; if (pItem->GetKind() == wxITEM_RADIO) { @@ -419,7 +414,7 @@ wxMenuItem* wxMenu::DoAppend( // // Ensure that we have a checked item in the radio group // - bCheck = TRUE; + bCheck = true; } else // extend the current radio group { @@ -454,7 +449,7 @@ wxMenuItem* wxMenu::DoAppend( // // Check the item initially // - pItem->Check(TRUE); + pItem->Check(true); } return pItem; } // end of wxMenu::DoAppend @@ -560,17 +555,15 @@ size_t wxMenu::CopyAccels( // set wxMenu title // --------------------------------------------------------------------------- -void wxMenu::SetTitle( - const wxString& rLabel -) +void wxMenu::SetTitle( const wxString& rLabel ) { - bool bHasNoTitle = m_title.IsEmpty(); - HWND hMenu = GetHmenu(); + bool bHasNoTitle = m_title.empty(); + HWND hMenu = GetHmenu(); m_title = rLabel; if (bHasNoTitle) { - if (!rLabel.IsEmpty()) + if (!rLabel.empty()) { if (!::WinSetWindowText(hMenu, (PSZ)rLabel.c_str())) { @@ -580,7 +573,7 @@ void wxMenu::SetTitle( } else { - if (rLabel.IsEmpty() ) + if (rLabel.empty() ) { ::WinSendMsg( GetHmenu() ,MM_REMOVEITEM @@ -785,14 +778,14 @@ WXHMENU wxMenuBar::Create() } else { - size_t nCount = GetMenuCount(), i; - wxMenuList::iterator it; + size_t nCount = GetMenuCount(), i; + wxMenuList::iterator it; for (i = 0, it = m_menus.begin(); i < nCount; i++, it++) { - APIRET rc; - ERRORID vError; - wxString sError; - HWND hSubMenu; + APIRET rc; + ERRORID vError; + wxString sError; + HWND hSubMenu; // // Set the parent and owner of the submenues to be the menubar, not the desktop @@ -814,7 +807,7 @@ WXHMENU wxMenuBar::Create() return NULLHANDLE; } - (*it)->m_vMenuData.iPosition = i; + (*it)->m_vMenuData.iPosition = (SHORT)i; rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&(*it)->m_vMenuData, (MPARAM)m_titles[i].c_str()); if (rc == (APIRET)MIT_MEMERROR || rc == (APIRET)MIT_ERROR) @@ -953,27 +946,20 @@ wxMenu* wxMenuBar::Replace( return pMenuOld; } // end of wxMenuBar::Replace -bool wxMenuBar::Insert( - size_t nPos -, wxMenu* pMenu -, const wxString& rTitle -) +bool wxMenuBar::Insert( size_t nPos, + wxMenu* pMenu, + const wxString& rTitle ) { - wxString sTitle = wxPMTextToLabel(rTitle); + wxString sTitle = wxPMTextToLabel(rTitle); - if (!wxMenuBarBase::Insert( nPos - ,pMenu - ,sTitle - )) - return FALSE; + if (!wxMenuBarBase::Insert( nPos, pMenu, sTitle )) + return false; - m_titles.Insert( sTitle - ,nPos - ); + m_titles.Insert( sTitle, nPos ); if (IsAttached()) { - pMenu->m_vMenuData.iPosition = nPos; + pMenu->m_vMenuData.iPosition = (SHORT)nPos; ::WinSendMsg( (HWND)m_hMenu ,MM_INSERTITEM ,(MPARAM)&pMenu->m_vMenuData @@ -988,7 +974,8 @@ bool wxMenuBar::Insert( #endif // wxUSE_ACCEL Refresh(); } - return TRUE; + + return true; } // end of wxMenuBar::Insert bool wxMenuBar::Append( @@ -1194,4 +1181,3 @@ wxMenuItem* wxMenuBar::FindItem( } return pItem; } // end of wxMenuBar::FindItem - diff --git a/src/os2/menuitem.cpp b/src/os2/menuitem.cpp index c02de98345..ebec03ef25 100644 --- a/src/os2/menuitem.cpp +++ b/src/os2/menuitem.cpp @@ -175,13 +175,13 @@ int wxMenuItem::GetRealId() const // -------------- bool wxMenuItem::IsChecked() const { - USHORT uFlag = SHORT1FROMMR(::WinSendMsg( GetHMenuOf(m_parentMenu) - ,MM_QUERYITEMATTR - ,MPFROM2SHORT(GetId(), TRUE) - ,MPFROMSHORT(MIA_CHECKED) - )); + USHORT uFlag = SHORT1FROMMR(::WinSendMsg( GetHMenuOf(m_parentMenu) + ,MM_QUERYITEMATTR + ,MPFROM2SHORT(GetId(), TRUE) + ,MPFROMSHORT(MIA_CHECKED) + )); - return (uFlag & MIA_CHECKED); + return (uFlag & MIA_CHECKED) == MIA_CHECKED ; } // end of wxMenuItem::IsChecked wxString wxMenuItemBase::GetLabelFromText( @@ -211,7 +211,7 @@ wxString wxMenuItemBase::GetLabelFromText( // void wxMenuItem::SetAsRadioGroupStart() { - m_bIsRadioGroupStart = TRUE; + m_bIsRadioGroupStart = true; } // end of wxMenuItem::SetAsRadioGroupStart void wxMenuItem::SetRadioGroupStart( @@ -367,9 +367,7 @@ void wxMenuItem::Check( wxMenuItemBase::Check(bCheck); } // end of wxMenuItem::Check -void wxMenuItem::SetText( - const wxString& rText -) +void wxMenuItem::SetText( const wxString& rText ) { // // Don't do anything if label didn't change @@ -393,9 +391,9 @@ void wxMenuItem::SetText( m_parentMenu->UpdateAccel(this); #endif // wxUSE_ACCEL - USHORT uId = GetRealId(); - MENUITEM vItem; - USHORT uFlagsOld; + USHORT uId = (USHORT)GetRealId(); + MENUITEM vItem; + USHORT uFlagsOld; if (!::WinSendMsg( hMenu ,MM_QUERYITEM @@ -483,4 +481,3 @@ wxMenuItem* wxMenuItemBase::New( ,pSubMenu ); } // end of wxMenuItemBase::New - diff --git a/src/os2/metafile.cpp b/src/os2/metafile.cpp index bb9fa9719d..cb3d8541db 100644 --- a/src/os2/metafile.cpp +++ b/src/os2/metafile.cpp @@ -72,8 +72,13 @@ wxMetafile::~wxMetafile(void) bool wxMetafile::SetClipboard(int width, int height) { +#if !wxUSE_CLIPBOARD + wxUnusedVar(width); + wxUnusedVar(height); + return false; +#else if (!m_refData) - return FALSE; + return false; bool alreadyOpen=wxClipboardOpen(); if (!alreadyOpen) @@ -84,6 +89,7 @@ bool wxMetafile::SetClipboard(int width, int height) bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height); if (!alreadyOpen) wxCloseClipboard(); return (bool) success; +#endif } bool wxMetafile::Play(wxDC *dc) @@ -98,7 +104,7 @@ bool wxMetafile::Play(wxDC *dc) dc->EndDrawing(); - return TRUE; + return true; } void wxMetafile::SetHMETAFILE(WXHANDLE mf) @@ -154,24 +160,30 @@ wxMetafileDC::wxMetafileDC(const wxString& file) // New constructor that takes origin and extent. If you use this, don't // give origin/extent arguments to wxMakeMetafilePlaceable. -wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg) +wxMetafileDC::wxMetafileDC( const wxString& file, + int WXUNUSED(xext), + int WXUNUSED(yext), + int WXUNUSED(xorg), + int WXUNUSED(yorg) ) { - m_minX = 10000; - m_minY = 10000; - m_maxX = -10000; - m_maxY = -10000; - if (file != wxT("") && wxFileExists(file)) wxRemoveFile(file); + m_minX = 10000; + m_minY = 10000; + m_maxX = -10000; + m_maxY = -10000; + if (file != wxT("") && wxFileExists(file)) + wxRemoveFile(file); + // m_hDC = (WXHDC) CreateMetaFile(file); - m_ok = TRUE; + m_ok = true; // ::SetWindowOrgEx((HDC) m_hDC,xorg,yorg, NULL); // ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL); - // Actual Windows mapping mode, for future reference. - m_windowsMappingMode = wxMM_ANISOTROPIC; + // Actual Windows mapping mode, for future reference. + m_windowsMappingMode = wxMM_ANISOTROPIC; - SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct) + SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct) } wxMetafileDC::~wxMetafileDC(void) @@ -179,32 +191,37 @@ wxMetafileDC::~wxMetafileDC(void) m_hDC = 0; } -void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y, - long *descent, long *externalLeading, wxFont *theFont, bool use16bit) const +void wxMetafileDC::GetTextExtent(const wxString& WXUNUSED(string), + long *WXUNUSED(x), + long *WXUNUSED(y), + long *WXUNUSED(descent), + long *WXUNUSED(externalLeading), + wxFont *theFont, + bool WXUNUSED(use16bit) ) const { - wxFont *fontToUse = theFont; - if (!fontToUse) - fontToUse = (wxFont*) &m_font; + wxFont *fontToUse = theFont; + if (!fontToUse) + fontToUse = (wxFont*) &m_font; - // TODO: + // TODO: /* - HDC dc = GetDC(NULL); - - SIZE sizeRect; - TEXTMETRIC tm; - GetTextExtentPoint(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); - GetTextMetrics(dc, &tm); - - ReleaseDC(NULL, dc); - - if ( x ) - *x = sizeRect.cx; - if ( y ) - *y = sizeRect.cy; - if ( descent ) - *descent = tm.tmDescent; - if ( externalLeading ) - *externalLeading = tm.tmExternalLeading; + HDC dc = GetDC(NULL); + + SIZE sizeRect; + TEXTMETRIC tm; + GetTextExtentPoint(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); + GetTextMetrics(dc, &tm); + + ReleaseDC(NULL, dc); + + if ( x ) + *x = sizeRect.cx; + if ( y ) + *y = sizeRect.cy; + if ( descent ) + *descent = tm.tmDescent; + if ( externalLeading ) + *externalLeading = tm.tmExternalLeading; */ } @@ -283,21 +300,21 @@ struct RECT32 }; struct mfPLACEABLEHEADER { - DWORD key; - short hmf; - RECT32 bbox; - WORD inch; - DWORD reserved; - WORD checksum; + DWORD key; + short hmf; + RECT32 bbox; + WORD inch; + DWORD reserved; + WORD checksum; }; #else struct mfPLACEABLEHEADER { - DWORD key; - HANDLE hmf; - RECT bbox; - WORD inch; - DWORD reserved; - WORD checksum; + DWORD key; + HANDLE hmf; + RECT bbox; + WORD inch; + DWORD reserved; + WORD checksum; }; #endif @@ -313,106 +330,111 @@ bool wxMakeMetafilePlaceable(const wxString& filename, float scale) return wxMakeMetafilePlaceable(filename, 0, 0, 0, 0, scale, FALSE); } -bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale, bool useOriginAndExtent) +bool wxMakeMetafilePlaceable(const wxString& WXUNUSED(filename), + int WXUNUSED(x1), + int WXUNUSED(y1), + int WXUNUSED(x2), + int WXUNUSED(y2), + float WXUNUSED(scale), + bool WXUNUSED(useOriginAndExtent)) { // TODO: the OS/2 PM/MM way to do this /* - // I'm not sure if this is the correct way of suggesting a scale - // to the client application, but it's the only way I can find. - int unitsPerInch = (int)(576/scale); - - mfPLACEABLEHEADER header; - header.key = 0x9AC6CDD7L; - header.hmf = 0; - header.bbox.xLeft = (int)(x1); - header.bbox.yTop = (int)(y1); - header.bbox.xRight = (int)(x2); - header.bbox.yBottom = (int)(y2); - header.inch = unitsPerInch; - header.reserved = 0; - - // Calculate checksum - WORD *p; - mfPLACEABLEHEADER *pMFHead = &header; - for (p =(WORD *)pMFHead,pMFHead -> checksum = 0; - p < (WORD *)&pMFHead ->checksum; ++p) - pMFHead ->checksum ^= *p; - - FILE *fd = fopen(filename.fn_str(), "rb"); - if (!fd) return FALSE; - - wxChar tempFileBuf[256]; - wxGetTempFileName(wxT("mf"), tempFileBuf); - FILE *fHandle = fopen(wxConvFile.cWX2MB(tempFileBuf), "wb"); - if (!fHandle) - return FALSE; - fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle); - - // Calculate origin and extent - int originX = x1; - int originY = y1; - int extentX = x2 - x1; - int extentY = (y2 - y1); - - // Read metafile header and write - METAHEADER metaHeader; - fread((void *)&metaHeader, sizeof(unsigned char), sizeof(metaHeader), fd); - - if (useOriginAndExtent) - metaHeader.mtSize += 15; - else - metaHeader.mtSize += 5; + // I'm not sure if this is the correct way of suggesting a scale + // to the client application, but it's the only way I can find. + int unitsPerInch = (int)(576/scale); + + mfPLACEABLEHEADER header; + header.key = 0x9AC6CDD7L; + header.hmf = 0; + header.bbox.xLeft = (int)(x1); + header.bbox.yTop = (int)(y1); + header.bbox.xRight = (int)(x2); + header.bbox.yBottom = (int)(y2); + header.inch = unitsPerInch; + header.reserved = 0; + + // Calculate checksum + WORD *p; + mfPLACEABLEHEADER *pMFHead = &header; + for (p =(WORD *)pMFHead,pMFHead -> checksum = 0; p < (WORD *)&pMFHead ->checksum; ++p) + pMFHead ->checksum ^= *p; + + FILE *fd = fopen(filename.fn_str(), "rb"); + if (!fd) + return FALSE; - fwrite((void *)&metaHeader, sizeof(unsigned char), sizeof(metaHeader), fHandle); + wxChar tempFileBuf[256]; + wxGetTempFileName(wxT("mf"), tempFileBuf); + FILE *fHandle = fopen(wxConvFile.cWX2MB(tempFileBuf), "wb"); + if (!fHandle) + return FALSE; + fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle); - // Write SetMapMode, SetWindowOrigin and SetWindowExt records - char modeBuffer[8]; - char originBuffer[10]; - char extentBuffer[10]; - METARECORD *modeRecord = (METARECORD *)&modeBuffer; + // Calculate origin and extent + int originX = x1; + int originY = y1; + int extentX = x2 - x1; + int extentY = (y2 - y1); - METARECORD *originRecord = (METARECORD *)&originBuffer; - METARECORD *extentRecord = (METARECORD *)&extentBuffer; + // Read metafile header and write + METAHEADER metaHeader; + fread((void *)&metaHeader, sizeof(unsigned char), sizeof(metaHeader), fd); - modeRecord->rdSize = 4; - modeRecord->rdFunction = META_SETMAPMODE; - modeRecord->rdParm[0] = MM_ANISOTROPIC; + if (useOriginAndExtent) + metaHeader.mtSize += 15; + else + metaHeader.mtSize += 5; - originRecord->rdSize = 5; - originRecord->rdFunction = META_SETWINDOWORG; - originRecord->rdParm[0] = originY; - originRecord->rdParm[1] = originX; + fwrite((void *)&metaHeader, sizeof(unsigned char), sizeof(metaHeader), fHandle); - extentRecord->rdSize = 5; - extentRecord->rdFunction = META_SETWINDOWEXT; - extentRecord->rdParm[0] = extentY; - extentRecord->rdParm[1] = extentX; + // Write SetMapMode, SetWindowOrigin and SetWindowExt records + char modeBuffer[8]; + char originBuffer[10]; + char extentBuffer[10]; + METARECORD *modeRecord = (METARECORD *)&modeBuffer; - fwrite((void *)modeBuffer, sizeof(char), 8, fHandle); + METARECORD *originRecord = (METARECORD *)&originBuffer; + METARECORD *extentRecord = (METARECORD *)&extentBuffer; - if (useOriginAndExtent) - { - fwrite((void *)originBuffer, sizeof(char), 10, fHandle); - fwrite((void *)extentBuffer, sizeof(char), 10, fHandle); - } + modeRecord->rdSize = 4; + modeRecord->rdFunction = META_SETMAPMODE; + modeRecord->rdParm[0] = MM_ANISOTROPIC; - int ch = -2; - while (ch != EOF) - { - ch = getc(fd); - if (ch != EOF) + originRecord->rdSize = 5; + originRecord->rdFunction = META_SETWINDOWORG; + originRecord->rdParm[0] = originY; + originRecord->rdParm[1] = originX; + + extentRecord->rdSize = 5; + extentRecord->rdFunction = META_SETWINDOWEXT; + extentRecord->rdParm[0] = extentY; + extentRecord->rdParm[1] = extentX; + + fwrite((void *)modeBuffer, sizeof(char), 8, fHandle); + + if (useOriginAndExtent) { - putc(ch, fHandle); + fwrite((void *)originBuffer, sizeof(char), 10, fHandle); + fwrite((void *)extentBuffer, sizeof(char), 10, fHandle); } - } - fclose(fHandle); - fclose(fd); - wxRemoveFile(filename); - wxCopyFile(tempFileBuf, filename); - wxRemoveFile(tempFileBuf); + + int ch = -2; + while (ch != EOF) + { + ch = getc(fd); + if (ch != EOF) + { + putc(ch, fHandle); + } + } + fclose(fHandle); + fclose(fd); + wxRemoveFile(filename); + wxCopyFile(tempFileBuf, filename); + wxRemoveFile(tempFileBuf); */ - return TRUE; + return true; } #endif // wxUSE_METAFILE - diff --git a/src/os2/mimetype.cpp b/src/os2/mimetype.cpp index eb5e585853..43d09ca099 100644 --- a/src/os2/mimetype.cpp +++ b/src/os2/mimetype.cpp @@ -9,6 +9,9 @@ // Licence: wxWindows licence (part of wxExtra library) ///////////////////////////////////////////////////////////////////////////// +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #define INCL_DOS #define INCL_GPI #define INCL_WIN @@ -62,7 +65,7 @@ class WXDLLEXPORT wxIcon; // location, uses it, so it isn't likely to change static const wxChar *MIME_DATABASE_KEY = wxT("MIME\\Database\\Content Type\\"); -wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const +wxString wxFileTypeImpl::GetCommand(const wxChar *WXUNUSED(verb)) const { // TODO: OS/2 doesn't have a registry but uses Prf /* @@ -94,7 +97,7 @@ wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const // NB: we don't make any attempt to verify that the string is valid, // i.e. doesn't contain %2, or second %1 or .... But we do make // sure that we return a string with _exactly_ one '%s'! - bool foundFilename = FALSE; + bool foundFilename = false; size_t len = command.Len(); for ( size_t n = 0; (n < len) && !foundFilename; n++ ) { if ( command[n] == wxT('%') && @@ -104,7 +107,7 @@ wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const // replace it with '%s' command[n + 1] = wxT('s'); - foundFilename = TRUE; + foundFilename = true; } } @@ -165,7 +168,7 @@ wxFileTypeImpl::GetOpenCommand(wxString *openCmd, *openCmd = wxFileType::ExpandCommand(cmd, params); - return !openCmd->IsEmpty(); + return !openCmd->empty(); } bool @@ -183,7 +186,7 @@ wxFileTypeImpl::GetPrintCommand(wxString *printCmd, *printCmd = wxFileType::ExpandCommand(cmd, params); - return !printCmd->IsEmpty(); + return !printCmd->empty(); } // TODO this function is half implemented @@ -192,19 +195,19 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions) if ( m_info ) { extensions = m_info->GetExtensions(); - return TRUE; + return true; } - else if ( m_ext.IsEmpty() ) { + else if ( m_ext.empty() ) { // the only way to get the list of extensions from the file type is to // scan through all extensions in the registry - too slow... - return FALSE; + return false; } else { extensions.Empty(); extensions.Add(m_ext); // it's a lie too, we don't return _all_ extensions... - return TRUE; + return true; } } @@ -214,7 +217,7 @@ bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const // we already have it *mimeType = m_info->GetMimeType(); - return TRUE; + return true; } // suppress possible error messages @@ -223,13 +226,13 @@ bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const /* wxRegKey key(wxRegKey::HKCR, wxT(".") + m_ext); if ( key.Open() && key.QueryValue(wxT("Content Type"), *mimeType) ) { - return TRUE; + return true; } else { - return FALSE; + return false; } */ - return FALSE; + return false; } bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const @@ -240,17 +243,17 @@ bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const { mimeTypes.Clear(); mimeTypes.Add(s); - return TRUE; + return true; } else - return FALSE; + return false; } -bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const +bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(iconLoc)) const { if ( m_info ) { // we don't have icons in the fallback resources - return FALSE; + return false; } wxString strIconKey; @@ -274,7 +277,7 @@ bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const // index may be omitted, in which case BeforeLast(',') is empty and // AfterLast(',') is the whole string - if ( strFullPath.IsEmpty() ) { + if ( strFullPath.empty() ) { strFullPath = strIndex; strIndex = wxT("0"); } @@ -286,13 +289,13 @@ bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const iconLoc->SetIndex(wxAtoi(strIndex)); } - return TRUE; + return true; } } // no such file type or no value or incorrect icon entry */ - return FALSE; + return false; } bool wxFileTypeImpl::GetDescription(wxString *desc) const @@ -301,7 +304,7 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const // we already have it *desc = m_info->GetDescription(); - return TRUE; + return true; } // suppress possible error messages @@ -313,11 +316,11 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const if ( key.Open() ) { // it's the default value of the key if ( key.QueryValue(wxT(""), *desc) ) { - return TRUE; + return true; } } */ - return FALSE; + return false; } // extension -> file type @@ -334,7 +337,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) // suppress possible error messages wxLogNull nolog; - bool knownExtension = FALSE; + bool knownExtension = false; wxString strFileType; // TODO: @@ -353,7 +356,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) // this extension doesn't have a filetype, but it's known to the // system and may be has some other useful keys (open command or // content-type), so still return a file type object for it - knownExtension = TRUE; + knownExtension = true; } } */ @@ -422,7 +425,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) return NULL; } -size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes) +size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& WXUNUSED(mimetypes)) { // enumerate all keys under MIME_DATABASE_KEY // TODO: diff --git a/src/os2/msgdlg.cpp b/src/os2/msgdlg.cpp index 1c7e16b39b..003c506618 100644 --- a/src/os2/msgdlg.cpp +++ b/src/os2/msgdlg.cpp @@ -36,13 +36,11 @@ IMPLEMENT_CLASS(wxMessageDialog, wxDialog) -wxMessageDialog::wxMessageDialog( - wxWindow* pParent -, const wxString& rsMessage -, const wxString& rsCaption -, long lStyle -, const wxPoint& pPos -) +wxMessageDialog::wxMessageDialog( wxWindow* WXUNUSED(pParent), + const wxString& rsMessage, + const wxString& rsCaption, + long lStyle, + const wxPoint& WXUNUSED(pPos) ) { m_sCaption = rsCaption; m_sMessage = rsMessage; @@ -138,4 +136,3 @@ int wxMessageDialog::ShowModal() } return nAns; } // end of wxMessageDialog::ShowModal - diff --git a/src/os2/notebook.cpp b/src/os2/notebook.cpp index 398290e166..89f0f9d6fd 100644 --- a/src/os2/notebook.cpp +++ b/src/os2/notebook.cpp @@ -35,7 +35,11 @@ // ---------------------------------------------------------------------------- // check that the page index is valid -#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount())) +#define IS_VALID_PAGE(nPage) ( \ + /* size_t is _always_ >= 0 */ \ + /* ((nPage) >= 0) && */ \ + ((nPage) < GetPageCount()) \ + ) // hide the ugly cast #define m_hWnd (HWND)GetHWND() @@ -112,14 +116,12 @@ wxNotebook::wxNotebook( // // Create() function // -bool wxNotebook::Create( - wxWindow* pParent -, wxWindowID vId -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, const wxString& rsName -) +bool wxNotebook::Create( wxWindow* pParent, + wxWindowID vId, + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + const wxString& rsName ) { // // Base init @@ -132,7 +134,7 @@ bool wxNotebook::Create( ,wxDefaultValidator ,rsName )) - return FALSE; + return false; // // Notebook, so explicitly specify 0 as last parameter @@ -143,10 +145,10 @@ bool wxNotebook::Create( ,rSize ,lStyle | wxTAB_TRAVERSAL )) - return FALSE; + return false; SetBackgroundColour(wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE))); - return TRUE; + return true; } // end of wxNotebook::Create WXDWORD wxNotebook::OS2GetStyle ( @@ -205,9 +207,7 @@ int wxNotebook::GetRowCount() const ); } // end of wxNotebook::GetRowCount -int wxNotebook::SetSelection( - size_t nPage -) +int wxNotebook::SetSelection( size_t nPage ) { wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") ); @@ -240,10 +240,8 @@ int wxNotebook::SetSelection( return nPage; } // end of wxNotebook::SetSelection -bool wxNotebook::SetPageText( - size_t nPage -, const wxString& rsStrText -) +bool wxNotebook::SetPageText( size_t nPage, + const wxString& rsStrText ) { wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") ); return (bool)::WinSendMsg( m_hWnd @@ -253,9 +251,7 @@ bool wxNotebook::SetPageText( ); } // end of wxNotebook::SetPageText -wxString wxNotebook::GetPageText ( - size_t nPage -) const +wxString wxNotebook::GetPageText ( size_t nPage ) const { BOOKTEXT vBookText; wxChar zBuf[256]; @@ -302,9 +298,7 @@ wxString wxNotebook::GetPageText ( return sStr; } // end of wxNotebook::GetPageText -int wxNotebook::GetPageImage ( - size_t nPage -) const +int wxNotebook::GetPageImage ( size_t nPage ) const { wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") ); @@ -332,10 +326,10 @@ void wxNotebook::SetImageList ( wxImageList* pImageList ) { - // + // // Does not really do anything yet, but at least we need to // update the base class. - // + // wxNotebookBase::SetImageList(pImageList); } // end of wxNotebook::SetImageList @@ -378,11 +372,9 @@ void wxNotebook::SetTabSize ( // // Remove one page from the notebook, without deleting // -wxNotebookPage* wxNotebook::DoRemovePage ( - size_t nPage -) +wxNotebookPage* wxNotebook::DoRemovePage ( size_t nPage ) { - wxNotebookPage* pPageRemoved = wxNotebookBase::DoRemovePage(nPage); + wxNotebookPage* pPageRemoved = wxNotebookBase::DoRemovePage(nPage); if (!pPageRemoved) return NULL; @@ -463,7 +455,8 @@ bool wxNotebook::DeleteAllPages() ,(MPARAM)BKA_ALL ); m_nSelection = -1; - return TRUE; + + return true; } // end of wxNotebook::DeleteAllPages // @@ -487,13 +480,11 @@ bool wxNotebook::AddPage ( // // Same as AddPage() but does it at given position // -bool wxNotebook::InsertPage ( - size_t nPage -, wxNotebookPage* pPage -, const wxString& rsStrText -, bool bSelect -, int nImageId -) +bool wxNotebook::InsertPage ( size_t nPage, + wxNotebookPage* pPage, + const wxString& rsStrText, + bool bSelect, + int nImageId ) { ULONG ulApiPage; @@ -585,9 +576,9 @@ bool wxNotebook::InsertPage ( // Now set TAB dimenstions // - wxWindowDC vDC(this); - wxCoord nTextX; - wxCoord nTextY; + wxWindowDC vDC(this); + wxCoord nTextX; + wxCoord nTextY; vDC.GetTextExtent(rsStrText, &nTextX, &nTextY); nTextY *= 2; @@ -604,7 +595,7 @@ bool wxNotebook::InsertPage ( // // Now set any TAB text // - if (!rsStrText.IsEmpty()) + if (!rsStrText.empty()) { if (!SetPageText( nPage ,rsStrText @@ -845,12 +836,10 @@ bool wxNotebook::DoPhase ( // ---------------------------------------------------------------------------- // wxNotebook Windows message handlers // ---------------------------------------------------------------------------- -bool wxNotebook::OS2OnScroll ( - int nOrientation -, WXWORD wSBCode -, WXWORD wPos -, WXHWND wControl -) +bool wxNotebook::OS2OnScroll ( int nOrientation, + WXWORD wSBCode, + WXWORD wPos, + WXHWND wControl ) { // // Don't generate EVT_SCROLLWIN events for the WM_SCROLLs coming from the @@ -866,4 +855,3 @@ bool wxNotebook::OS2OnScroll ( } // end of wxNotebook::OS2OnScroll #endif // wxUSE_NOTEBOOK - diff --git a/src/os2/ownerdrw.cpp b/src/os2/ownerdrw.cpp index 308a920978..e0bc262832 100644 --- a/src/os2/ownerdrw.cpp +++ b/src/os2/ownerdrw.cpp @@ -41,11 +41,9 @@ // ctor // ---- // -wxOwnerDrawn::wxOwnerDrawn( - const wxString& rsStr -, bool bCheckable -, bool bMenuItem -) +wxOwnerDrawn::wxOwnerDrawn( const wxString& rsStr, + bool bCheckable, + bool WXUNUSED(bMenuItem) ) : m_strName(rsStr) { m_bCheckable = bCheckable; @@ -67,15 +65,12 @@ size_t wxOwnerDrawn::ms_nLastMarginWidth = ms_nDefaultMarginWidth; // ------- // -bool wxOwnerDrawn::OnMeasureItem( - size_t* pWidth -, size_t* pHeight -) +bool wxOwnerDrawn::OnMeasureItem( size_t* pWidth, + size_t* pHeight ) { - wxMemoryDC vDC; + wxMemoryDC vDC; - - wxString sStr = wxStripMenuCodes(m_strName); + wxString sStr = wxStripMenuCodes(m_strName); // // If we have a valid accel string, then pad out @@ -91,7 +86,7 @@ bool wxOwnerDrawn::OnMeasureItem( ,(long *)pWidth ,(long *)pHeight ); - if (!m_strAccel.IsEmpty()) + if (!m_strAccel.empty()) { // // Measure the accelerator string, and add its width to @@ -168,22 +163,20 @@ bool wxOwnerDrawn::OnMeasureItem( if (*pHeight < m_nMinHeight) *pHeight = m_nMinHeight; m_nHeight = *pHeight; // remember height for use in OnDrawItem - return TRUE; + return true; } // end of wxOwnerDrawn::OnMeasureItem // draw the item -bool wxOwnerDrawn::OnDrawItem( - wxDC& rDC -, const wxRect& rRect -, wxODAction eAction -, wxODStatus eStatus -) +bool wxOwnerDrawn::OnDrawItem( wxDC& rDC, + const wxRect& rRect, + wxODAction eAction, + wxODStatus eStatus ) { // // We do nothing on focus change // if (eAction == wxODFocusChanged ) - return TRUE; + return true; // // Select the font and draw the text @@ -302,15 +295,15 @@ bool wxOwnerDrawn::OnDrawItem( // // Display main text and accel text separately to align better // - wxString sTgt = wxT("\t"); - wxString sFullString = m_strName; // need to save the original text - wxString sAccel; - int nIndex; - size_t nWidth; - size_t nCharWidth; - size_t nHeight; - bool bFoundMnemonic = FALSE; - bool bFoundAccel = FALSE; + wxString sTgt = wxT("\t"); + wxString sFullString = m_strName; // need to save the original text + wxString sAccel; + int nIndex; + size_t nWidth; + size_t nCharWidth; + size_t nHeight; + bool bFoundMnemonic = false; + bool bFoundAccel = false; // // Deal with the tab, extracting the Accel text @@ -318,7 +311,7 @@ bool wxOwnerDrawn::OnDrawItem( nIndex = sFullString.Find(sTgt.c_str()); if (nIndex != -1) { - bFoundAccel = TRUE; + bFoundAccel = true; sAccel = sFullString.Mid(nIndex + 1); sFullString.Remove(nIndex); } @@ -330,9 +323,9 @@ bool wxOwnerDrawn::OnDrawItem( nIndex = sFullString.Find(sTgt.c_str()); if (nIndex != -1) { - wxString sTmp = sFullString; + wxString sTmp = sFullString; - bFoundMnemonic = TRUE; + bFoundMnemonic = true; sTmp.Remove(nIndex); rDC.GetTextExtent( sTmp ,(long *)&nWidth @@ -343,7 +336,7 @@ bool wxOwnerDrawn::OnDrawItem( ,(long *)&nCharWidth ,(long *)&nHeight ); - sFullString.Replace(sTgt.c_str(), wxEmptyString, TRUE); + sFullString.Replace(sTgt.c_str(), wxEmptyString, true); } // @@ -426,7 +419,7 @@ bool wxOwnerDrawn::OnDrawItem( // // For uncheckable item we use only the 'checked' bitmap // - wxBitmap vBmp(GetBitmap(IsCheckable() ? ((eStatus & wxODChecked) != 0) : TRUE)); + wxBitmap vBmp(GetBitmap(IsCheckable() ? ((eStatus & wxODChecked) != 0) : TRUE)); if (vBmp.Ok()) { @@ -461,7 +454,7 @@ bool wxOwnerDrawn::OnDrawItem( ,0 ,0 ,wxCOPY - ,TRUE + ,true ); if (eStatus & wxODSelected) @@ -489,7 +482,7 @@ bool wxOwnerDrawn::OnDrawItem( vBmp.SetSelectedInto(NULL); } } - return TRUE; + return true; } // end of wxOwnerDrawn::OnDrawItem #endif //wxUSE_OWNER_DRAWN diff --git a/src/os2/palette.cpp b/src/os2/palette.cpp index 43252c4070..dd48397fc9 100644 --- a/src/os2/palette.cpp +++ b/src/os2/palette.cpp @@ -6,7 +6,7 @@ // Created: ??/??/98 // RCS-ID: $Id$ // Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". @@ -68,24 +68,20 @@ wxPalette::~wxPalette() { } // end of wxPalette::~wxPalette -bool wxPalette::FreeResource( - bool bForce -) +bool wxPalette::FreeResource( bool WXUNUSED(bForce) ) { if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette) { ::GpiSelectPalette(M_PALETTEDATA->m_hPS, NULLHANDLE); ::GpiDeletePalette((HPAL)M_PALETTEDATA->m_hPalette); } - return TRUE; + return true; } // end of wxPalette::FreeResource -bool wxPalette::Create( - int n -, const unsigned char* pRed -, const unsigned char* pGreen -, const unsigned char* pBlue -) +bool wxPalette::Create( int n, + const unsigned char* pRed, + const unsigned char* pGreen, + const unsigned char* pBlue ) { PULONG pualTable; @@ -94,7 +90,7 @@ bool wxPalette::Create( m_refData = new wxPaletteRefData; pualTable = new ULONG[n]; if (!pualTable) - return(FALSE); + return false; for (int i = 0; i < n; i ++) { @@ -107,7 +103,7 @@ bool wxPalette::Create( ,pualTable ); delete [] pualTable; - return TRUE; + return true; } // end of wxPalette::Create int wxPalette::GetPixel( @@ -153,12 +149,12 @@ int wxPalette::GetPixel( // // Now loop through and find the matching entry // - ULONG i; + ULONG i; for (i = 0; i < ulNumEntries; i++) { if (pualTable[i] == ulRGB) { - bFound = TRUE; + bFound = true; break; } } @@ -234,4 +230,3 @@ void wxPalette::SetPS( ::GpiSelectPalette(M_PALETTEDATA->m_hPS, M_PALETTEDATA->m_hPalette); M_PALETTEDATA->m_hPS = hPS; } // end of wxPalette::SetHPALETTE - diff --git a/src/os2/pen.cpp b/src/os2/pen.cpp index 3821b69f7d..a19f195160 100644 --- a/src/os2/pen.cpp +++ b/src/os2/pen.cpp @@ -156,11 +156,11 @@ bool wxPen::RealizeResource() } if (M_PENDATA->m_nStyle == wxTRANSPARENT) { - return TRUE; + return true; } - COLORREF vPmColour = 0L; - USHORT uLineType = wx2os2PenStyle(M_PENDATA->m_nStyle); + COLORREF vPmColour = 0L; + USHORT uLineType = (USHORT)wx2os2PenStyle(M_PENDATA->m_nStyle); vPmColour = M_PENDATA->m_vColour.GetPixel(); @@ -302,9 +302,10 @@ bool wxPen::RealizeResource() sError = wxPMErrorToStr(vError); wxLogError(_T("Can't set Gpi attributes for an AREABUNDLE. Error: %s\n"), sError.c_str()); } - return bOk; + + return (bool)bOk; } - return FALSE; + return false; } // end of wxPen::RealizeResource WXHANDLE wxPen::GetResourceHandle() @@ -315,16 +316,14 @@ WXHANDLE wxPen::GetResourceHandle() return (WXHANDLE)M_PENDATA->m_hPen; } // end of wxPen::GetResourceHandle -bool wxPen::FreeResource( - bool bForce -) +bool wxPen::FreeResource( bool WXUNUSED(bForce) ) { if (M_PENDATA && (M_PENDATA->m_hPen != 0)) { M_PENDATA->m_hPen = 0; - return TRUE; + return true; } - else return FALSE; + else return false; } // end of wxPen::FreeResource bool wxPen::IsFree() const @@ -406,10 +405,8 @@ void wxPen::SetStipple( RealizeResource(); } // end of wxPen::SetStipple -void wxPen::SetDashes( - int nNbDashes -, const wxDash* pDash -) +void wxPen::SetDashes( int WXUNUSED(nNbDashes), + const wxDash* WXUNUSED(pDash) ) { // // Does nothing under OS/2 @@ -473,5 +470,3 @@ int wx2os2PenStyle( } return nPMStyle; } // end of wx2os2PenStyle - - diff --git a/src/os2/popupwin.cpp b/src/os2/popupwin.cpp index 3592101960..5f80644ce1 100644 --- a/src/os2/popupwin.cpp +++ b/src/os2/popupwin.cpp @@ -34,10 +34,8 @@ // implementation // ============================================================================ -bool wxPopupWindow::Create( - wxWindow* pParent -, int nFlags -) +bool wxPopupWindow::Create( wxWindow* pParent, + int nFlags ) { return wxPopupWindowBase::Create(pParent) && wxWindow::Create( pParent @@ -48,10 +46,8 @@ bool wxPopupWindow::Create( ); } // end of wxPopupWindow::Create -void wxPopupWindow::DoGetPosition( - int* pnX -, int* pnY -) const +void wxPopupWindow::DoGetPosition( int* pnX, + int* pnY ) const { // // The position of a "top level" window such as this should be in @@ -70,16 +66,12 @@ WXHWND wxPopupWindow::OS2GetParent() const return (WXHWND)HWND_DESKTOP; } // end of wxPopupWindow::OS2GetParent -WXDWORD wxPopupWindow::OS2GetStyle( - long lFlags -, WXDWORD* dwExstyle -) const +WXDWORD wxPopupWindow::OS2GetStyle( long lFlags, + WXDWORD* dwExstyle ) const { - WXDWORD dwStyle = wxWindow::OS2GetStyle( lFlags & wxBORDER_MASK - ,dwExstyle - ); + WXDWORD dwStyle = wxWindow::OS2GetStyle( lFlags & wxBORDER_MASK + ,dwExstyle + ); return dwStyle; } // end of wxPopupWindow::OS2GetStyle - - diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index ec7d210b61..1e026433fc 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -90,24 +90,22 @@ wxRadioBox::~wxRadioBox() delete[] m_pnRadioHeight; } // end of wxRadioBox::~wxRadioBox -void wxRadioBox::AdjustButtons( - int nX -, int nY -, int nWidth -, int nHeight -, int nSizeFlags -) +void wxRadioBox::AdjustButtons( int nX, + int nY, + int nWidth, + int nHeight, + int WXUNUSED(nSizeFlags) ) { - wxSize vMaxSize; - int nXOffset = nX; - int nYOffset = nY + nHeight; - int nCx1; - int nCy1; - int nStartX; - int nStartY; - int nMaxWidth; - int nMaxHeight; - wxFont vFont = GetFont(); + wxSize vMaxSize; + int nXOffset = nX; + int nYOffset = nY + nHeight; + int nCx1; + int nCy1; + int nStartX; + int nStartY; + int nMaxWidth; + int nMaxHeight; + wxFont vFont = GetFont(); wxGetCharSize( m_hWnd ,&nCx1 @@ -754,10 +752,8 @@ wxSize wxRadioBox::GetMaxButtonSize() const if (nHeightMax < nHeight ) nHeightMax = nHeight; } - return(wxSize( nWidthMax - ,nHeightMax - ) - ); + wxSize maxsize( nWidthMax, nHeightMax); + return maxsize; } // end of wxRadioBox::GetMaxButtonSize int wxRadioBox::GetNumHor() const @@ -784,10 +780,8 @@ int wxRadioBox::GetNumVer() const } } // end of wxRadioBox::GetNumVer -void wxRadioBox::GetPosition( - int* pnX -, int* pnY -) const +void wxRadioBox::GetPosition( int* pnX, + int* WXUNUSED(pnY) ) const { wxWindowOS2* pParent = GetParent(); RECT vRect = { -1, -1, -1, -1 }; @@ -892,23 +886,17 @@ wxString wxRadioBox::GetStringSelection() const return sResult; } // end of wxRadioBox::GetStringSelection -wxSize wxRadioBox::GetTotalButtonSize( - const wxSize& rSizeBtn -) const +wxSize wxRadioBox::GetTotalButtonSize( const wxSize& rSizeBtn ) const { - int nCx1; - int nCy1; - int nExtraHeight; - int nHeight; - int nWidth; - int nWidthLabel; - wxFont vFont = GetFont(); - - wxGetCharSize( m_hWnd - ,&nCx1 - ,&nCy1 - ,&vFont - ); + int nCx1; + int nCy1; + int nExtraHeight; + int nHeight; + int nWidth; + int nWidthLabel; + wxFont vFont = GetFont(); + + wxGetCharSize( m_hWnd, &nCx1, &nCy1, &vFont ); nExtraHeight = nCy1; nHeight = GetNumVer() * rSizeBtn.y + (2 * nCy1); @@ -925,46 +913,37 @@ wxSize wxRadioBox::GetTotalButtonSize( if (nWidthLabel > nWidth) nWidth = nWidthLabel; - return(wxSize( nWidth - ,nHeight - ) - ); + wxSize total( nWidth, nHeight ); + return total; } // end of wxRadioBox::GetTotalButtonSize -WXHBRUSH wxRadioBox::OnCtlColor( - WXHDC hwinDC -, WXHWND hWnd -, WXUINT uCtlColor -, WXUINT uMessage -, WXWPARAM wParam -, WXLPARAM lParam -) +WXHBRUSH wxRadioBox::OnCtlColor( WXHDC hwinDC, + WXHWND WXUNUSED(hWnd), + WXUINT WXUNUSED(uCtlColor), + WXUINT WXUNUSED(uMessage), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam) ) { - HPS hPS = (HPS)hwinDC; // pass in a PS handle in OS/2 + HPS hPS = (HPS)hwinDC; // pass in a PS handle in OS/2 if (GetParent()->GetTransparentBackground()) ::GpiSetBackMix(hPS, BM_LEAVEALONE); else ::GpiSetBackMix(hPS, BM_OVERPAINT); - wxColour vColBack = GetBackgroundColour(); + wxColour vColBack = GetBackgroundColour(); ::GpiSetBackColor(hPS, vColBack.GetPixel()); ::GpiSetColor(hPS, vColBack.GetPixel()); - - wxBrush* pBrush = wxTheBrushList->FindOrCreateBrush( vColBack - ,wxSOLID - ); + wxBrush* pBrush = wxTheBrushList->FindOrCreateBrush( vColBack, wxSOLID ); return ((WXHBRUSH)pBrush->GetResourceHandle()); } // end of wxRadioBox::OnCtlColor -bool wxRadioBox::OS2Command( - WXUINT uCmd -, WXWORD wId -) +bool wxRadioBox::OS2Command( WXUINT uCmd, + WXWORD wId) { - int nSelectedButton = -1; + int nSelectedButton = -1; if (uCmd == BN_CLICKED) { @@ -1235,4 +1214,3 @@ MRESULT EXPENTRY wxRadioBoxWndProc( ) ); } // end of wxRadioBoxWndProc - diff --git a/src/os2/radiobut.cpp b/src/os2/radiobut.cpp index 3a5f166c67..61fd55f4b0 100644 --- a/src/os2/radiobut.cpp +++ b/src/os2/radiobut.cpp @@ -153,24 +153,21 @@ bool wxRadioButton::GetValue() const return((::WinSendMsg((HWND) GetHWND(), BM_QUERYCHECK, (MPARAM)0L, (MPARAM)0L) != 0)); } // end of wxRadioButton::GetValue -bool wxRadioButton::OS2Command( - WXUINT wParam -, WXWORD wId -) +bool wxRadioButton::OS2Command( WXUINT wParam, WXWORD WXUNUSED(wId) ) { if (wParam != BN_CLICKED) - return FALSE; + return false; if (m_bFocusJustSet) { // // See above: we want to ignore this event // - m_bFocusJustSet = FALSE; + m_bFocusJustSet = false; } else { - bool bIsChecked = GetValue(); + bool bIsChecked = GetValue(); if (HasFlag(wxRB_SINGLE)) { @@ -182,14 +179,11 @@ bool wxRadioButton::OS2Command( if (!bIsChecked ) SetValue(TRUE); } - wxCommandEvent rEvent( wxEVT_COMMAND_RADIOBUTTON_SELECTED - ,m_windowId - ); - + wxCommandEvent rEvent( wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId ); rEvent.SetEventObject(this); ProcessCommand(rEvent); } - return TRUE; + return true; } // end of wxRadioButton::OS2Command void wxRadioButton::SetFocus() @@ -203,7 +197,7 @@ void wxRadioButton::SetFocus() // // to avoid this, we drop the pseudo BN_CLICKED events generated when the // button gains focus - m_bFocusJustSet = TRUE; + m_bFocusJustSet = true; wxControl::SetFocus(); } diff --git a/src/os2/scrolbar.cpp b/src/os2/scrolbar.cpp index 8837a46404..0126d2b01b 100644 --- a/src/os2/scrolbar.cpp +++ b/src/os2/scrolbar.cpp @@ -97,9 +97,7 @@ bool wxScrollBar::Create ( ,(MPARAM)0 ,MPFROM2SHORT(0,1) ); - ::WinShowWindow( hScrollBar - ,TRUE - ); + ::WinShowWindow( hScrollBar, TRUE ); SetFont(*wxSMALL_FONT); m_hWnd = hScrollBar; @@ -120,21 +118,19 @@ wxScrollBar::~wxScrollBar() { } -bool wxScrollBar::OS2OnScroll ( - int nOrientation -, WXWORD wParam -, WXWORD wPos -, WXHWND hControl -) +bool wxScrollBar::OS2OnScroll ( int WXUNUSED(nOrientation), + WXWORD wParam, + WXWORD wPos, + WXHWND WXUNUSED(hControl) ) { - int nPosition; - int nMaxPos; - int nTrackPos = wPos; - int nMinPos; - int nScrollInc; - wxEventType vScrollEvent = wxEVT_NULL; + int nPosition; + int nMaxPos; + int nTrackPos = wPos; + int nMinPos; + int nScrollInc; + wxEventType vScrollEvent = wxEVT_NULL; - MRESULT vRange; + MRESULT vRange; // // When we're dragging the scrollbar we can't use pos parameter because it @@ -219,7 +215,7 @@ bool wxScrollBar::OS2OnScroll ( // Don't process the event if there is no displacement, // unless this is a thumb release or end scroll event. // - return FALSE; + return false; } wxScrollEvent vEvent( vScrollEvent @@ -232,15 +228,13 @@ bool wxScrollBar::OS2OnScroll ( return GetEventHandler()->ProcessEvent(vEvent); } // end of wxScrollBar::OS2OnScroll -void wxScrollBar::SetThumbPosition ( - int nViewStart -) +void wxScrollBar::SetThumbPosition ( int nViewStart ) { SBCDATA vInfo; memset(&vInfo, '\0', sizeof(SBCDATA)); vInfo.cb = sizeof(SBCDATA); - vInfo.posThumb = nViewStart; + vInfo.posThumb = (SHORT)nViewStart; ::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL); ::WinSendMsg((HWND)GetHwnd(), SBM_SETPOS, (MPARAM)nViewStart, (MPARAM)NULL); @@ -251,13 +245,11 @@ int wxScrollBar::GetThumbPosition() const return((int)(MRESULT)::WinSendMsg((HWND)GetHwnd(), SBM_QUERYPOS, (MPARAM)NULL, (MPARAM)NULL)); } // end of wxScrollBar::GetThumbPosition -void wxScrollBar::SetScrollbar ( - int nPosition -, int nThumbSize -, int nRange -, int nPageSize -, bool bRefresh -) +void wxScrollBar::SetScrollbar ( int nPosition, + int nThumbSize, + int nRange, + int nPageSize, + bool WXUNUSED(bRefresh) ) { SBCDATA vInfo; // @@ -280,22 +272,20 @@ void wxScrollBar::SetScrollbar ( nRange1 += (m_nPageSize - 1); } vInfo.cb = sizeof(SBCDATA); - vInfo.cVisible = m_nPageSize; + vInfo.cVisible = (SHORT)m_nPageSize; vInfo.posFirst = 0; - vInfo.posLast = nRange1; - vInfo.posThumb = nPosition; + vInfo.posLast = (SHORT)nRange1; + vInfo.posThumb = (SHORT)nPosition; ::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL); } // end of wxScrollBar::SetScrollbar -WXHBRUSH wxScrollBar::OnCtlColor ( - WXHDC hDC -, WXHWND hWnd -, WXUINT uCtlColor -, WXUINT uMessage -, WXWPARAM wParam -, WXLPARAM lParam -) +WXHBRUSH wxScrollBar::OnCtlColor ( WXHDC WXUNUSED(hDC), + WXHWND WXUNUSED(hWnd), + WXUINT WXUNUSED(uCtlColor), + WXUINT WXUNUSED(uMessage), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam) ) { // // Does nothing under OS/2 @@ -303,11 +293,8 @@ WXHBRUSH wxScrollBar::OnCtlColor ( return 0; } // end of wxScrollBar::OnCtlColor -void wxScrollBar::Command ( - wxCommandEvent& rEvent -) +void wxScrollBar::Command ( wxCommandEvent& rEvent ) { SetThumbPosition(rEvent.GetInt()); ProcessCommand(rEvent); } // end of wxScrollBar::Command - diff --git a/src/os2/settings.cpp b/src/os2/settings.cpp index 264e05b4e3..6bad06933b 100644 --- a/src/os2/settings.cpp +++ b/src/os2/settings.cpp @@ -166,7 +166,6 @@ wxColour wxSystemSettingsNative::GetColour( case wxSYS_COLOUR_LISTBOX: case wxSYS_COLOUR_CAPTIONTEXT: return(*wxWHITE); - break; case wxSYS_COLOUR_WINDOWTEXT: case wxSYS_COLOUR_INACTIVECAPTIONTEXT: @@ -249,10 +248,8 @@ wxFont wxSystemSettingsNative::GetFont( } // Get a system metric, e.g. scrollbar size -int wxSystemSettingsNative::GetMetric( - wxSystemMetric index -, wxWindow* WXUNUSED(win) -) +int wxSystemSettingsNative::GetMetric( wxSystemMetric index, + wxWindow* WXUNUSED(win) ) { switch ( index) { @@ -276,12 +273,12 @@ int wxSystemSettingsNative::GetMetric( // TODO case wxSYS_ICONSPACING_Y: // TODO case wxSYS_WINDOWMIN_X: // TODO case wxSYS_WINDOWMIN_Y: - + case wxSYS_SCREEN_X: return ::WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); case wxSYS_SCREEN_Y: return ::WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); - + // TODO case wxSYS_FRAMESIZE_X: // TODO case wxSYS_FRAMESIZE_Y: // TODO case wxSYS_SMALLICON_X: @@ -297,27 +294,20 @@ int wxSystemSettingsNative::GetMetric( // TODO case wxSYS_PENWINDOWS_PRESENT: // TODO case wxSYS_SHOW_SOUNDS: // TODO case wxSYS_SWAP_BUTTONS: - - default: - return -1; // unsupported metric } - return 0; + return -1; // unsupported metric } -bool wxSystemSettingsNative::HasFeature( - wxSystemFeature index -) +bool wxSystemSettingsNative::HasFeature( wxSystemFeature index ) { switch (index) { case wxSYS_CAN_ICONIZE_FRAME: - return TRUE; + return true; case wxSYS_CAN_DRAW_FRAME_DECORATIONS: - return FALSE; - - default: - return FALSE; + return false; } - return FALSE; + + return false; } diff --git a/src/os2/slider.cpp b/src/os2/slider.cpp index 1c806c968a..e2827fa6ce 100644 --- a/src/os2/slider.cpp +++ b/src/os2/slider.cpp @@ -52,13 +52,11 @@ wxSlider::~wxSlider() ::WinDestroyWindow((HWND)m_hStaticValue); } // end of wxSlider::~wxSlider -void wxSlider::AdjustSubControls( - int nX -, int nY -, int nWidth -, int nHeight -, int nSizeFlags -) +void wxSlider::AdjustSubControls( int nX, + int nY, + int nWidth, + int nHeight, + int WXUNUSED(nSizeFlags) ) { int nXOffset = nX; int nYOffset = nY; @@ -312,20 +310,20 @@ bool wxSlider::Create( lMsStyle |= SLS_RIBBONSTRIP; m_nPageSize = ((nMaxValue - nMinValue)/10); - vSlData.usScale1Increments = m_nPageSize; - vSlData.usScale2Increments = m_nPageSize; - - HWND hScrollBar = ::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle - ,WC_SLIDER // Window class - ,(PSZ)wxBuffer // Initial Text - ,(ULONG)lMsStyle // Style flags - ,0L, 0L, 0L, 0L // Origin -- 0 size - ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent - ,HWND_BOTTOM // initial z position - ,(HMENU)m_windowId // Window identifier - ,&vSlData // Slider control data - ,NULL // no Presentation parameters - ); + vSlData.usScale1Increments = (USHORT)m_nPageSize; + vSlData.usScale2Increments = (USHORT)m_nPageSize; + + HWND hScrollBar = ::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle + ,WC_SLIDER // Window class + ,(PSZ)wxBuffer // Initial Text + ,(ULONG)lMsStyle // Style flags + ,0L, 0L, 0L, 0L // Origin -- 0 size + ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent + ,HWND_BOTTOM // initial z position + ,(HMENU)m_windowId // Window identifier + ,&vSlData // Slider control data + ,NULL // no Presentation parameters + ); m_nRangeMax = nMaxValue; m_nRangeMin = nMinValue; @@ -922,14 +920,12 @@ WXHBRUSH wxSlider::OnCtlColor( ); } // end of wxSlider::OnCtlColor -bool wxSlider::OS2OnScroll( - int WXUNUSED(nOrientation) -, WXWORD wParam -, WXWORD wPos -, WXHWND hControl -) +bool wxSlider::OS2OnScroll( int WXUNUSED(nOrientation), + WXWORD wParam, + WXWORD WXUNUSED(wPos), + WXHWND WXUNUSED(hControl) ) { - wxEventType eScrollEvent = wxEVT_NULL; + wxEventType eScrollEvent = wxEVT_NULL; switch (wParam) { @@ -948,24 +944,21 @@ bool wxSlider::OS2OnScroll( return false; } - int nPixelRange = SHORT1FROMMR(::WinSendMsg( GetHwnd() - ,SLM_QUERYSLIDERINFO - ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS - ,SMA_RANGEVALUE - ) - ,(MPARAM)0 - ) - ); + int nPixelRange = SHORT1FROMMR(::WinSendMsg( GetHwnd() + , SLM_QUERYSLIDERINFO + , MPFROM2SHORT( SMA_SHAFTDIMENSIONS, SMA_RANGEVALUE ) + , (MPARAM)0 + ) + ); m_dPixelToRange = (double)(nPixelRange - m_nThumbLength)/(double)(m_nRangeMax - m_nRangeMin); - int nNewPos = 0; - int nPixelPos = SHORT1FROMMR(::WinSendMsg( GetHwnd() - ,SLM_QUERYSLIDERINFO - ,MPFROM2SHORT( SMA_SLIDERARMPOSITION - ,SMA_RANGEVALUE - ) - ,(MPARAM)0 - ) - ); + int nNewPos = 0; + int nPixelPos = SHORT1FROMMR(::WinSendMsg( GetHwnd() + , SLM_QUERYSLIDERINFO + , MPFROM2SHORT( SMA_SLIDERARMPOSITION, SMA_RANGEVALUE ) + , (MPARAM)0 + ) + ); + nNewPos = (int)(nPixelPos/m_dPixelToRange); if (nNewPos > (m_nRangeMax - m_nRangeMin)/2) nNewPos++; @@ -978,34 +971,26 @@ bool wxSlider::OS2OnScroll( } SetValue(nNewPos); - wxScrollEvent vEvent( eScrollEvent - ,m_windowId - ); + wxScrollEvent vEvent( eScrollEvent, m_windowId ); vEvent.SetPosition(nNewPos); vEvent.SetEventObject(this); GetEventHandler()->ProcessEvent(vEvent); - wxCommandEvent vCevent( wxEVT_COMMAND_SLIDER_UPDATED - ,GetId() - ); + wxCommandEvent vCevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() ); vCevent.SetInt(nNewPos); vCevent.SetEventObject(this); return (GetEventHandler()->ProcessEvent(vCevent)); } // end of wxSlider::OS2OnScroll -void wxSlider::SetLineSize( - int nLineSize -) +void wxSlider::SetLineSize( int nLineSize ) { m_nLineSize = nLineSize; } // end of wxSlider::SetLineSize -void wxSlider::SetPageSize( - int nPageSize -) +void wxSlider::SetPageSize( int nPageSize ) { m_nPageSize = nPageSize; } // end of wxSlider::SetPageSize @@ -1094,15 +1079,12 @@ void wxSlider::SetTick( } // end of wxSlider::SetTick // For trackbars only -void wxSlider::SetTickFreq( - int n -, int nPos -) +void wxSlider::SetTickFreq( int n, int WXUNUSED(nPos) ) { - SLDCDATA vSlData; - WNDPARAMS vWndParams; - int nPixelPos; - int i; + SLDCDATA vSlData; + WNDPARAMS vWndParams; + int nPixelPos; + int i; vSlData.cbSize = sizeof(SLDCDATA); if (m_windowStyle & wxSL_AUTOTICKS) @@ -1110,8 +1092,8 @@ void wxSlider::SetTickFreq( vSlData.usScale1Spacing = 0; vSlData.usScale2Spacing = 0; } - vSlData.usScale1Increments = (m_nRangeMax - m_nRangeMin)/n; - vSlData.usScale2Increments = (m_nRangeMax - m_nRangeMin)/n; + vSlData.usScale1Increments = (USHORT)((m_nRangeMax - m_nRangeMin)/n); + vSlData.usScale2Increments = (USHORT)((m_nRangeMax - m_nRangeMin)/n); vWndParams.fsStatus = WPM_CTLDATA; vWndParams.cchText = 0L; diff --git a/src/os2/sound.cpp b/src/os2/sound.cpp index e073d9f7f2..91d6c1206f 100644 --- a/src/os2/sound.cpp +++ b/src/os2/sound.cpp @@ -121,22 +121,23 @@ bool wxSound::Create(int size, const wxByte* data) return TRUE; } -bool wxSound::DoPlay(unsigned flags) const +bool wxSound::DoPlay(unsigned WXUNUSED(flags)) const { - if (!IsOk()) - return FALSE; + if (!IsOk()) + return false; + // TODO: /* - return ( ::PlaySound((LPCTSTR)m_waveData, NULL, SND_MEMORY | - SND_NODEFAULT | (async ? SND_ASYNC : SND_SYNC) | (looped ? (SND_LOOP | SND_ASYNC) : 0)) != 0 ); + return ( ::PlaySound((LPCTSTR)m_waveData, NULL, SND_MEMORY | + SND_NODEFAULT | (async ? SND_ASYNC : SND_SYNC) | (looped ? (SND_LOOP | SND_ASYNC) : 0)) != 0 ); */ - return FALSE; + return false; } bool wxSound::Free() { - if (m_waveData) - { + if (m_waveData) + { // HGLOBAL waveData = ::GlobalHandle(m_waveData); // TODO: @@ -156,7 +157,6 @@ bool wxSound::Free() return TRUE; } */ - } - return FALSE; + } + return false; } - diff --git a/src/os2/spinbutt.cpp b/src/os2/spinbutt.cpp index 3b292128b0..14ac821f31 100644 --- a/src/os2/spinbutt.cpp +++ b/src/os2/spinbutt.cpp @@ -167,7 +167,8 @@ wxSize wxSpinButton::DoGetBestSize() const // 24x20 which is the size of the buttons and the borders. // Also we have no horizontal spin buttons. // - return (wxSize(24,20)); + wxSize best(24,20); + return best; } // end of wxSpinButton::DoGetBestSize // ---------------------------------------------------------------------------- @@ -190,31 +191,25 @@ int wxSpinButton::GetValue() const return ((int)lVal); } // end of wxSpinButton::GetValue -bool wxSpinButton::OS2OnScroll( - int nOrientation -, WXWORD wParam -, WXWORD wPos -, WXHWND hControl -) +bool wxSpinButton::OS2OnScroll( int WXUNUSED(nOrientation), + WXWORD WXUNUSED(wParam), + WXWORD wPos, + WXHWND hControl ) { - wxCHECK_MSG(hControl, FALSE, wxT("scrolling what?") ) + wxCHECK_MSG(hControl, false, wxT("scrolling what?") ) - wxSpinEvent vEvent( wxEVT_SCROLL_THUMBTRACK - ,m_windowId - ); - int nVal = (int)wPos; // cast is important for negative values! + wxSpinEvent vEvent( wxEVT_SCROLL_THUMBTRACK, m_windowId ); + int nVal = (int)wPos; // cast is important for negative values! vEvent.SetPosition(nVal); vEvent.SetEventObject(this); return(GetEventHandler()->ProcessEvent(vEvent)); } // end of wxSpinButton::OS2OnScroll -bool wxSpinButton::OS2Command( - WXUINT uCmd -, WXWORD wId -) +bool wxSpinButton::OS2Command( WXUINT WXUNUSED(uCmd), + WXWORD WXUNUSED(wId) ) { - return FALSE; + return false; } // end of wxSpinButton::OS2Command void wxSpinButton::SetRange( diff --git a/src/os2/spinctrl.cpp b/src/os2/spinctrl.cpp index b74642b7ca..93fb4fb140 100644 --- a/src/os2/spinctrl.cpp +++ b/src/os2/spinctrl.cpp @@ -117,18 +117,16 @@ wxSpinCtrl::~wxSpinCtrl() // construction // ---------------------------------------------------------------------------- -bool wxSpinCtrl::Create( - wxWindow* pParent -, wxWindowID vId -, const wxString& rsValue -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, int nMin -, int nMax -, int nInitial -, const wxString& rsName -) +bool wxSpinCtrl::Create( wxWindow* pParent, + wxWindowID vId, + const wxString& WXUNUSED(rsValue), + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + int nMin, + int nMax, + int nInitial, + const wxString& rsName ) { SWP vSwp; @@ -418,21 +416,17 @@ void wxSpinCtrl::OnSetFocus ( rEvent.Skip(); } // end of wxSpinCtrl::OnSetFocus -bool wxSpinCtrl::ProcessTextCommand( - WXWORD wCmd -, WXWORD wId -) +bool wxSpinCtrl::ProcessTextCommand( WXWORD wCmd, + WXWORD WXUNUSED(wId) ) { switch (wCmd) { case SPBN_CHANGE: { - wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED - ,GetId() - ); + wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED, GetId() ); vEvent.SetEventObject(this); - wxString sVal = wxGetWindowText(m_hWndBuddy); + wxString sVal = wxGetWindowText(m_hWndBuddy); vEvent.SetString(sVal); vEvent.SetInt(GetValue()); @@ -442,9 +436,9 @@ bool wxSpinCtrl::ProcessTextCommand( case SPBN_SETFOCUS: case SPBN_KILLFOCUS: { - wxFocusEvent vEvent( wCmd == EN_KILLFOCUS ? wxEVT_KILL_FOCUS : wxEVT_SET_FOCUS - ,m_windowId - ); + wxFocusEvent vEvent( wCmd == EN_KILLFOCUS ? wxEVT_KILL_FOCUS : wxEVT_SET_FOCUS + ,m_windowId + ); vEvent.SetEventObject(this); return(GetEventHandler()->ProcessEvent(vEvent)); diff --git a/src/os2/statbmp.cpp b/src/os2/statbmp.cpp index ed401f97db..c0893d25c3 100644 --- a/src/os2/statbmp.cpp +++ b/src/os2/statbmp.cpp @@ -69,15 +69,13 @@ static wxGDIImage* ConvertImage( // wxStaticBitmap // --------------------------------------------------------------------------- -bool wxStaticBitmap::Create( - wxWindow* pParent -, wxWindowID nId -, const wxGDIImage& rBitmap -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, const wxString& rName -) +bool wxStaticBitmap::Create( wxWindow* pParent, + wxWindowID nId, + const wxGDIImage& rBitmap, + const wxPoint& rPos, + const wxSize& WXUNUSED(rSize), + long lStyle, + const wxString& rName ) { ERRORID vError; wxString sError; @@ -123,7 +121,7 @@ bool wxStaticBitmap::Create( { vError = ::WinGetLastError(wxGetInstance()); sError = wxPMErrorToStr(vError); - return FALSE; + return false; } wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create static bitmap") ); m_pImage = ConvertImage(rBitmap); @@ -133,7 +131,7 @@ bool wxStaticBitmap::Create( SubclassWin(m_hWnd); SetSize(nX, nY, m_pImage->GetWidth(), m_pImage->GetHeight()); - return(TRUE); + return true; } // end of wxStaticBitmap::Create bool wxStaticBitmap::ImageIsOk() const diff --git a/src/os2/tabctrl.cpp b/src/os2/tabctrl.cpp index 17f96a705d..8c35755897 100644 --- a/src/os2/tabctrl.cpp +++ b/src/os2/tabctrl.cpp @@ -87,7 +87,9 @@ wxTabCtrl::~wxTabCtrl() UnsubclassWin(); } -bool wxTabCtrl::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) +bool wxTabCtrl::OS2OnNotify(int idCtrl, + WXLPARAM WXUNUSED(lParam), + WXLPARAM *WXUNUSED(result) ) { wxTabEvent event(wxEVT_NULL, m_windowId); wxEventType eventType = wxEVT_NULL; @@ -142,14 +144,14 @@ void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event) bool wxTabCtrl::DeleteAllItems() { // TODO - return FALSE; + return false; } // Delete an item -bool wxTabCtrl::DeleteItem(int item) +bool wxTabCtrl::DeleteItem(int WXUNUSED(item)) { // TODO - return FALSE; + return false; } // Get the selection @@ -180,10 +182,11 @@ int wxTabCtrl::GetItemCount() const } // Get the rect corresponding to the tab -bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const +bool wxTabCtrl::GetItemRect(int WXUNUSED(item), + wxRect& WXUNUSED(wxrect)) const { // TODO - return FALSE; + return false; } // Get the number of rows @@ -194,82 +197,85 @@ int wxTabCtrl::GetRowCount() const } // Get the item text -wxString wxTabCtrl::GetItemText(int item) const +wxString wxTabCtrl::GetItemText(int WXUNUSED(item)) const { // TODO - return wxString(wxEmptyString); + return wxEmptyString; } // Get the item image -int wxTabCtrl::GetItemImage(int item) const +int wxTabCtrl::GetItemImage(int WXUNUSED(item)) const { // TODO return 0; } // Get the item data -void* wxTabCtrl::GetItemData(int item) const +void* wxTabCtrl::GetItemData(int WXUNUSED(item)) const { // TODO return NULL; } // Hit test -int wxTabCtrl::HitTest(const wxPoint& pt, long& flags) +int wxTabCtrl::HitTest(const wxPoint& WXUNUSED(pt), long& WXUNUSED(flags)) { // TODO return 0; } // Insert an item -bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data) +bool wxTabCtrl::InsertItem(int WXUNUSED(item), + const wxString& WXUNUSED(text), + int WXUNUSED(imageId), + void* WXUNUSED(data)) { // TODO - return FALSE; + return false; } // Set the selection -int wxTabCtrl::SetSelection(int item) +int wxTabCtrl::SetSelection(int WXUNUSED(item)) { // TODO return 0; } // Set the image list -void wxTabCtrl::SetImageList(wxImageList* imageList) +void wxTabCtrl::SetImageList(wxImageList* WXUNUSED(imageList)) { // TODO } // Set the text for an item -bool wxTabCtrl::SetItemText(int item, const wxString& text) +bool wxTabCtrl::SetItemText(int WXUNUSED(item), const wxString& WXUNUSED(text)) { // TODO - return FALSE; + return false; } // Set the image for an item -bool wxTabCtrl::SetItemImage(int item, int image) +bool wxTabCtrl::SetItemImage(int WXUNUSED(item), int WXUNUSED(image)) { // TODO - return FALSE; + return false; } // Set the data for an item -bool wxTabCtrl::SetItemData(int item, void* data) +bool wxTabCtrl::SetItemData(int WXUNUSED(item), void* WXUNUSED(data)) { // TODO - return FALSE; + return false; } // Set the size for a fixed-width tab control -void wxTabCtrl::SetItemSize(const wxSize& size) +void wxTabCtrl::SetItemSize(const wxSize& WXUNUSED(size)) { // TODO } // Set the padding between tabs -void wxTabCtrl::SetPadding(const wxSize& padding) +void wxTabCtrl::SetPadding(const wxSize& WXUNUSED(padding)) { // TODO } @@ -344,9 +350,7 @@ void wxMapBitmap(HBITMAP hBitmap, int width, int height) // Tab event IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxCommandEvent) -wxTabEvent::wxTabEvent(wxEventType commandType, int id): - wxCommandEvent(commandType, id) +wxTabEvent::wxTabEvent(wxEventType commandType, int id) + :wxCommandEvent(commandType, id) { } - - diff --git a/src/os2/textctrl.cpp b/src/os2/textctrl.cpp index f02d4af9db..c9bc9d2411 100644 --- a/src/os2/textctrl.cpp +++ b/src/os2/textctrl.cpp @@ -25,8 +25,9 @@ #include "wx/log.h" #endif +#include "wx/app.h" + #if wxUSE_CLIPBOARD - #include "wx/app.h" #include "wx/clipbrd.h" #endif @@ -596,14 +597,12 @@ bool wxTextCtrl::IsEditable() const // Editing // ---------------------------------------------------------------------------- -void wxTextCtrl::Replace( - long lFrom -, long lTo -, const wxString& rsValue -) +void wxTextCtrl::Replace( long lFrom, + long lTo, + const wxString& rsValue ) { #if wxUSE_CLIPBOARD - HWND hWnd = GetHwnd(); + HWND hWnd = GetHwnd(); // // Set selection and remove it @@ -630,6 +629,9 @@ void wxTextCtrl::Replace( else ::WinSendMsg(hWnd, EM_PASTE, (MPARAM)0, (MPARAM)0); #else + wxUnusedVar(lFrom); + wxUnusedVar(lTo); + wxUnusedVar(rsValue); wxFAIL_MSG("wxTextCtrl::Replace not implemented if wxUSE_CLIPBOARD is 0."); #endif } // end of wxTextCtrl::Replace @@ -819,12 +821,10 @@ bool wxTextCtrl::PositionToXY( return true; } // end of wxTextCtrl::PositionToXY -void wxTextCtrl::ShowPosition( - long lPos -) +void wxTextCtrl::ShowPosition( long WXUNUSED(lPos) ) { - HWND hWnd = GetHwnd(); - long lCurrentLineLineNo = 0L; + HWND hWnd = GetHwnd(); + long lCurrentLineLineNo = 0L; // To scroll to a position, we pass the number of lines and characters // to scroll *by*. This means that we need to: @@ -851,17 +851,17 @@ void wxTextCtrl::ShowPosition( } } // end of wxTextCtrl::ShowPosition -int wxTextCtrl::GetLineLength( - long lLineNo -) const +int wxTextCtrl::GetLineLength( long WXUNUSED(lLineNo) ) const { - long lLen = 0L; + long lLen = 0L; if (m_bIsMLE) + { lLen = (long)::WinSendMsg(GetHwnd(), MLM_QUERYLINELENGTH, 0, 0); + } else { - WNDPARAMS vParams; + WNDPARAMS vParams; vParams.fsStatus = WPM_CCHTEXT; if (::WinSendMsg( GetHwnd() @@ -994,21 +994,17 @@ void wxTextCtrl::OnDropFiles( } } // end of wxTextCtrl::OnDropFiles -WXHBRUSH wxTextCtrl::OnCtlColor( - WXHDC hWxDC -, WXHWND hWnd -, WXUINT uCtlColor -, WXUINT uMessage -, WXWPARAM wParam -, WXLPARAM lParam -) +WXHBRUSH wxTextCtrl::OnCtlColor( WXHDC hWxDC, + WXHWND WXUNUSED(hWnd), + WXUINT WXUNUSED(uCtlColor), + WXUINT WXUNUSED(uMessage), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam) ) { - HPS hPS = (HPS)hWxDC; - wxColour vColBack = GetBackgroundColour(); - wxColour vColFore = GetForegroundColour(); - wxBrush* pBackgroundBrush = wxTheBrushList->FindOrCreateBrush( GetBackgroundColour() - ,wxSOLID - ); + HPS hPS = (HPS)hWxDC; + wxColour vColBack = GetBackgroundColour(); + wxColour vColFore = GetForegroundColour(); + wxBrush* pBackgroundBrush = wxTheBrushList->FindOrCreateBrush( vColBack, wxSOLID ); if (m_bUseCtl3D) { @@ -1207,148 +1203,107 @@ wxSize wxTextCtrl::DoGetBestSize() const // standard handlers for standard edit menu events // ---------------------------------------------------------------------------- -void wxTextCtrl::OnCut( - wxCommandEvent& rEvent -) +void wxTextCtrl::OnCut( wxCommandEvent& WXUNUSED(rEvent) ) { Cut(); } // end of wxTextCtrl::OnCut -void wxTextCtrl::OnCopy( - wxCommandEvent& rEvent -) +void wxTextCtrl::OnCopy( wxCommandEvent& WXUNUSED(rEvent) ) { Copy(); } // end of wxTextCtrl::OnCopy -void wxTextCtrl::OnPaste( - wxCommandEvent& rEvent -) +void wxTextCtrl::OnPaste( wxCommandEvent& WXUNUSED(rEvent) ) { Paste(); } // end of wxTextCtrl::OnPaste -void wxTextCtrl::OnUndo( - wxCommandEvent& rEvent -) +void wxTextCtrl::OnUndo( wxCommandEvent& WXUNUSED(rEvent) ) { Undo(); } // end of wxTextCtrl::OnUndo -void wxTextCtrl::OnRedo( - wxCommandEvent& rEvent -) +void wxTextCtrl::OnRedo( wxCommandEvent& WXUNUSED(rEvent) ) { Redo(); } // end of wxTextCtrl::OnRedo -void wxTextCtrl::OnDelete( - wxCommandEvent& rEvent -) +void wxTextCtrl::OnDelete( wxCommandEvent& WXUNUSED(rEvent) ) { - long lFrom; - long lTo; + long lFrom, lTo; + + GetSelection( &lFrom, &lTo ); - GetSelection( &lFrom - ,&lTo - ); if (lFrom != -1 && lTo != -1) - Remove( lFrom - ,lTo - ); + Remove( lFrom, lTo ); } // end of wxTextCtrl::OnDelete -void wxTextCtrl::OnSelectAll( - wxCommandEvent& rEvent -) +void wxTextCtrl::OnSelectAll( wxCommandEvent& WXUNUSED(rEvent) ) { SetSelection(-1, -1); } // end of wxTextCtrl::OnSelectAll -void wxTextCtrl::OnUpdateCut( - wxUpdateUIEvent& rEvent -) +void wxTextCtrl::OnUpdateCut( wxUpdateUIEvent& rEvent ) { rEvent.Enable(CanCut()); } // end of wxTextCtrl::OnUpdateCut -void wxTextCtrl::OnUpdateCopy( - wxUpdateUIEvent& rEvent -) +void wxTextCtrl::OnUpdateCopy( wxUpdateUIEvent& rEvent ) { rEvent.Enable(CanCopy()); } // end of wxTextCtrl::OnUpdateCopy -void wxTextCtrl::OnUpdatePaste( - wxUpdateUIEvent& rEvent -) +void wxTextCtrl::OnUpdatePaste( wxUpdateUIEvent& rEvent ) { rEvent.Enable(CanPaste()); } // end of wxTextCtrl::OnUpdatePaste -void wxTextCtrl::OnUpdateUndo( - wxUpdateUIEvent& rEvent -) +void wxTextCtrl::OnUpdateUndo( wxUpdateUIEvent& rEvent ) { rEvent.Enable(CanUndo()); } // end of wxTextCtrl::OnUpdateUndo -void wxTextCtrl::OnUpdateRedo( - wxUpdateUIEvent& rEvent -) +void wxTextCtrl::OnUpdateRedo( wxUpdateUIEvent& rEvent ) { rEvent.Enable(CanRedo()); } // end of wxTextCtrl::OnUpdateRedo -void wxTextCtrl::OnUpdateDelete( - wxUpdateUIEvent& rEvent -) +void wxTextCtrl::OnUpdateDelete( wxUpdateUIEvent& rEvent ) { - long lFrom; - long lTo; + long lFrom, lTo; - GetSelection( &lFrom - ,&lTo - ); + GetSelection( &lFrom, &lTo ); rEvent.Enable( lFrom != -1L && lTo != -1L && lFrom != lTo && IsEditable()) ; } // end of wxTextCtrl::OnUpdateDelete -void wxTextCtrl::OnUpdateSelectAll( - wxUpdateUIEvent& rEvent -) +void wxTextCtrl::OnUpdateSelectAll( wxUpdateUIEvent& rEvent ) { rEvent.Enable(GetLastPosition() > 0); } // end of wxTextCtrl::OnUpdateSelectAll -bool wxTextCtrl::SetBackgroundColour( - const wxColour& rColour -) +bool wxTextCtrl::SetBackgroundColour( const wxColour& rColour ) { if (m_bIsMLE) ::WinSendMsg(GetHwnd(), MLM_SETBACKCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX); return true; } // end of wxTextCtrl::SetBackgroundColour -bool wxTextCtrl::SetForegroundColour( - const wxColour& rColour -) +bool wxTextCtrl::SetForegroundColour( const wxColour& rColour ) { if (m_bIsMLE) ::WinSendMsg(GetHwnd(), MLM_SETTEXTCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX); return true; } // end of wxTextCtrl::SetForegroundColour -bool wxTextCtrl::SetStyle( - long lStart -, long lEnd -, const wxTextAttr& rStyle -) +bool wxTextCtrl::SetStyle( long lStart, + long lEnd, + const wxTextAttr& WXUNUSED(rStyle) ) { - HWND hWnd = GetHwnd(); + HWND hWnd = GetHwnd(); if (lStart > lEnd) { - long lTmp = lStart; + long lTmp = lStart; lStart = lEnd; lEnd = lTmp; @@ -1358,18 +1313,15 @@ bool wxTextCtrl::SetStyle( // We can only change the format of the selection, so select the range we // want and restore the old selection later // - long lStartOld; - long lEndOld; + long lStartOld, lEndOld; - GetSelection( &lStartOld - ,&lEndOld - ); + GetSelection( &lStartOld, &lEndOld ); // // But do we really have to change the selection? // - bool bChangeSel = lStart != lStartOld || - lEnd != lEndOld; + bool bChangeSel = lStart != lStartOld || + lEnd != lEndOld; if (bChangeSel) { @@ -1384,4 +1336,3 @@ bool wxTextCtrl::SetStyle( // return true; } // end of wxTextCtrl::SetStyle - diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index 6bfb019a73..c36201e2c9 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -64,8 +64,8 @@ wxMutex* p_wxMainMutex; // OS2 substitute for Tls pointer the current parent thread object wxThread* m_pThread; // pointer to the wxWidgets thread object -// if it's FALSE, some secondary thread is holding the GUI lock -static bool gs_bGuiOwnedByMainThread = TRUE; +// if it's false, some secondary thread is holding the GUI lock +static bool gs_bGuiOwnedByMainThread = true; // critical section which controls access to all GUI functions: any secondary // thread (i.e. except the main one) must enter this crit section before doing @@ -79,7 +79,7 @@ static wxCriticalSection *gs_pCritsectWaitingForGui = NULL; static size_t gs_nWaitingForGui = 0; // are we waiting for a thread termination? -static bool gs_bWaitingForThread = FALSE; +static bool gs_bWaitingForThread = false; // ============================================================================ // OS/2 implementation of thread and related classes @@ -109,13 +109,9 @@ private: // (Calls to DosRequestMutexSem and DosReleaseMutexSem can be nested, but // the request count for a semaphore cannot exceed 65535. If an attempt is // made to exceed this number, ERROR_TOO_MANY_SEM_REQUESTS is returned.) -wxMutexInternal::wxMutexInternal( - wxMutexType WXUNUSED(eMutexType) -) +wxMutexInternal::wxMutexInternal(wxMutexType WXUNUSED(eMutexType)) { - APIRET ulrc; - - ulrc = ::DosCreateMutexSem(NULL, &m_vMutex, 0L, FALSE); + APIRET ulrc = ::DosCreateMutexSem(NULL, &m_vMutex, 0L, FALSE); if (ulrc != 0) { wxLogSysError(_("Can not create mutex.")); @@ -406,7 +402,7 @@ void wxThreadInternal::OS2ThreadStart( if ( pThread->m_internal->GetState() == STATE_EXITED ) { dwRet = (DWORD)-1; - bWasCancelled = TRUE; + bWasCancelled = true; } else // do run thread { @@ -474,15 +470,14 @@ void wxThreadInternal::SetPriority( } } -bool wxThreadInternal::Create( - wxThread* pThread -, unsigned int uStackSize -) +bool wxThreadInternal::Create( wxThread* pThread, + unsigned int uStackSize) { - int tid; + int tid; if (!uStackSize) - uStackSize = 131072; + uStackSize = 131072; + pThread->m_critsect.Enter(); tid = _beginthread(wxThreadInternal::OS2ThreadStart, NULL, uStackSize, pThread); @@ -490,7 +485,7 @@ bool wxThreadInternal::Create( { wxLogSysError(_("Can't create thread")); - return FALSE; + return false; } m_hThread = tid; if (m_nPriority != WXTHREAD_DEFAULT_PRIORITY) @@ -498,30 +493,31 @@ bool wxThreadInternal::Create( SetPriority(m_nPriority); } - return(TRUE); + return true; } bool wxThreadInternal::Suspend() { - ULONG ulrc = ::DosSuspendThread(m_hThread); + ULONG ulrc = ::DosSuspendThread(m_hThread); if (ulrc != 0) { wxLogSysError(_("Can not suspend thread %lu"), m_hThread); - return FALSE; + return false; } m_eState = STATE_PAUSED; - return TRUE; + + return true; } bool wxThreadInternal::Resume() { - ULONG ulrc = ::DosResumeThread(m_hThread); + ULONG ulrc = ::DosResumeThread(m_hThread); if (ulrc != 0) { wxLogSysError(_("Can not resume thread %lu"), m_hThread); - return FALSE; + return false; } // don't change the state from STATE_EXITED because it's special and means @@ -532,7 +528,7 @@ bool wxThreadInternal::Resume() m_eState = STATE_RUNNING; } - return TRUE; + return true; } // static functions @@ -546,14 +542,15 @@ wxThread *wxThread::This() bool wxThread::IsMain() { - PTIB ptib; - PPIB ppib; + PTIB ptib; + PPIB ppib; ::DosGetInfoBlocks(&ptib, &ppib); if (ptib->tib_ptib2->tib2_ultid == s_ulIdMainThread) - return TRUE; - return FALSE; + return true; + + return false; } #ifdef Yield @@ -694,9 +691,9 @@ wxThreadError wxThread::Delete(ExitCode *pRc) // we might need to resume the thread, but we might also not need to cancel // it if it doesn't run yet - bool shouldResume = FALSE, - shouldCancel = TRUE, - isRunning = FALSE; + bool shouldResume = false, + shouldCancel = true, + isRunning = false; // check if the thread already started to run { @@ -711,10 +708,10 @@ wxThreadError wxThread::Delete(ExitCode *pRc) Resume(); // it knows about STATE_EXITED special case - shouldCancel = FALSE; - isRunning = TRUE; + shouldCancel = false; + isRunning = true; - // shouldResume is correctly set to FALSE here + // shouldResume is correctly set to false here } else { @@ -726,14 +723,14 @@ wxThreadError wxThread::Delete(ExitCode *pRc) if ( shouldResume ) Resume(); - TID hThread = m_internal->GetHandle(); + TID hThread = m_internal->GetHandle(); if ( isRunning || IsRunning()) { if (IsMain()) { // set flag for wxIsWaitingForThread() - gs_bWaitingForThread = TRUE; + gs_bWaitingForThread = true; } // ask the thread to terminate @@ -811,7 +808,7 @@ wxThreadError wxThread::Delete(ExitCode *pRc) if ( IsMain() ) { - gs_bWaitingForThread = FALSE; + gs_bWaitingForThread = false; } } @@ -858,9 +855,7 @@ wxThreadError wxThread::Kill() return wxTHREAD_NO_ERROR; } -void wxThread::Exit( - ExitCode pStatus -) +void wxThread::Exit(ExitCode WXUNUSED(pStatus)) { delete this; _endthread(); @@ -942,13 +937,13 @@ bool wxThreadModule::OnInit() gs_pCritsectGui = new wxCriticalSection(); gs_pCritsectGui->Enter(); - PTIB ptib; - PPIB ppib; + PTIB ptib; + PPIB ppib; ::DosGetInfoBlocks(&ptib, &ppib); s_ulIdMainThread = ptib->tib_ptib2->tib2_ultid; - return TRUE; + return true; } void wxThreadModule::OnExit() @@ -1011,7 +1006,7 @@ void WXDLLEXPORT wxMutexGuiLeave() if ( wxThread::IsMain() ) { - gs_bGuiOwnedByMainThread = FALSE; + gs_bGuiOwnedByMainThread = false; } else { @@ -1042,7 +1037,7 @@ void WXDLLEXPORT wxMutexGuiLeaveOrEnter() { gs_pCritsectGui->Enter(); - gs_bGuiOwnedByMainThread = TRUE; + gs_bGuiOwnedByMainThread = true; } //else: already have it, nothing to do } diff --git a/src/os2/toolbar.cpp b/src/os2/toolbar.cpp index def07d2192..ea8d5f8480 100644 --- a/src/os2/toolbar.cpp +++ b/src/os2/toolbar.cpp @@ -451,7 +451,7 @@ bool wxToolBar::Realize() { wxToolBarTool* pTool = (wxToolBarTool *)node->GetData(); - if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty()) + if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().empty()) { // // Set the height according to the font and the border size @@ -613,14 +613,12 @@ void wxToolBar::OnPaint ( DrawTool(vDc, pTool); if (pTool->IsSeparator()) { - wxPen vDarkGreyPen( wxColour(85, 85, 85) - ,1 - ,wxSOLID - ); - int nX; - int nY; - int nHeight = 0; - int nWidth = 0; + wxColour gray85(85, 85, 85); + wxPen vDarkGreyPen( gray85, 1, wxSOLID ); + int nX; + int nY; + int nHeight = 0; + int nWidth = 0; vDc.SetPen(vDarkGreyPen); if (HasFlag(wxTB_TEXT)) @@ -752,7 +750,7 @@ void wxToolBar::OnMouseEvent( ); m_nCurrentTool = pTool->GetId(); OnMouseEnter(m_nCurrentTool); - if (!pTool->GetShortHelp().IsEmpty()) + if (!pTool->GetShortHelp().empty()) { if (m_pToolTip) delete m_pToolTip; @@ -828,22 +826,12 @@ void wxToolBar::DrawTool( , wxToolBarToolBase* pToolBase ) { - wxToolBarTool* pTool = (wxToolBarTool *)pToolBase; - wxPen vDarkGreyPen( wxColour( 85,85,85 ) - ,1 - ,wxSOLID - ); - wxPen vWhitePen( wxT("WHITE") - ,1 - ,wxSOLID - ); - wxPen vBlackPen( wxT("BLACK") - ,1 - ,wxSOLID - ); - wxBitmap vBitmap = pTool->GetNormalBitmap(); - bool bUseMask = FALSE; - wxMask* pMask = NULL; + wxToolBarTool* pTool = (wxToolBarTool *)pToolBase; + wxColour gray85( 85,85,85 ); + wxPen vDarkGreyPen( gray85, 1, wxSOLID ); + wxBitmap vBitmap = pTool->GetNormalBitmap(); + bool bUseMask = FALSE; + wxMask* pMask = NULL; PrepareDC(rDc); @@ -858,7 +846,7 @@ void wxToolBar::DrawTool( LowerTool(pTool, FALSE); if (!pTool->IsEnabled()) { - wxColour vColor(wxT("GREY")); + wxColour vColor(wxT("GREY")); rDc.SetTextForeground(vColor); if (!pTool->GetDisabledBitmap().Ok()) @@ -873,9 +861,7 @@ void wxToolBar::DrawTool( } else { - wxColour vColor(wxT("BLACK")); - - rDc.SetTextForeground(vColor); + rDc.SetTextForeground(*wxBLACK); rDc.DrawBitmap( vBitmap ,pTool->m_vX ,pTool->m_vY @@ -918,7 +904,7 @@ void wxToolBar::DrawTool( } else { - wxColour vColor(wxT("GREY")); + wxColour vColor(wxT("GREY")); LowerTool(pTool); rDc.SetTextForeground(vColor); @@ -1058,29 +1044,18 @@ void wxToolBar::SpringUpButton( // private helpers // ---------------------------------------------------------------------------- -void wxToolBar::LowerTool ( - wxToolBarToolBase* pToolBase -, bool bLower -) +void wxToolBar::LowerTool ( wxToolBarToolBase* pToolBase, + bool bLower ) { wxToolBarTool* pTool = (wxToolBarTool*)pToolBase; - wxCoord vX; - wxCoord vY; - wxCoord vWidth; - wxCoord vHeight; - wxPen vDarkGreyPen( wxColour(85, 85, 85) - ,1 - ,wxSOLID - ); - wxPen vWhitePen( wxT("WHITE") - ,1 - ,wxSOLID - ); - wxPen vClearPen( GetBackgroundColour() - ,1 - ,wxSOLID - ); - wxClientDC vDC(this); + wxCoord vX; + wxCoord vY; + wxCoord vWidth; + wxCoord vHeight; + wxColour gray85( 85,85,85 ); + wxPen vDarkGreyPen( gray85, 1, wxSOLID ); + wxPen vClearPen( GetBackgroundColour(), 1, wxSOLID ); + wxClientDC vDC(this); if (!pTool) return; @@ -1094,7 +1069,7 @@ void wxToolBar::LowerTool ( if (!HasFlag(wxTB_FLAT)) return; - if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty()) + if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().empty()) { if (pTool->GetWidth() > m_vTextX) { @@ -1118,7 +1093,7 @@ void wxToolBar::LowerTool ( } if (bLower) { - vDC.SetPen(vWhitePen); + vDC.SetPen(*wxWHITE_PEN); vDC.DrawLine(vX + vWidth, vY + vHeight, vX, vY + vHeight); vDC.DrawLine(vX + vWidth, vY, vX + vWidth, vY + vHeight); vDC.SetPen(vDarkGreyPen); @@ -1135,29 +1110,18 @@ void wxToolBar::LowerTool ( } } // end of WinGuiBase_CToolBarTool::LowerTool -void wxToolBar::RaiseTool ( - wxToolBarToolBase* pToolBase -, bool bRaise -) +void wxToolBar::RaiseTool ( wxToolBarToolBase* pToolBase, + bool bRaise ) { - wxToolBarTool* pTool = (wxToolBarTool*)pToolBase; - wxCoord vX; - wxCoord vY; - wxCoord vWidth; - wxCoord vHeight; - wxPen vDarkGreyPen( wxColour(85, 85, 85) - ,1 - ,wxSOLID - ); - wxPen vWhitePen( wxT("WHITE") - ,1 - ,wxSOLID - ); - wxPen vClearPen( GetBackgroundColour() - ,1 - ,wxSOLID - ); - wxClientDC vDC(this); + wxToolBarTool* pTool = (wxToolBarTool*)pToolBase; + wxCoord vX; + wxCoord vY; + wxCoord vWidth; + wxCoord vHeight; + wxColour gray85( 85,85,85 ); + wxPen vDarkGreyPen( gray85, 1, wxSOLID ); + wxPen vClearPen( GetBackgroundColour(), 1, wxSOLID ); + wxClientDC vDC(this); if (!pTool) return; @@ -1174,7 +1138,7 @@ void wxToolBar::RaiseTool ( if (!HasFlag(wxTB_FLAT)) return; - if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty()) + if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().empty()) { if (pTool->GetWidth() > m_vTextX) { @@ -1201,7 +1165,7 @@ void wxToolBar::RaiseTool ( vDC.SetPen(vDarkGreyPen); vDC.DrawLine(vX + vWidth, vY + vHeight, vX, vY + vHeight); vDC.DrawLine(vX + vWidth, vY, vX + vWidth, vY + vHeight); - vDC.SetPen(vWhitePen); + vDC.SetPen(*wxWHITE_PEN); vDC.DrawLine(vX, vY, vX + vWidth, vY); vDC.DrawLine(vX, vY + vHeight, vX, vY); } diff --git a/src/os2/toplevel.cpp b/src/os2/toplevel.cpp index 242f6c7ab1..273cbab7f7 100644 --- a/src/os2/toplevel.cpp +++ b/src/os2/toplevel.cpp @@ -307,12 +307,11 @@ WXHWND wxTopLevelWindowOS2::OS2GetParent() const return (WXHWND)hWndParent; } // end of wxTopLevelWindowOS2::OS2GetParent -bool wxTopLevelWindowOS2::CreateDialog( - ULONG ulDlgTemplate -, const wxString& rsTitle -, const wxPoint& rPos -, const wxSize& rSize -) + +bool wxTopLevelWindowOS2::CreateDialog( ULONG ulDlgTemplate, + const wxString& WXUNUSED(rsTitle), + const wxPoint& rPos, + const wxSize& rSize ) { wxWindow* pParent = GetParent(); @@ -756,7 +755,7 @@ bool wxTopLevelWindowOS2::Show( wxActivateEvent vEvent(wxEVT_ACTIVATE, TRUE, m_windowId); ::WinQueryWindowPos(m_hFrame, &vSwp); - m_bIconized = vSwp.fl & SWP_MINIMIZE; + m_bIconized = ( vSwp.fl & SWP_MINIMIZE ) == SWP_MINIMIZE ; ::WinQueryWindowPos(m_hWnd, &m_vSwpClient); ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)~0, 0); ::WinQueryWindowPos(m_hWnd, &vSwp); @@ -779,7 +778,7 @@ bool wxTopLevelWindowOS2::Show( HWND hWndParent = GetHwndOf(GetParent()); ::WinQueryWindowPos(hWndParent, &vSwp); - m_bIconized = vSwp.fl & SWP_MINIMIZE; + m_bIconized = (vSwp.fl & SWP_MINIMIZE)==SWP_MINIMIZE; ::WinEnableWindow(hWndParent, TRUE); } } @@ -813,9 +812,8 @@ void wxTopLevelWindowOS2::Maximize( bool wxTopLevelWindowOS2::IsMaximized() const { - ::WinQueryWindowPos(m_hFrame, (PSWP)&m_vSwp); - return (m_vSwp.fl & SWP_MAXIMIZE); + return (m_vSwp.fl & SWP_MAXIMIZE) == SWP_MAXIMIZE; } // end of wxTopLevelWindowOS2::IsMaximized void wxTopLevelWindowOS2::Iconize( @@ -860,17 +858,15 @@ void wxTopLevelWindowOS2::SendSizeEvent() // wxTopLevelWindowOS2 fullscreen // ---------------------------------------------------------------------------- -bool wxTopLevelWindowOS2::ShowFullScreen( - bool bShow -, long lStyle -) +bool wxTopLevelWindowOS2::ShowFullScreen( bool bShow, + long lStyle ) { if (bShow) { if (IsFullScreen()) - return FALSE; + return false; - m_bFsIsShowing = TRUE; + m_bFsIsShowing = true; m_lFsStyle = lStyle; // @@ -893,8 +889,8 @@ bool wxTopLevelWindowOS2::ShowFullScreen( // // Decide which window lStyle flags to turn off // - LONG lNewStyle = m_lFsOldWindowStyle; - LONG lOffFlags = 0; + LONG lNewStyle = m_lFsOldWindowStyle; + LONG lOffFlags = 0; if (lStyle & wxFULLSCREEN_NOBORDER) lOffFlags |= FCF_BORDER; @@ -914,16 +910,14 @@ bool wxTopLevelWindowOS2::ShowFullScreen( // // Resize to the size of the desktop // - int nWidth; - int nHeight; - RECTL vRect = wxGetWindowRect(HWND_DESKTOP); + int nWidth; + int nHeight; + RECTL vRect = wxGetWindowRect(HWND_DESKTOP); nWidth = vRect.xRight - vRect.xLeft; nHeight = vRect.yTop - vRect.yBottom; - SetSize( nWidth - ,nHeight - ); + SetSize( nWidth, nHeight ); // // Now flush the window style cache and actually go full-screen @@ -937,21 +931,17 @@ bool wxTopLevelWindowOS2::ShowFullScreen( ,SWP_SIZE | SWP_MOVE ); - wxSizeEvent vEvent( wxSize( nWidth - ,nHeight - ) - ,GetId() - ); - + wxSize full( nWidth, nHeight ); + wxSizeEvent vEvent( full, GetId() ); GetEventHandler()->ProcessEvent(vEvent); - return TRUE; + return true; } else { if (!IsFullScreen()) - return FALSE; + return false; - m_bFsIsShowing = FALSE; + m_bFsIsShowing = false; Maximize(m_bFsIsMaximized); ::WinSetWindowULong( (HWND)GetHWND() ,QWL_STYLE @@ -965,7 +955,7 @@ bool wxTopLevelWindowOS2::ShowFullScreen( ,m_vFsOldSize.height ,SWP_SIZE | SWP_MOVE ); - return TRUE; + return true; } } // end of wxTopLevelWindowOS2::ShowFullScreen diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index d77c05e60d..cbec9f74c1 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -39,16 +39,19 @@ #define PURE_32 -#ifndef __EMX__ -#include -#include -#include +#if defined(__WATCOMC__) +extern "C" +{ + #include +} +#elif !defined(__EMX__) + #include + #include + #include #endif static const wxChar WX_SECTION[] = _T("wxWidgets"); static const wxChar eHOSTNAME[] = _T("HostName"); -static const wxChar eUSERID[] = _T("UserId"); -static const wxChar eUSERNAME[] = _T("UserName"); // For the following functions we SHOULD fill in support // for Windows-NT (which I don't know) as I assume it begin @@ -99,41 +102,30 @@ bool wxGetHostName( } // Get user ID e.g. jacs -bool wxGetUserId( - wxChar* zBuf -, int nType -) +bool wxGetUserId(wxChar* zBuf, int nType) { -#if defined(__VISAGECPP__) - long lrc; +#if defined(__VISAGECPP__) || defined(__WATCOMC__) // UPM procs return 0 on success - lrc = U32ELOCU((unsigned char*)zBuf, (unsigned long *)&nType); + long lrc = U32ELOCU((PUCHAR)zBuf, (PULONG)&nType); if (lrc == 0) return true; #endif return false; } -bool wxGetUserName( - wxChar* zBuf -, int nMaxSize -) +bool wxGetUserName( wxChar* zBuf, int nMaxSize ) { #ifdef USE_NET_API - wxGetUserId( zBuf - ,nMaxSize - ); + wxGetUserId( zBuf, nMaxSize ); #else wxStrncpy(zBuf, _T("Unknown User"), nMaxSize); #endif return true; } -int wxKill( - long lPid -, wxSignal eSig -, wxKillError* peError -, int flags -) +int wxKill(long lPid, + wxSignal WXUNUSED(eSig), + wxKillError* WXUNUSED(peError), + int WXUNUSED(flags)) { return((int)::DosKillProcess(0, (PID)lPid)); } @@ -198,7 +190,7 @@ bool wxShell( } // Shutdown or reboot the PC -bool wxShutdown(wxShutdownFlags wFlags) +bool wxShutdown(wxShutdownFlags WXUNUSED(wFlags)) { // TODO return false; @@ -275,6 +267,8 @@ bool wxSetEnv(const wxString& variable, const wxChar *value) return putenv(buf) == 0; #else // no way to set an env var + wxUnusedVar(variable); + wxUnusedVar(value); return false; #endif } @@ -369,11 +363,11 @@ void wxBell() } -void wxAppTraits::InitializeGui(unsigned long &ulHab) +void wxAppTraits::InitializeGui(unsigned long &WXUNUSED(ulHab)) { } -void wxAppTraits::TerminateGui(unsigned long ulHab) +void wxAppTraits::TerminateGui(unsigned long WXUNUSED(ulHab)) { } @@ -468,10 +462,10 @@ wxChar* wxGetUserHome ( const wxString &rUser ) wxStrcpy(wxBuffer, zHome); wxUnix2DosFilename(wxBuffer); #if wxUSE_UNICODE - wxWCharBuffer retBuffer (wxBuffer); + wxWCharBuffer retBuffer (wxBuffer); delete[] wxBuffer; return retBuffer; -#else +#else wxStrcpy(zHome, wxBuffer); delete[] wxBuffer; return zHome; @@ -482,9 +476,7 @@ wxChar* wxGetUserHome ( const wxString &rUser ) return (wxChar*)wxEmptyString; // No home known! } -wxString WXDLLEXPORT wxPMErrorToStr( - ERRORID vError -) +wxString WXDLLEXPORT wxPMErrorToStr(ERRORID vError) { wxString sError; @@ -544,7 +536,7 @@ wxString WXDLLEXPORT wxPMErrorToStr( // to be used by all X11 based ports. struct wxEndProcessData; -void wxHandleProcessTermination(wxEndProcessData *proc_data) +void wxHandleProcessTermination(wxEndProcessData *WXUNUSED(proc_data)) { // For now, just do nothing. To be filled in as needed. } diff --git a/src/os2/utilsexc.cpp b/src/os2/utilsexc.cpp index da80a3b213..20d73e6f90 100644 --- a/src/os2/utilsexc.cpp +++ b/src/os2/utilsexc.cpp @@ -27,9 +27,11 @@ #define PURE_32 #ifndef __EMX__ -#include -#include -#include + #include + #ifndef __WATCOMC__ + #include + #include + #endif #endif #include @@ -64,19 +66,17 @@ public: DosExit(EXIT_PROCESS, 0); } - HWND hWnd; // window to send wxWM_PROC_TERMINATED to [not used] - RESULTCODES vResultCodes; - wxProcess* pHandler; - ULONG ulExitCode; // the exit code of the process - bool bState; // set to FALSE when the process finishes + HWND hWnd; // window to send wxWM_PROC_TERMINATED to [not used] + RESULTCODES vResultCodes; + wxProcess* pHandler; + ULONG ulExitCode; // the exit code of the process + bool bState; // set to false when the process finishes }; -static ULONG wxExecuteThread( - wxExecuteData* pData -) +static ULONG wxExecuteThread(wxExecuteData* pData) { - ULONG ulRc; - PID vPidChild; + ULONG ulRc; + PID vPidChild; // cout << "Executing thread: " << endl; @@ -96,12 +96,10 @@ static ULONG wxExecuteThread( // window procedure of a hidden window which is created just to receive // the notification message when a process exits -MRESULT APIENTRY wxExecuteWindowCbk( - HWND hWnd -, ULONG ulMessage -, MPARAM wParam -, MPARAM lParam -) +MRESULT APIENTRY wxExecuteWindowCbk( HWND hWnd, + ULONG ulMessage, + MPARAM WXUNUSED(wParam), + MPARAM lParam) { if (ulMessage == wxWM_PROC_TERMINATED) { @@ -130,13 +128,11 @@ MRESULT APIENTRY wxExecuteWindowCbk( return 0; } -long wxExecute( - const wxString& rCommand -, int flags -, wxProcess* pHandler -) +long wxExecute( const wxString& rCommand, + int flags, + wxProcess* pHandler) { - if (rCommand.IsEmpty()) + if (rCommand.empty()) { // cout << "empty command in wxExecute." << endl; return 0; @@ -243,10 +239,8 @@ long wxExecute( ); } -bool wxGetFullHostName( - wxChar* zBuf -, int nMaxSize -) +bool wxGetFullHostName( wxChar* zBuf, + int nMaxSize) { #if wxUSE_NET_API char zServer[256]; @@ -266,9 +260,8 @@ bool wxGetFullHostName( strncpy(zBuf, zComputer, nMaxSize); zBuf[nMaxSize] = _T('\0'); #else + wxUnusedVar(nMaxSize); strcpy((char*)zBuf, "noname"); #endif - return *zBuf ? TRUE : FALSE; - return TRUE; + return *zBuf ? true : false; } - diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 5999adffa1..343ef03aa1 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -731,13 +731,11 @@ void wxWindowOS2::SetScrollPos( ::WinSendMsg(m_hWndScrollBarVert, SBM_SETPOS, (MPARAM)nPos, (MPARAM)NULL); } // end of wxWindowOS2::SetScrollPos -void wxWindowOS2::SetScrollbar( - int nOrient -, int nPos -, int nThumbVisible -, int nRange -, bool WXUNUSED(bRefresh) -) +void wxWindowOS2::SetScrollbar( int nOrient, + int nPos, + int nThumbVisible, + int nRange, + bool WXUNUSED(bRefresh) ) { HWND hWnd = GetHwnd(); int nOldRange = nRange - nThumbVisible; @@ -779,7 +777,7 @@ void wxWindowOS2::SetScrollbar( vInfo.cb = sizeof(SBCDATA); vInfo.posFirst = 0; vInfo.posLast = (SHORT)nRange1; - vInfo.posThumb = nPos; + vInfo.posThumb = (SHORT)nPos; if (nOrient == wxHORIZONTAL ) { @@ -1068,10 +1066,8 @@ void wxWindowOS2::SetWindowStyleFlag( } } // end of wxWindowOS2::SetWindowStyleFlag -WXDWORD wxWindowOS2::OS2GetStyle( - long lFlags -, WXDWORD* pdwExstyle -) const +WXDWORD wxWindowOS2::OS2GetStyle( long lFlags, + WXDWORD* WXUNUSED(pdwExstyle) ) const { WXDWORD dwStyle = 0L; @@ -1733,27 +1729,25 @@ void wxWindowOS2::DoSetSize( ); } // end of wxWindowOS2::DoSetSize -void wxWindowOS2::DoSetClientSize( - int nWidth -, int nHeight -) +void wxWindowOS2::DoSetClientSize( int nWidth, + int nHeight ) { - POINTL vPoint; - int nActualWidth; - int nActualHeight; - wxWindow* pParent = (wxWindow*)GetParent(); - HWND hParentWnd = (HWND)0; + POINTL vPoint; + int nActualWidth; + int nActualHeight; + wxWindow* pParent = (wxWindow*)GetParent(); + HWND hParentWnd = (HWND)0; if (pParent) hParentWnd = (HWND)pParent->GetHWND(); if (IsKindOf(CLASSINFO(wxFrame))) { - wxFrame* pFrame = wxDynamicCast(this, wxFrame); - HWND hFrame = pFrame->GetFrame(); - RECTL vRect; - RECTL vRect2; - RECTL vRect3; + wxFrame* pFrame = wxDynamicCast(this, wxFrame); + HWND hFrame = pFrame->GetFrame(); + RECTL vRect; + RECTL vRect2; + RECTL vRect3; ::WinQueryWindowRect(GetHwnd(), &vRect2); ::WinQueryWindowRect(hFrame, &vRect); @@ -1771,8 +1765,8 @@ void wxWindowOS2::DoSetClientSize( } else { - int nX; - int nY; + int nX; + int nY; GetPosition(&nX, &nY); nActualWidth = nWidth; @@ -1781,18 +1775,10 @@ void wxWindowOS2::DoSetClientSize( vPoint.x = nX; vPoint.y = nY; } - DoMoveWindow( vPoint.x - ,vPoint.y - ,nActualWidth - ,nActualHeight - ); - - wxSizeEvent vEvent( wxSize( nWidth - ,nHeight - ) - ,m_windowId - ); + DoMoveWindow( vPoint.x, vPoint.y, nActualWidth, nActualHeight ); + wxSize size( nWidth, nHeight ); + wxSizeEvent vEvent( size, m_windowId ); vEvent.SetEventObject(this); GetEventHandler()->ProcessEvent(vEvent); } // end of wxWindowOS2::DoSetClientSize @@ -1833,25 +1819,22 @@ int wxWindowOS2::GetCharWidth() const return(vFontMetrics.lAveCharWidth); } // end of wxWindowOS2::GetCharWidth -void wxWindowOS2::GetTextExtent( - const wxString& rString -, int* pX -, int* pY -, int* pDescent -, int* pExternalLeading -, const wxFont* pTheFont -) const +void wxWindowOS2::GetTextExtent( const wxString& rString, + int* pX, + int* pY, + int* pDescent, + int* pExternalLeading, + const wxFont* WXUNUSED(pTheFont) ) const { - POINTL avPoint[TXTBOX_COUNT]; - POINTL vPtMin; - POINTL vPtMax; - int i; - int l; - FONTMETRICS vFM; // metrics structure - BOOL bRc = FALSE; - char* pStr; - HPS hPS; - + POINTL avPoint[TXTBOX_COUNT]; + POINTL vPtMin; + POINTL vPtMax; + int i; + int l; + FONTMETRICS vFM; // metrics structure + BOOL bRc = FALSE; + char* pStr; + HPS hPS; hPS = ::WinGetPS(GetHwnd()); @@ -2225,12 +2208,10 @@ bool wxWindowOS2::OS2TranslateMessage( #endif //wxUSE_ACCEL } // end of wxWindowOS2::OS2TranslateMessage -bool wxWindowOS2::OS2ShouldPreProcessMessage( - WXMSG* pMsg -) +bool wxWindowOS2::OS2ShouldPreProcessMessage( WXMSG* WXUNUSED(pMsg) ) { // preprocess all messages by default - return TRUE; + return true; } // end of wxWindowOS2::OS2ShouldPreProcessMessage // --------------------------------------------------------------------------- @@ -2735,7 +2716,7 @@ MRESULT wxWindowOS2::OS2WindowProc( } return 0; } - break; + // break; case BKN_PAGESELECTEDPENDING: { @@ -2790,7 +2771,7 @@ MRESULT wxWindowOS2::OS2WindowProc( wxRadioBox* pRadioBox = wxDynamicCast(pWin, wxRadioBox); pRadioBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam) - ,(WXUINT)SHORT1FROMMP(wParam) + ,(WXWORD)SHORT1FROMMP(wParam) ); } if (pWin->IsKindOf(CLASSINFO(wxRadioButton))) @@ -2798,7 +2779,7 @@ MRESULT wxWindowOS2::OS2WindowProc( wxRadioButton* pRadioButton = wxDynamicCast(pWin, wxRadioButton); pRadioButton->OS2Command( (WXUINT)SHORT2FROMMP(wParam) - ,(WXUINT)SHORT1FROMMP(wParam) + ,(WXWORD)SHORT1FROMMP(wParam) ); } if (pWin->IsKindOf(CLASSINFO(wxCheckBox))) @@ -2806,7 +2787,7 @@ MRESULT wxWindowOS2::OS2WindowProc( wxCheckBox* pCheckBox = wxDynamicCast(pWin, wxCheckBox); pCheckBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam) - ,(WXUINT)SHORT1FROMMP(wParam) + ,(WXWORD)SHORT1FROMMP(wParam) ); } if (pWin->IsKindOf(CLASSINFO(wxListBox))) @@ -2814,7 +2795,7 @@ MRESULT wxWindowOS2::OS2WindowProc( wxListBox* pListBox = wxDynamicCast(pWin, wxListBox); pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam) - ,(WXUINT)SHORT1FROMMP(wParam) + ,(WXWORD)SHORT1FROMMP(wParam) ); if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW) Refresh(); @@ -2824,12 +2805,12 @@ MRESULT wxWindowOS2::OS2WindowProc( wxComboBox* pComboBox = wxDynamicCast(pWin, wxComboBox); pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam) - ,(WXUINT)SHORT1FROMMP(wParam) + ,(WXWORD)SHORT1FROMMP(wParam) ); } return 0; } - break; + // break; case LN_ENTER: /* dups as CBN_EFCHANGE */ { @@ -2850,7 +2831,7 @@ MRESULT wxWindowOS2::OS2WindowProc( wxListBox* pListBox = wxDynamicCast(pWin, wxListBox); pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam) - ,(WXUINT)SHORT1FROMMP(wParam) + ,(WXWORD)SHORT1FROMMP(wParam) ); if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW) Refresh(); @@ -2861,31 +2842,31 @@ MRESULT wxWindowOS2::OS2WindowProc( wxComboBox* pComboBox = wxDynamicCast(pWin, wxComboBox); pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam) - ,(WXUINT)SHORT1FROMMP(wParam) + ,(WXWORD)SHORT1FROMMP(wParam) ); } return 0; } - break; + // break; case SPBN_UPARROW: case SPBN_DOWNARROW: case SPBN_CHANGE: { - char zVal[10]; - long lVal; + char zVal[10]; + long lVal; ::WinSendMsg( HWNDFROMMP(lParam) ,SPBM_QUERYVALUE - ,&zVal + ,&zVal[0] ,MPFROM2SHORT( (USHORT)10 ,(USHORT)SPBQ_UPDATEIFVALID ) ); lVal = atol(zVal); bProcessed = OS2OnScroll( wxVERTICAL - ,(int)SHORT2FROMMP(wParam) - ,(int)lVal + ,(WXWORD)SHORT2FROMMP(wParam) + ,(WXWORD)lVal ,HWNDFROMMP(lParam) ); } @@ -2893,8 +2874,8 @@ MRESULT wxWindowOS2::OS2WindowProc( case SLN_SLIDERTRACK: { - HWND hWnd = ::WinWindowFromID(GetHWND(), SHORT1FROMMP(wParam)); - wxWindowOS2* pChild = wxFindWinFromHandle(hWnd); + HWND hWnd = ::WinWindowFromID(GetHWND(), SHORT1FROMMP(wParam)); + wxWindowOS2* pChild = wxFindWinFromHandle(hWnd); if (!pChild) { @@ -2903,8 +2884,8 @@ MRESULT wxWindowOS2::OS2WindowProc( } if (pChild->IsKindOf(CLASSINFO(wxSlider))) bProcessed = OS2OnScroll( wxVERTICAL - ,(int)SHORT2FROMMP(wParam) - ,(int)LONGFROMMP(lParam) + ,(WXWORD)SHORT2FROMMP(wParam) + ,(WXWORD)LONGFROMMP(lParam) ,hWnd ); } @@ -3111,26 +3092,24 @@ WXHWND wxWindowOS2::OS2GetParent() const return m_parent ? m_parent->GetHWND() : NULL; } -bool wxWindowOS2::OS2Create( - PSZ zClass -, const wxChar* zTitle -, WXDWORD dwStyle -, const wxPoint& rPos -, const wxSize& rSize -, void* pCtlData -, WXDWORD dwExStyle -, bool bIsChild -) +bool wxWindowOS2::OS2Create( PSZ zClass, + const wxChar* zTitle, + WXDWORD dwStyle, + const wxPoint& rPos, + const wxSize& rSize, + void* pCtlData, + WXDWORD WXUNUSED(dwExStyle), + bool bIsChild ) { - ERRORID vError; - wxString sError; - int nX = 0L; - int nY = 0L; - int nWidth = 0L; - int nHeight = 0L; - long lControlId = 0L; - wxWindowCreationHook vHook(this); - wxString sClassName((wxChar*)zClass); + ERRORID vError; + wxString sError; + int nX = 0L; + int nY = 0L; + int nWidth = 0L; + int nHeight = 0L; + long lControlId = 0L; + wxWindowCreationHook vHook(this); + wxString sClassName((wxChar*)zClass); OS2GetCreateWindowCoords( rPos ,rSize @@ -3182,7 +3161,7 @@ bool wxWindowOS2::OS2Create( m_backgroundColour.Set(wxString(wxT("GREY"))); - LONG lColor = (LONG)m_backgroundColour.GetPixel(); + LONG lColor = (LONG)m_backgroundColour.GetPixel(); if (!::WinSetPresParam( m_hWnd ,PP_BACKGROUNDCOLOR @@ -3938,53 +3917,56 @@ bool wxWindowOS2::HandleMaximize() return GetEventHandler()->ProcessEvent(vEvent); } // end of wxWindowOS2::HandleMaximize -bool wxWindowOS2::HandleMove( - int nX -, int nY -) +bool wxWindowOS2::HandleMove( int nX, int nY ) { - wxMoveEvent vEvent(wxPoint(nX, nY), m_windowId); + wxPoint pt(nX, nY); + wxMoveEvent vEvent(pt, m_windowId); vEvent.SetEventObject(this); return GetEventHandler()->ProcessEvent(vEvent); } // end of wxWindowOS2::HandleMove -bool wxWindowOS2::HandleSize( - int nWidth -, int nHeight -, WXUINT WXUNUSED(nFlag) -) +bool wxWindowOS2::HandleSize( int nWidth, + int nHeight, + WXUINT WXUNUSED(nFlag) ) { - wxSizeEvent vEvent(wxSize(nWidth, nHeight), m_windowId); + wxSize sz(nWidth, nHeight); + wxSizeEvent vEvent(sz, m_windowId); vEvent.SetEventObject(this); return GetEventHandler()->ProcessEvent(vEvent); } // end of wxWindowOS2::HandleSize -bool wxWindowOS2::HandleGetMinMaxInfo( - PSWP pSwp -) +bool wxWindowOS2::HandleGetMinMaxInfo( PSWP pSwp ) { POINTL vPoint; switch(pSwp->fl) { case SWP_MAXIMIZE: +#ifndef __WATCOMC__ +// FIXME: incomplete headers ??? ::WinGetMaxPosition(GetHwnd(), pSwp); m_maxWidth = pSwp->cx; m_maxHeight = pSwp->cy; +#endif break; case SWP_MINIMIZE: +#ifndef __WATCOMC__ +// FIXME: incomplete headers ??? ::WinGetMinPosition(GetHwnd(), pSwp, &vPoint); m_minWidth = pSwp->cx; m_minHeight = pSwp->cy; +#else + wxUnusedVar(vPoint); +#endif break; default: - return FALSE; + return false; } - return TRUE; + return true; } // end of wxWindowOS2::HandleGetMinMaxInfo // --------------------------------------------------------------------------- @@ -4208,17 +4190,15 @@ wxKeyEvent wxWindowOS2::CreateKeyEvent( } // end of wxWindowOS2::CreateKeyEvent // -// isASCII is TRUE only when we're called from WM_CHAR handler and not from +// isASCII is true only when we're called from WM_CHAR handler and not from // WM_KEYDOWN one // -bool wxWindowOS2::HandleChar( - WXWPARAM wParam -, WXLPARAM lParam -, bool isASCII -) +bool wxWindowOS2::HandleChar( WXWPARAM WXUNUSED(wParam), + WXLPARAM lParam, + bool isASCII ) { - bool bCtrlDown = FALSE; - int vId; + bool bCtrlDown = FALSE; + int vId; if (m_bLastKeydownProcessed) { @@ -4227,15 +4207,15 @@ bool wxWindowOS2::HandleChar( // EVT_KEY_DOWN handler is meant, by design, to prevent EVT_CHARs // from happening, so just bail out at this point. // - m_bLastKeydownProcessed = FALSE; - return TRUE; + m_bLastKeydownProcessed = false; + return true; } if (isASCII) { // // If 1 -> 26, translate to either special keycode or just set // ctrlDown. IOW, Ctrl-C should result in keycode == 3 and - // ControlDown() == TRUE. + // ControlDown() == true. // vId = SHORT1FROMMP(lParam); if ((vId > 0) && (vId < 27)) @@ -4264,18 +4244,16 @@ bool wxWindowOS2::HandleChar( { vId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam)); if (vId == 0) - return FALSE; + return false; } - wxKeyEvent vEvent(CreateKeyEvent( wxEVT_CHAR - ,vId - ,lParam - )); + wxKeyEvent vEvent(CreateKeyEvent( wxEVT_CHAR, vId, lParam )); if (bCtrlDown) { - vEvent.m_controlDown = TRUE; + vEvent.m_controlDown = true; } + return (GetEventHandler()->ProcessEvent(vEvent)); } @@ -4514,9 +4492,7 @@ void wxWindowOS2::MoveChildren( // as that will be the eventual size of the panel after the frame resizes // it! // -int wxWindowOS2::GetOS2ParentHeight( - wxWindowOS2* pParent -) +int wxWindowOS2::GetOS2ParentHeight( wxWindowOS2* pParent ) { // // Case 1 @@ -4558,11 +4534,12 @@ int wxWindowOS2::GetOS2ParentHeight( // and it's height must be different. Otherwise the standard // applies. // - else - { - return(pParent->GetClientSize().y); - } - return(0L); + // else + // { + + return(pParent->GetClientSize().y); + + // } } // end of wxWindowOS2::GetOS2ParentHeight // @@ -4767,8 +4744,7 @@ wxWindow* wxGetActiveWindow() } // end of wxGetActiveWindow #ifdef __WXDEBUG__ -const char* wxGetMessageName( - int nMessage) +const char* wxGetMessageName( int nMessage ) { switch (nMessage) { @@ -5221,13 +5197,12 @@ const char* wxGetMessageName( case WM_USER+1000+60: return "TB_SETMAXTEXTROWS"; case WM_USER+1000+61: return "TB_GETTEXTROWS"; case WM_USER+1000+41: return "TB_GETBITMAPFLAGS"; - - default: - static char s_szBuf[128]; - sprintf(s_szBuf, "", nMessage); - return s_szBuf; } - return NULL; + + static char s_szBuf[128]; + sprintf(s_szBuf, "", nMessage); + return s_szBuf; + } // end of wxGetMessageName #endif // __WXDEBUG__ @@ -5306,11 +5281,9 @@ wxPoint wxGetMousePosition() return wxPoint(vPt.x, vPt.y); } -wxWindowOS2* FindWindowForMouseEvent( - wxWindow* pWin -, short* pnX -, short* pnY -) +wxWindowOS2* FindWindowForMouseEvent( wxWindow* pWin, + short* WXUNUSED(pnX), + short* WXUNUSED(pnY) ) { HWND hWnd = GetHwndOf(pWin); HWND hWndUnderMouse; @@ -5408,4 +5381,3 @@ wxWindowOS2* FindWindowForMouseEvent( } return pWin; } // end of FindWindowForMouseEvent - -- 2.45.2