示例#1
0
        private void TryEndHostCaption(IVdShape caption, CaptionType type)
        {
            //inject caption
            if (_hostAwaitingCaption == null)
            {
                return;
            }

            RemovePreviousCaption(_hostAwaitingCaption, type);

            if (caption is VdFreeForm)
            {
                _hostAwaitingCaption.CapMgr().FreeDraw = (VdFreeForm)caption;

                //initial resize of free form
                _hostAwaitingCaption.CapMgr().InitialResizeOfFreeForm();

                //send resized free form
                SendSyncState(_hostAwaitingCaption.CapMgr().FreeDraw);

                //cluster + title stats event
                _rt.clienRt.SendStatsEvent(StEvent.ClusterTitleAdded,
                                           _palette.GetOwnerId(),
                                           _doc.DiscussionId,
                                           _doc.TopicId,
                                           DeviceType.Wpf);
            }
            else if (caption is VdText)
            {
                _hostAwaitingCaption.CapMgr().text = (VdText)caption;

                //increase caption font
                //for(int i = 0; i<6; ++i)
                //    _hostAwaitingCaption.CapMgr().text.ScaleInPlace(true);

                SendSyncState(_hostAwaitingCaption.CapMgr().text);

                //cluster + title stats event
                _rt.clienRt.SendStatsEvent(StEvent.ClusterTitleAdded,
                                           _palette.GetOwnerId(),
                                           _doc.DiscussionId,
                                           _doc.TopicId,
                                           DeviceType.Wpf);
            }
            else
            {
                throw new NotSupportedException();
            }

            //update first time after build
            _hostAwaitingCaption.CapMgr().UpdateRelatives();

            //send state of cluster to attach captions on other clients
            SendSyncState(_hostAwaitingCaption);

            _hostAwaitingCaption = null;
        }
示例#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;
            }
        }
示例#3
0
 private void RemovePreviousCaption(ICaptionHost cluster, CaptionType type)
 {
     if (_hostAwaitingCaption.CapMgr().FreeDraw != null)
     {
         _doc.BeginRemoveSingleShape(_hostAwaitingCaption.CapMgr().FreeDraw.Id());
     }
     if (_hostAwaitingCaption.CapMgr().text != null)
     {
         _doc.BeginRemoveSingleShape(_hostAwaitingCaption.CapMgr().text.Id());
     }
 }
示例#4
0
        public ShapeCaptionsManager(ICaptionHost host, CaptionCreationRequested captionCreationRequested)
        {
            _hostShape = host;

            _captionCreationRequested = captionCreationRequested;

            btnDraw = new ClusterButton();
            btnDraw.btn.Click += __bntDraw;
            btnDraw.SetBrush((System.Windows.Media.Brush) Application.Current.TryFindResource("editBrush"));

            btnType = new ClusterButton();
            btnType.btn.Click += __bntType;
            btnType.SetBrush((System.Windows.Media.Brush)Application.Current.TryFindResource("keyboard"));
        }
示例#5
0
        public ShapeCaptionsManager(ICaptionHost host, CaptionCreationRequested captionCreationRequested)
        {
            _hostShape = host;

            _captionCreationRequested = captionCreationRequested;

            btnDraw            = new ClusterButton();
            btnDraw.btn.Click += __bntDraw;
            btnDraw.SetBrush((System.Windows.Media.Brush)Application.Current.TryFindResource("editBrush"));

            btnType            = new ClusterButton();
            btnType.btn.Click += __bntType;
            btnType.SetBrush((System.Windows.Media.Brush)Application.Current.TryFindResource("keyboard"));
        }
示例#6
0
        private void CaptionCreationRequested(CaptionType type, ICaptionHost host)
        {
            BeginHostCaption(host, type);
            switch (type)
            {
            case CaptionType.FreeDraw:
                EnterShapeCreationMode(VdShapeType.FreeForm, -1);
                break;

            case CaptionType.Text:
                //emulate text creation
                _palette.shapeType = VdShapeType.Text;
                EnterShapeCreationMode(VdShapeType.Text, -1);

                var clickLocation = host.capOrgProvider();
                InpDeviceDown(new Point(clickLocation.X, clickLocation.Y), null);
                break;
            }
        }
示例#7
0
 private void updateHostCaptions(ICaptionHost capHost)
 {
     capHost.CapMgr().SetBounds();
 }
示例#8
0
        private void BeginHostCaption(ICaptionHost host, CaptionType type)
        {
            _hostAwaitingCaption = host;

            RemovePreviousCaption(host, type);
        }
示例#9
0
 private void updateHostCaptions(ICaptionHost capHost)
 {
     capHost.CapMgr().SetBounds();
 }
示例#10
0
        private void TryEndHostCaption(IVdShape caption, CaptionType type)
        {
            //inject caption
            if (_hostAwaitingCaption == null)
                return;

            RemovePreviousCaption(_hostAwaitingCaption, type);

            if (caption is VdFreeForm)
            {
                _hostAwaitingCaption.CapMgr().FreeDraw = (VdFreeForm)caption;

                //initial resize of free form
                _hostAwaitingCaption.CapMgr().InitialResizeOfFreeForm();

                //send resized free form
                SendSyncState(_hostAwaitingCaption.CapMgr().FreeDraw);

                //cluster + title stats event
                _rt.clienRt.SendStatsEvent(StEvent.ClusterTitleAdded,
                                            _palette.GetOwnerId(),
                                            _doc.DiscussionId,
                                            _doc.TopicId,
                                            DeviceType.Wpf);
            }
            else if (caption is VdText)
            {
                _hostAwaitingCaption.CapMgr().text = (VdText)caption;

                //increase caption font
                //for(int i = 0; i<6; ++i)
                //    _hostAwaitingCaption.CapMgr().text.ScaleInPlace(true);

                SendSyncState(_hostAwaitingCaption.CapMgr().text);

                //cluster + title stats event
                _rt.clienRt.SendStatsEvent(StEvent.ClusterTitleAdded,
                                            _palette.GetOwnerId(),
                                            _doc.DiscussionId,
                                            _doc.TopicId,
                                            DeviceType.Wpf);
            }
            else
                throw new NotSupportedException();

            //update first time after build
            _hostAwaitingCaption.CapMgr().UpdateRelatives();

            //send state of cluster to attach captions on other clients
            SendSyncState(_hostAwaitingCaption);

            _hostAwaitingCaption = null;
        }
示例#11
0
 private void RemovePreviousCaption(ICaptionHost cluster, CaptionType type)
 {
     if (_hostAwaitingCaption.CapMgr().FreeDraw != null)
         _doc.BeginRemoveSingleShape(_hostAwaitingCaption.CapMgr().FreeDraw.Id());
     if (_hostAwaitingCaption.CapMgr().text != null)
         _doc.BeginRemoveSingleShape(_hostAwaitingCaption.CapMgr().text.Id());
 }
示例#12
0
        private void CaptionCreationRequested(CaptionType type, ICaptionHost host)
        {
            BeginHostCaption(host, type);
            switch (type)
            {
                case CaptionType.FreeDraw:
                    EnterShapeCreationMode(VdShapeType.FreeForm, -1);
                    break;
                case CaptionType.Text:
                    //emulate text creation
                    _palette.shapeType = VdShapeType.Text;
                    EnterShapeCreationMode(VdShapeType.Text, -1);

                    var clickLocation = host.capOrgProvider();
                    InpDeviceDown(new Point(clickLocation.X, clickLocation.Y), null);
                    break;
            }
        }
示例#13
0
        private void BeginHostCaption(ICaptionHost host, CaptionType type)
        {
            _hostAwaitingCaption = host;

            RemovePreviousCaption(host, type);
        }