Example #1
0
        static public void InitMarkers(ScintillaControl sci)
        {
            sci.ModEventMask |= (Int32)ScintillaNet.Enums.ModificationFlags.ChangeMarker;
            sci.MarkerChanged += new MarkerChangedHandler(SciControl_MarkerChanged);
			sci.MarginSensitiveN(0, true);
			int mask = sci.GetMarginMaskN(0);
			mask |= GetMarkerMask(markerBPEnabled);
			mask |= GetMarkerMask(markerBPDisabled);
			mask |= GetMarkerMask(markerBPNotAvailable);
			mask |= GetMarkerMask(markerCurrentLine);
			sci.SetMarginMaskN(0, mask);
			sci.MarkerDefinePixmap(markerBPEnabled, ScintillaNet.XPM.ConvertToXPM(Properties.Resource.Enabled, "#00FF00"));
			sci.MarkerDefinePixmap(markerBPDisabled, ScintillaNet.XPM.ConvertToXPM(Properties.Resource.Disabled, "#00FF00"));
            sci.MarkerDefinePixmap(markerCurrentLine, ScintillaNet.XPM.ConvertToXPM(Properties.Resource.CurLine, "#00FF00"));
            Language lang = PluginBase.MainForm.SciConfig.GetLanguage("as3"); // default
			sci.MarkerSetBack(markerBPEnabled, lang.editorstyle.ErrorLineBack); // enable
            sci.MarkerSetBack(markerBPDisabled, lang.editorstyle.DisabledLineBack); // disable
			sci.MarginClick += new MarginClickHandler(SciControl_MarginClick);
            sci.Modified += new ModifiedHandler(sci_Modified);
        }
 static public void InitMarkers(ScintillaControl sci)
 {
     sci.ModEventMask |= (Int32)ModificationFlags.ChangeMarker;
     sci.MarkerChanged += new MarkerChangedHandler(SciControl_MarkerChanged);
     sci.MarginSensitiveN(0, true);
     int mask = sci.GetMarginMaskN(0);
     mask |= GetMarkerMask(markerBPEnabled);
     mask |= GetMarkerMask(markerBPDisabled);
     mask |= GetMarkerMask(markerBPNotAvailable);
     mask |= GetMarkerMask(markerCurrentLine);
     sci.SetMarginMaskN(0, mask);
     var enabledImage = ScaleHelper.Scale(Resource.Enabled);
     var disabledImage = ScaleHelper.Scale(Resource.Disabled);
     var curlineImage = ScaleHelper.Scale(Resource.CurLine);
     sci.MarkerDefineRGBAImage(markerBPEnabled, enabledImage);
     sci.MarkerDefineRGBAImage(markerBPDisabled, disabledImage);
     sci.MarkerDefineRGBAImage(markerCurrentLine, curlineImage);
     Language lang = PluginBase.MainForm.SciConfig.GetLanguage("as3"); // default
     sci.MarkerSetBack(markerBPEnabled, lang.editorstyle.ErrorLineBack); // enable
     sci.MarkerSetBack(markerBPDisabled, lang.editorstyle.DisabledLineBack); // disable
     sci.MarginClick += new MarginClickHandler(SciControl_MarginClick);
     sci.Modified += new ModifiedHandler(sci_Modified);
 }
Example #3
0
		/**
		* Creates a new editor control for the document 
		*/
		public ScintillaControl CreateNewSciControl(string file, string text, int codepage)
		{
			ScintillaControl sciControl = new ScintillaControl();
			sciControl.AutoCSeparator = 32;
			sciControl.AutoCTypeSeparator = 63;
			sciControl.IsAutoCGetAutoHide = true;
			sciControl.IsAutoCGetCancelAtStart = false;
			sciControl.IsAutoCGetChooseSingle = false;
			sciControl.IsAutoCGetDropRestOfWord = false;
			sciControl.IsAutoCGetIgnoreCase = false;
			sciControl.ControlCharSymbol = 0;
			sciControl.CurrentPos = 0;
			sciControl.CursorType = -1;
			sciControl.Dock = System.Windows.Forms.DockStyle.Fill;
			sciControl.DocPointer = 187541976;
			sciControl.EndAtLastLine = 1;
			sciControl.EdgeColumn = 0;
			sciControl.EdgeMode = 0;
			sciControl.IsHScrollBar = true;
			sciControl.IsMouseDownCaptures = true;
			sciControl.IsBufferedDraw = true;
			sciControl.IsOvertype = false;
			sciControl.IsReadOnly = false;
			sciControl.IsUndoCollection = true;
			sciControl.IsVScrollBar = true;
			sciControl.IsUsePalette = true;
			sciControl.IsTwoPhaseDraw = true;
			sciControl.LayoutCache = 1;
			sciControl.Lexer = 3;
			sciControl.Location = new System.Drawing.Point(0, 0);
			sciControl.MarginLeft = 5;
			sciControl.MarginRight = 5;
			sciControl.ModEventMask = this.sciEventMask;
			sciControl.MouseDwellTime = ScintillaControl.MAXDWELLTIME;
			sciControl.Name = "sciControl";
			sciControl.PrintMagnification = 0;
			sciControl.PrintColourMode = (int)ScintillaNet.Enums.PrintOption.Normal;
			sciControl.PrintWrapMode = (int)ScintillaNet.Enums.Wrap.Word;
			sciControl.SearchFlags = 0;
			sciControl.SelectionEnd = 0;
			sciControl.SelectionMode = 0;
			sciControl.SelectionStart = 0;
			sciControl.Size = new System.Drawing.Size(100, 100);
			sciControl.SmartIndentType = ScintillaNet.Enums.SmartIndent.CPP;
			sciControl.Status = 0;
			sciControl.StyleBits = 7;
			sciControl.TabIndex = 0;
			sciControl.TargetEnd = 0;
			sciControl.TargetStart = 0;
			sciControl.WrapStartIndent = 4;
			sciControl.WrapVisualFlagsLocation = (int)ScintillaNet.Enums.WrapVisualLocation.EndByText;
			sciControl.WrapVisualFlags = (int)ScintillaNet.Enums.WrapVisualFlag.End;
			sciControl.XOffset = 0;
			sciControl.ZoomLevel = 0;
			sciControl.UsePopUp(false);
			sciControl.SetMarginTypeN(0, 0);
			sciControl.SetMarginWidthN(0, 14);
			sciControl.SetMarginTypeN(1, 1);
			sciControl.SetMarginMaskN(1, 0);
			sciControl.SetMarginTypeN(2, 0);
			sciControl.SetMarginMaskN(2, -33554432);
			sciControl.MarginSensitiveN(2, true);
			sciControl.MarkerDefinePixmap(0, this.xpmBookmark);
			sciControl.MarkerSetBack((int)ScintillaNet.Enums.MarkerOutline.Folder, 0x777777);
			sciControl.MarkerSetFore((int)ScintillaNet.Enums.MarkerOutline.Folder, 0xFFFFFF);
			sciControl.MarkerSetBack((int)ScintillaNet.Enums.MarkerOutline.FolderOpen, 0x777777);
			sciControl.MarkerSetFore((int)ScintillaNet.Enums.MarkerOutline.FolderOpen, 0xFFFFFF);
			sciControl.MarkerSetBack((int)ScintillaNet.Enums.MarkerOutline.FolderSub, 0x777777);
			sciControl.MarkerSetFore((int)ScintillaNet.Enums.MarkerOutline.FolderSub, 0xFFFFFF);
			sciControl.MarkerSetBack((int)ScintillaNet.Enums.MarkerOutline.FolderTail, 0x777777);
			sciControl.MarkerSetFore((int)ScintillaNet.Enums.MarkerOutline.FolderTail, 0xFFFFFF);
			sciControl.MarkerSetBack((int)ScintillaNet.Enums.MarkerOutline.FolderEnd, 0x777777);
			sciControl.MarkerSetFore((int)ScintillaNet.Enums.MarkerOutline.FolderEnd, 0xFFFFFF);
			sciControl.MarkerSetBack((int)ScintillaNet.Enums.MarkerOutline.FolderOpenMid, 0x777777);
			sciControl.MarkerSetFore((int)ScintillaNet.Enums.MarkerOutline.FolderOpenMid, 0xFFFFFF);
			sciControl.MarkerSetBack((int)ScintillaNet.Enums.MarkerOutline.FolderMidTail, 0x777777);
			sciControl.MarkerSetFore((int)ScintillaNet.Enums.MarkerOutline.FolderMidTail, 0xFFFFFF);
			sciControl.MarkerDefine((int)ScintillaNet.Enums.MarkerOutline.Folder, ScintillaNet.Enums.MarkerSymbol.BoxPlus);
			sciControl.MarkerDefine((int)ScintillaNet.Enums.MarkerOutline.FolderOpen, ScintillaNet.Enums.MarkerSymbol.BoxMinus);
			sciControl.MarkerDefine((int)ScintillaNet.Enums.MarkerOutline.FolderSub, ScintillaNet.Enums.MarkerSymbol.VLine);
			sciControl.MarkerDefine((int)ScintillaNet.Enums.MarkerOutline.FolderTail, ScintillaNet.Enums. MarkerSymbol.LCorner);
			sciControl.MarkerDefine((int)ScintillaNet.Enums.MarkerOutline.FolderEnd, ScintillaNet.Enums.MarkerSymbol.BoxPlusConnected);
			sciControl.MarkerDefine((int)ScintillaNet.Enums.MarkerOutline.FolderOpenMid, ScintillaNet.Enums.MarkerSymbol.BoxMinusConnected);
			sciControl.MarkerDefine((int)ScintillaNet.Enums.MarkerOutline.FolderMidTail, ScintillaNet.Enums.MarkerSymbol.TCorner);
			sciControl.MarkerSetBack((int)ScintillaNet.Enums.MarkerSymbol.Background, SharedUtils.ResolveColor(this.settings.GetValue("FlashDevelop.BookmarkColor")));
			sciControl.CodePage = this.SelectCodePage(codepage);
			sciControl.Encoding = Encoding.GetEncoding(codepage);
			sciControl.Text = SharedUtils.ConvertText(text, codepage, sciControl.CodePage);
			sciControl.Tag = file;
			sciControl.ContextMenu = this.editorMenu;
			sciControl.MarginClick += new MarginClickHandler(this.OnScintillaControlMarginClick);
			sciControl.Modified += new ModifiedHandler(this.OnScintillaControlModified);
			sciControl.UpdateUI += new UpdateUIHandler(this.OnScintillaControlUpdateControl);
			sciControl.URIDropped += new URIDroppedHandler(this.OnScintillaControlDropFiles);
			sciControl.ModifyAttemptRO += new ModifyAttemptROHandler(this.OnScintillaControlModifyRO);
			if (!file.StartsWith("Untitled")) sciControl.IsReadOnly = FileSystem.IsReadOnly(file);
			sciControl.SetFoldFlags(this.settings.GetInt("FlashDevelop.FoldFlags"));
			sciControl.ConfigurationLanguage = this.SciConfig.GetLanguageFromFile(file);
			this.CheckActiveLanguageButton(sciControl.ConfigurationLanguage);
			this.ApplySciSettings(sciControl);
			sciControl.EmptyUndoBuffer();
			UITools.ListenTo(sciControl);
			try 
			{
				bool collapseAll = this.settings.GetBool("FlashDevelop.CollapseAllOnFileOpen");
				if (collapseAll) sciControl.CollapseAllFolds();
			} 
			catch (Exception ex)
			{
				ErrorHandler.ShowError("Error while handling collapse all on file open.", ex);
			}
			return sciControl;
		}
Example #4
0
        /// <summary>
        /// Adds highlights to the correct sci control
        /// </summary>
        private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
        {
            if (matches == null)
            {
                return;
            }

            foreach (SearchMatch match in matches)
            {
                Int32 start = sci.MBSafePosition(match.Index);
                Int32 end = start + sci.MBSafeTextLength(match.Value);
                Int32 line = sci.LineFromPosition(start);
                Int32 position = start;
                Int32 es = sci.EndStyled;
                Int32 mask = 1 << sci.StyleBits;

                sci.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox);
                sci.SetIndicFore(0, DataConverter.ColorToInt32(this.settingObject.highlightColor));
                sci.StartStyling(position, mask);
                sci.SetStyling(end - start, mask);
                sci.StartStyling(es, mask - 1);

                if (this.settingObject.addLineMarker)
                {
                    sci.MarkerAdd(line, 2);
                    sci.MarkerSetBack(2, DataConverter.ColorToInt32(this.settingObject.highlightColor));
                }
            }
        }
 /// <summary>
 /// Adds highlights to the correct sci control
 /// </summary>
 private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
 {
     if (matches == null) return;
     int style = (int)settings.HighlightStyle;
     int color = DataConverter.ColorToInt32(settings.HighlightColor);
     if (settings.HighlightUnderCursorEnabled && prevResult != null)
     {
         if (prevResult.IsPackage) color = DataConverter.ColorToInt32(settings.PackageColor);
         else
         {
             FlagType flags;
             if (prevResult.Type != null && prevResult.Member == null)
             {
                 flags = prevResult.Type.Flags;
                 if ((flags & FlagType.Abstract) > 0) color = DataConverter.ColorToInt32(settings.AbstractColor);
                 else if ((flags & FlagType.TypeDef) > 0) color = DataConverter.ColorToInt32(settings.TypeDefColor);
                 else if ((flags & FlagType.Enum) > 0) color = DataConverter.ColorToInt32(settings.EnumColor);
                 else if ((flags & FlagType.Class) > 0) color = DataConverter.ColorToInt32(settings.ClassColor);
             }
             else if (prevResult.Member != null)
             {
                 flags = prevResult.Member.Flags;
                 if ((flags & FlagType.Constant) > 0) color = DataConverter.ColorToInt32(settings.ConstantColor);
                 else if ((flags & FlagType.ParameterVar) > 0) color = DataConverter.ColorToInt32(settings.MemberFunctionColor);
                 else if ((flags & FlagType.LocalVar) > 0) color = DataConverter.ColorToInt32(settings.LocalVariableColor);
                 else if ((flags & FlagType.Static) == 0)
                 {
                     if ((flags & FlagType.Variable) > 0) color = DataConverter.ColorToInt32(settings.VariableColor);
                     else if ((flags & (FlagType.Setter | FlagType.Getter)) > 0) color = DataConverter.ColorToInt32(settings.AccessorColor);
                     else if ((flags & FlagType.Function) > 0) color = DataConverter.ColorToInt32(settings.MethodColor);
                 }
                 else
                 {
                     if ((flags & FlagType.Variable) > 0) color = DataConverter.ColorToInt32(settings.StaticVariableColor);
                     else if ((flags & (FlagType.Setter | FlagType.Getter)) > 0) color = DataConverter.ColorToInt32(settings.StaticAccessorColor);
                     else if ((flags & FlagType.Function) > 0) color = DataConverter.ColorToInt32(settings.StaticMethodColor);
                 }
             }
         }
     }
     int es = sci.EndStyled;
     int mask = 1 << sci.StyleBits;
     bool addLineMarker = settings.AddLineMarker;
     foreach (SearchMatch match in matches)
     {
         int start = sci.MBSafePosition(match.Index);
         int end = start + sci.MBSafeTextLength(match.Value);
         int line = sci.LineFromPosition(start);
         int position = start;
         sci.SetIndicStyle(0, style);
         sci.SetIndicFore(0, color);
         sci.StartStyling(position, mask);
         sci.SetStyling(end - start, mask);
         sci.StartStyling(es, mask - 1);
         if (addLineMarker)
         {
             sci.MarkerAdd(line, MARKER_NUMBER);
             sci.MarkerSetBack(MARKER_NUMBER, color);
         }
     }
     prevPos = sci.CurrentPos;
 }