Пример #1
0
        public static void SelMultiFrame(object sender, bool recalc)
        {
            Frame frm = (Frame)sender;
            MWin  win = MWin.I;

            if (win.ActFrm.Count > 0 && win.ActFrm[0].Root != frm.Root)
            {
                foreach (Frame frme in win.ActFrm)
                {
                    frme.IsSelected = false;
                }
                win.ActFrm.Clear();
            }
            if (frm.IsSelected)
            {
                win.ActFrm.Remove(frm);
            }
            else
            {
                win.ActFrm.Add(frm);
            }
            frm.IsSelected = !frm.IsSelected;
            win.rgbColorProp.DataContext = win.rgbFrameProp.DataContext = win.ActFrm.Count == 1 ? win.ActFrm[0] : null;
            if (recalc)
            {
                CalcLength();
            }
        }
Пример #2
0
        public static void CalcLength()
        {
            MWin   win = MWin.I;
            double len = win.ActFrm.Sum(t => t.Length);

            win.spTime.Value = len;
        }
Пример #3
0
        public static void SelShiftFrame(object sender)
        {
            int  minInd = 1000, maxInd = 0;
            MWin win = MWin.I;

            for (int i = 0; i < win.ActCont.Frames.Count; i++)
            {
                if (win.ActCont.Frames[i].IsSelected)
                {
                    minInd = i < minInd ? i : minInd;
                    maxInd = i > maxInd ? i : maxInd;
                }
            }
            Frame fr  = (Frame)sender;
            int   ind = win.ActCont.Frames.IndexOf(fr);

            if (ind < 0)
            {
                SelOneFrame(fr);
                return;
            }
            if (ind < minInd)
            {
                SelectFromTo(ind, minInd);
            }
            else if (ind > maxInd)
            {
                SelectFromTo(maxInd, ind);
            }
        }
Пример #4
0
        internal static void DelFrame()
        {
            if (!IsAllowEdit)
            {
                return;
            }
            MWin win = MWin.I;

            foreach (Frame fr in win.ActFrm)
            {
                fr.IsSelected = false;
                win.ActCont.Frames.Remove(fr);
            }
            win.ActFrm.Clear();
        }
Пример #5
0
        internal static void PasteObject()
        {
            MWin win = MWin.I;

            if (_data.GetType() == typeof(Color[]))
            {
                Color[] col = (Color[])_data;
                win.ActFrm[0].SetColors(col[0], col[1]);
            }
            else if (_data.GetType() == typeof(List <Model.Frame>))
            {
                win.ActCont.InsertFrames(GetInsertPosition(false), (List <Model.Frame>)_data);
                EditUtil.RefreshSeekBar();
            }
        }
Пример #6
0
        public static void SelOneFrame(Frame sender)
        {
            MWin win = MWin.I;

            if (win.ActFrm.Count == 1 && win.ActFrm[0] == sender)
            {
                return;
            }
            foreach (Frame frme in win.ActFrm)
            {
                frme.IsSelected = false;
            }
            win.ActFrm.Clear();
            sender.IsSelected = true;
            win.ActFrm.Add(sender);
            win.rgbColorProp.DataContext = win.rgbFrameProp.DataContext = sender;
        }
Пример #7
0
        public static void SelController(Controller sender)
        {
            MWin win = MWin.I;

            if (win.ActCont == sender)
            {
                return;
            }
            for (int i = win.ActFrm.Count - 1; i > -1; i--)
            {
                if (!sender.Frames.Contains(win.ActFrm[i]))
                {
                    win.ActFrm[i].IsSelected = false;
                    win.ActFrm.Remove(win.ActFrm[i]);
                }
            }
            if (win.ActCont != null)
            {
                win.ActCont.IsSelected = false;
            }
            sender.IsSelected = true;
            win.ActCont       = sender;
        }
Пример #8
0
 /// <summary>
 /// Click event for the exit button. Closes the window.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Exit_Click(object sender, RoutedEventArgs e)
 {
     MWin.Close();
 }