aboutsummaryrefslogtreecommitdiffhomepage
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/ScintillaGTK.cxx20
-rw-r--r--gtk/makefile2
-rw-r--r--gtk/scintilla.mak19
3 files changed, 24 insertions, 17 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index e506dd1b4..9d7cc02ee 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -44,6 +44,7 @@
#include "Decoration.h"
#include "CharClassify.h"
#include "Document.h"
+#include "Selection.h"
#include "PositionCache.h"
#include "Editor.h"
#include "SString.h"
@@ -1345,7 +1346,7 @@ void ScintillaGTK::CopyToClipboard(const SelectionText &selectedText) {
}
void ScintillaGTK::Copy() {
- if (currentPos != anchor) {
+ if (!sel.Empty()) {
#ifndef USE_GTK_CLIPBOARD
CopySelectionRange(&copyText);
gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)),
@@ -1357,7 +1358,7 @@ void ScintillaGTK::Copy() {
StoreOnClipboard(clipText);
#endif
#if PLAT_GTK_WIN32
- if (selType == selRectangle) {
+ if (sel.IsRectangular()) {
::OpenClipboard(NULL);
::SetClipboardData(cfColumnSelect, 0);
::CloseClipboard();
@@ -1433,7 +1434,7 @@ bool ScintillaGTK::OwnPrimarySelection() {
void ScintillaGTK::ClaimSelection() {
// X Windows has a 'primary selection' as well as the clipboard.
// Whenever the user selects some text, we become the primary selection
- if (currentPos != anchor && GTK_WIDGET_REALIZED(GTK_WIDGET(PWidget(wMain)))) {
+ if (!sel.Empty() && GTK_WIDGET_REALIZED(GTK_WIDGET(PWidget(wMain)))) {
primarySelection = true;
gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)),
GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
@@ -1520,10 +1521,11 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) {
int selStart = SelectionStart();
if (selText.rectangular) {
- PasteRectangular(selStart, selText.s, selText.len);
+ PasteRectangular(SelectionPosition(selStart), selText.s, selText.len);
} else {
- pdoc->InsertString(currentPos, selText.s, selText.len);
- SetEmptySelection(currentPos + selText.len);
+ int caretMain = sel.MainCaret();
+ pdoc->InsertString(caretMain, selText.s, selText.len);
+ SetEmptySelection(caretMain + selText.len);
}
pdoc->EndUndoAction();
EnsureCaretVisible();
@@ -2222,7 +2224,7 @@ void ScintillaGTK::PreeditChangedThis() {
gint x, y;
gdk_window_get_origin((PWidget(wText))->window, &x, &y);
- Point pt = LocationFromPosition(currentPos);
+ Point pt = LocationFromPosition(sel.MainCaret());
if (pt.x < 0)
pt.x = 0;
if (pt.y < 0)
@@ -2309,7 +2311,7 @@ void ScintillaGTK::Draw(GtkWidget *widget, GdkRectangle *area) {
}
#ifdef INTERNATIONAL_INPUT
- Point pt = sciThis->LocationFromPosition(sciThis->currentPos);
+ Point pt = sciThis->LocationFromPosition(sciThis->sel.MainCaret());
pt.y += sciThis->vs.lineHeight - 2;
if (pt.x < 0) pt.x = 0;
if (pt.y < 0) pt.y = 0;
@@ -2569,7 +2571,7 @@ void ScintillaGTK::DragDataGet(GtkWidget *widget, GdkDragContext *context,
ScintillaGTK *sciThis = ScintillaFromWidget(widget);
try {
sciThis->dragWasDropped = true;
- if (sciThis->currentPos != sciThis->anchor) {
+ if (!sciThis->sel.Empty()) {
sciThis->GetSelection(selection_data, info, &sciThis->drag);
}
if (context->action == GDK_ACTION_MOVE) {
diff --git a/gtk/makefile b/gtk/makefile
index 87c43aa43..8d01390d8 100644
--- a/gtk/makefile
+++ b/gtk/makefile
@@ -88,7 +88,7 @@ $(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o \
CharClassify.o Decoration.o Document.o PerLine.o CallTip.o \
ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.o \
KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
- RESearch.o RunStyles.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
+ RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
$(MARSHALLER) $(LEXOBJS)
$(AR) rc $@ $^
$(RANLIB) $@
diff --git a/gtk/scintilla.mak b/gtk/scintilla.mak
index b993c6069..78634aaae 100644
--- a/gtk/scintilla.mak
+++ b/gtk/scintilla.mak
@@ -135,6 +135,7 @@ SOBJS=\
$(DIR_O)\PropSet.obj \
$(DIR_O)\ScintillaBase.obj \
$(DIR_O)\ScintillaGTK.obj \
+ $(DIR_O)\Selection.obj \
$(DIR_O)\Style.obj \
$(DIR_O)\UniConversion.obj \
$(DIR_O)\ViewStyle.obj \
@@ -245,6 +246,7 @@ LOBJS=\
$(DIR_O)\PropSet.obj \
$(DIR_O)\ScintillaBaseL.obj \
$(DIR_O)\ScintillaGTKL.obj \
+ $(DIR_O)\Selection.obj \
$(DIR_O)\Style.obj \
$(DIR_O)\StyleContext.obj \
$(DIR_O)\UniConversion.obj \
@@ -341,7 +343,7 @@ $(DIR_O)\Editor.obj: ../src/Editor.cxx ../include/Platform.h ../include/Scintill
../src/Partitioning.h ../src/CellBuffer.h ../src/KeyMap.h \
../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
- ../src/Document.h ../src/Editor.h ../src/PositionCache.h
+ ../src/Document.h ../src/Editor.h ../src/Selection.h ../src/PositionCache.h
$(DIR_O)\ExternalLexer.obj: ../src/ExternalLexer.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SciLexer.h ../include/PropSet.h \
@@ -530,7 +532,7 @@ $(DIR_O)\PositionCache.obj: ../src/Editor.cxx ../include/Platform.h ../include/S
../src/Partitioning.h ../src/CellBuffer.h ../src/KeyMap.h \
../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
- ../src/Decoration.h ../src/Document.h ../src/Editor.h ../src/PositionCache.h
+ ../src/Decoration.h ../src/Document.h ../src/Editor.h ../src/Selection.h ../src/PositionCache.h
$(DIR_O)\PropSet.obj: ../src/PropSet.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h
@@ -548,7 +550,7 @@ $(DIR_O)\ScintillaBase.obj: ../src/ScintillaBase.cxx ../include/Platform.h \
../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/AutoComplete.h ../src/CharClassify.h ../src/Document.h \
- ../src/Editor.h ../src/ScintillaBase.h
+ ../src/Editor.h ../src/Selection.h ../src/ScintillaBase.h
$(DIR_O)\ScintillaBaseL.obj: ../src/ScintillaBase.cxx ../include/Platform.h \
../include/Scintilla.h ../include/PropSet.h ../include/SString.h \
@@ -557,7 +559,7 @@ $(DIR_O)\ScintillaBaseL.obj: ../src/ScintillaBase.cxx ../include/Platform.h \
../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/AutoComplete.h ../src/CharClassify.h ../src/Document.h \
- ../src/Editor.h ../src/ScintillaBase.h
+ ../src/Editor.h ../src/Selection.h ../src/ScintillaBase.h
$(DIR_O)\ScintillaGTK.obj: ScintillaGTK.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \
@@ -566,7 +568,7 @@ $(DIR_O)\ScintillaGTK.obj: ScintillaGTK.cxx ../include/Platform.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \
- ../src/UniConversion.h
+ ../src/Selection.h ../src/UniConversion.h
$(DIR_O)\ScintillaGTKL.obj: ScintillaGTK.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \
@@ -575,7 +577,7 @@ $(DIR_O)\ScintillaGTKL.obj: ScintillaGTK.cxx ../include/Platform.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \
- ../src/UniConversion.h
+ ../src/Selection.h ../src/UniConversion.h
$(DIR_O)\ScintillaGTKS.obj: ScintillaGTK.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \
@@ -584,7 +586,10 @@ $(DIR_O)\ScintillaGTKS.obj: ScintillaGTK.cxx ../include/Platform.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \
- ../src/UniConversion.h
+ ../src/Selection.h ../src/UniConversion.h
+
+$(DIR_O)\Selection.obj: ../src/Selection.cxx ../include/Platform.h ../include/Scintilla.h \
+ ../src/Selection.h
$(DIR_O)\Style.obj: ../src/Style.cxx ../include/Platform.h ../include/Scintilla.h \
../src/Style.h