예제 #1
0
        // Populates the list of source records for inclusion/exclusion in the website
        private void FillSourcesList(SortableListView listView, bool bFirstColumnIsCheckbox)
        {
            LogFile.TheLogFile.WriteLine(LogFile.DT_APP, LogFile.EDebugLevel.Note, "FillSourcesList() : " + m_gedcom.m_alSourceRecords.Count.ToString());

            m_bDisablePrunepanelCheckEvent = true; // call to item.Checked below invokes event handler.

            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();

            listView.Clear();

            listView.View = View.Details;
            int nWidthTitle = listView.Width - 140 - 20;
            if (bFirstColumnIsCheckbox)
            {
                listView.Columns.Add("Include", 30, HorizontalAlignment.Left);
                nWidthTitle -= 30;
            }
            listView.Columns.Add("Title", nWidthTitle, HorizontalAlignment.Left);
            listView.Columns.Add("Repository", 100, HorizontalAlignment.Left);
            listView.Columns.Add("Citations", 60, HorizontalAlignment.Left);
            listView.Columns.Add("B", 30, HorizontalAlignment.Left);
            listView.Columns.Add("M", 30, HorizontalAlignment.Left);
            listView.Columns.Add("D", 30, HorizontalAlignment.Left);
            listView.Columns.Add("Id", 60, HorizontalAlignment.Left);
            listView.Columns.Add("Pics", 48, HorizontalAlignment.Left);

            ListViewItem[] temporaryItemsList = new ListViewItem[m_gedcom.m_alSourceRecords.Count];
            int nItem = 0;
            foreach (GEDmill.LLClasses.CSourceRecord sr in m_gedcom.m_alSourceRecords)
            {
                CListableBool item = new CListableBool(sr, bFirstColumnIsCheckbox);
                SetSourceSubItems(item, sr, bFirstColumnIsCheckbox);
                item.Checked = !(sr.Restricted);
                temporaryItemsList[nItem++] = item;
            }

            listView.Items.AddRange(temporaryItemsList);
            listView.Sort();

            m_tabpagePruneRecordsSources.Text = "Sources (" + listView.Items.Count + ")";

            Cursor.Current = Cursors.Default;
            Cursor.Hide();

            m_bDisablePrunepanelCheckEvent = false;
        }
예제 #2
0
        // Populates the list of individuals records for inclusion/exclusion in the website
        // alSelectedIndividuals is a small array indicating xrefs of those individuals to mark selected. (not currently used, 3Jan08)
        private void FillIndividualsList(SortableListView listView, bool bExcludeRestricted, ArrayList alSelectedIndividuals, bool bFirstColumnIsCheckbox)
        {
            LogFile.TheLogFile.WriteLine(LogFile.DT_APP, LogFile.EDebugLevel.Note, "FillIndividualsList() : " + m_gedcom.m_alIndividualRecords.Count.ToString());

            m_bDisablePrunepanelCheckEvent = true;

            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();

            listView.Clear();

            listView.View = View.Details;
            int nameWidth = listView.Width - 70 - 70 - 20;
            if (bFirstColumnIsCheckbox)
            {
                listView.Columns.Add("Include", 30, HorizontalAlignment.Left);
                nameWidth -= 30;
            }
            listView.Columns.Add("Name", nameWidth, HorizontalAlignment.Left);
            listView.Columns.Add("Born", 70, HorizontalAlignment.Left);
            listView.Columns.Add("Died", 70, HorizontalAlignment.Left);
            listView.Columns.Add("Id", 60, HorizontalAlignment.Left);
            listView.Columns.Add("User ref", 78, HorizontalAlignment.Left);
            listView.Columns.Add("Pics", 48, HorizontalAlignment.Left);

            // Build an array first then blit the whole array to the list control. This is faster than adding each item to the list control individually.
            ListViewItem[] temporaryItemsList = new ListViewItem[m_gedcom.m_alIndividualRecords.Count];

            int nItem = 0;
            foreach (GEDmill.LLClasses.CIndividualRecord ir in m_gedcom.m_alIndividualRecords)
            {
                // Only allow fully unrestricted individuals.
                if (bExcludeRestricted && ir.Visibility() != LLClasses.CIndividualRecord.EVisibility.Visible)
                {
                    continue;
                }

                CListableBool lbItem;
                if (bFirstColumnIsCheckbox)
                {
                    lbItem = new CListableBool(ir, true);
                }
                else
                {
                    string sSurname = "";
                    string sFirstName = "";
                    s_config.CapitaliseName(ir.Name, ref sFirstName, ref sSurname);
                    if (ir.NameSuffix != null && ir.NameSuffix != "")
                    {
                        sFirstName += ", " + ir.NameSuffix;
                    }
                    lbItem = new CListableBool(ir, sSurname, sFirstName, false);
                }

                SetIndividualSubItems(lbItem, ir, bFirstColumnIsCheckbox);

                // alSelectedIndividuals is a small array indicating xrefs of those individuals to mark selected. (not currently used, 3Jan08)
                if (alSelectedIndividuals != null && alSelectedIndividuals.Contains(ir.m_xref))
                {
                    lbItem.Selected = true;
                }

                lbItem.Checked = !(ir.Restricted);
                temporaryItemsList[nItem++] = lbItem;
            }

            listView.Items.AddRange(temporaryItemsList);
            listView.Sort();

            m_tabpagePruneRecordsIndis.Text = "Individuals (" + listView.Items.Count + ")";

            Cursor.Current = Cursors.Default;
            Cursor.Hide();

            m_bDisablePrunepanelCheckEvent = false;
        }