コード例 #1
0
        public override UIHandleResult OnMouseMove(MouseEventArgs args)
        {
            if (args.Button != MouseButtons.Left)
            {
                return(UIHandleResult.Pass);
            }
            TextSelection sel = _viewer.TextSelection;

            if (sel.State == SelectionState.Fixed || sel.State == SelectionState.Empty)
            {
                return(UIHandleResult.Pass);
            }
            //クリックだけでもなぜかMouseDownの直後にMouseMoveイベントが来るのでこのようにしてガード。でないと単発クリックでも選択状態になってしまう
            if (sel.StartX == args.X && sel.StartY == args.Y)
            {
                return(UIHandleResult.Capture);
            }

            CharacterDocument document = _viewer.CharacterDocument;

            lock (document) {
                int   topline_id = _viewer.GetTopLine().ID;
                SizeF pitch = _viewer.GetRenderProfile().Pitch;
                int   row, col;
                _viewer.MousePosToTextPos_AllowNegative(args.X, args.Y, out col, out row);
                int viewheight = (int)Math.Floor(_viewer.ClientSize.Height / pitch.Width);
                int target_id  = topline_id + row;

                GLine target_line             = document.FindLineOrEdge(target_id);
                TextSelection.TextPoint point = sel.ConvertSelectionPosition(target_line, col);

                point.Line = RuntimeUtil.AdjustIntRange(point.Line, document.FirstLineNumber, document.LastLineNumber);

                if (_viewer.VScrollBar.Enabled)   //スクロール可能なときは
                {
                    VScrollBar vsc = _viewer.VScrollBar;
                    if (target_id < topline_id) //前方スクロール
                    {
                        vsc.Value = point.Line - document.FirstLineNumber;
                    }
                    else if (point.Line >= topline_id + vsc.LargeChange)   //後方スクロール
                    {
                        int newval = point.Line - document.FirstLineNumber - vsc.LargeChange + 1;
                        if (newval < 0)
                        {
                            newval = 0;
                        }
                        if (newval > vsc.Maximum - vsc.LargeChange)
                        {
                            newval = vsc.Maximum - vsc.LargeChange + 1;
                        }
                        vsc.Value = newval;
                    }
                }
                else   //スクロール不可能なときは見えている範囲で
                {
                    point.Line = RuntimeUtil.AdjustIntRange(point.Line, topline_id, topline_id + viewheight - 1);
                } //ここさぼっている
                //Debug.WriteLine(String.Format("MouseMove {0} {1} {2}", sel.State, sel.PivotType, args.X));
                RangeType rt = sel.PivotType;
                if ((Control.ModifierKeys & Keys.Control) != Keys.None)
                {
                    rt = RangeType.Word;
                }
                else if ((Control.ModifierKeys & Keys.Shift) != Keys.None)
                {
                    rt = RangeType.Line;
                }

                GLine tl = document.FindLine(point.Line);
                sel.ExpandTo(tl, point.Column, rt);
            }
            _viewer.Invalidate(); //TODO 選択状態に変化のあった行のみ更新するようにすればなおよし
            return(UIHandleResult.Capture);
        }
コード例 #2
0
        private void BuildTransientDocument(PaintEventArgs e, RenderParameter param)
        {
            Rectangle     clip    = e.ClipRectangle;
            RenderProfile profile = GetRenderProfile();

            _transientLines.Clear();

            //Win32.SystemMetrics sm = GEnv.SystemMetrics;
            //param.TargetRect = new Rectangle(sm.ControlBorderWidth+1, sm.ControlBorderHeight,
            //	this.Width - _VScrollBar.Width - sm.ControlBorderWidth + 8, //この8がない値が正当だが、.NETの文字サイズ丸め問題のため行の最終文字が表示されないことがある。これを回避するためにちょっと増やす
            //	this.Height - sm.ControlBorderHeight);
            param.TargetRect = this.ClientRectangle;

            int offset1 = (int)Math.Floor((clip.Top - BORDER) / (profile.Pitch.Height + profile.LineSpacing));

            if (offset1 < 0)
            {
                offset1 = 0;
            }
            param.LineFrom = offset1;
            int offset2 = (int)Math.Floor((clip.Bottom - BORDER) / (profile.Pitch.Height + profile.LineSpacing));

            if (offset2 < 0)
            {
                offset2 = 0;
            }

            param.LineCount = offset2 - offset1 + 1;
            //Debug.WriteLine(String.Format("{0} {1} ", param.LineFrom, param.LineCount));

            int   topline_id = GetTopLine().ID;
            GLine l          = _document.FindLineOrNull(topline_id + param.LineFrom);

            if (l != null)
            {
                int poolIndex = 0;
                for (int i = 0; i < param.LineCount; i++)
                {
                    GLine cloned;
                    if (poolIndex < _glinePool.Count)
                    {
                        cloned = _glinePool[poolIndex];
                        poolIndex++;
                        cloned.CopyFrom(l);
                    }
                    else
                    {
                        cloned          = l.Clone();
                        cloned.NextLine = cloned.PrevLine = null;
                        _glinePool.Add(cloned); // store for next use
                        poolIndex++;
                    }

                    _transientLines.Add(cloned);
                    l = l.NextLine;
                    if (l == null)
                    {
                        break;
                    }
                }
            }

            //以下、_transientLinesにはparam.LineFromから示される値が入っていることに注意

            //選択領域の描画
            if (!_textSelection.IsEmpty)
            {
                TextSelection.TextPoint from = _textSelection.HeadPoint;
                TextSelection.TextPoint to   = _textSelection.TailPoint;
                l = _document.FindLineOrNull(from.Line);
                GLine t = _document.FindLineOrNull(to.Line);
                if (l != null && t != null)   //本当はlがnullではいけないはずだが、それを示唆するバグレポートがあったので念のため
                {
                    t = t.NextLine;
                    int pos = from.Column; //たとえば左端を越えてドラッグしたときの選択範囲は前行末になるので pos==TerminalWidthとなるケースがある。
                    do
                    {
                        int index = l.ID - (topline_id + param.LineFrom);
                        if (pos >= 0 && pos < l.DisplayLength && index >= 0 && index < _transientLines.Count)
                        {
                            if (l.ID == to.Line)
                            {
                                if (pos != to.Column)
                                {
                                    _transientLines[index].SetSelection(pos, to.Column);
                                }
                            }
                            else
                            {
                                _transientLines[index].SetSelection(pos, l.DisplayLength);
                            }
                        }
                        pos = 0; //2行目からの選択は行頭から
                        l   = l.NextLine;
                    } while (l != t);
                }
            }

            AdjustCaret(_caret);
            _caret.Enabled = _caret.Enabled && (param.LineFrom <= _caret.Y && _caret.Y < param.LineFrom + param.LineCount);

            //Caret画面外にあるなら処理はしなくてよい。2番目の条件は、Attach-ResizeTerminalの流れの中でこのOnPaintを実行した場合にTerminalHeight>lines.Countになるケースがあるのを防止するため
            if (_caret.Enabled)
            {
                //ヒクヒク問題のため、キャレットを表示しないときでもこの操作は省けない
                if (_caret.Style == CaretType.Box)
                {
                    int y = _caret.Y - param.LineFrom;
                    if (y >= 0 && y < _transientLines.Count)
                    {
                        _transientLines[y].SetCursor(_caret.X);
                    }
                }
            }
        }
コード例 #3
0
ファイル: Log.cs プロジェクト: xydoublez/EasyConnect
 //!!行単位の書き込み 実は標準とそれ以外ではログの扱い方に共通点があまりないのに強引に一つのクラスにまとめようとしてボロがでた
 public virtual void WriteLine(GLine line)
 {
 }
コード例 #4
0
 public void Close(GLine last_line)
 {
     _textLoggers.WriteLine(last_line); //TextLogは改行ごとであるから、Close時に最終行を書き込むようにする
     InternalClose();
 }
コード例 #5
0
        private void BuildTransientDocument(PaintEventArgs e, RenderParameter param)
        {
            Rectangle     clip    = e.ClipRectangle;
            RenderProfile profile = GetRenderProfile();

            _transientLines.Clear();

            //Win32.SystemMetrics sm = GEnv.SystemMetrics;
            //param.TargetRect = new Rectangle(sm.ControlBorderWidth+1, sm.ControlBorderHeight,
            //  this.Width - _VScrollBar.Width - sm.ControlBorderWidth + 8, //この8がない値が正当だが、.NETの文字サイズ丸め問題のため行の最終文字が表示されないことがある。これを回避するためにちょっと増やす
            //  this.Height - sm.ControlBorderHeight);
            param.TargetRect = this.ClientRectangle;

            int offset1 = (int)Math.Floor((clip.Top - BORDER) / (profile.Pitch.Height + profile.LineSpacing));

            if (offset1 < 0)
            {
                offset1 = 0;
            }
            param.LineFrom = offset1;
            int offset2 = (int)Math.Floor((clip.Bottom - BORDER) / (profile.Pitch.Height + profile.LineSpacing));

            if (offset2 < 0)
            {
                offset2 = 0;
            }

            param.LineCount = offset2 - offset1 + 1;
            //Debug.WriteLine(String.Format("{0} {1} ", param.LineFrom, param.LineCount));

            int   topline_id = GetTopLine().ID;
            GLine l          = _document.FindLineOrNull(topline_id + param.LineFrom);

            if (l != null)
            {
                for (int i = param.LineFrom; i < param.LineFrom + param.LineCount; i++)
                {
                    _transientLines.Add(l.Clone()); //TODO クローンはきついよなあ だが描画の方が時間かかるので、その間ロックをしないためには仕方ない点もある
                    l = l.NextLine;
                    if (l == null)
                    {
                        break;
                    }
                }
            }

            //以下、_transientLinesにはparam.LineFromから示される値が入っていることに注意

            //選択領域の描画
            if (!_textSelection.IsEmpty)
            {
                TextSelection.TextPoint from = _textSelection.HeadPoint;
                TextSelection.TextPoint to   = _textSelection.TailPoint;
                l = _document.FindLineOrNull(from.Line);
                GLine t = _document.FindLineOrNull(to.Line);

                bool isrect = (Control.ModifierKeys & Keys.Alt) != 0;

                if (l != null && t != null) //本当はlがnullではいけないはずだが、それを示唆するバグレポートがあったので念のため
                {
                    t = t.NextLine;
                    int p0 = from.Column;
                    //TODO: 全角文字調整?

                    int p1 = 0;
                    if (isrect)
                    {
                        p1 = to.Column;
                        //TODO: 全角文字調整?
                        if (p0 > p1)
                        {
                            int p2 = p0; p0 = p1; p1 = p2;
                        }
                    }

                    int start = from.Column; //たとえば左端を越えてドラッグしたときの選択範囲は前行末になるので pos==TerminalWidthとなるケースがある。
                    do
                    {
                        int index = l.ID - (topline_id + param.LineFrom);
                        if (0 <= start && start < l.DisplayLength && 0 <= index && index < _transientLines.Count)
                        {
                            int end = 0;
                            if (isrect)
                            {
                                start = p0;
                                end   = p1;
                                //TODO: 全角文字調整?
                            }
                            else
                            {
                                if (l.ID == to.Line)
                                {
                                    if (start != to.Column)
                                    {
                                        end = to.Column;
                                    }
                                }
                                else
                                {
                                    end = l.DisplayLength;
                                }
                            }

                            if (start < end)
                            {
                                GLine r = _transientLines[index].InverseRange(start, end);
                                if (r != null)
                                {
                                    _transientLines[index] = r;
                                }
                            }
                        }

                        start = 0; //2行目からの選択は行頭から
                        l     = l.NextLine;
                    }while(l != t);
                }
            }

            AdjustCaret(_caret);
            _caret.Enabled = _caret.Enabled && (param.LineFrom <= _caret.Y && _caret.Y < param.LineFrom + param.LineCount);

            //Caret画面外にあるなら処理はしなくてよい。2番目の条件は、Attach-ResizeTerminalの流れの中でこのOnPaintを実行した場合にTerminalHeight>lines.Countになるケースがあるのを防止するため
            if (_caret.Enabled)
            {
                //ヒクヒク問題のため、キャレットを表示しないときでもこの操作は省けない
                if (_caret.Style == CaretType.Box)
                {
                    int y = _caret.Y - param.LineFrom;
                    if (y >= 0 && y < _transientLines.Count)
                    {
                        _transientLines[y].InverseCharacter(_caret.X, _caret.IsActiveTick, _caret.Color);
                    }
                }
            }
        }
コード例 #6
0
ファイル: Log.cs プロジェクト: xydoublez/EasyConnect
 public void WriteLine(GLine line)
 {
 }
コード例 #7
0
 public void StartCommand(AbstractTerminal terminal, string command_text, GLine prompt_line)
 {
     _executingCommand = command_text;
     _terminal         = terminal;
 }
コード例 #8
0
 public static void DrawLine(GLine _line)
 {
     Handles.color  = Gizmos.color;
     Handles.matrix = Gizmos.matrix;
     Handles_Extend.DrawLine(_line);
 }
コード例 #9
0
 public void Close(GLine lastLine)
 {
     _textLoggers.WriteLine(lastLine); //TextLogは改行ごとであるから、Close時に最終行を書き込むようにする
     StopAutoFlushThread();
     InternalClose();
 }
コード例 #10
0
ファイル: AutoShellExecutor.cs プロジェクト: yueker/poderosa
 public void StartCommand(AbstractTerminal terminal, string command_text, GLine prompt_line)
 {
 }
コード例 #11
0
        /// <summary>
        /// Initialize the map
        /// </summary>
        public void InitializeMapData()
        {
            // populate map data
            var db = Sitecore.Context.Database;

            if (DataSource == null || DataSource.TemplateName != Settings.GoogleMapTemplateName)
            {
                Log.Error("Google Maps Module - could not find the data source to display the map", Settings.LoggingOwner);
                return;
            }

            try
            {
                // get map settings
                CurrentMap          = new GMap();
                CurrentMap.CanvasID = "map_canvas" + ClientID;

                // EnsureField checks whether a field is present on an item and logs errors
                Utilities.EnsureField(DataSource, "Latitude", true);
                Utilities.EnsureField(DataSource, "Longitude", true);
                CurrentMap.Center = new GLatLng(DataSource.Fields["Latitude"].Value, DataSource.Fields["Longitude"].Value);

                Utilities.EnsureField(DataSource, "Initial Zoom Level", false);
                CurrentMap.Zoom = int.Parse(DataSource.Fields["Initial Zoom Level"].Value);

                Utilities.EnsureField(DataSource, "Width", false);
                Utilities.EnsureField(DataSource, "Height", false);
                CurrentMap.Width  = int.Parse(DataSource.Fields["Width"].Value);
                CurrentMap.Height = int.Parse(DataSource.Fields["Height"].Value);

                Utilities.EnsureField(DataSource, "Map Types", false);
                CurrentMap.MapTypes = new List <string>();
                MultilistField mapTypes = ((MultilistField)DataSource.Fields["Map Types"]);
                foreach (ID mapTypeId in mapTypes.TargetIDs)
                {
                    Item mapTypeItem = db.GetItem(mapTypeId);
                    Utilities.EnsureField(mapTypeItem, "Type", true);
                    CurrentMap.MapTypes.Add(mapTypeItem.Fields["Type"].Value);
                }

                Utilities.EnsureField(DataSource, "Draggable Cursor", false);
                CurrentMap.DraggableCursor = DataSource.Fields["Draggable Cursor"].Value;

                Utilities.EnsureField(DataSource, "Dragging Cursor", false);
                CurrentMap.DraggingCursor = DataSource.Fields["Dragging Cursor"].Value;

                int tmpval;
                Utilities.EnsureField(DataSource, "Min Zoom Level", false);
                if (int.TryParse(DataSource.Fields["Min Zoom Level"].Value, out tmpval))
                {
                    CurrentMap.MinZoomLevel = tmpval;
                }
                else
                {
                    CurrentMap.MinZoomLevel = null;
                }

                Utilities.EnsureField(DataSource, "Max Zoom Level", false);
                if (int.TryParse(DataSource.Fields["Max Zoom Level"].Value, out tmpval))
                {
                    CurrentMap.MaxZoomLevel = tmpval;
                }
                else
                {
                    CurrentMap.MaxZoomLevel = null;
                }

                Utilities.EnsureField(DataSource, "Enable Double Click Zoom", false);
                CurrentMap.EnableDoubleClickZoom = ((CheckboxField)DataSource.Fields["Enable Double Click Zoom"]).Checked;

                Utilities.EnsureField(DataSource, "Enable Dragging", false);
                CurrentMap.EnableDragging = ((CheckboxField)DataSource.Fields["Enable Dragging"]).Checked;

                Utilities.EnsureField(DataSource, "Enable Scroll Wheel Zoom", false);
                CurrentMap.EnableScrollWheelZoom = ((CheckboxField)DataSource.Fields["Enable Scroll Wheel Zoom"]).Checked;

                Utilities.EnsureField(DataSource, "Enable Keyboard Functionality", false);
                CurrentMap.EnableKeyboardFunctionality = ((CheckboxField)DataSource.Fields["Enable Keyboard Functionality"]).Checked;

                Utilities.EnsureField(DataSource, "Disable All Default UI Elements", false);
                CurrentMap.DisableAllDefaultUIElements = ((CheckboxField)DataSource.Fields["Disable All Default UI Elements"]).Checked;

                Utilities.EnsureField(DataSource, "Enable Overview", false);
                CurrentMap.EnableOverview = ((CheckboxField)DataSource.Fields["Enable Overview"]).Checked;

                Utilities.EnsureField(DataSource, "Enable Pan Control", false);
                CurrentMap.EnablePanControl = ((CheckboxField)DataSource.Fields["Enable Pan Control"]).Checked;

                Utilities.EnsureField(DataSource, "Enable Scale Control", false);
                CurrentMap.EnableScaleControl = ((CheckboxField)DataSource.Fields["Enable Scale Control"]).Checked;

                Utilities.EnsureField(DataSource, "Enable Street View Control", false);
                CurrentMap.EnableStreetViewControl = ((CheckboxField)DataSource.Fields["Enable Street View Control"]).Checked;

                Utilities.EnsureField(DataSource, "Enable Zoom Control", false);
                CurrentMap.EnableZoomControl = ((CheckboxField)DataSource.Fields["Enable Zoom Control"]).Checked;

                // get all markers
                CurrentMap.Markers  = new List <GMarker>();
                CurrentMap.Lines    = new List <GLine>();
                CurrentMap.Polygons = new List <GPolygon>();

                if (DataSource.HasChildren)
                {
                    foreach (Item childElement in DataSource.Children)
                    {
                        if (childElement.TemplateName == Settings.LocationTemplateName)
                        {
                            GMarker marker = new GMarker();

                            Utilities.EnsureField(childElement, "Latitude", true);
                            Utilities.EnsureField(childElement, "Longitude", true);
                            marker.Position = new GLatLng(childElement.Fields["Latitude"].Value, childElement.Fields["Longitude"].Value);
                            marker.Title    = childElement.Name;
                            Utilities.EnsureField(childElement, "Text", false);
                            marker.InfoWindow = childElement.Fields["Text"].Value;

                            // check if marker has a custom icon
                            if (childElement.Fields["Custom Icon"] != null && childElement.Fields["Custom Icon"].HasValue && ((ReferenceField)childElement.Fields["Custom Icon"]).TargetItem != null)
                            {
                                Item  customIcon = ((ReferenceField)childElement.Fields["Custom Icon"]).TargetItem;
                                GIcon icon       = new GIcon();
                                Utilities.EnsureField(customIcon, "Image", true);
                                icon.ImageURL        = Sitecore.StringUtil.EnsurePrefix('/', MediaManager.GetMediaUrl(((Sitecore.Data.Fields.ImageField)customIcon.Fields["Image"]).MediaItem));
                                icon.ImageDimensions = Utilities.GetMediaItemSize((Sitecore.Data.Fields.ImageField)customIcon.Fields["Image"]);

                                Utilities.EnsureField(customIcon, "Anchor", false);
                                icon.Anchor = Utilities.StringToPoint(customIcon.Fields["Anchor"].Value);

                                Utilities.EnsureField(customIcon, "Shadow Image", false);
                                if (customIcon.Fields["Shadow Image"].HasValue && ((Sitecore.Data.Fields.ImageField)customIcon.Fields["Shadow Image"]).MediaItem != null)
                                {
                                    icon.ShadowURL        = Sitecore.StringUtil.EnsurePrefix('/', MediaManager.GetMediaUrl(((Sitecore.Data.Fields.ImageField)customIcon.Fields["Shadow Image"]).MediaItem));
                                    icon.ShadowDimensions = Utilities.GetMediaItemSize((Sitecore.Data.Fields.ImageField)customIcon.Fields["Shadow Image"]);
                                    Utilities.EnsureField(customIcon, "Shadow Anchor", false);
                                    icon.ShadowAnchor = Utilities.StringToPoint(customIcon.Fields["Shadow Anchor"].Value);
                                }

                                Utilities.EnsureField(customIcon, "Clickable Polygon", false);
                                if (customIcon.Fields["Clickable Polygon"].HasValue && !string.IsNullOrEmpty(customIcon.Fields["Clickable Polygon"].Value))
                                {
                                    icon.ClickablePolygon = customIcon.Fields["Clickable Polygon"].Value;
                                }

                                marker.CustomIcon = icon;
                            }

                            CurrentMap.Markers.Add(marker);
                        }
                        else if (childElement.TemplateName == Settings.LineTemplateName)
                        {
                            GLine line = new GLine();
                            Utilities.EnsureField(childElement, "Stroke Color", false);
                            line.StrokeColor = childElement.Fields["Stroke Color"].Value;

                            Utilities.EnsureField(childElement, "Stroke Opacity", false);
                            line.StrokeOpacity = Utilities.EnsureOpacity(childElement.Fields["Stroke Opacity"].Value);

                            Utilities.EnsureField(childElement, "Stroke Weight", false);
                            line.StrokeWeight = Utilities.EnsureWeight(childElement.Fields["Stroke Weight"].Value);

                            Utilities.EnsureField(childElement, "Points", false);
                            var points = ((MultilistField)childElement.Fields["Points"]).Items;
                            line.Points = Utilities.ArrayToLatLngList(points);

                            CurrentMap.Lines.Add(line);
                        }
                        else if (childElement.TemplateName == Settings.PolygonTemplateName)
                        {
                            GPolygon poly = new GPolygon();
                            Utilities.EnsureField(childElement, "Stroke Color", false);
                            poly.StrokeColor = childElement.Fields["Stroke Color"].Value;

                            Utilities.EnsureField(childElement, "Stroke Opacity", false);
                            poly.StrokeOpacity = Utilities.EnsureOpacity(childElement.Fields["Stroke Opacity"].Value);

                            Utilities.EnsureField(childElement, "Stroke Weight", false);
                            poly.StrokeWeight = Utilities.EnsureWeight(childElement.Fields["Stroke Weight"].Value);

                            Utilities.EnsureField(childElement, "Points", false);
                            var points = ((MultilistField)childElement.Fields["Points"]).Items;
                            poly.Points = Utilities.ArrayToLatLngList(points);

                            Utilities.EnsureField(childElement, "Fill Color", false);
                            poly.FillColor = childElement.Fields["Fill Color"].Value;

                            Utilities.EnsureField(childElement, "Fill Opacity", false);
                            poly.FillOpacity = Utilities.EnsureOpacity(childElement.Fields["Fill Opacity"].Value);

                            Utilities.EnsureField(childElement, "Is Clickable", false);
                            poly.Clickable = ((CheckboxField)childElement.Fields["Is Clickable"]).Checked;

                            Utilities.EnsureField(childElement, "Text", false);
                            poly.InfoWindow = childElement.Fields["Text"].Value;

                            CurrentMap.Polygons.Add(poly);
                        }
                    }
                }
            }
            catch (FieldValidationException)
            {
                // this has been logged already - nothing to do here.
            }
            catch (Exception ex)
            {
                Log.Error("Google Maps Module - could not initialize the map", ex, Settings.LoggingOwner);
            }
        }
コード例 #12
0
        /// <summary>
        /// 获取要素信息
        /// </summary>
        /// <returns></returns>
        private CMapFeatureInfo GetMapFeatureInfo()
        {
            CMapFeatureInfo fInfo = new CMapFeatureInfo();
            SFeature        sf    = new SFeature();

            sf.AttValue = new string[m_attStruct.FldNumber];
            for (int i = 0; i < m_attStruct.FldNumber; i++)
            {
                sf.AttValue[i] = m_textBoxArr[i].Text;
                switch (this.m_attStruct.FldType[i])
                {
                case "double":
                case "integer":
                case "long":
                case "short":
                    if (!CommFun.IsNumber(sf.AttValue[i]))
                    {
                        MessageBox.Show("字段【Fld_" + this.m_attStruct.FldName[i] + "】输入的数据格式不正确。请重新输入!", "提示", MessageBoxButton.OK);
                        return(null);
                    }
                    break;
                }
            }
            SFeatureGeometry sfGeo = null;
            SFclsGeomType    curFGeoType;

            if (m_targetGeo != null)
            {
                sfGeo = m_targetGeo as SFeatureGeometry;
                if (sfGeo == null) //add feature
                {
                    sfGeo = new SFeatureGeometry();
                    switch ((m_targetGeo as IWebGeometry).GetGeomType())
                    {
                    case WebGeomType.Point:
                        sf.ftype = SFclsGeomType.Pnt;
                        GPoint pnt = new GPoint();
                        pnt.Dot       = m_targetGeo as Dot_2D;
                        sfGeo.PntGeom = new GPoint[] { pnt };
                        break;

                    case WebGeomType.Line:
                        sf.ftype = SFclsGeomType.Lin;
                        GLine line = new GLine();
                        line.Line     = m_targetGeo as AnyLine;
                        sfGeo.LinGeom = new GLine[] { line };
                        break;

                    case WebGeomType.Polygon:
                        sf.ftype = SFclsGeomType.Reg;
                        GRegion polygon = new GRegion();
                        AnyLine circle  = new AnyLine();
                        circle.Arcs         = new Arc[1];
                        circle.Arcs[0]      = new Arc();
                        circle.Arcs[0].Dots = (m_targetGeo as ZDIMS.BaseLib.Polygon).Dots;
                        polygon.Rings       = new AnyLine[] { circle };
                        sfGeo.RegGeom       = new GRegion[] { polygon };
                        break;

                    default:
                        sfGeo = null;
                        break;
                    }
                }
            }
            curFGeoType = ActiveMapDoc.ActiveLayerGeoType;
            if (this.m_featureStyle == null)
            {
                this.m_featureStyle = new WebGraphicsInfo();
            }
            this.m_style.Update();
            switch (curFGeoType)
            {
            case SFclsGeomType.Pnt:
                this.m_featureStyle.InfoType = GInfoType.PntInfo;
                PointStyle newPntStyle = this.m_style as PointStyle;
                this.m_featureStyle.PntInfo = new CPointInfo();
                if (newPntStyle.patternAngle.Text == "")
                {
                    this.m_featureStyle.PntInfo.Angle = 0.0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.Angle = Convert.ToDouble(newPntStyle.patternAngle.Text);
                }
                if (newPntStyle.patternColor._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.PntInfo.Color = 0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.Color = Convert.ToInt32(newPntStyle.patternColor._TextBoxInput.Text.Split(':')[0]);
                }
                if (newPntStyle.patternHeight.Text == "")
                {
                    this.m_featureStyle.PntInfo.SymHeight = 0.0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.SymHeight = Convert.ToDouble(newPntStyle.patternHeight.Text);
                }
                if (newPntStyle.patternID._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.PntInfo.SymID = 0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.SymID = Convert.ToInt32(newPntStyle.patternID._TextBoxInput.Text.Split(':')[0]);
                }
                if (newPntStyle.patternWidth.Text == "")
                {
                    this.m_featureStyle.PntInfo.SymWidth = 0.0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.SymWidth = Convert.ToDouble(newPntStyle.patternWidth.Text);
                }
                break;

            case SFclsGeomType.Lin:
                this.m_featureStyle.InfoType = GInfoType.LinInfo;
                LineStyle newLineStyle = this.m_style as LineStyle;
                this.m_featureStyle.LinInfo = new CLineInfo();
                if (newLineStyle.color._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.LinInfo.Color = 0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.Color = Convert.ToInt32(newLineStyle.color._TextBoxInput.Text.Split(':')[0]);
                }
                if (newLineStyle.patternID._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.LinInfo.LinStyleID = 0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.LinStyleID = Convert.ToInt32(newLineStyle.patternID._TextBoxInput.Text.Split(':')[0]);
                }
                if (newLineStyle.patternID2._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.LinInfo.LinStyleID2 = 0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.LinStyleID2 = Convert.ToInt32(newLineStyle.patternID2._TextBoxInput.Text.Split(':')[0]);
                }
                if (newLineStyle.penWidth.Text == "")
                {
                    this.m_featureStyle.LinInfo.LinWidth = 0.0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.LinWidth = Convert.ToDouble(newLineStyle.penWidth.Text);
                }
                if (newLineStyle.lineScaleX.Text == "")
                {
                    this.m_featureStyle.LinInfo.Xscale = 0.0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.Xscale = Convert.ToDouble(newLineStyle.lineScaleX.Text);
                }
                if (newLineStyle.lineScaleY.Text == "")
                {
                    this.m_featureStyle.LinInfo.Yscale = 0.0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.Yscale = Convert.ToDouble(newLineStyle.lineScaleY.Text);
                }
                break;

            case SFclsGeomType.Reg:
                this.m_featureStyle.InfoType = GInfoType.RegInfo;
                PolygonStyle newRegStyle = this.m_style as PolygonStyle;
                this.m_featureStyle.RegInfo = new CRegionInfo();
                if (newRegStyle.fillcolor._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.RegInfo.FillColor = 0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.FillColor = Convert.ToInt32(newRegStyle.fillcolor._TextBoxInput.Text.Split(':')[0]);
                }
                if (newRegStyle.patternColor._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.RegInfo.PatColor = 0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.PatColor = Convert.ToInt32(newRegStyle.patternColor._TextBoxInput.Text.Split(':')[0]);
                }
                if (newRegStyle.patternHeight.Text == "")
                {
                    this.m_featureStyle.RegInfo.PatHeight = 0.0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.PatHeight = Convert.ToDouble(newRegStyle.patternHeight.Text);
                }
                if (newRegStyle.patternID._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.RegInfo.PatID = 0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.PatID = Convert.ToInt32(newRegStyle.patternID._TextBoxInput.Text.Split(':')[0]);
                }
                if (newRegStyle.patternPenWidth.Text == "")
                {
                    this.m_featureStyle.RegInfo.OutPenWidth = 0.0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.OutPenWidth = Convert.ToDouble(newRegStyle.patternPenWidth.Text);
                }
                if (newRegStyle.patternWidth.Text == "")
                {
                    this.m_featureStyle.RegInfo.PatWidth = 0.0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.PatWidth = Convert.ToDouble(newRegStyle.patternWidth.Text);
                }
                break;
            }

            sf.fGeom              = sfGeo;
            sf.FID                = m_featureID;
            fInfo.GInfo           = this.m_featureStyle;
            fInfo.FSet            = sf;
            fInfo.LayerIndex      = ActiveMapDoc.ActiveLayerIndex;
            fInfo.MapName         = new COpenMap();
            fInfo.MapName.MapName = new string[] { ActiveMapDoc.MapDocName };
            return(fInfo);
        }
コード例 #13
0
        public static void ConstructColLines(GCanvas gCanvas, GeometryEngine GeometryEngineRFT, double scale)
        {
            ColLinesTopStart = new GLine[SpanVals.Length];
            ColLinesTopEnd   = new GLine[SpanVals.Length];
            ColLinesBotStart = new GLine[SpanVals.Length];
            ColLinesBotEnd   = new GLine[SpanVals.Length];
            /*----------------------Bottom Start Lines----------------------*/
            //Case Of Cantilever at start
            if (GeometryEditorVM.GeometryEditor.RestraintsCollection[0].SelectedRestraint != Restraints.NoRestraints)
            {
                ColLinesBotStart[0] = new GLine(gCanvas, StartPointBotArr[0], new Point(StartPointBotArr[0].X, StartPointBotArr[0].Y + 0.4 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(ColLinesBotStart[0]);
            }
            else
            {
                GLine comLineBotStart = new GLine(gCanvas, StartPointBotArr[0], new Point(StartPointBotArr[0].X - 0.15 * scale, StartPointBotArr[0].Y));
                GeometryEngineRFT.Shapes["RFT"].Add(comLineBotStart);
            }
            for (int i = 1; i < ColLinesBotStart.Length; i++)
            {
                ColLinesBotStart[i] = new GLine(gCanvas, StartPointBotArr[i], new Point(StartPointBotArr[i].X, StartPointBotArr[i].Y + 0.4 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(ColLinesBotStart[i]);
            }
            /*----------------------Bottom End Lines----------------------*/
            for (int i = 0; i < ColLinesBotEnd.Length - 1; i++)
            {
                ColLinesBotEnd[i] = new GLine(gCanvas, EndPointBotArr[i], new Point(EndPointBotArr[i].X, EndPointBotArr[i].Y + 0.4 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(ColLinesBotEnd[i]);
            }
            //Case Of Cantilever at End
            if (GeometryEditorVM.GeometryEditor.RestraintsCollection[SpanVals.Length].SelectedRestraint != Restraints.NoRestraints)
            {
                ColLinesBotEnd[ColLinesBotEnd.Length - 1] = new GLine(gCanvas, EndPointBotArr[ColLinesBotEnd.Length - 1], new Point(EndPointBotArr[ColLinesBotEnd.Length - 1].X, EndPointBotArr[ColLinesBotEnd.Length - 1].Y + 0.4 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(ColLinesBotEnd[ColLinesBotEnd.Length - 1]);
            }
            else
            {
                GLine comLineBotEnd = new GLine(gCanvas, EndPointBotArr[ColLinesBotEnd.Length - 1], new Point(EndPointBotArr[ColLinesBotEnd.Length - 1].X + 0.15 * scale, EndPointBotArr[ColLinesBotEnd.Length - 1].Y));
                GeometryEngineRFT.Shapes["RFT"].Add(comLineBotEnd);
            }

            /*-----------------Top Start Lines---------------*/
            //Case Of Cantilever at start
            if (GeometryEditorVM.GeometryEditor.RestraintsCollection[0].SelectedRestraint != Restraints.NoRestraints)
            {
                ColLinesTopStart[0] = new GLine(gCanvas, StartPointTopArr[0], new Point(StartPointTopArr[0].X, StartPointTopArr[0].Y - 0.4 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(ColLinesTopStart[0]);
            }
            else
            {
                GLine comLineTopStart = new GLine(gCanvas, StartPointTopArr[0], new Point(StartPointTopArr[0].X - 0.15 * scale, StartPointTopArr[0].Y));
                GeometryEngineRFT.Shapes["RFT"].Add(comLineTopStart);
            }

            for (int i = 1; i < ColLinesTopStart.Length; i++)
            {
                ColLinesTopStart[i] = new GLine(gCanvas, StartPointTopArr[i], new Point(StartPointTopArr[i].X, StartPointTopArr[i].Y - 0.40 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(ColLinesTopStart[i]);
            }

            /*-----------------Top End Lines---------------*/
            for (int i = 0; i < ColLinesTopEnd.Length - 1; i++)
            {
                ColLinesTopEnd[i] = new GLine(gCanvas, EndPointTopArr[i], new Point(EndPointTopArr[i].X, EndPointTopArr[i].Y - 0.40 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(ColLinesTopEnd[i]);
            }

            //Case Of Cantilever at End
            if (GeometryEditorVM.GeometryEditor.RestraintsCollection[SpanVals.Length].SelectedRestraint != Restraints.NoRestraints)
            {
                ColLinesTopEnd[ColLinesTopEnd.Length - 1] = new GLine(gCanvas, EndPointTopArr[ColLinesBotEnd.Length - 1], new Point(EndPointTopArr[ColLinesBotEnd.Length - 1].X, EndPointTopArr[ColLinesBotEnd.Length - 1].Y - 0.4 * scale));//---
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(ColLinesTopEnd[ColLinesTopEnd.Length - 1]);
            }
            else
            {
                GLine comLineTopEnd = new GLine(gCanvas, EndPointTopArr[ColLinesBotEnd.Length - 1], new Point(EndPointTopArr[ColLinesBotEnd.Length - 1].X + 0.15 * scale, EndPointTopArr[ColLinesBotEnd.Length - 1].Y));
                GeometryEngineRFT.Shapes["RFT"].Add(comLineTopEnd);
            }

            /*-------------Start and End Column Lines-------------*/
            //Start Column Line
            //Case of Cantilever at start:
            if (GeometryEditorVM.GeometryEditor.RestraintsCollection[0].SelectedRestraint != Restraints.NoRestraints)
            {
                GLine startColLine = new GLine(gCanvas, new Point(StartPointTopArr[0].X - 0.15 * scale, StartPointTopArr[0].Y - 0.40 * scale)
                                               , new Point(StartPointBotArr[0].X - 0.15 * scale, StartPointBotArr[0].Y + 0.40 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(startColLine);
            }
            else
            {
                GLine startColLine = new GLine(gCanvas, new Point(StartPointTopArr[0].X - 0.15 * scale, StartPointTopArr[0].Y)
                                               , new Point(StartPointBotArr[0].X - 0.15 * scale, StartPointBotArr[0].Y));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(startColLine);
            }

            //End Colimn Line
            //Case of Cantilever at end
            if (GeometryEditorVM.GeometryEditor.RestraintsCollection[SpanVals.Length].SelectedRestraint != Restraints.NoRestraints)
            {
                GLine endColLine = new GLine(gCanvas, new Point(EndPointTopArr[SpanVals.Length - 1].X + 0.15 * scale, EndPointTopArr[SpanVals.Length - 1].Y - 0.40 * scale)
                                             , new Point(EndPointBotArr[SpanVals.Length - 1].X + 0.15 * scale, EndPointBotArr[SpanVals.Length - 1].Y + 0.40 * scale));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(endColLine);
            }
            else
            {
                GLine endColLine = new GLine(gCanvas, new Point(EndPointTopArr[SpanVals.Length - 1].X + 0.15 * scale, EndPointTopArr[SpanVals.Length - 1].Y)
                                             , new Point(EndPointBotArr[SpanVals.Length - 1].X + 0.15 * scale, EndPointBotArr[SpanVals.Length - 1].Y));
                //add to the CANVAS
                GeometryEngineRFT.Shapes["RFT"].Add(endColLine);
            }
        }
コード例 #14
0
        private unsafe Bitmap CalculateColorPickerBitmap(float hue)
        {
            Bitmap bitmap = new Bitmap(120, 120);
            Color  color  = Color.FromKnownColor(KnownColor.Control);
            float  num    = hue * -0.0174532924f;
            double num2   = (double)num;
            float  num3   = (float)Math.Cos(num2);
            GLine  gLine  = (float)Math.Sin(num2);
            double num4   = (double)(num + 2.09439516f);
            float  num5   = (float)Math.Cos(num4);
            float  num6   = num5;
            float  num7   = (float)Math.Sin(num4);
            GLine  gLine2 = num7;
            double num8   = (double)(num - 2.09439516f);
            float  num9   = (float)Math.Cos(num8);
            GLine  gLine3 = (float)Math.Sin(num8);
            int    num10  = 0;

            do
            {
                float num11 = (float)(num10 - 60);
                float num12 = num11 + 0.5f;
                int   num13 = -60;
                do
                {
                    float num14    = num12;
                    float num15    = (float)num13;
                    float num16    = num15 + 0.5f;
                    float num17    = num16;
                    float expr_AC  = num17;
                    float arg_B2_0 = expr_AC * expr_AC;
                    float expr_B0  = num14;
                    float num18    = arg_B2_0 + expr_B0 * expr_B0;
                    if (num18 > 3685.353f)
                    {
                        bitmap.SetPixel(num13 + 60, num10, color);
                    }
                    else if (num18 < 2236.61768f)
                    {
                        int   num19 = 0;
                        int   num20 = 0;
                        float num21 = num15 + 0.125f;
                        float num22 = num15 + 0.375f;
                        float num23 = num15 + 0.625f;
                        float num24 = num15 + 0.875f;
                        do
                        {
                            GPoint2 gPoint = num21;
                            float   num25  = ((float)num20 + 0.5f) * 0.25f + num11;
                            *(ref gPoint + 4) = num25;
                            if (*(ref gPoint + 4) * num3 + gPoint * gLine - 22.5f < 0f && gPoint * gLine2 + *(ref gPoint + 4) * num6 - 22.5f < 0f && gPoint * gLine3 + *(ref gPoint + 4) * num9 - 22.5f < 0f)
                            {
                                num19++;
                            }
                            gPoint            = num22;
                            *(ref gPoint + 4) = num25;
                            if (*(ref gPoint + 4) * num3 + gPoint * gLine - 22.5f < 0f && gPoint * gLine2 + *(ref gPoint + 4) * num6 - 22.5f < 0f && gPoint * gLine3 + *(ref gPoint + 4) * num9 - 22.5f < 0f)
                            {
                                num19++;
                            }
                            gPoint            = num23;
                            *(ref gPoint + 4) = num25;
                            if (*(ref gPoint + 4) * num3 + gPoint * gLine - 22.5f < 0f && gPoint * gLine2 + *(ref gPoint + 4) * num6 - 22.5f < 0f && gPoint * gLine3 + *(ref gPoint + 4) * num9 - 22.5f < 0f)
                            {
                                num19++;
                            }
                            gPoint            = num24;
                            *(ref gPoint + 4) = num25;
                            if (*(ref gPoint + 4) * num3 + gPoint * gLine - 22.5f < 0f && gPoint * gLine2 + *(ref gPoint + 4) * num6 - 22.5f < 0f && gPoint * gLine3 + *(ref gPoint + 4) * num9 - 22.5f < 0f)
                            {
                                num19++;
                            }
                            num20++;
                        }while (num20 < 4);
                        if (num19 != 0)
                        {
                            GPoint2 gPoint2 = num16;
                            *(ref gPoint2 + 4) = num12;
                            float num26 = num5;
                            float num27 = num7;
                            float num28 = (num27 * gPoint2 + num26 * *(ref gPoint2 + 4) + 45f) * 0.0148148146f;
                            float num29;
                            if (num28 <= 0f)
                            {
                                num29 = 0f;
                                goto IL_32A;
                            }
                            num29 = num28;
                            if (num28 < 1f)
                            {
                                goto IL_32A;
                            }
                            float num30 = 1f;
IL_337:
                            double num31 = (double)(num + 3.66519165f);
                            float num32 = (float)Math.Cos(num31);
                            float num33 = (float)Math.Sin(num31);
                            float num34 = num33 * gPoint2 + num32 * *(ref gPoint2 + 4);
                            if (num30 <= 0.001f)
                            {
                                goto IL_3A2;
                            }
                            num34 = num34 / num30 * 0.0222222228f / (float)Math.Sqrt(3.0) + 0.5f;
                            if (num34 <= 0f)
                            {
                                goto IL_3A2;
                            }
                            float num35 = num34;
                            if (num34 < 1f)
                            {
                                goto IL_3B4;
                            }
                            float num36 = 1f;
IL_3C1:
                            GColor gColor;
                            *(ref gColor + 8)  = 0f;
                            *(ref gColor + 4)  = 0f;
                            gColor             = 0f;
                            *(ref gColor + 12) = 1f;
                            < Module >.GColor.FromHSV(ref gColor, (int)((double)hue), (int)((double)(num36 * 100f)), (int)((double)(num30 * 100f)));
                            if (num19 == 16)
                            {
                                Color color2 = Color.FromArgb(255, (int)(gColor * 255f), (int)((double)(*(ref gColor + 4) * 255f)), (int)((double)(*(ref gColor + 8) * 255f)));
                                bitmap.SetPixel(num13 + 60, num10, color2);
                                goto IL_8D1;
                            }
                            float num37  = (float)num19 * 0.0625f;
                            float num38  = 1f - num37;
                            Color color3 = Color.FromArgb(255, (int)((float)color.R * num38 + num37 * gColor * 255f), (int)((double)((float)color.G * num38 + num37 * *(ref gColor + 4) * 255f)), (int)((double)((float)color.B * num38 + num37 * *(ref gColor + 8) * 255f)));
                            bitmap.SetPixel(num13 + 60, num10, color3);
                            goto IL_8D1;
IL_3B4:
                            num36 = num35;
                            goto IL_3C1;
IL_3A2:
                            num35 = 0f;
                            goto IL_3B4;
IL_32A:
                            num30 = num29;
                            goto IL_337;
                        }
                        bitmap.SetPixel(num13 + 60, num10, color);
                    }
コード例 #15
0
        public string GetSelectedText(TextFormatOption opt)
        {
            System.Text.StringBuilder b = new StringBuilder();
            TextPoint head = HeadPoint;
            TextPoint tail = TailPoint;

            GLine l  = _owner.CharacterDocument.FindLineOrEdge(head.Line);
            int   p0 = head.Column;

            if (l.Text[p0] == GLine.WIDECHAR_PAD)
            {
                p0--;
            }
            if (p0 < 0)
            {
                return("");
            }

            bool isrect = (opt & TextFormatOption.Rectangle) != 0;
            int  p1     = 0;

            if (isrect)
            {
                p1 = tail.Column;
                GLine tl = _owner.CharacterDocument.FindLineOrEdge(tail.Line);
                if (tl.Text[p1] == GLine.WIDECHAR_PAD)
                {
                    p1--;
                }

                if (p0 == p1)
                {
                    return("");
                }

                if (p0 > p1)
                {
                    l = tl;
                    int p3 = p0; p0 = p1; p1 = p3;
                }
            }

            int start = p0;

            for (; l != null && l.ID <= tail.Line; l = l.NextLine)
            {
                //note: 本来 l==null はないはずだがクラッシュレポートのため回避

                bool fCRLF =
                    (opt & (TextFormatOption.AsLook | TextFormatOption.Rectangle)) != 0 ||
                    l.EOLType != EOLType.Continue;

                char[] text = l.Text;

                int end;
                if (isrect)
                {
                    start = p0;
                    if (text[start] == GLine.WIDECHAR_PAD)
                    {
                        start--;
                    }
                    end = p1 < l.Length?p1:l.Length;
                }
                else
                {
                    if (l.ID == tail.Line) //最終行
                    {
                        end   = tail.Column;
                        fCRLF = fCRLF && _pivotType == RangeType.Line;
                    }
                    else //最終以外の行
                    {
                        end = l.Length;

                        //nl=eol_required&&b.Length>0; //b.Length>0は行単位選択で余計な改行が入るのを避けるための処置
                        //↑KM: 意図して先頭の改行も含む様に囲まなければ、これらの行は入らないのでは?
                    }
                }

                if (end > text.Length)
                {
                    end = text.Length;
                }
                if (fCRLF && (opt & TextFormatOption.TrimEol) != 0 && l.ID != tail.Line)
                {
                    // TrimEol
                    for (; end > start; end--)
                    {
                        if (!char.IsWhiteSpace(text[end - 1]) && text[end - 1] != GLine.WIDECHAR_PAD && text[end - 1] != '\0')
                        {
                            break;
                        }
                    }
                }

                for (int i = start; i < end; i++)
                {
                    char ch = text[i];
                    if (ch != GLine.WIDECHAR_PAD && ch != '\0')
                    {
                        b.Append(ch);
                    }
                    //末尾にNULL文字が入るケースがあるようだ
                }

                //note: LFのみをクリップボードに持っていっても他のアプリの混乱があるだけなのでやめておく
                if (fCRLF)
                {
                    b.Append("\r\n");
                }

                start = 0;
            }

            return(b.ToString());
        }