m_selectionAnchorObject = NULL;
m_selectionState = wxRichTextCtrlSelectionState_Normal;
m_editable = true;
+ m_useVirtualAttributes = false;
m_verticalScrollbarEnabled = true;
m_caretAtLineStart = false;
m_dragging = false;
dc.SetFont(GetFont());
- // Paint the background
- PaintBackground(dc);
-
wxRect drawingArea(GetUpdateRegion().GetBox());
drawingArea.SetPosition(GetUnscaledPoint(GetLogicalPoint(drawingArea.GetPosition())));
drawingArea.SetSize(GetUnscaledSize(drawingArea.GetSize()));
SetupScrollbars();
}
+ // Paint the background
+ PaintBackground(dc);
+
wxRect clipRect(availableSpace);
clipRect.x += GetBuffer().GetLeftMargin();
clipRect.y += GetBuffer().GetTopMargin();
/// Mouse-movements
void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
{
+ if (!event.Dragging() && m_dragging)
+ {
+ // We may have accidentally lost a mouse-up event, especially on Linux
+ m_dragging = false;
+ if (GetCapture() == this)
+ ReleaseMouse();
+ }
+
#if wxUSE_DRAG_AND_DROP
size_t distance = 0;
if (m_preDrag || m_dragging)
wxString valueUnix = wxTextFile::Translate(value, wxTextFileType_Unix);
GetFocusObject()->InsertTextWithUndo(& GetBuffer(), m_caretPosition+1, valueUnix, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
- GetBuffer().Defragment();
+ wxRichTextDrawingContext context(& GetBuffer());
+ GetBuffer().Defragment(context);
if ( flags & SetValue_SendEvent )
wxTextCtrl::SendTextUpdatedEvent(this);
SetSelection(from, to);
- wxRichTextAttr attr = GetDefaultStyle();
+ wxRichTextAttr attr(GetDefaultStyle());
DeleteSelectedContent();
wxRect caretRect;
if (GetCaretPositionForIndex(GetCaretPosition(), caretRect, container))
{
+#if !wxRICHTEXT_USE_OWN_CARET
caretRect = GetScaledRect(caretRect);
+#endif
int topMargin = (int) (0.5 + GetScale()*GetBuffer().GetTopMargin());
int bottomMargin = (int) (0.5 + GetScale()*GetBuffer().GetBottomMargin());
wxPoint newPt = caretRect.GetPosition();
PrepareDC(dc);
dc.SetFont(GetFont());
+ dc.SetUserScale(GetScale(), GetScale());
wxRichTextDrawingContext context(& GetBuffer());
- GetBuffer().Defragment();
+ GetBuffer().Defragment(context);
GetBuffer().UpdateRanges(); // If items were deleted, ranges need recalculation
GetBuffer().Layout(dc, context, availableSpace, availableSpace, flags);
GetBuffer().Invalidate(wxRICHTEXT_NONE);
+ dc.SetUserScale(1.0, 1.0);
+
if (!IsFrozen() && !onlyVisibleRect)
SetupScrollbars();
}
{
if (m_richTextCtrl && m_refreshEnabled)
{
- wxRect rect(GetPosition(), GetSize());
- m_richTextCtrl->RefreshRect(rect, false);
+ wxRect rect(wxPoint(m_xOld, m_yOld), GetSize());
+ wxRect scaledRect = m_richTextCtrl->GetScaledRect(rect);
+ m_richTextCtrl->RefreshRect(scaledRect, false);
}
}
}
if (m_richTextCtrl && m_refreshEnabled)
{
wxRect rect(GetPosition(), GetSize());
- m_richTextCtrl->RefreshRect(rect, false);
+ wxRect rectScaled = m_richTextCtrl->GetScaledRect(rect);
+ m_richTextCtrl->RefreshRect(rectScaled, false);
}
}