예제 #1
0
        public MainWindow()
        {
            InitializeComponent();
            textEditor.TextArea.Caret.PositionChanged += DisplayPosition;
            textEditor.PreviewMouseWheel += (s, e) =>
            {
                if (!Keyboard.IsKeyDown(Key.LeftCtrl))
                {
                    return;
                }
                if (e.Delta > 0)
                {
                    textEditor.FontSize += 3;
                }
                else if (e.Delta < 0 && textEditor.FontSize > 3)
                {
                    textEditor.FontSize -= 3;
                }
            };

            SearchPanel.Install(textEditor);
            var myvm = this.DataContext as MainWindowViewModel;

            myvm.editor = textEditor;
        }
        public CompilerMessageView()
        {
            instance = this;

            AddCategory(TaskService.BuildMessageViewCategory);

            textEditor.IsReadOnly = true;

            textEditor.ContextMenu = MenuService.CreateContextMenu(this, "/SharpDevelop/Pads/CompilerMessageView/ContextMenu");

            properties = (Properties)PropertyService.Get(OutputWindowOptionsPanel.OutputWindowsProperty, new Properties());

            var font = FontSelectionPanel.ParseFont(properties.Get("DefaultFont", Core.WinForms.WinFormsResourceService.DefaultMonospacedFont.ToString()).ToString());

            textEditor.FontFamily       = new FontFamily(font.FontFamily.Name);
            textEditor.FontSize         = Math.Round(font.Size * 96.0 / 72.0);
            properties.PropertyChanged += new PropertyChangedEventHandler(PropertyChanged);

            MessageViewLinkElementGenerator.RegisterGenerators(textEditor.TextArea.TextView);
            textEditor.TextArea.TextView.ElementGenerators.OfType <LinkElementGenerator>().ForEach(x => x.RequireControlModifierForClick = false);

            toolStrip = ToolBarService.CreateToolBar(panel, this, "/SharpDevelop/Pads/CompilerMessageView/Toolbar");
            toolStrip.SetValue(DockPanel.DockProperty, Dock.Top);

            panel.Children.Add(toolStrip);
            panel.Children.Add(textEditor);

            SetWordWrap();
            DisplayActiveCategory();
            ProjectService.SolutionLoaded += SolutionLoaded;

            SearchPanel.Install(textEditor);
        }
예제 #3
0
        public CodeTextEditor()
        {
            // Defaults
            FontSize        = (double)fontSizeConverter.ConvertFromString("10pt");
            FontFamily      = new FontFamily("Consolas");
            BorderBrush     = new SolidColorBrush(Colors.Silver);
            BorderThickness = new Thickness(1);

            // Indentation settings
            Options.IndentationSize            = 2;
            Options.ConvertTabsToSpaces        = true;
            Options.InheritWordWrapIndentation = false;

            // Create search panel
            this.searchPanel = SearchPanel.Install(TextArea);

            TextArea.TextEntering         += OnTextEntering;
            TextArea.TextEntered          += OnTextEntered;
            TextArea.MouseRightButtonDown += TextArea_MouseRightButtonDown;

            this.CtrlSpaceCommand = new RoutedCommand();
            this.CtrlSpaceCommand.InputGestures.Add(new KeyGesture(Key.Space, ModifierKeys.Control));
            CommandBinding cb = new CommandBinding(this.CtrlSpaceCommand, OnCtrlSpaceCommand);

            this.CommandBindings.Add(cb);

            cb = new CommandBinding(ApplicationCommands.Replace, OnReplace, OnCanReplace);
            this.CommandBindings.Add(cb);

            this.completion = new LuaCodeCompletion();
        }
예제 #4
0
        public ScriptWindow()
        {
            IHighlightingDefinition customHighlightingDefinition;

            using (var s = typeof(MainWindow).Assembly.GetManifestResourceStream("ClEngine.Lua.xshd"))
            {
                if (s == null)
                {
                    throw new InvalidOperationException("没有找到对应资源");
                }
                using (var reader = new XmlTextReader(s))
                {
                    customHighlightingDefinition =
                        HighlightingLoader.Load(reader,
                                                HighlightingManager.Instance);
                }
            }

            HighlightingManager.Instance.RegisterHighlighting("Lua", new[] { ".lua" }, customHighlightingDefinition);

            InitializeComponent();

            SearchPanel.Install(TextEditor);

            TextEditor.TextArea.TextEntering += TextAreaOnTextEntering;
            TextEditor.TextArea.TextEntered  += TextAreaOnTextEntered;

            ScriptEditor = TextEditor;
        }
예제 #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SearchPanel.Install(TextEditor.TextArea);
            //设置语法规则
            var name = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ".Util.Cmm.xshd";

            var assembly = System.Reflection.Assembly.GetExecutingAssembly();

            foldingManager  = FoldingManager.Install(TextEditor.TextArea);
            foldingStrategy = new BraceFoldingStrategy();
            //foldingStrategy.UpdateFoldings(foldingManager, TextEditor.Document);
            TextEditor.TextArea.TextEntering += TextEditor_TextArea_TextEntering;
            TextEditor.TextArea.TextEntered  += TextEditor_TextArea_TextEntered;


            //TextEditor.Text = DispContentValue;
            //foldingStrategy.UpdateFoldings(foldingManager, TextEditor.Document);
            using (var s = assembly.GetManifestResourceStream(name))
            {
                using (var reader = new XmlTextReader(s))
                {
                    var xshd = HighlightingLoader.LoadXshd(reader);
                    TextEditor.SyntaxHighlighting = HighlightingLoader.Load(xshd, HighlightingManager.Instance);
                }
            }
        }
예제 #6
0
        public EditScriptWindow(Script script, Dictionary <string, Script> scripts)
        {
            InitializeComponent();
            DataContext = this;
            SearchPanel.Install(scriptView);

            this._scripts = scripts;
            this.script   = script;

            if (script == null)
            {
                // This is a new script
                editorScript = new Script("New script", null, false, null);
            }
            else
            {
                // This is an existing script
                editorScript = script.Copy();
            }

            // See if there is the default value for this script is empty
            if (string.IsNullOrWhiteSpace(editorScript.defaultValue))
            {
                // No default; disable reset and show
                showDiffButton.IsEnabled       = false;
                resetToDefaultButton.IsEnabled = false;
            }

            scriptView.Text       = editorScript.Value;
            ScriptRecoveryService = new ScriptRecoveryService(this);
            ScriptRecoveryService.BeginScriptRecovery();
            scriptView.TextChanged += ScriptView_TextChanged;
        }
예제 #7
0
        /// <summary>
        /// expression window constructor
        /// </summary>
        public ExpressionWindow()
        {
            InitializeComponent();

            CodeTextEditor.TextArea.TextEntering     += TextEditor_TextEntering;
            CodeTextEditor.TextArea.TextEntered      += CodeTextEditor_TextEntered;
            AceTextEditor.TextArea.TextEntering      += TextEditor_TextEntering;
            AceTextEditor.TextArea.TextEntered       += AceTextEditor_TextEntered;
            LanguageTextEditor.TextArea.TextEntering += TextEditor_TextEntering;
            LanguageTextEditor.TextArea.TextEntered  += LanguageTextEditor_TextEntered;

            AceTextEditor.Options.EnableEmailHyperlinks      = false;
            AceTextEditor.Options.EnableHyperlinks           = false;
            CodeTextEditor.Options.EnableEmailHyperlinks     = false;
            CodeTextEditor.Options.EnableHyperlinks          = false;
            LanguageTextEditor.Options.EnableEmailHyperlinks = false;
            LanguageTextEditor.Options.EnableHyperlinks      = false;

            folding           = new BraceFoldingStrategy();
            aceFoldingManager = FoldingManager.Install(CodeTextEditor.TextArea);
            folding.UpdateFoldings(aceFoldingManager, CodeTextEditor.Document);

            //setip ctrl-f to single page code find
            codePanel = SearchPanel.Install(CodeTextEditor);
            langPanel = SearchPanel.Install(LanguageTextEditor);
            acePanel  = SearchPanel.Install(AceTextEditor);

            //setup ace view when find local
            acePanel.GotFocus  += AceView_OnClick;
            langPanel.GotFocus += LangView_OnClick;
            codePanel.GotFocus += CodeView_OnClick;
        }
예제 #8
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = Tools.Global.setting;

            //重写关闭响应代码
            this.Closing += SettingWindow_Closing;

            //置顶显示以免被挡住
            this.Topmost = true;

            //初始化下拉框参数
            dataBitsComboBox.SelectedIndex  = Tools.Global.setting.dataBits - 5;
            stopBitComboBox.SelectedIndex   = Tools.Global.setting.stopBit - 1;
            dataCheckComboBox.SelectedIndex = Tools.Global.setting.parity;

            //快速搜索
            SearchPanel.Install(textEditor.TextArea);
            string name = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ".Lua.xshd";

            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            using (System.IO.Stream s = assembly.GetManifestResourceStream(name))
            {
                using (XmlTextReader reader = new XmlTextReader(s))
                {
                    var xshd = HighlightingLoader.LoadXshd(reader);
                    textEditor.SyntaxHighlighting = HighlightingLoader.Load(xshd, HighlightingManager.Instance);
                }
            }
            //加载上次打开的文件
            loadLuaFile(Tools.Global.setting.sendScript);
        }
예제 #9
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public LogViewerControl()
        {
            InitializeComponent();

            _searchPanel             = SearchPanel.Install(textEditor.TextArea);
            _searchPanel.MarkerBrush = Brushes.DarkOrange;
        }
예제 #10
0
#pragma warning disable CS8618 // Non-nullable field is uninitialized.
        public FileEditor(ISettingsManager settings, IUIServices uIServices)
#pragma warning restore CS8618 // Non-nullable field is uninitialized.
        {
            InitializeComponent();

            _settings   = settings;
            _uIServices = uIServices;
            SyntaxHighlightingHelper.RegisterHightingExtensions();

            // set the Syntax Highlighting definitions
            SyntaxDefinitions.ItemsSource = HighlightingManager.Instance.HighlightingDefinitions;

            // Set the initial Font Family to Consolas
            FontChoice.ItemsSource  = Fonts.SystemFontFamilies.OrderBy(p => p.Source);
            FontChoice.SelectedItem = ConsolasFont;

            // disable unnecessary editor features
            Editor.Options.CutCopyWholeLine      = false;
            Editor.Options.EnableEmailHyperlinks = false;
            Editor.Options.EnableHyperlinks      = false;
            Editor.Options.ConvertTabsToSpaces   = true;

            Editor.TextArea.SelectionCornerRadius = 0;

            var searchInput = SearchPanel.Install(Editor.TextArea);
        }
예제 #11
0
        public FloatScriptEditor(string fileName)
        {
            IHighlightingDefinition customHighlightingDefinition;

            using (Stream s = typeof(MainWindow).Assembly.GetManifestResourceStream("ClEngine.Lua.xshd"))
            {
                if (s == null)
                {
                    throw new InvalidOperationException("没有找到对应资源");
                }
                using (var reader = new XmlTextReader(s))
                {
                    customHighlightingDefinition =
                        HighlightingLoader.Load(reader,
                                                HighlightingManager.Instance);
                }
            }

            HighlightingManager.Instance.RegisterHighlighting("Lua", new[] { ".lua" }, customHighlightingDefinition);

            //SwitchOldXshdFile("CustomHighlighting.xshd", "CustomHighlighting.xshd");

            InitializeComponent();

            SearchPanel.Install(TextEditor);

            LoadDocument(fileName);
        }
예제 #12
0
        public MainForm()
        {
            InitializeComponent();

            dotEditor = new TextEditor();
            SearchPanel.Install(dotEditor);

            dotEditor.Text = (new StreamReader(Utils.GetFileStream("defaultDot.gv"))).ReadToEnd();

            ElementHost eHost = new ElementHost();

            eHost.Dock  = DockStyle.Fill;
            eHost.Child = dotEditor;
            eHost.Name  = "DotEditor";

            splitContainerText.Panel1.Controls.Add(eHost);

            dotEngine = new DotCompletionEngine(dotEditor, this);

            ToolStripMenuItemRecent.DropDownOpening += recentToolStripMenuItem_DropDownOpening;

            OpenRecent();

            dotEngine.CompileDot();
            dotEngine.autoCompileEnabled = true;
        }
예제 #13
0
        //private readonly Timer _timerOfUpdateFoldings;

        #endregion

        #region Constructor

        public PdfDocumentView()
        {
            InitializeComponent();

            _foldingStrategy.FoldingTemplates = new List <FoldingTemplate>
            {
                new FoldingTemplate
                {
                    OpeningPhrase   = "[^a-zA-Z0-9]stream[^a-zA-Z0-9]",
                    ClosingPhrase   = "[^a-zA-Z0-9]endstream[^a-zA-Z0-9]",
                    IsDefaultFolded = true,
                    Name            = "stream"
                }
            };

            Editor.DocumentChanged += (sender, args) =>
            {
                UpdateFoldings();
                _colorTransformer = new TextMarkerService(Editor.Document);
                Editor.TextArea.TextView.BackgroundRenderers.Add(_colorTransformer);
                Editor.TextArea.TextView.LineTransformers.Add(_colorTransformer);
            };

            //_timerOfUpdateFoldings = new Timer(1000) { AutoReset = false };
            //_timerOfUpdateFoldings.Elapsed += (sender, args) => UpdateFoldings();

            Editor.TextArea.TextEntered          += TextAreaOnTextEntered;
            Editor.TextArea.PreviewMouseDown     += TextAreaOnPreviewMouseDown;
            Editor.TextArea.MouseMove            += TextAreaOnMouseMove;
            Editor.TextArea.MouseRightButtonDown += TextAreaOnMouseRightButtonDown;
            SearchPanel.Install(Editor);
        }
        public CodeView(string decompiledFileName)
        {
            this.adapter = new DecompiledTextEditorAdapter(new SharpDevelopTextEditor {
                IsReadOnly = true
            })
            {
                DecompiledFileName = decompiledFileName
            };
            this.Children.Add(adapter.TextEditor);
            adapter.TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");

            // add margin
            this.iconMargin = new IconBarMargin(iconBarManager = new IconBarManager());
            this.adapter.TextEditor.TextArea.LeftMargins.Insert(0, iconMargin);
            this.adapter.TextEditor.TextArea.TextView.VisualLinesChanged += delegate { iconMargin.InvalidateVisual(); };

            // add marker service
            this.textMarkerService = new TextMarkerService(adapter.TextEditor.Document);
            this.adapter.TextEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            this.adapter.TextEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);
            this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(IBookmarkMargin), iconBarManager);
            // DON'T add the editor in textview ervices - will mess the setting of breakpoints

            // add events
            this.adapter.TextEditor.MouseHover        += TextEditorMouseHover;
            this.adapter.TextEditor.MouseHoverStopped += TextEditorMouseHoverStopped;
            this.adapter.TextEditor.MouseLeave        += TextEditorMouseLeave;

            SearchPanel.Install(this.adapter.TextEditor.TextArea);
        }
        private void Grid_Initialized(object sender, EventArgs e)
        {
            CodeTextEditor.SyntaxHighlighting = HighlightingLoader.Load(
                new XmlTextReader(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "Python.Dark.xshd")), HighlightingManager.Instance);

            IEnumerable <Type> namespaces = Assembly.GetExecutingAssembly().GetTypes().Where(t =>
                                                                                             t.Namespace != null && t.IsPublic && t.IsClass && t.Namespace.EndsWith("Macros.Commands"));

            _completionData = new List <PythonCompletionData>();

            foreach (Type type in namespaces)
            {
                MethodInfo[] methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static);

                foreach (MethodInfo methodInfo in methods)
                {
                    CommandsDisplayAttribute attr = methodInfo.GetCustomAttribute <CommandsDisplayAttribute>();

                    if (attr == null)
                    {
                        continue;
                    }

                    _completionData.Add(
                        new PythonCompletionData(methodInfo.Name, attr.Description, attr.InsertText));
                }
            }

            CodeTextEditor.TextArea.TextEntered += OnTextEntered;
            SearchPanel.Install(CodeTextEditor);
        }
예제 #16
0
        public XamlPage()
        {
            InitializeComponent();

            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML");
            TextEditorOptions options = textEditor.Options;

            if (options != null)
            {
                //options.AllowScrollBelowDocument = true;
                options.EnableHyperlinks      = true;
                options.EnableEmailHyperlinks = true;
                options.EnableVirtualSpace    = false;
                options.HighlightCurrentLine  = true;
                //options.ShowSpaces               = true;
                //options.ShowTabs                 = true;
                //options.ShowEndOfLine            = true;
            }
            textEditor.ShowLineNumbers = true;

            _foldingManager  = FoldingManager.Install(textEditor.TextArea);
            _foldingStrategy = new XmlFoldingStrategy();

            textEditor.CommandBindings.Add(new CommandBinding(
                                               ApplicationCommands.Print, OnPrint, OnCanExecuteTextEditorCommand));
            textEditor.CommandBindings.Add(new CommandBinding(
                                               ApplicationCommands.PrintPreview, OnPrintPreview, OnCanExecuteTextEditorCommand));

            _searchPanel = SearchPanel.Install(textEditor);
        }
예제 #17
0
파일: Tab.cs 프로젝트: hamerstandr/Tools
        private void InalizedText()
        {
            //// Load our custom highlighting definition
            //IHighlightingDefinition customHighlighting;
            //using (Stream s = typeof(App).Assembly.GetManifestResourceStream("Editor.CustomHighlighting.xshd"))
            //{
            //    if (s == null)
            //        throw new InvalidOperationException("Could not find embedded resource");
            //    using (XmlReader reader = new XmlTextReader(s))
            //    {
            //        customHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.
            //            HighlightingLoader.Load(reader, HighlightingManager.Instance);
            //    }
            //}
            // and register it in the HighlightingManager
            //HighlightingManager.Instance.RegisterHighlighting("Custom Highlighting", new string[] { ".cool" }, customHighlighting);
            textEditor   = new TextEditor();
            this.Content = textEditor;
            textEditor.ShowLineNumbers = true;
            //textEditor.TextArea.TextView.LinkTextForegroundBrush = System.Windows.Media.Brushes.White;
            textEditor.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
            this.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
            textEditor.TextArea.TextEntering += textEditor_TextArea_TextEntering;
            textEditor.TextArea.TextEntered  += textEditor_TextArea_TextEntered;
            textEditor.PreviewMouseWheel     += TextEditor_PreviewMouseWheel;
            SearchPanel.Install(textEditor);
            DispatcherTimer foldingUpdateTimer = new DispatcherTimer();

            foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
            foldingUpdateTimer.Tick    += delegate { UpdateFoldings(); };
            foldingUpdateTimer.Start();
        }
예제 #18
0
        public AdvancedTextFileEditorControl()
        {
            InitializeComponent();
            this.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
            SearchPanel.Install(textEditor);

            textEditor.TextChanged    += (b, e) => _dataChanged = true;
            textEditor.ShowLineNumbers = true;

            DispatcherTimer foldingUpdateTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(2)
            };

            foldingUpdateTimer.Tick += delegate { UpdateFoldings(); };
            foldingUpdateTimer.Start();

            try
            {
                string extensionFilePath = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), EXTENSION_FILENAME);
                textExtensions.AddRange(File.ReadAllLines(extensionFilePath));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            if (textExtensions.Count == 0)
            {
                textExtensions.AddRange(DEFAULT_EXTENSIONS);
            }
        }
        public TextEditorView()
        {
            // Load our custom highlighting definition
            InitializeComponent();

            this.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);

            //this.

            //textEditor.TextArea.SelectionBorder = null;

            //textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
            //textEditor.SyntaxHighlighting = customHighlighting;
            // initial highlighting now set by XAML

            //textEditor.TextArea.TextEntering += textEditor_TextArea_TextEntering;
            //textEditor.TextArea.TextEntered += textEditor_TextArea_TextEntered;
            SearchPanel.Install(textEditor);

            DispatcherTimer foldingUpdateTimer = new DispatcherTimer();

            foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
            foldingUpdateTimer.Tick    += delegate { UpdateFoldings(); };
            foldingUpdateTimer.Start();
        }
예제 #20
0
        private void Options_Load(object sender, EventArgs e)
        {
            try
            {
                #region 载入语法高亮解决方案容器
                getPath();
                eleHighligh.Child = CodeHL;
                SearchPanel.Install(CodeHL.TextArea);
                string   name     = Assembly.GetExecutingAssembly().GetName().Name + ".Python.xshd";
                Assembly assembly = Assembly.GetExecutingAssembly();
                using (Stream s = assembly.GetManifestResourceStream(name))
                {
                    using (XmlTextReader reader = new XmlTextReader(s))
                    {
                        var xshd = HighlightingLoader.LoadXshd(reader);
                        CodeHL.SyntaxHighlighting = HighlightingLoader.Load(xshd, HighlightingManager.Instance);
                    }
                }
                #endregion


                // tabcontrol 被选择下标为 0
                mtab.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                PyCodeConfig.Config.writeConfiguration(LogPath, DateTime.Now.Date.ToString(), DateTime.Now.TimeOfDay.ToString(), ex.Message.ToString());
            }
        }
예제 #21
0
        public XamlPage()
        {
            InitializeComponent();

            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("XML");
            TextEditorOptions options = textEditor.Options;

            if (options != null)
            {
                //options.AllowScrollBelowDocument = true;
                options.EnableHyperlinks      = true;
                options.EnableEmailHyperlinks = true;
                options.EnableVirtualSpace    = false;
                options.HighlightCurrentLine  = true;
                //options.ShowSpaces               = true;
                //options.ShowTabs                 = true;
                //options.ShowEndOfLine            = true;
            }
            textEditor.ShowLineNumbers = true;

            textEditor.IsReadOnly = true;

            _foldingManager  = FoldingManager.Install(textEditor.TextArea);
            _foldingStrategy = new XmlFoldingStrategy();

            _searchPanel = SearchPanel.Install(textEditor);

            this.Loaded      += OnPageLoaded;
            this.SizeChanged += OnPageSizeChanged;
        }
예제 #22
0
        public MainWindow()
        {
            _mainViewModel = new MainViewModel();
            DataContext    = _mainViewModel;
            InitializeComponent();
            LoadOldSettings();
            _sourceXmlFoldingManager  = FoldingManager.Install(SourceXml.TextArea);
            _sourceXsltFoldingManager = FoldingManager.Install(SourceXslt.TextArea);
            _outputXmlFoldingManager  = FoldingManager.Install(OutputXml.TextArea);

            SearchPanel.Install(SourceXml);
            SearchPanel.Install(OutputXml);
            SearchPanel.Install(SourceXslt);

            _strategy = new XmlFoldingStrategy();
            UpdateFolding();

            _mainViewModel.OnTransformFinished += delegate { UpdateFolding(); };

            SourceXslt.TextArea.TextEntering += TextEditor_TextArea_TextEntering;
            SourceXslt.TextArea.TextEntered  += TextEditor_TextArea_TextEntered;
            SourceXml.TextArea.TextEntered   += (a, b) =>
            {
                try
                {
                    var xpath = GetXmlXPath(true);
                    TextBlockXPath.Text = xpath;
                }
                catch (Exception)
                {
                    TextBlockXPath.Text = "Error getting XPath";
                }
            };
        }
        public CIMViewer()
        {
            InitializeComponent();

            _foldingManager = FoldingManager.Install(this.AvalonTextEditor.TextArea);
            _xmlFolding     = new XmlFoldingStrategy();
            //http://blog.jerrynixon.com/2013/07/solved-two-way-binding-inside-user.html
            (this.Content as FrameworkElement).DataContext = this;
            //this.AvalonTextEditor.DataContext = this;

            ////http://stackoverflow.com/questions/13344982/does-avalonedit-texteditor-has-quick-search-replace-functionality
            //this.AvalonTextEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(
            //    new SearchInputHandler(this.AvalonTextEditor.TextArea));
            SearchPanel.Install(this.AvalonTextEditor);
            this.Loaded += (s, e) =>
            {
                try
                {
                    this.AvalonTextEditor.ContextMenu.SetValue(CIMViewer.TextEditorProperty,
                                                               this.AvalonTextEditor);
                }
                catch (System.Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Exception: {0}", ex.ToString());
                }
            };
        }
예제 #24
0
        private void OnPageLoaded(object sender, RoutedEventArgs e)
        {
            this.Startup();

            if (_searchPanel == null)
            {
                TextEditorOptions options = textEditor.Options;
                if (options != null)
                {
                    //options.AllowScrollBelowDocument = true;
                    options.EnableHyperlinks      = true;
                    options.EnableEmailHyperlinks = true;
                    options.EnableVirtualSpace    = false;
                    options.HighlightCurrentLine  = true;
                    //options.ShowSpaces               = true;
                    //options.ShowTabs                 = true;
                    //options.ShowEndOfLine            = true;
                }

                textEditor.IsReadOnly      = true;
                textEditor.WordWrap        = false;
                textEditor.ShowLineNumbers = true;

                _searchPanel = SearchPanel.Install(textEditor);
            }

            if (_listener == null)
            {
                _listener = new TextBoxTraceListener(textEditor);
                Trace.Listeners.Add(_listener);
            }
        }
예제 #25
0
        private void InitializeComponent()
        {
            IHighlightingDefinition customHighlighting;

            using (
                XmlReader reader =
                    new XmlTextReader(GlobalConfig.FullPath("Static", "TSL-Syntax.xshd")))
            {
                customHighlighting = HighlightingLoader.Load(reader,
                                                             HighlightingManager.Instance);
            }
            HighlightingManager.Instance.RegisterHighlighting(
                "Custom Highlighting", new[] { ".cool" }, customHighlighting);

            SyntaxHighlighting = customHighlighting;

            //this.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");

            // FontFamily = new FontFamily("Consolas");
            // FontSize = 18;
            //completionWindow.ShowActivated = true;
            Options.HighlightCurrentLine = true;
            //this.Options.ShowColumnRuler = true;
            ShowLineNumbers = true;
            // this.MouseWheel += ExperimentalCodeEditor_MouseWheel;
            TextArea.KeyUp             += TextArea_KeyUp;
            TextArea.KeyDown           += TextArea_KeyDown;
            TextArea.PreviewMouseWheel += ExperimentalCodeEditor_MouseWheel;

            TextArea.IndentationStrategy =
                new CSharpIndentationStrategy(Options);

#if USE_FOLDING
            foldingStrategy = new BraceFoldingStrategy();
            foldingManager  = FoldingManager.Install(TextArea);

            var foldingUpdateTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(5)
            };
            foldingUpdateTimer.Tick += delegate { UpdateFoldings(); };
            foldingUpdateTimer.Start();
#endif

#if !NEW_AUTOCOMPLETE
            TextArea.TextEntering += OnTextEntering;
            TextArea.TextEntered  += OnTextEntered;
            var ctrlSpace = new RoutedCommand();
            ctrlSpace.InputGestures.Add(new KeyGesture(Key.Space,
                                                       ModifierKeys.Control));
            var cb = new CommandBinding(ctrlSpace, OnCtrlSpaceCommand);
            CommandBindings.Add(cb);
#endif


            searchPanel = SearchPanel.Install(TextArea);


            // searchPanel.
        }
        public LocalizationSettingWindow(Dictionary <string, XmlObjectsListWrapper> loadedListWrappers)
        {
            InitializeComponent();

            Closing += new CancelEventHandler(LocalizatonSettingWindow_Closing);

            AddTooltips();

            StartingMod             = Properties.Settings.Default.ModTagSetting;
            WindowTitle             = StartingMod.ToString();
            this.Title              = GetTitleForWindow();
            this.LoadedListWrappers = loadedListWrappers;

            string pathToModLocalizationFile = XmlFileManager.ModConfigOutputPath + LocalizationFileObject.LOCALIZATION_FILE_NAME;

            ModLocalizationGridUserControl = new LocalizationGridUserControl(pathToModLocalizationFile);
            GridAsCSVAfterUpdate           = ModLocalizationGridUserControl.Maingrid.GridAsCSV();

            List <string> allCustomTagDirectories = XmlFileManager.GetCustomModFoldersInOutput();

            foreach (string nextModTag in allCustomTagDirectories)
            {
                ModSelectionComboBox.AddUniqueValueTo(nextModTag);
            }
            ModSelectionComboBox.SelectedItem = Properties.Settings.Default.ModTagSetting;

            ModSelectionComboBox.DropDownClosed += ModSelectionComboBox_DropDownClosed;

            ModLocalizationScrollViewer.Content = ModLocalizationGridUserControl;

            string pathToGameLocalizationFile = XmlFileManager.LoadedFilesPath + LocalizationFileObject.LOCALIZATION_FILE_NAME;

            GameLocalizationFile = new LocalizationFileObject(pathToGameLocalizationFile);
            TextEditorOptions newOptions = new TextEditorOptions
            {
                EnableRectangularSelection = true,
                EnableTextDragDrop         = true,
                HighlightCurrentLine       = true,
                ShowTabs = true
            };

            LocalizationPreviewBox.ShowLineNumbers  = true;
            LocalizationPreviewBox.TextArea.Options = newOptions;
            LocalizationPreviewBox.Text             = ModLocalizationGridUserControl.Maingrid.GridAsCSV();
            LocalizationPreviewBox.LostFocus       += LocalizationPreviewBox_LostFocus;
            SearchPanel.Install(LocalizationPreviewBox);
            ModLocalizationScrollViewer.GotFocus  += Maingrid_GotOrLostFocus;
            ModLocalizationScrollViewer.LostFocus += Maingrid_GotOrLostFocus;

            SortedSet <string> gameFileKeysSorted = GameLocalizationFile.HeaderKeyToCommonValuesMap.GetValueOrDefault(GameLocalizationFile.KeyColumn);
            List <string>      gameFileKeys       = new List <string>(gameFileKeysSorted);

            GameKeySelectionComboBox.SetComboBox(gameFileKeys);
            GameKeySelectionComboBox.IsEditable      = true;
            GameKeySelectionComboBox.DropDownClosed += GameKeySelectionComboBox_DropDownClosed;
            GameKeySelectionComboBox.PreviewKeyDown += GameKeySelectionComboBox_PreviewKeyDown;

            SetBackgroundColor();
        }
        public AvalonEdit()
        {
            InitializeComponent();
            Search = SearchPanel.Install(this);

            AvalonEditGlobalStyling.StyleChanged += AvalonEditGlobalStyling_StyleChanged;
            reloadStyle();
        }
        public InteractiveConsoleView()
        {
            InitializeComponent();

            //   History.TextArea.DefaultInputHandler.NestedInputHandlers.Add(new SearchInputHandler(History.TextArea));
            SearchPanel.Install(History.TextArea);
            History.SyntaxHighlighting = HighlightingLoader.Load(new XmlTextReader(Environment.CurrentDirectory + "\\Resources\\Log.xshd"), HighlightingManager.Instance);
        }
예제 #29
0
        public MainWindow()
        {
            InitializeComponent();

            textEditor.TextArea.Caret.PositionChanged += DisplayPosition;

            SearchPanel.Install(textEditor);
        }
예제 #30
0
        private void SetSearchPanel()
        {
            _logger.Debug("Setting editor search panel.");

            SearchPanel.Install(MainTextEditor);

            _logger.Debug("Editor search panel is successfully set.");
        }