public void Register(HighlightingManager manager) { manager.RegisterHighlighting( this.Name, this.Extensions, delegate { return(HighlightingLoader.Load(LoadXshd(), manager)); }); }
public void HighlightingDefinitionReturnedFromLoadHighlightingMethod() { HighlightingManager manager = new HighlightingManager(); IHighlightingDefinition highlighting = highlightingResource.LoadHighlighting("ICSharpCode.Xml.xshd", manager); Assert.AreEqual("BAT", highlighting.Name); }
private void LoadConfig(Config config) { string xshdString = config.ToXshdString(); TextReader tr = new StringReader(xshdString); XshdSyntaxDefinition syntaxDefinition; using (XmlTextReader reader = new XmlTextReader(tr)) { syntaxDefinition = HighlightingLoader.LoadXshd(reader); } HighlightingManager manager = HighlightingManager.Instance; IHighlightingDefinition def = HighlightingLoader.Load(syntaxDefinition, manager); ui_editor.SyntaxHighlighting = def; ui_editor.FontFamily = new FontFamily(Configure.TextFont); ui_editor.FontSize = Configure.TextSize; ui_editor.FontStyle = Configure.TextStyle; ui_editor.FontWeight = Configure.TextWeight; ui_editor.Foreground = new SolidColorBrush(Configure.TextColor); ui_editor.Background = new SolidColorBrush(Configure.BackGroundColor); m_caretLineRenderer.BgColor = Configure.CurrentLineColor; m_errorColor = Configure.ErrorLineColor; m_pauseColor = Configure.PauseLineColor; m_breakPointMargin.BreakPointBrush = new SolidColorBrush(Configure.BreakpointColor); m_breakPointMargin.PausingArrowBrush = new SolidColorBrush(Configure.PauseArrowColor); ui_editor.LineNumbersForeground = new SolidColorBrush(Configure.LineNumberColor); ui_editor.ShowLineNumbers = Configure.ShowLineNumber; ui_editor.Options.IndentationSize = Configure.IndentionSize; }
private void editorControl_Load(object sender, EventArgs e) { HighlightingManager hmgr = HighlightingManager.Manager; TrillekSyntaxModeProvider smp = new TrillekSyntaxModeProvider(); hmgr.AddSyntaxModeFileProvider(smp); editorControl.SetHighlighting("DCPU"); }
private void LoadedOnce(object sender, RoutedEventArgs e) { var hl = new HighlightingManager(); var def = hl.HighlightingDefinitions; aEditor.ShowLineNumbers = true; this.Loaded -= LoadedOnce; }
public void Init() { // pre-load var _ = new TextEditor(); _hlmLight = getHighlightingManager(Themes.Light, "Light"); _hlmDark = getHighlightingManager(Themes.Dark, "Dark"); }
//-------------------------------------------------------------- #region Methods //-------------------------------------------------------------- /// <inheritdoc/> protected override void OnInitialize() { // Override AvalonEdits highlighting manager. _highlightingManager = new HighlightingManager(Editor); ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.SetHighlightingManager(_highlightingManager); // Register services. Editor.Services.Register(typeof(ITextService), null, this); Editor.Services.Register(typeof(IHighlightingService), null, _highlightingManager); // Register views. Editor.Services.RegisterView(typeof(GoToLineViewModel), typeof(GoToLineView)); }
private IHighlightingDefinition LoadHighlightingDefinition() { HighlightingManager highlightingManager = HighlightingManager.Instance; if (!string.IsNullOrEmpty(CustomSyntaxHighlightingFileName)) { using var reader = new XmlTextReader(OpenStream(CustomSyntaxHighlightingFileName)); _syntaxDefinition = HighlightingLoader.LoadXshd(reader); } if (_syntaxDefinition != null) { var highlightingDefinition = HighlightingLoader.Load(_syntaxDefinition, highlightingManager); highlightingManager.RegisterHighlighting(_syntaxDefinition.Name, _syntaxDefinition.Extensions.ToArray(), highlightingDefinition); } return(highlightingManager.GetDefinition(Name)); }
private HighlightingManager getHighlightingManager(Themes theme, string dirName) { var hlm = new HighlightingManager(); var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (string.IsNullOrEmpty(assemblyPath)) { return(hlm); } var syntaxPath = Path.Combine(assemblyPath, "Syntax", dirName); if (!Directory.Exists(syntaxPath)) { return(hlm); } foreach (var file in Directory.EnumerateFiles(syntaxPath, "*.xshd")) { Debug.WriteLine(file); var ext = Path.GetFileNameWithoutExtension(file); using (Stream s = File.OpenRead(Path.GetFullPath(file))) using (var reader = new XmlTextReader(s)) { var xshd = HighlightingLoader.LoadXshd(reader); var highlightingDefinition = HighlightingLoader.Load(xshd, hlm); if (xshd.Extensions.Count > 0) { hlm.RegisterHighlighting(ext, xshd.Extensions.ToArray(), highlightingDefinition); } } } return(hlm); }
/// <inheritdoc/> protected override void OnUninitialize() { Editor.Services.UnregisterView(typeof(GoToLineViewModel)); Editor.Services.Unregister(typeof(ITextService)); Editor.Services.Unregister(typeof(IHighlightingService)); ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.SetHighlightingManager(ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance); _highlightingManager = null; }
/// <summary> /// Class constructor /// </summary> /// <param name="hlManager"></param> public HighLightingManagerAdapter(HighlightingManager hlManager) { _hlManager = hlManager; }