From caf448e3e19c0fcd6593e47138fe31a82e8c8a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Skiba?= Date: Mon, 23 May 2005 10:54:45 +0000 Subject: [PATCH] Clipboard usage fixes inspired by Tinderbox logs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/htmlwin.cpp | 4 ++++ src/msw/combobox.cpp | 8 ++++++-- src/msw/enhmeta.cpp | 14 +++++++------- utils/configtool/src/mainframe.cpp | 4 ++++ utils/configtool/src/mainframe.h | 2 ++ 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 2ec463d641..83307773bc 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -826,6 +826,8 @@ bool wxHtmlWindow::CopySelection(ClipboardType t) return true; } } +#else + wxUnusedVar(t); #endif // wxUSE_CLIPBOARD return false; @@ -1027,6 +1029,8 @@ void wxHtmlWindow::OnMouseDown(wxMouseEvent& event) CaptureMouse(); } } +#else + wxUnusedVar(event); #endif // wxUSE_CLIPBOARD } diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 520e547064..e61f41c12b 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -574,7 +574,7 @@ bool wxComboBox::CanUndo() const { if (!IsEditable()) return false; - + HWND hEditWnd = (HWND) GetEditHWND() ; if ( hEditWnd ) return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0; @@ -586,7 +586,7 @@ bool wxComboBox::CanRedo() const { if (!IsEditable()) return false; - + HWND hEditWnd = (HWND) GetEditHWND() ; if ( hEditWnd ) return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0; @@ -697,6 +697,10 @@ void wxComboBox::Replace(long from, long to, const wxString& value) // Paste into edit control SendMessage(GetHwnd(), WM_PASTE, (WPARAM)0, (LPARAM)0L); +#else + wxUnusedVar(from); + wxUnusedVar(to); + wxUnusedVar(value); #endif } diff --git a/src/msw/enhmeta.cpp b/src/msw/enhmeta.cpp index 621208202c..c0063dd5e6 100644 --- a/src/msw/enhmeta.cpp +++ b/src/msw/enhmeta.cpp @@ -120,7 +120,7 @@ void wxEnhMetaFile::Free() bool wxEnhMetaFile::Play(wxDC *dc, wxRect *rectBound) { wxCHECK_MSG( Ok(), false, _T("can't play invalid enhanced metafile") ); - wxCHECK_MSG( dc, FALSE, _T("invalid wxDC in wxEnhMetaFile::Play") ); + wxCHECK_MSG( dc, false, _T("invalid wxDC in wxEnhMetaFile::Play") ); RECT rect; if ( rectBound ) @@ -180,8 +180,8 @@ wxSize wxEnhMetaFile::GetSize() const bool wxEnhMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height)) { -#if wxUSE_DRAG_AND_DROP - wxCHECK_MSG( m_hMF, FALSE, _T("can't copy invalid metafile to clipboard") ); +#if wxUSE_DRAG_AND_DROP && wxUSE_CLIPBOARD + wxCHECK_MSG( m_hMF, false, _T("can't copy invalid metafile to clipboard") ); return wxTheClipboard->AddData(new wxEnhMetaFileDataObject(*this)); #else // !wxUSE_DRAG_AND_DROP @@ -318,7 +318,7 @@ bool wxEnhMetaFileDataObject::GetDataHere(const wxDataFormat& format, void *buf) // first get the buffer size and alloc memory size_t size = ::GetWinMetaFileBits(hEMF, 0, NULL, MM_ANISOTROPIC, hdc); - wxCHECK_MSG( size, FALSE, _T("GetWinMetaFileBits() failed") ); + wxCHECK_MSG( size, false, _T("GetWinMetaFileBits() failed") ); BYTE *bits = (BYTE *)malloc(size); @@ -366,7 +366,7 @@ bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format, { hEMF = *(HENHMETAFILE *)buf; - wxCHECK_MSG( hEMF, FALSE, _T("pasting invalid enh metafile") ); + wxCHECK_MSG( hEMF, false, _T("pasting invalid enh metafile") ); } else { @@ -377,7 +377,7 @@ bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format, // first get the buffer size size_t size = ::GetMetaFileBitsEx(mfpict->hMF, 0, NULL); - wxCHECK_MSG( size, FALSE, _T("GetMetaFileBitsEx() failed") ); + wxCHECK_MSG( size, false, _T("GetMetaFileBitsEx() failed") ); // then get metafile bits BYTE *bits = (BYTE *)malloc(size); @@ -441,7 +441,7 @@ bool wxEnhMetaFileSimpleDataObject::SetData(size_t WXUNUSED(len), { HENHMETAFILE hEMF = *(HENHMETAFILE *)buf; - wxCHECK_MSG( hEMF, FALSE, _T("pasting invalid enh metafile") ); + wxCHECK_MSG( hEMF, false, _T("pasting invalid enh metafile") ); m_metafile.SetHENHMETAFILE((WXHANDLE)hEMF); return true; diff --git a/utils/configtool/src/mainframe.cpp b/utils/configtool/src/mainframe.cpp index 43247a405c..2e013b6a6f 100644 --- a/utils/configtool/src/mainframe.cpp +++ b/utils/configtool/src/mainframe.cpp @@ -421,7 +421,9 @@ void ctMainFrame::OnUpdateDisable(wxUpdateUIEvent& event) IMPLEMENT_CLASS(ctOutputWindow, wxPanel) BEGIN_EVENT_TABLE(ctOutputWindow, wxPanel) +#if wxUSE_CLIPBOARD EVT_BUTTON(wxID_COPY, ctOutputWindow::OnCopyToClipboard) +#endif // wxUSE_CLIPBOARD EVT_BUTTON(wxID_SAVE, ctOutputWindow::OnSaveText) EVT_BUTTON(ctID_REGENERATE, ctOutputWindow::OnRegenerate) EVT_UPDATE_UI(wxID_SAVE, ctOutputWindow::OnUpdateSaveText) @@ -471,6 +473,7 @@ void ctOutputWindow::CreateWindows() SetSizer( item0 ); } +#if wxUSE_CLIPBOARD /// Copies the text to the clipboard. void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event)) { @@ -506,6 +509,7 @@ void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event)) wxTheClipboard->Close(); } } +#endif // wxUSE_CLIPBOARD /// Sets the code in the text control. void ctOutputWindow::SetText(const wxString& text) diff --git a/utils/configtool/src/mainframe.h b/utils/configtool/src/mainframe.h index cf240a0dca..5e9523c267 100644 --- a/utils/configtool/src/mainframe.h +++ b/utils/configtool/src/mainframe.h @@ -184,7 +184,9 @@ public: void CreateWindows(); /// Copies the text to the clipboard. +#if wxUSE_CLIPBOARD void OnCopyToClipboard(wxCommandEvent& event); +#endif // wxUSE_CLIPBOARD void OnUpdateCopy(wxUpdateUIEvent& event); /// Regenerates setup.h/configure command