示例#1
0
        //shape can be either cluster, text, free draw
        private void CleanupClusterCaptions(IVdShape shape, int indirectOwner)
        {
            ICaptionHost capHost = null;

            switch (shape.ShapeCode())
            {
            case VdShapeType.FreeForm:
                capHost = DocTools.GetCaptionHost(GetShapes(), shape);
                if (capHost != null)
                {
                    capHost.CapMgr().InvalidateCaption(shape);
                }

                //caption removed locally, update cluster
                if (capHost != null && shape.Id() == recentLocallyRemovedShapeId)
                {
                    _rt.clienRt.SendSyncState(capHost.Id(),
                                              capHost.GetState(TopicId));
                }
                break;

            case VdShapeType.Text:
                capHost = DocTools.GetCaptionHost(GetShapes(), shape);
                if (capHost != null)
                {
                    capHost.CapMgr().InvalidateCaption(shape);
                }

                //caption removed locally, update cluster
                if (capHost != null && shape.Id() == recentLocallyRemovedShapeId)
                {
                    _rt.clienRt.SendSyncState(capHost.Id(),
                                              capHost.GetState(TopicId));
                }
                break;

            case VdShapeType.Cluster:
            case VdShapeType.ClusterLink:
                //cluster removed locally, remove captions
                capHost = (ICaptionHost)shape;
                if (indirectOwner == _palette.GetOwnerId())
                {
                    if (capHost.CapMgr().text != null)
                    {
                        BeginRemoveSingleShape(capHost.CapMgr().text.Id());
                    }

                    if (capHost.CapMgr().FreeDraw != null)
                    {
                        BeginRemoveSingleShape(capHost.CapMgr().FreeDraw.Id());
                    }
                }
                break;
            }
        }
示例#2
0
        private void ReleaseCaptureAndFinishManip(IVdShape sh)
        {
            sh.UnderlyingControl().ReleaseMouseCapture();
            sh.UnderlyingControl().ReleaseAllTouchCaptures();
            sh.FinishManip();

            //if the moved shape is a caption of caption host, save caption host to save new relative position of caption
            var capHost = DocTools.GetCaptionHost(_doc.GetShapes(), sh);

            if (capHost != null)
            {
                capHost.CapMgr().UpdateRelatives();
                SendSyncState(capHost);
            }
        }