Esempio n. 1
0
        /// <summary>
        /// call this when
        /// 1. user removes contact points so that local cursor needs to be removed
        /// 2. palette owner changes and we invalidate previous cursor
        /// </summary>
        /// <param name="ownId"></param>
        public void BeginFreeCursor(bool supressClusterMoveEvent)
        {
            //if currently we hold cursor on shape, remove it
            var ownedSh = DocTools.CursorOwnerToShape(_palette.GetOwnerId(), _doc.GetShapes());

            if (ownedSh != null && ownedSh.GetCursor() != null)
            {
                _rt.clienRt.SendCursorRequest(false, _palette.GetOwnerId(), ownedSh.Id(), _doc.TopicId);

                if (_movementDetected)
                {
                    if (ownedSh is VdBadge)
                    {
                        _rt.clienRt.SendStatsEvent(Discussions.model.StEvent.BadgeMoved,
                                                   ownedSh.GetCursor().OwnerId,
                                                   _doc.DiscussionId,
                                                   _doc.TopicId,
                                                   Discussions.model.DeviceType.Wpf);
                    }
                    else if (!supressClusterMoveEvent && ownedSh is VdCluster)
                    {
                        _rt.clienRt.SendStatsEvent(Discussions.model.StEvent.ClusterMoved,
                                                   ownedSh.GetCursor().OwnerId,
                                                   _doc.DiscussionId,
                                                   _doc.TopicId,
                                                   Discussions.model.DeviceType.Wpf);
                    }
                    else if (ownedSh is VdFreeForm)
                    {
                        _rt.clienRt.SendStatsEvent(Discussions.model.StEvent.FreeDrawingMoved,
                                                   ownedSh.GetCursor().OwnerId,
                                                   _doc.DiscussionId,
                                                   _doc.TopicId,
                                                   Discussions.model.DeviceType.Wpf);
                    }
                }

                if (_resizeDetected)
                {
                    if (ownedSh is VdFreeForm)
                    {
                        _rt.clienRt.SendStatsEvent(Discussions.model.StEvent.FreeDrawingResize,
                                                   ownedSh.GetCursor().OwnerId,
                                                   _doc.DiscussionId,
                                                   _doc.TopicId,
                                                   Discussions.model.DeviceType.Wpf);
                    }
                }

                _localCursorShape = null;
                if (localCursorChanged != null)
                {
                    localCursorChanged(this);
                }
            }

            _movementDetected = false;
            _resizeDetected   = false;
        }
Esempio n. 2
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;
            }
        }