Ejemplo n.º 1
0
 //-------------------------------------------------------
 public TSScript(TSGrid g)
 {
     tsg = g;
     tsd = g.tsd;
     sel = g.sel;
     ChkScriotFolder();
 }
Ejemplo n.º 2
0
        //----------------------------------------------------------
        public void FrameEnabeld(TSSelection sel, bool sw)
        {
            int y0 = sel.Start;

            if (y0 < 0)
            {
                y0 = 0;
            }
            int y1 = sel.Last;

            if (y1 >= m_FrameCount)
            {
                y1 = m_FrameCount;
            }
            int v = -1;

            if (sw)
            {
                v = 0;
            }
            for (int i = y0; i <= y1; i++)
            {
                frameEnabled[i] = v;
            }
            checkFrameEnabed();
        }
Ejemplo n.º 3
0
        //----------------------------------------------------------
        public void SetCellData(TSSelection sel, int v)
        {
            int c = sel.Index;

            if ((c < 0) || (c >= m_CellCount))
            {
                return;
            }
            int f0 = sel.Start;

            if (f0 >= m_FrameCount)
            {
                return;
            }
            int f1 = sel.Last;

            if (f1 < 0)
            {
                return;
            }

            for (int i = f0; i <= f1; i++)
            {
                if ((i >= 0) && (i < m_FrameCount))
                {
                    cellData[c][i] = v;
                }
            }
        }
Ejemplo n.º 4
0
        //----------------------------------------------------------
        public void DeleteFrameWithDuration(TSSelection sel)
        {
            int y0 = sel.Start;

            if (y0 < 0)
            {
                y0 = 0;
            }
            int y1 = sel.Last + 1;

            if (y1 > m_FrameCount)
            {
                y1 = m_FrameCount;
            }
            int len = y1 - y0;

            if ((m_FrameCount - len) <= 0)
            {
                return;
            }
            for (int f = y1; f < m_FrameCount; f++)
            {
                for (int c = 0; c < m_CellCount; c++)
                {
                    cellData[c][f - len] = cellData[c][f];
                    cellData[c][f]       = 0;
                }
                frameEnabled[f - len] = frameEnabled[f];
                frameEnabled[f]       = 0;
            }
            SetSize(m_CellCount, m_FrameCount - len);
        }
Ejemplo n.º 5
0
        //----------------------------------------------------------
        public void InsertFrameWithDuration(TSSelection sel)
        {
            int y0 = sel.Start;

            if (y0 < 0)
            {
                y0 = 0;
            }
            int y1 = sel.Last + 1;

            if (y1 > m_FrameCount)
            {
                y1 = m_FrameCount;
            }
            int len = y1 - y0;

            SetSize(m_CellCount, m_FrameCount + len);
            for (int f = m_FrameCount - 1; f >= y1; f--)
            {
                for (int c = 0; c < m_CellCount; c++)
                {
                    cellData[c][f]       = cellData[c][f - len];
                    cellData[c][f - len] = 0;
                }
                frameEnabled[f]       = frameEnabled[f - len];
                frameEnabled[f - len] = -1;
            }
        }
Ejemplo n.º 6
0
        //----------------------------------------------------------
        public void InsertFrame(TSSelection sel)
        {
            int y0 = sel.Start;

            if (y0 < 0)
            {
                y0 = 0;
            }
            int y1 = sel.Last + 1;

            if (y1 > m_FrameCount)
            {
                y1 = m_FrameCount;
            }
            int len = y1 - y0;

            for (int f = m_FrameCount - 1; f >= y1; f--)
            {
                for (int c = 0; c < m_CellCount; c++)
                {
                    cellData[c][f]       = cellData[c][f - len];
                    cellData[c][f - len] = 0;
                }
            }
        }
Ejemplo n.º 7
0
        //**************************************************************

        public void CalcValue(TSSelection sel, int v, ValueEditMode md)
        {
            int idx = sel.Index;

            if ((idx < 0) || (idx >= m_CellCount))
            {
                return;
            }
            int y0 = sel.Start;

            if (y0 < 0)
            {
                y0 = 0;
            }
            int y1 = sel.Last;

            if (y1 >= m_FrameCount)
            {
                y1 = m_FrameCount - 1;
            }

            switch (md)
            {
            case ValueEditMode.add:
                for (int i = y0; i <= y1; i++)
                {
                    int v2 = cellData[idx][i] + v;

                    cellData[idx][i] = v2;
                }
                break;

            case ValueEditMode.dec:
                for (int i = y0; i <= y1; i++)
                {
                    int v2 = cellData[idx][i] - v;

                    cellData[idx][i] = v2;
                }
                break;

            default:
                for (int i = y0; i <= y1; i++)
                {
                    int v2 = v;

                    cellData[idx][i] = v;
                }
                break;
            }
        }
Ejemplo n.º 8
0
 //----------------------------------------------------------
 public void FrameEnabeld(TSSelection sel, bool sw)
 {
     /*
      * int y0 = sel.Start;
      * if (y0 < 0) y0 = 0;
      * int y1 = sel.Last;
      * if (y1 >= m_FrameCount) y1 = m_FrameCount;
      * int v = -1;
      * if (sw) v = 0;
      * for (int i = y0; i <= y1; i++)
      * {
      *      frameEnabled[i] = v;
      * }
      * checkFrameEnabed();
      */
 }
Ejemplo n.º 9
0
        //----------------------------------------------------------
        public void SetCellData(TSSelection sel, List <int> lst)
        {
            if (lst.Count <= 0)
            {
                return;
            }
            int c = sel.Index;

            if ((c < 0) || (c >= m_CellCount))
            {
                return;
            }

            int f0 = sel.Start;

            if (f0 >= m_FrameCount)
            {
                return;
            }
            int f1 = sel.Last;

            if (f1 < 0)
            {
                return;
            }


            int j = 0;

            for (int i = f0; i <= f1; i++)
            {
                if (j >= lst.Count)
                {
                    break;
                }
                if ((i >= 0) && (i < m_FrameCount))
                {
                    cellData[c][i] = lst[j];
                }
                j++;
            }
        }
Ejemplo n.º 10
0
        //----------------------------------------------------------
        public int[] GetCellData(TSSelection sel)
        {
            int c = sel.Index;

            if ((c < 0) || (c >= m_CellCount))
            {
                return(new int[0]);
            }
            int f0 = sel.Start;

            if (f0 >= m_FrameCount)
            {
                return(new int[0]);
            }
            if (f0 < 0)
            {
                f0 = 0;
            }
            int f1 = sel.Last;

            if (f1 < 0)
            {
                return(new int[0]);
            }
            if (f1 < 0)
            {
                f1 = 0;
            }

            int[] ret = new int[f1 - f0 + 1];

            int j = 0;

            for (int i = f0; i <= f1; i++)
            {
                ret[j] = cellData[c][i];
                j++;
            }
            return(ret);
        }
Ejemplo n.º 11
0
        //----------------------------------------------------------
        public void AutoInput(TSSelection sel, int start, int end, int koma)
        {
            //-input
            int idx = sel.Index;
            int y0  = sel.Start;

            if (y0 < 0)
            {
                y0 = 0;
            }
            int y1 = sel.Last + 1;

            if (y1 > m_FrameCount)
            {
                y1 = m_FrameCount - 1;
            }
            //
            int s0 = start;
            int s1 = end;
            int k  = koma;

            if (k <= 0)
            {
                k = 1;
            }
            int ll = (s1 - s0 + 1) * k;

            int[] loop = new int[ll];
            int   v    = 0;

            if (s0 == s1)
            {
                for (int j = 0; j < k; j++)
                {
                    loop[j] = s0;
                }
            }
            else if (s0 < s1)
            {
                for (int i = s0; i <= s1; i++)
                {
                    for (int j = 0; j < k; j++)
                    {
                        loop[v] = i;
                        v++;
                    }
                }
            }
            else if (s0 > s1)
            {
                for (int i = s0; i <= s1; i--)
                {
                    for (int j = 0; j < k; j++)
                    {
                        loop[v] = i;
                        v++;
                    }
                }
            }
            v = 0;
            for (int i = y0; i < y1; i++)
            {
                cellData[idx][i] = loop[v];
                v = (v + 1) % ll;
            }
        }
Ejemplo n.º 12
0
 //------------------------------
 public void Assign(TSSelection t)
 {
     this.index = t.index;
     this.start = t.start;
     this.last  = t.last;
 }