aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2009-07-12 10:48:17 +0000
committernyamatongwe <devnull@localhost>2009-07-12 10:48:17 +0000
commitbaa50ad103ecc10beae248982a3a37f4a9f51ec9 (patch)
treee083564dff4359f7da1d9b6e537a703f4cda1bea
parent25e9743b71cbeec06c79a7c57ae91f243ac53164 (diff)
downloadscintilla-mirror-baa50ad103ecc10beae248982a3a37f4a9f51ec9.tar.gz
Made compile with new selection class for Mac OS X Carbon.
-rw-r--r--macosx/ScintillaMacOSX.cxx32
-rw-r--r--macosx/ScintillaMacOSX.h1
2 files changed, 17 insertions, 16 deletions
diff --git a/macosx/ScintillaMacOSX.cxx b/macosx/ScintillaMacOSX.cxx
index 410d105d9..1ff26a2b7 100644
--- a/macosx/ScintillaMacOSX.cxx
+++ b/macosx/ScintillaMacOSX.cxx
@@ -334,12 +334,12 @@ HIPoint ScintillaMacOSX::GetLocalPoint(::Point pt)
}
void ScintillaMacOSX::StartDrag() {
- if (currentPos == anchor) return;
+ if (sel.Empty()) return;
// calculate the bounds of the selection
PRectangle client = GetTextRectangle();
- int selStart = SelectionStart();
- int selEnd = SelectionEnd();
+ int selStart = sel.RangeMain().Start().Position();
+ int selEnd = sel.RangeMain().End().Position();
int startLine = pdoc->LineFromPosition(selStart);
int endLine = pdoc->LineFromPosition(selEnd);
Point pt;
@@ -565,12 +565,12 @@ void ScintillaMacOSX::DragScroll()
scrollSpeed = (lines); \
scrollTicks = 2000;
- if (posDrag == invalidPosition) {
+ if (!posDrag.IsValid()) {
RESET_SCROLL_TIMER(1);
return;
}
Point dragMouse = LocationFromPosition(posDrag);
- int line = pdoc->LineFromPosition(posDrag);
+ int line = pdoc->LineFromPosition(posDrag.Position());
int currentVisibleLine = cs.DisplayFromDoc(line);
int lastVisibleLine = Platform::Minimum(topLine + LinesOnScreen() - 1, pdoc->LinesTotal() - 1);
@@ -589,7 +589,7 @@ void ScintillaMacOSX::DragScroll()
}
}
- SetDragPosition(PositionFromLocation(dragMouse));
+ SetDragPosition(SPositionFromLocation(dragMouse));
#undef RESET_SCROLL_TIMER
}
@@ -603,7 +603,7 @@ bool ScintillaMacOSX::DragWithin(DragRef inDrag )
}
Point pt = GetDragPoint (inDrag);
- SetDragPosition(PositionFromLocation(pt));
+ SetDragPosition(SPositionFromLocation(pt));
SetDragCursor(inDrag);
return true;
@@ -612,7 +612,7 @@ bool ScintillaMacOSX::DragWithin(DragRef inDrag )
bool ScintillaMacOSX::DragLeave(DragRef inDrag )
{
HideDragHilite( inDrag );
- SetDragPosition(invalidPosition);
+ SetDragPosition(SelectionPosition(invalidPosition));
WndProc(SCI_SETCURSOR, Window::cursorArrow, 0);
return true;
}
@@ -849,7 +849,7 @@ OSStatus ScintillaMacOSX::DragReceive(DragRef inDrag )
GetDragAttributes( inDrag, &attributes );
bool moving = true;
- int position = PositionFromLocation(GetDragPoint(inDrag));
+ SelectionPosition position = SPositionFromLocation(GetDragPoint(inDrag));
if ( attributes & kDragInsideSenderWindow ) {
GetDragModifiers(inDrag, NULL, NULL, &modifiers);
switch (modifiers & ~btnState) // Filter out btnState (on for drop)
@@ -1457,7 +1457,7 @@ pascal OSStatus ScintillaMacOSX::CommandEventHandler( EventHandlerCallRef /*inCa
bool ScintillaMacOSX::HasSelection()
{
- return ( SelectionEnd() - SelectionStart() > 0 );
+ return ( !sel.Empty() );
}
bool ScintillaMacOSX::CanUndo()
@@ -1484,7 +1484,7 @@ void ScintillaMacOSX::CopyToClipboard(const SelectionText &selectedText) {
void ScintillaMacOSX::Copy()
{
- if (currentPos != anchor) {
+ if (!sel.Empty()) {
#ifdef EXT_INPUT
ExtInput::stop (GetViewRef());
#endif
@@ -1534,11 +1534,11 @@ void ScintillaMacOSX::Paste(bool forceRectangular)
pdoc->BeginUndoAction();
ClearSelection();
if (selectedText.rectangular) {
- int selStart = SelectionStart();
+ SelectionPosition selStart = sel.RangeMain().Start();
PasteRectangular(selStart, selectedText.s, selectedText.len);
} else
- if ( pdoc->InsertString( currentPos, selectedText.s, selectedText.len ) ) {
- SetEmptySelection( currentPos + selectedText.len );
+ if ( pdoc->InsertString( sel.RangeMain().caret.Position(), selectedText.s, selectedText.len ) ) {
+ SetEmptySelection( sel.RangeMain().caret.Position() + selectedText.len );
}
pdoc->EndUndoAction();
@@ -1976,8 +1976,8 @@ OSStatus ScintillaMacOSX::TextInput( TCarbonEvent& event )
AddCharUTF( buffer, usedBufferLength );
} else {
// WARNING: This is an untested code path as with my US keyboard, I only enter a single character at a time
- if (pdoc->InsertString(currentPos, buffer, usedBufferLength)) {
- SetEmptySelection(currentPos + usedBufferLength);
+ if (pdoc->InsertString(sel.RangeMain().caret.Position(), buffer, usedBufferLength)) {
+ SetEmptySelection(sel.RangeMain().caret.Position() + usedBufferLength);
}
}
diff --git a/macosx/ScintillaMacOSX.h b/macosx/ScintillaMacOSX.h
index 66d4f0f68..98210f175 100644
--- a/macosx/ScintillaMacOSX.h
+++ b/macosx/ScintillaMacOSX.h
@@ -45,6 +45,7 @@
#include "CharClassify.h"
#include "Decoration.h"
#include "Document.h"
+#include "Selection.h"
#include "PositionCache.h"
#include "Editor.h"
#include "SString.h"