/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DiffViewProxy"/> class. /// </summary> /// <param name="dlg">The instance of the DiffDialog displaying this view.</param> /// <param name="name">The (internal) name of the view.</param> /// <param name="book">The book to display.</param> /// <param name="fRev"><c>true</c> if this proxy is for the side representing the saved /// or imported version</param> /// ------------------------------------------------------------------------------------ internal DiffViewProxy(DiffDialog dlg, string name, IScrBook book, bool fRev) : base(name, false) { m_dlg = dlg; m_book = book; m_fIsRevision = fRev; }
internal static void UnorderedDiff() { StringBuilder currentFilePath = new StringBuilder(Win32.MAX_PATH); Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETFULLCURRENTPATH, Win32.MAX_PATH, currentFilePath); firstFile = currentFilePath.ToString(); var dlg = new DiffDialog(firstFile); dlg.Show(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handle the View Differences button. Display the Review Differences window to /// view/merge differences between the current scripture and selected book in the tree. /// </summary> /// ------------------------------------------------------------------------------------ private void m_btnDiff_Click(object sender, System.EventArgs e) { // If the selected item is not a book, then don't do a diff. TreeNode node = m_treeArchives.SelectedNode; if (node == null) { return; } ScrBook bookRev = node.Tag as ScrBook; if (bookRev == null) { return; } //ScrDraft archive = node.Parent.Tag as ScrDraft; using (BookMerger merger = new BookMerger(m_cache, m_styleSheet, bookRev)) { using (ProgressDialogWithTask progress = new ProgressDialogWithTask(this)) { progress.Title = DlgResources.ResourceString("kstidCompareCaption"); progress.Message = string.Format( DlgResources.ResourceString("kstidMergeProgress"), bookRev.BestUIName); progress.RunTask(true, new BackgroundTaskInvoker(merger.DetectDifferences)); } // always hide diffs that could cause deletion of current sections, if reverted merger.UseFilteredDiffList(); // If there were differences detected then show the diff dialog if (merger.NumberOfDifferences != 0) { using (DiffDialog dlg = new DiffDialog(merger, m_cache, m_styleSheet, m_zoomDraft, m_zoomFootnote)) { // We have to pass the owner (this), so that the dialog shows when the // user clicks on the TE icon in the taskbar. Otherwise only the Archive // dialog would pop up and beeps; diff dialog could only be regained by Alt-Tab. dlg.ShowDialog(this); } } else { // Tell users that no differences were found in the merge MessageBox.Show(this, string.Format(DlgResources.ResourceString("kstidNoDifferencesDetected"), bookRev.BestUIName), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handle the View Differences button. Display the Review Differences window to /// view/merge differences between the current scripture and selected book in the tree. /// </summary> /// ------------------------------------------------------------------------------------ private void m_btnDiff_Click(object sender, System.EventArgs e) { // If the selected item is not a book, then don't do a diff. TreeNode node = m_treeArchives.SelectedNode; if (node == null) { return; } IScrBook bookRev = (IScrBook)node.Tag; if (bookRev == null) { return; } using (BookMerger merger = new BookMerger(m_cache, m_styleSheet, bookRev)) { using (ProgressDialogWithTask progress = new ProgressDialogWithTask(this, m_cache.ThreadHelper)) { progress.Title = DlgResources.ResourceString("kstidCompareCaption"); progress.Message = string.Format( DlgResources.ResourceString("kstidMergeProgress"), bookRev.BestUIName); progress.RunTask(merger.DetectDifferences); } int cUnfilteredDifferences = merger.NumberOfDifferences; // always hide diffs that could cause deletion of current sections, if reverted merger.UseFilteredDiffList = true; bool fShowCompareAndMergeDlg = (merger.NumberOfDifferences != 0); if (!fShowCompareAndMergeDlg && cUnfilteredDifferences > 0) { // Tell users that no differences were found in the merge if (MessageBox.Show(this, string.Format(DlgResources.ResourceString("kstidOnlyAdditionsDetected"), bookRev.BestUIName), m_app.ApplicationName, MessageBoxButtons.YesNo) == DialogResult.Yes) { fShowCompareAndMergeDlg = true; merger.UseFilteredDiffList = false; } } // If there were differences detected then show the diff dialog if (fShowCompareAndMergeDlg) { using (DiffDialog dlg = new DiffDialog(merger, m_cache, m_styleSheet, m_zoomDraft, m_zoomFootnote, m_app, m_helpTopicProvider)) { // We have to pass the owner (this), so that the dialog shows when the // user clicks on the TE icon in the taskbar. Otherwise only the Archive // dialog would pop up and beeps; diff dialog could only be regained by Alt-Tab. dlg.ShowDialog(this); } } else if (cUnfilteredDifferences == 0) { // Tell users that no differences were found in the merge MessageBoxUtils.Show(this, string.Format(DlgResources.ResourceString("kstidNoDifferencesDetected"), bookRev.BestUIName), m_app.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DiffViewScrProxy"/> class. /// </summary> /// <param name="dlg">The instance of the DiffDialog displaying this view.</param> /// <param name="name">The (internal) name of the view.</param> /// <param name="book">The book to display.</param> /// <param name="fRev"><c>true</c> if this proxy is for the side representing the saved /// or imported version</param> /// ------------------------------------------------------------------------------------ public DiffViewScrProxy(DiffDialog dlg, string name, IScrBook book, bool fRev) : base(dlg, name, book, fRev) { }