示例#1
0
        protected override void CompleteLinking()
        {
            if (_createdLink != null)
            {
                SlideView node1 = _createdLink.FromSlideView;
                SlideView node2 = _createdLink.ToSlideView;

                //check node links and free space
                if ((node1 != null && node2 != null))
                {
                    _createdLink.IsDefault = node1.GetOutgoingLinks().Count == 1;
                    ((SlideGraphController)Controller).RefreshDefaultSlidePath(false);
                }

                _createdLink = null;
            }

        }
示例#2
0
        /// <summary>
        /// Изменяет свойства сцены (Форма "Свойства")
        /// </summary>
        /// <param name="CurrentSlideView">Отображение сцены для изменения</param>
        /// <param name="Slide">Содержит требуемые изменения</param>
        /// <param name="NewDefLink">Новая ссылка по умолчанию</param>
        /// <param name="OldDefLink">Старая ссылка по умолчанию</param>
        /// <param name="IsStartup">True, если сцена - стартовая для сценария</param>
        internal void ChangeSlideData(SlideView CurrentSlideView, Slide Slide, SlideLink NewDefLink, bool IsStartup)
        {
            Model.HistoryManager.StartAtomicAction(CommandDescr.EditSlideDescr);
            Slide.Modified = DateTime.Now;
            string authorName = identity.User.FullName;
            if (String.IsNullOrEmpty(authorName))
                authorName = identity.User.Name;
            Slide.Author = authorName;
            Model.HistoryManager.RecordPropertyChanged(CurrentSlideView, String.Empty, "Slide");
            Slide.CopyTo(CurrentSlideView.Slide);

            if (NewDefLink != null)
            {
                RefreshDefaultLinkForSlide(CurrentSlideView, NewDefLink);
                foreach (var link in CurrentSlideView.GetOutgoingLinks().Except(new[] { NewDefLink }))
                {
                    Model.HistoryManager.RecordPropertyChanged(link, String.Empty, "IsDefault");
                    link.IsDefault = false;
                }
            }

            bool updateStartup = false;
            if (IsStartup)
            {
                Model.HistoryManager.RecordPropertyChanged(this, String.Empty, "m_startSlideId");
                StartSlide = CurrentSlideView;
                updateStartup = true;
            }
            else
            {
                if (StartSlide.Slide.Id == CurrentSlideView.Slide.Id && SlideCount > 1)
                {
                    Model.HistoryManager.RecordPropertyChanged(this, String.Empty, "m_startSlideId");
                    StartSlide = Model.Nodes.OfType<SlideView>().Except(new[] { CurrentSlideView }).First();
                    updateStartup = true;
                }
            }

            RefreshDefaultSlidePath(false);
            Model.HistoryManager.EndAtomicAction();

            if (updateStartup) UpdateStartSlide();
        }
示例#3
0
 /// <summary>
 /// Выбирает следующую сцену, следуя по заданной ссылке
 /// </summary>
 /// <param name="link">Ссылка для перехода</param>
 public void GoNextSlide(SlideLink link)
 {
     if (link != null)
     {
         //find next slide by link
         var slideView = link.ToSlideView;
         SelectSlideView(slideView);
     }
 }
示例#4
0
        private void LoadPresentation(bool rememberSelected)
        {
            Slide selected = SelectedSlide;

            if (rememberSelected)
                PresentationController.Instance.SuppressLayoutChanging = true;

            this.Model.BeginUpdate();
            this.Model.Clear();

            Presentation.Presentation m_Presentation = PresentationController.Instance.Presentation;
            PresentationInfo m_PresentationInfo = PresentationController.Instance.PresentationInfo;

            _inited = true;
            Author = m_PresentationInfo.Author;

            using (SplashForm form = SplashForm.CreateAndShowForm(false, false))
            {
                //create views for slides
                m_Presentation.SlideList.ForEach(slide =>
                {
                    form.Status = "Обработка сцены " + slide.Name;
                    form.Progress = (int)((float)(m_Presentation.SlideList.IndexOf(slide) + 1) / m_Presentation.SlideList.Count * 100.0f);

                    PointF? point = null;
                    if (m_Presentation.SlidePositionList.ContainsKey(slide.Id))
                    {
                        point = m_Presentation.SlidePositionList[slide.Id];
                    }

                    //slide.State = SlideState.Normal;
                    CreateSlideView(slide, point ?? GetNextSlideViewPos());
                });

                m_Presentation.SlideList.ForEach(slide =>
                {
                    slide.LinkList().ForEach(link =>
                    {
                        form.Status = "Обработка связи " + slide.Name;
                        form.Progress = (int)((slide.LinkList().IndexOf(link) + 1) / (float)slide.LinkList().Count * 100.0f);

                        SlideView v1 = slideViews(slide);
                        SlideView v2 = slideViews(link.NextSlide);
                        SlideLink slidelink = new SlideLink(PointF.Empty, PointF.Empty);

                        v1.CentralPort.TryConnect(slidelink.TailEndPoint);
                        v2.CentralPort.TryConnect(slidelink.HeadEndPoint);

                        slidelink.IsDefault = link.IsDefault;

                        Model.AppendChild(slidelink);
                        slidelink.Refresh();
                    });
                });

                StartSlide = slideViews(m_Presentation.StartSlide);
                StartSlide.IsStartSlide = true;

                UpdateStartSlide();
                RefreshDefaultSlidePath(true);

                SlideIdenty = new Identity(m_Presentation.SlideList.Max(s => s.Id));

                m_PresentationInfo.SlideInfoList.ForEach(s =>
                {
                    var slides = m_Presentation.SlideList.Where(slide => slide.Id == s.Id);
                    if (slides.Count() > 0)
                    {
                        //slideViews(slides.First()).IsLocked = s.LockingInfo != null;
                        if (s.LockingInfo != null)
                            slideViews(slides.First()).Lock(s.LockingInfo.RequireLock == RequireLock.ForEdit);
                        else
                            slideViews(slides.First()).Unlock();
                    }
                });
            }
            this.Model.EndUpdate();
            Model.HistoryManager.ClearHistory();

            if (selected != null && selected.IsLocked && PresentationController.Instance.CanUnlockSlide(selected))
            {
                Slide selClone = m_Presentation.SlideList.Where(s => s.Id == selected.Id).FirstOrDefault();
                if (selClone != null)
                {
                    selClone.SourceList.Clear();
                    selClone.SourceList.AddRange(selected.SourceList);

                    selClone.DisplayList.Clear();
                    foreach (Display d in selected.DisplayList)
                    {
                        Display newDisplay = d.Type.CreateNewDisplay();
                        selClone.DisplayList.Add(newDisplay);
                        foreach (Window w in d.WindowList)
                        {
                            newDisplay.WindowList.Add(w.SimpleClone());
                        }
                    }


                    if (rememberSelected && selected != null)
                    {
                        SelectSlideView(slideViews(selClone));
                    }
                }
            }
            PresentationController.Instance.SuppressLayoutChanging = false;
        }
示例#5
0
        public void Paste(PointF point)
        {
            if (!CanPaste) return;

            if (point.X < 0) point.X = 0;
            if (point.Y < 0) point.Y = 0;

            List<SlideLink> links = new List<SlideLink>();
            PointF lastPos = PointF.Empty;
            var slideEnum = SlideClibpoard.GetEnumerator();
            if (slideEnum.MoveNext())
            {
                PointF firstPoint = slideEnum.Current.GetPositionF();

                this.Model.HistoryManager.StartAtomicAction(CommandDescr.PasteElements);
                this.Model.BeginUpdate();

                Dictionary<SlideView, SlideView> mapping = new Dictionary<SlideView, SlideView>();
                Slide newSlide = CloneSlide(slideEnum.Current.Slide);
                newSlide.LabelId = -1;

                mapping.Add(slideEnum.Current, AddSlideView(newSlide, point));

                while (slideEnum.MoveNext())
                {
                    PointF pos = slideEnum.Current.GetPositionF();
                    pos.X = (pos.X - firstPoint.X) + point.X;
                    pos.Y = (pos.Y - firstPoint.Y) + point.Y;

                    Slide slide = CloneSlide(slideEnum.Current.Slide);
                    mapping.Add(slideEnum.Current, AddSlideView(slide, pos));

                    lastPos = pos;
                }

                //process the links
                foreach (SlideView view in SlideClibpoard)
                {
                    foreach (SlideLink linkView in view.GetOutgoingLinks())
                    {
                        if (SlideClibpoard.Contains(linkView.ToSlideView))
                        {
                            SlideView FromSlideView = mapping[view];
                            SlideView ToSlideView = mapping[linkView.ToSlideView];
                            SlideLink newLink = new SlideLink(Point.Empty, PointF.Empty);
                            FromSlideView.CentralPort.TryConnect(newLink.TailEndPoint);
                            ToSlideView.CentralPort.TryConnect(newLink.HeadEndPoint);

                            if (linkView.ToNode != null && linkView.FromNode != null)
                            {
                                newLink.IsDefault = linkView.IsDefault;
                                this.Model.AppendChild(newLink);
                            }
                            else
                            {
                                throw new ArgumentException("Некорректное поведение, собщите разработчику!", "linkView");
                            }
                        }
                    }
                }

                this.Model.EndUpdate();
                this.Model.HistoryManager.EndAtomicAction();
            }

            if (!lastPos.IsEmpty)
                EnsureVisible(lastPos);
        }
示例#6
0
        void CreateLinkInternal(SlideView FromSlideView, SlideView ToSlideView)
        {
            this.Model.BeginUpdate();
            SlideLink link = new SlideLink(PointF.Empty, PointF.Empty);
            FromSlideView.CentralPort.TryConnect(link.TailEndPoint);
            ToSlideView.CentralPort.TryConnect(link.HeadEndPoint);
            this.Model.AppendChild(link);
            link.IsDefault = FromSlideView.GetOutgoingLinks().Count == 1;
            this.Model.EndUpdate();

            RefreshDefaultSlidePath(true);
        }
示例#7
0
 public void RefreshDefaultLinkForSlide(SlideView view, SlideLink link)
 {
     List<SlideLink> links = view.GetOutgoingLinks();
     if (links.Count > 0)
     {
         Model.HistoryManager.RecordPropertyChanged(link, String.Empty, "IsDefault");
         link.IsDefault = true;
     }
 }
示例#8
0
        public SlidePropertiesForm(SlideGraphController AController)
        {
            InitializeComponent();
            m_controller = AController;
            CurrentSlideView = m_controller.SelectedSlideView;

            m_controller.OnLabelListChanhed += m_controller_OnLabelListChanhed;

            bool slideLocked = (CurrentSlideView.IsLocked && PresentationController.Instance.CanUnlockSlide(CurrentSlideView.Slide)) || DesignerClient.Instance.IsStandAlone;
            bool presentationLocked = PresentationController.Instance.PresentationLocked || DesignerClient.Instance.IsStandAlone;

            this.Text = CurrentSlideView.SlideName + " - Свойства";

            Slide = CurrentSlideView.Slide.Copy();
            Slide.SaveSlideLevelChanges(CurrentSlideView.Slide);

            if (CurrentSlideView.GetOutgoingLinks().Count > 0)
            {
                OldDefLink = NewDefLink = CurrentSlideView.GetOutgoingLinks().Where(l => l.IsDefault).First();
            }

            #region Add bindings
            nameText.DataBindings.Add("Text", Slide, "Name");
            nameText.ReadOnly = !slideLocked;
            labelsList.Enabled = slideLocked;
            labelsList.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;
            RefreshLabels();

            hourSpanEdit.DataBindings.Add("Value", Slide.Time, "Hours");
            hourSpanEdit.Enabled = slideLocked;
            minuteSpanEdit.DataBindings.Add("Value", Slide.Time, "Minutes");
            minuteSpanEdit.Enabled = slideLocked;
            secondSpanEdit.DataBindings.Add("Value", Slide.Time, "Seconds");
            secondSpanEdit.Enabled = slideLocked;
            authorText.DataBindings.Add("Text", Slide, "Author");
            modifiedLabel.DataBindings.Add("Text", Slide, "Modified");
            commentText.DataBindings.Add("Text", Slide, "Comment");
            commentText.ReadOnly = !slideLocked;
            #endregion

            if (nextSlideList.Enabled = NewDefLink != null && presentationLocked)
            {
                List<SlideView> list = CurrentSlideView.GetOutgoingSlideViews();
                list.ForEach(s => nextSlideList.Items.Add(s));
                nextSlideList.SelectedIndex = list.IndexOf(NewDefLink.ToSlideView);
            }

            bool flag = m_controller.StartSlide == CurrentSlideView;
            isStartupCheckBox.Checked = flag;

            bool flag2 = !flag & CurrentSlideView.GetIncomingSlideLinks().Count == 0;

            isStartupCheckBox.Enabled = flag2 & presentationLocked;
            
            bool visible =  presentationLocked | slideLocked;

            if (presentationLocked && !slideLocked)
            {
                visible = isStartupCheckBox.Enabled || nextSlideList.Items.Count > 0;
            }

            okButton.Visible = visible;

            if (!visible)
            {
                this.AcceptButton = cancelButton;
                cancelButton.Text = "OK";
            }

        }
示例#9
0
 private void nextSlideList_SelectedValueChanged(object sender, EventArgs e)
 {
     SlideView nextSlide = ((SlideView)nextSlideList.SelectedItem);
     NewDefLink = CurrentSlideView.GetOutgoingLinks().Where(l => nextSlide == l.ToSlideView).First();
     _modified = true;
 }
示例#10
0
 public SlideLink(SlideLink source)
     : base(source)
 {
 }
示例#11
0
 protected override Node CreateNode(PointF ptStart, PointF ptEnd)
 {
     SlideLink link = new SlideLink(ptStart, ptEnd);
     _createdLink = link;
     return link;
 }