/// ------------------------------------------------------------------------------------
        public ProjectSettingsDlg(PaProject project)
            : this()
        {
            Application.DoEvents();

            _isProjectNew          = (project == null);
            _chkMakeFolder.Visible = (_isProjectNew && !Properties.Settings.Default.AutoCreateProjectFilesAndFolderOnProjectCreation);
            _chkMakeFolder.Checked = (Properties.Settings.Default.CreateProjectFolderForNewProject || !_chkMakeFolder.Visible);

            BuildGrid();
            pnlGridHdg.ControlReceivingFocusOnMnemonic = m_grid;
            pnlGridHdg.BorderStyle = BorderStyle.None;

            if (project == null)
            {
                Project = new PaProject(true);
            }
            else
            {
                Project = project;
                _originallyMappedFields = project.GetMappedFields().Select(f => f.Name).ToList();
                _dataSources            = project.DataSources.Select(ds => ds.Copy()).ToList();
                txtProjName.Text        = project.Name;
                txtLanguageName.Text    = project.LanguageName;
                txtLanguageCode.Text    = project.LanguageCode;
                txtResearcher.Text      = project.Researcher;
                txtTranscriber.Text     = project.Transcriber;
                txtSpeaker.Text         = project.SpeakerName;
                txtComments.Text        = project.Comments;
                LoadGrid(-1);
            }

            WaitCursor.Show();

            if (Project.DistinctiveFeatureSet == BFeatureCache.DefaultFeatureSetName)
            {
                _comboDistinctiveFeaturesSet.SelectedIndex = 0;
            }
            else
            {
                _comboDistinctiveFeaturesSet.SelectedItem = Project.DistinctiveFeatureSet;
            }

            if (_dataSources.Any(ds => ds.Type == DataSourceType.FW))
            {
                FwDBUtils.StartSQLServer(true);
            }

            mnuAddFw6DataSource.Enabled = FwDBUtils.IsSQLServerInstalled(false);
            mnuAddFw7DataSource.Enabled = FwDBUtils.IsFw7Installed;

            DialogResult   = DialogResult.Cancel;
            m_dirty        = _isProjectNew;
            m_grid.IsDirty = false;
            WaitCursor.Hide();

            UpdateButtonStates();
        }