diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/Resources.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/Resources.cs index cb74ab88547..f439a2e7194 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/Resources.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/Resources.cs @@ -49,8 +49,9 @@ internal static void RegisterBuiltInHighlightings(HighlightingManager.DefaultHig hlm.RegisterHighlighting("Java", new[] { ".java" }, "Java-Mode.xshd"); hlm.RegisterHighlighting("Patch", new[] { ".patch", ".diff" }, "Patch-Mode.xshd"); hlm.RegisterHighlighting("PowerShell", new[] { ".ps1", ".psm1", ".psd1" }, "PowerShell.xshd"); - hlm.RegisterHighlighting("PHP", new[] { ".php" }, "PHP-Mode.xshd"); - hlm.RegisterHighlighting("TeX", new[] { ".tex" }, "Tex-Mode.xshd"); + hlm.RegisterHighlighting("PHP", new[] { ".php" }, "PHP-Mode.xshd"); + hlm.RegisterHighlighting("SQL", new[] { ".sql" }, "SQL.xshd"); + hlm.RegisterHighlighting("TeX", new[] { ".tex" }, "Tex-Mode.xshd"); hlm.RegisterHighlighting("VB", new[] { ".vb" }, "VB-Mode.xshd"); hlm.RegisterHighlighting("XML", (".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;" + ".xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;" + diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/SQL.xshd b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/SQL.xshd new file mode 100644 index 00000000000..a8930e7bdc3 --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/SQL.xshd @@ -0,0 +1,220 @@ + + + + + + + + + ' + ' + + + + + " + " + + + + + /\* + \*/ + + + + ABORT + BETWEEN + CRASH + DIGITS + ACCEPT + BINARY_INTEGER + CREATE + DISPOSE + ACCESS + BODY + CURRENT + DISTINCT + ADD + BOOLEAN + CURRVAL + DO + ALL + BY + CURSOR + DROP + ALTER + CASE + DATABASE + ELSE + AND + CHAR + DATA_BASE + ELSIF + ANY + CHAR_BASE + DATE + END + ARRAY + CHECK + DBA + ENTRY + ARRAYLEN + CLOSE + DEBUGOFF + EXCEPTION + AS + CLUSTER + DEBUGON + EXCEPTION_INIT + ASC + CLUSTERS + DECLARE + EXISTS + ASSERT + COLAUTH + DECIMAL + EXIT + ASSIGN + COLUMNS + DEFAULT + FALSE + AT + COMMIT + DEFINITION + FETCH + AUTHORIZATION + COMPRESS + DELAY + FLOAT + AVG + CONNECT + DELETE + FOR + BASE_TABLE + CONSTANT + DELTA + FORM + BEGIN + COUNT + DESC + FROM + FUNCTION + NEW + RELEASE + SUM + GENERIC + NEXTVAL + REMR + TABAUTH + GOTO + NOCOMPRESS + RENAME + TABLE + GRANT + NOT + RESOURCE + TABLES + GROUP + NULL + RETURN + TASK + HAVING + NUMBER + REVERSE + TERMINATE + IDENTIFIED + NUMBER_BASE + REVOKE + THEN + IF + OF + ROLLBACK + TO + IN + ON + ROWID + TRUE + INDEX + OPEN + ROWLABEL + TYPE + INDEXES + OPTION + ROWNUM + UNION + INDICATOR + OR + ROWTYPE + UNIQUE + INSERT + ORDER + RUN + UPDATE + INTEGER + OTHERS + SAVEPOINT + USE + INTERSECT + OUT + SCHEMA + VALUES + INTO + PACKAGE + SELECT + VARCHAR + IS + PARTITION + SEPARATE + VARCHAR2 + LEVEL + PCTFREE + SET + VARIANCE + LIKE + POSITIVE + SIZE + VIEW + LIMITED + PRAGMA + SMALLINT + VIEWS + LOOP + PRIOR + SPACE + WHEN + MAX + PRIVATE + SQL + WHERE + MIN + PROCEDURE + SQLCODE + WHILE + MINUS + PUBLIC + SQLERRM + WITH + MLSLABEL + RAISE + START + WORK + MOD + RANGE + STATEMENT + XOR + MODE + REAL + STDDEV + NATURAL + RECORD + SUBTYPE + + + [?,.;()\[\]{}+\-/%*<>^+~!|&]+ + + + + + \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj index 47582f623d4..3327932311d 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj @@ -448,4 +448,7 @@ + + + \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs index 91e183d46da..a247af69cb9 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs @@ -75,17 +75,62 @@ protected TextEditor(TextArea textArea) SetCurrentValue(OptionsProperty, textArea.Options); SetCurrentValue(DocumentProperty, new TextDocument()); + + TextChanged += TextEditor_TextChanged; } - - #if !DOTNET4 + + #region Make TextEditor MVVM-friendly + + /// + /// Occurs when the text has changed. + /// + /// + /// + void TextEditor_TextChanged(object sender, EventArgs e) + { + DocumentText = Text; + } + + /// + /// Gets or sets the DocumentText (set a Binding to this Property to support MVVM) + /// + public string DocumentText + { + get { return (string)GetValue(DocumentTextProperty); } + set { SetValue(DocumentTextProperty, value); } + } + + /// + /// The dependency propety of the Document Text. + /// + public static readonly DependencyProperty DocumentTextProperty = + DependencyProperty.Register("DocumentText", typeof(string), typeof(TextEditor), + new PropertyMetadata(new PropertyChangedCallback(OnDocumentTextChanged))); + + /// + /// Is called when the Text property has changed. + /// + /// + /// + private static void OnDocumentTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + TextEditor textEditor = d as TextEditor; + string documentText = e.NewValue as string; + if (textEditor.Text != documentText) + textEditor.Text = documentText; + } + + #endregion + +#if !DOTNET4 void SetCurrentValue(DependencyProperty property, object value) { SetValue(property, value); } - #endif - #endregion - - /// +#endif + #endregion + + /// protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer() { return new TextEditorAutomationPeer(this); diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml index da738e09b02..4893f0f4e35 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml @@ -3,14 +3,17 @@ xmlns:AvalonEdit="clr-namespace:ICSharpCode.AvalonEdit" xmlns:editing="clr-namespace:ICSharpCode.AvalonEdit.Editing" > -