X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfunc.C;h=79d0dc66a0db010db0a72d57901e216b79f1ebe6;hb=9625f5e2300339330e099ccea259c46667ea1461;hp=d8f982ad3077d0ab8ce3798febba11e90c62f071;hpb=e445df8e4f8679526ca4cea4c73b498e7eaf60b5;p=lyx.git diff --git a/src/lyxfunc.C b/src/lyxfunc.C index d8f982ad30..79d0dc66a0 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -92,6 +92,7 @@ using std::istringstream; #include "menus.h" #endif #include "FloatList.h" +#include "exporter.h" #include "FontLoader.h" #include "TextCache.h" @@ -112,15 +113,21 @@ extern kb_keymap * toplevel_keymap; extern bool MenuWrite(Buffer *); extern bool MenuWriteAs(Buffer *); +#ifdef NEW_MENUBAR extern int MenuRunLaTeX(Buffer *); +#endif extern int MenuBuildProg(Buffer *); extern int MenuRunChktex(Buffer *); +#ifndef NEW_EXPORT extern bool CreatePostscript(Buffer *, bool); +#endif extern void MenuPrint(Buffer *); extern void MenuSendto(); extern void QuitLyX(); extern void MenuFax(Buffer *); +#ifndef NEW_EXPORT extern void MenuExport(Buffer *, string const &); +#endif extern void show_symbols_form(LyXFunc *); extern LyXAction lyxaction; @@ -128,8 +135,10 @@ extern LyXAction lyxaction; extern tex_accent_struct get_accent(kb_action action); extern void AutoSave(BufferView *); +#ifndef NEW_EXPORT extern bool PreviewDVI(Buffer *); extern bool PreviewPostscript(Buffer *); +#endif extern void MenuInsertLabel(char const *); extern void MenuLayoutCharacter(); extern void MenuLayoutParagraph(); @@ -262,10 +271,6 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state) lyxerr << "Key [" << action << "][" << buf << "]" -#if 0 - << "[" - << num_bytes << "]" -#endif << endl; } @@ -301,12 +306,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state) return 0; } } -#if 0 - else - if (action == LFUN_SELFINSERT) { - argument = s_r[0]; - } -#endif + bool tmp_sc = show_sc; show_sc = false; Dispatch(action, argument.c_str()); @@ -495,6 +495,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const static bool noLaTeX = lyxrc.latex_command == "none"; bool disable = false; switch (action) { +#ifndef NEW_EXPORT case LFUN_PREVIEW: disable = noLaTeX || lyxrc.view_dvi_command == "none"; break; @@ -505,6 +506,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const case LFUN_RUNDVIPS: disable = noLaTeX; break; +#endif case LFUN_MENUPRINT: disable = noLaTeX || lyxrc.print_command == "none"; break; @@ -517,6 +519,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const else if (argument == "linuxdoc") disable = lyxrc.linuxdoc_to_lyx_command == "none"; break; +#ifndef NEW_EXPORT case LFUN_EXPORT: if (argument == "latex") disable = (! buf->isLatex() && ! buf->isLiterate()) ; @@ -536,6 +539,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const else if (argument == "custom") disable = (! buf->isLatex() && ! buf->isLiterate()); break; +#endif case LFUN_UNDO: disable = buf->undostack.empty(); break; @@ -569,7 +573,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const case LFUN_TABULAR_FEATURE: disable = true; if (owner->view()->the_locking_inset) { - int ret = 0; + func_status ret = LyXFunc::Disabled; if (owner->view()->the_locking_inset->LyxCode() == Inset::TABULAR_CODE) { ret = static_cast (owner->view()->the_locking_inset)-> @@ -580,21 +584,17 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const GetFirstLockingInsetOfType(Inset::TABULAR_CODE))-> getStatus(argument); } - switch(ret) { - case 0: - break; - case 1: - disable = false; - break; - case 2: - disable = false; - flag |= LyXFunc::ToggleOn; - break; - case 3: - disable = false; - flag |= LyXFunc::ToggleOff; - break; - } + flag |= ret; + disable = false; + } else { + static InsetTabular inset(owner->buffer(), 1, 1); + func_status ret; + + disable = true; + ret = inset.getStatus(argument); + if ((ret & LyXFunc::ToggleOn) || + (ret & LyXFunc::ToggleOff)) + flag |= LyXFunc::ToggleOff; } break; @@ -976,6 +976,15 @@ string LyXFunc::Dispatch(int ac, reloadBuffer(); break; +#ifdef NEW_EXPORT + case LFUN_UPDATE: + Exporter::Export(owner->buffer(), argument, true); + break; + + case LFUN_PREVIEW: + Exporter::Preview(owner->buffer(), argument); + break; +#else case LFUN_PREVIEW: PreviewDVI(owner->buffer()); break; @@ -987,6 +996,11 @@ string LyXFunc::Dispatch(int ac, case LFUN_RUNLATEX: MenuRunLaTeX(owner->buffer()); break; + + case LFUN_RUNDVIPS: + CreatePostscript(owner->buffer(), false); + break; +#endif case LFUN_BUILDPROG: MenuBuildProg(owner->buffer()); @@ -995,11 +1009,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_RUNCHKTEX: MenuRunChktex(owner->buffer()); break; - - case LFUN_RUNDVIPS: - CreatePostscript(owner->buffer(), false); - break; - + case LFUN_MENUPRINT: owner->getDialogs()->showPrint(); break; @@ -1009,7 +1019,11 @@ string LyXFunc::Dispatch(int ac, break; case LFUN_EXPORT: +#ifdef NEW_EXPORT + Exporter::Export(owner->buffer(), argument, false); +#else MenuExport(owner->buffer(), argument); +#endif break; case LFUN_IMPORT: @@ -1062,7 +1076,7 @@ string LyXFunc::Dispatch(int ac, break; } - case LFUN_TABLE: + case LFUN_DIALOG_TABULAR_INSERT: #ifndef NEW_TABULAR Table(); #else