コード例 #1
0
ファイル: BaseAction.cs プロジェクト: Belial2010/eidtText
        private void SetStartLinePoint(ResultPuckerListData puckerData, bool isStart = true)
        {
            if (puckerData != null)
            {
                if (isStart)
                {
                    this.PParser.GetSelectPartPoint[0].LineWidth += puckerData.LineLeavingWidth;
                }

                var endPoint = this.PParser.GetSelectPartPoint[1];
                endPoint.X               += puckerData.LineLeavingWidth;
                endPoint.LineWidth       += puckerData.LineLeavingWidth;
                endPoint.LineStringIndex += Math.Max(0, puckerData.LineLeavingLength - 1);
                if (puckerData.PuckerCount > 0)
                {
                    endPoint.Y += puckerData.PuckerCount * FontContainer.FontHeight;
                    if (puckerData.LastChildLS != null)
                    {
                        endPoint.X               = this.PParser.GetLeftSpace + puckerData.LastChildLS.Width;
                        endPoint.LineWidth       = puckerData.LastChildLS.Width;
                        endPoint.LineStringIndex = puckerData.LastChildLS.Length - 1;
                    }
                }
                if (puckerData.PuckerLineStringAndY != null && puckerData.PuckerLineStringAndY.Count > 0)
                {
                    this.DeleteSeelctPuckerLineStringAndY = puckerData.PuckerLineStringAndY;
                }
            }
        }
コード例 #2
0
ファイル: BaseAction.cs プロジェクト: Belial2010/eidtText
        /// <summary>
        /// 删除多行
        /// </summary>
        /// <param name="deleteLineCount"></param>
        /// <param name="startPoint"></param>
        /// <param name="endPoint"></param>
        /// <returns></returns>
        private string DeleteSelectMoreLine(out int deleteLineCount, CPoint startPoint, CPoint endPoint)
        {
            deleteLineCount = 0;
            var sbStr      = new StringBuilder();
            int i          = startPoint.Y;
            int startIndex = startPoint.Y / FontContainer.FontHeight;
            int startY     = startIndex;

            //int endY = 0;
            LineString ls = null;
            //var lpns = this.GetSelectLNProperty(startPoint, endPoint, out endY);
            //string delString = string.Empty;
            var puckerData = new ResultPuckerListData();

            puckerData.PuckerLineStringAndY = new List <PuckerLineStringAndID>();
            int puckerCount = 0;
            Tuple <LineNodeProperty, int, bool> lnpID = null;

            while (i <= endPoint.Y)
            {
                if (i == startPoint.Y)
                {
                    ls = this.PParser.PLineString[startIndex];
                    //sbStr.AppendLine(ls.Text.Substring(Math.Min(ls.Text.Length, startPoint.LineStringIndex + 1)));
                    var startPucker = sbStr.AppendForPucker(ls, ls.Text.Substring(Math.Min(ls.Text.Length, startPoint.LineStringIndex + 1)), this.PParser.PPucker);
                    this.PParser.PPucker.GetPuckerLsText(ls, sbStr, puckerData.PuckerLineStringAndY, startIndex, ref puckerCount);
                    ls.Text = ls.Text.Substring(0, Math.Min(ls.Text.Length, startPoint.LineStringIndex + 1));
                    startIndex++;
                    deleteLineCount++;
                    if (startPucker != null)
                    {
                        startPoint.LineWidth += startPucker.Item2;
                        //startPoint.LineStringIndex += startPucker.Item1;
                    }
                }
                else if (i == endPoint.Y)
                {
                    var lendLs = this.PParser.PLineString[startIndex];
                    //sbStr.Append(lendLs.Text.Substring(0, Math.Min(lendLs.Text.Length, endPoint.LineStringIndex + 1)));
                    var endPucker = sbStr.AppendForPucker(lendLs,
                                                          lendLs.Text.Substring(0, Math.Min(lendLs.Text.Length, endPoint.LineStringIndex + 1)),
                                                          endPoint.LineStringIndex,
                                                          this.PParser.PPucker,
                                                          i / FontContainer.FontHeight
                                                          );
                    if (lendLs.Length > endPoint.LineStringIndex + 1)
                    {
                        lnpID    = lendLs.GetLnpAndId();
                        ls.Text += this.GetLineStringEffectualText(lendLs).Substring(endPoint.LineStringIndex + 1);
                    }

                    this.PParser.PLineString.RemoveAt(startIndex);
                    deleteLineCount++;
                    if (endPucker != null)
                    {
                        puckerData.LineLeavingLength = endPucker.LineLeavingLength;
                        puckerData.LineLeavingWidth  = endPucker.LineLeavingWidth;
                        puckerData.LastChildLS       = endPucker.LastChildLS;
                        puckerCount += endPucker.PuckerCount;
                        if (endPucker.PuckerLineStringAndY.Count > 0)
                        {
                            puckerData.PuckerLineStringAndY.AddRange(endPucker.PuckerLineStringAndY);
                        }
                    }
                }
                else
                {
                    sbStr.AppendForPucker(this.PParser.PLineString[startIndex], this.PParser.PPucker);
                    this.PParser.PPucker.GetPuckerLsText(this.PParser.PLineString[startIndex], sbStr, puckerData.PuckerLineStringAndY,
                                                         i / FontContainer.FontHeight,
                                                         ref puckerCount);
                    this.PParser.PLineString.RemoveAt(startIndex);
                    deleteLineCount++;
                }
                i += FontContainer.FontHeight;
            }
            #region 重新解析当前行
            //this.PParser.PCharFontStyle.ClearProperty();
            //var nLine = this.PParser.PCharFontStyle.GetLineString(ls.Text/*, this.PParser.PCursor.CousorPointForWord.Y*/);
            //ls.PWord = nLine.PWord;
            //ls.Width = 0;
            //ls.PLNProperty = nLine.PLNProperty;
            //ls.PRecentlyUpPLN = nLine.PRecentlyUpPLN;

            this.SetResetLineString(ls);
            this.RemovePuckerLeavingOnly(lnpID, ls);

            #endregion
            puckerData.PuckerCount = puckerCount;
            this.SetStartLinePoint(puckerData, false);
            this.PParser.PCursor.CousorPointForWord.Y = startY;
            this.PParser.PCursor.CousorPointForWord.X = startPoint.LineStringIndex;
            this.PParser.PCursor.SetPosition(startPoint.X, startPoint.Y, this.PParser.GetLeftSpace);
            //if (this.PCursor.CousorPointForEdit.Y < this.PIEdit.GetVerticalScrollValue) {

            //}

            this.PParser.PIEdit.ChangeScollSize();
            this.PParser.PCursor.SetPosition();
            //this.SetMoreLineLnp(ls, lpns, startY, endY);
            //this.PParser.ClearSelect();
            return(sbStr.ToString());
        }