diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index a5e290acc5..3a208fcb5e 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -1364,20 +1364,30 @@ lib_images_files = Split(''' box-insert.png break-line.png buffer-close.png + buffer-export.png buffer-export_dvi.png buffer-export_latex.png + buffer-export_pdf.png buffer-export_pdf2.png + buffer-export_pdf3.png + buffer-export_pdf4.png buffer-export_ps.png buffer-export_text.png buffer-new.png buffer-reload.png buffer-update.png buffer-update_dvi.png + buffer-update_pdf.png buffer-update_pdf2.png + buffer-update_pdf3.png + buffer-update_pdf4.png buffer-update_ps.png buffer-view.png buffer-view_dvi.png + buffer-view_pdf.png buffer-view_pdf2.png + buffer-view_pdf3.png + buffer-view_pdf4.png buffer-view_ps.png buffer-write-as.png buffer-write.png @@ -1642,6 +1652,7 @@ lib_images_math_files = Split(''' eta.png eth.png exists.png + export-others.png fallingdotseq.png fint.png fintop.png diff --git a/lib/Makefile.am b/lib/Makefile.am index afa3f0f9e5..1dcbf11c1c 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -275,20 +275,30 @@ dist_images_DATA = \ images/box-insert.png \ images/break-line.png \ images/buffer-close.png \ + images/buffer-export.png \ images/buffer-export_dvi.png \ images/buffer-export_latex.png \ + images/buffer-export_pdf.png \ images/buffer-export_pdf2.png \ + images/buffer-export_pdf3.png \ + images/buffer-export_pdf4.png \ images/buffer-export_ps.png \ images/buffer-export_text.png \ images/buffer-new.png \ images/buffer-reload.png \ images/buffer-update.png \ images/buffer-update_dvi.png \ + images/buffer-update_pdf.png \ images/buffer-update_pdf2.png \ + images/buffer-update_pdf3.png \ + images/buffer-update_pdf4.png \ images/buffer-update_ps.png \ images/buffer-view.png \ images/buffer-view_dvi.png \ + images/buffer-view_pdf.png \ images/buffer-view_pdf2.png \ + images/buffer-view_pdf3.png \ + images/buffer-view_pdf4.png \ images/buffer-view_ps.png \ images/buffer-write-as.png \ images/buffer-write.png \ @@ -554,6 +564,7 @@ dist_imagesmath_DATA = \ images/math/eta.png \ images/math/eth.png \ images/math/exists.png \ + images/math/export-others.png \ images/math/fallingdotseq.png \ images/math/fint.png \ images/math/fintop.png \ diff --git a/lib/images/buffer-export.png b/lib/images/buffer-export.png new file mode 100644 index 0000000000..09f8060e16 Binary files /dev/null and b/lib/images/buffer-export.png differ diff --git a/lib/images/buffer-export_pdf.png b/lib/images/buffer-export_pdf.png new file mode 100644 index 0000000000..601fa8b9db Binary files /dev/null and b/lib/images/buffer-export_pdf.png differ diff --git a/lib/images/buffer-export_pdf3.png b/lib/images/buffer-export_pdf3.png new file mode 100644 index 0000000000..601fa8b9db Binary files /dev/null and b/lib/images/buffer-export_pdf3.png differ diff --git a/lib/images/buffer-export_pdf4.png b/lib/images/buffer-export_pdf4.png new file mode 100644 index 0000000000..601fa8b9db Binary files /dev/null and b/lib/images/buffer-export_pdf4.png differ diff --git a/lib/images/buffer-update_pdf.png b/lib/images/buffer-update_pdf.png new file mode 100644 index 0000000000..865ac47039 Binary files /dev/null and b/lib/images/buffer-update_pdf.png differ diff --git a/lib/images/buffer-update_pdf3.png b/lib/images/buffer-update_pdf3.png new file mode 100644 index 0000000000..865ac47039 Binary files /dev/null and b/lib/images/buffer-update_pdf3.png differ diff --git a/lib/images/buffer-update_pdf4.png b/lib/images/buffer-update_pdf4.png new file mode 100644 index 0000000000..865ac47039 Binary files /dev/null and b/lib/images/buffer-update_pdf4.png differ diff --git a/lib/images/buffer-view_pdf.png b/lib/images/buffer-view_pdf.png new file mode 100644 index 0000000000..601fa8b9db Binary files /dev/null and b/lib/images/buffer-view_pdf.png differ diff --git a/lib/images/buffer-view_pdf3.png b/lib/images/buffer-view_pdf3.png new file mode 100644 index 0000000000..601fa8b9db Binary files /dev/null and b/lib/images/buffer-view_pdf3.png differ diff --git a/lib/images/buffer-view_pdf4.png b/lib/images/buffer-view_pdf4.png new file mode 100644 index 0000000000..601fa8b9db Binary files /dev/null and b/lib/images/buffer-view_pdf4.png differ diff --git a/lib/images/math/export-others.png b/lib/images/math/export-others.png new file mode 100644 index 0000000000..09f8060e16 Binary files /dev/null and b/lib/images/math/export-others.png differ diff --git a/lib/ui/stdtoolbars.inc b/lib/ui/stdtoolbars.inc index 8a50201f04..8524c82e18 100644 --- a/lib/ui/stdtoolbars.inc +++ b/lib/ui/stdtoolbars.inc @@ -213,17 +213,29 @@ ToolbarSet End Toolbar "view-others" "View Other Formats" - Item "View DVI" "buffer-view dvi" - Item "View PDF (pdflatex)" "buffer-view pdf2" - Item "View PostScript" "buffer-view ps" + ViewFormats End Toolbar "update-others" "Update Other Formats" - Item "Update DVI" "buffer-update dvi" - Item "Update PDF (pdflatex)" "buffer-update pdf2" - Item "Update PostScript" "buffer-update ps" + UpdateFormats End +# The following three toolbars are disabled because of missing icons. +# Toolbar "import/export" "Import/Export" +# Item "Import" "buffer-import" +# Item "Export" "buffer-export" +# StickyPopupMenu "import-others" "Import Other Formats" +# StickyPopupMenu "export-others" "Export Other Formats" +# End + +# Toolbar "import-others" "Import Other Formats" +# ImportFormats +# End + +# Toolbar "export-others" "Export Other Formats" +# ExportFormats +# End + Toolbar "vcs" "Version Control" Item "Register" "vc-register" Item "Check-out for edit" "vc-check-out" diff --git a/src/Converter.cpp b/src/Converter.cpp index 6d42d10ee4..9b8a53df7e 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -707,6 +707,20 @@ vector Converters::importableFormats() } +vector Converters::exportableFormats(bool only_viewable) +{ + vector s = savers(); + vector result = getReachable(s[0], only_viewable, true); + for (vector::const_iterator it = s.begin() + 1; + it != s.end(); ++it) { + vector r = + getReachable(*it, only_viewable, false); + result.insert(result.end(), r.begin(), r.end()); + } + return result; +} + + vector Converters::loaders() const { vector v; @@ -717,4 +731,19 @@ vector Converters::loaders() const } +vector Converters::savers() const +{ + vector v; + v.push_back("docbook"); + v.push_back("latex"); + v.push_back("literate"); + v.push_back("lyx"); + v.push_back("pdflatex"); + v.push_back("platex"); + v.push_back("text"); + v.push_back("xetex"); + return v; +} + + } // namespace lyx diff --git a/src/Converter.h b/src/Converter.h index 942f33acd1..481968eff1 100644 --- a/src/Converter.h +++ b/src/Converter.h @@ -100,8 +100,10 @@ public: bool clear_visited); std::vector importableFormats(); + std::vector exportableFormats(bool only_viewable); std::vector loaders() const; + std::vector savers() const; /// Does a conversion path from format \p from to format \p to exist? bool isReachable(std::string const & from, std::string const & to); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 607c37a98c..b33ccc2f6c 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1461,7 +1461,7 @@ void GuiView::openDocument(string const & fname) if (!fullname.onlyPath().isDirectory()) { Alert::warning(_("Invalid filename"), - bformat(_("The directory in the given path\n%1$s\ndoes not exists."), + bformat(_("The directory in the given path\n%1$s\ndoes not exist."), from_utf8(fullname.absFilename()))); return; } diff --git a/src/frontends/qt4/Toolbars.cpp b/src/frontends/qt4/Toolbars.cpp index 834c9ab394..bd1c9af763 100644 --- a/src/frontends/qt4/Toolbars.cpp +++ b/src/frontends/qt4/Toolbars.cpp @@ -12,6 +12,8 @@ #include #include "Toolbars.h" +#include "Converter.h" +#include "Format.h" #include "FuncRequest.h" #include "Lexer.h" #include "LyXAction.h" @@ -31,10 +33,6 @@ using namespace lyx::support; namespace lyx { namespace frontend { -namespace { - -} // namespace anon - ///////////////////////////////////////////////////////////////////////// // @@ -73,18 +71,26 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex) TO_POPUPMENU, TO_STICKYPOPUPMENU, TO_ICONPALETTE, + TO_EXPORTFORMATS, + TO_IMPORTFORMATS, + TO_UPDATEFORMATS, + TO_VIEWFORMATS, }; struct LexerKeyword toolTags[] = { { "end", TO_ENDTOOLBAR }, + { "exportformats", TO_EXPORTFORMATS }, { "iconpalette", TO_ICONPALETTE }, + { "importformats", TO_IMPORTFORMATS }, { "item", TO_COMMAND }, { "layouts", TO_LAYOUTS }, { "minibuffer", TO_MINIBUFFER }, { "popupmenu", TO_POPUPMENU }, { "separator", TO_SEPARATOR }, { "stickypopupmenu", TO_STICKYPOPUPMENU }, - { "tableinsert", TO_TABLEINSERT } + { "tableinsert", TO_TABLEINSERT }, + { "updateformats", TO_UPDATEFORMATS }, + { "viewformats", TO_VIEWFORMATS }, }; //consistency check @@ -114,7 +120,8 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex) lex.printTable(lyxerr); while (lex.isOK() && !quit) { - switch (lex.lex()) { + int const code = lex.lex(); + switch (code) { case TO_COMMAND: if (lex.next(true)) { docstring const tooltip = translateIfPossible(lex.getDocString()); @@ -183,6 +190,53 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex) quit = true; break; + case TO_EXPORTFORMATS: + case TO_IMPORTFORMATS: + case TO_UPDATEFORMATS: + case TO_VIEWFORMATS: { + vector formats = (code == TO_IMPORTFORMATS) ? + theConverters().importableFormats() : + theConverters().exportableFormats(code != TO_EXPORTFORMATS); + sort(formats.begin(), formats.end()); + vector::const_iterator fit = formats.begin(); + vector::const_iterator end = formats.end(); + for (; fit != end ; ++fit) { + if ((*fit)->dummy()) + continue; + if (code != TO_IMPORTFORMATS && + !(*fit)->documentFormat()) + continue; + + docstring const prettyname = + from_utf8((*fit)->prettyname()); + docstring tooltip; + FuncCode lfun; + switch (code) { + case TO_EXPORTFORMATS: + lfun = LFUN_BUFFER_EXPORT; + tooltip = _("Export %1$s"); + break; + case TO_IMPORTFORMATS: + lfun = LFUN_BUFFER_IMPORT; + tooltip = _("Import %1$s ..."); + break; + case TO_UPDATEFORMATS: + lfun = LFUN_BUFFER_UPDATE; + tooltip = _("Update %1$s"); + break; + case TO_VIEWFORMATS: + lfun = LFUN_BUFFER_VIEW; + tooltip = _("View %1$s"); + break; + } + FuncRequest func(lfun, (*fit)->name(), + FuncRequest::TOOLBAR); + add(ToolbarItem(ToolbarItem::COMMAND, func, + bformat(tooltip, prettyname))); + } + break; + } + default: lex.printError("ToolbarInfo::read: " "Unknown toolbar tag: `$$Token'");