diff options
Diffstat (limited to 'scintilla/src/Editor.cxx')
-rw-r--r-- | scintilla/src/Editor.cxx | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index a19feba..5ee9721 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -363,14 +363,14 @@ SelectionPosition Editor::ClampPositionIntoDocument(SelectionPosition sp) const }
}
-Point Editor::LocationFromPosition(SelectionPosition pos) {
+Point Editor::LocationFromPosition(SelectionPosition pos, PointEnd pe) {
RefreshStyleData();
AutoSurface surface(this);
- return view.LocationFromPosition(surface, *this, pos, topLine, vs);
+ return view.LocationFromPosition(surface, *this, pos, topLine, vs, pe);
}
-Point Editor::LocationFromPosition(int pos) {
- return LocationFromPosition(SelectionPosition(pos));
+Point Editor::LocationFromPosition(int pos, PointEnd pe) {
+ return LocationFromPosition(SelectionPosition(pos), pe);
}
int Editor::XFromPosition(int pos) {
@@ -2424,13 +2424,7 @@ void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctr }
bool Editor::NotifyMarginClick(Point pt, int modifiers) {
- int marginClicked = -1;
- int x = vs.textStart - vs.fixedColumnWidth;
- for (size_t margin = 0; margin < vs.ms.size(); margin++) {
- if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width))
- marginClicked = static_cast<int>(margin);
- x += vs.ms[margin].width;
- }
+ const int marginClicked = vs.MarginFromLocation(pt);
if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) {
int position = pdoc->LineStart(LineFromLocation(pt));
if ((vs.ms[marginClicked].mask & SC_MASK_FOLDERS) && (foldAutomatic & SC_AUTOMATICFOLD_CLICK)) {
@@ -2471,6 +2465,22 @@ bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { return NotifyMarginClick(pt, ModifierFlags(shift, ctrl, alt));
}
+bool Editor::NotifyMarginRightClick(Point pt, int modifiers) {
+ int marginRightClicked = vs.MarginFromLocation(pt);
+ if ((marginRightClicked >= 0) && vs.ms[marginRightClicked].sensitive) {
+ int position = pdoc->LineStart(LineFromLocation(pt));
+ SCNotification scn = {};
+ scn.nmhdr.code = SCN_MARGINRIGHTCLICK;
+ scn.modifiers = modifiers;
+ scn.position = position;
+ scn.margin = marginRightClicked;
+ NotifyParent(scn);
+ return true;
+ } else {
+ return false;
+ }
+}
+
void Editor::NotifyNeedShown(int pos, int len) {
SCNotification scn = {};
scn.nmhdr.code = SCN_NEEDSHOWN;
@@ -3156,6 +3166,12 @@ void Editor::ParaUpOrDown(int direction, Selection::selTypes selt) { } while (!cs.GetVisible(lineDoc));
}
+Range Editor::RangeDisplayLine(int lineVisible) {
+ RefreshStyleData();
+ AutoSurface surface(this);
+ return view.RangeDisplayLine(surface, *this, lineVisible, vs);
+}
+
int Editor::StartEndDisplayLine(int pos, bool start) {
RefreshStyleData();
AutoSurface surface(this);
@@ -3948,7 +3964,7 @@ CaseFolder *Editor::CaseFolderForEncoding() { long Editor::FindText(
uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX.
- sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range.
+ sptr_t lParam) { ///< @c Sci_TextToFind structure: The text to search for in the given range.
Sci_TextToFind *ft = reinterpret_cast<Sci_TextToFind *>(lParam);
int lengthFound = istrlen(ft->lpstrText);
@@ -4594,6 +4610,11 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifie ShowCaretAtCurrentPosition();
}
+void Editor::RightButtonDownWithModifiers(Point pt, unsigned int, int modifiers) {
+ if (NotifyMarginRightClick(pt, modifiers))
+ return;
+}
+
void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
return ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt));
}
@@ -5589,7 +5610,7 @@ void Editor::AddStyledText(char *buffer, int appendLength) { SetEmptySelection(sel.MainCaret() + lengthInserted);
}
-bool Editor::ValidMargin(uptr_t wParam) {
+bool Editor::ValidMargin(uptr_t wParam) const {
return wParam < vs.ms.size();
}
@@ -6304,6 +6325,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { Redraw();
break;
+ case SCI_GETTABDRAWMODE:
+ return vs.tabDrawMode;
+
+ case SCI_SETTABDRAWMODE:
+ vs.tabDrawMode = static_cast<TabDrawMode>(wParam);
+ Redraw();
+ break;
+
case SCI_GETWHITESPACESIZE:
return vs.whitespaceSize;
@@ -6724,15 +6753,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETIMEINTERACTION:
return imeInteraction;
-#ifdef INCLUDE_DEPRECATED_FEATURES
- case SCI_SETUSEPALETTE:
- InvalidateStyleRedraw();
- break;
-
- case SCI_GETUSEPALETTE:
- return 0;
-#endif
-
// Marker definition and setting
case SCI_MARKERDEFINE:
if (wParam <= MARKER_MAX) {
@@ -7076,6 +7096,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { Redraw();
break;
+ case SCI_TOGGLEFOLDSHOWTEXT:
+ cs.SetFoldDisplayText(static_cast<int>(wParam), CharPtrFromSPtr(lParam));
+ FoldLine(static_cast<int>(wParam), SC_FOLDACTION_TOGGLE);
+ break;
+
+ case SCI_FOLDDISPLAYTEXTSETSTYLE:
+ foldDisplayTextStyle = static_cast<int>(wParam);
+ Redraw();
+ break;
+
case SCI_TOGGLEFOLD:
FoldLine(static_cast<int>(wParam), SC_FOLDACTION_TOGGLE);
break;
|