Exemple #1
0
        public override bool InsertText(string aText)
        {
            if (FActiveArea != ExpressArea.ceaNone)
            {
                if (FActiveArea == ExpressArea.ceaTop)
                {
                    FSupText = FSupText.Insert(FCaretOffset, aText);
                }
                else
                if (FActiveArea == ExpressArea.ceaBottom)
                {
                    FSubText = FSubText.Insert(FCaretOffset, aText);
                }

                FCaretOffset += (short)aText.Length;
                this.FormatDirty();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        public override bool InsertText(string AText)
        {
            if (FActiveArea != ExpressArea.ceaNone)
            {
                if (FActiveArea == ExpressArea.ceaTop)
                {
                    FSupText = FSupText.Insert(FCaretOffset, AText);
                }
                else
                if (FActiveArea == ExpressArea.ceaBottom)
                {
                    FSubText = FSubText.Insert(FCaretOffset, AText);
                }

                FCaretOffset    += (short)AText.Length;
                this.SizeChanged = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
 public override void GetCaretInfo(ref HCCaretInfo aCaretInfo)
 {
     if (FActiveArea != ExpressArea.ceaNone)
     {
         ApplySupSubStyle(OwnerData.Style.TextStyles[TextStyleNo], OwnerData.Style.TempCanvas);
         if (FActiveArea == ExpressArea.ceaTop)
         {
             aCaretInfo.Height = FSupRect.Bottom - FSupRect.Top;
             aCaretInfo.X      = FSupRect.Left + OwnerData.Style.TempCanvas.TextWidth(FSupText.Substring(0, FCaretOffset));
             aCaretInfo.Y      = FSupRect.Top;
         }
         else
         if (FActiveArea == ExpressArea.ceaBottom)
         {
             aCaretInfo.Height = FSubRect.Bottom - FSubRect.Top;
             aCaretInfo.X      = FSubRect.Left + OwnerData.Style.TempCanvas.TextWidth(FSubText.Substring(0, FCaretOffset));
             aCaretInfo.Y      = FSubRect.Top;
         }
     }
     else
     {
         aCaretInfo.Visible = false;
     }
 }
Exemple #4
0
        public override void KeyDown(KeyEventArgs e)
        {
            switch (e.KeyValue)
            {
            case User.VK_BACK:
                if (FActiveArea == ExpressArea.ceaTop)
                {
                    if (FCaretOffset > 0)
                    {
                        FSupText = FSupText.Remove(FCaretOffset - 1, 1);
                        FCaretOffset--;
                    }
                }
                else
                if (FActiveArea == ExpressArea.ceaBottom)
                {
                    if (FCaretOffset > 0)
                    {
                        FSubText = FSubText.Remove(FCaretOffset - 1, 1);
                        FCaretOffset--;
                    }
                }

                this.FormatDirty();
                break;

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

            case User.VK_RIGHT:
                string vS = "";
                if (FActiveArea == ExpressArea.ceaTop)
                {
                    vS = FSupText;
                }
                else
                if (FActiveArea == ExpressArea.ceaBottom)
                {
                    vS = FSubText;
                }

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

            case User.VK_DELETE:
                if (FActiveArea == ExpressArea.ceaTop)
                {
                    if (FCaretOffset < FSupText.Length)
                    {
                        FSupText = FSupText.Remove(FCaretOffset, 1);
                    }
                }
                else
                if (FActiveArea == ExpressArea.ceaBottom)
                {
                    if (FCaretOffset < FSubText.Length)
                    {
                        FSubText = FSubText.Remove(FCaretOffset, 1);
                    }
                }

                this.FormatDirty();
                break;

            case User.VK_HOME:
                FCaretOffset = 0;
                break;

            case User.VK_END:
                if (FActiveArea == ExpressArea.ceaTop)
                {
                    FCaretOffset = (short)FSupText.Length;
                }
                else
                if (FActiveArea == ExpressArea.ceaBottom)
                {
                    FCaretOffset = (short)FSubText.Length;
                }
                break;
            }
        }