当前位置: 首页>>代码示例>>C#>>正文


C# ScintillaControl.LineFromPosition方法代码示例

本文整理汇总了C#中ScintillaNet.ScintillaControl.LineFromPosition方法的典型用法代码示例。如果您正苦于以下问题:C# ScintillaControl.LineFromPosition方法的具体用法?C# ScintillaControl.LineFromPosition怎么用?C# ScintillaControl.LineFromPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScintillaNet.ScintillaControl的用法示例。


在下文中一共展示了ScintillaControl.LineFromPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectMatch

 /// <summary>
 /// Selects a search match
 /// </summary>
 public static void SelectMatch(ScintillaControl sci, SearchMatch match)
 {
     Int32 start = sci.MBSafePosition(match.Index); // wchar to byte position
     Int32 end = start + sci.MBSafeTextLength(match.Value); // wchar to byte text length
     Int32 line = sci.LineFromPosition(start);
     sci.EnsureVisible(line);
     sci.SetSel(start, end);
 }
开发者ID:ImaginationSydney,项目名称:flashdevelop,代码行数:11,代码来源:FRDialogGenerics.cs

示例2: sci_Modified

 static public void sci_Modified(ScintillaControl sender, int position, int modificationType, string text, int length, int linesAdded, int line, int foldLevelNow, int foldLevelPrev)
 {
     if (linesAdded != 0)
     {
         int modline = sender.LineFromPosition(position);
         PluginMain.breakPointManager.UpdateBreakPoint(sender.FileName, modline, linesAdded);
     }
 }
开发者ID:ImaginationSydney,项目名称:flashdevelop,代码行数:8,代码来源:ScintillaHelper.cs

示例3: PositionControl

 public void PositionControl(ScintillaControl sci)
 {
     // compute control location
     Point p = new Point(sci.PointXFromPosition(memberPos), sci.PointYFromPosition(memberPos));
     p = ((Form)PluginBase.MainForm).PointToClient(((Control)sci).PointToScreen(p));
     toolTip.Left = p.X + sci.Left;
     bool hasListUp = !CompletionList.Active || CompletionList.listUp;
     if (currentLine > sci.LineFromPosition(memberPos) || !hasListUp) toolTip.Top = p.Y - toolTip.Height + sci.Top;
     else toolTip.Top = p.Y + UITools.Manager.LineHeight(sci) + sci.Top;
     // Keep on control area
     if (toolTip.Right > ((Form)PluginBase.MainForm).ClientRectangle.Right)
     {
         toolTip.Left = ((Form)PluginBase.MainForm).ClientRectangle.Right - toolTip.Width;
     }
     toolTip.Show();
     toolTip.BringToFront();
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:17,代码来源:MethodCallTip.cs

示例4: CallTipShow

 public void CallTipShow(ScintillaControl sci, int position, string text)
 {
     if (toolTip.Visible && position == memberPos && text == currentText)
         return;
     toolTip.Visible = false;
     currentText = text;
     Text = text;
     AutoSize();
     memberPos = position;
     startPos = memberPos + text.IndexOf('(');
     currentPos = sci.CurrentPos;
     currentLine = sci.LineFromPosition(currentPos);
     PositionControl(sci);
     // state
     isActive = true;
     faded = false;
     UITools.Manager.LockControl(sci);
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:18,代码来源:MethodCallTip.cs

示例5: OnCompletionInsert

        public override bool OnCompletionInsert(ScintillaControl sci, int position, string text, char trigger)
        {
            if (text == "Dictionary")
            {
                string insert = null;
                string line = sci.GetLine(sci.LineFromPosition(position));
                Match m = Regex.Match(line, @"\svar\s+(?<varname>.+)\s*:\s*Dictionary\.<(?<indextype>.+)(?=(>\s*=))");
                if (m.Success)
                {
                    insert = String.Format(".<{0}>", m.Groups["indextype"].Value);
                }
                else
                {
                    m = Regex.Match(line, @"\s*=\s*new");
                    if (m.Success)
                    {
                        ASResult result = ASComplete.GetExpressionType(sci, sci.PositionFromLine(sci.LineFromPosition(position)) + m.Index);
                        if (result != null && !result.IsNull() && result.Member != null && result.Member.Type != null)
                        {
                            m = Regex.Match(result.Member.Type, @"(?<=<).+(?=>)");
                            if (m.Success)
                            {
                                insert = String.Format(".<{0}>", m.Value);
                            }
                        }
                    }
                    if (insert == null)
                    {
                        if (trigger == '.' || trigger == '(') return true;
                        insert = ".<>";
                        sci.InsertText(position + text.Length, insert);
                        sci.CurrentPos = position + text.Length + 2;
                        sci.SetSel(sci.CurrentPos, sci.CurrentPos);
                        ASComplete.HandleAllClassesCompletion(sci, "", false, true);
                        return true;
                    }
                }
                if (insert == null) return false;
                if (trigger == '.')
                {
                    sci.InsertText(position + text.Length, insert.Substring(1));
                    sci.CurrentPos = position + text.Length;
                }
                else
                {
                    sci.InsertText(position + text.Length, insert);
                    sci.CurrentPos = position + text.Length + insert.Length;
                }
                sci.SetSel(sci.CurrentPos, sci.CurrentPos);
                return true;
            }

            return base.OnCompletionInsert(sci, position, text, trigger);
        }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:54,代码来源:Context.cs

示例6: OnScintillaControlMarginClick

		/**
		* Provides a basic folding service and notifies 
		* the plugins for the MarginClick event
		*/
		public void OnScintillaControlMarginClick(ScintillaControl sci, int modifiers, int position, int margin)
		{
			if (margin == 2) 
			{
				int line = sci.LineFromPosition(position);
				sci.ToggleFold(line);
			}
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:12,代码来源:MainForm.cs

示例7: OnScintillaControlMarginClick

 /// <summary>
 /// Provides a basic folding service and notifies the plugins for the MarginClick event
 /// </summary>
 public void OnScintillaControlMarginClick(ScintillaControl sci, Int32 modifiers, Int32 position, Int32 margin)
 {
     if (margin == 2)
     {
         Int32 line = sci.LineFromPosition(position);
         if (Control.ModifierKeys == Keys.Control) MarkerManager.ToggleMarker(sci, 0, line);
         else sci.ToggleFold(line);
     }
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:12,代码来源:MainForm.cs

示例8: OnScintillaControlUpdateControl

 /// <summary>
 /// Refreshes the statusbar display and updates the important edit buttons
 /// </summary>
 public void OnScintillaControlUpdateControl(ScintillaControl sci)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke((MethodInvoker)delegate { this.OnScintillaControlUpdateControl(sci); });
         return;
     }
     ITabbedDocument document = DocumentManager.FindDocument(sci);
     if (sci != null && document != null && document.IsEditable)
     {
         Int32 column = sci.Column(sci.CurrentPos) + 1;
         Int32 line = sci.LineFromPosition(sci.CurrentPos) + 1;
         String statusText = " " + TextHelper.GetString("Info.StatusText");
         String file = PathHelper.GetCompactPath(sci.FileName);
         String eol = (sci.EOLMode == 0) ? "CR+LF" : ((sci.EOLMode == 1) ? "CR" : "LF");
         String encoding = ButtonManager.GetActiveEncodingName();
         this.toolStripStatusLabel.Text = String.Format(statusText, line, column, eol, encoding, file);
     }
     else this.toolStripStatusLabel.Text = " ";
     this.OnUpdateMainFormDialogTitle();
     ButtonManager.UpdateFlaggedButtons();
     NotifyEvent ne = new NotifyEvent(EventType.UIRefresh);
     EventManager.DispatchEvent(this, ne);
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:27,代码来源:MainForm.cs

示例9: MoveToPosition

 /// <summary>
 /// Move the document position
 /// </summary>
 private void MoveToPosition(ScintillaControl sci, Int32 position)
 {
     try
     {
         position = sci.MBSafePosition(position); // scintilla indexes are in 8bits
         Int32 line = sci.LineFromPosition(position);
         sci.EnsureVisible(line);
         sci.GotoPos(position);
         sci.SetSel(position, sci.LineEndPosition(line));
         sci.Focus();
     }
     catch 
     {
         String message = TextHelper.GetString("Info.InvalidItem");
         ErrorManager.ShowInfo(message);
         this.RemoveInvalidItems();
         this.RefreshProject();
     }
 }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:22,代码来源:PluginUI.cs

示例10: AddLookupPosition

 private static void AddLookupPosition(ScintillaControl sci)
 {
     if (lookupPosition >= 0 && sci != null)
     {
         int lookupLine = sci.LineFromPosition(lookupPosition);
         int lookupCol = lookupPosition - sci.PositionFromLine(lookupLine);
         // TODO: Refactor, doesn't make a lot of sense to have this feature inside the Panel
         ASContext.Panel.SetLastLookupPosition(sci.FileName, lookupLine, lookupCol);
     }
 }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:10,代码来源:ASGenerator.cs

示例11: AddInterfaceDefJob

        private static void AddInterfaceDefJob(ClassModel inClass, ScintillaControl sci, MemberModel member, string interf)
        {
            ClassModel aType = ASContext.Context.ResolveType(interf, ASContext.Context.CurrentModel);
            if (aType.IsVoid()) return;

            FileModel fileModel = ASFileParser.ParseFile(ASContext.Context.CreateFileModel(aType.InFile.FileName));
            foreach (ClassModel cm in fileModel.Classes)
            {
                if (cm.QualifiedName.Equals(aType.QualifiedName))
                {
                    aType = cm;
                    break;
                }
            }

            string template = TemplateUtils.GetTemplate("IFunction");
            if ((member.Flags & FlagType.Getter) > 0)
            {
                template = TemplateUtils.GetTemplate("IGetter");
            }
            else if ((member.Flags & FlagType.Setter) > 0)
            {
                template = TemplateUtils.GetTemplate("ISetter");
            }

            ASContext.MainForm.OpenEditableDocument(aType.InFile.FileName, true);
            sci = ASContext.CurSciControl;

            MemberModel latest = GetLatestMemberForFunction(aType, Visibility.Default, new MemberModel());
            int position;
            if (latest == null)
            {
                position = GetBodyStart(aType.LineFrom, aType.LineTo, sci);
            }
            else
            {
                position = sci.PositionFromLine(latest.LineTo + 1) - ((sci.EOLMode == 0) ? 2 : 1);
                template = NewLine + template;
            }
            sci.SetSel(position, position);
            sci.CurrentPos = position;

            IASContext context = ASContext.Context;
            ContextFeatures features = context.Features;

            template = TemplateUtils.ToDeclarationString(member, template);
            template = TemplateUtils.ReplaceTemplateVariable(template, "BlankLine", NewLine);
            template = TemplateUtils.ReplaceTemplateVariable(template, "Void", features.voidKey);

            List<string> importsList = new List<string>();
            string t;
            List<MemberModel> parms = member.Parameters;
            if (parms != null && parms.Count > 0)
            {
                for (int i = 0; i < parms.Count; i++)
                {
                    if (parms[i].Type != null)
                    {
                        t = GetQualifiedType(parms[i].Type, inClass); 
                        importsList.Add(t);
                    }
                }
            }

            if (member.Type != null)
            {
                t = GetQualifiedType(member.Type, inClass);
                importsList.Add(t);
            }

            if (importsList.Count > 0)
            {
                int o = AddImportsByName(importsList, sci.LineFromPosition(position));
                position += o;
                
            }

            sci.SetSel(position, position);
            sci.CurrentPos = position;

            InsertCode(position, template, sci);
        }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:82,代码来源:ASGenerator.cs

示例12: ChangeDecl

        private static void ChangeDecl(ScintillaControl sci, MemberModel memberModel, List<FunctionParameter> functionParameters)
        {
            bool paramsDiffer = false;
            if (memberModel.Parameters != null)
            {
                // check that parameters have one and the same type
                if (memberModel.Parameters.Count == functionParameters.Count)
                {
                    if (functionParameters.Count > 0)
                    {
                        List<MemberModel> parameters = memberModel.Parameters;
                        for (int i = 0; i < parameters.Count; i++)
                        {
                            MemberModel p = parameters[i];
                            if (p.Type != functionParameters[i].paramType)
                            {
                                paramsDiffer = true;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    paramsDiffer = true;
                }
            }
            // check that parameters count differs
            else if (functionParameters.Count != 0)
            {
                paramsDiffer = true;
            }

            if (paramsDiffer)
            {
                int app = 0;
                List<MemberModel> newParameters = new List<MemberModel>();
                List<MemberModel> existingParameters = memberModel.Parameters;
                for (int i = 0; i < functionParameters.Count; i++)
                {
                    FunctionParameter p = functionParameters[i];
                    if (existingParameters != null
                        && existingParameters.Count > (i - app)
                        && existingParameters[i - app].Type == p.paramType)
                    {
                        newParameters.Add(existingParameters[i - app]);
                    }
                    else
                    {
                        if (existingParameters != null && existingParameters.Count < functionParameters.Count)
                        {
                            app++;
                        }
                        newParameters.Add(new MemberModel(p.paramName, p.paramType, FlagType.ParameterVar, 0));
                    }
                }
                memberModel.Parameters = newParameters;

                int posStart = sci.PositionFromLine(memberModel.LineFrom);
                int posEnd = sci.LineEndPosition(memberModel.LineTo);
                sci.SetSel(posStart, posEnd);
                string selectedText = sci.SelText;
                Regex rStart = new Regex(@"\s{1}" + memberModel.Name + @"\s*\(([^\)]*)\)(\s*:\s*([^({{|\n|\r|\s|;)]+))?");
                Match mStart = rStart.Match(selectedText);
                if (!mStart.Success)
                {
                    return;
                }

                int start = mStart.Index + posStart;
                int end = start + mStart.Length;

                sci.SetSel(start, end);

                string decl = TemplateUtils.ToDeclarationString(memberModel, TemplateUtils.GetTemplate("MethodDeclaration"));
                InsertCode(sci.CurrentPos, "$(Boundary) " + decl, sci);

                // add imports to function argument types
                if (functionParameters.Count > 0)
                {
                    List<string> l = new List<string>();
                    foreach (FunctionParameter fp in functionParameters)
                    {
                        try
                        {
                            l.Add(fp.paramQualType);
                        }
                        catch (Exception)
                        {
                        }
                    }
                    start += AddImportsByName(l, sci.LineFromPosition(end));
                }

                sci.SetSel(start, start);
            }
        }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:97,代码来源:ASGenerator.cs

示例13: AssignStatementToVar

        private static void AssignStatementToVar(ClassModel inClass, ScintillaControl sci, MemberModel member)
        {
            int lineNum = sci.CurrentLine;
            string line = sci.GetLine(lineNum);
            StatementReturnType returnType = GetStatementReturnType(sci, inClass, line, sci.PositionFromLine(lineNum));

            if (returnType == null) return;
            
            string type = null;
            string varname = null;
            ASResult resolve = returnType.resolve;
            string word = returnType.word;

            if (resolve != null && !resolve.IsNull())
            {
                if (resolve.Member != null && resolve.Member.Type != null)
                {
                    type = resolve.Member.Type;
                }
                else if (resolve.Type != null && resolve.Type.Name != null)
                {
                    type = resolve.Type.QualifiedName;
                }

                if (resolve.Member != null && resolve.Member.Name != null)
                {
                    varname = GuessVarName(resolve.Member.Name, type);
                }
            }

            if (!string.IsNullOrEmpty(word) && Char.IsDigit(word[0])) word = null;

            if (!string.IsNullOrEmpty(word) && (string.IsNullOrEmpty(type) || Regex.IsMatch(type, "(<[^]]+>)")))
                word = null;

            if (!string.IsNullOrEmpty(type) && type.Equals("void", StringComparison.OrdinalIgnoreCase))
                type = null;

            if (varname == null) varname = GuessVarName(word, type);

            if (varname != null && varname == word)
                varname = varname.Length == 1 ? varname + "1" : varname[0] + "";

            string cleanType = null;
            if (type != null) cleanType = FormatType(GetShortType(type));
            
            string template = TemplateUtils.GetTemplate("AssignVariable");
            template = TemplateUtils.ReplaceTemplateVariable(template, "Name", varname);
            template = TemplateUtils.ReplaceTemplateVariable(template, "Type", cleanType);

            int indent = sci.GetLineIndentation(lineNum);
            int pos = sci.PositionFromLine(lineNum) + indent / sci.Indent;

            sci.CurrentPos = pos;
            sci.SetSel(pos, pos);
            InsertCode(pos, template, sci);

            if (type != null)
            {
                ClassModel inClassForImport = null;
                if (resolve.InClass != null)
                {
                    inClassForImport = resolve.InClass;
                }
                else if (resolve.RelClass != null)
                {
                    inClassForImport = resolve.RelClass;
                }
                else 
                {
                    inClassForImport = inClass;
                }
                List<string> l = new List<string>();
                l.Add(GetQualifiedType(type, inClassForImport));
                pos += AddImportsByName(l, sci.LineFromPosition(pos));
            }
        }
开发者ID:JoeRobich,项目名称:flashdevelop,代码行数:77,代码来源:ASGenerator.cs

示例14: GoToLineEnd

        public static void GoToLineEnd(ScintillaControl sci, Boolean insertNewLine)
        {
            sci.GotoPos(sci.LineEndPosition(sci.LineFromPosition(sci.CurrentPos)));

            if (insertNewLine) sci.NewLine();
        }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:6,代码来源:PluginMain.cs

示例15: PositionInfos

        public PositionInfos(ScintillaControl sci, Int32 position, String argString)
        {
            // Variables
            String[] vars = argString.Split('¤');
            this.ArgCurWord = vars[0];
            this.ArgPackageName = vars[1];
            this.ArgClassName = vars[2];
            this.ArgClassType = vars[3];
            this.ArgMemberName = vars[4];
            this.ArgMemberType = vars[5];

            // Selection
            Int32 ss = sci.SelectionStart;
            Int32 se = sci.SelectionEnd;
            if (se != ss)
            {
                this.SelectionStart = ss;
                this.SelectionEnd = se;
                this.HasSelection = true;
                if (sci.LineFromPosition(ss) != sci.LineFromPosition(se))
                    this.SelectionIsMultiline = true;
                else SelectedText = sci.SelText;
            }

            // Current
            this.CurrentPosition = position;
            this.CurrentCharCode = sci.CharAt(position);
            this.CurrentIsWhiteChar = (HelpTools.IsWhiteChar(this.CurrentCharCode));
            this.CurrentIsDotChar = (this.CurrentCharCode == 46);
            this.CurrentIsActionScriptChar = HelpTools.IsActionScriptChar(this.CurrentCharCode);
            this.CurrentIsWordChar = HelpTools.IsWordChar((byte)this.CurrentCharCode);
            Int32 s = sci.StyleAt(position);
            this.CurrentIsInsideComment = (s == 1 || s == 2 || s == 3 || s == 17);

            // Next
            Int32 np = sci.PositionAfter(position);
            if (np != position)
                this.NextPosition = np;
            else
                this.CaretIsAtEndOfDocument = true;

            // Word
            this.CodePage = sci.CodePage; // (UTF-8|Big Endian|Little Endian : 65001) (8 Bits|UTF-7 : 0)
            
            if (this.CurrentIsInsideComment == false && this.SelectionIsMultiline == false)
            {
                Int32 wsp = sci.WordStartPosition(position, true);
                // Attention (WordEndPosition n'est pas estimé comme par defaut)
                Int32 wep = sci.PositionBefore(sci.WordEndPosition(position, true));

                if (this.CodePage != 65001)
                {
                    wsp = HelpTools.GetWordStartPositionByWordChar(sci, position);
                    // Attention (WordEndPosition n'est pas estimé comme par defaut)
                    wep = sci.PositionBefore(HelpTools.GetWordEndPositionByWordChar(sci, position));
                }

                this.WordStartPosition = wsp;
                this.WordEndPosition = wep;

                if (this.CodePage == 65001)
                    this.WordFromPosition = this.ArgCurWord;
                else
                    this.WordFromPosition = HelpTools.GetText(sci, wsp, sci.PositionAfter(wep));

                if (position > wep)
                    this.CaretIsAfterLastLetter = true;
            }
            
            // Previous
            if (this.CurrentPosition > 0)
            {
                this.PreviousPosition = sci.PositionBefore(position);
                this.PreviousCharCode = sci.CharAt(this.PreviousPosition);
                this.PreviousIsWhiteChar = HelpTools.IsWhiteChar(this.PreviousCharCode);
                this.PreviousIsDotChar = (this.PreviousCharCode == 46);
                this.PreviousIsActionScriptChar = HelpTools.IsActionScriptChar(this.PreviousCharCode);
            }

            // Line
            this.CurrentLineIdx = sci.LineFromPosition(position);
            if (this.CurrentPosition > 0)
                this.PreviousLineIdx = sci.LineFromPosition(this.PreviousPosition);

            this.LineIdxMax = sci.LineCount - 1;
            this.LineStartPosition = HelpTools.LineStartPosition(sci, this.CurrentLineIdx);
            this.LineEndPosition = sci.LineEndPosition(this.CurrentLineIdx);
            this.NewLineMarker = LineEndDetector.GetNewLineMarker(sci.EOLMode);

            // Previous / Next
            if (this.WordStartPosition != -1)
            {
                this.PreviousNonWhiteCharPosition = HelpTools.PreviousNonWhiteCharPosition(sci, this.WordStartPosition);
                this.PreviousWordIsFunction = (sci.GetWordFromPosition(this.PreviousNonWhiteCharPosition) == "function");
                this.NextNonWhiteCharPosition = HelpTools.NextNonWhiteCharPosition(sci, this.WordEndPosition);
            }

            // Function
            if (this.PreviousWordIsFunction)
            {
//.........这里部分代码省略.........
开发者ID:heon21st,项目名称:flashdevelop,代码行数:101,代码来源:PluginMain.cs


注:本文中的ScintillaNet.ScintillaControl.LineFromPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。