* 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
@ -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
|
||||
|
@ -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 \
|
||||
|
BIN
lib/images/buffer-export.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
lib/images/buffer-export_pdf.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
lib/images/buffer-export_pdf3.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
lib/images/buffer-export_pdf4.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
lib/images/buffer-update_pdf.png
Normal file
After Width: | Height: | Size: 585 B |
BIN
lib/images/buffer-update_pdf3.png
Normal file
After Width: | Height: | Size: 585 B |
BIN
lib/images/buffer-update_pdf4.png
Normal file
After Width: | Height: | Size: 585 B |
BIN
lib/images/buffer-view_pdf.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
lib/images/buffer-view_pdf3.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
lib/images/buffer-view_pdf4.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
lib/images/math/export-others.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
@ -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"
|
||||
|
@ -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> 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
|
||||
|
@ -100,8 +100,10 @@ public:
|
||||
bool clear_visited);
|
||||
|
||||
std::vector<Format const *> importableFormats();
|
||||
std::vector<Format const *> exportableFormats(bool only_viewable);
|
||||
|
||||
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?
|
||||
bool isReachable(std::string const & from, std::string const & to);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <config.h>
|
||||
|
||||
#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<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:
|
||||
lex.printError("ToolbarInfo::read: "
|
||||
"Unknown toolbar tag: `$$Token'");
|
||||
|