예제 #1
0
        public void SetMemento(IXmlConvertable memento)
        {
            IProperties properties = (IProperties)memento;

            string[] bookMarks = properties.GetProperty("Bookmarks").ToString().Split(',');
            foreach (string mark in bookMarks)
            {
                if (mark != null && mark.Length > 0)
                {
                    textEditorControl.Document.BookmarkManager.Marks.Add(Int32.Parse(mark));
                }
            }

            textEditorControl.ActiveTextAreaControl.Caret.Position = ((TextEditorControl)this.Control).Document.OffsetToPosition(Math.Min(((TextEditorControl)this.Control).Document.TextLength, Math.Max(0, properties.GetProperty("CaretOffset", ((TextEditorControl)this.Control).ActiveTextAreaControl.Caret.Offset))));

            if (((TextEditorControl)this.Control).Document.HighlightingStrategy.Name != properties.GetProperty("HighlightingLanguage", ((TextEditorControl)this.Control).Document.HighlightingStrategy.Name))
            {
                IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighterByName(properties.GetProperty("HighlightingLanguage", ((TextEditorControl)this.Control).Document.HighlightingStrategy.Name));
                if (highlightingStrategy != null)
                {
                    textEditorControl.Document.HighlightingStrategy = highlightingStrategy;
                }
            }
            textEditorControl.ActiveTextAreaControl.TextArea.TextViewMargin.FirstVisibleLine = properties.GetProperty("VisibleLine", 0);

            textEditorControl.Document.FoldingManager.DeserializeFromString(properties.GetProperty("Foldings", ""));
        }
예제 #2
0
        void SetDocumentCodeType(TextEditorControl editor, string codeType)
        {
            IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(codeType);

            editor.Document.HighlightingStrategy = strategy;
            _CodeType = codeType;
        }
예제 #3
0
 private void ResolveExternalReferences()
 {
     foreach (HighlightRuleSet highlightRuleSet in this.Rules)
     {
         if (highlightRuleSet.Reference != null)
         {
             IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter(highlightRuleSet.Reference);
             if (highlightingStrategy != null)
             {
                 highlightRuleSet.Highlighter = highlightingStrategy;
             }
             else
             {
                 MessageBox.Show(string.Concat(new string[]
                 {
                     "The mode defintion ",
                     highlightRuleSet.Reference,
                     " which is refered from the ",
                     this.Name,
                     " mode definition could not be found"
                 }), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                 highlightRuleSet.Highlighter = this;
             }
         }
         else
         {
             highlightRuleSet.Highlighter = this;
         }
     }
 }
예제 #4
0
        public static DocumentLanguage GetDocumentLanguageFromHighlighter(EditorControl editor)
        {
            IHighlightingStrategy highlighter = editor.Document.HighlightingStrategy;

            if (highlighter != null)
            {
                if (highlighter.Name == "JavaScript")
                {
                    return(DocumentLanguage.JavaScript);
                }
                else if (highlighter.Name == "Cascading Style Sheet")
                {
                    return(DocumentLanguage.CSS);
                }
                else if (highlighter.Name == "HTML")
                {
                    return(DocumentLanguage.HTML);
                }
                else if (highlighter.Name == "PHP")
                {
                    return(DocumentLanguage.PHP);
                }
            }
            return(DocumentLanguage.HTML);
        }
예제 #5
0
        public void SetMemento(Properties memento)
        {
            Properties properties = (Properties)memento;

            textAreaControl.ActiveTextAreaControl.Caret.Position = textAreaControl.Document.OffsetToPosition(Math.Min(textAreaControl.Document.TextLength, Math.Max(0, properties.Get("CaretOffset", textAreaControl.ActiveTextAreaControl.Caret.Offset))));
//			textAreaControl.SetDesiredColumn();

            if (textAreaControl.Document.HighlightingStrategy.Name != properties.Get("HighlightingLanguage", textAreaControl.Document.HighlightingStrategy.Name))
            {
                IHighlightingStrategy highlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(properties.Get("HighlightingLanguage", textAreaControl.Document.HighlightingStrategy.Name));
                if (highlightingStrategy != null)
                {
                    textAreaControl.Document.HighlightingStrategy = highlightingStrategy;
                }
            }
            textAreaControl.ActiveTextAreaControl.TextArea.TextView.FirstVisibleLine = properties.Get("VisibleLine", 0);

            textAreaControl.Document.FoldingManager.DeserializeFromString(properties.Get("Foldings", ""));
//			// insane check for cursor position, may be required for document reload.
//			int lineNr = textAreaControl.Document.GetLineNumberForOffset(textAreaControl.Document.Caret.Offset);
//			LineSegment lineSegment = textAreaControl.Document.GetLineSegment(lineNr);
//			textAreaControl.Document.Caret.Offset = Math.Min(lineSegment.Offset + lineSegment.Length, textAreaControl.Document.Caret.Offset);
//
//			textAreaControl.OptionsChanged();
//			textAreaControl.Refresh();
        }
예제 #6
0
        private static void SetDarkTheme()
        {
            IHighlightingStrategy scheme = HighlightingStrategyFactory.CreateHighlightingStrategy("Dark");

            TipGradient = scheme.GetColorFor("TipsGradient");

            SelectedHighlight     = new HighlightColor(Color.White, Color.MediumVioletRed);
            CodeFunctions         = Color.FromArgb(64, 64, 90);
            HighlightError        = Color.Red;
            HighlightIncludeError = Color.Lime;
            IncludeHighlight      = Color.DarkSlateGray;
            TreeNameFunction      = Color.FromArgb(243, 233, 122); //LightKhaki

            Color back = Color.FromArgb(40, 40, 42);

            mainForm.FunctionTreeLeft.BackColor = back;
            mainForm.FunctionTreeLeft.ForeColor = Color.Gainsboro;
            mainForm.FunctionTreeLeft.LineColor = Color.DimGray;

            mainForm.FunctionsTree.BackColor = back;
            mainForm.FunctionsTree.ForeColor = Color.Gainsboro;
            mainForm.FunctionsTree.LineColor = Color.DimGray;

            mainForm.ProcTree.BackColor = back;
            mainForm.ProcTree.ForeColor = Color.Gainsboro;
            mainForm.ProcTree.LineColor = Color.Gray;

            mainForm.VarTree.BackColor = back;
            mainForm.VarTree.ForeColor = Color.Gainsboro;
            mainForm.VarTree.LineColor = Color.Gray;
        }
예제 #7
0
        public void FileViewer_ShowSyntaxHighlightingInDiff_enabled_use_highlighting()
        {
            // a sample c sharp file diff
            const string sampleCsharpPatch =
                @"diff --git a/GitUI/Editor/FileViewerInternal.cs b/GitUI/Editor/FileViewerInternal.cs
index 62a5c2f08..2bc482714 100644
--- a/GitUI/Editor/FileViewerInternal.cs
+++ b/GitUI/Editor/FileViewerInternal.cs
@@ -229 +229 @@ public void SetText(string text, Action openWithDifftool, bool isDiff = false)
-            int scrollPos = ScrollPos;
+            int scrollPos = VScrollPosition;";

            using var testHelper = new GitModuleTestHelper();
            var uiCommands = new GitUICommands(testHelper.Module);

            _uiCommandsSource.UICommands.Returns(x => uiCommands);
            _fileViewer.UICommandsSource = _uiCommandsSource;

            FileViewer.TestAccessor testAccessor = _fileViewer.GetTestAccessor();
            testAccessor.ShowSyntaxHighlightingInDiff = true;

            // act
            testAccessor.ViewPatch("FileViewerInternal.cs", sampleCsharpPatch);

            // assert
            IHighlightingStrategy csharpHighlighting = HighlightingManager.Manager.FindHighlighterForFile("anycsharpfile.cs");

            csharpHighlighting.Should().NotBe(HighlightingManager.Manager.DefaultHighlighting);

            _fileViewer.GetTestAccessor().FileViewerInternal.GetTestAccessor().TextEditor.Document
            .HighlightingStrategy.Should().Be(csharpHighlighting);
        }
        public void SetMemento(Properties properties)
        {
            textEditorControl.ActiveTextAreaControl.Caret.Position = textEditorControl.Document.OffsetToPosition(Math.Min(textEditorControl.Document.TextLength, Math.Max(0, properties.Get("CaretOffset", textEditorControl.ActiveTextAreaControl.Caret.Offset))));
//			textAreaControl.SetDesiredColumn();

            string highlightingName = properties.Get("HighlightingLanguage", string.Empty);

            if (!string.IsNullOrEmpty(highlightingName))
            {
                if (highlightingName == textEditorControl.Document.HighlightingStrategy.Name)
                {
                    textEditorControl.HighlightingExplicitlySet = true;
                }
                else
                {
                    IHighlightingStrategy highlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(highlightingName);
                    if (highlightingStrategy != null)
                    {
                        textEditorControl.HighlightingExplicitlySet     = true;
                        textEditorControl.Document.HighlightingStrategy = highlightingStrategy;
                    }
                }
            }
            textEditorControl.ActiveTextAreaControl.TextArea.TextView.FirstVisibleLine = properties.Get("VisibleLine", 0);

//			// insane check for cursor position, may be required for document reload.
//			int lineNr = textAreaControl.Document.GetLineNumberForOffset(textAreaControl.Document.Caret.Offset);
//			LineSegment lineSegment = textAreaControl.Document.GetLineSegment(lineNr);
//			textAreaControl.Document.Caret.Offset = Math.Min(lineSegment.Offset + lineSegment.Length, textAreaControl.Document.Caret.Offset);
//
//			textAreaControl.OptionsChanged();
//			textAreaControl.Refresh();
        }
    private void Initialize()
    {
        GenericHelper.SetSize(this, ConfigHandler.EditWindowSize);
        MinimumSize = new Size(700, 500);          // error in .NET

        wordWrapToolStripMenuItem.Checked = Convert.ToBoolean(ConfigHandler.WordWrap);
        descriptionTextBox.WordWrap       = Convert.ToBoolean(ConfigHandler.WordWrap);

        IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter("SQL");

        HighlightColor highlightColor = new HighlightColor(Color.Black, Color.WhiteSmoke, false, false);

        ((DefaultHighlightingStrategy)highlightingStrategy).SetColorFor("Default", highlightColor);
        ((DefaultHighlightingStrategy)highlightingStrategy).SetColorFor("LineNumbers", highlightColor);

        sqlTextBox.SetHighlighting("SQL");
        sqlTextBox.Document.HighlightingStrategy = highlightingStrategy;

        sqlTextBox.TextEditorProperties.Font = new Font(ConfigHandler.EditorFontFamily, float.Parse(ConfigHandler.EditorFontSize));
        sqlTextBox.Font = new Font(ConfigHandler.EditorFontFamily, float.Parse(ConfigHandler.EditorFontSize));

        TaskHelper.TaskType[] taskTypes = (TaskHelper.TaskType[])Enum.GetValues(typeof(TaskHelper.TaskType));

        foreach (TaskHelper.TaskType taskType in taskTypes)
        {
            taskTypeComboBox.Items.Add(new ComboBoxItem(TaskHelper.TaskTypeToString(taskType), taskType.ToString()));
        }
    }
        private void ResolveExternalReferences()
        {
            foreach (HighlightRuleSet ruleSet in Rules)
            {
                ruleSet.Highlighter = this;

                if (ruleSet.Reference != null)
                {
                    IHighlightingStrategy highlighter = HighlightingManager.Manager.FindHighlighter(ruleSet.Reference);

                    if (highlighter == null)
                    {
                        throw new HighlightingDefinitionInvalidException("The mode defintion " + ruleSet.Reference + " which is refered from the " + Name + " mode definition could not be found");
                    }

                    if (highlighter is IHighlightingStrategyUsingRuleSets)
                    {
                        ruleSet.Highlighter = (IHighlightingStrategyUsingRuleSets)highlighter;
                    }
                    else
                    {
                        throw new HighlightingDefinitionInvalidException("The mode defintion " + ruleSet.Reference + " which is refered from the " + Name + " mode definition does not implement IHighlightingStrategyUsingRuleSets");
                    }
                }
            }
        }
예제 #11
0
        public void SetHighlighting(string mode)
        {
            IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(mode);

            //IHighlightingStrategy strategy = HighlightingManager.Manager.FindHighlighter(mode);
            Document.HighlightingStrategy = strategy;
        }
예제 #12
0
 public void AddHighlightingStrategy(IHighlightingStrategy highlightingStrategy)
 {
     highlightingDefs[highlightingStrategy.Name] = highlightingStrategy;
     foreach (string extension in highlightingStrategy.Extensions)
     {
         extensionsToName[extension.ToUpperInvariant()] = highlightingStrategy.Name;
     }
 }
예제 #13
0
 public TextEditorFactory(System.Windows.Controls.TextBox textBox, IHighlightingStrategy strategy)
 {
     _openFileDlg = new OpenFileDialog();
     _textBox = textBox;
     _undoCommand = null;
     _strategy = strategy;
     this._textBox.KeyDown += new System.Windows.Input.KeyEventHandler(this.TextBoxKeyDown);
 }
예제 #14
0
		public void AddHighlightingStrategy(IHighlightingStrategy highlightingStrategy)
		{
			highlightingDefs[highlightingStrategy.Name] = highlightingStrategy;
			foreach (string extension in highlightingStrategy.Extensions)
			{
				extensionsToName[extension.ToUpperInvariant()] = highlightingStrategy.Name;
			}
		}
예제 #15
0
        /// <summary>
        /// ファイルを読み込み画面状態を初期化する
        /// </summary>
        public void loadOption()
        {
            if (m_krkrType == FileType.KrkrType.Kag)
            {
                //カラー設定
                KagColorType          type = new KagColorType();
                IHighlightingStrategy hs   = HighlightingManager.Manager.FindHighlighter("KAG");
                loadBaseTypeColor(type, hs);
                loadKagTypeColor(type, (DefaultHighlightingStrategy)hs);
                colorPropertyGrid.SelectedObject = type;

                //タブ表示切り替え
                optionTabControl.TabPages.Clear();
                optionTabControl.TabPages.Add(colorTabPage);
                optionTabControl.TabPages.Add(fontTabPage);
                optionTabControl.TabPages.Add(showTabPage);
                optionTabControl.TabPages.Add(actionTabPage);
                optionTabControl.TabPages.Add(completeTabPage);
                optionTabControl.TabPages.Add(kag1TabPage);
                optionTabControl.TabPages.Add(kag2TabPage);
                optionTabControl.TabPages.Add(kagex1TabPage);
            }
            else if (m_krkrType == FileType.KrkrType.Tjs)
            {
                TjsColorType          type = new TjsColorType();
                IHighlightingStrategy hs   = HighlightingManager.Manager.FindHighlighter("TJS2");
                loadBaseTypeColor(type, hs);
                loadTjsTypeColor(type, (DefaultHighlightingStrategy)hs);
                colorPropertyGrid.SelectedObject = type;

                //タブ表示切り替え
                optionTabControl.TabPages.Clear();
                optionTabControl.TabPages.Add(colorTabPage);
                optionTabControl.TabPages.Add(fontTabPage);
                optionTabControl.TabPages.Add(showTabPage);
                optionTabControl.TabPages.Add(actionTabPage);
                //optionTabControl.TabPages.Add(completeTabPage);
            }
            else
            {
                BaseColorType         type = new BaseColorType();
                IHighlightingStrategy hs   = HighlightingManager.Manager.FindHighlighter("Default");
                loadBaseTypeColor(type, hs);
                colorPropertyGrid.SelectedObject = type;

                //タブ表示切り替え
                optionTabControl.TabPages.Clear();
                optionTabControl.TabPages.Add(colorTabPage);
                optionTabControl.TabPages.Add(fontTabPage);
                optionTabControl.TabPages.Add(showTabPage);
                optionTabControl.TabPages.Add(actionTabPage);
            }

            //エディタ設定
            EditorOption editorOption = GlobalStatus.EditorManager.GetEditorOption(m_krkrType);

            loadEditorOption(editorOption);
        }
        public static IHighlightingStrategy CreateHighlightingStrategyForFile(string fileName)
        {
            IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighterForFile(fileName);

            if (highlightingStrategy == null)
            {
                return(CreateHighlightingStrategy());
            }
            return(highlightingStrategy);
        }
예제 #17
0
        private void DbSPViewer_Load(object sender, EventArgs e)
        {
            this.Text      = string.Format("查看存储过程信息[{0}->{1}]", currentSP.Database.Name, currentSP.Name);
            dgv.DataSource = DbSchemaHelper.Instance.CurrentSchema.GetCommandParameterList(currentSP);

            IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(CodeType.TSQL);

            textEditorControl1.Document.HighlightingStrategy = strategy;
            textEditorControl1.Text = currentSP.SqlText;
        }
        public static IHighlightingStrategy CreateHighlightingStrategy(string name)
        {
            IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter(name);

            if (highlightingStrategy == null)
            {
                return(CreateHighlightingStrategy());
            }
            return(highlightingStrategy);
        }
예제 #19
0
 public void AddHighlightingStrategy(IHighlightingStrategy highlightingStrategy)
 {
     this.highlightingDefs[highlightingStrategy.Name] = highlightingStrategy;
     string[] extensions = highlightingStrategy.Extensions;
     for (int i = 0; i < (int)extensions.Length; i++)
     {
         string name = extensions[i];
         this.extensionsToName[name.ToUpperInvariant()] = highlightingStrategy.Name;
     }
 }
예제 #20
0
        public static IHighlightingStrategy CreateHighlightingStrategy()
        {
            IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter("Default");

            if (highlightingStrategy == null)
            {
                return((IHighlightingStrategy)HighlightingManager.Manager.HighlightingDefinitions["Default"]);
            }

            return(highlightingStrategy);
        }
예제 #21
0
        private void DbViewViewer_Load(object sender, EventArgs e)
        {
            dgv.AutoGenerateColumns = false;
            this.Text      = string.Format("查看视图信息[{0}->{1}]", currentView.Database.Name, currentView.Name);
            dgv.DataSource = DbSchemaHelper.Instance.CurrentSchema.GetViewColumnList(currentView);

            IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(CodeType.TSQL);

            textEditorControl1.Document.HighlightingStrategy = strategy;
            textEditorControl1.Text = currentView.SqlText;
        }
예제 #22
0
 private void PreviewTemplate_Load(object sender, EventArgs e)
 {
     if (File.Exists(_FileName))
     {
         IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(_CodeType);
         textEditorControl1.Document.HighlightingStrategy = strategy;
         textEditorControl1.Text = File.ReadAllText(_FileName);
     }
     this.Text = string.Concat("预览文件 - ", _FileName);
     textEditorControl1.TextChanged += new EventHandler(textEditorControl1_TextChanged);
 }
예제 #23
0
        public void SetDocumentCodeType(string codeType)
        {
            if (string.IsNullOrEmpty(codeType))
            {
                return;
            }
            IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(codeType);

            textEditorControl1.Document.HighlightingStrategy = strategy;
            //textEditorControl1.Document.FoldingManager.FoldingStrategy = FoldingStrategyFactory
        }
예제 #24
0
        public void SetHighlightingForFile(string filename)
        {
            IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighterForFile(filename);

            if (highlightingStrategy != null)
            {
                TextEditor.Document.HighlightingStrategy = highlightingStrategy;
            }
            else
            {
                TextEditor.SetHighlighting("XML");
            }
            TextEditor.Refresh();
        }
예제 #25
0
        /// <summary>
        /// ベースとなるカラーを読み込む
        /// </summary>
        /// <param name="type">設定するカラータイプ</param>
        /// <param name="hs">読み込むカラー情報</param>
        private void loadBaseTypeColor(BaseColorType type, IHighlightingStrategy hs)
        {
            HighlightColor color;

            color            = hs.GetColorFor("Default");
            type.WindowFront = color.Color;
            type.WindowBack  = color.BackgroundColor;

            color = hs.GetColorFor("Selection");
            type.SelectTextFront = color.Color;
            type.SelectTextBack  = color.BackgroundColor;

            color       = hs.GetColorFor("VRuler");
            type.VRuler = color.Color;

            color             = hs.GetColorFor("InvalidLines");
            type.InvalidLines = color.Color;

            color            = hs.GetColorFor("CaretMarker");
            type.CaretMarker = color.Color;

            color = hs.GetColorFor("LineNumbers");
            type.LineNumbersFront = color.Color;
            type.LineNumbersBack  = color.BackgroundColor;

            color = hs.GetColorFor("FoldLine");
            type.FoldLineFront = color.Color;
            type.FoldLineBack  = color.BackgroundColor;

            color = hs.GetColorFor("FoldMarker");
            type.FoldMarkerFront = color.Color;
            type.FoldMarkerBack  = color.BackgroundColor;

            color = hs.GetColorFor("SelectedFoldLine");
            type.SelectFoldLineFront = color.Color;
            type.SelectFoldLineBack  = color.BackgroundColor;

            color           = hs.GetColorFor("EOLMarkers");
            type.EolMarkers = color.Color;

            color            = hs.GetColorFor("SpaceMarkers");
            type.SpaceMakers = color.Color;

            color           = hs.GetColorFor("TabMarkers");
            type.TabMarkers = color.Color;

            color       = ((DefaultHighlightingStrategy)hs).DigitColor;
            type.Digits = color.Color;
        }
예제 #26
0
        private void QueryAnalyzer_Load(object sender, EventArgs e)
        {
            this.Text = FileName;

            IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(CodeType.TSQL);

            textEditorControl1.Document.HighlightingStrategy = strategy;

            if (DbSchemaHelper.Instance.CurrentSchema == null || string.IsNullOrEmpty(SqlText))
            {
                return;
            }

            textEditorControl1.Text = SqlText;
            ExecuteSql();
        }
예제 #27
0
 public virtual void SetSyntaxLanguage(string languageName)
 {
     try
     {
         IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(languageName);
         textEditorControl.Document.HighlightingStrategy = strategy;
         textEditorControl.InitializeAdvancedHighlighter();
         ModuleName    = strategy.Name;
         this.Icon     = Ultility.GetModuleIcon(languageName);
         FileExtension = strategy.Name + " (*" + string.Join(";", strategy.Extensions) + ")|*" +
                         string.Join(";", strategy.Extensions) + "|All File (*.*)|*.*";
     }
     catch (HighlightingDefinitionInvalidException ex)
     {
         MessageBox.Show(Resources.Error__file_format_is_not_supported_, Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #28
0
        private static void SetDefaultTheme(bool isDefault)
        {
            if (Settings.highlight == 0)
            {
                TipGradient = new HighlightColor(Color.White, Color.FromArgb(255, 245, 190));
            }
            else
            {
                IHighlightingStrategy scheme = HighlightingStrategyFactory.CreateHighlightingStrategy("F-Geck");
                TipGradient = scheme.GetColorFor("TipsGradient");
            }

            SelectedHighlight     = new HighlightColor(Color.Black, Color.GreenYellow);
            CodeFunctions         = Color.LightGray;
            HighlightError        = Color.FromArgb(160, Color.Red);
            HighlightIncludeError = Color.Blue;
            IncludeHighlight      = Color.Beige;
            TreeNameFunction      = Color.FromArgb(100, 0, 100); //DarkPurple

            // for form
            if (isDefault)
            {
                return;
            }

            mainForm.FunctionTreeLeft.BackColor = Color.GhostWhite;
            mainForm.FunctionTreeLeft.ForeColor = SystemColors.WindowText;
            mainForm.FunctionTreeLeft.LineColor = Color.Gray;

            Color back = Color.FromArgb(250, 250, 255);

            mainForm.FunctionsTree.BackColor = back;
            mainForm.FunctionsTree.ForeColor = SystemColors.WindowText;
            mainForm.FunctionsTree.LineColor = Color.Gainsboro;

            mainForm.ProcTree.BackColor = back;
            mainForm.ProcTree.ForeColor = SystemColors.WindowText;
            mainForm.ProcTree.LineColor = SystemColors.WindowText;

            mainForm.VarTree.BackColor = back;
            mainForm.VarTree.ForeColor = SystemColors.WindowText;
            mainForm.VarTree.LineColor = SystemColors.WindowText;
        }
 protected override void OnReloadHighlighting(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(FileName))
         {
             IHighlightingStrategy strategy = HighlightingManager.Manager.FindHighlighterForFile(FileName);
             SetHighlighting(strategy.Name);
         }
         else
         {
             SetHighlighting("Z80 Assembly");
         }
     }
     catch (HighlightingDefinitionInvalidException ex)
     {
         DockingService.ShowError("Error loading highlighting", ex);
     }
 }
예제 #30
0
    private void Initialize()
    {
        GenericHelper.SetSize(this, ConfigHandler.EditWindowSize);
        MinimumSize = new Size(700, 500);          // error in .NET

        wordWrapToolStripMenuItem.Checked = Convert.ToBoolean(ConfigHandler.WordWrap);
        descriptionTextBox.WordWrap       = Convert.ToBoolean(ConfigHandler.WordWrap);

        IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter("XML");

        HighlightColor highlightColor = new HighlightColor(Color.Black, Color.WhiteSmoke, false, false);

        ((DefaultHighlightingStrategy)highlightingStrategy).SetColorFor("Default", highlightColor);
        ((DefaultHighlightingStrategy)highlightingStrategy).SetColorFor("LineNumbers", highlightColor);

        xslTextBox.SetHighlighting("XML");
        xslTextBox.Document.HighlightingStrategy = highlightingStrategy;

        xslTextBox.TextEditorProperties.Font = new Font(ConfigHandler.EditorFontFamily, float.Parse(ConfigHandler.EditorFontSize));
        xslTextBox.Font = new Font(ConfigHandler.EditorFontFamily, float.Parse(ConfigHandler.EditorFontSize));
    }
예제 #31
0
        void ChangeSyntax(object sender, EventArgs e)
        {
            if (control != null)
            {
                ButtonItem item = (ButtonItem)sender;
                foreach (ButtonItem i in menuCommands)
                {
                    i.Checked = false;
                }
                item.Checked = true;
                IHighlightingStrategy strat = HighlightingManager.Manager.FindHighlighterByName(item.Text);
                if (strat == null)
                {
                    throw new Exception("高亮度策略没有找到!");
                }

                control.Document.HighlightingStrategy = strat;

                control.Refresh();
            }
        }
예제 #32
0
        public static DocumentLanguage GetDocumentLanguage(EditorControl editor)
        {
            IHighlightingStrategy highlighter = editor.Document.HighlightingStrategy;

            if (highlighter != null)
            {
                if (highlighter.Name == "JavaScript")
                {
                    return(DocumentLanguage.JavaScript);
                }
                else if (highlighter.Name == "Cascading Style Sheet")
                {
                    return(DocumentLanguage.CSS);
                }
                else if ((highlighter.Name == "HTML") || (highlighter.Name == "PHP"))
                {
                    DocumentLanguage docLang = LanguageFinder.GetLanguageFromSegment(editor.Document.GetLineSegmentForOffset(editor.Caret.Offset), editor);
                    return(docLang);
                }
            }
            return(DocumentLanguage.HTML);
        }
 public LineManager(IDocument document, IHighlightingStrategy highlightingStrategy)
 {
   _document = document;
   _highlightingStrategy = highlightingStrategy;
 }
예제 #34
0
		public DefaultLineManager(IDocument document, IHighlightingStrategy highlightingStrategy) 
		{
			this.document = document;
			this.highlightingStrategy  = highlightingStrategy;
		}
예제 #35
0
		/// <summary>
		/// The default constructor.
		/// </summary>
		public CPLTextEditorVM(IHighlightingStrategy p_hltHighlighter, ICplParserFactory p_pftCPLParserFactory)
		{
			HighlightingStrategy = p_hltHighlighter;
			CPLParserFactory = p_pftCPLParserFactory;
		}
 public HqlAdvancedHighlightStrategy(IHighlightingStrategy baseStrategy)
 {
     this.baseStrategy = baseStrategy;
 }