예제 #1
0
 public void AddTimeline(TimeLine tl)
 {
     timelines.Add(tl);
 }
예제 #2
0
        private void Dialogs_MouseDown(object sender, MouseEventArgs e)
        {
            if (!ChooseConstraint && !ChooseConstraintLost && !ChooseByAlign && SelectedChanged != null)
            {
                int phindexx = dlginstance.GetSelectedPhrase(e.Location, ScaleZoom, Translate);
                if (phindexx == -1)
                {
                    phindexx = dlginstance.GetSelectedTimeLine(e.Location, ScaleZoom, Translate);
                    if (phindexx > -1)
                    {
                        if (FocusedEditPhrase != -1)
                        {
                            SelectedChanging(dlginstance.Phrase(FocusedEditPhrase));
                        }
                        if (FocusedEditTimeline != -1)
                        {
                            SelectedChangingTL(dlginstance.Timeline(FocusedEditTimeline));
                        }
                        FocusedEditTimeline = phindexx;

                        FocusedEditPhrase   = -1;
                        FocusedEditTimeline = phindexx;
                        this.Refresh();
                        TimeLine t = dlginstance.Timeline(phindexx);
                        SelectedChangedTL.Invoke(t);

                        //return;
                        goto next;
                    }
                    //else
                    //TranslateFocus = true;
                    //movestart = e.Location;
                    //return;
                }
                else
                {
                    Phrase p = dlginstance.Phrase(phindexx);
                    if (FocusedEditPhrase != -1)
                    {
                        SelectedChanging(dlginstance.Phrase(FocusedEditPhrase));
                    }
                    if (FocusedEditTimeline != -1)
                    {
                        SelectedChangingTL(dlginstance.Timeline(FocusedEditTimeline));
                    }
                    if (FocusedEditPhrase != phindexx)
                    {
                        FocusedEditPhrase   = phindexx;
                        FocusedEditTimeline = -1;
                        this.Refresh();
                        SelectedChanged.Invoke(p);
                    }
                }
            }
next:
            int phindex = dlginstance.GetSelectedPhrase(e.Location, ScaleZoom, Translate);

            if (phindex == -1)
            {
                if (ChooseConstraint || ChooseConstraintLost || ChooseByAlign)
                {
                    if (Program.HitTest(e.X, e.Y, 0, 0, this.Width, 40))
                    {
                        ChooseConstraint = ChooseConstraintLost = ChooseByAlign = false;
                    }
                    this.Refresh();
                    return;
                }
                phindex = dlginstance.GetSelectedTimeLine(e.Location, ScaleZoom, Translate);

                if (phindex == -1)
                {
                    TranslateFocus = true;
                    movestart      = e.Location;
                    return;
                }

                FocusedTimeline = phindex;
                movestart       = e.Location;
                return;
            }
            if (ChooseConstraintLost)
            {
                if (dlginstance.Phrase(FocusedEditPhrase).PhraseConnectReferences.Contains(phindex))
                {
                    dlginstance.RemoveConnection(FocusedEditPhrase, phindex);
                    ChooseConstraintLost = false;
                    this.Refresh();
                    Changed = true;
                }
                else if (dlginstance.Phrase(phindex).PhraseConnectReferences.Contains(FocusedEditPhrase))
                {
                    dlginstance.RemoveConnection(phindex, FocusedEditPhrase);
                    ChooseConstraintLost = false;
                    this.Refresh();
                    Changed = true;
                }
                return;
            }
            if (ChooseConstraint)
            {
                if (phindex != FocusedEditPhrase &&
                    !dlginstance.Phrase(FocusedEditPhrase).PhraseConnectReferences.Contains(phindex) &&
                    !dlginstance.Phrase(phindex).PhraseConnectReferences.Contains(FocusedEditPhrase))
                {
                    //dlginstance.Phrase(FocusedEditPhrase).PhraseConnectReferences.Add(phindex);
                    dlginstance.Connect(FocusedEditPhrase, phindex);
                    ChooseConstraint = false;
                    this.Refresh();
                    Changed = true;
                }
                return;
            }
            if (ChooseByAlign)
            {
                if (phindex != FocusedEditPhrase)
                {
                    //dlginstance.phrases[FocusedEditPhrase].PhraseConnectReferences.Add(phindex);
                    Point newpos = dlginstance.Phrase(FocusedEditPhrase).position;
                    switch (orientation)
                    {
                    case AlignOrientation.horisontal:
                        newpos.Y = dlginstance.Phrase(phindex).position.Y;
                        dlginstance.Phrase(FocusedEditPhrase).position = newpos;
                        break;

                    case AlignOrientation.vertical:
                        newpos.X = dlginstance.Phrase(phindex).position.X;
                        dlginstance.Phrase(FocusedEditPhrase).position = newpos;
                        break;
                    }
                    ChooseByAlign = false;
                    this.Refresh();
                    Changed = true;
                }
                return;
            }
            FocusedPhrase = phindex;
            movestart     = e.Location;
        }
예제 #3
0
 public void AddTimeline(TimeLine tl)
 {
     baseDialog.AddTimeline(tl);
 }