Author: mkrueger
Date: 2008-02-15 13:55:20 -0500 (Fri, 15 Feb 2008)
New Revision: 95788
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/EditActions.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtendibleTextEditor.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MarkerOperationsHandler.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorDisplayBinding.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs
Log:
* gtk-gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs,
MonoDevelop.SourceEditor/SourceEditorWidget.cs,
MonoDevelop.SourceEditor/ExtendibleTextEditor.cs,
MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs,
MonoDevelop.SourceEditor/SourceEditorView.cs,
MonoDevelop.SourceEditor/SourceEditorOptions.cs,
MonoDevelop.SourceEditor/MarkerOperationsHandler.cs,
MonoDevelop.SourceEditor/EditActions.cs,
MonoDevelop.SourceEditor/SourceEditorDisplayBinding.cs: Refactored
text editor.
Modified: trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
2008-02-15 18:54:07 UTC (rev 95787)
+++ trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
2008-02-15 18:55:20 UTC (rev 95788)
@@ -1,3 +1,16 @@
+2008-02-15 Mike Krüger <[EMAIL PROTECTED]>
+
+ * gtk-gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs,
+ MonoDevelop.SourceEditor/SourceEditorWidget.cs,
+ MonoDevelop.SourceEditor/ExtendibleTextEditor.cs,
+ MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs,
+ MonoDevelop.SourceEditor/SourceEditorView.cs,
+ MonoDevelop.SourceEditor/SourceEditorOptions.cs,
+ MonoDevelop.SourceEditor/MarkerOperationsHandler.cs,
+ MonoDevelop.SourceEditor/EditActions.cs,
+ MonoDevelop.SourceEditor/SourceEditorDisplayBinding.cs: Refactored
text
+ editor.
+
2008-02-14 Michael Hutchinson <[EMAIL PROTECTED]>
* SourceEditorWidget.cs: Add workaround for gmcs 1.2.4 bug.
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/EditActions.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/EditActions.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/EditActions.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -52,9 +52,9 @@
int GetNextNonWsCharOffset (TextEditorData data, int offset)
{
int result = offset;
- while (Char.IsWhiteSpace
(data.Document.Buffer.GetCharAt (result))) {
+ while (Char.IsWhiteSpace (data.Document.GetCharAt
(result))) {
result++;
- if (result >= data.Document.Buffer.Length)
+ if (result >= data.Document.Length)
return -1;
}
return result;
@@ -62,12 +62,12 @@
protected override void RemoveCharBeforCaret (TextEditorData
data)
{
- char ch = data.Document.Buffer.GetCharAt
(data.Caret.Offset - 1);
+ char ch = data.Document.GetCharAt (data.Caret.Offset -
1);
int idx = open.IndexOf (ch);
if (idx >= 0) {
int nextCharOffset = GetNextNonWsCharOffset
(data, data.Caret.Offset);
- if (nextCharOffset >= 0 && closing[idx] ==
data.Document.Buffer.GetCharAt (nextCharOffset))
- data.Document.Buffer.Remove
(data.Caret.Offset, nextCharOffset - data.Caret.Offset + 1);
+ if (nextCharOffset >= 0 && closing[idx] ==
data.Document.GetCharAt (nextCharOffset))
+ data.Document.Remove
(data.Caret.Offset, nextCharOffset - data.Caret.Offset + 1);
}
base.RemoveCharBeforCaret (data);
}
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtendibleTextEditor.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtendibleTextEditor.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtendibleTextEditor.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -82,14 +82,14 @@
void Initialize (SourceEditorView view)
{
this.view = view;
- this.Buffer.TextReplaced += delegate {
+ this.Document.TextReplaced += delegate {
this.HideLanguageItemWindow ();
};
base.TextEditorData.Caret.PositionChanged += delegate {
if (extension != null)
extension.CursorPositionChanged ();
};
- base.TextEditorData.Document.Buffer.TextReplaced +=
delegate (object sender, ReplaceEventArgs args) {
+ base.TextEditorData.Document.TextReplaced += delegate
(object sender, ReplaceEventArgs args) {
if (extension != null)
extension.TextChanged (args.Offset,
args.Offset + Math.Max (args.Count, args.Value != null ? args.Value.Length :
0));
};
@@ -166,20 +166,20 @@
extension.KeyPress
(Gdk.Key.Return, Gdk.ModifierType.None);
} else {
base.SimulateKeyPress
(Gdk.Key.Return, Gdk.ModifierType.None);
- Buffer.Insert (Caret.Offset,
new StringBuilder ("}"));
+ Document.Insert (Caret.Offset,
new StringBuilder ("}"));
}
break;
case '[':
- Buffer.Insert (Caret.Offset, new
StringBuilder ("]"));
+ Document.Insert (Caret.Offset, new
StringBuilder ("]"));
break;
case '(':
- Buffer.Insert (Caret.Offset, new
StringBuilder (")"));
+ Document.Insert (Caret.Offset, new
StringBuilder (")"));
break;
case '\'':
- Buffer.Insert (Caret.Offset, new
StringBuilder ("'"));
+ Document.Insert (Caret.Offset, new
StringBuilder ("'"));
break;
case '"':
- Buffer.Insert (Caret.Offset, new
StringBuilder ("\""));
+ Document.Insert (Caret.Offset, new
StringBuilder ("\""));
break;
}
}
@@ -286,7 +286,7 @@
public ILanguageItem GetLanguageItem (int offset)
{
- string txt = this.Document.Buffer.Text;
+ string txt = this.Document.Text;
string fileName = view.ContentName;
if (fileName == null)
fileName = view.UntitledName;
@@ -303,7 +303,7 @@
if (expression == null)
return null;
- int lineNumber =
this.Document.Splitter.OffsetToLineNumber (offset);
+ int lineNumber = this.Document.OffsetToLineNumber
(offset);
LineSegment line = this.Document.GetLine (lineNumber);
return ctx.ResolveIdentifier (expression, lineNumber +
1, line.Offset + 1, fileName, txt);
@@ -361,7 +361,7 @@
#region Templates
int FindPrevWordStart (int offset)
{
- while (--offset >= 0 && !Char.IsWhiteSpace
(Buffer.GetCharAt (offset)))
+ while (--offset >= 0 && !Char.IsWhiteSpace
(Document.GetCharAt (offset)))
;
return ++offset;
}
@@ -370,14 +370,14 @@
{
int offset = this.Caret.Offset;
int start = FindPrevWordStart (offset);
- return Buffer.GetTextAt (start, offset - start);
+ return Document.GetTextAt (start, offset - start);
}
public int DeleteWordBeforeCaret ()
{
int offset = this.Caret.Offset;
int start = FindPrevWordStart (offset);
- Buffer.Remove (start, offset - start);
+ Document.Remove (start, offset - start);
return start;
}
@@ -385,9 +385,9 @@
{
LineSegment line = Document.GetLine (lineNr);
int index = 0;
- while (index < line.EditableLength && Char.IsWhiteSpace
(Buffer.GetCharAt (line.Offset + index)))
+ while (index < line.EditableLength && Char.IsWhiteSpace
(Document.GetCharAt (line.Offset + index)))
index++;
- return index > 0 ? Buffer.GetTextAt (line.Offset,
index) : "";
+ return index > 0 ? Document.GetTextAt (line.Offset,
index) : "";
}
public bool IsTemplateKnown ()
@@ -456,7 +456,7 @@
// if (endLine > beginLine) {
// IndentLines (beginLine+1, endLine,
leadingWhiteSpace);
// }
- Buffer.Insert (offset, builder);
+ Document.Insert (offset, builder);
Caret.Offset = finalCaretOffset;
}
#endregion
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -61,11 +61,11 @@
expressionFinder = ctx.GetExpressionFinder
(document.FileName);
if (expressionFinder == null)
return null;
- string txt = document.Buffer.Text;
+ string txt = document.Text;
expression = expressionFinder.FindFullExpression (txt,
offset).Expression;
if (expression == null)
return null;
- int lineNumber = document.Splitter.OffsetToLineNumber
(offset);
+ int lineNumber = document.OffsetToLineNumber (offset);
LineSegment line = document.GetLine (lineNumber);
return ctx.ResolveIdentifier (expression, lineNumber +
1, line.Offset + 1, document.FileName, null);
@@ -78,8 +78,8 @@
if (chunk.Style.Color.Pixel != 0)
continue;
for (int i = chunk.Offset; i < chunk.EndOffset;
i++) {
- char charBefore = i == chunk.Offset ?
'E' : doc.Buffer.GetCharAt (i - 1);
- if (Char.IsLetter (doc.Buffer.GetCharAt
(i)) && !Char.IsLetterOrDigit (charBefore)) {
+ char charBefore = i == chunk.Offset ?
'E' : doc.GetCharAt (i - 1);
+ if (Char.IsLetter (doc.GetCharAt (i))
&& !Char.IsLetterOrDigit (charBefore)) {
} else {
continue;
}
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MarkerOperationsHandler.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MarkerOperationsHandler.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MarkerOperationsHandler.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -60,7 +60,7 @@
SourceEditorView view =
IdeApp.Workbench.ActiveDocument.GetContent <SourceEditorView>();
if (view != null) {
DocumentLocation location =
view.TextEditor.MenuPopupLocation;
- if (location == null)
+ if (location.IsEmpty)
return;
LineSegment line =
view.TextEditorData.Document.GetLine (location.Line);
if (line == null || line.Markers ==
null)
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorDisplayBinding.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorDisplayBinding.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorDisplayBinding.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -79,7 +79,7 @@
SourceEditorView result = new SourceEditorView ();
result.Document.MimeType = mimeType;
using (StreamReader reader = new StreamReader
(content)) {
- result.Document.Buffer.Text = reader.ReadToEnd
();
+ result.Document.Text = reader.ReadToEnd ();
}
return result;
}
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -81,251 +81,250 @@
SyntaxModeService.GetSyntaxMode
("text/x-csharp").RemoveSemanticRule (typeof (HighlightPropertiesRule));
}
};
+
}
+ public SourceEditorOptions ()
+ {
+ this.enableSemanticHighlighting = PropertyService.Get
("EnableSemanticHighlighting", false);
+ this.autoInsertTemplates = PropertyService.Get
("AutoInsertTemplates", false);
+ this.autoInsertMatchingBracket = PropertyService.Get
("AutoInsertMatchingBracket", false);
+ this.enableCodeCompletion = PropertyService.Get
("EnableCodeCompletion", true);
+ this.enableQuickFinder = PropertyService.Get
("EnableQuickFinder", true);
+ this.underlineErrors = PropertyService.Get
("UnderlineErrors", true);
+ this.indentStyle = PropertyService.Get
("IndentStyle", MonoDevelop.Ide.Gui.Content.IndentStyle.Smart);
+ this.editorFontType = PropertyService.Get
("EditorFontType", MonoDevelop.SourceEditor.EditorFontType.DefaultMonospace);
+
+ base.TabsToSpaces = PropertyService.Get
("TabsToSpaces", false);
+ base.IndentationSize = PropertyService.Get
("TabIndent", 4);
+ base.ShowLineNumberMargin = PropertyService.Get
("ShowLineNumberMargin", true);
+ base.ShowFoldMargin = PropertyService.Get
("ShowFoldMargin", true);
+ base.ShowInvalidLines = PropertyService.Get
("ShowInvalidLines", true);
+ base.ShowTabs = PropertyService.Get
("ShowTabs", false);
+ base.ShowEolMarkers = PropertyService.Get
("ShowEolMarkers", false);
+ base.HighlightCaretLine = PropertyService.Get
("HighlightCaretLine", false);
+ base.ShowSpaces = PropertyService.Get
("ShowSpaces", false);
+ base.EnableSyntaxHighlighting = PropertyService.Get
("EnableSyntaxHighlighting", true);
+ base.HighlightMatchingBracket = PropertyService.Get
("HighlightMatchingBracket", true);
+ base.RulerColumn = PropertyService.Get
("RulerColumn", 80);
+ base.ShowRuler = PropertyService.Get
("ShowRuler", false);
+ base.FontName = PropertyService.Get
("FontName", "Mono 10");
+ base.ColorSheme = PropertyService.Get
("ColorSheme", "Default");
+ }
+
+ #region new options
+ bool enableSemanticHighlighting;
public bool EnableSemanticHighlighting {
get {
- return PropertyService.Get
("EnableSemanticHighlighting", false);
+ return enableSemanticHighlighting;
}
set {
- if (value != TabsToSpaces) {
+ if (value != this.enableSemanticHighlighting) {
+ this.enableSemanticHighlighting = value;
PropertyService.Set
("EnableSemanticHighlighting", value);
OnChanged (EventArgs.Empty);
}
}
}
- public override bool TabsToSpaces {
+ bool autoInsertTemplates;
+ public bool AutoInsertTemplates {
get {
- return PropertyService.Get ("TabsToSpaces",
base.TabsToSpaces);
+ return autoInsertTemplates;
}
set {
- if (value != TabsToSpaces) {
- PropertyService.Set ("TabsToSpaces",
value);
+ if (value != this.autoInsertTemplates) {
+ this.autoInsertTemplates = value;
+ PropertyService.Set
("AutoInsertTemplates", value);
OnChanged (EventArgs.Empty);
}
}
}
-
- public override int IndentationSize {
+
+ bool autoInsertMatchingBracket;
+ public bool AutoInsertMatchingBracket {
get {
- return PropertyService.Get ("TabIndent",
base.IndentationSize);
+ return autoInsertMatchingBracket;
}
set {
- if (value != IndentationSize) {
- PropertyService.Set ("TabIndent",
value);
+ if (value != this.autoInsertMatchingBracket) {
+ this.autoInsertMatchingBracket = value;
+ PropertyService.Set
("AutoInsertMatchingBracket", value);
OnChanged (EventArgs.Empty);
}
}
}
-
- public override int TabSize {
+
+ bool enableCodeCompletion;
+ public bool EnableCodeCompletion {
get {
- return IndentationSize;
+ return enableCodeCompletion;
}
set {
- IndentationSize = value;
- }
- }
-
-// public override bool ShowIconMargin {
-// get {
-// return showIconMargin;
-// }
-// set {
-// showIconMargin = value;
-// }
-// }
-
- public override bool ShowLineNumberMargin {
- get {
- return PropertyService.Get
("ShowLineNumberMargin", base.ShowLineNumberMargin);
- }
- set {
- if (value != ShowLineNumberMargin) {
- PropertyService.Set
("ShowLineNumberMargin", value);
+ if (value != this.enableCodeCompletion) {
+ this.enableCodeCompletion = value;
+ PropertyService.Set
("EnableCodeCompletion", value);
OnChanged (EventArgs.Empty);
}
}
}
-
- public override bool ShowFoldMargin {
+
+ bool enableQuickFinder;
+ public bool EnableQuickFinder {
get {
- return PropertyService.Get ("ShowFoldMargin",
base.ShowFoldMargin);
+ return enableQuickFinder;
}
set {
- if (value != ShowFoldMargin) {
- PropertyService.Set ("ShowFoldMargin",
value);
+ if (value != this.enableQuickFinder) {
+ this.enableQuickFinder = value;
+ PropertyService.Set
("EnableQuickFinder", value);
OnChanged (EventArgs.Empty);
}
}
}
-
- public override bool ShowInvalidLines {
+
+ bool underlineErrors;
+ public bool UnderlineErrors {
get {
- return PropertyService.Get ("ShowInvalidLines",
base.ShowInvalidLines);
+ return underlineErrors;
}
set {
- if (value != ShowInvalidLines) {
- PropertyService.Set
("ShowInvalidLines", value);
+ if (value != this.underlineErrors) {
+ this.underlineErrors = value;
+ PropertyService.Set ("UnderlineErrors",
value);
OnChanged (EventArgs.Empty);
}
}
}
-
- public override bool ShowTabs {
+
+ IndentStyle indentStyle;
+ public IndentStyle IndentStyle {
get {
- return PropertyService.Get ("ShowTabs",
base.ShowTabs);
+ return indentStyle;
}
set {
- if (value != ShowTabs) {
- PropertyService.Set ("ShowTabs", value);
+ if (value != this.indentStyle) {
+ this.indentStyle = value;
+ PropertyService.Set ("IndentStyle",
value);
OnChanged (EventArgs.Empty);
}
}
}
-
- public override bool ShowEolMarkers {
+
+ EditorFontType editorFontType;
+ public EditorFontType EditorFontType {
get {
- return PropertyService.Get ("ShowEolMarkers",
base.ShowEolMarkers);
+ return editorFontType;
}
set {
- if (value != ShowEolMarkers) {
- PropertyService.Set ("ShowEolMarkers",
value);
+ if (value != this.editorFontType) {
+ this.editorFontType = value;
+ PropertyService.Set ("EditorFontType",
value);
OnChanged (EventArgs.Empty);
}
}
}
-
- public override bool HighlightCaretLine {
- get {
- return PropertyService.Get
("HighlightCaretLine", base.HighlightCaretLine);
- }
+
+ #endregion
+
+ #region old options
+ public override bool TabsToSpaces {
set {
- if (value != HighlightCaretLine) {
- PropertyService.Set
("HighlightCaretLine", value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set ("TabsToSpaces", value);
+ base.TabsToSpaces = value;
}
}
-
- public override bool ShowSpaces {
- get {
- return PropertyService.Get ("ShowSpaces",
base.ShowSpaces);
- }
+
+ public override int IndentationSize {
set {
- if (value != ShowSpaces) {
- PropertyService.Set ("ShowSpaces",
value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set ("TabIndent", value);
+ base.IndentationSize = value;
}
}
- public override bool EnableSyntaxHighlighting {
+ public override int TabSize {
get {
- return PropertyService.Get
("EnableSyntaxHighlighting", true);
+ return IndentationSize;
}
set {
- if (value != EnableSyntaxHighlighting) {
- PropertyService.Set
("EnableSyntaxHighlighting", value);
- OnChanged (EventArgs.Empty);
- }
+ IndentationSize = value;
}
}
- public bool AutoInsertTemplates {
- get {
- return PropertyService.Get
("AutoInsertTemplates", false);
- }
+ public override bool ShowLineNumberMargin {
set {
- if (value != AutoInsertTemplates) {
- PropertyService.Set
("AutoInsertTemplates", value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set ("ShowLineNumberMargin",
value);
+ base.ShowLineNumberMargin = value;
}
}
- public bool AutoInsertMatchingBracket {
- get {
- return PropertyService.Get
("AutoInsertMatchingBracket", false);
- }
+ public override bool ShowFoldMargin {
set {
- if (value != AutoInsertMatchingBracket) {
- PropertyService.Set
("AutoInsertMatchingBracket", value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set ("ShowFoldMargin", value);
+ base.ShowFoldMargin = value;
}
}
- public bool EnableCodeCompletion {
- get {
- return PropertyService.Get
("EnableCodeCompletion", true);
+ public override bool ShowInvalidLines {
+ set {
+ PropertyService.Set ("ShowInvalidLines", value);
+ base.ShowInvalidLines = value;
}
+ }
+
+ public override bool ShowTabs {
set {
- if (value != EnableCodeCompletion) {
- PropertyService.Set
("EnableCodeCompletion", value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set ("ShowTabs", value);
+ base.ShowTabs = value;
}
}
- public bool EnableQuickFinder {
- get {
- return PropertyService.Get
("EnableQuickFinder", true);
+ public override bool ShowEolMarkers {
+ set {
+ PropertyService.Set ("ShowEolMarkers", value);
+ base.ShowEolMarkers = value;
}
+ }
+
+ public override bool HighlightCaretLine {
set {
- if (value != EnableQuickFinder) {
- PropertyService.Set
("EnableQuickFinder", value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set ("HighlightCaretLine",
value);
+ base.HighlightCaretLine = value;
}
}
- public bool UnderlineErrors {
- get {
- return PropertyService.Get ("UnderlineErrors",
true);
+ public override bool ShowSpaces {
+ set {
+ PropertyService.Set ("ShowSpaces", value);
+ base.ShowSpaces = value;
}
+ }
+
+ public override bool EnableSyntaxHighlighting {
set {
- if (value != UnderlineErrors) {
- PropertyService.Set ("UnderlineErrors",
value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set
("EnableSyntaxHighlighting", value);
+ base.EnableSyntaxHighlighting = value;
}
}
public override bool HighlightMatchingBracket {
- get {
- return PropertyService.Get
("HighlightMatchingBracket", true);
- }
set {
- if (value != HighlightMatchingBracket) {
- PropertyService.Set
("HighlightMatchingBracket", value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set
("HighlightMatchingBracket", value);
+ base.HighlightMatchingBracket = value;
}
}
public override int RulerColumn {
- get {
- return PropertyService.Get ("RulerColumn",
base.RulerColumn);
- }
set {
- if (value != RulerColumn) {
- PropertyService.Set ("RulerColumn",
value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set ("RulerColumn", value);
+ base.RulerColumn = value;
}
}
-
+
public override bool ShowRuler {
- get {
- return PropertyService.Get ("ShowRuler",
base.ShowRuler);
- }
set {
- if (value != ShowRuler) {
- PropertyService.Set ("ShowRuler",
value);
- OnChanged (EventArgs.Empty);
- }
+ PropertyService.Set ("ShowRuler", value);
+ base.ShowRuler = value;
}
}
@@ -338,51 +337,19 @@
}
}
- public IndentStyle IndentStyle {
- get {
- return PropertyService.Get ("IndentStyle",
MonoDevelop.Ide.Gui.Content.IndentStyle.Smart);
- }
- set {
- if (value != IndentStyle) {
- PropertyService.Set ("IndentStyle",
value);
- OnChanged (EventArgs.Empty);
- }
- }
- }
-
- public EditorFontType EditorFontType {
- get {
- return PropertyService.Get ("EditorFontType",
MonoDevelop.SourceEditor.EditorFontType.DefaultMonospace);
- }
- set {
- if (value != EditorFontType) {
- PropertyService.Set ("EditorFontType",
value);
- OnChanged (EventArgs.Empty);
- }
- }
- }
-
public override string FontName {
- get {
- return PropertyService.Get ("FontName", "Mono
10");
- }
set {
- if (value != FontName) {
- PropertyService.Set ("FontName",
!String.IsNullOrEmpty (value) ? value : "Mono 10");
- OnChanged (EventArgs.Empty);
- }
+ string newName = !String.IsNullOrEmpty (value)
? value : "Mono 10";
+ PropertyService.Set ("FontName", newName);
+ base.FontName = newName;
}
}
public override string ColorSheme {
- get {
- return PropertyService.Get ("ColorSheme",
"Default");
- }
set {
- if (value != ColorSheme) {
- PropertyService.Set ("ColorSheme",
!String.IsNullOrEmpty (value) ? value : "Default");
- OnChanged (EventArgs.Empty);
- }
+ string newColorSheme = !String.IsNullOrEmpty
(value) ? value : "Default";
+ PropertyService.Set ("ColorSheme",
newColorSheme);
+ base.ColorSheme = newColorSheme;
}
}
@@ -403,5 +370,6 @@
}
}
}
+ #endregion
}
}
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -75,14 +75,14 @@
public SourceEditorView()
{
widget = new SourceEditorWidget (this);
- widget.TextEditor.Buffer.TextReplaced += delegate
(object sender, ReplaceEventArgs args) {
+ widget.TextEditor.Document.TextReplaced += delegate
(object sender, ReplaceEventArgs args) {
int startIndex = args.Offset;
int endIndex = startIndex + Math.Max
(args.Count, args.Value != null ? args.Value.Length : 0);
if (TextChanged != null)
TextChanged (this, new
TextChangedEventArgs (startIndex, endIndex));
};
- widget.TextEditor.Buffer.TextReplaced += delegate {
+ widget.TextEditor.Document.TextReplaced += delegate {
this.IsDirty = true;
};
@@ -279,12 +279,11 @@
public string SelectedText {
get {
- return
this.widget.TextEditor.TextEditorData.IsSomethingSelected ?
this.widget.TextEditor.Document.Buffer.GetTextAt
(this.widget.TextEditor.TextEditorData.SelectionRange) : "";
+ return
this.widget.TextEditor.TextEditorData.IsSomethingSelected ?
this.widget.TextEditor.Document.GetTextAt
(this.widget.TextEditor.TextEditorData.SelectionRange) : "";
}
set {
this.widget.TextEditor.TextEditorData.DeleteSelectedText ();
- this.widget.TextEditor.Document.Buffer.Insert
(this.widget.TextEditor.Caret.Offset,
-
new StringBuilder (value));
+ this.widget.TextEditor.Document.Insert
(this.widget.TextEditor.Caret.Offset, new StringBuilder (value));
this.widget.TextEditor.TextEditorData.SelectionRange = new Segment
(this.widget.TextEditor.Caret.Offset, value.Length);
this.widget.TextEditor.Caret.Offset +=
value.Length;
}
@@ -339,15 +338,16 @@
public string Text {
get {
- return this.widget.TextEditor.Buffer.Text;
+ return this.widget.TextEditor.Document.Text;
}
set {
- this.widget.TextEditor.Buffer.Text = value;
+ this.widget.TextEditor.Document.Text = value;
}
}
+
public int Length {
get {
- return this.widget.TextEditor.Buffer.Length;
+ return this.widget.TextEditor.Document.Length;
}
}
@@ -364,12 +364,12 @@
{
if (startPosition < 0 || endPosition < 0
|| startPosition > endPosition)
return "";
- return this.widget.TextEditor.Buffer.GetTextAt
(startPosition, endPosition - startPosition);
+ return this.widget.TextEditor.Document.GetTextAt
(startPosition, endPosition - startPosition);
}
public char GetCharAt (int position)
{
- return this.widget.TextEditor.Buffer.GetCharAt
(position);
+ return this.widget.TextEditor.Document.GetCharAt
(position);
}
public int GetPositionFromLineColumn (int line, int column)
@@ -387,13 +387,13 @@
#region IEditableTextFile
public void InsertText (int position, string text)
{
- this.widget.TextEditor.Document.Buffer.Insert
(position, new StringBuilder (text));
+ this.widget.TextEditor.Document.Insert (position, new
StringBuilder (text));
if (text != null && this.widget.TextEditor.Caret.Offset
>= position)
this.widget.TextEditor.Caret.Offset +=
text.Length;
}
public void DeleteText (int position, int length)
{
- this.widget.TextEditor.Document.Buffer.Remove
(position, length);
+ this.widget.TextEditor.Document.Remove (position,
length);
if (this.widget.TextEditor.Caret.Offset >= position)
this.widget.TextEditor.Caret.Offset -= length;
}
@@ -425,7 +425,7 @@
{
LineSegment line = GetLine (position);
if (line != null && line.IsBookmarked != mark) {
- int lineNumber =
widget.TextEditor.Document.Splitter.GetLineNumberForOffset (line.Offset);
+ int lineNumber =
widget.TextEditor.Document.OffsetToLineNumber (line.Offset);
line.IsBookmarked = mark;
widget.TextEditor.Document.RequestUpdate (new
LineUpdate (lineNumber));
widget.TextEditor.Document.CommitDocumentUpdate
();
@@ -506,7 +506,7 @@
#region ICompletionWidget
public int TextLength {
get {
- return
this.widget.TextEditor.Document.Buffer.Length;
+ return this.widget.TextEditor.Document.Length;
}
}
public int SelectedLength {
@@ -520,7 +520,7 @@
// }
public char GetChar (int offset)
{
- return this.widget.TextEditor.Document.Buffer.GetCharAt
(offset);
+ return this.widget.TextEditor.Document.GetCharAt
(offset);
}
public Gtk.Style GtkStyle {
@@ -554,7 +554,7 @@
return null;
int min = Math.Min (ctx.TriggerOffset,
this.widget.TextEditor.Caret.Offset);
int max = Math.Max (ctx.TriggerOffset,
this.widget.TextEditor.Caret.Offset);
- return widget.TextEditor.Buffer.GetTextAt (min, max -
min);
+ return widget.TextEditor.Document.GetTextAt (min, max -
min);
}
public void SetCompletionText (ICodeCompletionContext ctx,
string partial_word, string complete_word)
@@ -568,7 +568,7 @@
idx = complete_word.Length;
}
- this.widget.TextEditor.Buffer.Replace
(ctx.TriggerOffset, String.IsNullOrEmpty (partial_word) ? 0 :
partial_word.Length, new StringBuilder (complete_word));
+ this.widget.TextEditor.Document.Replace
(ctx.TriggerOffset, String.IsNullOrEmpty (partial_word) ? 0 :
partial_word.Length, new StringBuilder (complete_word));
this.widget.TextEditor.Caret.Offset = ctx.TriggerOffset
+ idx;
}
@@ -595,10 +595,10 @@
public string GetLineTextAtOffset (int offset)
{
- LineSegment line =
this.widget.TextEditor.Document.Splitter.GetByOffset (offset);
+ LineSegment line =
this.widget.TextEditor.Document.GetLineByOffset (offset);
if (line == null)
return null;
- return this.widget.TextEditor.Document.Buffer.GetTextAt
(line);
+ return this.widget.TextEditor.Document.GetTextAt (line);
}
class DocumentTextIterator : ITextIterator
@@ -614,7 +614,7 @@
public char Current {
get {
- return view.Document.Buffer.GetCharAt
(offset);
+ return view.Document.GetCharAt (offset);
}
}
public int Position {
@@ -627,14 +627,16 @@
}
public int Line {
get {
- return
view.Document.Splitter.GetLineNumberForOffset (offset);
+ return view.Document.OffsetToLineNumber
(offset);
}
- }
+ }
+
public int Column {
get {
- return offset -
view.Document.Splitter.GetByOffset (offset).Offset;
+ return view.Document.OffsetToLocation
(offset).Column;
}
- }
+ }
+
public int DocumentOffset {
get {
return offset;
@@ -643,22 +645,22 @@
public char GetCharRelative (int offset)
{
- return view.Document.Buffer.GetCharAt
(this.offset + offset);
+ return view.Document.GetCharAt (this.offset +
offset);
}
public bool MoveAhead (int numChars)
{
- bool result = offset + numChars <
view.Document.Buffer.Length && offset + numChars >= 0;
- offset = Math.Max (Math.Min (offset + numChars,
view.Document.Buffer.Length - 1), 0);
+ bool result = offset + numChars <
view.Document.Length && offset + numChars >= 0;
+ offset = Math.Max (Math.Min (offset + numChars,
view.Document.Length - 1), 0);
return result;
}
public void MoveToEnd ()
{
- offset = view.Document.Buffer.Length - 1;
+ offset = view.Document.Length - 1;
}
public string ReadToEnd ()
{
- return view.Document.Buffer.GetTextAt (offset,
view.Document.Buffer.Length - offset);
+ return view.Document.GetTextAt (offset,
view.Document.Length - offset);
}
public void Reset()
@@ -667,7 +669,7 @@
}
public void Replace (int length, string pattern)
{
- view.Document.Buffer.Replace (offset, length,
new StringBuilder (pattern));
+ view.Document.Replace (offset, length, new
StringBuilder (pattern));
}
public void Close ()
{
@@ -697,7 +699,7 @@
bool comment = false;
string commentTag =
Services.Languages.GetBindingPerFileName (this.ContentName).CommentTag ?? "//";
foreach (LineSegment line in
this.TextEditorData.SelectedLines) {
- string text = Document.Buffer.GetTextAt (line);
+ string text = Document.GetTextAt (line);
string trimmedText = text.TrimStart ();
if (!trimmedText.StartsWith (commentTag)) {
comment = true;
@@ -713,15 +715,15 @@
public void CommentCode ()
{
- int startLineNr =
this.TextEditorData.IsSomethingSelected ?
this.TextEditorData.Document.Splitter.GetLineNumberForOffset
(this.TextEditorData.SelectionRange.Offset) : this.TextEditorData.Caret.Line;
- int endLineNr =
this.TextEditorData.IsSomethingSelected ?
this.TextEditorData.Document.Splitter.GetLineNumberForOffset
(this.TextEditorData.SelectionRange.EndOffset) : this.TextEditorData.Caret.Line;
+ int startLineNr =
this.TextEditorData.IsSomethingSelected ?
this.TextEditorData.Document.OffsetToLineNumber
(this.TextEditorData.SelectionRange.Offset) : this.TextEditorData.Caret.Line;
+ int endLineNr =
this.TextEditorData.IsSomethingSelected ?
this.TextEditorData.Document.OffsetToLineNumber
(this.TextEditorData.SelectionRange.EndOffset) : this.TextEditorData.Caret.Line;
if (endLineNr < 0)
- endLineNr =
this.TextEditorData.Document.Splitter.LineCount;
+ endLineNr =
this.TextEditorData.Document.LineCount;
StringBuilder commentTag = new
StringBuilder(Services.Languages.GetBindingPerFileName
(this.ContentName).CommentTag ?? "//");
Document.BeginAtomicUndo ();
foreach (LineSegment line in
this.TextEditorData.SelectedLines) {
- this.Document.Buffer.Insert (line.Offset,
commentTag);
+ this.Document.Insert (line.Offset, commentTag);
}
if (this.TextEditorData.IsSomethingSelected)
this.TextEditorData.SelectionStart.Column +=
commentTag.Length;
@@ -739,20 +741,20 @@
public void UncommentCode ()
{
- int startLineNr =
this.TextEditorData.IsSomethingSelected ?
this.TextEditorData.Document.Splitter.GetLineNumberForOffset
(this.TextEditorData.SelectionRange.Offset) : this.TextEditorData.Caret.Line;
- int endLineNr =
this.TextEditorData.IsSomethingSelected ?
this.TextEditorData.Document.Splitter.GetLineNumberForOffset
(this.TextEditorData.SelectionRange.EndOffset) : this.TextEditorData.Caret.Line;
+ int startLineNr =
this.TextEditorData.IsSomethingSelected ?
this.TextEditorData.Document.OffsetToLineNumber
(this.TextEditorData.SelectionRange.Offset) : this.TextEditorData.Caret.Line;
+ int endLineNr =
this.TextEditorData.IsSomethingSelected ?
this.TextEditorData.Document.OffsetToLineNumber
(this.TextEditorData.SelectionRange.EndOffset) : this.TextEditorData.Caret.Line;
if (endLineNr < 0)
- endLineNr =
this.TextEditorData.Document.Splitter.LineCount;
+ endLineNr =
this.TextEditorData.Document.LineCount;
string commentTag =
Services.Languages.GetBindingPerFileName (this.ContentName).CommentTag ?? "//";
Document.BeginAtomicUndo ();
int first = -1;
int last = 0;
foreach (LineSegment line in
this.TextEditorData.SelectedLines) {
- string text = Document.Buffer.GetTextAt (line);
+ string text = Document.GetTextAt (line);
string trimmedText = text.TrimStart ();
int length = 0;
if (trimmedText.StartsWith (commentTag)) {
- this.Document.Buffer.Remove
(line.Offset + (text.Length - trimmedText.Length), commentTag.Length);
+ this.Document.Remove (line.Offset +
(text.Length - trimmedText.Length), commentTag.Length);
length = commentTag.Length;
}
last = length;
@@ -951,7 +953,7 @@
config.GetPageSize (out pageWidth, out pageHeight);
int linesPerPage = (int)((pageHeight - marginBottom -
marginTop - 10) / widget.TextEditor.LineHeight);
linesPerPage -= 2;
- totalPages = Document.Splitter.LineCount / linesPerPage;
+ totalPages = Document.LineCount / linesPerPage;
xPos = marginLeft;
string fontName = SourceEditorOptions.Options.FontName;
Gnome.Font font = Gnome.Font.FindClosestFromFullName
(fontName);
@@ -969,7 +971,7 @@
gpc.BeginPage ("page " + page++);
PrintHeader (gpc, config);
- foreach (LineSegment line in Document.Splitter.Lines) {
+ foreach (LineSegment line in Document.Lines) {
if (yPos >= pageHeight - marginBottom - 5 -
widget.TextEditor.LineHeight) {
gpc.SetFont (font);
yPos = marginTop;
@@ -980,7 +982,7 @@
}
Chunk[] chunks = Document.SyntaxMode.GetChunks
(Document, TextEditorData.ColorStyle, line, line.Offset, line.Length);
foreach (Chunk chunk in chunks) {
- string text = Document.Buffer.GetTextAt
(chunk);
+ string text = Document.GetTextAt
(chunk);
text = text.Replace ("\t", new string
(' ', TextEditorOptions.Options.TabSize));
gpc.SetRgbColor (chunk.Style.Color.Red
/ (double)ushort.MaxValue,
chunk.Style.Color.Green / (double)ushort.MaxValue,
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -170,7 +170,7 @@
FoldSegment AddMarker (List<FoldSegment> foldSegments, string
text, IRegion region, FoldingType type)
{
- if (region == null || region.BeginLine <= 0 ||
region.EndLine <= 0 || region.BeginLine >=
this.TextEditor.Document.Splitter.LineCount || region.EndLine >=
this.TextEditor.Document.Splitter.LineCount)
+ if (region == null || region.BeginLine <= 0 ||
region.EndLine <= 0 || region.BeginLine >= this.TextEditor.Document.LineCount
|| region.EndLine >= this.TextEditor.Document.LineCount)
return null;
int startOffset =
this.TextEditor.Document.LocationToOffset (region.BeginLine - 1,
region.BeginColumn - 1);
int endOffset =
this.TextEditor.Document.LocationToOffset (region.EndLine - 1,
region.EndColumn - 1);
@@ -455,9 +455,9 @@
void UpdateLineCol ()
{
int offset = this.TextEditor.Caret.Offset;
- if (offset < 0 || offset >=
this.TextEditor.Document.Buffer.Length)
+ if (offset < 0 || offset >=
this.TextEditor.Document.Length)
return;
- char ch = this.TextEditor.Document.Buffer.GetCharAt
(offset);
+ char ch = this.TextEditor.Document.GetCharAt (offset);
DocumentLocation location =
this.TextEditor.Document.LogicalToVisualLocation
(this.TextEditor.Caret.Location);
IdeApp.Workbench.StatusBar.SetCaretPosition
(location.Line, location.Column, ch);
}
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs
2008-02-15 18:54:07 UTC (rev 95787)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs
2008-02-15 18:55:20 UTC (rev 95788)
@@ -96,6 +96,7 @@
this.radiobutton1 = new
Gtk.RadioButton(Mono.Unix.Catalog.GetString("_Default monospace"));
this.radiobutton1.CanFocus = true;
this.radiobutton1.Name = "radiobutton1";
+ this.radiobutton1.Active = true;
this.radiobutton1.DrawIndicator = true;
this.radiobutton1.UseUnderline = true;
this.radiobutton1.Group = new GLib.SList(System.IntPtr.Zero);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches