if (result == wxDragMove && dropWentOutside)
ClearSelection();
inDragDrop = ddNone;
- SetDragPosition(invalidPosition);
+ SetDragPosition(SelectionPosition(invalidPosition));
}
#endif // wxUSE_DRAG_AND_DROP
}
void ScintillaWX::Copy() {
- if (currentPos != anchor) {
+ if (!sel.Empty()) {
SelectionText st;
CopySelectionRange(&st);
CopyToClipboard(st);
text = wxEmptyString;
#endif
int len = strlen(buf);
- pdoc->InsertString(currentPos, buf, len);
- SetEmptySelection(currentPos + len);
+ int caretMain = sel.MainCaret();
+ pdoc->InsertString(caretMain, buf, len);
+ SetEmptySelection(caretMain + len);
}
#endif // wxUSE_DATAOBJ
void ScintillaWX::ClaimSelection() {
#ifdef __WXGTK__
// Put the selected text in the PRIMARY selection
- if (currentPos != anchor) {
+ if (!sel.Empty()) {
SelectionText st;
CopySelectionRange(&st);
wxTheClipboard->UsePrimarySelection(true);
DestroySystemCaret();
CreateSystemCaret();
}
- Point pos = LocationFromPosition(currentPos);
+ Point pos = PointMainCaret();
::SetCaretPos(pos.x, pos.y);
}
#endif
{
ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
}
- PRectangle rc = ct.CallTipStart(currentPos, pt,
+ int caretMain = sel.MainCaret();
+ PRectangle rc = ct.CallTipStart(caretMain, pt,
defn,
vs.styles[ctStyle].fontName,
vs.styles[ctStyle].sizeZoomed,
// Set the current position to the mouse click point and
// then paste in the PRIMARY selection, if any. wxGTK only.
int newPos = PositionFromLocation(pt);
- MovePositionTo(newPos, noSel, true);
+ MovePositionTo(newPos, Selection::noSel, true);
pdoc->BeginUndoAction();
wxTextDataObject data;
wxConvertEOLMode(pdoc->eolMode));
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
int len = strlen(buf);
- pdoc->InsertString(currentPos, buf, len);
- SetEmptySelection(currentPos + len);
+ int caretMain = sel.MainCaret();
+ pdoc->InsertString(caretMain, buf, len);
+ SetEmptySelection(caretMain + len);
}
pdoc->EndUndoAction();
NotifyChange();
#if wxUSE_DRAG_AND_DROP
bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
- SetDragPosition(invalidPosition);
+ SetDragPosition(SelectionPosition(invalidPosition));
wxString text = wxTextBuffer::Translate(data,
wxConvertEOLMode(pdoc->eolMode));
dragResult = evt.GetDragResult();
if (dragResult == wxDragMove || dragResult == wxDragCopy) {
- DropAt(evt.GetPosition(),
+ DropAt(SelectionPosition(evt.GetPosition()),
wx2stc(evt.GetDragText()),
dragResult == wxDragMove,
false); // TODO: rectangular?
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
- SetDragPosition(PositionFromLocation(Point(x, y)));
+ SetDragPosition(SelectionPosition(PositionFromLocation(Point(x, y))));
// Send an event to allow the drag result to be changed
wxStyledTextEvent evt(wxEVT_STC_DRAG_OVER, stc->GetId());
void ScintillaWX::DoDragLeave() {
- SetDragPosition(invalidPosition);
+ SetDragPosition(SelectionPosition(invalidPosition));
}
#endif // wxUSE_DRAG_AND_DROP
//----------------------------------------------------------------------
}
bool ScintillaWX::GetUseAntiAliasing() {
- return vs.extraFontFlag;
+ return vs.extraFontFlag != 0;
}
//----------------------------------------------------------------------