Don't try to open clipboard if already open

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35977 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2005-10-21 20:43:02 +00:00
parent c59f6793fb
commit d21423356e
2 changed files with 9 additions and 2 deletions

View File

@@ -3824,7 +3824,7 @@ bool wxRichTextBuffer::CopyToClipboard(const wxRichTextRange& range)
{ {
bool success = false; bool success = false;
wxString text = GetTextForRange(range); wxString text = GetTextForRange(range);
if (wxTheClipboard->Open()) if (!wxTheClipboard->IsOpened() && wxTheClipboard->Open())
{ {
success = wxTheClipboard->SetData(new wxTextDataObject(text)); success = wxTheClipboard->SetData(new wxTextDataObject(text));
wxTheClipboard->Close(); wxTheClipboard->Close();
@@ -3883,7 +3883,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
bool wxRichTextBuffer::CanPasteFromClipboard() const bool wxRichTextBuffer::CanPasteFromClipboard() const
{ {
bool canPaste = false; bool canPaste = false;
if (wxTheClipboard->Open()) if (!wxTheClipboard->IsOpened() && wxTheClipboard->Open())
{ {
if (wxTheClipboard->IsSupported(wxDF_TEXT) || wxTheClipboard->IsSupported(wxDF_BITMAP)) if (wxTheClipboard->IsSupported(wxDF_TEXT) || wxTheClipboard->IsSupported(wxDF_BITMAP))
{ {

View File

@@ -218,6 +218,9 @@ void wxRichTextCtrl::Clear()
/// Painting /// Painting
void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
{ {
if (GetCaret())
GetCaret()->Hide();
{ {
wxBufferedPaintDC dc(this, m_bufferBitmap); wxBufferedPaintDC dc(this, m_bufferBitmap);
//wxLogDebug(wxT("OnPaint")); //wxLogDebug(wxT("OnPaint"));
@@ -245,6 +248,10 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
GetBuffer().Draw(dc, GetBuffer().GetRange(), GetSelectionRange(), drawingArea, 0 /* descent */, 0 /* flags */); GetBuffer().Draw(dc, GetBuffer().GetRange(), GetSelectionRange(), drawingArea, 0 /* descent */, 0 /* flags */);
} }
if (GetCaret())
GetCaret()->Show();
PositionCaret(); PositionCaret();
} }