예제 #1
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            if (memento.Contains("Outgoings"))
            {
                foreach (var ex in memento.ReadExternalizables("Outgoings"))
                {
                    var edge = ex as IConnection;
                    if (edge != null)
                    {
                        _Outgoings.Add(edge);
                    }
                }
            }

            if (memento.Contains("Incomings"))
            {
                foreach (var ex in memento.ReadExternalizables("Incomings"))
                {
                    var edge = ex as IConnection;
                    if (edge != null)
                    {
                        _Incomings.Add(edge);
                    }
                }
            }
        }
예제 #2
0
        // ========================================
        // method
        // ========================================
        // === IPersistable ==========
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteExternalizable("SourceDecoration", _sourceDecoration);
            memento.WriteExternalizable("TargetDecoration", _targetDecoration);
        }
 // ========================================
 // method
 // ========================================
 // === IPersistable ==========
 public override void WriteExternal(IMemento memento, ExternalizeContext context)
 {
     base.WriteExternal(memento, context);
     memento.WriteFloat("Angle", _angle);
     memento.WriteBool("IsFlippedHorizontal", _isFlippedHorizontal);
     memento.WriteBool("IsFlippedVertical", _isFlippedVertical);
 }
예제 #4
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            _points    = memento.ReadSerializable("Points") as List <Point>;
            _hitMargin = memento.ReadInt("HitMargin");
        }
        // ========================================
        // method
        // ========================================
        public virtual void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            memento.WriteBool("IsVisible", _isVisible);
            memento.WriteExternalizable("Layout", _layout);

            if (_layoutConstraints != null)
            {
                var constraints = new Dictionary <IMemento, object>();
                foreach (var pair in _layoutConstraints)
                {
                    var childMem = context.GetMemento("Children", pair.Key);
                    if (childMem != null)
                    {
                        constraints[childMem] = pair.Value;
                    }
                }
                memento.WriteSerializable("LayoutConstraints", constraints);
            }

            var data = new Dictionary <string, object>();

            if (_persistentData != null)
            {
                foreach (var pair in _persistentData)
                {
                    data[pair.Key] = pair.Value;
                }
            }
            memento.WriteSerializable("PersistentData", data);

            if (_structure.HasChildren)
            {
                memento.WriteExternalizables("Children", Children.As <IFigure, object>());
            }
        }
예제 #6
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            _font                = (FontDescription)memento.ReadSerializable("Font");
            _fontColor           = (Color)memento.ReadSerializable("FontColor");
            _foreground          = (Color)memento.ReadSerializable("Foreground");
            _background          = (IBrushDescription)memento.ReadSerializable("Background");
            _isForegroundEnabled = memento.ReadBool("IsForegroundEnabled");
            _isBackgroundEnabled = memento.ReadBool("IsBackgroundEnabled");
            _borderWidth         = memento.ReadInt("BorderWidth");
            _borderDashStyle     = (DashStyle)memento.ReadSerializable("BorderDashStyle");
            _minSize             = (Size)memento.ReadSerializable("MinSize");
            _maxSize             = (Size)memento.ReadSerializable("MaxSize");
            _autoSize            = (AutoSizeKinds)memento.ReadSerializable("AutoSize");

            _padding = (Insets)memento.ReadSerializable("Padding");

            _selectionBorderColor = (Color)memento.ReadSerializable("SelectionBorderColor");
            _selectionBrush       = (IBrushDescription)memento.ReadSerializable("SelectionBrush");
            StyledText            = (StyledText)memento.ReadSerializable("StyledText");

            _text = memento.ReadString("Text");
            _textHorizontalAlignment =
                (DataType::HorizontalAlignment)memento.ReadSerializable("TextHorizontalAlignment");
            _textVerticalAlignment =
                (VerticalAlignment)memento.ReadSerializable("TextVerticalAlignment");
        }
예제 #7
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            Source = memento.ReadExternalizable("Source") as IConnectable;
            Target = memento.ReadExternalizable("Target") as IConnectable;
        }
예제 #8
0
        //protected FontCache _FontCache {
        //    get { return _fontCache; }
        //}

        //protected SizeCache _SizeCache {
        //    get { return _sizeCache; }
        //}

        //protected BoundsCache _BoundsCache {
        //    get { return _boundsCache; }
        //}

        //protected VisualLineCache _VisualLineCache {
        //    get { return _visualLineCache; }
        //}

        // ========================================
        // method
        // ========================================
        // === IPersistable ==========
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteSerializable("Font", _font == null? null: _font.Clone());
            memento.WriteSerializable("FontColor", _fontColor);
            memento.WriteSerializable("Foreground", _foreground);
            memento.WriteSerializable("Background", _background == null? null: _background.Clone());
            memento.WriteBool("IsForegroundEnabled", _isForegroundEnabled);
            memento.WriteBool("IsBackgroundEnabled", _isBackgroundEnabled);
            memento.WriteInt("BorderWidth", _borderWidth);
            memento.WriteSerializable("BorderDashStyle", _borderDashStyle);
            memento.WriteSerializable("MinSize", _minSize);
            memento.WriteSerializable("MaxSize", _maxSize);
            memento.WriteSerializable("AutoSize", _autoSize);

            memento.WriteSerializable("Padding", _padding);

            memento.WriteSerializable("StyledText", _styledText == null? null: _styledText.CloneDeeply());
            memento.WriteSerializable("SelectionBorderColor", _selectionBorderColor);
            memento.WriteSerializable("SelectionBrush", _selectionBrush);

            memento.WriteString("Text", _text);
            memento.WriteSerializable("TextHorizontalAlignment", _textHorizontalAlignment);
            memento.WriteSerializable("TextVerticalAlignment", _textVerticalAlignment);
        }
예제 #9
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            _router = (IRouter)memento.ReadExternalizable("Router");

            var edgePoints = (Point[])memento.ReadSerializable("EdgePoints");

            _edgePoints.Clear();
            for (int i = 0, len = edgePoints.Length; i < len; ++i)
            {
                _edgePoints.Add(edgePoints[i]);
            }
            _hitMargin        = memento.ReadInt("HitMargin");
            _lineColor        = (Color)memento.ReadSerializable("LineColor");
            _lineWidth        = memento.ReadInt("LineWidth");
            _lineDashStyle    = (DashStyle)memento.ReadSerializable("DashStyle");
            _connectionMethod = (ConnectionMethodKind)memento.ReadSerializable("ConnectionMethod");

            _sourceConnectionOption = memento.ReadSerializable("SourceConnectionOption");
            _targetConnectionOption = memento.ReadSerializable("TargetConnectionOption");

            {
                var opt = memento.ReadSerializable("EdgeBehaviorOptions") as EdgeBehaviorOptions;
                if (opt == null)
                {
                    _behaviorOptions = new EdgeBehaviorOptions();
                }
                else
                {
                    _behaviorOptions = opt;
                }
            }
        }
예제 #10
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            SourceDecoration = memento.ReadExternalizable("SourceDecoration") as IEdgeDecoration;
            TargetDecoration = memento.ReadExternalizable("TargetDecoration") as IEdgeDecoration;
        }
 public override void ReadExternal(IMemento memento, ExternalizeContext context)
 {
     base.ReadExternal(memento, context);
     _angle = memento.ReadFloat("Angle");
     _isFlippedHorizontal = memento.ReadBool("IsFlippedHorizontal");
     _isFlippedVertical   = memento.ReadBool("IsFlippedVertical");
 }
예제 #12
0
        // ========================================
        // method
        // ========================================
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteSerializable("Points", _points);
            memento.WriteInt("HitMargin", _hitMargin);
        }
예제 #13
0
        // ========================================
        // property
        // ========================================

        // ========================================
        // method
        // ========================================
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteBool("IsVertical", _isVertical);
            memento.WriteFloat("HeadLengthRatio", _headLengthRatio);
            memento.WriteFloat("ShaftWidthRatio", _shaftWidthRatio);
        }
예제 #14
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            _isVertical      = memento.ReadBool("IsVertical");
            _headLengthRatio = memento.ReadFloat("HeadLengthRatio");
            _shaftWidthRatio = memento.ReadFloat("ShaftWidthRatio");
        }
예제 #15
0
        // ========================================
        // property
        // ========================================

        // ========================================
        // method
        // ========================================
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteSerializable("Direction", _direction);
            memento.WriteFloat("HeadLengthRatio", _headLengthRatio);
            memento.WriteFloat("ShaftWidthRatio", _shaftWidthRatio);
        }
예제 #16
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            _direction       = (Directions)memento.ReadSerializable("Direction");
            _headLengthRatio = memento.ReadFloat("HeadLengthRatio");
            _shaftWidthRatio = memento.ReadFloat("ShaftWidthRatio");
        }
예제 #17
0
        // ========================================
        // property
        // ========================================

        // ========================================
        // method
        // ========================================
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteBool("IsNotEqual", _isNotEqual);
            memento.WriteFloat("WidthRatio", _widthRatio);
            memento.WriteFloat("MarginRatio", _marginRatio);
            memento.WriteFloat("StrikeRatio", _strikeMarginRatio);
        }
예제 #18
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            _isNotEqual        = memento.ReadBool("IsNotEqual");
            _widthRatio        = memento.ReadFloat("WidthRatio");
            _marginRatio       = memento.ReadFloat("MarginRatio");
            _strikeMarginRatio = memento.ReadFloat("StrikeRatio");
        }
예제 #19
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            _imageDesc = memento.ReadSerializable("ImageDesc") as IImageDescription;

            _imageSize = (Size)memento.ReadSerializable("ImageSize");
            _opacity   = memento.ReadFloat("Opacity");
            _needRecreateImageOnBoundsChanged = memento.ReadBool("NeedRecreateImageOnBoundsChanged");
            _needImageFitted = memento.ReadBool("NeedImageFitted");
        }
예제 #20
0
        // ========================================
        // method
        // ========================================
        // === IPersistable ==========
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteSerializable("ImageDesc", _imageDesc == null? null: _imageDesc.Clone());

            memento.WriteSerializable("ImageSize", _imageSize);
            memento.WriteFloat("Opacity", _opacity);
            memento.WriteBool("NeedRecreateImageOnBoundsChanged", _needRecreateImageOnBoundsChanged);
            memento.WriteBool("NeedImageFitted", _needImageFitted);
        }
예제 #21
0
        // === IPersistable ==========
        public void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            var modelSerializer = context.ExtendedData[EditorConsts.ModelSerializerKey] as IModelSerializer;

            if (modelSerializer == null)
            {
                throw new ArgumentException("context.ExtendedData is invalid");
            }

            memento.WriteExternalizable("Figure", Figure);
            memento.WriteSerializable("ModelHint", modelSerializer.Save(Model));
            memento.WriteExternalizables("Children", Children.As <Editor, object>());
        }
예제 #22
0
        // ========================================
        // method
        // ========================================
        // === IPersistable ==========
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);


            if (_outgoings != null)
            {
                memento.WriteExternalizables("Outgoings", _outgoings.As <IConnection, object>());
            }
            if (_incomings != null)
            {
                memento.WriteExternalizables("Incomings", _incomings.As <IConnection, object>());
            }
        }
        public virtual void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            _isVisible = memento.ReadBool("IsVisible");
            _layout    = memento.ReadExternalizable("Layout") as ILayout;
            if (_layout != null)
            {
                _layout.Owner = this;
            }
            if (memento.Contains("LayoutConstraints"))
            {
                var constraints = memento.ReadSerializable("LayoutConstraints") as Dictionary <IMemento, object>;
                if (constraints.Count > 0)
                {
                    foreach (var pair in constraints)
                    {
                        var child = context.GetExternalizable("Children", pair.Key) as IFigure;
                        LayoutConstraints[child] = pair.Value;
                    }
                }
            }
            if (memento.Contains("PersistentData"))
            {
                var data = memento.ReadSerializable("PersistentData") as Dictionary <string, object>;
                if (data.Count > 0)
                {
                    foreach (var pair in data)
                    {
                        PersistentData[pair.Key] = pair.Value;
                    }
                }
            }

            if (memento.Contains("Children"))
            {
                var children = memento.ReadExternalizables("Children");
                foreach (var child in children)
                {
                    var childFig = child as IFigure;
                    if (childFig != null)
                    {
                        Children.Add(childFig);
                    }
                }
            }
        }
예제 #24
0
        // ========================================
        // method
        // ========================================
        // === IPersistable ==========
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            /// ValueにFigureのMementoを入れたTableDataを作る
            var memTableData = new TableData <IMemento>();

            memTableData.Redim(_tableData.RowCount, _tableData.ColumnCount);

            memTableData.MinRowHeight   = _tableData.MinRowHeight;
            memTableData.MinColumnWidth = _tableData.MinColumnWidth;

            /// row
            for (int i = 0, len = _tableData.RowCount; i < len; ++i)
            {
                var row    = _tableData.Rows.ElementAt(i);
                var memRow = memTableData.Rows.ElementAt(i);
                memRow.Height = row.Height;
            }

            /// column
            for (int i = 0, len = _tableData.ColumnCount; i < len; ++i)
            {
                var col    = _tableData.Columns.ElementAt(i);
                var memCol = memTableData.Columns.ElementAt(i);
                memCol.Width = col.Width;
            }

            /// cell
            for (int i = 0, len = _tableData.CellCount; i < len; ++i)
            {
                var cell    = _tableData.Cells.ElementAt(i);
                var memCell = memTableData.Cells.ElementAt(i);
                memCell.Value = context.GetMemento("Cell", cell.Value);
                //memCell.ColumnSpan = cell.ColumnSpan;
                //memCell.RowSpan = cell.RowSpan;
                if (cell.ColumnSpan != 1 || cell.RowSpan != 1)
                {
                    memTableData.SetSpan(memCell, cell.ColumnSpan, cell.RowSpan);
                }
                memCell.Color = cell.Color;
            }

            memento.WriteSerializable("TableData", memTableData);
        }
예제 #25
0
        // ========================================
        // method
        // ========================================
        // === IPersistable ==========
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteExternalizable("Router", _router);

            memento.WriteSerializable("EdgePoints", _edgePoints.ToArray());
            memento.WriteInt("HitMargin", _hitMargin);
            memento.WriteSerializable("LineColor", _lineColor);
            memento.WriteInt("LineWidth", _lineWidth);
            memento.WriteSerializable("DashStyle", _lineDashStyle);
            memento.WriteSerializable("ConnectionMethod", _connectionMethod);

            memento.WriteSerializable("SourceConnectionOption", _sourceConnectionOption);
            memento.WriteSerializable("TargetConnectionOption", _targetConnectionOption);

            memento.WriteSerializable("EdgeBehaviorOptions", _behaviorOptions);
        }
예제 #26
0
        public void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            _inLoading = true;

            var modelSerializer = context.ExtendedData[EditorConsts.ModelSerializerKey] as IModelSerializer;
            var site            = context.ExtendedData[EditorConsts.EditorSiteKey] as IEditorSite;

            if (modelSerializer == null || site == null)
            {
                throw new ArgumentException("context.ExtendedData is invalid");
            }

            var model = modelSerializer.Load(memento.ReadSerializable("ModelHint"));
            var fig   = memento.ReadExternalizable("Figure") as IFigure;
            var ctrl  = site.ControllerFactory.CreateController(model); /// Controllerは作り直す

            Model       = model;
            _Figure     = fig;
            _Controller = ctrl;

            using (Figure.DirtManager.BeginDirty()) {
                ctrl.ConfigureEditor(this);

                if (memento.Contains("Children"))
                {
                    foreach (var child in memento.ReadExternalizables("Children"))
                    {
                        var childEditor = child as Editor;
                        if (childEditor != null)
                        {
                            AddChildEditor(childEditor);
                        }
                    }
                }

                RelocateAllHandles();
                RelocateFocus();

                //Refresh();
                //Enable();
            }

            _inLoading = false;
        }
예제 #27
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            /// ValueにFigureのMementoが入ったTableDataから復元する
            var memTableData = memento.ReadSerializable("TableData") as TableData <IMemento>;

            _tableData.Redim(memTableData.RowCount, memTableData.ColumnCount);

            _tableData.MinRowHeight   = memTableData.MinRowHeight;
            _tableData.MinColumnWidth = memTableData.MinColumnWidth;

            /// row
            for (int i = 0, len = _tableData.RowCount; i < len; ++i)
            {
                var row    = _tableData.Rows.ElementAt(i);
                var memRow = memTableData.Rows.ElementAt(i);
                row.Height = memRow.Height;
            }

            /// column
            for (int i = 0, len = _tableData.ColumnCount; i < len; ++i)
            {
                var col    = _tableData.Columns.ElementAt(i);
                var memCol = memTableData.Columns.ElementAt(i);
                col.Width = memCol.Width;
            }
            /// cell
            for (int i = 0, len = _tableData.CellCount; i < len; ++i)
            {
                var cell    = _tableData.Cells.ElementAt(i);
                var memCell = memTableData.Cells.ElementAt(i);
                cell.Value = context.GetExternalizable("Cell", memCell.Value) as TableCellFigure;

                //cell.ColumnSpan = memCell.ColumnSpan;
                //cell.RowSpan = memCell.RowSpan;
                if (memCell.ColumnSpan != 1 || memCell.RowSpan != 1)
                {
                    _tableData.SetSpan(cell, memCell.ColumnSpan, memCell.RowSpan);
                }
                cell.Color = memCell.Color;
            }
        }
예제 #28
0
            public void WriteExternal(IMemento memento, ExternalizeContext context)
            {
                var parentEditor = _editor.Parent;
                var table        = parentEditor.Model as MemoTable;
                var cell         = _editor.Model as MemoTableCell;

                for (int rowIndex = 0; rowIndex < table.RowCount; ++rowIndex)
                {
                    var row = table.Rows.ElementAt(rowIndex);
                    for (int colIndex = 0; colIndex < table.ColumnCount; ++colIndex)
                    {
                        var c = row.Cells.ElementAt(colIndex);
                        if (c == cell)
                        {
                            memento.WriteInt("RowIndex", rowIndex);
                            memento.WriteInt("ColumnIndex", colIndex);
                            break;
                        }
                    }
                }
            }
예제 #29
0
        public override void ReadExternal(IMemento memento, ExternalizeContext context)
        {
            base.ReadExternal(memento, context);

            _foldRatio = memento.ReadFloat("FoldRatio");
        }
예제 #30
0
        // ========================================
        // method
        // ========================================
        public override void WriteExternal(IMemento memento, ExternalizeContext context)
        {
            base.WriteExternal(memento, context);

            memento.WriteFloat("FoldRatio", _foldRatio);
        }