Ejemplo n.º 1
0
        public static void ApplySciSettings(ScintillaControl sci)
        {
            try
            {
                sci.CaretPeriod = MainForm.Settings.CaretPeriod;
                sci.CaretWidth = MainForm.Settings.CaretWidth;
                sci.EOLMode = LineEndDetector.DetectNewLineMarker(sci.Text, (Int32)MainForm.Settings.EOLMode);
                sci.Indent = MainForm.Settings.IndentSize;
                sci.IsBackSpaceUnIndents = true;
                sci.IsCaretLineVisible = false;
                sci.IsTabIndents = true;
                sci.IsUseTabs = true;
                sci.IsViewEOL = false;
                sci.ScrollWidth = MainForm.Settings.ScrollWidth;
                sci.TabWidth = MainForm.Settings.TabWidth;
                sci.ViewWS = Convert.ToInt32(MainForm.Settings.ViewWhitespace);
                sci.WrapMode = Convert.ToInt32(MainForm.Settings.WrapText);
                sci.SetProperty("fold", Convert.ToInt32(MainForm.Settings.UseFolding).ToString());
                sci.SetProperty("fold.comment", Convert.ToInt32(MainForm.Settings.FoldComment).ToString());
                sci.SetProperty("fold.compact", Convert.ToInt32(MainForm.Settings.FoldCompact).ToString());
                sci.SetProperty("fold.preprocessor", Convert.ToInt32(MainForm.Settings.FoldPreprocessor).ToString());
                sci.SetProperty("fold.at.else", Convert.ToInt32(MainForm.Settings.FoldAtElse).ToString());
                sci.SetProperty("fold.html", Convert.ToInt32(MainForm.Settings.FoldHtml).ToString());
                sci.SetFoldFlags((Int32)MainForm.Settings.FoldFlags);

                /**
                * Set correct line number margin width
                */
                Boolean viewLineNumbers = true;
                if (viewLineNumbers) sci.SetMarginWidthN(0, 36);
                else sci.SetMarginWidthN(0, 0);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Updates editor Globals.Settings to the specified ScintillaControl
 /// </summary>
 public static void ApplySciSettings(ScintillaControl sci)
 {
     try
     {
         sci.CaretPeriod = Globals.Settings.CaretPeriod;
         sci.CaretWidth = Globals.Settings.CaretWidth;
         sci.EOLMode = LineEndDetector.DetectNewLineMarker(sci.Text, (Int32)Globals.Settings.EOLMode);
         sci.IsBraceMatching = Globals.Settings.BraceMatchingEnabled;
         sci.UseHighlightGuides = !Globals.Settings.HighlightGuide;
         sci.Indent = Globals.Settings.IndentSize;
         sci.SmartIndentType = Globals.Settings.SmartIndentType;
         sci.IsBackSpaceUnIndents = Globals.Settings.BackSpaceUnIndents;
         sci.IsCaretLineVisible = Globals.Settings.CaretLineVisible;
         sci.IsIndentationGuides = Globals.Settings.ViewIndentationGuides;
         sci.IsTabIndents = Globals.Settings.TabIndents;
         sci.IsUseTabs = Globals.Settings.UseTabs;
         sci.IsViewEOL = Globals.Settings.ViewEOL;
         sci.ScrollWidth = Globals.Settings.ScrollWidth;
         sci.TabWidth = Globals.Settings.TabWidth;
         sci.ViewWS = Convert.ToInt32(Globals.Settings.ViewWhitespace);
         sci.WrapMode = Convert.ToInt32(Globals.Settings.WrapText);
         sci.SetProperty("fold", Convert.ToInt32(Globals.Settings.UseFolding).ToString());
         sci.SetProperty("fold.comment", Convert.ToInt32(Globals.Settings.FoldComment).ToString());
         sci.SetProperty("fold.compact", Convert.ToInt32(Globals.Settings.FoldCompact).ToString());
         sci.SetProperty("fold.preprocessor", Convert.ToInt32(Globals.Settings.FoldPreprocessor).ToString());
         sci.SetProperty("fold.at.else", Convert.ToInt32(Globals.Settings.FoldAtElse).ToString());
         sci.SetProperty("fold.html", Convert.ToInt32(Globals.Settings.FoldHtml).ToString());
         sci.SetFoldFlags((Int32)Globals.Settings.FoldFlags);
         /** 
         * Set correct line number margin width
         */
         Boolean viewLineNumbers = Globals.Settings.ViewLineNumbers;
         if (viewLineNumbers) sci.SetMarginWidthN(1, 31);
         else sci.SetMarginWidthN(1, 0);
         /**
         * Set correct bookmark margin width
         */
         Boolean viewBookmarks = Globals.Settings.ViewBookmarks;
         if (viewBookmarks) sci.SetMarginWidthN(0, 14);
         else sci.SetMarginWidthN(0, 0);
         /**
         * Set correct folding margin width
         */
         Boolean useFolding = Globals.Settings.UseFolding;
         if (!useFolding && !viewBookmarks && !viewLineNumbers) sci.SetMarginWidthN(2, 0);
         else if (useFolding) sci.SetMarginWidthN(2, 15);
         else sci.SetMarginWidthN(2, 2);
         /**
         * Adjust the print margin
         */
         sci.EdgeColumn = Globals.Settings.PrintMarginColumn;
         if (sci.EdgeColumn > 0) sci.EdgeMode = 1;
         else sci.EdgeMode = 0;
         /**
         * Add missing ignored keys
         */
         Int32 count = Globals.MainForm.IgnoredKeys.Count;
         for (Int32 i = 0; i < count; i++)
         {
             Keys keys = (Keys)Globals.MainForm.IgnoredKeys[i];
             if (!sci.ContainsIgnoredKeys(keys))
             {
                 sci.AddIgnoredKeys(keys);
             }
         }
         String lang = sci.ConfigurationLanguage;
         sci.ConfigurationLanguage = lang;
         sci.Colourise(0, -1);
         sci.Refresh();
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
Ejemplo n.º 3
0
		/**
		* Updates editor settings to the specified ScintillaControl
		*/
		private void ApplySciSettings(ScintillaControl sciControl)
		{
			try
			{
				sciControl.CaretPeriod = this.settings.GetInt("FlashDevelop.CaretPeriod");
				sciControl.CaretWidth = this.settings.GetInt("FlashDevelop.CaretWidth");
				sciControl.EOLMode = this.GuessNewLineMarker(sciControl.Text, this.settings.GetInt("FlashDevelop.EOLMode"));
				sciControl.HighlightGuide = Convert.ToInt32(this.settings.GetBool("FlashDevelop.HighlightGuide"));
				sciControl.Indent = this.settings.GetInt("FlashDevelop.IndentSize");
				sciControl.SmartIndentType = (ScintillaNet.Enums.SmartIndent)Enum.Parse(typeof(ScintillaNet.Enums.SmartIndent), this.settings.GetValue("FlashDevelop.SmartIndentType").ToString());
				sciControl.IsBackSpaceUnIndents = this.settings.GetBool("FlashDevelop.BackSpaceUnIndents");
				sciControl.IsCaretLineVisible = this.settings.GetBool("FlashDevelop.CaretLineVisible");
				sciControl.IsIndentationGuides = this.settings.GetBool("FlashDevelop.ViewIndentationGuides");
				sciControl.IsTabIndents = this.settings.GetBool("FlashDevelop.TabIndents");
				sciControl.IsUseTabs = this.settings.GetBool("FlashDevelop.UseTabs");
				sciControl.IsViewEOL = this.settings.GetBool("FlashDevelop.ViewEOL");
				sciControl.ScrollWidth = this.settings.GetInt("FlashDevelop.ScrollWidth");
				sciControl.TabWidth = this.settings.GetInt("FlashDevelop.TabWidth");
				sciControl.ViewWS = Convert.ToInt32(this.settings.GetBool("FlashDevelop.ViewWhitespace"));
				sciControl.WrapMode = Convert.ToInt32(this.settings.GetBool("FlashDevelop.WrapText"));
				sciControl.SetProperty("fold", Convert.ToInt32(this.settings.GetBool("FlashDevelop.UseFolding")).ToString());
				sciControl.SetProperty("fold.comment", Convert.ToInt32(this.settings.GetBool("FlashDevelop.FoldComment")).ToString());
				sciControl.SetProperty("fold.compact", Convert.ToInt32(this.settings.GetBool("FlashDevelop.FoldCompact")).ToString());
				sciControl.SetProperty("fold.preprocessor", Convert.ToInt32(this.settings.GetBool("FlashDevelop.FoldPreprocessor")).ToString());
				sciControl.SetProperty("fold.html", Convert.ToInt32(this.settings.GetBool("FlashDevelop.FoldHtml")).ToString());
				sciControl.SetProperty("fold.at.else", Convert.ToInt32(this.settings.GetBool("FlashDevelop.FoldAtElse")).ToString());
				sciControl.SetFoldFlags(this.settings.GetInt("FlashDevelop.FoldFlags"));
				/** 
				* Set correct line number margin width
				*/
				bool viewLineNumbers = this.settings.GetBool("FlashDevelop.ViewLineNumbers");
				if (viewLineNumbers) sciControl.SetMarginWidthN(1, 31);
				else sciControl.SetMarginWidthN(1, 0);
				/** 
				* Set correct bookmark margin width
				*/
				bool viewBookmarks = this.settings.GetBool("FlashDevelop.ViewBookmarks");
				if (viewBookmarks) sciControl.SetMarginWidthN(0, 14);
				else sciControl.SetMarginWidthN(0, 0);
				/**
				* Set correct folding margin width
				*/
				bool useFolding = this.settings.GetBool("FlashDevelop.UseFolding");
				if (!useFolding && !viewBookmarks && !viewLineNumbers) sciControl.SetMarginWidthN(2, 0);
				else if (useFolding) sciControl.SetMarginWidthN(2, 15);
				else sciControl.SetMarginWidthN(2, 2);
				/**
				* Add ingnored keys defined in mainmenu xml
				*/
				int count = this.xmlBuilder.Shortcuts.Count;
				for (int i = 0; i<count; i++)
				{
					Shortcut shortcut = (Shortcut)this.xmlBuilder.Shortcuts[i];
					if (!sciControl.ContainsIgnoredKey(shortcut))
					{
						sciControl.AddIgnoredKey(shortcut);
					}
				}
			}
			catch (Exception ex)
			{
				ErrorHandler.ShowError("Error while applying scintilla settings", ex);
			}
		}
Ejemplo n.º 4
0
 public static void ApplySciSettings(ScintillaControl sci, Boolean hardUpdate)
 {
     try
     {
         sci.CaretPeriod = Globals.Settings.CaretPeriod;
         sci.CaretWidth = Globals.Settings.CaretWidth;
         sci.EOLMode = LineEndDetector.DetectNewLineMarker(sci.Text, (Int32)Globals.Settings.EOLMode);
         sci.IsBraceMatching = Globals.Settings.BraceMatchingEnabled;
         sci.UseHighlightGuides = !Globals.Settings.HighlightGuide;
         sci.Indent = Globals.Settings.IndentSize;
         sci.SmartIndentType = Globals.Settings.SmartIndentType;
         sci.IsBackSpaceUnIndents = Globals.Settings.BackSpaceUnIndents;
         sci.IsCaretLineVisible = Globals.Settings.CaretLineVisible;
         sci.IsIndentationGuides = Globals.Settings.ViewIndentationGuides;
         sci.IndentView = Globals.Settings.IndentView;
         sci.IsTabIndents = Globals.Settings.TabIndents;
         sci.IsUseTabs = Globals.Settings.UseTabs;
         sci.IsViewEOL = Globals.Settings.ViewEOL;
         sci.ScrollWidth = Globals.Settings.ScrollWidth;
         sci.TabWidth = Globals.Settings.TabWidth;
         sci.ViewWS = Convert.ToInt32(Globals.Settings.ViewWhitespace);
         sci.WrapMode = Convert.ToInt32(Globals.Settings.WrapText);
         sci.SetProperty("fold", Convert.ToInt32(Globals.Settings.UseFolding).ToString());
         sci.SetProperty("fold.comment", Convert.ToInt32(Globals.Settings.FoldComment).ToString());
         sci.SetProperty("fold.compact", Convert.ToInt32(Globals.Settings.FoldCompact).ToString());
         sci.SetProperty("fold.preprocessor", Convert.ToInt32(Globals.Settings.FoldPreprocessor).ToString());
         sci.SetProperty("fold.at.else", Convert.ToInt32(Globals.Settings.FoldAtElse).ToString());
         sci.SetProperty("fold.html", Convert.ToInt32(Globals.Settings.FoldHtml).ToString());
         sci.SetProperty("lexer.cpp.track.preprocessor", "0");
         sci.SetVirtualSpaceOptions((Int32)Globals.Settings.VirtualSpaceMode);
         sci.SetFoldFlags((Int32)Globals.Settings.FoldFlags);
         /**
         * Set if themes should colorize the first margin
         */
         Language language = SciConfig.GetLanguage(sci.ConfigurationLanguage);
         if (language != null && language.editorstyle != null)
         {
             Boolean colorizeMarkerBack = language.editorstyle.ColorizeMarkerBack;
             if (colorizeMarkerBack) sci.SetMarginTypeN(0, (Int32)MarginType.Fore);
             else sci.SetMarginTypeN(0, (Int32)MarginType.Symbol);
         }
         /**
         * Set correct line number margin width
         */
         Boolean viewLineNumbers = Globals.Settings.ViewLineNumbers;
         if (viewLineNumbers) sci.SetMarginWidthN(1, ScaleArea(sci, 36));
         else sci.SetMarginWidthN(1, 0);
         /**
         * Set correct bookmark margin width
         */
         Boolean viewBookmarks = Globals.Settings.ViewBookmarks;
         if (viewBookmarks) sci.SetMarginWidthN(0, ScaleArea(sci, 14));
         else sci.SetMarginWidthN(0, 0);
         /**
         * Set correct folding margin width
         */
         Boolean useFolding = Globals.Settings.UseFolding;
         if (!useFolding && !viewBookmarks && !viewLineNumbers) sci.SetMarginWidthN(2, 0);
         else if (useFolding) sci.SetMarginWidthN(2, ScaleArea(sci, 15));
         else sci.SetMarginWidthN(2, ScaleArea(sci, 2));
         /**
         * Adjust the print margin
         */
         sci.EdgeColumn = Globals.Settings.PrintMarginColumn;
         if (sci.EdgeColumn > 0) sci.EdgeMode = 1;
         else sci.EdgeMode = 0;
         /**
         * Add missing ignored keys
         */
         foreach (Keys keys in ShortcutManager.AllShortcuts)
         {
             if (keys != Keys.None && !sci.ContainsIgnoredKeys(keys))
             {
                 sci.AddIgnoredKeys(keys);
             }
         }
         if (hardUpdate)
         {
             String lang = sci.ConfigurationLanguage;
             sci.ConfigurationLanguage = lang;
         }
         sci.Colourise(0, -1);
         sci.Refresh();
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }