]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiViewSource.cpp
Allow LyX format to be written to View>Source window.
[features.git] / src / frontends / qt4 / GuiViewSource.cpp
index 6a49febd7de3dd552c656263472a606ab13bdd8d..f4f197d1de8a08d9493027afe520b541e1ddcd7e 100644 (file)
@@ -143,6 +143,7 @@ void ViewSourceWidget::setViewFormat()
        updateView();
 }
 
+
 void ViewSourceWidget::updateView()
 {
        if (!bv_) {
@@ -197,22 +198,25 @@ void ViewSourceWidget::updateDefaultFormat()
        outputFormatCO->addItem(qt_("Default"),
                                QVariant(QString("default")));
 
+       int index = 0;
        vector<string> tmp = bv_->buffer().params().backends();
        vector<string>::const_iterator it = tmp.begin();
        vector<string>::const_iterator en = tmp.end();
        for (; it != en; ++it) {
                string const format = *it;
                Format const * fmt = formats.getFormat(format);
-               if (!fmt)
+               if (!fmt) {
                        LYXERR0("Can't find format for backend " << format << "!");
-               else if (fmt->name() == "lyx")
-                       // we can't presently display the LyX format itself
                        continue;
+               } 
 
-               QString const pretty =
-                       fmt ? qt_(fmt->prettyname()) : toqstr(format);
-               outputFormatCO->addItem(pretty, QVariant(toqstr(format)));
+               QString const pretty = qt_(fmt->prettyname());
+               QString const qformat = toqstr(format);
+               outputFormatCO->addItem(pretty, QVariant(qformat));
+               if (qformat == view_format_)
+                  index = outputFormatCO->count() -1;
        }
+       outputFormatCO->setCurrentIndex(index);
 
        outputFormatCO->blockSignals(false);
 }