* add all available formats to view/update others popup icon (bug 5380)

patch contributed by Georg.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29490 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-05-02 08:43:22 +00:00
parent 3bed1d0111
commit e032cd934d
18 changed files with 132 additions and 13 deletions

View File

@ -1364,20 +1364,30 @@ lib_images_files = Split('''
box-insert.png box-insert.png
break-line.png break-line.png
buffer-close.png buffer-close.png
buffer-export.png
buffer-export_dvi.png buffer-export_dvi.png
buffer-export_latex.png buffer-export_latex.png
buffer-export_pdf.png
buffer-export_pdf2.png buffer-export_pdf2.png
buffer-export_pdf3.png
buffer-export_pdf4.png
buffer-export_ps.png buffer-export_ps.png
buffer-export_text.png buffer-export_text.png
buffer-new.png buffer-new.png
buffer-reload.png buffer-reload.png
buffer-update.png buffer-update.png
buffer-update_dvi.png buffer-update_dvi.png
buffer-update_pdf.png
buffer-update_pdf2.png buffer-update_pdf2.png
buffer-update_pdf3.png
buffer-update_pdf4.png
buffer-update_ps.png buffer-update_ps.png
buffer-view.png buffer-view.png
buffer-view_dvi.png buffer-view_dvi.png
buffer-view_pdf.png
buffer-view_pdf2.png buffer-view_pdf2.png
buffer-view_pdf3.png
buffer-view_pdf4.png
buffer-view_ps.png buffer-view_ps.png
buffer-write-as.png buffer-write-as.png
buffer-write.png buffer-write.png
@ -1642,6 +1652,7 @@ lib_images_math_files = Split('''
eta.png eta.png
eth.png eth.png
exists.png exists.png
export-others.png
fallingdotseq.png fallingdotseq.png
fint.png fint.png
fintop.png fintop.png

View File

@ -275,20 +275,30 @@ dist_images_DATA = \
images/box-insert.png \ images/box-insert.png \
images/break-line.png \ images/break-line.png \
images/buffer-close.png \ images/buffer-close.png \
images/buffer-export.png \
images/buffer-export_dvi.png \ images/buffer-export_dvi.png \
images/buffer-export_latex.png \ images/buffer-export_latex.png \
images/buffer-export_pdf.png \
images/buffer-export_pdf2.png \ images/buffer-export_pdf2.png \
images/buffer-export_pdf3.png \
images/buffer-export_pdf4.png \
images/buffer-export_ps.png \ images/buffer-export_ps.png \
images/buffer-export_text.png \ images/buffer-export_text.png \
images/buffer-new.png \ images/buffer-new.png \
images/buffer-reload.png \ images/buffer-reload.png \
images/buffer-update.png \ images/buffer-update.png \
images/buffer-update_dvi.png \ images/buffer-update_dvi.png \
images/buffer-update_pdf.png \
images/buffer-update_pdf2.png \ images/buffer-update_pdf2.png \
images/buffer-update_pdf3.png \
images/buffer-update_pdf4.png \
images/buffer-update_ps.png \ images/buffer-update_ps.png \
images/buffer-view.png \ images/buffer-view.png \
images/buffer-view_dvi.png \ images/buffer-view_dvi.png \
images/buffer-view_pdf.png \
images/buffer-view_pdf2.png \ images/buffer-view_pdf2.png \
images/buffer-view_pdf3.png \
images/buffer-view_pdf4.png \
images/buffer-view_ps.png \ images/buffer-view_ps.png \
images/buffer-write-as.png \ images/buffer-write-as.png \
images/buffer-write.png \ images/buffer-write.png \
@ -554,6 +564,7 @@ dist_imagesmath_DATA = \
images/math/eta.png \ images/math/eta.png \
images/math/eth.png \ images/math/eth.png \
images/math/exists.png \ images/math/exists.png \
images/math/export-others.png \
images/math/fallingdotseq.png \ images/math/fallingdotseq.png \
images/math/fint.png \ images/math/fint.png \
images/math/fintop.png \ images/math/fintop.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -213,17 +213,29 @@ ToolbarSet
End End
Toolbar "view-others" "View Other Formats" Toolbar "view-others" "View Other Formats"
Item "View DVI" "buffer-view dvi" ViewFormats
Item "View PDF (pdflatex)" "buffer-view pdf2"
Item "View PostScript" "buffer-view ps"
End End
Toolbar "update-others" "Update Other Formats" Toolbar "update-others" "Update Other Formats"
Item "Update DVI" "buffer-update dvi" UpdateFormats
Item "Update PDF (pdflatex)" "buffer-update pdf2"
Item "Update PostScript" "buffer-update ps"
End 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" Toolbar "vcs" "Version Control"
Item "Register" "vc-register" Item "Register" "vc-register"
Item "Check-out for edit" "vc-check-out" Item "Check-out for edit" "vc-check-out"

View File

@ -707,6 +707,20 @@ vector<Format const *> Converters::importableFormats()
} }
vector<Format const *> Converters::exportableFormats(bool only_viewable)
{
vector<string> s = savers();
vector<Format const *> result = getReachable(s[0], only_viewable, true);
for (vector<string>::const_iterator it = s.begin() + 1;
it != s.end(); ++it) {
vector<Format const *> r =
getReachable(*it, only_viewable, false);
result.insert(result.end(), r.begin(), r.end());
}
return result;
}
vector<string> Converters::loaders() const vector<string> Converters::loaders() const
{ {
vector<string> v; vector<string> v;
@ -717,4 +731,19 @@ vector<string> Converters::loaders() const
} }
vector<string> Converters::savers() const
{
vector<string> 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 } // namespace lyx

View File

@ -100,8 +100,10 @@ public:
bool clear_visited); bool clear_visited);
std::vector<Format const *> importableFormats(); std::vector<Format const *> importableFormats();
std::vector<Format const *> exportableFormats(bool only_viewable);
std::vector<std::string> loaders() const; std::vector<std::string> loaders() const;
std::vector<std::string> savers() const;
/// Does a conversion path from format \p from to format \p to exist? /// Does a conversion path from format \p from to format \p to exist?
bool isReachable(std::string const & from, std::string const & to); bool isReachable(std::string const & from, std::string const & to);

View File

@ -1461,7 +1461,7 @@ void GuiView::openDocument(string const & fname)
if (!fullname.onlyPath().isDirectory()) { if (!fullname.onlyPath().isDirectory()) {
Alert::warning(_("Invalid filename"), 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()))); from_utf8(fullname.absFilename())));
return; return;
} }

View File

@ -12,6 +12,8 @@
#include <config.h> #include <config.h>
#include "Toolbars.h" #include "Toolbars.h"
#include "Converter.h"
#include "Format.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "Lexer.h" #include "Lexer.h"
#include "LyXAction.h" #include "LyXAction.h"
@ -31,10 +33,6 @@ using namespace lyx::support;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
namespace {
} // namespace anon
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
@ -73,18 +71,26 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
TO_POPUPMENU, TO_POPUPMENU,
TO_STICKYPOPUPMENU, TO_STICKYPOPUPMENU,
TO_ICONPALETTE, TO_ICONPALETTE,
TO_EXPORTFORMATS,
TO_IMPORTFORMATS,
TO_UPDATEFORMATS,
TO_VIEWFORMATS,
}; };
struct LexerKeyword toolTags[] = { struct LexerKeyword toolTags[] = {
{ "end", TO_ENDTOOLBAR }, { "end", TO_ENDTOOLBAR },
{ "exportformats", TO_EXPORTFORMATS },
{ "iconpalette", TO_ICONPALETTE }, { "iconpalette", TO_ICONPALETTE },
{ "importformats", TO_IMPORTFORMATS },
{ "item", TO_COMMAND }, { "item", TO_COMMAND },
{ "layouts", TO_LAYOUTS }, { "layouts", TO_LAYOUTS },
{ "minibuffer", TO_MINIBUFFER }, { "minibuffer", TO_MINIBUFFER },
{ "popupmenu", TO_POPUPMENU }, { "popupmenu", TO_POPUPMENU },
{ "separator", TO_SEPARATOR }, { "separator", TO_SEPARATOR },
{ "stickypopupmenu", TO_STICKYPOPUPMENU }, { "stickypopupmenu", TO_STICKYPOPUPMENU },
{ "tableinsert", TO_TABLEINSERT } { "tableinsert", TO_TABLEINSERT },
{ "updateformats", TO_UPDATEFORMATS },
{ "viewformats", TO_VIEWFORMATS },
}; };
//consistency check //consistency check
@ -114,7 +120,8 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
lex.printTable(lyxerr); lex.printTable(lyxerr);
while (lex.isOK() && !quit) { while (lex.isOK() && !quit) {
switch (lex.lex()) { int const code = lex.lex();
switch (code) {
case TO_COMMAND: case TO_COMMAND:
if (lex.next(true)) { if (lex.next(true)) {
docstring const tooltip = translateIfPossible(lex.getDocString()); docstring const tooltip = translateIfPossible(lex.getDocString());
@ -183,6 +190,53 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
quit = true; quit = true;
break; break;
case TO_EXPORTFORMATS:
case TO_IMPORTFORMATS:
case TO_UPDATEFORMATS:
case TO_VIEWFORMATS: {
vector<Format const *> formats = (code == TO_IMPORTFORMATS) ?
theConverters().importableFormats() :
theConverters().exportableFormats(code != TO_EXPORTFORMATS);
sort(formats.begin(), formats.end());
vector<Format const *>::const_iterator fit = formats.begin();
vector<Format const *>::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: default:
lex.printError("ToolbarInfo::read: " lex.printError("ToolbarInfo::read: "
"Unknown toolbar tag: `$$Token'"); "Unknown toolbar tag: `$$Token'");