Don't try to open clipboard if already open
authorJulian Smart <julian@anthemion.co.uk>
Fri, 21 Oct 2005 20:43:02 +0000 (20:43 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 21 Oct 2005 20:43:02 +0000 (20:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35977 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp
src/richtext/richtextctrl.cpp

index ffe737397cc9cb58b7d2bc43f00e6ec4b1f9914e..55ff600311ddb1ffb9d9ffeacb9bddcf8e0f8301 100644 (file)
@@ -3824,7 +3824,7 @@ bool wxRichTextBuffer::CopyToClipboard(const wxRichTextRange& range)
 {
     bool success = false;
     wxString text = GetTextForRange(range);
-    if (wxTheClipboard->Open())
+    if (!wxTheClipboard->IsOpened() && wxTheClipboard->Open())
     {
         success = wxTheClipboard->SetData(new wxTextDataObject(text));
         wxTheClipboard->Close();
@@ -3883,7 +3883,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
 bool wxRichTextBuffer::CanPasteFromClipboard() const
 {
     bool canPaste = false;
-    if (wxTheClipboard->Open())
+    if (!wxTheClipboard->IsOpened() && wxTheClipboard->Open())
     {
         if (wxTheClipboard->IsSupported(wxDF_TEXT) || wxTheClipboard->IsSupported(wxDF_BITMAP))
         {
index 732a30dd8ef88e8b0e7a559048210ff4bc812a6d..297a3dea4f1252fad8038099e9ca971b74470966 100644 (file)
@@ -218,6 +218,9 @@ void wxRichTextCtrl::Clear()
 /// Painting
 void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
+    if (GetCaret())
+        GetCaret()->Hide();
+
     {
         wxBufferedPaintDC dc(this, m_bufferBitmap);
         //wxLogDebug(wxT("OnPaint"));
@@ -245,6 +248,10 @@ void wxRichTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
         
         GetBuffer().Draw(dc, GetBuffer().GetRange(), GetSelectionRange(), drawingArea, 0 /* descent */, 0 /* flags */);
     }
+
+    if (GetCaret())
+        GetCaret()->Show();
+
     PositionCaret();
 }