Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/core/Mono.Texteditor/Mono.TextEditor/Gui')
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ActionMargin.cs4
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentEditorWindow.cs4
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentPreviewWindow.cs6
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/DashedLineMargin.cs4
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldMarkerMargin.cs4
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldingScreenbackgroundRenderer.cs4
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs2
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GutterMargin.cs4
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/HslColor.cs2
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ITooltipProvider.cs10
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/IconMargin.cs8
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/Margin.cs6
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/MonoTextEditor.cs (renamed from main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditor.cs)26
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs57
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs29
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TooltipProvider.cs14
16 files changed, 117 insertions, 67 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ActionMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ActionMargin.cs
index ba069dfc6e..ea054fb966 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ActionMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ActionMargin.cs
@@ -30,7 +30,7 @@ namespace Mono.TextEditor
{
public class ActionMargin : Margin
{
- readonly TextEditor editor;
+ readonly MonoTextEditor editor;
double marginWidth;
public override double Width {
@@ -39,7 +39,7 @@ namespace Mono.TextEditor
}
}
- public ActionMargin (TextEditor editor)
+ public ActionMargin (MonoTextEditor editor)
{
if (editor == null)
throw new ArgumentNullException ("editor");
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentEditorWindow.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentEditorWindow.cs
index b461bc6b7a..93115383ac 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentEditorWindow.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentEditorWindow.cs
@@ -29,7 +29,7 @@ namespace Mono.TextEditor
{
public class CodeSegmentEditorWindow : Gtk.Window
{
- TextEditor codeSegmentEditor = new TextEditor ();
+ MonoTextEditor codeSegmentEditor = new MonoTextEditor ();
public ISyntaxMode SyntaxMode {
get {
@@ -49,7 +49,7 @@ namespace Mono.TextEditor
}
}
- public CodeSegmentEditorWindow (TextEditor editor) : base (Gtk.WindowType.Toplevel)
+ public CodeSegmentEditorWindow (MonoTextEditor editor) : base (Gtk.WindowType.Toplevel)
{
Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow ();
scrolledWindow.Child = codeSegmentEditor;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentPreviewWindow.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentPreviewWindow.cs
index 29a546cb20..424ba054cc 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentPreviewWindow.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/CodeSegmentPreviewWindow.cs
@@ -38,7 +38,7 @@ namespace Mono.TextEditor
{
const int DefaultPreviewWindowWidth = 320;
const int DefaultPreviewWindowHeight = 200;
- TextEditor editor;
+ MonoTextEditor editor;
Pango.FontDescription fontDescription;
Pango.Layout layout;
Pango.Layout informLayout;
@@ -64,11 +64,11 @@ namespace Mono.TextEditor
}
}
- public CodeSegmentPreviewWindow (TextEditor editor, bool hideCodeSegmentPreviewInformString, TextSegment segment, bool removeIndent = true) : this(editor, hideCodeSegmentPreviewInformString, segment, DefaultPreviewWindowWidth, DefaultPreviewWindowHeight, removeIndent)
+ public CodeSegmentPreviewWindow (MonoTextEditor editor, bool hideCodeSegmentPreviewInformString, TextSegment segment, bool removeIndent = true) : this(editor, hideCodeSegmentPreviewInformString, segment, DefaultPreviewWindowWidth, DefaultPreviewWindowHeight, removeIndent)
{
}
- public CodeSegmentPreviewWindow (TextEditor editor, bool hideCodeSegmentPreviewInformString, TextSegment segment, int width, int height, bool removeIndent = true) : base (Gtk.WindowType.Popup)
+ public CodeSegmentPreviewWindow (MonoTextEditor editor, bool hideCodeSegmentPreviewInformString, TextSegment segment, int width, int height, bool removeIndent = true) : base (Gtk.WindowType.Popup)
{
this.HideCodeSegmentPreviewInformString = hideCodeSegmentPreviewInformString;
this.Segment = segment;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/DashedLineMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/DashedLineMargin.cs
index 154111bc09..db52b966d9 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/DashedLineMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/DashedLineMargin.cs
@@ -30,7 +30,7 @@ namespace Mono.TextEditor
{
public class DashedLineMargin : Margin
{
- TextEditor editor;
+ MonoTextEditor editor;
Cairo.Color color;
public override double Width {
@@ -39,7 +39,7 @@ namespace Mono.TextEditor
}
}
- public DashedLineMargin (TextEditor editor)
+ public DashedLineMargin (MonoTextEditor editor)
{
this.editor = editor;
}
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldMarkerMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldMarkerMargin.cs
index 7a87bfe63a..68aa69fb9f 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldMarkerMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldMarkerMargin.cs
@@ -35,7 +35,7 @@ namespace Mono.TextEditor
{
public class FoldMarkerMargin : Margin
{
- TextEditor editor;
+ MonoTextEditor editor;
DocumentLine lineHover;
Pango.Layout layout;
@@ -63,7 +63,7 @@ namespace Mono.TextEditor
}
}
- public FoldMarkerMargin (TextEditor editor)
+ public FoldMarkerMargin (MonoTextEditor editor)
{
this.editor = editor;
layout = PangoUtil.CreateLayout (editor);
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldingScreenbackgroundRenderer.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldingScreenbackgroundRenderer.cs
index 6c392f8ae7..c1803dbdaf 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldingScreenbackgroundRenderer.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldingScreenbackgroundRenderer.cs
@@ -31,7 +31,7 @@ namespace Mono.TextEditor
{
public class FoldingScreenbackgroundRenderer : IBackgroundRenderer, IDisposable
{
- TextEditor editor;
+ MonoTextEditor editor;
List<FoldSegment> foldSegments;
[Flags]
enum Roles
@@ -54,7 +54,7 @@ namespace Mono.TextEditor
}
}
- public FoldingScreenbackgroundRenderer (TextEditor editor, IEnumerable<FoldSegment> foldSegments)
+ public FoldingScreenbackgroundRenderer (MonoTextEditor editor, IEnumerable<FoldSegment> foldSegments)
{
this.editor = editor;
this.foldSegments = new List<FoldSegment> (foldSegments);
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs
index 01d2665829..b3dcc07170 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkWorkarounds.cs
@@ -34,7 +34,7 @@ using Gtk;
namespace Mono.TextEditor
{
- public static class GtkWorkarounds
+ static class GtkWorkarounds
{
const string LIBOBJC ="/usr/lib/libobjc.dylib";
const string USER32DLL = "User32.dll";
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GutterMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GutterMargin.cs
index 1428c3fc0c..8c69267e8b 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GutterMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GutterMargin.cs
@@ -34,13 +34,13 @@ namespace Mono.TextEditor
{
public class GutterMargin : Margin
{
- TextEditor editor;
+ MonoTextEditor editor;
int width;
int oldLineCountLog10 = -1;
double fontHeight;
- public GutterMargin (TextEditor editor)
+ public GutterMargin (MonoTextEditor editor)
{
this.editor = editor;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/HslColor.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/HslColor.cs
index 6f7f446845..f8e525f939 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/HslColor.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/HslColor.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
namespace Mono.TextEditor
{
- public struct HslColor
+ struct HslColor
{
public double H {
get;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ITooltipProvider.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ITooltipProvider.cs
index cd0cb8d027..6cdc53eccb 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ITooltipProvider.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/ITooltipProvider.cs
@@ -50,5 +50,15 @@ namespace Mono.TextEditor
this.ItemSegment = new TextSegment (offset, length);
this.Item = item;
}
+
+ public override bool Equals (object obj)
+ {
+ return ItemSegment.Equals (((TooltipItem)obj).ItemSegment);
+ }
+
+ public override int GetHashCode ()
+ {
+ return ItemSegment.GetHashCode ();
+ }
}
}
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/IconMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/IconMargin.cs
index 89f264056d..f3ab923632 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/IconMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/IconMargin.cs
@@ -33,11 +33,11 @@ namespace Mono.TextEditor
{
public class IconMargin : Margin
{
- TextEditor editor;
+ MonoTextEditor editor;
Cairo.Color backgroundColor, separatorColor;
const int marginWidth = 22;
- public IconMargin (TextEditor editor)
+ public IconMargin (MonoTextEditor editor)
{
this.editor = editor;
}
@@ -136,7 +136,7 @@ namespace Mono.TextEditor
public class BookmarkMarginDrawEventArgs : EventArgs
{
- public TextEditor Editor {
+ public MonoTextEditor Editor {
get;
private set;
}
@@ -166,7 +166,7 @@ namespace Mono.TextEditor
private set;
}
- public BookmarkMarginDrawEventArgs (TextEditor editor, Cairo.Context context, DocumentLine line, int lineNumber, double xPos, double yPos)
+ public BookmarkMarginDrawEventArgs (MonoTextEditor editor, Cairo.Context context, DocumentLine line, int lineNumber, double xPos, double yPos)
{
this.Editor = editor;
this.Context = context;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/Margin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/Margin.cs
index 9a132f34ee..fdd570e2c3 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/Margin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/Margin.cs
@@ -182,18 +182,18 @@ namespace Mono.TextEditor
}
}
- public TextEditor Editor {
+ public MonoTextEditor Editor {
get;
private set;
}
- public MarginMouseEventArgs (TextEditor editor, Gdk.Event raw, uint button, double x, double y, Gdk.ModifierType modifierState)
+ public MarginMouseEventArgs (MonoTextEditor editor, Gdk.Event raw, uint button, double x, double y, Gdk.ModifierType modifierState)
: this (editor, raw.Type, button, x, y, modifierState)
{
this.RawEvent = raw;
}
- public MarginMouseEventArgs (TextEditor editor, Gdk.EventType type, uint button, double x, double y, Gdk.ModifierType modifierState)
+ public MarginMouseEventArgs (MonoTextEditor editor, Gdk.EventType type, uint button, double x, double y, Gdk.ModifierType modifierState)
{
this.Editor = editor;
this.Type = type;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditor.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/MonoTextEditor.cs
index 9c6542011c..29c4bde505 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditor.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/MonoTextEditor.cs
@@ -41,7 +41,7 @@ namespace Mono.TextEditor
{
[System.ComponentModel.Category("Mono.TextEditor")]
[System.ComponentModel.ToolboxItem(true)]
- public class TextEditor : Container
+ public class MonoTextEditor : Container
{
readonly TextArea textArea;
@@ -60,21 +60,21 @@ namespace Mono.TextEditor
}
}
- public TextEditor () : this(new TextDocument ())
+ public MonoTextEditor () : this(new TextDocument ())
{
}
- public TextEditor (TextDocument doc)
+ public MonoTextEditor (TextDocument doc)
: this (doc, null)
{
}
- public TextEditor (TextDocument doc, ITextEditorOptions options)
+ public MonoTextEditor (TextDocument doc, ITextEditorOptions options)
: this (doc, options, new SimpleEditMode ())
{
}
- public TextEditor (TextDocument doc, ITextEditorOptions options, EditMode initialMode)
+ public MonoTextEditor (TextDocument doc, ITextEditorOptions options, EditMode initialMode)
{
GtkWorkarounds.FixContainerLeak (this);
WidgetFlags |= WidgetFlags.NoWindow;
@@ -376,6 +376,9 @@ namespace Mono.TextEditor
get {
return textArea.Document;
}
+ set {
+ textArea.Document = value;
+ }
}
public bool IsDisposed {
@@ -723,7 +726,16 @@ namespace Mono.TextEditor
textArea.SelectionAnchor = value;
}
}
-
+
+ public int SelectionLead {
+ get {
+ return textArea.SelectionLead;
+ }
+ set {
+ textArea.SelectionLead = value;
+ }
+ }
+
public IEnumerable<DocumentLine> SelectedLines {
get {
return textArea.SelectedLines;
@@ -1203,6 +1215,8 @@ namespace Mono.TextEditor
public double ColumnToX (DocumentLine line, int column)
{
+ if (line == null)
+ throw new ArgumentNullException ("line");
return TextViewMargin.ColumnToX (line, column);
}
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
index ebb0580971..4a2415bfa4 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
@@ -76,6 +76,9 @@ namespace Mono.TextEditor
get {
return textEditorData.Document;
}
+ set {
+ textEditorData.Document = value;
+ }
}
public bool IsDisposed {
@@ -296,8 +299,8 @@ namespace Mono.TextEditor
ResizeMode = ResizeMode.Queue;
}
- TextEditor editor;
- internal void Initialize (TextEditor editor, TextDocument doc, ITextEditorOptions options, EditMode initialMode)
+ MonoTextEditor editor;
+ internal void Initialize (MonoTextEditor editor, TextDocument doc, ITextEditorOptions options, EditMode initialMode)
{
if (doc == null)
throw new ArgumentNullException ("doc");
@@ -1479,8 +1482,10 @@ namespace Mono.TextEditor
} else {
double caretX = ColumnToX (Document.GetLine (p.Line), p.Column);
double textWith = Allocation.Width - textViewMargin.XOffset;
- if (this.textEditorData.HAdjustment.Value > caretX) {
- this.textEditorData.HAdjustment.Value = caretX;
+ if (caretX < this.textEditorData.HAdjustment.Upper) {
+ this.textEditorData.HAdjustment.Value = 0;
+ } else if (this.textEditorData.HAdjustment.Value > caretX) {
+ this.textEditorData.HAdjustment.Value = System.Math.Max (0, caretX - this.textEditorData.HAdjustment.Upper / 2);
} else if (this.textEditorData.HAdjustment.Value + textWith < caretX + TextViewMargin.CharWidth) {
double adjustment = System.Math.Max (0, caretX - textWith + TextViewMargin.CharWidth);
this.textEditorData.HAdjustment.Value = adjustment;
@@ -1953,7 +1958,16 @@ namespace Mono.TextEditor
this.textEditorData.SelectionAnchor = value;
}
}
-
+
+ public int SelectionLead {
+ get {
+ return this.textEditorData.SelectionLead;
+ }
+ set {
+ this.textEditorData.SelectionLead = value;
+ }
+ }
+
public IEnumerable<DocumentLine> SelectedLines {
get {
return this.textEditorData.SelectedLines;
@@ -2277,7 +2291,7 @@ namespace Mono.TextEditor
class CaretPulseAnimation : IAnimationDrawer
{
- TextEditor editor;
+ MonoTextEditor editor;
public double Percent { get; set; }
@@ -2294,7 +2308,7 @@ namespace Mono.TextEditor
}
}
- public CaretPulseAnimation (TextEditor editor)
+ public CaretPulseAnimation (MonoTextEditor editor)
{
this.editor = editor;
}
@@ -2331,7 +2345,7 @@ namespace Mono.TextEditor
public class RegionPulseAnimation : IAnimationDrawer
{
- TextEditor editor;
+ MonoTextEditor editor;
public PulseKind Kind { get; set; }
public double Percent { get; set; }
@@ -2352,10 +2366,10 @@ namespace Mono.TextEditor
}
}
- public RegionPulseAnimation (TextEditor editor, Gdk.Point position, Gdk.Size size)
+ public RegionPulseAnimation (MonoTextEditor editor, Gdk.Point position, Gdk.Size size)
: this (editor, new Gdk.Rectangle (position, size)) {}
- public RegionPulseAnimation (TextEditor editor, Gdk.Rectangle region)
+ public RegionPulseAnimation (MonoTextEditor editor, Gdk.Rectangle region)
{
if (region.X < 0 || region.Y < 0 || region.Width < 0 || region.Height < 0)
throw new ArgumentException ("region is invalid");
@@ -2478,7 +2492,7 @@ namespace Mono.TextEditor
set;
}
- public SearchHighlightPopupWindow (TextEditor editor) : base (editor)
+ public SearchHighlightPopupWindow (MonoTextEditor editor) : base (editor)
{
}
@@ -2753,9 +2767,11 @@ namespace Mono.TextEditor
tipItem = item;
Gtk.Window tw = null;
try {
- tw = provider.ShowTooltipWindow (editor, nextTipOffset, nextTipModifierState, tipX + (int) TextViewMargin.XOffset, tipY, item);
+ tw = provider.CreateTooltipWindow (editor, nextTipOffset, nextTipModifierState, item);
+ if (tw != null)
+ provider.ShowTooltipWindow (editor, tw, nextTipOffset, nextTipModifierState, tipX + (int) TextViewMargin.XOffset, tipY, item);
} catch (Exception e) {
- Console.WriteLine ("-------- Exception while creating tooltip:");
+ Console.WriteLine ("-------- Exception while creating tooltip: " + provider);
Console.WriteLine (e);
}
if (tw == tipWindow)
@@ -2821,9 +2837,12 @@ namespace Mono.TextEditor
nextTipOffset = -1;
}
- void OnDocumentStateChanged (object s, EventArgs a)
+ void OnDocumentStateChanged (object s, DocumentChangeEventArgs args)
{
HideTooltip ();
+ var start = editor.Document.OffsetToLineNumber (args.Offset);
+ var end = editor.Document.OffsetToLineNumber (args.Offset + args.InsertionLength);
+ editor.Document.CommitMultipleLineUpdate (start, end);
}
void OnTextSet (object sender, EventArgs e)
@@ -3047,12 +3066,12 @@ namespace Mono.TextEditor
class SetCaret
{
- TextEditor view;
+ MonoTextEditor view;
int line, column;
bool highlightCaretLine;
bool centerCaret;
- public SetCaret (TextEditor view, int line, int column, bool highlightCaretLine, bool centerCaret)
+ public SetCaret (MonoTextEditor view, int line, int column, bool highlightCaretLine, bool centerCaret)
{
this.view = view;
this.line = line;
@@ -3122,12 +3141,12 @@ namespace Mono.TextEditor
return Gtk.Widget.GType;
}
- internal List<TextEditor.EditorContainerChild> containerChildren = new List<TextEditor.EditorContainerChild> ();
+ internal List<MonoTextEditor.EditorContainerChild> containerChildren = new List<MonoTextEditor.EditorContainerChild> ();
public void AddTopLevelWidget (Gtk.Widget widget, int x, int y)
{
widget.Parent = this;
- TextEditor.EditorContainerChild info = new TextEditor.EditorContainerChild (this, widget);
+ MonoTextEditor.EditorContainerChild info = new MonoTextEditor.EditorContainerChild (this, widget);
info.X = x;
info.Y = y;
containerChildren.Add (info);
@@ -3218,7 +3237,7 @@ namespace Mono.TextEditor
containerChildren.ForEach (child => child.Child.Unmap ());
}
- void ResizeChild (Rectangle allocation, TextEditor.EditorContainerChild child)
+ void ResizeChild (Rectangle allocation, MonoTextEditor.EditorContainerChild child)
{
Requisition req = child.Child.SizeRequest ();
var childRectangle = new Gdk.Rectangle (child.X, child.Y, req.Width, req.Height);
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
index c055338beb..68441c45cd 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -42,7 +42,7 @@ namespace Mono.TextEditor
{
public class TextViewMargin : Margin
{
- readonly TextEditor textEditor;
+ readonly MonoTextEditor textEditor;
Pango.TabArray tabArray;
Pango.Layout markerLayout, defaultLayout;
Pango.Layout[] eolMarkerLayout;
@@ -120,7 +120,7 @@ namespace Mono.TextEditor
}
- public TextViewMargin (TextEditor textEditor)
+ public TextViewMargin (MonoTextEditor textEditor)
{
if (textEditor == null)
throw new ArgumentNullException ("textEditor");
@@ -1630,18 +1630,26 @@ namespace Mono.TextEditor
TextRenderEndPosition = xPos + width,
LineHeight = _lineHeight,
- WholeLineWidth = textEditor.Allocation.Width - xPos
+ WholeLineWidth = textEditor.Allocation.Width - xPos,
+
+ LineYRenderStartPosition = y
};
foreach (TextLineMarker marker in line.Markers) {
if (!marker.IsVisible)
continue;
- if (marker.DrawBackground (textEditor, cr, y, metrics)) {
+ if (marker.DrawBackground (textEditor, cr, metrics)) {
isSelectionDrawn |= (marker.Flags & TextLineMarkerFlags.DrawsSelection) == TextLineMarkerFlags.DrawsSelection;
}
}
+ foreach (var marker in Document.GetTextSegmentMarkersAt (line).Where (m => m.IsVisible)) {
+ if (layout.Layout != null)
+ marker.DrawBackground (textEditor, cr, metrics, offset, offset + length);
+ }
+
+
if (DecorateLineBg != null)
DecorateLineBg (cr, layout, offset, length, xPos, y, selectionStartOffset, selectionEndOffset);
@@ -1819,12 +1827,12 @@ namespace Mono.TextEditor
}
foreach (TextLineMarker marker in line.Markers.Where (m => m.IsVisible)) {
if (layout.Layout != null)
- marker.Draw (textEditor, cr, y, metrics);
+ marker.Draw (textEditor, cr, metrics);
}
foreach (var marker in Document.GetTextSegmentMarkersAt (line).Where (m => m.IsVisible)) {
if (layout.Layout != null)
- marker.Draw (textEditor, cr, layout.Layout, false, /*selected*/offset, offset + length, y, xPos, xPos + width);
+ marker.Draw (textEditor, cr, metrics, offset, offset + length);
}
position += System.Math.Floor (layout.LastLineWidth);
@@ -2037,7 +2045,7 @@ namespace Mono.TextEditor
textEditor.ClearSelection ();
Caret.Location = clickLocation;
InSelectionDrag = true;
- textEditor.SetSelection (clickLocation, clickLocation);
+ textEditor.MainSelection = new Selection (clickLocation, clickLocation);
}
textEditor.RequestResetCaretBlink ();
}
@@ -2417,6 +2425,8 @@ namespace Mono.TextEditor
public static int GetNextTabstop (TextEditorData textEditor, int currentColumn, int tabSize)
{
+ if (tabSize == 0)
+ return currentColumn;
int result = currentColumn - 1 + tabSize;
return 1 + (result / tabSize) * tabSize;
}
@@ -2878,10 +2888,11 @@ namespace Mono.TextEditor
var metrics = new EndOfLineMetrics {
LineSegment = line,
TextRenderEndPosition = TextStartPosition + position,
- LineHeight = _lineHeight
+ LineHeight = _lineHeight,
+ LineYRenderStartPosition = y
};
foreach (var marker in line.Markers) {
- marker.DrawAfterEol (textEditor, cr, y, metrics);
+ marker.DrawAfterEol (textEditor, cr, metrics);
}
}
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TooltipProvider.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TooltipProvider.cs
index 20ea1309e9..c3467dcb75 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TooltipProvider.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TooltipProvider.cs
@@ -29,30 +29,26 @@ namespace Mono.TextEditor
{
public abstract class TooltipProvider
{
- public abstract TooltipItem GetItem (TextEditor editor, int offset);
+ public abstract TooltipItem GetItem (MonoTextEditor editor, int offset);
- public virtual bool IsInteractive (TextEditor editor, Gtk.Window tipWindow)
+ public virtual bool IsInteractive (MonoTextEditor editor, Gtk.Window tipWindow)
{
return false;
}
- protected virtual void GetRequiredPosition (TextEditor editor, Gtk.Window tipWindow, out int requiredWidth, out double xalign)
+ protected virtual void GetRequiredPosition (MonoTextEditor editor, Gtk.Window tipWindow, out int requiredWidth, out double xalign)
{
requiredWidth = tipWindow.SizeRequest ().Width;
xalign = 0.5;
}
- protected virtual Gtk.Window CreateTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
+ public virtual Gtk.Window CreateTooltipWindow (MonoTextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
{
return null;
}
- public virtual Gtk.Window ShowTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
+ public virtual Gtk.Window ShowTooltipWindow (MonoTextEditor editor, Gtk.Window tipWindow, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
{
- Gtk.Window tipWindow = CreateTooltipWindow (editor, offset, modifierState, item);
- if (tipWindow == null)
- return null;
-
int ox = 0, oy = 0;
if (editor.GdkWindow != null)
editor.GdkWindow.GetOrigin (out ox, out oy);