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:
authorMike Krüger <mkrueger@xamarin.com>2013-08-13 12:09:13 +0400
committerMike Krüger <mkrueger@xamarin.com>2013-08-13 12:09:13 +0400
commit9bc9a87a8e6edf33dda8daa2815f9d649ebcab49 (patch)
treec4ff6321d296c812452f792b5b9ca82f81ca8128 /main/src/core/Mono.Texteditor
parent506e27b26c45383f46a0dac791e04ff96bd41b99 (diff)
[TextEditor] Text layouts now calculate with pixel and no longer with
pango coordinates.
Diffstat (limited to 'main/src/core/Mono.Texteditor')
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldingScreenbackgroundRenderer.cs2
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs2
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs18
3 files changed, 11 insertions, 11 deletions
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 2a1422565f..88c8122f5d 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldingScreenbackgroundRenderer.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/FoldingScreenbackgroundRenderer.cs
@@ -113,7 +113,7 @@ namespace Mono.TextEditor
for (var curLine = segmentStartLine; curLine != endLine && y < editor.VAdjustment.Value + editor.Allocation.Height; curLine = curLine.NextLine) {
var curLayout = textViewMargin.CreateLinePartLayout (mode, curLine, curLine.Offset, curLine.Length, -1, -1);
- var width = (int)(curLayout.PangoWidth / Pango.Scale.PangoScale);
+ var width = (int)(curLayout.Width);
curWidth = System.Math.Max (curWidth, width);
y += editor.GetLineHeight (curLine);
}
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 eca35400f2..a8ccb56f8d 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
@@ -2809,7 +2809,7 @@ namespace Mono.TextEditor
longest = line;
}
if (longest != longestLine) {
- int width = (int)(textViewMargin.GetLayout (longest).PangoWidth / Pango.Scale.PangoScale);
+ int width = (int)(textViewMargin.GetLayout (longest).Width);
if (width > this.longestLineWidth) {
this.longestLineWidth = width;
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 190a424958..3adef15aca 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -1059,7 +1059,7 @@ namespace Mono.TextEditor
atts.Dispose ();
int w, h;
wrapper.Layout.GetSize (out w, out h);
- wrapper.PangoWidth = w;
+ wrapper.Width = w / Pango.Scale.PangoScale;
selectionStart = System.Math.Max (line.Offset - 1, selectionStart);
selectionEnd = System.Math.Min (line.EndOffsetIncludingDelimiter + 1, selectionEnd);
@@ -1261,7 +1261,7 @@ namespace Mono.TextEditor
set;
}
- public int PangoWidth {
+ public double Width {
get;
set;
}
@@ -1503,12 +1503,12 @@ namespace Mono.TextEditor
// ---- new renderer
LayoutWrapper layout = CreateLinePartLayout (mode, line, logicalRulerColumn, offset, length, selectionStart, selectionEnd);
int lineOffset = line.Offset;
- double width = layout.PangoWidth / Pango.Scale.PangoScale;
+ double width = layout.Width;
double xPos = pangoPosition / Pango.Scale.PangoScale;
// The caret line marker must be drawn below the text markers otherwise the're invisible
if ((HighlightCaretLine || textEditor.Options.HighlightCaretLine) && Caret.Line == lineNumber)
- DrawCaretLineMarker (cr, xPos, y, layout.PangoWidth / Pango.Scale.PangoScale, _lineHeight);
+ DrawCaretLineMarker (cr, xPos, y, layout.Width, _lineHeight);
// if (!(HighlightCaretLine || textEditor.Options.HighlightCaretLine) || Document.GetLine(Caret.Line) != line) {
if (BackgroundRenderer == null) {
@@ -1653,15 +1653,15 @@ namespace Mono.TextEditor
int vy, vx;
wrapper.Layout.GetSize (out vx, out vy);
- var x = ((pangoPosition + vx + layout.PangoWidth) / Pango.Scale.PangoScale);
+ var x = ((pangoPosition + vx) / Pango.Scale.PangoScale) + layout.Width;
SetVisibleCaretPosition (x, y, x, y);
- xPos = (pangoPosition + layout.PangoWidth) / Pango.Scale.PangoScale;
+ xPos = (pangoPosition) / Pango.Scale.PangoScale + layout.Width;
if (!isSelectionDrawn && (selectionEnd == lineOffset + line.Length) && BackgroundRenderer == null) {
double startX;
double endX;
startX = xPos;
- endX = (pangoPosition + vx + layout.PangoWidth) / Pango.Scale.PangoScale;
+ endX = (pangoPosition + vx) / Pango.Scale.PangoScale + layout.Width;
DrawRectangleWithRuler (cr, xPos + textEditor.HAdjustment.Value - TextStartPosition, new Cairo.Rectangle (startX, y, endX - startX, _lineHeight), this.SelectionColor.Background, true);
}
@@ -1687,7 +1687,7 @@ namespace Mono.TextEditor
wrapper.Dispose ();
pangoPosition += vx;
} else if (index == length && string.IsNullOrEmpty (textEditor.preeditString)) {
- var x = (pangoPosition + layout.PangoWidth) / Pango.Scale.PangoScale;
+ var x = pangoPosition / Pango.Scale.PangoScale + layout.Width;
SetVisibleCaretPosition (x, y, x, y);
} else if (index >= 0 && index <= length) {
Pango.Rectangle strong_pos, weak_pos;
@@ -1720,7 +1720,7 @@ namespace Mono.TextEditor
marker.Draw (textEditor, cr, layout.Layout, false, /*selected*/offset, offset + length, y, xPos, xPos + width);
}
- pangoPosition += layout.PangoWidth;
+ pangoPosition += layout.Width * Pango.Scale.PangoScale;
int scaledDown = (int)(pangoPosition / Pango.Scale.PangoScale);
pangoPosition = scaledDown * Pango.Scale.PangoScale;