#include "menus.h"
#endif
#include "FloatList.h"
+#include "exporter.h"
#include "FontLoader.h"
#include "TextCache.h"
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;
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();
lyxerr << "Key ["
<< action << "]["
<< buf << "]"
-#if 0
- << "["
- << num_bytes << "]"
-#endif
<< endl;
}
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());
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;
case LFUN_RUNDVIPS:
disable = noLaTeX;
break;
+#endif
case LFUN_MENUPRINT:
disable = noLaTeX || lyxrc.print_command == "none";
break;
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()) ;
else if (argument == "custom")
disable = (! buf->isLatex() && ! buf->isLiterate());
break;
+#endif
case LFUN_UNDO:
disable = buf->undostack.empty();
break;
getStatus(argument);
}
flag |= ret;
+ disable = false;
} else {
static InsetTabular inset(owner->buffer(), 1, 1);
func_status ret;
case LFUN_VC_HISTORY:
disable = !buf->lyxvc.inUse();
break;
+ case LFUN_REF_BACK:
+ disable = owner->view()->NoSavedPositions();
+ break;
default:
break;
}
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;
case LFUN_RUNLATEX:
MenuRunLaTeX(owner->buffer());
break;
+
+ case LFUN_RUNDVIPS:
+ CreatePostscript(owner->buffer(), false);
+ break;
+#endif
case LFUN_BUILDPROG:
MenuBuildProg(owner->buffer());
case LFUN_RUNCHKTEX:
MenuRunChktex(owner->buffer());
break;
-
- case LFUN_RUNDVIPS:
- CreatePostscript(owner->buffer(), false);
- break;
-
+
case LFUN_MENUPRINT:
owner->getDialogs()->showPrint();
break;
break;
case LFUN_EXPORT:
+#ifdef NEW_EXPORT
+ Exporter::Export(owner->buffer(), argument, false);
+#else
MenuExport(owner->buffer(), argument);
+#endif
break;
case LFUN_IMPORT:
break;
}
- case LFUN_TABLE:
+ case LFUN_DIALOG_TABULAR_INSERT:
#ifndef NEW_TABULAR
Table();
#else
MenuInsertLabel(argument.c_str());
break;
- case LFUN_REF_CREATE:
- {
- InsetCommandParams p( "ref" );
- owner->getDialogs()->createRef( p.getAsString() );
- }
- break;
-
case LFUN_REF_INSERT:
- {
- InsetCommandParams p;
- p.setFromString( argument );
+ if (argument.empty()) {
+ InsetCommandParams p("ref");
+ owner->getDialogs()->createRef(p.getAsString());
+ } else {
+ InsetCommandParams p;
+ p.setFromString(argument);
+
+ InsetRef * inset = new InsetRef(p);
+ if (!owner->view()->insertInset(inset))
+ delete inset;
+ else
+ owner->view()->updateInset(inset, true);
+ }
+ break;
- InsetRef * inset = new InsetRef( p );
- if (!owner->view()->insertInset(inset))
- delete inset;
- else
- owner->view()->updateInset( inset, true );
- }
- break;
-
case LFUN_REF_BACK:
{
owner->view()->restorePosition();
}
break;
+ case LFUN_GOTO_PARAGRAPH:
+ {
+#ifdef HAVE_SSTREAM
+ istringstream istr(argument);
+#else
+ istrstream istr(argument.c_str());
+#endif
+
+ int id;
+ istr >> id;
+ LyXParagraph * par = owner->view()->text->GetParFromID(id);
+
+ // Set the cursor
+ owner->view()->text->SetCursor(owner->view(), par, 0);
+ owner->view()->setState();
+ owner->showState();
+
+ // Recenter screen
+ owner->view()->center();
+ }
+ break;
+
case LFUN_APROPOS:
case LFUN_GETTIP:
{