From 39fc096d5a40b85488a43226aa49c887ae86f45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Skiba?= Date: Wed, 8 Sep 2004 06:41:06 +0000 Subject: [PATCH] Fixes and source cleaning for WinCE. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/wince/helpwce.h | 2 +- include/wx/msw/wince/libraries.h | 4 +-- include/wx/msw/wince/net.h | 2 +- include/wx/msw/wince/textctrlce.h | 8 ++--- src/msw/wince/choicece.cpp | 20 ++++++------ src/msw/wince/filedlgwce.cpp | 2 +- src/msw/wince/helpwce.cpp | 8 ++--- src/msw/wince/menuce.cpp | 52 +++++++++++++++---------------- src/msw/wince/net.cpp | 4 +-- src/msw/wince/tbarwce.cpp | 52 +++++++++++++++---------------- src/msw/wince/textctrlce.cpp | 12 +++---- 11 files changed, 82 insertions(+), 84 deletions(-) diff --git a/include/wx/msw/wince/helpwce.h b/include/wx/msw/wince/helpwce.h index 82e29f1a95..6540fdce66 100644 --- a/include/wx/msw/wince/helpwce.h +++ b/include/wx/msw/wince/helpwce.h @@ -6,7 +6,7 @@ // Created: 2003-07-12 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_HELPWCE_H_ diff --git a/include/wx/msw/wince/libraries.h b/include/wx/msw/wince/libraries.h index 67bca56aea..b03e41a9ba 100644 --- a/include/wx/msw/wince/libraries.h +++ b/include/wx/msw/wince/libraries.h @@ -12,8 +12,8 @@ #ifndef _WX_LIBRARIES_H_ #define _WX_LIBRARIES_H_ -// NB: According to Microsoft, it is up to the OEM to decide whether -// some of libraries will be included in the system or not. For example, +// NB: According to Microsoft, it is up to the OEM to decide whether +// some of libraries will be included in the system or not. For example, // MS' STANDARDSDK does not include cyshell.lib and aygshell.lib, while // Pocket PC 2003 SDK does. We depend on some symbols that are in these // libraries in some SDKs and in different libs in others. Fortunately we diff --git a/include/wx/msw/wince/net.h b/include/wx/msw/wince/net.h index 7476d80463..f99209bd55 100644 --- a/include/wx/msw/wince/net.h +++ b/include/wx/msw/wince/net.h @@ -1,7 +1,7 @@ // Copyright 1998, Ben Goetter. All rights reserved. /* - patch holes in winsock + patch holes in winsock WCE 2.0 lacks many of the 'database' winsock routines. Stub just enough them for ss.dll. diff --git a/include/wx/msw/wince/textctrlce.h b/include/wx/msw/wince/textctrlce.h index ad2f72a392..68741c84c4 100644 --- a/include/wx/msw/wince/textctrlce.h +++ b/include/wx/msw/wince/textctrlce.h @@ -193,10 +193,10 @@ protected: // replace the contents of the selection or of the entire control with the // given text - void DoWriteText(const wxString& text, bool selectionOnly = TRUE); + void DoWriteText(const wxString& text, bool selectionOnly = true); // set the selection possibly without scrolling the caret into view - void DoSetSelection(long from, long to, bool scrollCaret = TRUE); + void DoSetSelection(long from, long to, bool scrollCaret = true); // return true if there is a non empty selection in the control bool HasSelection() const; @@ -205,7 +205,7 @@ protected: // position long GetLengthOfLineContainingPos(long pos) const; - // send TEXT_UPDATED event, return TRUE if it was handled, FALSE otherwise + // send TEXT_UPDATED event, return true if it was handled, false otherwise bool SendUpdateEvent(); // override some base class virtuals @@ -214,7 +214,7 @@ protected: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - // if TRUE, SendUpdateEvent() will eat the next event (see comments in the + // if true, SendUpdateEvent() will eat the next event (see comments in the // code as to why this is needed) bool m_suppressNextUpdate; diff --git a/src/msw/wince/choicece.cpp b/src/msw/wince/choicece.cpp index 5f46de450b..59971875c4 100644 --- a/src/msw/wince/choicece.cpp +++ b/src/msw/wince/choicece.cpp @@ -151,8 +151,6 @@ bool wxChoice::CreateAndInit(wxWindow *parent, wxSize sizeText(size), sizeBtn(size); sizeBtn.x = GetBestSpinerSize(IsVertical(style)).x; - sizeBtn.x; - if ( sizeText.x == wxDefaultCoord ) { // DEFAULT_ITEM_WIDTH is the default width for the text control @@ -300,7 +298,7 @@ wxChoice::~wxChoice() int wxChoice::DoAppend(const wxString& item) { - int n = (int)SendMessage(GetBuddyHwnd(), LB_ADDSTRING, 0, (LPARAM)item.c_str()); + int n = (int)::SendMessage(GetBuddyHwnd(), LB_ADDSTRING, 0, (LPARAM)item.c_str()); if ( n == LB_ERR ) { @@ -315,7 +313,7 @@ int wxChoice::DoInsert(const wxString& item, int pos) wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into choice")); wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index")); - int n = (int)SendMessage(GetBuddyHwnd(), LB_INSERTSTRING, pos, (LPARAM)item.c_str()); + int n = (int)::SendMessage(GetBuddyHwnd(), LB_INSERTSTRING, pos, (LPARAM)item.c_str()); if ( n == LB_ERR ) { wxLogLastError(wxT("SendMessage(LB_INSERTSTRING)")); @@ -333,14 +331,14 @@ void wxChoice::Delete(int n) delete GetClientObject(n); } - SendMessage(GetBuddyHwnd(), LB_DELETESTRING, n, 0); + ::SendMessage(GetBuddyHwnd(), LB_DELETESTRING, n, 0); } void wxChoice::Clear() { Free(); - SendMessage(GetBuddyHwnd(), LB_RESETCONTENT, 0, 0); + ::SendMessage(GetBuddyHwnd(), LB_RESETCONTENT, 0, 0); } void wxChoice::Free() @@ -361,12 +359,12 @@ void wxChoice::Free() int wxChoice::GetSelection() const { - return (int)SendMessage(GetBuddyHwnd(), LB_GETCURSEL, 0, 0); + return (int)::SendMessage(GetBuddyHwnd(), LB_GETCURSEL, 0, 0); } void wxChoice::SetSelection(int n) { - SendMessage(GetBuddyHwnd(), LB_SETCURSEL, n, 0); + ::SendMessage(GetBuddyHwnd(), LB_SETCURSEL, n, 0); } // ---------------------------------------------------------------------------- @@ -375,12 +373,12 @@ void wxChoice::SetSelection(int n) int wxChoice::GetCount() const { - return (int)SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0); + return (int)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0); } int wxChoice::FindString(const wxString& s) const { - int pos = (int)SendMessage(GetBuddyHwnd(), LB_FINDSTRINGEXACT, + int pos = (int)::SendMessage(GetBuddyHwnd(), LB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)s.c_str()); return pos == LB_ERR ? wxNOT_FOUND : pos; @@ -452,7 +450,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData ) void* wxChoice::DoGetItemClientData( int n ) const { - LPARAM rc = SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0); + LPARAM rc = ::SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0); if ( rc == LB_ERR ) { wxLogLastError(wxT("LB_GETITEMDATA")); diff --git a/src/msw/wince/filedlgwce.cpp b/src/msw/wince/filedlgwce.cpp index bb0a24773b..ac530e7158 100644 --- a/src/msw/wince/filedlgwce.cpp +++ b/src/msw/wince/filedlgwce.cpp @@ -116,7 +116,7 @@ int wxFileDialog::ShowModal() wxWindow* parentWindow = GetParent(); if (!parentWindow) parentWindow = wxTheApp->GetTopWindow(); - + wxString str = wxGetTextFromUser(m_message, _("File"), m_fileName, parentWindow); if (str) { diff --git a/src/msw/wince/helpwce.cpp b/src/msw/wince/helpwce.cpp index 1e6a0b19a8..0196bb6907 100644 --- a/src/msw/wince/helpwce.cpp +++ b/src/msw/wince/helpwce.cpp @@ -6,7 +6,7 @@ // Created: 2003-07-12 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) @@ -87,7 +87,7 @@ bool wxWinceHelpController::KeywordSearch(const wxString& WXUNUSED(k), bool wxWinceHelpController::Quit() { - return TRUE; + return true; } // Append extension if necessary. @@ -109,8 +109,8 @@ wxString wxWinceHelpController::GetValidFilename(const wxString& file) const // View URL bool wxWinceHelpController::ViewURL(const wxString& topic) { - if (m_helpFile.IsEmpty()) return FALSE; - + if (m_helpFile.IsEmpty()) return false; + wxString url( wxT("file:") + GetValidFilename(m_helpFile) ); if (!topic.IsEmpty()) url = url + wxT("#") + topic; diff --git a/src/msw/wince/menuce.cpp b/src/msw/wince/menuce.cpp index c9905e452f..10c97cd142 100644 --- a/src/msw/wince/menuce.cpp +++ b/src/msw/wince/menuce.cpp @@ -87,41 +87,41 @@ void wxTopLevelWindowMSW::ButtonMenu::SetButton(int id, const wxString& label, w wxMenu *wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(wxMenu *menu) { - // This is required in case of converting wxMenuBar to wxMenu in wxFrame::SetMenuBar. - // All submenus has to be recreated because of new owner. + // This is required in case of converting wxMenuBar to wxMenu in wxFrame::SetMenuBar. + // All submenus has to be recreated because of new owner. - wxMenu *duplication = new wxMenu; + wxMenu *duplication = new wxMenu; - if (menu) - { + if (menu) + { wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); while (node) - { - wxMenuItem *item = node->GetData(); - if (item) - { - wxMenu *submenu = NULL; + { + wxMenuItem *item = node->GetData(); + if (item) + { + wxMenu *submenu = NULL; - if(item->IsSubMenu()) - submenu = DuplicateMenu( item->GetSubMenu() ); - else - submenu = NULL; + if(item->IsSubMenu()) + submenu = DuplicateMenu( item->GetSubMenu() ); + else + submenu = NULL; - wxMenuItem *new_item = wxMenuItem::New(duplication, item->GetId(), item->GetLabel(), item->GetHelp(), item->GetKind(), submenu); + wxMenuItem *new_item = wxMenuItem::New(duplication, item->GetId(), item->GetLabel(), item->GetHelp(), item->GetKind(), submenu); - if( item->IsCheckable() ) - new_item->Check(item->IsChecked()); + if( item->IsCheckable() ) + new_item->Check(item->IsChecked()); - new_item->Enable( item->IsEnabled() ); + new_item->Enable( item->IsEnabled() ); - duplication->Append(new_item); - } + duplication->Append(new_item); + } node = node->GetNext(); - } - - } + } - return duplication; + } + + return duplication; } void wxMenuToHMenu(wxMenu* in, HMENU hMenu) @@ -189,11 +189,11 @@ void wxTopLevelWindowMSW::ReloadButton(ButtonMenu& button, UINT menuID) button_info.fsState = TBSTATE_ENABLED; wxStrcpy(buf, button.GetLabel().c_str()); button_info.pszText = buf; - SendMessage(m_MenuBarHWND, TB_SETBUTTONINFO, menuID, (LPARAM) &button_info); + ::SendMessage(m_MenuBarHWND, TB_SETBUTTONINFO, menuID, (LPARAM) &button_info); if(button.IsMenu()) { - HMENU hPopupMenu = (HMENU) SendMessage(m_MenuBarHWND, SHCMBM_GETSUBMENU, 0, menuID); + HMENU hPopupMenu = (HMENU) ::SendMessage(m_MenuBarHWND, SHCMBM_GETSUBMENU, 0, menuID); RemoveMenu(hPopupMenu, 0, MF_BYPOSITION); wxMenuToHMenu(button.GetMenu(), hPopupMenu); } diff --git a/src/msw/wince/net.cpp b/src/msw/wince/net.cpp index b83753f82c..fc8c9eef1e 100644 --- a/src/msw/wince/net.cpp +++ b/src/msw/wince/net.cpp @@ -1,7 +1,7 @@ // Copyright 1998, Ben Goetter. All rights reserved. /* - patch holes in winsock + patch holes in winsock WCE 2.0 lacks many of the 'database' winsock routines. Stub just enough them for ss.dll. @@ -47,7 +47,7 @@ static struct protoent RgProtoEnt[] = // Ordered by most likely to be requested. // Assumes that a service available on different protocols // will use the same port number on each protocol. -// Should that be no longer the case, +// Should that be no longer the case, // remove the fFoundOnce code from getservbyXxx fcns. // This table keeps port numbers in host byte order. diff --git a/src/msw/wince/tbarwce.cpp b/src/msw/wince/tbarwce.cpp index 4cb447f393..2138b8ef6a 100644 --- a/src/msw/wince/tbarwce.cpp +++ b/src/msw/wince/tbarwce.cpp @@ -236,7 +236,7 @@ bool wxToolBar::Create(wxWindow *parent, SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - return TRUE; + return true; } #ifndef TBSTYLE_NO_DROPDOWN_ARROW @@ -252,7 +252,7 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& WXUNUSED(pos), const wxSize& WXU #if defined(WINCE_WITHOUT_COMMANDBAR) // Create the menubar. SHMENUBARINFO mbi; - + memset (&mbi, 0, sizeof (SHMENUBARINFO)); mbi.cbSize = sizeof (SHMENUBARINFO); mbi.hwndParent = (HWND) GetParent()->GetHWND(); @@ -265,13 +265,13 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& WXUNUSED(pos), const wxSize& WXU mbi.cBmpImages = 0; mbi.dwFlags = 0 ; // SHCMBF_EMPTYBAR; mbi.hInstRes = wxGetInstance(); - + if (!SHCreateMenuBar(&mbi)) { wxFAIL_MSG( _T("SHCreateMenuBar failed") ); return false; } - + SetHWND((WXHWND) mbi.hwndMB); #else HWND hWnd = CommandBar_Create(wxGetInstance(), (HWND) GetParent()->GetHWND(), GetId()); @@ -283,8 +283,8 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& WXUNUSED(pos), const wxSize& WXU if (menuBar) menuBar->Create(); - - return TRUE; + + return true; } void wxToolBar::Recreate() @@ -437,7 +437,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) // Realize() later tool->Attach(this); - return TRUE; + return true; } bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) @@ -510,11 +510,11 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) int x; wxControl *control = tool2->GetControl(); control->GetPosition(&x, NULL); - control->Move(x - width, -1); + control->Move(x - width, wxDefaultCoord); } } - return TRUE; + return true; } struct wxToolBarIdMapping @@ -554,7 +554,7 @@ static wxToolBarIdMapping sm_ToolBarIdMappingArray[] = static int wxFindIdForwxWinId(int id) { int i = 0; - while (TRUE) + while (true) { if (sm_ToolBarIdMappingArray[i].m_wxwinId == 0) return -1; @@ -572,7 +572,7 @@ bool wxToolBar::Realize() if ( nTools == 0 ) { // nothing to do - return TRUE; + return true; } #if 0 @@ -605,7 +605,7 @@ bool wxToolBar::Realize() { wxToolBarToolBase *tool = node->GetData(); - bool processedThis = TRUE; + bool processedThis = true; TBBUTTON& button = buttons[i]; @@ -663,10 +663,10 @@ bool wxToolBar::Realize() // radio items button.fsState |= TBSTATE_CHECKED; - tool->Toggle(TRUE); + tool->Toggle(true); } - isRadio = TRUE; + isRadio = true; break; case wxITEM_CHECK: @@ -723,8 +723,8 @@ bool wxToolBar::Realize() // note that we use TB_GETITEMRECT and not TB_GETRECT because the // latter only appeared in v4.70 of comctl32.dll RECT r; - if ( !SendMessage(GetHwnd(), TB_GETITEMRECT, - index, (LPARAM)(LPRECT)&r) ) + if ( !::SendMessage(GetHwnd(), TB_GETITEMRECT, + index, (LPARAM)(LPRECT)&r) ) { wxLogLastError(wxT("TB_GETITEMRECT")); } @@ -756,8 +756,8 @@ bool wxToolBar::Realize() tbbi.cbSize = sizeof(tbbi); tbbi.dwMask = TBIF_SIZE; tbbi.cx = size.x; - if ( !SendMessage(GetHwnd(), TB_SETBUTTONINFO, - tool->GetId(), (LPARAM)&tbbi) ) + if ( !::SendMessage(GetHwnd(), TB_SETBUTTONINFO, + tool->GetId(), (LPARAM)&tbbi) ) { // the id is probably invalid? wxLogLastError(wxT("TB_SETBUTTONINFO")); @@ -780,8 +780,8 @@ bool wxToolBar::Realize() size_t nSeparators = size.x / widthSep; for ( size_t nSep = 0; nSep < nSeparators; nSep++ ) { - if ( !SendMessage(GetHwnd(), TB_INSERTBUTTON, - index, (LPARAM)&tbb) ) + if ( !::SendMessage(GetHwnd(), TB_INSERTBUTTON, + index, (LPARAM)&tbb) ) { wxLogLastError(wxT("TB_INSERTBUTTON")); } @@ -794,7 +794,7 @@ bool wxToolBar::Realize() ((wxToolBarTool *)tool)->SetSeparatorsCount(nSeparators); // adjust the controls width to exactly cover the separators - control->SetSize((nSeparators + 1)*widthSep, -1); + control->SetSize((nSeparators + 1)*widthSep, wxDefaultCoord); } // position the control itself correctly vertically @@ -803,7 +803,7 @@ bool wxToolBar::Realize() if ( diff < 0 ) { // the control is too high, resize to fit - control->SetSize(-1, height - 2); + control->SetSize(wxDefaultCoord, height - 2); diff = 2; } @@ -893,7 +893,7 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id) } } - return TRUE; + return true; } bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), @@ -908,11 +908,11 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), // in an ANSI application - this seems to be a bug in comctl32.dll v5 UINT code = hdr->code; if ( (code != (UINT) TTN_NEEDTEXTA) && (code != (UINT) TTN_NEEDTEXTW) ) - return FALSE; + return false; HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0); if ( toolTipWnd != hdr->hwndFrom ) - return FALSE; + return false; LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam; int id = (int)ttText->hdr.idFrom; @@ -1032,7 +1032,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const void wxToolBar::UpdateSize() { // the toolbar size changed - SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0); + ::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0); // we must also refresh the frame after the toolbar size (possibly) changed wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); diff --git a/src/msw/wince/textctrlce.cpp b/src/msw/wince/textctrlce.cpp index 5fce03dcf1..86f6c7d248 100644 --- a/src/msw/wince/textctrlce.cpp +++ b/src/msw/wince/textctrlce.cpp @@ -232,7 +232,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, WXDWORD spiner_style = WS_VISIBLE | UDS_ALIGNRIGHT | UDS_EXPANDABLE | - UDS_NOSCROLL; + UDS_NOSCROLL; if ( !IsVertical(style) ) spiner_style |= UDS_HORZ; @@ -409,7 +409,7 @@ void wxTextCtrl::SetValue(const wxString& value) if ( (value.length() > 0x400) || (value != GetValue()) ) { DoWriteText(value, false); - + // for compatibility, don't move the cursor when doing SetValue() SetInsertionPoint(0); } @@ -546,7 +546,7 @@ bool wxTextCtrl::CanPaste() const void wxTextCtrl::SetEditable(bool editable) { - SendMessage(GetBuddyHwnd(), EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L); + ::SendMessage(GetBuddyHwnd(), EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L); } void wxTextCtrl::SetInsertionPoint(long pos) @@ -740,9 +740,9 @@ wxTextCtrl::HitTest(const wxPoint& pt, long *posOut) const // double check that we really are where it pretends POINTL ptReal; - LRESULT lRc = SendMessage(GetBuddyHwnd(), EM_POSFROMCHAR, pos, 0); + LRESULT lRc = ::SendMessage(GetBuddyHwnd(), EM_POSFROMCHAR, pos, 0); - if ( lRc == -1 ) + if ( lRc == -1 ) { // this is apparently returned when pos corresponds to the last // position @@ -779,7 +779,7 @@ void wxTextCtrl::ShowPosition(long pos) int linesToScroll = specifiedLineLineNo - currentLineLineNo; if (linesToScroll != 0) - (void)::SendMessage(GetBuddyHwnd(), EM_LINESCROLL, 0, (LPARAM)linesToScroll); + (void)::SendMessage(GetBuddyHwnd(), EM_LINESCROLL, 0, (LPARAM)linesToScroll); } long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const