]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/GuiCompare.cpp
Hack to display section symbol
[lyx.git] / src / frontends / qt / GuiCompare.cpp
index e48be86f22ac7efe9ec3eef1220525d061d1d4a7..e485ec0a548c6de028a6ae5ed6952dfcfd8a84b4 100644 (file)
 
 #include "GuiCompare.h"
 
+#include "GuiApplication.h"
+
 #include "Buffer.h"
 #include "BufferView.h"
 #include "BufferList.h"
 #include "buffer_funcs.h"
+#include "ColorCache.h"
 #include "Compare.h"
 #include "FuncRequest.h"
 #include "GuiView.h"
@@ -318,11 +321,18 @@ int GuiCompare::run(bool blocking_mode)
                return 0;
 
        dest_buffer_->changed(true);
-       dest_buffer_->markDirty();
+       if (blocking_mode)
+               //blocking mode is infinitive and we don't want diff autosave
+               //if user decides to kill ther running lyx instance
+               dest_buffer_->markClean();
+       else
+               dest_buffer_->markDirty();
+
 
        // get the options from the dialog
        CompareOptions options;
        options.settings_from_new = newSettingsRB->isChecked();
+       options.author = authorCO->currentIndex();
 
        // init the compare object and start it
 
@@ -364,10 +374,14 @@ bool GuiCompare::initialiseParams(std::string const &par)
                                return false;
                        }
 
-                       // Wait for the Compare function to process in a thread (2 minute timeout)
-                       compare_->wait(120000);
+                       // Wait for the Compare function to process in a thread
+                       compare_->wait();
 
                        finished(false);
+                       //Hiding dialog does not work as intended through finished routine, because showView
+                       //is triggered after initialiseParams returns true. So we return false, warning will
+                       //show on the terminal though.
+                       return false;
                }
        }
 
@@ -375,6 +389,19 @@ bool GuiCompare::initialiseParams(std::string const &par)
        progressBar->setEnabled(false);
        progressBar->setMaximum(1);
 
+       // If empty fill the author combobox with the current and the comparison
+       // author and their respective colors
+       if (authorCO->count() == 0) {
+               authorCO->clear();
+               QPixmap colorIcon(32, 32);
+               colorIcon.fill(guiApp->colorCache().get(
+                       Color(Color_changedtext_workarea_author1)));
+               authorCO->addItem(colorIcon, qt_("Current Author"));
+               colorIcon.fill(guiApp->colorCache().get(
+                       Color(Color_changedtext_workarea_comparison)));
+               authorCO->addItem(colorIcon, qt_("Document Comparison"));
+       }
+
        return true;
 }