//public string SoapAction { get; set; } public EditorControl() { var host = new ElementHost(); host.Size = new Size(200, 100); host.Location = new Point(100, 100); host.Dock = DockStyle.Fill; _editor = new ICSharpCode.AvalonEdit.TextEditor(); _editor.FontFamily = new System.Windows.Media.FontFamily("Consolas"); _editor.FontSize = 12.0; _editor.Options.ConvertTabsToSpaces = true; _editor.Options.EnableRectangularSelection = true; _editor.Options.IndentationSize = 2; _editor.ShowLineNumbers = true; _editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinitionByExtension(".xml"); _editor.TextArea.TextEntering += TextArea_TextEntering; _editor.TextArea.TextEntered += TextArea_TextEntered; _editor.TextArea.KeyDown += TextArea_KeyDown; host.Child = _editor; _editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy(); _foldingManager = FoldingManager.Install(_editor.TextArea); UpdateFoldings(); var foldingUpdateTimer = new DispatcherTimer(); foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2); foldingUpdateTimer.Tick += delegate { UpdateFoldings(); }; foldingUpdateTimer.Start(); this.Controls.Add(host); }
/// <summary> /// Xshdファイルを画面のAvalonEditに適用させ、ハイライトを有効にします /// </summary> /// <returns>true:成功, false:失敗</returns> private bool SetXshdFile() { Logger.Info(CLASS_NAME, "SetXshdFile", "start"); MainWindow mw = Model.Manager.WindowManager.GetMainWindow(); ICSharpCode.AvalonEdit.TextEditor target = mw.TextEditor; if (target == null) { Logger.Fatal(CLASS_NAME, "SetXshdFile", "GetTextEditor TextEditor is null"); return(false); } try { using (XmlReader reader = new XmlTextReader(_xshdFilePath)) { var definition = HighlightingLoader.Load(reader, HighlightingManager.Instance); target.SyntaxHighlighting = definition; reader.Close(); } } catch (Exception e) { Logger.Fatal(CLASS_NAME, "SetXshdFile", e.ToString()); return(false); } return(true); }
static ITextEditorOptions GetTextEditorOptions() { ICSharpCode.AvalonEdit.TextEditor editor = new ICSharpCode.AvalonEdit.TextEditor(); AvalonEditTextEditorAdapter adapter = new AvalonEditTextEditorAdapter(editor); return(adapter.Options); }
public static SourcecodeDocument OpenNew(Window owner, ICSharpCode.AvalonEdit.TextEditor handler, out bool isLST) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "All Files|*|Source- and Programmcode|*.src;*.lst|Sourcecode|*.src|Programmcode|*.lst"; ofd.FilterIndex = 2; ofd.CheckFileExists = true; ofd.CheckPathExists = true; if (ofd.ShowDialog().GetValueOrDefault(false)) { if (System.IO.Path.GetExtension(ofd.FileName).ToLower() == ".src") { isLST = false; return(OpenSRCDocument(owner, handler, ofd.FileName)); } else if (System.IO.Path.GetExtension(ofd.FileName).ToLower() == ".lst") { isLST = true; return(OpenLSTDocument(owner, handler, ofd.FileName)); } else { isLST = false; return(null); } } else { isLST = false; return(null); } }
private async Task ShowCompletionWindow(ICSharpCode.AvalonEdit.TextEditor editor) { completionWindow = new CompletionWindow(editor.TextArea); IList <ICompletionData> data = completionWindow.CompletionList.CompletionData; var position = editor.TextArea.Caret.Offset + 1; var code = editor.Document.Text + " "; if (editor == queryEdit) { position += configEdit.Document.TextLength + 1; code = configEdit.Document.Text + Environment.NewLine + code; } var completionItems = await VM.GetCompletionListAsync(position, code); foreach (var item in completionItems) { data.Add(item); } completionWindow.Show(); completionWindow.Closed += delegate { completionWindow = null; }; }
private void Form1_Load(object sender, EventArgs e) { ctrlHost = new ElementHost(); ctrlHost.Dock = DockStyle.Fill; panel1.Controls.Add(ctrlHost); wpfAvalonTextEditor = new ICSharpCode.AvalonEdit.TextEditor(); ctrlHost.Child = wpfAvalonTextEditor; wpfAvalonTextEditor.FontSize = 14; wpfAvalonTextEditor.IsReadOnly = true; wpfAvalonTextEditor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("C#"); // load c# code sample string filePath = System.IO.Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory) + "\\SampleFilesCSharp\\"; System.IO.StreamReader streamReader = new System.IO.StreamReader(filePath + "ActiveWorkbookSample.txt"); TextDocument doc = new TextDocument(); doc.Text = streamReader.ReadToEnd(); wpfAvalonTextEditor.Document = doc; // Support folding (collapse and expand) for C# code blocks var foldingStrategy = new ICSharpCode.AvalonEdit.Sample.BraceFoldingStrategy(); ICSharpCode.AvalonEdit.Folding.FoldingManager foldingManager; foldingManager = ICSharpCode.AvalonEdit.Folding.FoldingManager.Install(wpfAvalonTextEditor.TextArea); ((ICSharpCode.AvalonEdit.Sample.BraceFoldingStrategy)foldingStrategy).UpdateFoldings(foldingManager, wpfAvalonTextEditor.Document); }
private static SourcecodeDocument OpenLSTDocument(Window owner, ICSharpCode.AvalonEdit.TextEditor handler, string FileName) { try { string s = PICProgramLoader.LoadSourceCodeFromText(FileName); if (s == null) { return(null); } string FileNameSrc = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(FileName), System.IO.Path.GetFileNameWithoutExtension(FileName) + ".src"); if (File.Exists(FileNameSrc)) { if (MessageBox.Show("File \r\n" + FileNameSrc + "\r\nalready exists. Override ?", "Overwrite?", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { return(null); } } File.WriteAllText(FileNameSrc, s, Encoding.Default); return(new SourcecodeDocument(owner, handler, s, FileNameSrc)); } catch (IOException) { MessageBox.Show("Error: Could not load File."); return(null); } }
/// <summary> /// Divide la pantalla con dos cuadros de edición /// </summary> private void SplitDocument(bool split, bool isVertical) { // Muestra / oculta el cuadro de texto secundario if (split) { // Cambia la visibilidad txtEditorSecondary.Visibility = Visibility.Visible; // Coloca los editores if (isVertical) { // El editor principal está en la fila superior Grid.SetRow(txtEditor, 0); Grid.SetColumn(txtEditor, 0); Grid.SetRowSpan(txtEditor, 1); Grid.SetColumnSpan(txtEditor, 2); // El editor secundario está en la fila inferior Grid.SetRow(txtEditorSecondary, 1); Grid.SetColumn(txtEditorSecondary, 0); Grid.SetRowSpan(txtEditorSecondary, 1); Grid.SetColumnSpan(txtEditorSecondary, 2); // Muestra el spliter horizontal splitterHorizontal.Visibility = Visibility.Visible; } else { // Cambia el margen txtEditor.Margin = new Thickness(0, 0, 10, 0); // El editor principal está en la columna izquierda Grid.SetRow(txtEditor, 0); Grid.SetColumn(txtEditor, 0); Grid.SetRowSpan(txtEditor, 2); Grid.SetColumnSpan(txtEditor, 1); // El editor secundario está en la columna derecha Grid.SetRow(txtEditorSecondary, 0); Grid.SetColumn(txtEditorSecondary, 1); Grid.SetRowSpan(txtEditorSecondary, 2); Grid.SetColumnSpan(txtEditorSecondary, 1); // Muestra el spliter vertical splitterVertical.Visibility = Visibility.Visible; } } else { // Cambia el margen txtEditor.Margin = new Thickness(0, 0, 0, 0); // Cambia la visibilidad txtEditorSecondary.Visibility = Visibility.Collapsed; splitterHorizontal.Visibility = Visibility.Collapsed; splitterVertical.Visibility = Visibility.Collapsed; // El editor principal lo ocupa todo Grid.SetRowSpan(txtEditor, 2); Grid.SetColumnSpan(txtEditor, 2); // y es el seleccionado _selectedEditor = txtEditor; } // Activa / desactiva las opciones de menú mnuSplitHorizontal.IsEnabled = !split; mnuSplitVertical.IsEnabled = !split; mnuUnsplit.IsEnabled = split; }
private async void TextArea_TextEntered(object sender, System.Windows.Input.TextCompositionEventArgs e) { if (VM == null) { return; } // Open code completion after the user has pressed dot: if (e.Text == "." || e.Text == "[") { var textArea = sender as ICSharpCode.AvalonEdit.Editing.TextArea; ICSharpCode.AvalonEdit.TextEditor editor = null; if (configEdit.TextArea == textArea) { editor = configEdit; } else if (queryEdit.TextArea == textArea) { editor = queryEdit; } else { return; } await ShowCompletionWindow(editor); } }
private void CreateEditor() { Editor = new ICSharpCode.AvalonEdit.TextEditor(); Editor.TextArea.TextEntering += TextArea_TextEntering; Editor.TextArea.TextEntered += TextArea_TextEntered; //Editor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#"); Editor.ShowLineNumbers = true; using (StreamReader s = new StreamReader(AdmiralEnvironment.ApplicationPath + @"\\VSCSharp.xshd")) { using (XmlTextReader reader = new XmlTextReader(s)) { Editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load( reader, HighlightingManager.Instance); } } Editor.FontFamily = new System.Windows.Media.FontFamily("Consolas"); Editor.FontSize = 12; //Editor.SyntaxHighlighting.MainRuleSet.Rules Editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(Editor.Options); var foldingManager = FoldingManager.Install(Editor.TextArea); var foldingStrategy = new BraceFoldingStrategy(); this.elementHost1.Child = Editor; }
public TableEditorPage(SelectedContentArgs SelectedContentArgs, string startKeyWord, string endKeyWord, string KeyWordForTableLocationIndication = null) { InitializeComponent(); GapBetweenFoldingOffsetAndTableLocaionIndication = 0; this.textEditor = SelectedContentArgs.TextEditor; this.foldingSection = SelectedContentArgs.GetFoldingsAtCaretPosition()[0]; int CaretLocation = SelectedContentArgs.GetCaretPosition(); FoldingOffset = SelectedContentArgs.GetFoldingOffSet(); if (KeyWordForTableLocationIndication != null) { int indexOfKeyWordForIndication = foldingSection.TextContent.IndexOf(KeyWordForTableLocationIndication); if (KeyWordForTableLocationIndication != null && indexOfKeyWordForIndication != -1 && CaretLocation - FoldingOffset > indexOfKeyWordForIndication) { WorkingSection = foldingSection.TextContent.Substring(indexOfKeyWordForIndication); GapBetweenFoldingOffsetAndTableLocaionIndication = foldingSection.TextContent.Length - WorkingSection.Length; } else { WorkingSection = foldingSection.TextContent; } } else { WorkingSection = foldingSection.TextContent; } StartKeyWord = startKeyWord; EndKeyWord = endKeyWord; InitTable(); }
private void OpenFile_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.CheckFileExists = true; if (dlg.ShowDialog() ?? false) { var firstDocumentPane = dockingManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault(); if (firstDocumentPane != null) { ICSharpCode.AvalonEdit.TextEditor textEditor2 = new ICSharpCode.AvalonEdit.TextEditor(); textEditor2.FontSize = 14; LayoutAnchorable layoutAnchorable2 = new LayoutAnchorable(); layoutAnchorable2.Content = textEditor2; layoutAnchorable2.Title = dlg.FileName; layoutAnchorable2.Closing += Tab_Close; layoutAnchorable2.IsActive = true; firstDocumentPane.Children.Add(layoutAnchorable2); currentFileName = dlg.FileName; textEditor2.Load(currentFileName); textEditor2.ShowLineNumbers = true; textEditor2.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(currentFileName)); } } }
public static void CreateHighlightingRules(ICSharpCode.AvalonEdit.TextEditor editor, EngineController controller) { var stream = typeof(CodeHighlightingRuleFactory).Assembly.GetManifestResourceStream( "Dynamo.Wpf.UI.Resources." + Configurations.HighlightingFile); editor.SyntaxHighlighting = HighlightingLoader.Load( new XmlTextReader(stream), HighlightingManager.Instance); // Highlighting Digits var rules = editor.SyntaxHighlighting.MainRuleSet.Rules; rules.Add(CodeHighlightingRuleFactory.CreateNumberHighlightingRule()); var classRule = CodeHighlightingRuleFactory.CreateClassHighlightRule(controller); if (classRule != null) { rules.Add(classRule); } var methodRule = CodeHighlightingRuleFactory.CreateMethodHighlightRule(controller); if (methodRule != null) { rules.Add(methodRule); } }
public HighlightErrorLineBackgroundRenderer(ICSharpCode.AvalonEdit.TextEditor editor) { _editor = editor; _brush = new SolidColorBrush(Color.FromArgb(0x80, 0, 0, 0)); _brush.Freeze(); CurrentCodeSectionId = string.Empty; }
public static void ShowCompletionWindow(this ICSharpCode.AvalonEdit.TextEditor editor, string s) { if (string.IsNullOrWhiteSpace(s)) { return; } var completionWindow = editor.GetCompletionWindow(); IList <ICompletionData> data = completionWindow.CompletionList.CompletionData; data.Clear(); foreach (var word in dictionary.Where(word => word.Key.StartsWith(s))) { data.Add(new CompletionData(word.Key, s.Length, word.Value)); } if (data.Count == 0) { return; } completionWindow.CompletionList.ListBox.SelectedIndex = 0; completionWindow.Show(); completionWindow.Closed += delegate { completionWindow = null; }; }
public IconBarMargin(MainWindow _owner, ICSharpCode.AvalonEdit.TextEditor _editor) { this.owner = _owner; this.Editor = _editor; BitmapImage b; b = new BitmapImage(); b.BeginInit(); b.UriSource = new Uri("pack://application:,,,/PICSimulator;component/icons/arrow-left.png"); b.EndInit(); img_Arrow = b; b = new BitmapImage(); b.BeginInit(); b.UriSource = new Uri("pack://application:,,,/PICSimulator;component/icons/sealing-wax.png"); b.EndInit(); img_Breakpoint = b; b = new BitmapImage(); b.BeginInit(); b.UriSource = new Uri("pack://application:,,,/PICSimulator;component/icons/sealing-arrow.png"); b.EndInit(); img_Combined = b; }
protected void attachWpfEditor(AvalonEditorWPF editor) { Controls.Add(new ElementHost() { Dock = DockStyle.Fill, Child = editor }); }
public void Initialize(ICSharpCode.AvalonEdit.TextEditor textEditor) { this.textEditor = textEditor; var view = textEditor.TextArea.TextView; view.MouseHover += TextView_MouseHover; view.MouseHoverStopped += (s, e) => Close(); }
public override void DocumentChanged(ICSharpCode.AvalonEdit.TextEditor editor, FileBaseItem item) { MainWindow.inst().Dispatcher.Invoke(delegate() { Parsers.GLSLParser asp = new Parsers.GLSLParser(GetGLSLGlobals()); IDEProject.inst().LocalTypes = documentGlobals_ = asp.Parse(item.Path, System.IO.File.ReadAllText(item.Path), IDEProject.inst().Settings.GetIncludeDirectories()); }); }
public TextEditEx() { mTextEditor = new ICSharpCode.AvalonEdit.TextEditor(); TextOptions.SetTextFormattingMode(mTextEditor, TextFormattingMode.Display); mTextEditor.FontSize = 13; mTextEditor.FontFamily = new FontFamily("新宋体"); mTextEditor.DocumentChanged += _documentChanged; this.Child = mTextEditor; }
public ctlEditor() { InitializeComponent(); txtEditor.TextArea.Caret.PositionChanged += (sender, args) => PositionChanged?.Invoke(this, args); txtEditorSecondary.TextArea.Caret.PositionChanged += (sender, args) => PositionChanged?.Invoke(this, args); txtEditorSecondary.Document = txtEditor.Document; _selectedEditor = txtEditor; SplitDocument(false); }
//This method exists as a hack to get the XAML assebmlies loaded in the plugin public static void LoadAssemblies() { var av = new ICSharpCode.AvalonEdit.TextEditor(); var ac = new p.InvokeCommandAction(); i.InvokeCommandAction action = new i.InvokeCommandAction(); action.CommandName = "Loaded"; var window = new Window(); x.VisualStateUtilities.GetVisualStateGroups(window); ViewModelLocator.SetAutoWireViewModel(window, false); }
public codeeditor(ICSharpCode.AvalonEdit.TextEditor e) { editor = e; editor.TextArea.TextEntered += TextArea_TextEntered; editor.TextArea.TextEntering += TextArea_TextEntering; editor.TextArea.SelectionChanged += TextArea_SelectionChanged; editor.Document.Changed += Document_Changed; txts = new Block2(null, null, null, 0); curblock = txts; }
public CodeEditorControlHandler() { te = new ICSharpCode.AvalonEdit.TextEditor(); te.FontFamily = new System.Windows.Media.FontFamily("Consolas"); te.ShowLineNumbers = true; te.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("C#"); this.Control = te; }
public EditorForm() { InitializeComponent(); this.translucentPanel1.BackColor = Color.FromArgb(192, 255, 255, 255); this.worldIni_avEdit = new ICSharpCode.AvalonEdit.TextEditor(); this.worldIni_avEdit.FontFamily = new System.Windows.Media.FontFamily("Courier New"); this.worldIni_avEdit.BorderThickness = new System.Windows.Thickness(1); this.elementHost1.Child = worldIni_avEdit; }
public FindReplacePage(ICSharpCode.AvalonEdit.TextEditor editor) { InitializeComponent(); this.editor = editor; cbCaseSensitive.IsChecked = caseSensitive; cbWholeWord.IsChecked = wholeWord; cbRegex.IsChecked = useRegex; cbWildcards.IsChecked = useWildcards; cbSearchUp.IsChecked = searchUp; txtFind.Focus(); }
public Search(IsbDev sourceDev) { IsbDev = sourceDev; BuildSearchNodes(true); SearchCriteriaTextEditor = new ICSharpCode.AvalonEdit.TextEditor { Options = { ShowEndOfLine = true, ShowSpaces = true, ShowTabs = true } }; SearchCriteriaTextEditor.TextChanged += SearchCriteriaChanged; SearchCriteriaTextEditor.TextArea.KeyUp += new System.Windows.Input.KeyEventHandler(TextArea_KeyUp); SearchCriteriaTextEditor.TextArea.TextView.LineTransformers.Add(new HighlightIncorrectRegExp(this)); SearchCriteriaTextEditor.FontFamily = new FontFamily("Courier New, Courier, monospace"); SearchCriteriaTextEditor.FontSize = 13; SearchCriteriaTextEditor.FontStretch = FontStretch.FromOpenTypeStretch(5); TextEditor = new ICSharpCode.AvalonEdit.TextEditor { Options = { ConvertTabsToSpaces = true, ShowEndOfLine = true, ShowSpaces = true, ShowTabs = true, AllowScrollBelowDocument = false, EnableRectangularSelection = true, }, ShowLineNumbers = true, Text = "", IsReadOnly = false }; TextEditor.TextArea.TextView.LineTransformers.Add(new HighlightSearchedStrings(this)); TextEditor.FontFamily = new FontFamily("Courier New, Courier, monospace"); TextEditor.FontSize = 13; TextEditor.FontStretch = FontStretch.FromOpenTypeStretch(1); TextEditor.TextArea.KeyUp += new System.Windows.Input.KeyEventHandler(TextArea_KeyUp); var syntaxHighlightingFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ISBL.xshd"); using (Stream s = File.OpenRead(syntaxHighlightingFilePath)) { using (XmlTextReader reader = new XmlTextReader(s)) { TextEditor.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance); } } }
public TextEditor() { InitializeComponent(); editor = new AvalonEditorWPF(); attachWpfEditor(editor); ContextMenuStrip = contextMenuEditor; foldingManager = FoldingManager.Install(_.TextArea); searchPanel = SearchPanel.Install(_.TextArea); init(); }
public CodeEditorControlHandler() { te = new ICSharpCode.AvalonEdit.TextEditor(); te.FontFamily = new System.Windows.Media.FontFamily("Consolas"); te.ShowLineNumbers = true; te.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("C#"); te.Options.ConvertTabsToSpaces = false; te.Options.EnableHyperlinks = true; te.Options.EnableTextDragDrop = true; this.Control = te; }
public SourcecodeDocument(Window owner, ICSharpCode.AvalonEdit.TextEditor handler, string text, string path) { LastSaved_Value = text; Value = text; Path = path; Owner = owner; handler.Text = Value; handler.TextChanged += OnChange; updateTitle(); }
public SourcecodeDocument(Window owner, ICSharpCode.AvalonEdit.TextEditor handler) { LastSaved_Value = null; Value = ""; Path = null; Owner = owner; handler.Text = Value; handler.TextChanged += OnChange; updateTitle(); }
private static CompletionWindow GetCompletionWindow(this ICSharpCode.AvalonEdit.TextEditor editor) { // Open code completion after the user has pressed dot: var completionWindow = new CompletionWindow(editor.TextArea); completionWindow.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White); (completionWindow.Content as System.Windows.Controls.Control).Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Transparent); completionWindow.CompletionList.Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Transparent); completionWindow.CompletionList.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White); return(completionWindow); }
public DevTools(JScriptEngine engine, Dictionary<string, object> objects, string source = "") { InitializeComponent(); this.engine = engine; this.objects = objects; editor = new ICSharpCode.AvalonEdit.TextEditor(); editor.FontFamily = new System.Windows.Media.FontFamily("Consolas"); editor.FontSize = 14; editor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(".js"); editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy(); editor.ShowLineNumbers = true; editor.Text = source; foldingStrategy = new BraceFoldingStrategy(); foldingManager = FoldingManager.Install(editor.TextArea); foldingStrategy.UpdateFoldings(foldingManager, editor.Document); editor.TextArea.TextEntering += textEditor_TextArea_TextEntering; editor.TextArea.TextEntered += textEditor_TextArea_TextEntered; editor.TextChanged += Editor_TextChanged; DispatcherTimer foldingUpdateTimer = new DispatcherTimer(); foldingUpdateTimer.Interval = TimeSpan.FromTicks(20); foldingUpdateTimer.Tick += foldingUpdateTimer_Tick; foldingUpdateTimer.Start(); var img = new Image(); img.Source = Utils.ImageToBitmapsource(Properties.Resources.start); btnStart.Content = img; btnStart.Click += (s, e) => engine.Execute(editor.Text); editor.ExtendWithContextMenu(); view.Child = editor; }
public AsTextBoxStreamWriter(ICSharpCode.AvalonEdit.TextEditor textBox) { textBox_ = textBox; }
public TextMarkingBackGroundRender(ICSharpCode.AvalonEdit.TextEditor textEditor) { m_textEditor = textEditor; }
static ITextEditorOptions GetTextEditorOptions() { ICSharpCode.AvalonEdit.TextEditor editor = new ICSharpCode.AvalonEdit.TextEditor(); AvalonEditTextEditorAdapter adapter = new AvalonEditTextEditorAdapter(editor); return adapter.Options; }
private void LoadAssetClick(object sender, MouseButtonEventArgs e) { var vm = DataContext as AssetsTabViewModel; var tree = sender as TreeView; var si = (AssetTreeViewItemViewModel)(tree.SelectedItem); if (si == null) return; if (si.FileSystemInfo is DirectoryInfo) return; var ass = Asset.Load(si.FileSystemInfo as FileInfo); if (string.IsNullOrWhiteSpace(ass.FullPath)) return; switch (ass.Type) { case AssetType.Image: { var t = new TabItem(); var i = new Image(); i.Source = new BitmapImage(new Uri(ass.FullPath)); i.Stretch = Stretch.UniformToFill; t.Header = ass.FileName + "." + ass.Extension; t.Content = i; tab.Items.Add(t); tab.SelectedItem = t; break; } case AssetType.PythonScript: { var t = new TabItem(); var editor = new ICSharpCode.AvalonEdit.TextEditor() { Text = File.ReadAllText(ass.FullPath) }; var something = HighlightingLoader.Load( new XmlTextReader(File.Open(@"SyntaxHighlighting\Python.xshd", FileMode.Open)), HighlightingManager.Instance); editor.SyntaxHighlighting = something; editor.ShowLineNumbers = true; t.Header = ass.FileName + "." + ass.Extension; t.Content = editor; tab.Items.Add(t); tab.SelectedItem = t; break; } case AssetType.Xml: { var t = new TabItem(); var editor = new ICSharpCode.AvalonEdit.TextEditor() { Text = File.ReadAllText(ass.FullPath) }; //var something = // HighlightingLoader.Load( // new XmlTextReader(File.Open(@"SyntaxHighlighting\Python.xshd", FileMode.Open)), // HighlightingManager.Instance); //editor.SyntaxHighlighting = something; editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("XML"); t.Header = ass.FileName + "." + ass.Extension; editor.ShowLineNumbers = true; t.Content = editor; tab.Items.Add(t); tab.SelectedItem = t; break; } case AssetType.Sound: break; case AssetType.Other: break; default: throw new ArgumentOutOfRangeException(); } }
public SimilarWordsRenderer(AvalonEditorWPF editor) { this.editor = editor; BrushStyle = brushColorFromString("#DDE8CA"); PenStyle = new Pen(BrushStyle, 1); }
public void CreateEditor(){ this.editor = new ICSharpCode.AvalonEdit.TextEditor(); using (System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Program.BasePath + "config/squirrel.xshd")) { try { this.editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(reader, ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance); } catch (System.IO.FileNotFoundException) { this.WriteToConsole("Could not read syntax highlighter definitions file."); } } editor.TextChanged += delegate(object s, System.EventArgs args) { this.EditorTextChanged(); }; editor.TextArea.TextEntered += delegate(object s, System.Windows.Input.TextCompositionEventArgs args) { this.EditorTextChanged(); }; this.RegisterCompletionEvents(); this.editor.FontFamily = new System.Windows.Media.FontFamily("Consolas, Courier New"); this.editor.WordWrap = false; this.editor.ShowLineNumbers = true; this.editor.FontSize = 13; // code folding foldingManager = ICSharpCode.AvalonEdit.Folding.FoldingManager.Install(editor.TextArea); foldingStrategy = new AvalonEdit.Sample.BraceFoldingStrategy(); this.foldingStrategy.UpdateFoldings(this.foldingManager, this.editor.Document); this.editorHost.Child = this.editor; }
public void Initialize(ICSharpCode.AvalonEdit.TextEditor textEditor) { this.textEditor = textEditor; var view = textEditor.TextArea.TextView; view.MouseHover += TextView_MouseHover; view.MouseHoverStopped += (s, e) => Close(); }
private void AddScriptTabFile(string filename) { var textEditor = new ICSharpCode.AvalonEdit.TextEditor(); textEditor.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; textEditor.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; textEditor.FontFamily = new WM.FontFamily("Consolas"); textEditor.ShowLineNumbers = true; textEditor.SyntaxHighlighting = selectedHighlighting_; string headerText = "NewFile"; if (String.IsNullOrEmpty(filename) == false) { textEditor.Document.FileName = filename; textEditor.Load(filename); headerText = System.IO.Path.GetFileNameWithoutExtension(filename); } AsClosableTabItem tabItem = new AsClosableTabItem(); tabItem.SetHeader(headerText); tabItem.Content = textEditor; int tabIndex = tabScript.Items.Add(tabItem); tabScript.SelectedIndex = tabIndex; }
private void CreateEditor() { Editor = new ICSharpCode.AvalonEdit.TextEditor(); Editor.TextArea.TextEntering += TextArea_TextEntering; Editor.TextArea.TextEntered += TextArea_TextEntered; //Editor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#"); Editor.ShowLineNumbers = true; using (StreamReader s = new StreamReader(AdmiralEnvironment.ApplicationPath + @"\\VSCSharp.xshd")) { using (XmlTextReader reader = new XmlTextReader(s)) { Editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load( reader, HighlightingManager.Instance); } } Editor.FontFamily = new System.Windows.Media.FontFamily("Consolas"); Editor.FontSize = 12; //Editor.SyntaxHighlighting.MainRuleSet.Rules Editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(Editor.Options); var foldingManager = FoldingManager.Install(Editor.TextArea); var foldingStrategy = new BraceFoldingStrategy(); this.elementHost1.Child = Editor; }
protected void attachWpfEditor(AvalonEditorWPF editor) { Controls.Add(new ElementHost() { Dock = DockStyle.Fill, Child = editor }); }
public TextEditor() { InitializeComponent(); editor = new AvalonEditorWPF(); attachWpfEditor(editor); ContextMenuStrip = contextMenuEditor; foldingManager = FoldingManager.Install(_.TextArea); searchPanel = SearchPanel.Install(_.TextArea); init(); }
public CaretLineBackGroundRender(ICSharpCode.AvalonEdit.TextEditor textEditor) { m_textEditor = textEditor; m_textEditor.TextArea.Caret.PositionChanged += (sender, e) => m_textEditor.TextArea.TextView.InvalidateLayer(KnownLayer.Background); }
public HighlightBracesRenderer(AvalonEditorWPF editor) { this.editor = editor; BrushStyle = brushColorFromString("#EAEDE0"); PenStyle = new Pen(brushColorFromString("#314463"), 0.2f); }
public MoveCommand(ICSharpCode.AvalonEdit.TextEditor textEditor, string direction) { this.textEditor = textEditor; this.direction = direction; }