Ejemplo n.º 1
0
        public override bool InsertText(string aText)
        {
            if (FActiveArea != ExpressArea.ceaNone)
            {
                switch (FActiveArea)
                {
                case ExpressArea.ceaLeft:
                    FLeftText     = FLeftText.Insert(FCaretOffset, aText);
                    FCaretOffset += (short)aText.Length;
                    this.FormatDirty();
                    return(true);

                case ExpressArea.ceaRight:
                    FRightText    = FRightText.Insert(FCaretOffset, aText);
                    FCaretOffset += (short)aText.Length;
                    this.FormatDirty();
                    return(true);

                default:
                    return(base.InsertText(aText));
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public override bool InsertText(string AText)
        {
            if (FActiveArea != ExpressArea.ceaNone)
            {
                switch (FActiveArea)
                {
                case ExpressArea.ceaLeft:
                    FLeftText        = FLeftText.Insert(FCaretOffset, AText);
                    FCaretOffset    += (short)AText.Length;
                    this.SizeChanged = true;
                    return(true);

                case ExpressArea.ceaRight:
                    FRightText       = FRightText.Insert(FCaretOffset, AText);
                    FCaretOffset    += (short)AText.Length;
                    this.SizeChanged = true;
                    return(true);

                default:
                    return(base.InsertText(AText));
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public override void GetCaretInfo(ref HCCaretInfo aCaretInfo)
        {
            if (FActiveArea != ExpressArea.ceaNone)
            {
                OwnerData.Style.ApplyTempStyle(TextStyleNo);

                switch (FActiveArea)
                {
                case ExpressArea.ceaLeft:
                    if (FCaretOffset < 0)
                    {
                        FCaretOffset = 0;
                    }

                    aCaretInfo.Height = FLeftRect.Bottom - FLeftRect.Top;
                    aCaretInfo.X      = FLeftRect.Left + OwnerData.Style.TempCanvas.TextWidth(FLeftText.Substring(0, FCaretOffset));
                    aCaretInfo.Y      = FLeftRect.Top;
                    break;

                case ExpressArea.ceaTop:
                    if (FCaretOffset < 0)
                    {
                        FCaretOffset = 0;
                    }

                    aCaretInfo.Height = TopRect.Bottom - TopRect.Top;
                    aCaretInfo.X      = TopRect.Left + OwnerData.Style.TempCanvas.TextWidth(TopText.Substring(0, FCaretOffset));
                    aCaretInfo.Y      = TopRect.Top;
                    break;

                case ExpressArea.ceaRight:
                    if (FCaretOffset < 0)
                    {
                        FCaretOffset = 0;
                    }

                    aCaretInfo.Height = FRightRect.Bottom - FRightRect.Top;
                    aCaretInfo.X      = FRightRect.Left + OwnerData.Style.TempCanvas.TextWidth(FRightText.Substring(0, FCaretOffset));
                    aCaretInfo.Y      = FRightRect.Top;
                    break;

                case ExpressArea.ceaBottom:
                    if (FCaretOffset < 0)
                    {
                        FCaretOffset = 0;
                    }

                    aCaretInfo.Height = BottomRect.Bottom - BottomRect.Top;
                    aCaretInfo.X      = BottomRect.Left + OwnerData.Style.TempCanvas.TextWidth(BottomText.Substring(0, FCaretOffset));
                    aCaretInfo.Y      = BottomRect.Top;
                    break;
                }
            }
            else
            {
                aCaretInfo.Visible = false;
            }
        }
Ejemplo n.º 4
0
        public override void KeyDown(KeyEventArgs e)
        {
            if ((FActiveArea == ExpressArea.ceaLeft) || (FActiveArea == ExpressArea.ceaRight))
            {
                switch (e.KeyValue)
                {
                case User.VK_BACK:
                    if (FActiveArea == ExpressArea.ceaLeft)
                    {
                        if (FCaretOffset > 0)
                        {
                            FLeftText = FLeftText.Remove(FCaretOffset - 1, 1);
                            FCaretOffset--;
                        }
                    }
                    else
                    {
                        if (FCaretOffset > 0)
                        {
                            FRightText = FRightText.Remove(FCaretOffset - 1, 1);
                            FCaretOffset--;
                        }
                    }

                    this.FormatDirty();
                    break;

                case User.VK_LEFT:
                    if (FCaretOffset > 0)
                    {
                        FCaretOffset--;
                    }
                    break;

                case User.VK_RIGHT:
                    string vS = FRightText;
                    if (FActiveArea == ExpressArea.ceaLeft)
                    {
                        vS = FLeftText;
                    }

                    if (FCaretOffset < vS.Length)
                    {
                        FCaretOffset++;
                    }
                    break;

                case User.VK_DELETE:
                    if (FActiveArea == ExpressArea.ceaLeft)
                    {
                        if (FCaretOffset < FLeftText.Length)
                        {
                            FLeftText = FLeftText.Remove(FCaretOffset, 1);
                        }
                    }
                    else
                    {
                        if (FCaretOffset < FRightText.Length)
                        {
                            FRightText = FRightText.Remove(FCaretOffset, 1);
                        }
                    }

                    this.FormatDirty();
                    break;

                case User.VK_HOME:
                    FCaretOffset = 0;
                    break;

                case User.VK_END:
                    if (FActiveArea == ExpressArea.ceaLeft)
                    {
                        FCaretOffset = (short)FLeftText.Length;
                    }
                    else
                    {
                        FCaretOffset = (short)FRightText.Length;
                    }

                    break;
                }
            }
            else
            {
                base.KeyDown(e);
            }
        }