Example #1
0
        private static void DrawLine(ExtList <ExtList <TreeCell> > table, TreeCell cellAncestor, TreeCell cellDescendant)
        {
            int r  = table.IndexOf(cellDescendant.Row);
            int r2 = table.IndexOf(cellAncestor.Row);
            int y;

            if (r > r2)
            {
                y  = r2;
                r2 = r;
                r  = y;
            }

            int x = cellDescendant.ColIndex - 1;

            for (y = r; y <= r2; y++)
            {
                var row = table[y];
                row[x].Kind = CellKind.ckLine;
            }
        }
Example #2
0
        public ExtPoint GetMemberPosition(CreatureEntity member)
        {
            int idx = fList.IndexOf(member);

            return(new ExtPoint(fSelf.PosX + (int)fOffsets[idx].RX, fSelf.PosY + (int)fOffsets[idx].RY));
        }
Example #3
0
        private void Step(ExtList <ExtList <TreeCell> > table, int rowIndex, int colIndex,
                          TreeCell prev, GEDCOMIndividualRecord cur, int gen)
        {
            if (cur == null)
            {
                return;
            }

            if (rowIndex < 0)
            {
                rowIndex = 0;
            }
            if (rowIndex > table.Count)
            {
                rowIndex = table.Count;
            }

            var row = AddRow(table, rowIndex, 0);

            int num = (colIndex - 1) << 1;

            for (int i = 0; i <= num; i++)
            {
                AddCell(row, null, CellKind.ckSpace);
            }

            if (prev != null)
            {
                AddCell(row, null, CellKind.ckLine);
            }

            TreeCell curCell = AddCell(row, cur, CellKind.ckPerson);

            if (cur.ChildToFamilyLinks.Count > 0 && gen < 5)
            {
                GEDCOMFamilyRecord     family  = cur.ChildToFamilyLinks[0].Family;
                GEDCOMIndividualRecord iFather = family.Husband.Value as GEDCOMIndividualRecord;
                GEDCOMIndividualRecord iMother = family.Wife.Value as GEDCOMIndividualRecord;
                if (iFather != null || iMother != null)
                {
                    AddCell(row, null, CellKind.ckLine);
                    AddCell(row, null, CellKind.ckSpace);

                    rowIndex = table.IndexOf(row);
                    if (iFather != null)
                    {
                        AddRow(table, rowIndex, colIndex + 1);
                    }
                    Step(table, rowIndex, colIndex + 1, curCell, iFather, gen + 1);

                    rowIndex = table.IndexOf(row);
                    if (iMother != null)
                    {
                        AddRow(table, rowIndex + 1, colIndex + 1);
                    }
                    Step(table, rowIndex + 2, colIndex + 1, curCell, iMother, gen + 1);
                }
            }

            WideTable(table, curCell.ColIndex + 1);
            if (prev != null)
            {
                DrawLine(table, prev, curCell);
            }
        }
 public int IndexOf(ConversationEntry convers)
 {
     return(fConversations.IndexOf(convers));
 }
Example #5
0
        public void Test_Common()
        {
            using (ExtList <object> list = new ExtList <object>(true))
            {
                Assert.IsNotNull(list);
            }

            using (ExtList <object> list = new ExtList <object>())
            {
                Assert.IsNotNull(list);
                Assert.AreEqual(0, list.Count);

                Assert.Throws(typeof(ListException), () => { list[-1] = null; });

                object obj  = new object();
                object obj1 = new object();

                list.Add(obj);
                Assert.AreEqual(1, list.Count);
                Assert.AreEqual(obj, list[0]);
                Assert.AreEqual(0, list.IndexOf(obj));

                list.Delete(0);
                Assert.AreEqual(0, list.Count);

                list.Add(obj);
                Assert.AreEqual(obj, list.Extract(obj));

                list.Insert(0, obj);

                list[0] = obj;
                Assert.AreEqual(obj, list[0]);

                list.Add(null);
                Assert.AreEqual(2, list.Count);
                Assert.AreEqual(null, list[1]);
                list[1] = obj1;
                Assert.AreEqual(obj1, list[1]);

                list[1] = null;
                Assert.AreEqual(2, list.Count);
                list.Pack();
                Assert.AreEqual(1, list.Count);

                list.Remove(obj);
                Assert.AreEqual(0, list.Count);

                Assert.AreEqual(false, list.OwnsObjects);

                list.OwnsObjects = true;
                Assert.AreEqual(true, list.OwnsObjects);

                list.Clear();
                list.Add(obj);
                list.Add(obj1);
                Assert.AreEqual(obj, list[0]);
                Assert.AreEqual(obj1, list[1]);
                list.Exchange(0, 1);
                Assert.AreEqual(obj, list[1]);
                Assert.AreEqual(obj1, list[0]);
            }

            using (ExtList <ValItem> list = new ExtList <ValItem>())
            {
                Assert.IsNotNull(list);

                list.Add(new ValItem(5));
                list.Add(new ValItem(1));
                list.Add(new ValItem(17));
                list.Add(new ValItem(4));

                list.QuickSort(CompareItems);

                list.MergeSort(CompareItems);
            }
        }
Example #6
0
 public int IndexOf(TopicEntry topic)
 {
     return(fTopics.IndexOf(topic));
 }