Clipboard usage fixes inspired by Tinderbox logs.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8afd90d57c
commit
caf448e3e1
@ -826,6 +826,8 @@ bool wxHtmlWindow::CopySelection(ClipboardType t)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wxUnusedVar(t);
|
||||||
#endif // wxUSE_CLIPBOARD
|
#endif // wxUSE_CLIPBOARD
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1027,6 +1029,8 @@ void wxHtmlWindow::OnMouseDown(wxMouseEvent& event)
|
|||||||
CaptureMouse();
|
CaptureMouse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wxUnusedVar(event);
|
||||||
#endif // wxUSE_CLIPBOARD
|
#endif // wxUSE_CLIPBOARD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ bool wxComboBox::CanUndo() const
|
|||||||
{
|
{
|
||||||
if (!IsEditable())
|
if (!IsEditable())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
HWND hEditWnd = (HWND) GetEditHWND() ;
|
HWND hEditWnd = (HWND) GetEditHWND() ;
|
||||||
if ( hEditWnd )
|
if ( hEditWnd )
|
||||||
return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0;
|
return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0;
|
||||||
@ -586,7 +586,7 @@ bool wxComboBox::CanRedo() const
|
|||||||
{
|
{
|
||||||
if (!IsEditable())
|
if (!IsEditable())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
HWND hEditWnd = (HWND) GetEditHWND() ;
|
HWND hEditWnd = (HWND) GetEditHWND() ;
|
||||||
if ( hEditWnd )
|
if ( hEditWnd )
|
||||||
return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0;
|
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
|
// Paste into edit control
|
||||||
SendMessage(GetHwnd(), WM_PASTE, (WPARAM)0, (LPARAM)0L);
|
SendMessage(GetHwnd(), WM_PASTE, (WPARAM)0, (LPARAM)0L);
|
||||||
|
#else
|
||||||
|
wxUnusedVar(from);
|
||||||
|
wxUnusedVar(to);
|
||||||
|
wxUnusedVar(value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ void wxEnhMetaFile::Free()
|
|||||||
bool wxEnhMetaFile::Play(wxDC *dc, wxRect *rectBound)
|
bool wxEnhMetaFile::Play(wxDC *dc, wxRect *rectBound)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), false, _T("can't play invalid enhanced metafile") );
|
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;
|
RECT rect;
|
||||||
if ( rectBound )
|
if ( rectBound )
|
||||||
@ -180,8 +180,8 @@ wxSize wxEnhMetaFile::GetSize() const
|
|||||||
|
|
||||||
bool wxEnhMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height))
|
bool wxEnhMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height))
|
||||||
{
|
{
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP && wxUSE_CLIPBOARD
|
||||||
wxCHECK_MSG( m_hMF, FALSE, _T("can't copy invalid metafile to clipboard") );
|
wxCHECK_MSG( m_hMF, false, _T("can't copy invalid metafile to clipboard") );
|
||||||
|
|
||||||
return wxTheClipboard->AddData(new wxEnhMetaFileDataObject(*this));
|
return wxTheClipboard->AddData(new wxEnhMetaFileDataObject(*this));
|
||||||
#else // !wxUSE_DRAG_AND_DROP
|
#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
|
// first get the buffer size and alloc memory
|
||||||
size_t size = ::GetWinMetaFileBits(hEMF, 0, NULL, MM_ANISOTROPIC, hdc);
|
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);
|
BYTE *bits = (BYTE *)malloc(size);
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format,
|
|||||||
{
|
{
|
||||||
hEMF = *(HENHMETAFILE *)buf;
|
hEMF = *(HENHMETAFILE *)buf;
|
||||||
|
|
||||||
wxCHECK_MSG( hEMF, FALSE, _T("pasting invalid enh metafile") );
|
wxCHECK_MSG( hEMF, false, _T("pasting invalid enh metafile") );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -377,7 +377,7 @@ bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format,
|
|||||||
|
|
||||||
// first get the buffer size
|
// first get the buffer size
|
||||||
size_t size = ::GetMetaFileBitsEx(mfpict->hMF, 0, NULL);
|
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
|
// then get metafile bits
|
||||||
BYTE *bits = (BYTE *)malloc(size);
|
BYTE *bits = (BYTE *)malloc(size);
|
||||||
@ -441,7 +441,7 @@ bool wxEnhMetaFileSimpleDataObject::SetData(size_t WXUNUSED(len),
|
|||||||
{
|
{
|
||||||
HENHMETAFILE hEMF = *(HENHMETAFILE *)buf;
|
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);
|
m_metafile.SetHENHMETAFILE((WXHANDLE)hEMF);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -421,7 +421,9 @@ void ctMainFrame::OnUpdateDisable(wxUpdateUIEvent& event)
|
|||||||
IMPLEMENT_CLASS(ctOutputWindow, wxPanel)
|
IMPLEMENT_CLASS(ctOutputWindow, wxPanel)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(ctOutputWindow, wxPanel)
|
BEGIN_EVENT_TABLE(ctOutputWindow, wxPanel)
|
||||||
|
#if wxUSE_CLIPBOARD
|
||||||
EVT_BUTTON(wxID_COPY, ctOutputWindow::OnCopyToClipboard)
|
EVT_BUTTON(wxID_COPY, ctOutputWindow::OnCopyToClipboard)
|
||||||
|
#endif // wxUSE_CLIPBOARD
|
||||||
EVT_BUTTON(wxID_SAVE, ctOutputWindow::OnSaveText)
|
EVT_BUTTON(wxID_SAVE, ctOutputWindow::OnSaveText)
|
||||||
EVT_BUTTON(ctID_REGENERATE, ctOutputWindow::OnRegenerate)
|
EVT_BUTTON(ctID_REGENERATE, ctOutputWindow::OnRegenerate)
|
||||||
EVT_UPDATE_UI(wxID_SAVE, ctOutputWindow::OnUpdateSaveText)
|
EVT_UPDATE_UI(wxID_SAVE, ctOutputWindow::OnUpdateSaveText)
|
||||||
@ -471,6 +473,7 @@ void ctOutputWindow::CreateWindows()
|
|||||||
SetSizer( item0 );
|
SetSizer( item0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_CLIPBOARD
|
||||||
/// Copies the text to the clipboard.
|
/// Copies the text to the clipboard.
|
||||||
void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event))
|
void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
@ -506,6 +509,7 @@ void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_CLIPBOARD
|
||||||
|
|
||||||
/// Sets the code in the text control.
|
/// Sets the code in the text control.
|
||||||
void ctOutputWindow::SetText(const wxString& text)
|
void ctOutputWindow::SetText(const wxString& text)
|
||||||
|
@ -184,7 +184,9 @@ public:
|
|||||||
void CreateWindows();
|
void CreateWindows();
|
||||||
|
|
||||||
/// Copies the text to the clipboard.
|
/// Copies the text to the clipboard.
|
||||||
|
#if wxUSE_CLIPBOARD
|
||||||
void OnCopyToClipboard(wxCommandEvent& event);
|
void OnCopyToClipboard(wxCommandEvent& event);
|
||||||
|
#endif // wxUSE_CLIPBOARD
|
||||||
void OnUpdateCopy(wxUpdateUIEvent& event);
|
void OnUpdateCopy(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
/// Regenerates setup.h/configure command
|
/// Regenerates setup.h/configure command
|
||||||
|
Loading…
Reference in New Issue
Block a user