// Constructor
        public PicturesForm( CISRecord r, CGedcom gedcom )
        {
            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();

            m_bExtraUserInfoAdded = false;
            m_bDisablePictureListCheckEvent = true;
            m_record = r;
            // Add pictures
            // Copy MFRs to a new list
            m_alMultimediaFileRefs = new ArrayList();
            foreach( CMultimediaFileReference mfr in m_record.m_alUniqueFileRefs )
            {
                CAsidPair mmasidPair = mfr.m_asidPair;
                CMultimediaFileReference new_mfr = new CMultimediaFileReference( mfr, true ); // Make copy
                m_alMultimediaFileRefs.Add( new_mfr );
            }

            m_gedcom = gedcom;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            m_listviewPictures.View = View.Details;
            m_listviewPictures.Columns.Add("Title", (m_listviewPictures.Width-6) * 40 / 100, HorizontalAlignment.Left);
            m_listviewPictures.Columns.Add("Filename", (m_listviewPictures.Width-6) * 60 / 100, HorizontalAlignment.Left);

            m_sizePictureBox = m_picturebox.Size;

            // Add pictures
            FillPicturesList( m_listviewPictures, m_alMultimediaFileRefs );
            EnableButtons();

            // Select first checked picture
            int index = 0;
            foreach( CListableMFR lmfr in m_listviewPictures.Items )
            {
                if( lmfr.Checked )
                {
                    index = lmfr.Index;
                    break;
                }
            }
            SetPicture(index);

            Cursor.Current = Cursors.Default;
            Cursor.Show();
        }
        // Constructor
        public CRecordDetailsForm( IWin32Window parent, CISRecord r, CGedcom gedcomParser, bool bCanEditPictures, bool bCanSelectText )
        {
            Cursor.Current = Cursors.WaitCursor;
            Cursor.Show();
            m_bCanSelectText = bCanSelectText;
            m_gedcom = gedcomParser;
            m_record = r;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            m_buttonPictures.Visible = bCanEditPictures;

            m_sizePictureBox = m_picturebox.Size;

            if( r == null )
            {
                return;
            }

            string sDetails = m_record.Details();

            if( m_record is CSourceRecord )
            {
                sDetails += "\r\nReferenced by: ";
                string sBackref = "";
                Hashtable htBackrefs = ((CSourceRecord)m_record).MakeBackRefList();

                IDictionaryEnumerator ide = htBackrefs.GetEnumerator();
                while( ide.MoveNext() )
                {
                    CIndividualRecord ir = (CIndividualRecord)(ide.Value);
                    if( ir != null )
                    {

                        string sFirstName = "";
                        string sSurname = "";
                        string sName = MainForm.s_config.CapitaliseName( ir.Name, ref sFirstName, ref sSurname );
                        if( sName == "" )
                        {
                            sName = MainForm.s_config.m_sUnknownName;
                        }

                        if( sName != "" )
                        {
                            if( sBackref != "" )
                            {
                                sBackref += ", ";
                            }
                            sBackref += sName;
                        }
                    }
                }
                if( sBackref == "" )
                {
                    sDetails += "no references";
                }
                else
                {
                    sDetails += sBackref;
                }
            }

            if( m_bCanSelectText )
            {
                m_textbox.Text = sDetails;
                m_textbox.SelectionLength = 0;
            }
            else
            {
                m_labelDetailsText.Text = sDetails;
            }

            // Select first picture
            SetPicture();

            m_buttonOk.Select(); // To avoid flashing cursor appearing in text box when window appears.

            Cursor.Current = Cursors.Default;
            Cursor.Show();
        }
Esempio n. 3
0
        // Constructor. Initialise and create GUI.
        public MainForm( bool bResetConfig )
        {
            // Set some values that scale the size of the GUI
            m_ptDefaultButtonSize = new System.Drawing.Point(75, 23);
            m_ptConfigButtonSize = new System.Drawing.Point(92, 23);

            m_colordialogConfigMiniTree = new ColorDialog();
            m_colordialogConfigMiniTree.FullOpen = true;
            m_colordialogConfigMiniTree.SolidColorOnly = true;

            s_config = new CConfig();
            if( !bResetConfig )
            {
                // Read back any previously stored settings.
                s_config.RecoverSettings();
            }
            else
            {
                // Save default settings without neeeding user to complete app
                s_config.StoreSettings();
            }

            // Creates the entire GUI
            InitializeComponent();

            m_gedcom = new CGedcom();
            m_nCurrentPanel = 1;
            m_bConfigPanelOn = false;
            m_nPruneExcluded = 0;
            m_nPruneExcluded = 0;

            CListableName.s_sUnknownName = s_config.m_sUnknownName;
            CListableBool.s_sUnknownName = s_config.m_sUnknownName;

            m_bPrunepanelDataChanged = false;
            m_bDisablePrunepanelCheckEvent = false;

            ShowCurrentPanel();
        }