diff --git a/SharpDevelop.sln b/SharpDevelop.sln
index 873d53ea78..169e5f2f62 100644
--- a/SharpDevelop.sln
+++ b/SharpDevelop.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
-# SharpDevelop 4.2.0.8634-beta
+# SharpDevelop 4.2.0.8783
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
index 87cde8b6bd..e65e76b4cc 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
@@ -64,6 +64,9 @@
+
+ 3.5
+
3.0
@@ -241,7 +244,6 @@
-
\ No newline at end of file
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs
index cbe6842867..fbf2af3dc1 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs
@@ -43,6 +43,35 @@ namespace ICSharpCode.AvalonEdit.AddIn
}
}
+ #region Brushes
+ public static readonly DependencyProperty AddedLineBrushProperty =
+ DependencyProperty.Register("AddedLineBrush", typeof(Brush), typeof(ChangeMarkerMargin),
+ new FrameworkPropertyMetadata(Brushes.LightGreen));
+
+ public Brush AddedLineBrush {
+ get { return (Brush)GetValue(AddedLineBrushProperty); }
+ set { SetValue(AddedLineBrushProperty, value); }
+ }
+
+ public static readonly DependencyProperty ChangedLineBrushProperty =
+ DependencyProperty.Register("ChangedLineBrush", typeof(Brush), typeof(ChangeMarkerMargin),
+ new FrameworkPropertyMetadata(Brushes.LightBlue));
+
+ public Brush ChangedLineBrush {
+ get { return (Brush)GetValue(ChangedLineBrushProperty); }
+ set { SetValue(ChangedLineBrushProperty, value); }
+ }
+
+ public static readonly DependencyProperty UnsavedLineBrushProperty =
+ DependencyProperty.Register("UnsavedLineBrush", typeof(Brush), typeof(ChangeMarkerMargin),
+ new FrameworkPropertyMetadata(Brushes.Yellow));
+
+ public Brush UnsavedLineBrush {
+ get { return (Brush)GetValue(UnsavedLineBrushProperty); }
+ set { SetValue(UnsavedLineBrushProperty, value); }
+ }
+ #endregion
+
protected override void OnRender(DrawingContext drawingContext)
{
Size renderSize = this.RenderSize;
@@ -52,7 +81,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
var zeroLineInfo = changeWatcher.GetChange(0);
foreach (VisualLine line in textView.VisualLines) {
- Rect rect = new Rect(0, line.VisualTop - textView.ScrollOffset.Y, 5, line.Height);
+ Rect rect = new Rect(0, line.VisualTop - textView.ScrollOffset.Y - 1, 5, line.Height + 2);
LineChangeInfo info = changeWatcher.GetChange(line.FirstDocumentLine.LineNumber);
@@ -64,14 +93,14 @@ namespace ICSharpCode.AvalonEdit.AddIn
case ChangeType.None:
break;
case ChangeType.Added:
- drawingContext.DrawRectangle(Brushes.LightGreen, null, rect);
+ drawingContext.DrawRectangle(AddedLineBrush, null, rect);
break;
case ChangeType.Deleted:
case ChangeType.Modified:
- drawingContext.DrawRectangle(Brushes.LightBlue, null, rect);
+ drawingContext.DrawRectangle(ChangedLineBrush, null, rect);
break;
case ChangeType.Unsaved:
- drawingContext.DrawRectangle(Brushes.Yellow, null, rect);
+ drawingContext.DrawRectangle(UnsavedLineBrush, null, rect);
break;
default:
throw new Exception("Invalid value for ChangeType");
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizableHighlightingColorizer.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizableHighlightingColorizer.cs
index 22f99bdb23..59aa6744e6 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizableHighlightingColorizer.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizableHighlightingColorizer.cs
@@ -12,6 +12,7 @@ using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Rendering;
+using ICSharpCode.SharpDevelop.Project.Commands;
namespace ICSharpCode.AvalonEdit.AddIn
{
@@ -24,6 +25,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
public const string SelectedText = "Selected text";
public const string NonPrintableCharacters = "Non-printable characters";
public const string LineNumbers = "Line numbers";
+ public const string LinkText = "Link text";
public static void ApplyCustomizationsToDefaultElements(TextEditor textEditor, IEnumerable customizations)
{
@@ -42,6 +44,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
bool assignedSelectedText = false;
bool assignedNonPrintableCharacter = false;
bool assignedLineNumbers = false;
+ bool assignedLinkText = false;
foreach (CustomizedHighlightingColor color in customizations) {
switch (color.Name) {
case DefaultTextAndBackground:
@@ -88,6 +91,15 @@ namespace ICSharpCode.AvalonEdit.AddIn
if (color.Foreground != null)
textEditor.LineNumbersForeground = CreateFrozenBrush(color.Foreground.Value);
break;
+ case LinkText:
+ if (assignedLinkText)
+ continue;
+ assignedLinkText = true;
+ if (color.Foreground != null)
+ textEditor.TextArea.TextView.LinkTextForegroundBrush = CreateFrozenBrush(color.Foreground.Value);
+ if (color.Background != null)
+ textEditor.TextArea.TextView.LinkTextBackgroundBrush = CreateFrozenBrush(color.Background.Value);
+ break;
}
}
}
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml
index f8ab41dd0c..6820ef027d 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml
@@ -1,4 +1,11 @@
-
+
@@ -39,6 +46,10 @@
+
+
+
+
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
index e6a5fea194..14d38b2cd5 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs
@@ -5,22 +5,26 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Xml;
-
+using System.Xml.Linq;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Folding;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
using ICSharpCode.AvalonEdit.Rendering;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
using ICSharpCode.SharpDevelop.Gui;
+using Microsoft.Win32;
namespace ICSharpCode.AvalonEdit.AddIn.Options
{
@@ -130,6 +134,8 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
customizationList = CustomizedHighlightingColor.LoadColors();
+ CreateDefaultEntries(null, out defaultText, defaultEntries);
+
languageComboBox.Items.Clear();
languageComboBox.Items.Add(new XshdSyntaxDefinition { Name = "All languages" });
foreach (XshdSyntaxDefinition def in allSyntaxDefinitions)
@@ -144,7 +150,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
XshdSyntaxDefinition xshd = (XshdSyntaxDefinition)languageComboBox.SelectedItem;
if (xshd != null) {
IHighlightingItem defaultText;
- CreateDefaultEntries(languageComboBox.SelectedIndex == 0 ? null : xshd.Name, out defaultText);
+ List list = new List();
+ CreateDefaultEntries(languageComboBox.SelectedIndex == 0 ? null : xshd.Name, out defaultText, list);
+ listBox.Items.AddRange(list);
if (languageComboBox.SelectedIndex > 0) {
// Create entries for all customizable colors in the syntax highlighting definition
@@ -168,18 +176,16 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
}
- void CreateDefaultEntries(string language, out IHighlightingItem defaultText)
+ void CreateDefaultEntries(string language, out IHighlightingItem defaultText, IList items)
{
// Create entry for "default text/background"
defaultText = new SimpleHighlightingItem(CustomizableHighlightingColorizer.DefaultTextAndBackground, ta => ta.Document.Text = "Normal text") {
Foreground = SystemColors.WindowTextColor,
Background = SystemColors.WindowColor
};
- defaultText = new CustomizedHighlightingItem(customizationList, defaultText, null, canSetFont: false);
- if (language != null)
- defaultText = new CustomizedHighlightingItem(customizationList, defaultText, language, canSetFont: false);
+ defaultText = new CustomizedHighlightingItem(customizationList, defaultText, language, canSetFont: false);
defaultText.PropertyChanged += item_PropertyChanged;
- listBox.Items.Add(defaultText);
+ items.Add(defaultText);
// Create entry for "Selected text"
IHighlightingItem selectedText = new SimpleHighlightingItem(
@@ -192,11 +198,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
Foreground = SystemColors.HighlightTextColor,
Background = SystemColors.HighlightColor
};
- selectedText = new CustomizedHighlightingItem(customizationList, selectedText, null, canSetFont: false);
- if (language != null)
- selectedText = new CustomizedHighlightingItem(customizationList, selectedText, language, canSetFont: false);
+ selectedText = new CustomizedHighlightingItem(customizationList, selectedText, language, canSetFont: false);
selectedText.PropertyChanged += item_PropertyChanged;
- listBox.Items.Add(selectedText);
+ items.Add(selectedText);
// Create entry for "Non-printable characters"
IHighlightingItem nonPrintChars = new SimpleHighlightingItem(
@@ -207,11 +211,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
{
Foreground = Colors.LightGray
};
- nonPrintChars = new CustomizedHighlightingItem(customizationList, nonPrintChars, null, canSetFont: false, canSetBackground: false);
- if (language != null)
- nonPrintChars = new CustomizedHighlightingItem(customizationList, nonPrintChars, language, canSetFont: false);
+ nonPrintChars = new CustomizedHighlightingItem(customizationList, nonPrintChars, language, canSetFont: false, canSetBackground: false);
nonPrintChars.PropertyChanged += item_PropertyChanged;
- listBox.Items.Add(nonPrintChars);
+ items.Add(nonPrintChars);
// Create entry for "Line numbers"
IHighlightingItem lineNumbers = new SimpleHighlightingItem(
@@ -225,11 +227,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
{
Foreground = Colors.Gray
};
- lineNumbers = new CustomizedHighlightingItem(customizationList, lineNumbers, null, canSetFont: false, canSetBackground: false);
- if (language != null)
- lineNumbers = new CustomizedHighlightingItem(customizationList, lineNumbers, language, canSetFont: false);
+ lineNumbers = new CustomizedHighlightingItem(customizationList, lineNumbers, language, canSetFont: false, canSetBackground: false);
lineNumbers.PropertyChanged += item_PropertyChanged;
- listBox.Items.Add(lineNumbers);
+ items.Add(lineNumbers);
// Create entry for "Bracket highlight"
IHighlightingItem bracketHighlight = new SimpleHighlightingItem(
@@ -247,11 +247,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
Foreground = BracketHighlightRenderer.DefaultBorder,
Background = BracketHighlightRenderer.DefaultBackground
};
- bracketHighlight = new CustomizedHighlightingItem(customizationList, bracketHighlight, null, canSetFont: false);
- if (language != null)
- bracketHighlight = new CustomizedHighlightingItem(customizationList, bracketHighlight, language, canSetFont: false);
+ bracketHighlight = new CustomizedHighlightingItem(customizationList, bracketHighlight, language, canSetFont: false);
bracketHighlight.PropertyChanged += item_PropertyChanged;
- listBox.Items.Add(bracketHighlight);
+ items.Add(bracketHighlight);
// Create entry for "Folding controls"
IHighlightingItem foldingControls = new SimpleHighlightingItem(
@@ -266,11 +264,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
Foreground = Colors.Gray,
Background = Colors.White
};
- foldingControls = new CustomizedHighlightingItem(customizationList, foldingControls, null, canSetFont: false);
- if (language != null)
- foldingControls = new CustomizedHighlightingItem(customizationList, foldingControls, language, canSetFont: false);
+ foldingControls = new CustomizedHighlightingItem(customizationList, foldingControls, language, canSetFont: false);
foldingControls.PropertyChanged += item_PropertyChanged;
- listBox.Items.Add(foldingControls);
+ items.Add(foldingControls);
// Create entry for "Selected folding controls"
IHighlightingItem selectedFoldingControls = new SimpleHighlightingItem(
@@ -285,11 +281,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
Foreground = Colors.Black,
Background = Colors.White
};
- selectedFoldingControls = new CustomizedHighlightingItem(customizationList, selectedFoldingControls, null, canSetFont: false);
- if (language != null)
- selectedFoldingControls = new CustomizedHighlightingItem(customizationList, selectedFoldingControls, language, canSetFont: false);
+ selectedFoldingControls = new CustomizedHighlightingItem(customizationList, selectedFoldingControls, language, canSetFont: false);
selectedFoldingControls.PropertyChanged += item_PropertyChanged;
- listBox.Items.Add(selectedFoldingControls);
+ items.Add(selectedFoldingControls);
// Create entry for "Folding text markers"
IHighlightingItem foldingTextMarker = new SimpleHighlightingItem(
@@ -303,14 +297,25 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
{
Foreground = Colors.Gray
};
- foldingTextMarker = new CustomizedHighlightingItem(customizationList, foldingTextMarker, null, canSetFont: false, canSetBackground: false);
- if (language != null)
- foldingControls = new CustomizedHighlightingItem(customizationList, foldingTextMarker, language, canSetFont: false, canSetBackground: false);
+ foldingTextMarker = new CustomizedHighlightingItem(customizationList, foldingTextMarker, language, canSetFont: false, canSetBackground: false);
foldingTextMarker.PropertyChanged += item_PropertyChanged;
- listBox.Items.Add(foldingTextMarker);
+ items.Add(foldingTextMarker);
+
+ IHighlightingItem linkText = new SimpleHighlightingItem(
+ CustomizableHighlightingColorizer.LinkText,
+ ta => {
+ ta.Document.Text = "http://icsharpcode.net" + Environment.NewLine + "me@example.com";
+ })
+ {
+ Foreground = Colors.Blue,
+ Background = Colors.Transparent
+ };
+ linkText = new CustomizedHighlightingItem(customizationList, linkText, language, canSetFont: false);
+ linkText.PropertyChanged += item_PropertyChanged;
+ items.Add(linkText);
}
- void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
+ void item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
UpdatePreview();
}
@@ -358,5 +363,227 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
}
}
+
+ void ImportButtonClick(object sender, RoutedEventArgs e)
+ {
+ OpenFileDialog dialog = new OpenFileDialog {
+ Filter = @"All known settings|*.vssettings;*.sdsettings|Visual Studio settings (*.vssettings)|*.vssettings|SharpDevelop settings (*.sdsettings)|*.sdsettings",
+ CheckFileExists = true
+ };
+ if (dialog.ShowDialog() != true)
+ return;
+ switch (Path.GetExtension(dialog.FileName).ToUpperInvariant()) {
+ case ".VSSETTINGS":
+ LoadVSSettings(XDocument.Load(dialog.FileName));
+ break;
+ case ".SDSETTINGS":
+ LoadSDSettings(XDocument.Load(dialog.FileName));
+ break;
+ }
+ }
+ #region VSSettings
+ void LoadVSSettings(XDocument document)
+ {
+ XElement[] items;
+ if (!CheckVersionAndFindCategory(document, out items) || items == null) {
+ Core.MessageService.ShowError("Settings version not supported!");
+ return;
+ }
+ foreach (var item in items) {
+ string key = item.Attribute("Name").Value;
+ var entry = ParseEntry(item);
+ foreach (var sdKey in mapping[key]) {
+ IHighlightingItem color;
+ if (FindSDColor(sdKey, out color)) {
+ color.Bold = entry.Item3;
+ color.Foreground = entry.Item1;
+ color.Background = entry.Item2;
+ }
+ }
+ }
+ }
+
+ readonly List defaultEntries = new List();
+ IHighlightingItem defaultText;
+
+ bool FindSDColor(string sdKey, out IHighlightingItem item)
+ {
+ string language = null;
+ int dot = sdKey.IndexOf('.');
+ if (dot > 0) {
+ language = sdKey.Substring(0, dot);
+ sdKey = sdKey.Substring(dot + 1);
+ }
+ if ((language == null && languageComboBox.SelectedIndex == 0)
+ || (language == ((XshdSyntaxDefinition)languageComboBox.SelectedItem).Name)) {
+ item = listBox.Items.OfType().FirstOrDefault(i => i.Name == sdKey);
+ } else if (language == null) {
+ item = defaultEntries.FirstOrDefault(i => i.Name == sdKey);
+ } else {
+ var def = allSyntaxDefinitions.FirstOrDefault(d => d.Name == language);
+ var highlighting = HighlightingManager.Instance.GetDefinition(language);
+ item = null;
+ if (def != null && highlighting != null) {
+ var color = def.Elements.OfType().FirstOrDefault(i => i.Name == sdKey);
+ if (color != null) {
+ item = new NamedColorHighlightingItem(defaultText, color) { ParentDefinition = highlighting };
+ item = new CustomizedHighlightingItem(customizationList, item, language);
+ }
+ }
+ }
+ return item != null;
+ }
+
+ // VS => SD
+ static readonly MultiDictionary mapping = new MultiDictionary(StringComparer.Ordinal) {
+ { "Brace Matching (Rectangle)", "Bracket highlight" },
+ { "Collapsible Text", "" },
+ { "Comment", "" },
+ { "Comment", "C#.Comment" },
+ { "Compiler Error", "" },
+ { "CSS Comment", "" },
+ { "CSS Keyword", "" },
+ { "CSS Property Name", "" },
+ { "CSS Property Value", "" },
+ { "CSS Selector", "" },
+ { "CSS String Value", "" },
+ { "Excluded Code", "" },
+ { "HTML Attribute Value", "" },
+ { "HTML Attribute", "" },
+ { "HTML Comment", "" },
+ { "HTML Element Name", "" },
+ { "HTML Entity", "" },
+ { "HTML Operator", "" },
+ { "HTML Server-Side Script", "" },
+ { "HTML Tag Delimiter", "" },
+ { "Identifier", "" },
+ { "Inactive Selected Text", "" },
+ { "Indicator Margin", "" },
+ { "Keyword", "" },
+ { "Line Numbers", "Line numbers" },
+ { "MarkerFormatDefinition/HighlightedReference", "" },
+ { "Number", "" },
+ { "Operator", "" },
+ { "outlining.collapsehintadornment", "" },
+ { "outlining.square", "" },
+ { "outlining.verticalrule", "" },
+ { "Plain Text", "" },
+ { "Plain Text", "Default text/background" },
+ { "Preprocessor Keyword", "" },
+ { "Preprocessor Keyword", "C#.Preprocessor" },
+ { "Razor Code", "" },
+ { "Script Comment", "" },
+ { "Script Identifier", "" },
+ { "Script Keyword", "" },
+ { "Script Number", "" },
+ { "Script Operator", "" },
+ { "Script String", "" },
+ { "Selected Text", "" },
+ { "Selected Text", "Selected text" },
+ { "String", "" },
+ { "String", "C#.String" },
+ { "String(C# @ Verbatim)", "" },
+ { "Syntax Error", "" },
+ { "urlformat", "" },
+ { "User Types", "" },
+ { "User Types(Delegates)", "" },
+ { "User Types(Enums)", "" },
+ { "User Types(Interfaces)", "" },
+ { "User Types(Value types)", "" },
+ { "Warning", "" },
+ { "XAML Attribute Quotes", "" },
+ { "XAML Attribute Value", "" },
+ { "XAML Attribute", "" },
+ { "XAML CData Section", "" },
+ { "XAML Comment", "" },
+ { "XAML Delimiter", "" },
+ { "XAML Markup Extension Class", "" },
+ { "XAML Markup Extension Parameter Name", "" },
+ { "XAML Markup Extension Parameter Value", "" },
+ { "XAML Name", "" },
+ { "XAML Text", "" },
+ { "XML Attribute Quotes", "" },
+ { "XML Attribute Value", "" },
+ { "XML Attribute", "" },
+ { "XML CData Section", "" },
+ { "XML Comment", "" },
+ { "XML Delimiter", "" },
+ { "XML Doc Comment", "" },
+ { "XML Doc Tag", "" },
+ { "XML Name", "" },
+ { "XML Text", "" },
+ };
+
+ Tuple ParseEntry(XElement element)
+ {
+ Color fore = Colors.Transparent;
+ Color back = Colors.Transparent;
+ bool isBold = false;
+
+ var attribute = element.Attribute("Foreground");
+ if (attribute != null)
+ fore = ParseColor(attribute.Value);
+ attribute = element.Attribute("Background");
+ if (attribute != null)
+ back = ParseColor(attribute.Value);
+ attribute = element.Attribute("BoldFont");
+ if (attribute != null)
+ isBold = attribute.Value == "Yes";
+
+ return Tuple.Create(fore, back, isBold);
+ }
+
+ Color ParseColor(string s)
+ {
+ if (string.IsNullOrWhiteSpace(s))
+ return Colors.Transparent;
+ if (s.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
+ s = s.Substring(2);
+ if (s.Substring(0, 2) == "02")
+ return Colors.Transparent;
+ try {
+ byte b = byte.Parse(s.Substring(2, 2), NumberStyles.HexNumber);
+ byte g = byte.Parse(s.Substring(4, 2), NumberStyles.HexNumber);
+ byte r = byte.Parse(s.Substring(6, 2), NumberStyles.HexNumber);
+ return Color.FromRgb(r, g, b);
+ } catch (FormatException) {
+ return Colors.Transparent;
+ }
+ }
+
+ bool CheckVersionAndFindCategory(XDocument document, out XElement[] categoryItems)
+ {
+ categoryItems = null;
+ var node = document.Root;
+ var appID = document.Root.Element("ApplicationIdentity");
+ var category = document.Root.Descendants("Category").FirstOrDefault(e => e.Attribute("GUID") != null && e.Attribute("GUID").Value == "{A27B4E24-A735-4D1D-B8E7-9716E1E3D8E0}");
+ if (category != null)
+ categoryItems = category.Descendants("Item").ToArray();
+ if (node.Name != "UserSettings" || appID == null || category == null)
+ return false;
+ return appID.Attribute("version") != null && appID.Attribute("version").Value == "10.0";
+ }
+ #endregion
+
+ #region SDSettings
+ void LoadSDSettings(XDocument document)
+ {
+ var p = Properties.Load(document.CreateReader());
+ customizationList = p.Get("CustomizedHighlightingRules", new List());
+ LanguageComboBox_SelectionChanged(null, null);
+ }
+ #endregion
+
+ void ExportButtonClick(object sender, RoutedEventArgs e)
+ {
+ SaveFileDialog dialog = new SaveFileDialog {
+ Filter = @"SharpDevelop settings (*.sdsettings)|*.sdsettings",
+ };
+ if (dialog.ShowDialog() != true)
+ return;
+ Properties p = new Properties();
+ p.Set("CustomizedHighlightingRules", customizationList);
+ p.Save(dialog.FileName);
+ }
}
}
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingMargin.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingMargin.cs
index f5466e8f12..e9945b3ab5 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingMargin.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingMargin.cs
@@ -3,12 +3,12 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.TextFormatting;
-
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.AvalonEdit.Utils;
@@ -92,10 +92,16 @@ namespace ICSharpCode.AvalonEdit.Folding
static void OnUpdateBrushes(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
+ FoldingMargin m = null;
+ if (d is FoldingMargin)
+ m = (FoldingMargin)d;
+ else if (d is TextEditor)
+ m = ((TextEditor)d).TextArea.LeftMargins.FirstOrDefault(c => c is FoldingMargin) as FoldingMargin;
+ if (m == null) return;
if (e.Property.Name == FoldingMarkerBrushProperty.Name)
- foldingControlPen = MakeFrozenPen((Brush)e.NewValue);
+ m.foldingControlPen = MakeFrozenPen((Brush)e.NewValue);
if (e.Property.Name == SelectedFoldingMarkerBrushProperty.Name)
- selectedFoldingControlPen = MakeFrozenPen((Brush)e.NewValue);
+ m.selectedFoldingControlPen = MakeFrozenPen((Brush)e.NewValue);
}
#endregion
@@ -181,8 +187,8 @@ namespace ICSharpCode.AvalonEdit.Folding
return markers[index];
}
- static Pen foldingControlPen = MakeFrozenPen((Brush)FoldingMarkerBrushProperty.DefaultMetadata.DefaultValue);
- static Pen selectedFoldingControlPen = MakeFrozenPen((Brush)SelectedFoldingMarkerBrushProperty.DefaultMetadata.DefaultValue);
+ Pen foldingControlPen = MakeFrozenPen((Brush)FoldingMarkerBrushProperty.DefaultMetadata.DefaultValue);
+ Pen selectedFoldingControlPen = MakeFrozenPen((Brush)SelectedFoldingMarkerBrushProperty.DefaultMetadata.DefaultValue);
static Pen MakeFrozenPen(Brush brush)
{
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd
index ba860b7048..e3d6571499 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd
@@ -97,7 +97,7 @@
- @"
+ @"
"
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
index e1ec32c7f2..a92183d6c1 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
@@ -538,6 +538,36 @@ namespace ICSharpCode.AvalonEdit.Rendering
get { return (Brush)GetValue(NonPrintableCharacterBrushProperty); }
set { SetValue(NonPrintableCharacterBrushProperty, value); }
}
+
+ ///
+ /// LinkTextForegroundBrush dependency property.
+ ///
+ public static readonly DependencyProperty LinkTextForegroundBrushProperty =
+ DependencyProperty.Register("LinkTextForegroundBrush", typeof(Brush), typeof(TextView),
+ new FrameworkPropertyMetadata(Brushes.Blue));
+
+ ///
+ /// Gets/sets the Brush used for displaying link texts.
+ ///
+ public Brush LinkTextForegroundBrush {
+ get { return (Brush)GetValue(LinkTextForegroundBrushProperty); }
+ set { SetValue(LinkTextForegroundBrushProperty, value); }
+ }
+
+ ///
+ /// LinkTextBackgroundBrush dependency property.
+ ///
+ public static readonly DependencyProperty LinkTextBackgroundBrushProperty =
+ DependencyProperty.Register("LinkTextBackgroundBrush", typeof(Brush), typeof(TextView),
+ new FrameworkPropertyMetadata(Brushes.Transparent));
+
+ ///
+ /// Gets/sets the Brush used for the background of link texts.
+ ///
+ public Brush LinkTextBackgroundBrush {
+ get { return (Brush)GetValue(LinkTextBackgroundBrushProperty); }
+ set { SetValue(LinkTextBackgroundBrushProperty, value); }
+ }
#endregion
#region Redraw methods / VisualLine invalidation
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineLinkText.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineLinkText.cs
index a2c15e579f..29482dbc5b 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineLinkText.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineLinkText.cs
@@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Documents;
@@ -46,7 +47,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
///
public override TextRun CreateTextRun(int startVisualColumn, ITextRunConstructionContext context)
{
- this.TextRunProperties.SetForegroundBrush(Brushes.Blue);
+ this.TextRunProperties.SetForegroundBrush(context.TextView.LinkTextForegroundBrush);
+ this.TextRunProperties.SetBackgroundBrush(context.TextView.LinkTextBackgroundBrush);
this.TextRunProperties.SetTextDecorations(TextDecorations.Underline);
return base.CreateTextRun(startVisualColumn, context);
}
diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
index 1dac314e93..177b3d0b14 100644
--- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
+++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
@@ -818,6 +818,7 @@
+
diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml b/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml
index 848d849290..6332dc5db5 100644
--- a/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml
+++ b/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml
@@ -227,9 +227,9 @@
-
+
-
+
diff --git a/src/Main/Base/Project/Src/Util/ExtensionMethods.cs b/src/Main/Base/Project/Src/Util/ExtensionMethods.cs
index e759706bab..80699864ac 100644
--- a/src/Main/Base/Project/Src/Util/ExtensionMethods.cs
+++ b/src/Main/Base/Project/Src/Util/ExtensionMethods.cs
@@ -91,6 +91,12 @@ namespace ICSharpCode.SharpDevelop
list.Add(o);
}
+ public static void AddRange(this IList arrayList, IEnumerable elements)
+ {
+ foreach (object o in elements)
+ arrayList.Add(o);
+ }
+
public static ReadOnlyCollection AsReadOnly(this IList arr)
{
return new ReadOnlyCollection(arr);
diff --git a/src/Main/Base/Project/Src/Util/MultiDictionary.cs b/src/Main/Base/Project/Src/Util/MultiDictionary.cs
new file mode 100644
index 0000000000..1d28a177ad
--- /dev/null
+++ b/src/Main/Base/Project/Src/Util/MultiDictionary.cs
@@ -0,0 +1,117 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
+// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using ICSharpCode.NRefactory;
+using Mono.Collections.Generic;
+
+namespace ICSharpCode.SharpDevelop
+{
+ ///
+ /// A dictionary that allows multiple pairs with the same key.
+ ///
+ public class MultiDictionary : ILookup
+ {
+ Dictionary> dict;
+
+ public MultiDictionary()
+ {
+ }
+
+ public MultiDictionary(IEqualityComparer comparer)
+ {
+ dict = new Dictionary>(comparer);
+ }
+
+ public void Add(TKey key, TValue value)
+ {
+ List valueList;
+ if (!dict.TryGetValue(key, out valueList)) {
+ valueList = new List();
+ dict.Add(key, valueList);
+ }
+ valueList.Add(value);
+ }
+
+ public bool Remove(TKey key, TValue value)
+ {
+ List valueList;
+ if (dict.TryGetValue(key, out valueList)) {
+ if (valueList.Remove(value)) {
+ if (valueList.Count == 0)
+ dict.Remove(key);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void Clear()
+ {
+ dict.Clear();
+ }
+
+ public IEnumerable this[TKey key] {
+ get {
+ List list;
+ if (dict.TryGetValue(key, out list))
+ return list.AsReadOnly();
+ else
+ return new TValue[0];
+ }
+ }
+
+ public int Count {
+ get { return dict.Count; }
+ }
+
+ IEnumerable ILookup.this[TKey key] {
+ get { return this[key]; }
+ }
+
+ bool ILookup.Contains(TKey key)
+ {
+ return dict.ContainsKey(key);
+ }
+
+ public IEnumerator> GetEnumerator()
+ {
+ foreach (var pair in dict)
+ yield return new Grouping(pair.Key, pair.Value);
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ sealed class Grouping : IGrouping
+ {
+ readonly TKey key;
+ readonly List values;
+
+ public Grouping(TKey key, List values)
+ {
+ this.key = key;
+ this.values = values;
+ }
+
+ public TKey Key {
+ get { return key; }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return values.GetEnumerator();
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return values.GetEnumerator();
+ }
+ }
+ }
+}
\ No newline at end of file