public int GetC(VariationTypeE type, int id)
        {
            if (this.Game.Flags.IsFirtMove)
            {
                return(0);
            }

            NotationDataRow nd = GetNotationDataRow(id);

            if (nd == null)
            {
                return(0);
            }


            switch (type)
            {
            case VariationTypeE.Variation:
                return(1);

            case VariationTypeE.MainLine:
            case VariationTypeE.Insert:
            case VariationTypeE.Overwrite:
            default:
                if (nd.C == Notations.MaxColumnIndex)
                {
                    return(0);
                }

                return(nd.C + 1);
            }
        }
        public void SetMove(int r, int c)
        {
            NotationDataRow nd = Notations.GetNotationDataRow(r, c);

            Move m = Moves.GetByID(nd.Id);

            SetMove(m);
        }
        private void AddNotationView(Move m)
        {
            NotationDataRow nd = GetNotationDataRow(m.Id);

            if (nd == null)
            {
                return;
            }

            NotationView.Rows[nd.R][nd.C] = m.NotationForView;
        }
        public void SetNotationView(bool isSingle, Move m)
        {
            NotationDataRow nd = GetNotationDataRow(m.Id);

            if (nd == null)
            {
                return;
            }

            NotationView.Rows[nd.R][nd.C] = isSingle ? m.SingleNotationForView : m.DoubleNotationForView;
        }
        public int GetR(int id)
        {
            NotationDataRow nv = GetNotationDataRow(id);

            if (nv == null)
            {
                return(-1);
            }

            return(nv.R);
        }
        public int GetC(int id)
        {
            NotationDataRow nd = GetNotationDataRow(id);

            if (nd == null)
            {
                return(-1);
            }

            return(nd.C);
        }
        public int GetId(int r, int c)
        {
            NotationDataRow nd = GetNotationDataRow(r, c);

            if (nd == null)
            {
                return(-1);
            }

            return(nd.Id);
        }
Exemple #8
0
        private void AddMainLine(Move m)
        {
            int    i, r = 0, c = 0, d = 0;
            string str = "";

            Move move = Game.Moves.GetById(m.Pid);

            Moves moves = Game.Moves.GetLineFrom(move);

            if (moves == null)
            {
                return;
            }

            for (i = 0; i < moves.Count; i++)
            {
                move = moves[i];

                NotationDataRow nv = GetNotationDataRow(move.Id);

                r = nv.R;
                d = nv.C;

                str = NotationView.Rows[r][d].ToString();
                NotationView.Rows[r][d] = "";

                c++;

                if (r >= LastNotationViewRowIndex || i == 0 || c == 10)
                {
                    DataRow dr = NotationView.NewRow();
                    NotationView.Rows.Add(dr);
                    if (c == 10)
                    {
                        c = 0;
                    }
                }

                r = LastNotationViewRowIndex;

                nv.R = r;
                nv.C = c;

                NotationView.Rows[r][c] = str;
            }

            NotationData.AcceptChanges();
            NotationView.AcceptChanges();

            AddNotationData(m);
            AddNotationView(m);
            Scoring.AddCurrentMoveLine(m);
        }
Exemple #9
0
        private void AddOverwrite(Move m)
        {
            int j = 0, i, c = 0;

            if (m.HasNoParent)
            {
                j = -1;
                c = 0;

                for (i = NotationData.Rows.Count - 1; i > j; i--)
                {
                    NotationData.Rows[i].Delete();
                }

                for (i = LastNotationViewRowIndex; i > j; i--)
                {
                    NotationView.Rows[i].Delete();
                }

                NotationData.AcceptChanges();
                NotationView.AcceptChanges();

                this.Game.Moves.DeleteAllRows();

                AddNotationData(m);
                AddNotationView(m);
                Scoring.AddCurrentMoveLine(m);

                return;
            }
            else
            {
                j = GetNotationDataRowIndex(m.Pid);
            }

            for (i = LastNotationViewRowIndex; i > j; i--)
            {
                NotationData.Rows[i].Delete();
            }

            NotationData.AcceptChanges();

            NotationDataRow nd = GetNotationDataRow(m.Pid);

            if (nd != null)
            {
                j = nd.R;
                c = nd.C;
            }
            else
            {
                j = 0;
            }

            for (i = LastNotationViewRowIndex; i > j; i--)
            {
                NotationView.Rows[i].Delete();
            }

            for (i = c + 1; i <= MaxColumnIndex; i++)
            {
                NotationView.Rows[j][i] = "";
            }

            NotationView.AcceptChanges();

            this.Game.Moves.DeleteRows(m);

            AddNotationData(m);
            AddNotationView(m);
            Scoring.AddCurrentMoveLine(m);
        }
        public int GetNotationDataRowIndex(int id)
        {
            NotationDataRow nd = GetNotationDataRow(id);

            return(NotationData.Rows.IndexOf(nd.DataRow));
        }