]> git.lyx.org Git - features.git/commitdiff
Show backends rather than formats in the View>Source combo box.
authorRichard Heck <rgheck@comcast.net>
Fri, 9 Mar 2012 22:24:20 +0000 (22:24 +0000)
committerRichard Heck <rgheck@comcast.net>
Fri, 9 Mar 2012 22:24:20 +0000 (22:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40900 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp
src/BufferParams.cpp
src/frontends/qt4/GuiViewSource.cpp

index a53df7b75244bb236ac8e0bc6e1a7d1c5ad1f29c..3fdd32b813b71b1a5e9e0a7353e3617146c353c7 100644 (file)
@@ -3309,6 +3309,12 @@ void Buffer::getSourceCode(odocstream & os, string const format,
                        XHTMLStream xs(os);
                        setMathFlavor(runparams);
                        xhtmlParagraphs(text(), *this, xs, runparams);
+               } else if (runparams.flavor == OutputParams::TEXT) {
+                       bool dummy;
+                       // FIXME Handles only one paragraph, unlike the others.
+                       // Probably should have some routine with a signature like them.
+                       writePlaintextParagraph(*this,
+                               text().paragraphs()[par_begin], os, runparams, dummy);
                } else {
                        // latex or literate
                        otexstream ots(os, texrow);
index 81a13bdb2b1a8b0bfa044abccb0777aa0301732b..5f848a6256ff9f76132d5c7bc4fb666ed4d7727e 100644 (file)
@@ -2172,6 +2172,8 @@ OutputParams::FLAVOR BufferParams::getOutputFlavor(string const format) const
 
        if (dformat == "xhtml")
                result = OutputParams::HTML;
+       else if (dformat == "text")
+               result = OutputParams::TEXT;
        else {
                // Try to determine flavor of default output format
                vector<string> backs = backends();
index 8a2309d75dbebe39ca4aef88acfe7b373f78dc63..6a49febd7de3dd552c656263472a606ab13bdd8d 100644 (file)
@@ -197,19 +197,23 @@ void ViewSourceWidget::updateDefaultFormat()
        outputFormatCO->addItem(qt_("Default"),
                                QVariant(QString("default")));
 
-       int index = 0;
-       typedef vector<Format const *> Formats;
-       Formats formats = bv_->buffer().params().exportableFormats(true);
-       Formats::const_iterator cit = formats.begin();
-       Formats::const_iterator end = formats.end();
-       for (; cit != end; ++cit) {
-               QString const fname = toqstr((*cit)->name());
-               outputFormatCO->addItem(qt_((*cit)->prettyname()),
-                               QVariant(fname));
-               if (fname == view_format_)
-                   index = outputFormatCO->count() -1;
+       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)
+                       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)));
        }
-       outputFormatCO->setCurrentIndex(index);
+
        outputFormatCO->blockSignals(false);
 }