]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiCompareHistory.cpp
Fix handling of the add branch textfield in GuiBranches
[lyx.git] / src / frontends / qt4 / GuiCompareHistory.cpp
index 35cff62151d49e9d3b6ee717da9c69a37360db2b..711cd51dcbaea2f21ec40dd70a909c03f32285ba 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <config.h>
+#include <support/debug.h>
 
 #include "GuiCompareHistory.h"
 
@@ -42,18 +43,24 @@ GuiCompareHistory::GuiCompareHistory(GuiView & lv)
 
        connect(revbackRB, SIGNAL(clicked()), this, SLOT(selectRevback()));
        connect(betweenrevRB, SIGNAL(clicked()), this, SLOT(selectBetweenrev()));
+}
 
-       string revstring = lv.currentBufferView()->buffer().lyxvc().revisionInfo(LyXVC::File);
+bool GuiCompareHistory::initialiseParams(std::string const &)
+{
+       string revstring = lyxview().currentBufferView()->buffer().lyxvc().revisionInfo(LyXVC::File);
        int rev=0;
-       if (prefixIs(revstring, "r"))
-               revstring = ltrim(revstring,"r");
+
+       string tmp;
+       // RCS case
+       if (!isStrInt(revstring))
+               revstring = rsplit(revstring, tmp , '.' );
        if (isStrInt(revstring))
                rev = convert<int>(revstring);
 
        okPB->setEnabled(rev);
        rev1SB->setMaximum(rev);
        rev2SB->setMaximum(rev);
-       revbackSB->setMaximum(rev);
+       revbackSB->setMaximum(rev-1);
        rev2SB->setValue(rev);
        rev1SB->setValue(rev-1);
 
@@ -61,6 +68,7 @@ GuiCompareHistory::GuiCompareHistory(GuiView & lv)
        //bc().setOK(okPB);
        //bc().setCancel(cancelPB);
        enableControls();
+       return true;
 }
 
 
@@ -87,8 +95,11 @@ void GuiCompareHistory::selectBetweenrev()
 void GuiCompareHistory::enableControls()
 {
        bool rb = revbackRB->isChecked();
+       oldL->setEnabled(!rb);
+       newL->setEnabled(!rb);
        rev1SB->setEnabled(!rb);
        rev2SB->setEnabled(!rb);
+       rev2SB->setEnabled(!rb);
        betweenrevRB->setChecked(!rb);
        revbackSB->setEnabled(rb);
 }