From e032cd934d7d94aa37d7951411660dc32a4b9f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Sat, 2 May 2009 08:43:22 +0000 Subject: [PATCH] * 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 --- development/scons/scons_manifest.py | 11 +++++ lib/Makefile.am | 11 +++++ lib/images/buffer-export.png | Bin 0 -> 1080 bytes lib/images/buffer-export_pdf.png | Bin 0 -> 352 bytes lib/images/buffer-export_pdf3.png | Bin 0 -> 352 bytes lib/images/buffer-export_pdf4.png | Bin 0 -> 352 bytes lib/images/buffer-update_pdf.png | Bin 0 -> 585 bytes lib/images/buffer-update_pdf3.png | Bin 0 -> 585 bytes lib/images/buffer-update_pdf4.png | Bin 0 -> 585 bytes lib/images/buffer-view_pdf.png | Bin 0 -> 352 bytes lib/images/buffer-view_pdf3.png | Bin 0 -> 352 bytes lib/images/buffer-view_pdf4.png | Bin 0 -> 352 bytes lib/images/math/export-others.png | Bin 0 -> 1080 bytes lib/ui/stdtoolbars.inc | 24 +++++++--- src/Converter.cpp | 29 ++++++++++++ src/Converter.h | 2 + src/frontends/qt4/GuiView.cpp | 2 +- src/frontends/qt4/Toolbars.cpp | 66 +++++++++++++++++++++++++--- 18 files changed, 132 insertions(+), 13 deletions(-) create mode 100644 lib/images/buffer-export.png create mode 100644 lib/images/buffer-export_pdf.png create mode 100644 lib/images/buffer-export_pdf3.png create mode 100644 lib/images/buffer-export_pdf4.png create mode 100644 lib/images/buffer-update_pdf.png create mode 100644 lib/images/buffer-update_pdf3.png create mode 100644 lib/images/buffer-update_pdf4.png create mode 100644 lib/images/buffer-view_pdf.png create mode 100644 lib/images/buffer-view_pdf3.png create mode 100644 lib/images/buffer-view_pdf4.png create mode 100644 lib/images/math/export-others.png 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 0000000000000000000000000000000000000000..09f8060e16c342dd3ff03946b6d47de3be6d4978 GIT binary patch literal 1080 zcmV-81jqY{P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXJ@ z3oA2=Jj!SQ00X#5L_t(I%axT)Ok7nI$A9;|fngY0rVP%EGE|UKEUiX^pr#dVGzd*& z6QzkROcyn&i5rOvH(i>Tm>731Owcs8i7~O&5DSY|+ftgADaE!>S}31o_!`PL%)FU- zb6gBF&hVw)Zc60 z9O0{vp9T=ecAISJsdQh3^mTQl;YCG7a_i;|LKEl6(x!kI0Ly^^W_y}xy9X1GmudVX zgVFK%b)39%@UWb@cw6>X>`(PBfl0sknj2(Q1_9)=_uX>sOpQFc^r2k%(jmW`bcpxK zTv;bYbzQv_?kdBPmrs7li=>jbHhoUjp>Gl=RDk;Wr%841fgii81lNuXVrXPp_4OJn zrBVCdF#vL$Zd}h+vG=6|0;qRCI*rJB*-kYtCEr6)D8$mg6d%3odMO1tZ8rLy|%Eps@ppcuRR89d%%0cgK9qz=Abl}7$&kAu@!B6Qw) zqyV(p=?Qhb_W3P|?_O!5{rrzij1DHX?tUFKzWG`UL$}+=vRVik(X_14G$jgnuH1tF_j{)>!lv4+^5pkUKMg02(c6B3%nY4y z#7wi|ZS08}V07N7?0hJ(Kg9Aug?Ey4h$G&Sfj=Cdc6?oBf9i?gPDK6p@ zk25Znh@g~8&IHM(cq~TDG%=>8Sh(0s$UjQVG?7>gTj5T0K-X2gK$79Ck|mxAEKx)N zQ6oY)Xuz1C;N(P7M0Mu zVS?#lw{5|WJ3riF*|+BH9$T3fKc>!p`KHd$#$}N=ZMpoK)E)1q)^k6zSI}=-H@$v7 zYmMlem~Z#~1q6Jpz4=eA!Tvv6HAmC2rm%^QCQK1qU(DJgX(HV7sc2I6`39>GoI1^& s&rZGBmCSuRtS4Ua;PeG2_nu@uT+*C;;C;y&pvM_JUHx3vIVCg!0LFoda{vGU literal 0 HcmV?d00001 diff --git a/lib/images/buffer-export_pdf3.png b/lib/images/buffer-export_pdf3.png new file mode 100644 index 0000000000000000000000000000000000000000..601fa8b9dbf63997717f00f7fe41f453f66a92a4 GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3&Vd9T(EcfWS|IVfk$L9 z0|U1(2s1Lwnj--eWH0gbb!ETK$;H6Wqn{IU3@G&0)5S5Q;?~*8_E}Dj0`2?Nxx~sG zHwb8VCnV47om;`uukeH^YMIwAnZt*i_!E-FIXa@AF=ehM0Mu zVS?#lw{5|WJ3riF*|+BH9$T3fKc>!p`KHd$#$}N=ZMpoK)E)1q)^k6zSI}=-H@$v7 zYmMlem~Z#~1q6Jpz4=eA!Tvv6HAmC2rm%^QCQK1qU(DJgX(HV7sc2I6`39>GoI1^& s&rZGBmCSuRtS4Ua;PeG2_nu@uT+*C;;C;y&pvM_JUHx3vIVCg!0LFoda{vGU literal 0 HcmV?d00001 diff --git a/lib/images/buffer-export_pdf4.png b/lib/images/buffer-export_pdf4.png new file mode 100644 index 0000000000000000000000000000000000000000..601fa8b9dbf63997717f00f7fe41f453f66a92a4 GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3&Vd9T(EcfWS|IVfk$L9 z0|U1(2s1Lwnj--eWH0gbb!ETK$;H6Wqn{IU3@G&0)5S5Q;?~*8_E}Dj0`2?Nxx~sG zHwb8VCnV47om;`uukeH^YMIwAnZt*i_!E-FIXa@AF=ehM0Mu zVS?#lw{5|WJ3riF*|+BH9$T3fKc>!p`KHd$#$}N=ZMpoK)E)1q)^k6zSI}=-H@$v7 zYmMlem~Z#~1q6Jpz4=eA!Tvv6HAmC2rm%^QCQK1qU(DJgX(HV7sc2I6`39>GoI1^& s&rZGBmCSuRtS4Ua;PeG2_nu@uT+*C;;C;y&pvM_JUHx3vIVCg!0LFoda{vGU literal 0 HcmV?d00001 diff --git a/lib/images/buffer-update_pdf.png b/lib/images/buffer-update_pdf.png new file mode 100644 index 0000000000000000000000000000000000000000..865ac470396595ae7bd9b6b4791eb4aeebf68401 GIT binary patch literal 585 zcmV-P0=E5$P)irBd1af(Y*NZn?9=iOY!k9y{= zz-r)2ivVj?LOe6P6hj-7$UoTo7^`?5_%ngl{-Ls4t&>${7DpF-{#dEmT?%?LQ(D(- zm4nzAG>3YN+iM=Y&8-`~?ClYM5_cy9N9f*%Ea^$d`c@BA9b_d;VYp8Cjju^A`XBKR X!BVGyrXh(300000NkvXXu0mjfd5rq) literal 0 HcmV?d00001 diff --git a/lib/images/buffer-update_pdf3.png b/lib/images/buffer-update_pdf3.png new file mode 100644 index 0000000000000000000000000000000000000000..865ac470396595ae7bd9b6b4791eb4aeebf68401 GIT binary patch literal 585 zcmV-P0=E5$P)irBd1af(Y*NZn?9=iOY!k9y{= zz-r)2ivVj?LOe6P6hj-7$UoTo7^`?5_%ngl{-Ls4t&>${7DpF-{#dEmT?%?LQ(D(- zm4nzAG>3YN+iM=Y&8-`~?ClYM5_cy9N9f*%Ea^$d`c@BA9b_d;VYp8Cjju^A`XBKR X!BVGyrXh(300000NkvXXu0mjfd5rq) literal 0 HcmV?d00001 diff --git a/lib/images/buffer-update_pdf4.png b/lib/images/buffer-update_pdf4.png new file mode 100644 index 0000000000000000000000000000000000000000..865ac470396595ae7bd9b6b4791eb4aeebf68401 GIT binary patch literal 585 zcmV-P0=E5$P)irBd1af(Y*NZn?9=iOY!k9y{= zz-r)2ivVj?LOe6P6hj-7$UoTo7^`?5_%ngl{-Ls4t&>${7DpF-{#dEmT?%?LQ(D(- zm4nzAG>3YN+iM=Y&8-`~?ClYM5_cy9N9f*%Ea^$d`c@BA9b_d;VYp8Cjju^A`XBKR X!BVGyrXh(300000NkvXXu0mjfd5rq) literal 0 HcmV?d00001 diff --git a/lib/images/buffer-view_pdf.png b/lib/images/buffer-view_pdf.png new file mode 100644 index 0000000000000000000000000000000000000000..601fa8b9dbf63997717f00f7fe41f453f66a92a4 GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3&Vd9T(EcfWS|IVfk$L9 z0|U1(2s1Lwnj--eWH0gbb!ETK$;H6Wqn{IU3@G&0)5S5Q;?~*8_E}Dj0`2?Nxx~sG zHwb8VCnV47om;`uukeH^YMIwAnZt*i_!E-FIXa@AF=ehM0Mu zVS?#lw{5|WJ3riF*|+BH9$T3fKc>!p`KHd$#$}N=ZMpoK)E)1q)^k6zSI}=-H@$v7 zYmMlem~Z#~1q6Jpz4=eA!Tvv6HAmC2rm%^QCQK1qU(DJgX(HV7sc2I6`39>GoI1^& s&rZGBmCSuRtS4Ua;PeG2_nu@uT+*C;;C;y&pvM_JUHx3vIVCg!0LFoda{vGU literal 0 HcmV?d00001 diff --git a/lib/images/buffer-view_pdf3.png b/lib/images/buffer-view_pdf3.png new file mode 100644 index 0000000000000000000000000000000000000000..601fa8b9dbf63997717f00f7fe41f453f66a92a4 GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3&Vd9T(EcfWS|IVfk$L9 z0|U1(2s1Lwnj--eWH0gbb!ETK$;H6Wqn{IU3@G&0)5S5Q;?~*8_E}Dj0`2?Nxx~sG zHwb8VCnV47om;`uukeH^YMIwAnZt*i_!E-FIXa@AF=ehM0Mu zVS?#lw{5|WJ3riF*|+BH9$T3fKc>!p`KHd$#$}N=ZMpoK)E)1q)^k6zSI}=-H@$v7 zYmMlem~Z#~1q6Jpz4=eA!Tvv6HAmC2rm%^QCQK1qU(DJgX(HV7sc2I6`39>GoI1^& s&rZGBmCSuRtS4Ua;PeG2_nu@uT+*C;;C;y&pvM_JUHx3vIVCg!0LFoda{vGU literal 0 HcmV?d00001 diff --git a/lib/images/buffer-view_pdf4.png b/lib/images/buffer-view_pdf4.png new file mode 100644 index 0000000000000000000000000000000000000000..601fa8b9dbf63997717f00f7fe41f453f66a92a4 GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3&Vd9T(EcfWS|IVfk$L9 z0|U1(2s1Lwnj--eWH0gbb!ETK$;H6Wqn{IU3@G&0)5S5Q;?~*8_E}Dj0`2?Nxx~sG zHwb8VCnV47om;`uukeH^YMIwAnZt*i_!E-FIXa@AF=ehM0Mu zVS?#lw{5|WJ3riF*|+BH9$T3fKc>!p`KHd$#$}N=ZMpoK)E)1q)^k6zSI}=-H@$v7 zYmMlem~Z#~1q6Jpz4=eA!Tvv6HAmC2rm%^QCQK1qU(DJgX(HV7sc2I6`39>GoI1^& s&rZGBmCSuRtS4Ua;PeG2_nu@uT+*C;;C;y&pvM_JUHx3vIVCg!0LFoda{vGU literal 0 HcmV?d00001 diff --git a/lib/images/math/export-others.png b/lib/images/math/export-others.png new file mode 100644 index 0000000000000000000000000000000000000000..09f8060e16c342dd3ff03946b6d47de3be6d4978 GIT binary patch literal 1080 zcmV-81jqY{P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXJ@ z3oA2=Jj!SQ00X#5L_t(I%axT)Ok7nI$A9;|fngY0rVP%EGE|UKEUiX^pr#dVGzd*& z6QzkROcyn&i5rOvH(i>Tm>731Owcs8i7~O&5DSY|+ftgADaE!>S}31o_!`PL%)FU- zb6gBF&hVw)Zc60 z9O0{vp9T=ecAISJsdQh3^mTQl;YCG7a_i;|LKEl6(x!kI0Ly^^W_y}xy9X1GmudVX zgVFK%b)39%@UWb@cw6>X>`(PBfl0sknj2(Q1_9)=_uX>sOpQFc^r2k%(jmW`bcpxK zTv;bYbzQv_?kdBPmrs7li=>jbHhoUjp>Gl=RDk;Wr%841fgii81lNuXVrXPp_4OJn zrBVCdF#vL$Zd}h+vG=6|0;qRCI*rJB*-kYtCEr6)D8$mg6d%3odMO1tZ8rLy|%Eps@ppcuRR89d%%0cgK9qz=Abl}7$&kAu@!B6Qw) zqyV(p=?Qhb_W3P|?_O!5{rrzij1DHX?tUFKzWG`UL$}+=vRVik(X_14G$jgnuH1tF_j{)>!lv4+^5pkUKMg02(c6B3%nY4y z#7wi|ZS08}V07N7?0hJ(Kg9Aug?Ey4h$G&Sfj=Cdc6?oBf9i?gPDK6p@ zk25Znh@g~8&IHM(cq~TDG%=>8Sh(0s$UjQVG?7>gTj5T0K-X2gK$79Ck|mxAEKx)N zQ6oY)Xuz1C;N(P7 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'");