public MainViewContent(string fileName, IWorkbenchWindow workbenchWindow)
        {
            codeEditor = new CodeEditor();

            textEditor = new TextEditor();
            textEditor.FontFamily = new FontFamily("Consolas");

            textEditor.TextArea.TextEntering += TextAreaOnTextEntering;
            textEditor.TextArea.TextEntered += TextAreaOnTextEntered;
            textEditor.ShowLineNumbers = true;

            var ctrlSpace = new RoutedCommand();
            ctrlSpace.InputGestures.Add(new KeyGesture(Key.Space, ModifierKeys.Control));
            var cb = new CommandBinding(ctrlSpace, OnCtrlSpaceCommand);
            // this.CommandBindings.Add(cb);

            adapter = new SharpSnippetTextEditorAdapter(textEditor);
            this.WorkbenchWindow = workbenchWindow;
            textEditor.TextArea.TextView.Services.AddService(typeof (ITextEditor), adapter);
            LoadFile(fileName);

            iconBarManager = new IconBarManager();
            textEditor.TextArea.LeftMargins.Insert(0, new IconBarMargin(iconBarManager));

            var textMarkerService = new TextMarkerService(textEditor.Document);
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            textEditor.TextArea.TextView.Services.AddService(typeof (ITextMarkerService), textMarkerService);
            textEditor.TextArea.TextView.Services.AddService(typeof (IBookmarkMargin), iconBarManager);
        }
Пример #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Tabs = ((System.Windows.Controls.TabControl)(target));

            #line 19 "..\..\..\Editors\Editor.xaml"
                this.Tabs.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.Tabs_SelectionChanged);

            #line default
            #line hidden
                return;

            case 2:
                this.TextEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 3:
                this.PreviewTab = ((System.Windows.Controls.TabItem)(target));
                return;

            case 4:
                this.webControl = ((Awesomium.Windows.Controls.WebControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 14 "..\..\..\UserWindows\Notepad.xaml"
                ((RunAwayAppWPF.UserWindows.Notepad)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Notepad_OnLoaded);

            #line default
            #line hidden

            #line 15 "..\..\..\UserWindows\Notepad.xaml"
                ((RunAwayAppWPF.UserWindows.Notepad)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Notepad_OnClosing);

            #line default
            #line hidden

            #line 15 "..\..\..\UserWindows\Notepad.xaml"
                ((RunAwayAppWPF.UserWindows.Notepad)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Notepad_OnKeyDown);

            #line default
            #line hidden
                return;

            case 2:
                this.notepadTextBox = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #4
0
        public AutoCompleteTextBox()
        {
            object tmp;
            #if SD5
            this.editorAdapter = SD.EditorControlService.CreateEditor(out tmp);
            #else
            #fail
            this.editorAdapter = WorkbenchSingleton.c SD.EditorControlService.CreateEditor(out tmp);
            #endif
            this.editor = (TextEditor)tmp;

            this.editor.Background = Brushes.Transparent;
            this.editor.ClearValue(TextEditor.FontFamilyProperty);
            this.editor.ClearValue(TextEditor.FontSizeProperty);
            this.editor.ShowLineNumbers = false;
            this.editor.WordWrap = false;
            this.editor.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            this.editor.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
            this.editor.TextArea.GotKeyboardFocus += delegate {
                this.Background = Brushes.White;
            };
            this.editor.TextArea.LostKeyboardFocus += delegate {
                this.Background = Brushes.Transparent;
                this.Text = this.editor.Text;
                this.editor.Select(0, 0);
            };
            this.editor.TextArea.PreviewKeyDown += editor_TextArea_PreviewKeyDown;
            this.editor.TextArea.TextEntered += editor_TextArea_TextEntered;

            this.Content = this.editor.TextArea;
        }
Пример #5
0
        public MainForm() {
            InitializeComponent();

            // 初始化编辑器。
            codeEditor = new ICSharpCode.AvalonEdit.TextEditor();
            codeEditorHost.Child = codeEditor;

            codeEditor.FontFamily = new System.Windows.Media.FontFamily("Consolas");
            codeEditor.FontSize = 14;
            codeEditor.ShowLineNumbers = true;
            codeEditor.SyntaxHighlighting = syntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(".js");
            codeEditor.WordWrap = true;

            foldingManager = FoldingManager.Install(codeEditor.TextArea);
            codeEditor.TextChanged += codeEditor_TextChanged;

            //codeEditor.TextArea.AddHandler(System.Windows.DataObject.PastingEvent, new System.Windows.DataObjectPastingEventHandler(codeEditor_Paste));

            textMarkerService = new TextMarkerService(codeEditor);
            TextView textView = codeEditor.TextArea.TextView;
            textView.BackgroundRenderers.Add(textMarkerService);
            textView.LineTransformers.Add(textMarkerService);
            textView.Services.AddService(typeof(TextMarkerService), textMarkerService);
            textView.MouseHover += MouseHover;
            textView.MouseHoverStopped += codeEditorMouseHoverStopped;

            textView.MouseHover += MouseHover;
            textView.MouseHoverStopped += codeEditorMouseHoverStopped;
            textView.VisualLinesChanged += VisualLinesChanged;

        }
Пример #6
0
        public void SetUpFixture()
        {
            AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
            document        = textEditor.Document;
            textEditor.Text = GetTextEditorCode();

            RubyParser       parser          = new RubyParser();
            ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text);

            using (DesignSurface designSurface = new DesignSurface(typeof(UserControl))) {
                IDesignerHost host        = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
                UserControl   userControl = (UserControl)host.RootComponent;
                userControl.ClientSize = new Size(489, 389);

                PropertyDescriptorCollection descriptors            = TypeDescriptor.GetProperties(userControl);
                PropertyDescriptor           namePropertyDescriptor = descriptors.Find("Name", false);
                namePropertyDescriptor.SetValue(userControl, "userControl1");

                DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
                using (serializationManager.CreateSession()) {
                    AvalonEditDocumentAdapter docAdapter = new AvalonEditDocumentAdapter(document, null);
                    RubyDesignerGenerator     generator  = new RubyDesignerGenerator(new MockTextEditorOptions());
                    generator.Merge(host, docAdapter, compilationUnit, serializationManager);
                }
            }
        }
Пример #7
0
 /// <summary>
 ///     取得配置后的处理工厂对象
 /// </summary>
 /// <param name="serviceType">指定为哪类服务器类型配置消息处理工厂</param>
 /// <returns></returns>
 public static void Processe(TextEditor rtb, EMark mark)
 {
     if (_procs.ContainsKey(mark))
     {
         _procs[mark].Process(rtb, mark);
     }
 }
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     ICSharpCode.AvalonEdit.TextEditor code = codeEdit;
     codeEdit.TextArea.TextView.BackgroundRenderers.Add(
         new HighlightCurrentLineBackgroundRenderer(code));
     codeEdit.TextArea.Caret.PositionChanged += (s, ee) =>
     {
         if (this.debugInfo == null)
         {
             return;
         }
         var pos  = codeEdit.CaretOffset;
         var line = codeEdit.Document.GetLineByOffset(pos).LineNumber;
         var addr = this.debugInfo.GetAddrBack(line);
         if (addr >= 0)
         {
             foreach (ThinNeo.Compiler.Op item in this.listASM.Items)
             {
                 if (item != null && item.addr == addr)
                 {
                     this.listASM.SelectedItem = item;
                     this.listASM.ScrollIntoView(item);
                     break;
                 }
             }
         }
     };
 }
Пример #9
0
        public int FindTextInTextEditor(TextEditor te, int ofst, string whatfind, ref int cor)
        {

            if (ofst < 0) return -1;
            string searchtext = whatfind;
            if (cbMatchCase.IsChecked == false) searchtext = searchtext.ToLower();                        
            int lenst = searchtext.Length;
            string tetext = "";
            {
                while (true)
                {
                    if (ofst < 0) return -1;
                    
                    if (cbFindUp.IsChecked == false)
                    { if (ofst + lenst > te.Document.TextLength) { return -2; } }
                    else
                    {
                        if (ofst < 0) { return -1; }
                        if (ofst > te.Document.TextLength - lenst) ofst = ofst - lenst;
                    }
                    tetext = te.Document.GetText(ofst, lenst);                                        
                    if (cbMatchCase.IsChecked == false) tetext = tetext.ToLower();                    
                    if (searchtext == tetext)
                    {
                        cor = tetext.Length;
                        return ofst;
                    }
                    if (cbFindUp.IsChecked == false) ofst++; else ofst--;
                }
            }
        }//func        
Пример #10
0
 public ScriptingConsolePad()
 {
     textEditor = CreateTextEditor();
     textEditor.SyntaxHighlighting = GetSyntaxHighlighting();
     CreateConsoleHost();
     host.Run();
 }
Пример #11
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this._textEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 2:
                this._footerGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this._buttonOk = ((System.Windows.Controls.Button)(target));

            #line 20 "..\..\..\..\..\View\Dialogs\ScriptEditDialog.xaml"
                this._buttonOk.Click += new System.Windows.RoutedEventHandler(this._buttonOk_Click);

            #line default
            #line hidden
                return;

            case 4:
                this._buttonCancel = ((System.Windows.Controls.Button)(target));

            #line 21 "..\..\..\..\..\View\Dialogs\ScriptEditDialog.xaml"
                this._buttonCancel.Click += new System.Windows.RoutedEventHandler(this._buttonCancel_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #12
0
        public static void ShowForReplace(TextEditor editor, bool replace)
        {
            if (theDialog == null)
            {
                theDialog = new FindAndReplaceForm(editor);
                theDialog.tabMain.SelectedIndex = replace ? 1 : 0;
                theDialog.Show();
                theDialog.Activate();
            }
            else
            {
                theDialog.tabMain.SelectedIndex = replace ? 1 : 0;
                theDialog.Activate();
            }

            if (!editor.TextArea.Selection.IsMultiline)
            {
                theDialog.txtFind.Text = theDialog.txtFind2.Text = editor.TextArea.Selection.GetText();
                theDialog.txtFind.SelectAll();
                theDialog.txtFind2.SelectAll();
                theDialog.txtFind2.Focus();
            }

            if (replace)
            {
                theDialog.txtFind2.Focus();
            }
            else
            {
                theDialog.txtFind.Focus();
            }
        }
Пример #13
0
		public void SetUpFixture()
		{
			resourceWriter = new MockResourceWriter();
			resourceService = new MockResourceService();
			resourceService.SetResourceWriter(resourceWriter);
			
			AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
			document = textEditor.Document;
			textEditor.Text = GetTextEditorCode();
			
			PythonParser parser = new PythonParser();
			ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text);

			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(499, 309);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					AvalonEditDocumentAdapter adapter = new AvalonEditDocumentAdapter(document, null);
					MockTextEditorOptions options = new MockTextEditorOptions();
					PythonDesignerGenerator generator = new PythonDesignerGenerator(options);
					generator.Merge(host, adapter, compilationUnit, serializationManager);
				}
			}
		}
Пример #14
0
        /// <summary>
        /// Initializes a new instance of class CodeControl
        /// </summary>
        /// <param name="content">Base64 content of the web resource</param>
        /// <param name="type">Web resource type</param>
        public CodeControl(string content, Enumerations.WebResourceType type)
        {
            InitializeComponent();

            textEditor = new TextEditor
            {
                ShowLineNumbers = true,
                FontSize = 12,
                FontFamily = new System.Windows.Media.FontFamily("Consolas"),
                //Focusable = true,
                //IsHitTestVisible = true
            };

            var wpfHost = new ElementHost
            {
                Child = textEditor,
                Dock = DockStyle.Fill,
                BackColorTransparent = true,
            };

            Controls.Add(wpfHost);

            if (!string.IsNullOrEmpty(content))
            {
                // Converts base64 content to string
                byte[] b = Convert.FromBase64String(content);
                innerContent = System.Text.Encoding.UTF8.GetString(b);
                originalContent = innerContent;
                innerType = type;
            }
        }
        public AvalonEditTextContainer(TextEditor editor)
        {
            _editor = editor;
            _currentText = SourceText.From(_editor.Text);

            _editor.Document.Changed += DocumentOnChanged;
        }
Пример #16
0
 public E2Editor()
 {
     _settings = MainWindow.Settings ?? new Settings();
     _textEditor = new TextEditor
                       {
                           SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("Expression2"),
                           Background = new SolidColorBrush(Color.FromRgb(0x1A, 0x1A, 0x1A)),
                           Foreground = new SolidColorBrush(Color.FromRgb(0xE0, 0xE0, 0xE0)),
                           FontFamily = _settings.Font,
                           ShowLineNumbers = true,
                           Options = {ConvertTabsToSpaces = true},
                       };
     if (_settings.AutoIndentEnabled)
     {
         _textEditor.TextArea.IndentationStrategy = new E2IndentationStrategy(_textEditor.Options);
         _textEditor.TextArea.TextEntered += AutoIndent_OnTextEntered;
     }
     try
     {
         using (Stream s = Resource.GetResource("E2.Functions"))
             _functionData = Function.LoadData(s);
         _textEditor.TextArea.TextView.LineTransformers.Add(new E2Colorizer(_functionData));
         _textEditor.TextArea.TextEntered += IntelliSense_OnTextEntered;
         _textEditor.TextArea.TextEntered += Insight_OnTextEntered;
     }
     catch (Exception)
     {
         if (!DesignerProperties.GetIsInDesignMode(this)) MessageBox.Show("Unable to load function data.");
         //Debugger.Break();
     }
     AddChild(_textEditor);
 }
Пример #17
0
		public ToolTipRequestEventArgs(TextEditor editor)
		{
			if (editor == null)
				throw new ArgumentNullException("editor");
			this.Editor = editor;
			this.InDocument = true;
		}
Пример #18
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.PyInputTextBox = ((ICSharpCode.AvalonEdit.TextEditor)(target));

            #line 24 "..\..\..\..\PythonExample\Gui.xaml"
                this.PyInputTextBox.LostFocus += new System.Windows.RoutedEventHandler(this.PyInputTextBox_OnLostFocus);

            #line default
            #line hidden
                return;

            case 2:
                this.ExecutePythonButton = ((System.Windows.Controls.Button)(target));

            #line 29 "..\..\..\..\PythonExample\Gui.xaml"
                this.ExecutePythonButton.Click += new System.Windows.RoutedEventHandler(this.ExecutePythonButton_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #19
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.txtUrl = ((Xceed.Wpf.Toolkit.WatermarkTextBox)(target));
                return;

            case 2:
                this.cbClearHtml = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 3:
                this.btnSaveFolder = ((System.Windows.Controls.Button)(target));

            #line 28 "..\..\Gather.xaml"
                this.btnSaveFolder.Click += new System.Windows.RoutedEventHandler(this.btnSaveFolder_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.btnGenUrl = ((System.Windows.Controls.Button)(target));

            #line 29 "..\..\Gather.xaml"
                this.btnGenUrl.Click += new System.Windows.RoutedEventHandler(this.btnGenUrl_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.btnGather = ((System.Windows.Controls.Button)(target));

            #line 32 "..\..\Gather.xaml"
                this.btnGather.Click += new System.Windows.RoutedEventHandler(this.btnGather_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.txtTitle = ((Xceed.Wpf.Toolkit.WatermarkTextBox)(target));
                return;

            case 7:
                this.txtContext = ((Xceed.Wpf.Toolkit.WatermarkTextBox)(target));
                return;

            case 8:
                this.txtGather = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 9:
                this.pbQuery = ((System.Windows.Controls.ProgressBar)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #20
0
        public EditorView(IApplicationState state)
        {
            InitializeComponent();

            _state = state;

            _editor = new TextEditor();
            _editor.Name = "txtEditor";
            _editor.IsReadOnly = true;
            _editor.Options.EnableEmailHyperlinks = false;
            _editor.Options.EnableHyperlinks = false;
            _editor.TextChanged += OnTextChanged;

            ehoEditor.Child = _editor;

            // folding
            var foldingManager = FoldingManager.Install(_editor.TextArea);
            var foldingStrategy = new GherkinFoldingStrategy();
            Timer foldingTimer = new Timer { Interval = TimeSpan.FromSeconds(2).Seconds };
            foldingTimer.Tick += (s, e) => foldingStrategy.UpdateFoldings(foldingManager, _editor.Document);
            foldingTimer.Start();

            // code completion
            var codeCompletionStrategy = new GherkinCodeCompletionStrategy(_editor, state);

            state.Project.CurrentFeatureChanged += OnCurrentFeatureChanged;
            state.Settings.EditorSettingsChanged += OnEditorSettingsChanged;
        }
        public IEnumerable<int> SelectIndexes(TextEditor textEditor)
        {
            int start = 0;
            int end = 0;

            if (textEditor.SelectionLength != 0)
            {
                start = textEditor.SelectionStart;
                end = textEditor.SelectionStart + textEditor.SelectionLength;
            }
            else
            {
                var position = textEditor.GetPositionFromPoint(MouseUtils.GetMousePosition(textEditor));

                if (position != null)
                {
                    start = textEditor.Document.GetOffset(position.Value.Line, position.Value.Column);
                    end = start;
                }
            }

            var list = new List<int>();

            for (int i = 0; i < _ranges.Count; i++)
            {
                var range = _ranges[i];
                if ((range.Start <= start && range.End <= start) || (range.Start >= end && range.End >= end)) continue;

                list.Add(i);
            }

            return list;
        }
        public CurrentLineHighlightRenderer(TextEditor editor, ProjectItemCodeDocument projectitem)
        {
            _editor = editor;
            _projectitem = projectitem;

            _editor.TextArea.Caret.PositionChanged += (s, e) => Invalidate();
        }
Пример #23
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.avalonTxt = ((ICSharpCode.AvalonEdit.TextEditor)(target));

            #line 20 "..\..\..\Pages\TextViewer_Page.xaml"
                this.avalonTxt.Loaded += new System.Windows.RoutedEventHandler(this.txtbox_viewr_Loaded);

            #line default
            #line hidden

            #line 21 "..\..\..\Pages\TextViewer_Page.xaml"
                this.avalonTxt.AddHandler(System.Windows.Controls.Primitives.ScrollBar.ScrollEvent, new System.Windows.Controls.Primitives.ScrollEventHandler(this.avalonTxt_Scroll));

            #line default
            #line hidden

            #line 21 "..\..\..\Pages\TextViewer_Page.xaml"
                this.avalonTxt.PreviewMouseWheel += new System.Windows.Input.MouseWheelEventHandler(this.avalonTxt_MouseWheel);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        protected virtual void DetectNamespaces(TextEditor editor)
        {
            this._nsmap.Clear();

            foreach (Match m in Regex.Matches(editor.Text, PrefixRegexPattern))
            {
                //Set the Offset for this Namespace so it gets properly scoped later on
                this._nsmap.CurrentOffset = m.Index + m.Length;

                String prefix = m.Groups[1].Value;
                String nsUri = m.Groups[3].Value;
                try
                {
                    this._nsmap.AddNamespace(prefix, new Uri(nsUri));
                    if (!this._namespaceTerms.ContainsKey(nsUri))
                    {
                        this._namespaceLoader.BeginInvoke(nsUri, this.LoadNamespaceTermsCallback, null);
                    }
                }
                catch (UriFormatException)
                {
                    //Ignore
                }
            }
        }
Пример #25
0
        private void addCodeFile(File File)
        {
            TabPage Page = new TabPage();
            Page.Text = File.Name;
            CheckBox IsCritical = new CheckBox();
            IsCritical.Visible = false;
            IsCritical.Checked = File.Critical;
            Page.Controls.Add(IsCritical);

            TextEditor TextBox = new TextEditor();
            TextBox.ShowLineNumbers = true;
            TextBox.FontSize = 14;
            TextBox.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("C#");
            TextBox.TextArea.TextEntered +=new System.Windows.Input.TextCompositionEventHandler(TextEntered);
            TextBox.TextArea.TextEntering += new System.Windows.Input.TextCompositionEventHandler(AutocompleteEntering);
            ElementHost Host = new ElementHost();
            Host.Child = TextBox;
            Host.Location = new Point(3, 3);
            Host.Size = new Size(Page.Size.Width - 6, Page.Size.Height - 6);
            Host.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            Page.Controls.Add(Host);
            codeTabControl.TabPages.Add(Page);
            codeTextboxes.Add(TextBox);
            TextBox.Text = File.Code;
        }
Пример #26
0
        public Point GetPositionFromOffset(TextEditor editor, VisualYPosition position, int offset)
        {
            var startLocation = editor.TextArea.TextView.Document.GetLocation(offset);
            var point = editor.TextArea.TextView.GetVisualPosition(new TextViewPosition(startLocation), position);

            return new Point(Math.Round(point.X), Math.Round(point.Y));
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.textEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));

            #line 16 "..\..\CodeBoxControl.xaml"
                this.textEditor.TextChanged += new System.EventHandler(this.TextEditor_TextChanged);

            #line default
            #line hidden

            #line 17 "..\..\CodeBoxControl.xaml"
                this.textEditor.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this.TextEditor_PreviewTextInput);

            #line default
            #line hidden

            #line 17 "..\..\CodeBoxControl.xaml"
                this.textEditor.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.textEditor_KeyDown);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        public static void InvokeCompletionWindow(TextEditor textEditor)
        {
            completionWindow = new CompletionWindow(textEditor.TextArea);

            completionWindow.Closed += delegate
            {
                completionWindow = null;
            };

            var text = textEditor.Text;
            var offset = textEditor.TextArea.Caret.Offset;

            var completedInput = CommandCompletion.CompleteInput(text, offset, null, PSConsolePowerShell.PowerShellInstance);
            // var r = CommandCompletion.MapStringInputToParsedInput(text, offset);

            "InvokeCompletedInput".ExecuteScriptEntryPoint(completedInput.CompletionMatches);

            if (completedInput.CompletionMatches.Count > 0)
            {
                completedInput.CompletionMatches.ToList()
                    .ForEach(record =>
                    {
                        completionWindow.CompletionList.CompletionData.Add(
                            new CompletionData
                            {
                                CompletionText = record.CompletionText,
                                ToolTip = record.ToolTip,
                                Resultype = record.ResultType,
                                ReplacementLength = completedInput.ReplacementLength
                            });
                    });

                completionWindow.Show();
            }
        }
		public void SetUpFixture()
		{
			AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
			document = textEditor.Document;
			textEditor.Text = GetTextEditorCode();

			RubyParser parser = new RubyParser();
			ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text);

			using (DesignSurface designSurface = new DesignSurface(typeof(UserControl))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				UserControl userControl = (UserControl)host.RootComponent;			
				userControl.ClientSize = new Size(489, 389);
				
				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(userControl);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(userControl, "userControl1");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					AvalonEditDocumentAdapter docAdapter = new AvalonEditDocumentAdapter(document, null);
					RubyDesignerGenerator generator = new RubyDesignerGenerator(new MockTextEditorOptions());
					generator.Merge(host, docAdapter, compilationUnit, serializationManager);
				}
			}
		}
Пример #30
0
 public Page(string path, TextEditor viewer, WebBrowser webviewer) {
     Viewer = viewer;
     WebViewer = webviewer;
     Root = path;
     if (File.Exists(Root + @"\__page.cfg")) {
         try
         {
             Config = JObject.Parse(File.ReadAllText(Root + @"\__page.cfg", Encoding.UTF8));
             Title = (string) Config["title"] ?? path.Split('\\').Last();
         }catch(Exception)
         {
             Config = new JObject();
             Title = path.Split('\\').Last();
         }
     }
     else
     {
         Config = new JObject();
         Title = path.Split('\\').Last();
     }
     Childs = new List<Page>();
     Item = new TreeViewItem { Header = Title };
     Item.Selected += Click;
     foreach (var dir in Directory.EnumerateDirectories(Root)) {
         var p = new Page(dir, viewer, webviewer);
         Childs.Add(p);
         Item.Items.Add(p.Item);
     }
 }
Пример #31
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.SettingsListView = ((System.Windows.Controls.ListView)(target));
                return;

            case 2:
                this.TabControl = ((System.Windows.Controls.TabControl)(target));
                return;

            case 3:
                this.LogOutUserTGB = ((System.Windows.Controls.Primitives.ToggleButton)(target));

            #line 188 "..\..\..\..\States\Settings\Settings.xaml"
                this.LogOutUserTGB.Click += new System.Windows.RoutedEventHandler(this.LogOutUserTGB_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.LanguageName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:
                this.FeedbackEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #32
0
        public TextEditor(string path = "")
        {
            InitializeComponent();

            editor     = new Editor();
            host.Child = editor;

            editor.FontFamily = new System.Windows.Media.FontFamily("Consolas");
            editor.FontSize   = 12;
            if (Config.HighlightingDefinition != null)
            {
                editor.SyntaxHighlighting = HighlightingLoader.Load(
                    Config.HighlightingDefinition, HighlightingManager.Instance);
            }

            editor.Options.IndentationSize       = 8;
            editor.Options.ConvertTabsToSpaces   = false;
            editor.ShowLineNumbers               = true;
            editor.HorizontalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Auto;
            editor.VerticalScrollBarVisibility   = System.Windows.Controls.ScrollBarVisibility.Auto;

            if (!string.IsNullOrWhiteSpace(path))
            {
                Open(path);
            }

            editor.TextArea.TextEntering += editor_TextArea_TextEntering;
            editor.TextArea.TextEntered  += editor_TextArea_TextEntered;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.textEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 2:
                this.ResultEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 3:

            #line 29 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Complier_Click);

            #line default
            #line hidden
                return;

            case 4:

            #line 30 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Attribute_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #34
0
		public AutoCompleteTextBox()
		{
			object tmp;
			this.editorAdapter = SD.EditorControlService.CreateEditor(out tmp);
			this.editor = (TextEditor)tmp;
			
			this.editor.Background = Brushes.Transparent;
			this.editor.ClearValue(TextEditor.FontFamilyProperty);
			this.editor.ClearValue(TextEditor.FontSizeProperty);
			this.editor.ShowLineNumbers = false;
			this.editor.WordWrap = false;
			this.editor.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
			this.editor.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
			this.editor.TextArea.GotKeyboardFocus += delegate {
				this.Background = Brushes.White;
				this.Foreground = Brushes.Black;
			};
			this.editor.TextArea.LostKeyboardFocus += delegate {
				this.Background = Brushes.Transparent;
				this.ClearValue(ForegroundProperty);
				this.Text = this.editor.Text;
				this.editorAdapter.ClearSelection();
			};
			this.editor.TextArea.PreviewKeyDown += editor_TextArea_PreviewKeyDown;
			this.editor.TextArea.TextEntered += editor_TextArea_TextEntered;
			
			this.Content = this.editor.TextArea;
			
			HorizontalContentAlignment = HorizontalAlignment.Stretch;
			VerticalContentAlignment = VerticalAlignment.Stretch;
		}
		public ScriptingConsoleTextEditor(TextEditor textEditor)
		{
			this.textEditor = textEditor;
			readOnlyRegion = new BeginReadOnlySectionProvider();
			textEditor.TextArea.ReadOnlySectionProvider = readOnlyRegion;
			textEditor.PreviewKeyDown += OnTextEditorPreviewKeyDown;
		}
        public void SetUpFixture()
        {
            resourceWriter  = new MockResourceWriter();
            resourceService = new MockResourceService();
            resourceService.SetResourceWriter(resourceWriter);

            AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
            document        = textEditor.Document;
            textEditor.Text = GetTextEditorCode();

            RubyParser       parser          = new RubyParser();
            ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.rb", document.Text);

            using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
                IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
                Form          form = (Form)host.RootComponent;
                form.ClientSize = new Size(499, 309);

                PropertyDescriptorCollection descriptors            = TypeDescriptor.GetProperties(form);
                PropertyDescriptor           namePropertyDescriptor = descriptors.Find("Name", false);
                namePropertyDescriptor.SetValue(form, "MainForm");

                DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
                using (serializationManager.CreateSession()) {
                    RubyDesignerGenerator generator = new RubyDesignerGenerator(new MockTextEditorOptions());
                    generator.Merge(host, new AvalonEditDocumentAdapter(document, null), compilationUnit, serializationManager);
                }
            }
        }
		public AvalonEditTextEditorAdapter(TextEditor textEditor)
		{
			if (textEditor == null)
				throw new ArgumentNullException("textEditor");
			this.textEditor = textEditor;
			this.Options = new OptionsAdapter(textEditor.Options);
		}
Пример #38
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.sectionComboBox = ((System.Windows.Controls.ComboBox)(target));

            #line 27 "..\..\..\..\Pages\Dialogs\DialogLSDoc.xaml"
                this.sectionComboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.sectionComboBox_SelectionChanged);

            #line default
            #line hidden
                return;

            case 2:
                this.menuPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 3:
                this.titleLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.contentDisplay = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #39
0
 public GoToLineDialog(TextEditor textEditor) {
   InitializeComponent();
   this.textEditor = textEditor;
   lowerLimit = 1;
   upperLimit = textEditor.LineCount;
   lineNumberLabel.Text = string.Format("Line Number ({0}-{1}):", lowerLimit, upperLimit);
 }
Пример #40
0
        static ITextEditorOptions GetTextEditorOptions()
        {
            ICSharpCode.AvalonEdit.TextEditor editor  = new ICSharpCode.AvalonEdit.TextEditor();
            AvalonEditTextEditorAdapter       adapter = new AvalonEditTextEditorAdapter(editor);

            return(adapter.Options);
        }
Пример #41
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.console = ((PythonConsoleControl.IronPythonConsoleControl)(target));
                return;

            case 2:

            #line 36 "..\..\IronPythonControl.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.openFileClick);

            #line default
            #line hidden
                return;

            case 3:

            #line 39 "..\..\IronPythonControl.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.saveFileClick);

            #line default
            #line hidden
                return;

            case 4:

            #line 73 "..\..\IronPythonControl.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.runClick);

            #line default
            #line hidden
                return;

            case 5:
                this.textEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 6:
                this.expander = ((System.Windows.Controls.Expander)(target));
                return;

            case 7:
                this.propertyGridComboBox = ((System.Windows.Controls.ComboBox)(target));

            #line 90 "..\..\IronPythonControl.xaml"
                this.propertyGridComboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.propertyGridComboBoxSelectionChanged);

            #line default
            #line hidden
                return;

            case 8:
                this.propertyGrid = ((System.Windows.Controls.WpfPropertyGrid.PropertyGrid)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #42
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 18 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.ToolBar)(target)).Loaded += new System.Windows.RoutedEventHandler(this.ToolBarLoaded);

            #line default
            #line hidden
                return;

            case 2:

            #line 28 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveFile);

            #line default
            #line hidden
                return;

            case 3:

            #line 31 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OpenFile);

            #line default
            #line hidden
                return;

            case 4:

            #line 34 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Clear);

            #line default
            #line hidden
                return;

            case 5:

            #line 62 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.StartCompile);

            #line default
            #line hidden
                return;

            case 6:
                this.textEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 7:
                this.tbOutput = ((System.Windows.Controls.TextBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #43
0
        public AvalonEditTextContainer(TextEditor editor)
        {
            _editor = editor;
            SetCurrent();

            _editor.Document.Changing += DocumentOnChanging;
            _editor.Document.Changed += DocumentOnChanged;
        }
        public ErrorBackgroundRenderer(TextEditor editor, ProjectItemCodeDocument projectitem)
        {
            _editor = editor;
            _codeitem = projectitem;
            _solution = projectitem.Project.Solution;

            //_editor.TextArea.Caret.PositionChanged += (s, e) => Invalidate();
        }
        public static void CorespondingTextEditorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ICSharpCode.AvalonEdit.TextEditor textEditor = (ICSharpCode.AvalonEdit.TextEditor)e.NewValue;

            double top    = textEditor.TextArea.TextView.GetVisualPosition(new TextViewPosition(1, 1), VisualYPosition.LineTop).Y;
            double bottom = textEditor.TextArea.TextView.GetVisualPosition(new TextViewPosition(1, 1), VisualYPosition.LineBottom).Y;
            double height = bottom - top;
        }
 protected virtual void DetectVariables(TextEditor editor)
 {
     this._vars.Clear();
     foreach (Match m in Regex.Matches(editor.Text, VariableRegexPattern))
     {
         this._vars.Add(new VariableCompletionData(m.Value));
     }
 }
Пример #47
0
		public MainForm()
		{
			InitializeComponent();
			var ce = new CodeEditor();
			edCode = ce.EditMain;
			hostCode.Child = ce;
			edCode.TextChanged += textBox1_TextChanged;
		}
		public void Init()
		{
			textEditorControl = new TextEditor();
			textEditor = new ScriptingConsoleTextEditor(textEditorControl);
			host = new DerivedPythonConsoleHost(textEditor);
			
			ScriptRuntime runtime = IronPython.Hosting.Python.CreateRuntime();
		}
Пример #49
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.TextBoxCode = ((ICSharpCode.AvalonEdit.TextEditor)(target));

            #line 25 "..\..\..\..\DevTab\Gui.xaml"
                this.TextBoxCode.LostFocus += new System.Windows.RoutedEventHandler(this.TextBoxCode_OnLostFocus);

            #line default
            #line hidden
                return;

            case 2:
                this.TextBoxFileName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.TextBoxClassName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.ButtonExecuteText = ((System.Windows.Controls.Button)(target));

            #line 37 "..\..\..\..\DevTab\Gui.xaml"
                this.ButtonExecuteText.Click += new System.Windows.RoutedEventHandler(this.ButtonExecuteText_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.ButtonExecuteFile = ((System.Windows.Controls.Button)(target));

            #line 40 "..\..\..\..\DevTab\Gui.xaml"
                this.ButtonExecuteFile.Click += new System.Windows.RoutedEventHandler(this.ButtonExecuteFile_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.TextBoxAssemblies = ((System.Windows.Controls.TextBox)(target));
                return;

            case 7:
                this.ButtonChooseFile = ((System.Windows.Controls.Button)(target));

            #line 51 "..\..\..\..\DevTab\Gui.xaml"
                this.ButtonChooseFile.Click += new System.Windows.RoutedEventHandler(this.ButtonChooseFile_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #50
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.SettingsFlyout = ((MahApps.Metro.Controls.Flyout)(target));
                return;

            case 2:
                this.enabledSwitch = ((MahApps.Metro.Controls.ToggleSwitch)(target));

            #line 50 "..\..\MainWindow.xaml"
                this.enabledSwitch.IsCheckedChanged += new System.EventHandler(this.OnIsCheckedChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.HardwareID = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.ScripList = ((System.Windows.Controls.ListBox)(target));

            #line 100 "..\..\MainWindow.xaml"
                this.ScripList.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.OnSelectionChanged);

            #line default
            #line hidden
                return;

            case 5:
                this.SearchBox = ((System.Windows.Controls.TextBox)(target));
                return;

            case 6:
                this.ReflectTree = ((System.Windows.Controls.TreeView)(target));
                return;

            case 7:
                this.MessageEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 8:
                this.InfoEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 9:
                this.ScripEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 10:
                this.ToolBar1 = ((System.Windows.Controls.ToolBar)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #51
0
 public PythonConsolePad()
 {
     textEditor = new TextEditor();
     pythonTextEditor = new PythonTextEditor(textEditor);
     host = new PythonConsoleHost(pythonTextEditor);
     host.Run();
     textEditor.FontFamily = new FontFamily("Consolas");
     textEditor.FontSize = 12;
 }
Пример #52
0
        /// <summary>
        /// CompletionWindowResolver
        /// </summary>
        /// <param name="text"></param>
        /// <param name="position"></param>
        /// <param name="input"></param>+
        /// <param name="textEditor"></param>
        public CompletionWindowResolver(string text, int position, string input, ICSharpCode.AvalonEdit.TextEditor textEditor)
        {
            _text     = text;
            _position = position;
            _input    = input;
            _target   = textEditor;

            _dataProviders.Add(new FileCompletionDataProvider());
        }
Пример #53
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.extensionComboBox = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 2:

            #line 49 "..\..\..\..\Src\Snippets\SnippetOptionPanel.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.AddGroupButton_Click);

            #line default
            #line hidden
                return;

            case 3:

            #line 54 "..\..\..\..\Src\Snippets\SnippetOptionPanel.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.RemoveGroupButton_Click);

            #line default
            #line hidden
                return;

            case 4:

            #line 59 "..\..\..\..\Src\Snippets\SnippetOptionPanel.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.EditGroupButton_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.dataGrid = ((System.Windows.Controls.DataGrid)(target));

            #line 100 "..\..\..\..\Src\Snippets\SnippetOptionPanel.xaml"
                this.dataGrid.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.DataGrid_SelectionChanged);

            #line default
            #line hidden
                return;

            case 6:
                this.snippetTextBox = ((ICSharpCode.AvalonEdit.TextEditor)(target));

            #line 122 "..\..\..\..\Src\Snippets\SnippetOptionPanel.xaml"
                this.snippetTextBox.TextChanged += new System.EventHandler(this.SnippetTextBox_TextChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #54
0
        public GherkinTableEditorPage(SelectedContentArgs SelectedContentArgs)
        {
            InitializeComponent();

            this.textEditor     = SelectedContentArgs.TextEditor;
            this.foldingSection = SelectedContentArgs.GetFoldingsAtCaretPosition()[0];

            InitTable();
        }
Пример #55
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.textEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));

            #line 22 "..\..\EditorPanel.xaml"
                this.textEditor.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.textEditor_MouseRightButtonDown);

            #line default
            #line hidden
                return;

            case 2:
                this.btnEditorCopy = ((System.Windows.Controls.Button)(target));

            #line 35 "..\..\EditorPanel.xaml"
                this.btnEditorCopy.Click += new System.Windows.RoutedEventHandler(this.btnEditorCopy_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.btnEditorPaste = ((System.Windows.Controls.Button)(target));

            #line 40 "..\..\EditorPanel.xaml"
                this.btnEditorPaste.Click += new System.Windows.RoutedEventHandler(this.btnEditorPaste_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.btnEditorCut = ((System.Windows.Controls.Button)(target));

            #line 45 "..\..\EditorPanel.xaml"
                this.btnEditorCut.Click += new System.Windows.RoutedEventHandler(this.btnEditorCut_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.btnEditorSelectAll = ((System.Windows.Controls.Button)(target));

            #line 50 "..\..\EditorPanel.xaml"
                this.btnEditorSelectAll.Click += new System.Windows.RoutedEventHandler(this.btnEditorSelectAll_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #56
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 39 "..\..\Window1.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.openFileClick);

            #line default
            #line hidden
                return;

            case 2:

            #line 40 "..\..\Window1.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.saveFileClick);

            #line default
            #line hidden
                return;

            case 3:
                this.highlightingComboBox = ((System.Windows.Controls.ComboBox)(target));

            #line 62 "..\..\Window1.xaml"
                this.highlightingComboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.HighlightingComboBox_SelectionChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.textEditor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
                return;

            case 5:
                this.propertyGridComboBox = ((System.Windows.Controls.ComboBox)(target));

            #line 79 "..\..\Window1.xaml"
                this.propertyGridComboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.propertyGridComboBoxSelectionChanged);

            #line default
            #line hidden
                return;

            case 6:
                this.propertyGridHost = ((System.Windows.Forms.Integration.WindowsFormsHost)(target));
                return;

            case 7:
                this.propertyGrid = ((System.Windows.Forms.PropertyGrid)(target));
                return;
            }
            this._contentLoaded = true;
        }
        public void OpenFileInEditor()
        {
            var    textEditor   = new ICSharpCode.AvalonEdit.TextEditor();
            String documentPath = @"C:\Users\Akash Paul\Dropbox\XMLFile1.pdfx";

            System.IO.StreamReader reader = new StreamReader(documentPath);
            String mystring = reader.ReadToEnd();

            textEditor.Document.Text = mystring;
        }
        public void xmlSyntaxHiglighting()
        {
            var editor = new ICSharpCode.AvalonEdit.TextEditor();

            editor.ShowLineNumbers = true;
            String file = @"C:\Users\Akash Paul\Dropbox\XMLFile1.pdfx";
            Stream pdfx = File.OpenRead(file);

            editor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("XML");
        }
Пример #59
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.Editor = ((ICSharpCode.AvalonEdit.TextEditor)(target));
         return;
     }
     this._contentLoaded = true;
 }
Пример #60
0
        //...........................................................

        public void ConstructViewers <EDITOR_T> ()
            where EDITOR_T : avalon.TextEditor, new()
        {
            m_viewerL = new EDITOR_T();  PanelL.Children.Add(m_viewerL);
            m_viewerR = new EDITOR_T();  PanelR.Children.Add(m_viewerR);

            // disable folding:
            // can't listen for folding events, can't sync foldings between viewers
            // todo: more generic solution if add folding to types other than xml.
            var viewerL = m_viewerL as XmlViewer;
            var viewerR = m_viewerR as XmlViewer;

            if (viewerL != null && viewerR != null)
            {
                avalon.Folding.FoldingManager.Uninstall(viewerL.FoldingManager);
                avalon.Folding.FoldingManager.Uninstall(viewerR.FoldingManager);
            }

            m_viewerL.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            m_viewerL.VerticalScrollBarVisibility   = ScrollBarVisibility.Hidden;

            m_viewerR.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            m_viewerR.VerticalScrollBarVisibility   = ScrollBarVisibility.Hidden;

            foreach (var line in m_model.OldText.Lines)
            {
                var text = line?.Text + System.Environment.NewLine;
                m_viewerL.AppendText(text);
            }
            foreach (var line in m_model.NewText.Lines)
            {
                var text = line?.Text + System.Environment.NewLine;
                m_viewerR.AppendText(text);
            }

            m_renderL = new TextDifferBackgroundRenderer(m_viewerL);
            m_renderR = new TextDifferBackgroundRenderer(m_viewerR);

            m_renderL.Lines = m_model.OldText.Lines;
            m_renderR.Lines = m_model.NewText.Lines;

            m_viewerL.TextArea.TextView.BackgroundRenderers.Add(m_renderL);
            m_viewerR.TextArea.TextView.BackgroundRenderers.Add(m_renderR);

            m_viewerL.TextArea.TextView.VisualLinesChanged  += ViewerL_VScrollChanged;
            m_viewerL.TextArea.TextView.ScrollOffsetChanged += ViewerL_HScrollChanged;
            m_viewerL.LayoutUpdated += ViewerL_LayoutUpdated;

            m_viewerR.TextArea.TextView.VisualLinesChanged  += ViewerR_VScrollChanged;
            m_viewerR.TextArea.TextView.ScrollOffsetChanged += ViewerR_HScrollChanged;

            Loaded += OnLoaded;
        }