Ejemplo n.º 1
0
        internal QuotationMarksDlg(Project project, BlockNavigatorViewModel navigatorViewModel, bool readOnly)
        {
            InitializeComponent();

            m_project = project;
            m_project.AnalysisCompleted -= HandleAnalysisCompleted;
            m_project.AnalysisCompleted += HandleAnalysisCompleted;
            m_navigatorViewModel         = navigatorViewModel;

            if (Settings.Default.QuoteMarksDialogShowGridView)
            {
                m_toolStripButtonGridView.Checked = true;
            }

            var books = new BookSet();

            foreach (var bookId in m_navigatorViewModel.IncludedBooks)
            {
                books.Add(bookId);
            }
            m_scriptureReference.VerseControl.BooksPresentSet = books;
            m_scriptureReference.VerseControl.ShowEmptyBooks  = false;

            m_scriptureReference.VerseControl.AllowVerseSegments = false;
            m_scriptureReference.VerseControl.Versification      = m_navigatorViewModel.Versification;
            m_scriptureReference.VerseControl.VerseRefChanged   += m_scriptureReference_VerseRefChanged;

            m_blocksViewer.Initialize(m_navigatorViewModel);
            m_navigatorViewModel.CurrentBlockChanged += HandleCurrentBlockChanged;

            SetupQuoteMarksComboBoxes(m_project.QuoteSystem);

            m_scriptureReference.VerseControl.GetLocalizedBookName = L10N.GetLocalizedBookNameFunc(m_scriptureReference.VerseControl.GetLocalizedBookName);
            HandleStringsLocalized();
            LocalizeItemDlg.StringsLocalized += HandleStringsLocalized;

            m_blocksViewer.VisibleChanged += (sender, args) => this.SafeInvoke(() =>
            {
                if (m_blocksViewer.Visible)
                {
                    LoadBlock();
                }
            }, GetType().FullName + " - anonymous delegate m_blocksViewer.VisibleChanged", ControlExtensions.ErrorHandlingAction.IgnoreIfDisposed);

            SetFilterControlsFromMode();

            if (m_project.ProjectState == ProjectState.NeedsQuoteSystemConfirmation)
            {
                UpdateTestParse(false);
            }
            else
            {
                ShowTestResults(PercentageOfExpectedQuotesFound(m_project.Books), false);
            }

            if (readOnly)
            {
                MakeReadOnly();
            }
        }
        private void m_btnQuoteMarkSettings_Click(object sender, EventArgs e)
        {
            var reparseOkay = false;

            if (m_model.Project.IsLiveParatextProject)
            {
                reparseOkay = m_model.Project.QuoteSystemStatus != QuoteSystemStatus.Obtained;
            }
            else if (!m_model.Project.IsSampleProject)
            {
                if (m_model.Project.IsOkayToChangeQuoteSystem)
                {
                    reparseOkay = true;
                }
                else
                {
                    string msg = string.Format(LocalizationManager.GetString("Project.UnableToLocateTextBundleMsg",
                                                                             "The original text release bundle for the project is no longer in its original location ({0}). " +
                                                                             "The Quote Mark Settings cannot be modified without access to it."), m_model.Project.OriginalBundlePath) +
                                 Environment.NewLine + Environment.NewLine +
                                 LocalizationManager.GetString("Project.LocateBundleYourself", "Would you like to locate the text release bundle yourself?");
                    string title = LocalizationManager.GetString("Project.UnableToLocateTextBundle", "Unable to Locate Text Bundle", "Message caption");
                    if (DialogResult.Yes == MessageBox.Show(msg, title, MessageBoxButtons.YesNo))
                    {
                        reparseOkay = SelectBundleForProjectDlg.GiveUserChanceToFindOriginalBundle(m_model.Project);
                    }
                }
            }

            BlockNavigatorViewModel viewModel = null;

            try
            {
                if (m_model.Project.IncludedBooks.Any())
                {
                    viewModel = new BlockNavigatorViewModel(m_model.Project, BlocksToDisplay.AllExpectedQuotes, m_model);
                }
                using (var dlg = new QuotationMarksDlg(m_model.Project, viewModel, !reparseOkay, this))
                {
                    MainForm.LogDialogDisplay(dlg);
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        UpdateQuotePageDisplay();
                    }
                }
            }
            finally
            {
                viewModel?.Dispose();
            }
        }
Ejemplo n.º 3
0
        internal QuotationMarksDlg(Project project, BlockNavigatorViewModel navigatorViewModel, bool readOnly)
        {
            InitializeComponent();

            m_project = project;
            m_project.AnalysisCompleted -= HandleAnalysisCompleted;
            m_project.AnalysisCompleted += HandleAnalysisCompleted;
            m_navigatorViewModel         = navigatorViewModel;

            if (Settings.Default.QuoteMarksDialogShowGridView)
            {
                m_toolStripButtonGridView.Checked = true;
            }

            var books = new BookSet();

            foreach (var bookId in m_navigatorViewModel.IncludedBooks)
            {
                books.Add(bookId);
            }
            m_scriptureReference.VerseControl.BooksPresentSet = books;
            m_scriptureReference.VerseControl.ShowEmptyBooks  = false;

            m_scriptureReference.VerseControl.AllowVerseSegments = false;
            m_scriptureReference.VerseControl.Versification      = m_navigatorViewModel.Versification;
            m_scriptureReference.VerseControl.VerseRefChanged   += m_scriptureReference_VerseRefChanged;

            m_blocksViewer.Initialize(m_navigatorViewModel);
            m_navigatorViewModel.CurrentBlockChanged += HandleCurrentBlockChanged;

            SetupQuoteMarksComboBoxes(m_project.QuoteSystem);

            HandleStringsLocalized();
            LocalizeItemDlg.StringsLocalized += HandleStringsLocalized;

            m_blocksViewer.VisibleChanged += (sender, args) => this.SafeInvoke(() =>
            {
                if (m_blocksViewer.Visible)
                {
                    LoadBlock();
                }
            }, true);

            SetFilterControlsFromMode();

            if (readOnly)
            {
                MakeReadOnly();
            }
        }
Ejemplo n.º 4
0
        private void m_btnQuoteMarkSettings_Click(object sender, EventArgs e)
        {
            bool reparseOkay = false;

            if (m_model.Project.IsSampleProject)
            {
                string msg   = LocalizationManager.GetString("Project.CannotChangeSampleMsg", "The Quote Mark Settings cannot be modified for the Sample project.");
                string title = LocalizationManager.GetString("Project.CannotChangeSample", "Cannot Change Sample Project");
                MessageBox.Show(msg, title);
            }
            else
            {
                if (!m_model.Project.IsReparseOkay())
                {
                    string msg = string.Format(LocalizationManager.GetString("Project.UnableToLocateTextBundleMsg",
                                                                             "The original text bundle for the project is no longer in its original location ({0}). " +
                                                                             "The Quote Mark Settings cannot be modified without access to the original text bundle."), m_model.Project.OriginalBundlePath) +
                                 Environment.NewLine + Environment.NewLine +
                                 LocalizationManager.GetString("Project.LocateBundleYourself", "Would you like to locate the text bundle yourself?");
                    string title = LocalizationManager.GetString("Project.UnableToLocateTextBundle", "Unable to Locate Text Bundle");
                    if (DialogResult.Yes == MessageBox.Show(msg, title, MessageBoxButtons.YesNo))
                    {
                        reparseOkay = SelectProjectDlg.GiveUserChanceToFindOriginalBundle(m_model.Project);
                    }
                }
                else
                {
                    reparseOkay = true;
                }
            }

            using (var viewModel = new BlockNavigatorViewModel(m_model.Project, BlocksToDisplay.AllExpectedQuotes, m_model))
                using (var dlg = new QuotationMarksDlg(m_model.Project, viewModel, !reparseOkay))
                {
                    MainForm.LogDialogDisplay(dlg);
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        UpdateQuotePageDisplay();
                    }
                }
        }
Ejemplo n.º 5
0
        internal QuotationMarksDlg(Project project, BlockNavigatorViewModel navigatorViewModel, bool readOnly, ProjectSettingsDlg parentDlg)
        {
            InitializeComponent();
            Cursor.Current = Cursors.WaitCursor;
            m_project      = project;
            m_project.AnalysisCompleted -= HandleAnalysisCompleted;
            m_project.AnalysisCompleted += HandleAnalysisCompleted;
            m_navigatorViewModel         = navigatorViewModel;
            m_parentDlg = parentDlg;

            if (Settings.Default.QuoteMarksDialogShowGridView)
            {
                m_toolStripButtonGridView.Checked = true;
            }

            if (m_navigatorViewModel == null)
            {
                PreventNavigation();
            }
            else
            {
                var books = new BookSet();
                foreach (var bookId in m_navigatorViewModel.IncludedBooks)
                {
                    books.Add(bookId);
                }
                m_scriptureReference.VerseControl.BooksPresentSet = books;
                m_scriptureReference.VerseControl.ShowEmptyBooks  = false;

                m_scriptureReference.VerseControl.AllowVerseSegments = false;
                m_scriptureReference.VerseControl.Versification      = m_navigatorViewModel.Versification;
                m_scriptureReference.VerseControl.VerseRefChanged   += m_scriptureReference_VerseRefChanged;

                m_blocksViewer.Initialize(m_navigatorViewModel);
                m_navigatorViewModel.CurrentBlockChanged += HandleCurrentBlockChanged;
                m_scriptureReference.VerseControl.GetLocalizedBookName = L10N.GetLocalizedBookNameFunc(m_scriptureReference.VerseControl.GetLocalizedBookName);

                m_blocksViewer.VisibleChanged += (sender, args) => this.SafeInvoke(() =>
                {
                    if (m_blocksViewer.Visible)
                    {
                        LoadBlock();
                    }
                }, GetType().FullName + " - anonymous delegate m_blocksViewer.VisibleChanged", ControlExtensions.ErrorHandlingAction.IgnoreIfDisposed);
            }

            SetupQuoteMarksComboBoxes(m_project.QuoteSystem);

            if (m_project.IsLiveParatextProject && readOnly)
            {
                var wrapper = m_project.GetLiveParatextDataIfCompatible(false, checkForChangesInAvailableBooks: false);
                m_linkOverride.Visible = m_allowOverride = wrapper == null || !wrapper.UserCanEditProject;
            }

            try
            {
                HandleStringsLocalized();
                LocalizeItemDlg <TMXDocument> .StringsLocalized += HandleStringsLocalized;

                SetFilterControlsFromMode();

                if (m_project.ProjectState == ProjectState.NeedsQuoteSystemConfirmation)
                {
                    UpdateTestParse(false);
                }

                ReadOnly = readOnly;
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }