From e4ddd93da4036ac608f1778e79452ac7070d3d28 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Fri, 3 Feb 2006 21:47:25 +0000 Subject: [PATCH] fix bug 2174 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10807 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 6 ++++++ lib/configure.m4 | 4 +++- src/ChangeLog | 7 +++++++ src/MenuBackend.C | 5 +++++ src/exporter.C | 18 +++++++++++++++--- src/graph.C | 2 -- 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 4ce2a9baf2..94ca7e1b77 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2006-02-02 Georg Baum + + * configure.m4: add lyx13x format and converter + * configure.m4: remove viewer from lyx format to exclude it from the + View menu + 2006-01-26 Jürgen Spitzmüller * chkconfig.ltx: add missing tests for bibtopic and jurabib; diff --git a/lib/configure.m4 b/lib/configure.m4 index 0068529700..1e8afd04f9 100644 --- a/lib/configure.m4 +++ b/lib/configure.m4 @@ -590,7 +590,8 @@ cat >$outfile <$outfile < \$\$o" "" \\converter lyxpreview png "$lyxpreview_to_png_command" "" \\converter lyxpreview ppm "$lyxpreview_to_bitmap_command" "" \\converter ps fax "$fax_command" "" diff --git a/src/ChangeLog b/src/ChangeLog index b069f4e5e8..8f5e741b9c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2006-02-02 Georg Baum + + * exporter.C (Backends): Add "lyx" backend + * exporter.C (Export): Handle "lyx" backend + * graph.C (getReachable): Don't exclude "lyx" + * MenuBackend.C (expandFormats): exclude "lyx" from export menu + 2006-02-03 Martin Vermeer * cursor.C (bruteFind2): convert relative to absolute co-ordinates diff --git a/src/MenuBackend.C b/src/MenuBackend.C index 89101d55e6..8ecdb4bad1 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -517,6 +517,11 @@ void expandFormats(MenuItem::Kind kind, Menu & tomenu, LyXView const * view) else if ((*fit)->name() == "textparagraph") label = _("Plain Text as Paragraphs"); label += "..."; + } else if (kind == MenuItem::ExportFormats) { + // exporting to LyX does not make sense + // FIXME: Introduce noexport flag + if ((*fit)->name() == "lyx") + continue; } if (!(*fit)->shortcut().empty()) label += '|' + (*fit)->shortcut(); diff --git a/src/exporter.C b/src/exporter.C index d79c49d4cd..57aca837ea 100644 --- a/src/exporter.C +++ b/src/exporter.C @@ -61,6 +61,7 @@ vector const Backends(Buffer const & buffer) if (buffer.params().getLyXTextClass().isTeXClassAvailable()) v.push_back(BufferFormat(buffer)); v.push_back("text"); + v.push_back("lyx"); return v; } @@ -143,11 +144,19 @@ bool Exporter::Export(Buffer * buffer, string const & format, runparams.flavor = OutputParams::LATEX; runparams.linelen = lyxrc.ascii_linelen; vector backends = Backends(*buffer); - if (find(backends.begin(), backends.end(), format) == backends.end()) { + // FIXME: Without this test export to lyx13 would be through + // latex -> lyx -> lyx13, because the first backend below with a + // working conversion path is used. We should replace this test and + // the explicit loop below with a method + // getShortestPath(vector const & from, string const & to) + // which returns the shortest path from one of the formats in 'from' + // to 'to'. + if (format == "lyx13x" && !converters.getPath("lyx", format).empty()) + backend_format = "lyx"; + else if (find(backends.begin(), backends.end(), format) == backends.end()) { for (vector::const_iterator it = backends.begin(); it != backends.end(); ++it) { - Graph::EdgePath p = - converters.getPath(*it, format); + Graph::EdgePath p = converters.getPath(*it, format); if (!p.empty()) { runparams.flavor = converters.getFlavor(p); backend_format = *it; @@ -171,6 +180,9 @@ bool Exporter::Export(Buffer * buffer, string const & format, // Ascii backend if (backend_format == "text") writeFileAscii(*buffer, filename, runparams); + // no backend + else if (backend_format == "lyx") + buffer->writeFile(filename); // Linuxdoc backend else if (buffer->isLinuxDoc()) { runparams.nice = !put_in_tempdir; diff --git a/src/graph.C b/src/graph.C index 66daec8263..2b34bf0857 100644 --- a/src/graph.C +++ b/src/graph.C @@ -77,8 +77,6 @@ Graph::getReachable(int from, bool only_viewable, int const i = Q_.front(); Q_.pop(); Format const & format = formats.get(i); - if (format.name() == "lyx") - continue; if (!only_viewable || !format.viewer().empty() || format.isChildFormat()) result.push_back(i); -- 2.39.5