#pragma implementation
#endif
+#include "version.h"
#include "lyxlookup.h"
#include "kbmap.h"
#include "lyxfunc.h"
#include "insets/insettheorem.h"
#include "insets/insetcaption.h"
#include "mathed/formulamacro.h"
-#include "toolbar.h"
#include "spellchecker.h" // RVDK_PATCH_5
#include "minibuffer.h"
#include "vspace.h"
#include "layout.h"
#include "WorkArea.h"
#include "lyxfr1.h"
-#include "menus.h"
#include "bufferview_funcs.h"
#include "frontends/Dialogs.h"
+#include "frontends/Toolbar.h"
+#ifdef NEW_MENUBAR
+#include "frontends/Menubar.h"
+#else
+#include "menus.h"
+#endif
#include "FloatList.h"
using std::pair;
extern void QuitLyX();
extern void MenuFax(Buffer *);
extern void MenuExport(Buffer *, string const &);
+extern void show_symbols_form(LyXFunc *);
extern LyXAction lyxaction;
// (alkis)
// no
setErrorMessage(N_("Document is read-only"));
flag |= LyXFunc::Disabled;
+ return flag;
}
} else {
// no
}
}
- if (flag & LyXFunc::Disabled)
- return flag;
-
// I would really like to avoid having this switch and rather try to
// encode this in the function itself.
static bool noLaTeX = lyxrc.latex_command == "none";
disable = noLaTeX || lyxrc.fax_command == "none";
break;
case LFUN_IMPORT:
- if (argument == "latex")
+ if (argument == "latex" || argument == "noweb")
disable = lyxrc.relyx_command == "none";
- if (argument == "linuxdoc")
+ else if (argument == "linuxdoc")
disable = lyxrc.linuxdoc_to_lyx_command == "none";
break;
case LFUN_EXPORT:
- if (argument == "dvi" || argument == "postscript")
+ if (argument == "latex")
+ disable = ! buf->isLatex();
+ else if (argument == "linuxdoc")
+ disable = ! buf->isLinuxDoc();
+ else if (argument == "docbook")
+ disable = ! buf->isDocBook();
+ else if (argument == "dvi" || argument == "postscript")
disable = noLaTeX;
- if (argument == "html")
- disable = lyxrc.html_command == "none";
- if (argument == "html-linuxdoc")
- disable = lyxrc.linuxdoc_to_html_command == "none";
- if (argument == "html-docbook")
- disable = lyxrc.docbook_to_html_command == "none";
+ else if (argument == "html")
+ disable = (! buf->isLatex()
+ || lyxrc.html_command == "none");
+ else if (argument == "html-linuxdoc")
+ disable = (! buf->isLinuxDoc()
+ || lyxrc.linuxdoc_to_html_command == "none");
+ else if (argument == "html-docbook")
+ disable = (! buf->isDocBook()
+ || lyxrc.docbook_to_html_command == "none");
+ else if (argument == "custom")
+ disable == ! buf->isLatex();
break;
case LFUN_UNDO:
disable = buf->undostack.empty();
case LFUN_RUNCHKTEX:
disable = lyxrc.chktex_command == "none";
break;
+ case LFUN_BUILDPROG:
+ disable = (lyxrc.literate_command == "none"
+ || ! buf->isLiterate());
+#ifndef NEW_TABULAR
case LFUN_LAYOUT_TABLE:
disable = ! owner->view()->text->cursor.par()->table;
break;
+#endif
+ case LFUN_VC_REGISTER:
+ disable = buf->lyxvc.inUse();
+ break;
+ case LFUN_VC_CHECKIN:
+ disable = !buf->lyxvc.inUse() || buf->isReadonly();
+ break;
+ case LFUN_VC_CHECKOUT:
+ disable = !buf->lyxvc.inUse() || !buf->isReadonly();
+ break;
+ case LFUN_VC_REVERT:
+ case LFUN_VC_UNDO:
+ case LFUN_VC_HISTORY:
+ disable = !buf->lyxvc.inUse();
+ break;
default:
break;
}
Figure();
break;
- case LFUN_INSERT_GRAPHICS:
+ case LFUN_INSET_GRAPHICS:
{
Inset * new_inset = new InsetGraphics;
if (!owner->view()->insertInset(new_inset))
owner->getDialogs()->showCopyright();
break;
+ case LFUN_HELP_CREDITS:
+ owner->getDialogs()->showCredits();
+ break;
+
+ case LFUN_HELP_OPEN: {
+ string arg = argument;
+ if (arg.empty()) {
+ setErrorMessage(N_("Missing argument"));
+ break;
+ }
+ ProhibitInput(owner->view());
+ string fname = i18nLibFileSearch("doc", arg, "lyx");
+ if (fname.empty()) {
+ lyxerr << "LyX: unable to find documentation file `"
+ << arg << "'. Bad installation?" << endl;
+ AllowInput(owner->view());
+ break;
+ }
+ owner->getMiniBuffer()->Set(_("Opening help file"),
+ MakeDisplayPath(fname),"...");
+ owner->view()->buffer(bufferlist.loadLyXFile(fname,false));
+ AllowInput(owner->view());
+ break;
+ }
+
+ case LFUN_HELP_VERSION:
+ ProhibitInput(owner->view());
+ fl_show_message((string(_("LyX Version ")) + LYX_VERSION
+ + _(" of ") + LYX_RELEASE).c_str(),
+ (_("Library directory: ")
+ + MakeDisplayPath(system_lyxdir)).c_str(),
+ (_("User directory: ")
+ + MakeDisplayPath(user_lyxdir)).c_str());
+ AllowInput(owner->view());
+ break;
+
// --- version control -------------------------------
case LFUN_VC_REGISTER:
{
// --- buffers ----------------------------------------
+ case LFUN_SWITCHBUFFER:
+ owner->view()->buffer(bufferlist.getBuffer(argument));
+ break;
+
+
case LFUN_FILE_INSERT:
{
MenuInsertLyXFile(argument);
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->
SetLayout(owner->view(), layout.second);
- owner->getToolbar()->combox->
- select(owner->view()->
- text->cursor.par()->
- GetLayout() + 1);
+ owner->setLayout(layout.second);
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->setState();
}
break;
case LFUN_DROP_LAYOUTS_CHOICE:
- owner->getToolbar()->combox->Show();
+ owner->getToolbar()->openLayoutList();
break;
case LFUN_LANGUAGE:
break;
case LFUN_MENU_OPEN_BY_NAME:
+#ifdef NEW_MENUBAR
+ owner->getMenubar()->openByName(argument);
+#else
owner->getMenus()->openByName(argument);
+#endif
break; // RVDK_PATCH_5
case LFUN_SPELLCHECK:
case LFUN_PUSH_TOOLBAR:
{
int nth = strToInt(argument);
- if (lyxerr.debugging(Debug::TOOLBAR)) {
- lyxerr << "LFUN_PUSH_TOOLBAR: argument = `"
- << argument << "'\n"
- << "LFUN_PUSH_TOOLBAR: nth = `"
- << nth << "'" << endl;
- }
-
if (nth <= 0) {
- LyXBell();
setErrorMessage(N_("Push-toolbar needs argument > 0"));
} else {
owner->getToolbar()->push(nth);
case LFUN_ADD_TO_TOOLBAR:
{
- if (lyxerr.debugging(Debug::TOOLBAR)) {
+ if (lyxerr.debugging(Debug::GUI)) {
lyxerr << "LFUN_ADD_TO_TOOLBAR:"
"argument = `" << argument << '\'' << endl;
}
//lyxerr <<string("Argument: ") + argument);
//lyxerr <<string("Tmp : ") + tmp);
if (tmp.empty()) {
- LyXBell();
setErrorMessage(N_("Usage: toolbar-add-to <LyX command>"));
} else {
owner->getToolbar()->add(argument, false);
break;
case LFUN_MATH_MODE: // Open or create a math inset
- {
-
+ {
if (owner->view()->available())
owner->view()->open_new_inset(new InsetFormula);
setMessage(N_("Math editor mode"));
case LFUN_MATH_LIMITS:
{
setErrorMessage(N_("This is only allowed in math mode!"));
+
+ }
+ break;
+
+ case LFUN_MATH_PANEL:
+ {
+ show_symbols_form(this);
}
break;