UpdateLine() private method

private UpdateLine ( int line ) : void
line int
return void
Beispiel #1
0
        public void UpdateCaretPosition()
        {
            if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line)
            {
                textArea.UpdateLine(oldLine);
                textArea.UpdateLine(line);
            }
            oldLine = line;


            if (hidden || textArea.MotherTextEditorControl.IsUpdating)
            {
                return;
            }
            try {
                if (!caretCreated)
                {
                    CreateCaret();
                }
                if (caretCreated)
                {
                    ValidateCaretPos();
                    int lineNr = this.line;
                    int xpos   = textArea.TextView.GetDrawingXPos(lineNr, this.column);
                    //LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
                    Point pos = ScreenPosition;
                    if (xpos >= 0)
                    {
                        bool success = SetCaretPos(pos.X, pos.Y);
                        if (!success)
                        {
                            DestroyCaret();
                            caretCreated = false;
                            UpdateCaretPosition();
                        }
                    }
                    // set the input method editor location
                    if (ime == null)
                    {
                        ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
                    }
                    else
                    {
                        ime.Font = textArea.Document.TextEditorProperties.Font;
                    }
                    ime.SetIMEWindowLocation(pos.X + 2,
                                             pos.Y);

                    currentPos = pos;
                }
            } catch (Exception e) {
                Console.WriteLine("Got exception while update caret position : " + e);
            }
        }
Beispiel #2
0
 void CaretTimerTick(object sender, EventArgs e)
 {
     blink = !blink;
     if (visible)
     {
         textArea.UpdateLine(parentCaret.Line);
     }
 }
        public void HandleMouseDown(Point mousePos, MouseButtons mouseButtons)
        {
            int clickedVisibleLine = (mousePos.Y + TextArea.VirtualTop.Y) / TextArea._FontHeight;
            int lineNumber         = TextArea.Document.GetFirstLogicalLine(clickedVisibleLine);

            if ((mouseButtons & MouseButtons.Right) == MouseButtons.Right)
            {
                if (TextArea.Caret.Line != lineNumber)
                {
                    TextArea.Caret.Line = lineNumber;
                }
            }

            IList <Bookmark> marks       = TextArea.Document.BookmarkManager.Marks;
            List <Bookmark>  marksInLine = new List <Bookmark>();
            int oldCount = marks.Count;

            foreach (Bookmark mark in marks)
            {
                if (mark.LineNumber == lineNumber)
                {
                    marksInLine.Add(mark);
                }
            }

            for (int i = marksInLine.Count - 1; i >= 0; i--)
            {
                Bookmark mark = marksInLine[i];
                if (mark.Click(TextArea, new MouseEventArgs(mouseButtons, 1, mousePos.X, mousePos.Y, 0)))
                {
                    if (oldCount != marks.Count)
                    {
                        TextArea.UpdateLine(lineNumber);
                    }
                    return;
                }
            }

            MouseDown?.Invoke(this, mousePos, mouseButtons);
        }
Beispiel #4
0
        public void UpdateCaretPosition()
        {
            Log("UpdateCaretPosition");

            if (caretImplementation.RequireRedrawOnPositionChange)
            {
                textArea.UpdateLine(oldLine);
                if (line != oldLine)
                {
                    textArea.UpdateLine(line);
                }
            }
            else
            {
                if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line)
                {
                    textArea.UpdateLine(oldLine);
                    textArea.UpdateLine(line);
                }
            }
            oldLine = line;


            if (hidden || textArea.MotherTextEditorControl.IsInUpdate)
            {
                outstandingUpdate = true;
                return;
            }
            else
            {
                outstandingUpdate = false;
            }
            ValidateCaretPos();
            int lineNr = this.line;
            int xpos   = textArea.TextView.GetDrawingXPos(lineNr, this.column);
            //LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
            Point pos = ScreenPosition;

            if (xpos >= 0)
            {
                CreateCaret();
                bool success = caretImplementation.SetPosition(pos.X, pos.Y);
                if (!success)
                {
                    caretImplementation.Destroy();
                    caretCreated = false;
                    UpdateCaretPosition();
                }
            }
            else
            {
                caretImplementation.Destroy();
            }

            // set the input method editor location
            if (ime == null)
            {
                ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
            }
            else
            {
                ime.HWnd = textArea.Handle;
                ime.Font = textArea.Document.TextEditorProperties.Font;
            }
            ime.SetIMEWindowLocation(pos.X, pos.Y);

            currentPos = pos;
        }
Beispiel #5
0
        public void UpdateCaretPosition()
        {
            //Console.WriteLine("updatecaret " + ScreenPosition.X+"-"+ScreenPosition.Y+"-"+oldLine+"-"+line);
            if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
            {
                if (oldLine != line)
                {
                    //Console.WriteLine(oldLine + "-" + line);
                    textArea.UpdateLine(oldLine);
                    //textArea.UpdateLine(line);
                }
            }
            else
            {
                if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line)
                {
                    textArea.UpdateLine(oldLine);
                    textArea.UpdateLine(line);
                }
            }


            oldLine = line;


            if (hidden || textArea.MotherTextEditorControl.IsInUpdate)
            {
                return;
            }

            //DisposeCaret();
            //Console.WriteLine("updatecaret " + ScreenPosition.X + "-" + ScreenPosition.Y + "-" + oldLine + "-" + line);

            if (!caretCreated)
            {
                CreateCaret();
            }
            if (caretCreated)
            {
                ValidateCaretPos();
                int lineNr = this.line;
                int xpos   = textArea.TextView.GetDrawingXPos(lineNr, this.column);
                //LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
                Point pos = ScreenPosition;
                if (xpos >= 0)
                {
                    bool success = SetCaretPos(pos.X, pos.Y);
                    if (!success)
                    {
                        DestroyCaret();
                        caretCreated = false;
                        UpdateCaretPosition();
                    }
                }
                // set the input method editor location

                /*if (ime == null) {
                 *      ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
                 * } else {
                 *      ime.HWnd = textArea.Handle;
                 *      ime.Font = textArea.Document.TextEditorProperties.Font;
                 * }
                 * ime.SetIMEWindowLocation(pos.X, pos.Y);*/

                currentPos = pos;
            }
        }
        public void UpdateCaretPosition()
        {
            if (Shared.TEP.CaretLine)
            {
                _textArea.Invalidate();
            }
            else
            {
                if (_caretImplementation.RequireRedrawOnPositionChange)
                {
                    _textArea.UpdateLine(_oldLine);
                    if (_line != _oldLine)
                    {
                        _textArea.UpdateLine(_line);
                    }
                }
                else
                {
                    if (Shared.TEP.LineViewerStyle == LineViewerStyle.FullRow && _oldLine != _line)
                    {
                        _textArea.UpdateLine(_oldLine);
                        _textArea.UpdateLine(_line);
                    }
                }
            }
            _oldLine = _line;

            if (_hidden || _textArea.MotherTextEditorControl.IsInUpdate)
            {
                _outstandingUpdate = true;
                return;
            }
            else
            {
                _outstandingUpdate = false;
            }

            ValidateCaretPos();
            int lineNr = _line;
            int xpos   = _textArea.GetDrawingXPos(lineNr, this._column);
            //LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
            Point pos = ScreenPosition;

            if (xpos >= 0)
            {
                CreateCaret();
                bool success = _caretImplementation.SetPosition(pos.X, pos.Y);
                if (!success)
                {
                    _caretImplementation.Destroy();
                    _caretCreated = false;
                    UpdateCaretPosition();
                }
            }
            else
            {
                _caretImplementation.Destroy();
            }

            //// set the input method editor location
            //if (ime == null)
            //{
            //    ime = new Ime(textArea.Handle, Shared.FontContainer.DefaultFont);
            //}
            //else
            //{
            //    ime.HWnd = textArea.Handle;
            //    ime.Font = Shared.FontContainer.DefaultFont;
            //}
            //ime.SetIMEWindowLocation(pos.X, pos.Y);

            _currentPos = pos;
        }