예제 #1
0
        /// <summary>
        /// Inserts a phoneme-row.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnRowInsert_pho(object sender, EventArgs e)
        {
            string pos = Table.Rows[_r - 1][0].ToString();                      // deter the position-field ->

            int posSeparator = pos.IndexOf('.') + 1;                            // ie. only the digits after the separator
            int p2           = Int32.Parse(pos.Substring(posSeparator)) + 1;    // current suffix

            pos = pos.Substring(0, posSeparator);                               // current prefix w/ separator


            var row = RowTemplate.Clone() as DataGridViewRow;             // insert row in DataGridView ->

            row.CreateCells(this, String.Empty, String.Empty, String.Empty);
            Rows.Insert(_r, row);
            Rows[_r].HeaderCell.Value = pos + p2;


            DataRow dr = Table.NewRow();             // insert row in the DataTable ->

            dr[0] = pos + p2;
            for (int i = 1; i != Table.Columns.Count; ++i)
            {
                dr[i] = String.Empty;
            }
            Table.Rows.InsertAt(dr, _r);


            for (++_r; _r != Table.Rows.Count; ++_r)             // advance the post-insert rows ->
            {
                if (Utility.isWordstart(Table.Rows[_r][0].ToString()))
                {
                    break;
                }

                ++p2;
                Rows[_r].HeaderCell.Value = pos + p2;                 // in DataGridView
                Table.Rows[_r][0]         = pos + p2;                 // in the DataTable
            }

//			if (Waver != null) // NOTE: technically that's not necessary since cells are blank.
//				Waver.Invalidate();
        }
예제 #2
0
        /// <summary>
        /// Inserts an ortheme-row.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnRowInsert_ort(object sender, EventArgs e)
        {
            string pos; int p1;

            if (Rows.Count != 1)
            {
                if (_r == Rows.Count - 1)                 // is last (ie. default) row
                {
                    pos = Table.Rows[_r - 1][0].ToString();
                    p1  = 1;
                }
                else
                {
                    pos = Table.Rows[_r][0].ToString();
                    p1  = 0;
                }

                int posSeparator = pos.IndexOf('.');
                pos = pos.Substring(0, posSeparator);

                p1 += Int32.Parse(pos);
            }
            else             // has only a default row
            {
                p1 = 0;
            }


            var row = RowTemplate.Clone() as DataGridViewRow;             // insert row in DataGridView ->

            row.CreateCells(this, String.Empty, String.Empty, String.Empty);
            Rows.Insert(_r, row);
            Rows[_r].HeaderCell.Value = p1 + ".0";


            DataRow dr = Table.NewRow();             // insert row in the DataTable ->

            dr[0] = p1 + ".0";
            for (int i = 1; i != Table.Columns.Count; ++i)
            {
                dr[i] = String.Empty;
            }
            Table.Rows.InsertAt(dr, _r);


            if (_sil)
            {
                _sil = false;

                Rows[_r].Cells[0].Value =
                    Table.Rows[_r][1]   = StaticData.SIL;
            }


            for (++_r; _r != Table.Rows.Count; ++_r)             // advance the post-insert rows ->
            {
                if (Utility.isWordstart(pos = Table.Rows[_r][0].ToString()))
                {
                    ++p1;
                }

                int posSeparator = pos.IndexOf('.');
                pos = pos.Substring(posSeparator);

                Rows[_r].HeaderCell.Value =                               // in DataGridView
                                            Table.Rows[_r][0] = p1 + pos; // in the DataTable
            }
        }