1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2000 The LyX Team.
9 * ====================================================== */
20 #pragma implementation
23 #include "lyxlookup.h"
26 #include "bufferlist.h"
27 #include "lyxserver.h"
32 #include "LyXAction.h"
33 #include "insets/inseturl.h"
34 #include "insets/insetlatexaccent.h"
35 #include "insets/insettoc.h"
36 #include "insets/insetlof.h"
37 #include "insets/insetloa.h"
38 #include "insets/insetlot.h"
39 #include "insets/insetref.h"
40 #include "insets/insetparent.h"
41 #include "insets/insetindex.h"
42 #include "insets/insetinclude.h"
43 #include "insets/insetbib.h"
44 #include "mathed/formulamacro.h"
46 #include "spellchecker.h" // RVDK_PATCH_5
47 #include "minibuffer.h"
51 #include "lyx_gui_misc.h"
52 #include "support/filetools.h"
53 #include "support/FileInfo.h"
54 #include "support/syscall.h"
55 #include "support/lstrings.h"
56 #include "support/path.h"
61 #include "trans_mgr.h"
62 #include "ImportLaTeX.h"
63 #include "ImportNoweb.h"
67 extern bool cursor_follows_scrollbar;
69 extern void InsertAsciiFile(string const &, bool);
70 extern void math_insert_symbol(char const *);
71 extern Bool math_insert_greek(char const); // why "Bool"?
72 extern BufferList bufferlist;
73 extern LyXServer * lyxserver;
74 extern short greek_kb_flag;
75 extern FD_form_toc * fd_form_toc;
76 extern bool selection_possible;
78 extern kb_keymap * toplevel_keymap;
80 extern void MenuWrite(Buffer *);
81 extern void MenuWriteAs(Buffer *);
82 extern int MenuRunLaTeX(Buffer *);
83 extern int MenuBuildProg(Buffer *);
84 extern int MenuRunChktex(Buffer *);
85 extern bool CreatePostscript(Buffer *, bool);
86 extern void MenuPrint(Buffer *);
87 extern void MenuSendto();
88 extern void QuitLyX();
89 extern void MenuFax(Buffer *);
90 extern void MenuExport(Buffer *, string const &);
91 extern void MenuPasteSelection(char at);
92 extern LyXAction lyxaction;
94 extern tex_accent_struct get_accent(kb_action action);
96 extern void AutoSave();
97 extern void MenuSearch();
98 extern void SetUpdateTimer(float timer = 0.3);
99 extern void FreeUpdateTimer();
100 extern bool PreviewDVI(Buffer *);
101 extern bool PreviewPostscript(Buffer *);
102 extern void MenuInsertLabel(char const *);
103 extern void MenuInsertRef();
104 extern void MenuLayoutCharacter();
105 extern void MenuLayoutParagraph();
106 extern void MenuLayoutDocument();
107 extern void MenuLayoutPaper();
108 extern void MenuLayoutTable(int flag);
109 extern void MenuLayoutQuotes();
110 extern void MenuLayoutPreamble();
111 extern void MenuLayoutSave();
112 extern void bulletForm();
114 extern Buffer * NewLyxFile(string const &);
115 extern void LoadLyXFile(string const &);
116 extern void Reconfigure(BufferView *);
118 extern int current_layout;
119 extern int getISOCodeFromLaTeX(char *);
121 extern void ShowLatexLog();
123 /* === globals =========================================================== */
125 bool LyXFunc::show_sc = true;
128 LyXFunc::LyXFunc(LyXView * o)
132 lyx_dead_action = LFUN_NOACTION;
133 lyx_calling_dead_action = LFUN_NOACTION;
138 // I changed this func slightly. I commented out the ...FinishUndo(),
139 // this means that all places that used to have a moveCursorUpdate, now
140 // have a ...FinishUndo() as the preceeding statement. I have also added
141 // a moveCursorUpdate to some of the functions that updated the cursor, but
142 // that did not show its new position.
144 void LyXFunc::moveCursorUpdate(bool selecting)
146 if (selecting || owner->view()->text->mark_set) {
147 owner->view()->text->SetSelection();
148 owner->view()->toggleToggle();
149 owner->view()->update(0);
151 owner->view()->update(-2); // this IS necessary
155 owner->view()->showCursor();
157 /* ---> Everytime the cursor is moved, show the current font state. */
158 // should this too me moved out of this func?
159 //owner->getMiniBuffer()->Set(CurrentState());
160 owner->view()->setState();
164 int LyXFunc::processKeyEvent(XEvent * ev)
168 XKeyEvent * keyevent = &ev->xkey;
169 KeySym keysym_return;
171 int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
172 s_r[num_bytes] = '\0';
174 if (lyxerr.debugging(Debug::KEY)) {
175 char * tmp = XKeysymToString(keysym_return);
176 string stm = (tmp ? tmp : "");
177 lyxerr << "KeySym is "
180 << keysym_return << "]"
181 << " and num_bytes is "
183 << " the string returned is \""
184 << s_r << '\"' << endl;
186 // Do nothing if we have nothing (JMarc)
187 if (num_bytes == 0 && keysym_return == NoSymbol) {
188 lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
193 // this function should be used always [asierra060396]
194 if (owner->view()->available() &&
195 owner->view()->the_locking_inset &&
196 keysym_return == XK_Escape) {
197 owner->view()->unlockInset(owner->view()->the_locking_inset);
198 owner->view()->text->CursorRight();
199 moveCursorUpdate(false);
200 owner->getMiniBuffer()->Set(CurrentState());
204 // Can we be sure that this will work for all X-Windows
205 // implementations? (Lgb)
206 // This code snippet makes lyx ignore some keys. Perhaps
207 // all of them should be explictly mentioned?
208 if((keysym_return >= XK_Shift_L && keysym_return <= XK_Hyper_R)
209 || keysym_return == XK_Mode_switch || keysym_return == 0x0)
212 // Do a one-deep top-level lookup for
213 // cancel and meta-fake keys. RVDK_PATCH_5
214 cancel_meta_seq.reset();
216 int action = cancel_meta_seq.addkey(keysym_return, keyevent->state
217 &(ShiftMask|ControlMask
220 // When not cancel or meta-fake, do the normal lookup.
221 // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
222 // Mostly, meta_fake_bit = 0. RVDK_PATCH_5.
223 if ( (action != LFUN_CANCEL) && (action != LFUN_META_FAKE) ) {
225 // remove Caps Lock and Mod2 as a modifiers
226 action = keyseq.addkey(keysym_return,
227 (keyevent->state | meta_fake_bit)
228 &(ShiftMask|ControlMask
231 // Dont remove this unless you know what you are doing.
234 if (action == 0) action = LFUN_PREFIX;
236 if (lyxerr.debugging(Debug::KEY)) {
242 << num_bytes << "]" << endl;
245 // already here we know if it any point in going further
246 // why not return already here if action == -1 and
247 // num_bytes == 0? (Lgb)
249 if(keyseq.length > 1 || keyseq.length < -1) {
252 owner->getMiniBuffer()->Set(buf);
256 if (keyseq.length < -1) { // unknown key sequence...
260 owner->getMiniBuffer()->Set(_("Unknown sequence:"), buf);
264 char isochar = keyseq.getiso();
265 if (!(keyevent->state&ControlMask) &&
266 !(keyevent->state&Mod1Mask) &&
267 (isochar && keysym_return < 0xF000)) {
270 if (argument.empty()) {
271 lyxerr.debug() << "Empty argument!" << endl;
272 // This can`t possibly be of any use
273 // so we`ll skip the dispatch.
277 if (action == LFUN_SELFINSERT) {
281 bool tmp_sc = show_sc;
283 Dispatch(action, argument.c_str());
290 LyXFunc::func_status LyXFunc::getStatus(int ac) const
293 func_status flag = LyXFunc::OK;
295 Buffer * buf = owner->buffer();
297 if (lyxaction.isPseudoAction(ac))
298 action = lyxaction.retrieveActionArg(ac, argument);
300 action = static_cast<kb_action>(ac);
302 if (action == LFUN_UNKNOWN_ACTION) {
303 setErrorMessage(N_("Unknown action"));
304 return LyXFunc::Unknown;
307 // Check whether we need a buffer
308 if (!lyxaction.funcHasFlag(action, LyXAction::NoBuffer)) {
309 // Yes we need a buffer, do we have one?
312 // Can we use a readonly buffer?
313 if (buf->isReadonly() &&
314 !lyxaction.funcHasFlag(action,
315 LyXAction::ReadOnly)) {
317 setErrorMessage(N_("Document is read-only"));
318 flag |= LyXFunc::Disabled;
322 setErrorMessage(N_("Command not allowed with"
323 "out any document open"));
324 flag |= LyXFunc::Disabled;
328 if (flag & LyXFunc::Disabled)
331 // I would really like to avoid having this switch and rather try to
332 // encode this in the function itself.
333 static bool noLaTeX = lyxrc->latex_command == "none";
334 bool disable = false;
337 disable = noLaTeX || lyxrc->view_dvi_command == "none";
340 disable = noLaTeX || lyxrc->view_ps_command == "none";
347 disable = noLaTeX || lyxrc->print_command == "none";
350 disable = noLaTeX || lyxrc->fax_command == "none";
353 if (argument == "latex")
354 disable = lyxrc->relyx_command == "none";
357 if (argument == "dvi" || argument == "postscript")
359 if (argument == "html")
360 disable = lyxrc->html_command == "none";
363 disable = buf->undostack.empty();
366 disable = buf->redostack.empty();
368 case LFUN_SPELLCHECK:
369 disable = lyxrc->isp_command == "none";
372 disable = lyxrc->chktex_command == "none";
374 case LFUN_LAYOUT_TABLE:
375 disable = ! owner->view()->text->cursor.par->table;
381 flag |= LyXFunc::Disabled;
384 func_status box = LyXFunc::ToggleOff;
385 LyXFont font = owner->view()->text->real_current_font;
388 if (font.emph() == LyXFont::ON)
389 box = LyXFunc::ToggleOn;
392 if (font.noun() == LyXFont::ON)
393 box = LyXFunc::ToggleOn;
396 if (font.series() == LyXFont::BOLD_SERIES)
397 box = LyXFunc::ToggleOn;
400 if (font.latex() == LyXFont::ON)
401 box = LyXFunc::ToggleOn;
404 if (font.direction() == LyXFont::RTL_DIR)
405 box = LyXFunc::ToggleOn;
418 string LyXFunc::Dispatch(string const & s)
420 // Split command string into command and argument
421 string cmd, line = frontStrip(s);
422 string arg = strip(frontStrip(split(line, cmd, ' ')));
424 return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg.c_str());
428 string LyXFunc::Dispatch(int ac,
429 char const * do_not_use_this_arg)
434 // we have not done anything wrong yet.
436 dispatch_buffer.clear();
438 // if action is a pseudo-action, we need the real action
439 if (lyxaction.isPseudoAction(ac)) {
441 action = static_cast<kb_action>
442 (lyxaction.retrieveActionArg(ac, tmparg));
446 action = static_cast<kb_action>(ac);
447 if (do_not_use_this_arg)
448 argument = do_not_use_this_arg; // except here
451 selection_possible = false;
453 if (owner->view()->available())
454 owner->view()->hideCursor();
456 // We cannot use this function here
457 if (getStatus(action) & Disabled)
458 goto exit_with_message;
460 commandshortcut.clear();
462 if (lyxrc->display_shortcuts && show_sc) {
463 if (action != LFUN_SELFINSERT) {
464 // Put name of command and list of shortcuts
465 // for it in minibuffer
466 string comname = lyxaction.getActionName(action);
468 int pseudoaction = action;
469 bool argsadded = false;
471 if (!argument.empty()) {
472 // If we have the command with argument,
475 lyxaction.searchActionArg(action,
478 if (pseudoaction == -1) {
479 pseudoaction = action;
481 comname += " " + argument;
486 string shortcuts = toplevel_keymap->findbinding(pseudoaction);
488 if (!shortcuts.empty()) {
489 comname += ": " + shortcuts;
490 } else if (!argsadded) {
491 comname += " " + argument;
494 if (!comname.empty()) {
495 comname = strip(comname);
496 commandshortcut = "(" + comname + ')';
497 owner->getMiniBuffer()->Set(commandshortcut);
498 // Here we could even add a small pause,
499 // to annoy the user and make him learn
501 // No! That will just annoy, not teach
502 // anything. The user will read the messages
503 // if they are interested. (Asger)
508 // If in math mode pass the control to
509 // the math inset [asierra060396]
510 if (owner->view()->available() &&
511 owner->view()->the_locking_inset) {
513 || (action == LFUN_UNKNOWN_ACTION
514 && keyseq.length >= -1)) {
515 if (action == LFUN_UNKNOWN_ACTION
516 && argument.empty()) {
517 argument = keyseq.getiso();
519 // Undo/Redo pre 0.13 is a bit tricky for insets.
520 if (action == LFUN_UNDO) {
522 UpdatableInset * inset =
523 owner->view()->the_locking_inset;
524 inset->GetCursorPos(slx, sly);
525 owner->view()->unlockInset(inset);
526 owner->view()->menuUndo();
527 inset = static_cast<UpdatableInset*>(owner->view()->text->cursor.par->GetInset(owner->view()->text->cursor.pos));
529 inset->Edit(owner->view(), slx, sly);
532 if (action == LFUN_REDO) {
534 UpdatableInset * inset = owner->view()->the_locking_inset;
535 inset->GetCursorPos(slx, sly);
536 owner->view()->unlockInset(inset);
537 owner->view()->menuRedo();
538 inset = static_cast<UpdatableInset*>(owner->view()->text->cursor.par->GetInset(owner->view()->text->cursor.pos));
540 inset->Edit(owner->view(),
544 if (owner->view()->the_locking_inset->LocalDispatch(owner->view(), action, argument.c_str()))
547 setMessage(N_("Text mode"));
548 LyXDirection direction = owner->view()->text->cursor.par->getParDirection();
550 (action == LFUN_RIGHT
551 && direction == LYX_DIR_LEFT_TO_RIGHT)) {
552 owner->view()->text->CursorRight();
553 moveCursorUpdate(false);
554 owner->getMiniBuffer()->Set(CurrentState());
556 if ( action == LFUN_LEFT
557 && direction == LYX_DIR_RIGHT_TO_LEFT) {
558 owner->view()->text->CursorRight();
559 moveCursorUpdate(false);
560 owner->getMiniBuffer()->Set(CurrentState());
562 if (action == LFUN_LEFT || action == LFUN_RIGHT)
569 // --- Misc -------------------------------------------
570 case LFUN_WORDFINDFORWARD :
571 case LFUN_WORDFINDBACKWARD : {
572 static string last_search;
573 string searched_string;
575 if (!argument.empty()) {
576 last_search = argument;
577 searched_string = argument;
579 searched_string = last_search;
582 LyXText * ltCur = owner->view()->text ;
584 if (!searched_string.empty() &&
585 ((action == LFUN_WORDFINDBACKWARD) ?
586 ltCur->SearchBackward(searched_string.c_str()) :
587 ltCur->SearchForward(searched_string.c_str()))) {
589 // ??? What is that ???
590 owner->view()->update(-2);
593 // clear the selection (if there is any)
594 owner->view()->toggleSelection();
595 owner->view()->text->ClearSelection();
597 // Move cursor so that successive C-s 's will not stand in place.
598 if( action == LFUN_WORDFINDFORWARD )
599 owner->view()->text->CursorRightOneWord();
600 owner->view()->text->FinishUndo();
601 moveCursorUpdate(false);
604 // set the new selection
605 // SetSelectionOverLenChars(owner->view()->currentBuffer()->text, iLenSelected);
606 owner->view()->toggleSelection(false);
610 // REMOVED : if (owner->view()->getWorkArea()->focus)
611 owner->view()->showCursor();
617 if (owner->view()->available()) {
618 owner->view()->update(-2);
621 keyseq.print(buf, true);
622 owner->getMiniBuffer()->Set(buf, string(), string(), 1);
626 // --- Misc -------------------------------------------
627 case LFUN_EXEC_COMMAND:
628 owner->getMiniBuffer()->ExecCommand();
631 case LFUN_CANCEL: // RVDK_PATCH_5
634 if(owner->view()->available())
635 // cancel any selection
636 Dispatch(LFUN_MARK_OFF, 0);
637 setMessage(N_("Cancel"));
640 case LFUN_META_FAKE: // RVDK_PATCH_5
642 meta_fake_bit = Mod1Mask;
644 keyseq.print(buf, true);
645 string res = string("M-") + buf;
646 setMessage(buf); // RVDK_PATCH_5
650 case LFUN_READ_ONLY_TOGGLE:
651 if (owner->buffer()->lyxvc.inUse()) {
652 owner->buffer()->lyxvc.toggleReadOnly();
654 owner->buffer()->setReadonly(
655 !owner->buffer()->isReadonly());
659 case LFUN_CENTER: // this is center and redraw.
660 owner->view()->center();
664 if (owner->view()->available()) {
665 owner->view()->text->toggleAppendix();
666 owner->view()->update(1);
670 // --- Menus -----------------------------------------------
675 case LFUN_MENUNEWTMPLT:
683 case LFUN_CLOSEBUFFER:
688 owner->getMiniBuffer()->Set(_("Saving document"),
689 MakeDisplayPath(owner->buffer()->fileName()),
691 MenuWrite(owner->buffer());
692 //owner->getMiniBuffer()->
693 // Set(_("Document saved as"),
694 // MakeDisplayPath(owner->buffer()->fileName()));
696 //owner->getMiniBuffer()->Set(_("Save failed!"));
700 case LFUN_MENUWRITEAS:
701 MenuWriteAs(owner->buffer());
704 case LFUN_MENURELOAD:
709 PreviewDVI(owner->buffer());
713 PreviewPostscript(owner->buffer());
717 MenuRunLaTeX(owner->buffer());
721 MenuBuildProg(owner->buffer());
725 MenuRunChktex(owner->buffer());
729 CreatePostscript(owner->buffer(), false);
733 MenuPrint(owner->buffer());
737 MenuFax(owner->buffer());
741 MenuExport(owner->buffer(), argument);
746 //needs argument as string
747 string imtyp = argument;
750 if (imtyp == "latex") {
751 doImportLaTeX(false);
754 else if (imtyp == "ascii") {
755 doImportASCII(false);
756 } else if (imtyp == "asciiparagraph") {
759 } else if (imtyp == "noweb") {
762 setErrorMessage(string(N_("Unknown import type: "))
774 if (fd_form_toc->form_toc->visible) {
775 fl_raise_form(fd_form_toc->form_toc);
777 static int ow = -1, oh;
778 fl_show_form(fd_form_toc->form_toc,
780 FL_FREE_SIZE, FL_FULLBORDER,
781 _("Table of Contents"));
783 ow = fd_form_toc->form_toc->w;
784 oh = fd_form_toc->form_toc->h;
786 fl_set_form_minsize(fd_form_toc->form_toc, ow, oh);
790 case LFUN_TOC_INSERT:
792 Inset * new_inset = new InsetTOC(owner->buffer());
793 owner->view()->insertInset(new_inset, "Standard", true);
797 case LFUN_LOF_INSERT:
799 Inset * new_inset = new InsetLOF(owner->buffer());
800 owner->view()->insertInset(new_inset, "Standard", true);
804 case LFUN_LOA_INSERT:
806 Inset * new_inset = new InsetLOA(owner->buffer());
807 owner->view()->insertInset(new_inset, "Standard", true);
811 case LFUN_LOT_INSERT:
813 Inset * new_inset = new InsetLOT(owner->buffer());
814 owner->view()->insertInset(new_inset, "Standard", true);
831 owner->view()->menuUndo();
835 owner->view()->menuRedo();
838 case LFUN_MENUSEARCH:
843 owner->view()->paste();
846 case LFUN_PASTESELECTION:
849 if (argument == "paragraph") asPara = true;
850 MenuPasteSelection(asPara);
855 owner->view()->cut();
859 owner->view()->copy();
862 case LFUN_LAYOUT_COPY:
863 owner->view()->copyEnvironment();
866 case LFUN_LAYOUT_PASTE:
867 owner->view()->pasteEnvironment();
871 owner->view()->gotoError();
874 case LFUN_REMOVEERRORS:
875 if (owner->view()->removeAutoInsets()) {
876 owner->view()->redraw();
877 owner->view()->fitCursor();
878 owner->view()->updateScrollbar();
883 owner->view()->gotoNote();
887 owner->view()->openStuff();
890 case LFUN_HYPHENATION:
891 owner->view()->hyphenationPoint();
895 owner->view()->ldots();
898 case LFUN_END_OF_SENTENCE:
899 owner->view()->endOfSentenceDot();
902 case LFUN_MENU_SEPARATOR:
903 owner->view()->menuSeparator();
907 owner->view()->hfill();
911 changeDepth(owner->view(), 0);
915 changeDepth(owner->view(), -1);
918 case LFUN_DEPTH_PLUS:
919 changeDepth(owner->view(), 1);
928 owner->view()->setState();
929 owner->getMiniBuffer()->Set(CurrentState());
936 case LFUN_RECONFIGURE:
937 Reconfigure(owner->view());
941 if (owner->view()->available()
942 && !owner->view()->text->selection
943 && owner->view()->text->cursor.par->footnoteflag
944 != LyXParagraph::NO_FOOTNOTE)
945 { // only melt footnotes with FOOTMELT, not margins etc
946 if(owner->view()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE)
951 owner->view()->setState();
954 case LFUN_MARGINMELT:
955 if (owner->view()->available()
956 && !owner->view()->text->selection
957 && owner->view()->text->cursor.par->footnoteflag
958 != LyXParagraph::NO_FOOTNOTE) {
960 if(owner->view()->text->cursor.par->footnotekind == LyXParagraph::MARGIN)
963 Margin(owner->view());
964 owner->view()->setState();
967 // --- version control -------------------------------
968 case LFUN_VC_REGISTER:
970 if (!owner->buffer()->lyxvc.inUse())
971 owner->buffer()->lyxvc.registrer();
975 case LFUN_VC_CHECKIN:
977 if (owner->buffer()->lyxvc.inUse()
978 && !owner->buffer()->isReadonly())
979 owner->buffer()->lyxvc.checkIn();
983 case LFUN_VC_CHECKOUT:
985 if (owner->buffer()->lyxvc.inUse()
986 && owner->buffer()->isReadonly())
987 owner->buffer()->lyxvc.checkOut();
993 owner->buffer()->lyxvc.revert();
999 owner->buffer()->lyxvc.undoLast();
1003 case LFUN_VC_HISTORY:
1005 owner->buffer()->lyxvc.showLog();
1009 // --- buffers ----------------------------------------
1011 case LFUN_FILE_INSERT:
1013 MenuInsertLyXFile(argument);
1017 case LFUN_FILE_INSERT_ASCII:
1019 bool asPara = (argument == "paragraph");
1020 InsertAsciiFile(string(), asPara);
1026 // servercmd: argument must be <file>:<template>
1027 Buffer * tmpbuf = NewLyxFile(argument);
1029 owner->view()->buffer(tmpbuf);
1033 case LFUN_FILE_OPEN:
1034 owner->view()->buffer(bufferlist.loadLyXFile(argument));
1037 case LFUN_LATEX_LOG:
1043 lyxerr.debug() << "LFUN_LAYOUTNO: (arg) " << argument << endl;
1044 int sel = strToInt(argument);
1045 lyxerr.debug() << "LFUN_LAYOUTNO: (sel) "<< sel << endl;
1047 // Should this give a setMessage instead?
1049 return string(); // illegal argument
1051 --sel; // sel 1..., but layout 0...
1053 // Pretend we got the name instead.
1054 Dispatch(int(LFUN_LAYOUT),
1055 textclasslist.NameOfLayout(owner->view()->
1064 lyxerr.debug() << "LFUN_LAYOUT: (arg) "
1065 << argument << endl;
1067 // Derive layout number from given argument (string)
1068 // and current buffer's textclass (number). */
1069 LyXTextClassList::ClassList::size_type tclass =
1070 owner->view()->text->parameters->textclass;
1071 pair <bool, int> layout =
1072 textclasslist.NumberOfLayout(tclass, argument);
1074 // If the entry is obsolete, use the new one instead.
1076 string obs = textclasslist.Style(tclass,layout.second)
1080 textclasslist.NumberOfLayout(tclass, obs);
1083 // see if we found the layout number:
1084 if (!layout.first) {
1085 setErrorMessage(string(N_("Layout ")) + argument +
1090 if (current_layout != layout.second) {
1091 owner->view()->hideCursor();
1092 current_layout = layout.second;
1093 owner->view()->update(-2);
1094 owner->view()->text->
1095 SetLayout(layout.second);
1096 owner->getToolbar()->combox->
1097 select(owner->view()->
1100 owner->view()->update(1);
1105 case LFUN_LAYOUT_DOCUMENT:
1106 MenuLayoutDocument();
1109 case LFUN_LAYOUT_PARAGRAPH:
1110 MenuLayoutParagraph();
1113 case LFUN_LAYOUT_CHARACTER:
1114 MenuLayoutCharacter();
1117 case LFUN_LAYOUT_TABLE:
1120 if (argument == "true") flag = 1;
1121 MenuLayoutTable(flag);
1125 case LFUN_LAYOUT_PAPER:
1129 case LFUN_LAYOUT_QUOTES:
1133 case LFUN_LAYOUT_PREAMBLE:
1134 MenuLayoutPreamble();
1137 case LFUN_LAYOUT_SAVE_DEFAULT:
1141 case LFUN_DROP_LAYOUTS_CHOICE:
1142 owner->getToolbar()->combox->Show();
1148 owner->view()->setState();
1149 owner->getMiniBuffer()->Set(CurrentState());
1181 case LFUN_UNDERLINE:
1185 case LFUN_FONT_SIZE:
1189 case LFUN_FONT_STATE:
1190 setMessage(CurrentState());
1193 case LFUN_UPCASE_WORD:
1194 owner->view()->update(-2);
1196 owner->view()->text->ChangeWordCase(LyXText::text_uppercase);
1197 owner->view()->update(1);
1201 case LFUN_LOWCASE_WORD:
1202 owner->view()->update(-2);
1204 owner->view()->text->ChangeWordCase(LyXText::text_lowercase);
1205 owner->view()->update(1);
1209 case LFUN_CAPITALIZE_WORD:
1210 owner->view()->update(-2);
1212 owner->view()->text->ChangeWordCase(LyXText::text_capitalization);
1213 owner->view()->update(1);
1217 case LFUN_INSERT_LABEL:
1218 MenuInsertLabel(argument.c_str());
1221 case LFUN_INSERT_REF:
1225 case LFUN_REFTOGGLE:
1228 static_cast<InsetRef*>(getInsetByCode(Inset::REF_CODE));
1230 if (inset->getFlag() == InsetRef::REF)
1231 inset->setFlag(InsetRef::PAGE_REF);
1233 inset->setFlag(InsetRef::REF);
1234 owner->view()->updateInset(inset, true);
1236 setErrorMessage(N_("No cross-reference to toggle"));
1243 owner->view()->restorePosition();
1249 string label(argument);
1250 if (label.empty()) {
1252 static_cast<InsetRef*>(getInsetByCode(Inset::REF_CODE));
1254 label = inset->getContents();
1257 if (!label.empty()) {
1258 owner->view()->savePosition();
1259 owner->view()->gotoLabel(label.c_str());
1264 case LFUN_MENU_OPEN_BY_NAME:
1265 owner->getMenus()->openByName(argument);
1266 break; // RVDK_PATCH_5
1268 case LFUN_SPELLCHECK:
1269 if (lyxrc->isp_command != "none")
1270 ShowSpellChecker(owner->view());
1271 break; // RVDK_PATCH_5
1273 // --- Cursor Movements -----------------------------
1276 LyXText * tmptext = owner->view()->text;
1277 LyXDirection direction =
1278 tmptext->cursor.par->getParDirection();
1279 if(!tmptext->mark_set)
1280 owner->view()->beforeChange();
1281 owner->view()->update(-2);
1282 if (direction == LYX_DIR_RIGHT_TO_LEFT)
1283 tmptext->CursorLeft();
1284 if (tmptext->cursor.pos < tmptext->cursor.par->Last()
1285 && tmptext->cursor.par->GetChar(tmptext->cursor.pos)
1286 == LyXParagraph::META_INSET
1287 && tmptext->cursor.par->GetInset(tmptext->cursor.pos)
1288 && tmptext->cursor.par->GetInset(tmptext->cursor.pos)->Editable() == 2){
1289 Inset * tmpinset = tmptext->cursor.par->GetInset(tmptext->cursor.pos);
1290 setMessage(tmpinset->EditMessage());
1291 tmpinset->Edit(owner->view(), 0, 0);
1294 if (direction == LYX_DIR_LEFT_TO_RIGHT)
1295 tmptext->CursorRight();
1296 owner->view()->text->FinishUndo();
1297 moveCursorUpdate(false);
1298 owner->getMiniBuffer()->Set(CurrentState());
1304 // This is soooo ugly. Isn`t it possible to make
1305 // it simpler? (Lgb)
1306 LyXText * txt = owner->view()->text;
1307 LyXDirection direction = txt->cursor.par->getParDirection();
1308 if(!txt->mark_set) owner->view()->beforeChange();
1309 owner->view()->update(-2);
1310 if (direction == LYX_DIR_LEFT_TO_RIGHT)
1312 if (txt->cursor.pos < txt->cursor.par->Last()
1313 && txt->cursor.par->GetChar(txt->cursor.pos)
1314 == LyXParagraph::META_INSET
1315 && txt->cursor.par->GetInset(txt->cursor.pos)
1316 && txt->cursor.par->GetInset(txt->cursor.pos)->Editable() == 2) {
1317 Inset * tmpinset = txt->cursor.par->GetInset(txt->cursor.pos);
1318 setMessage(tmpinset->EditMessage());
1319 tmpinset->Edit(owner->view(),
1320 tmpinset->width(owner->view()->painter(),
1321 txt->GetFont(txt->cursor.par,
1322 txt->cursor.pos)), 0);
1325 if (direction == LYX_DIR_RIGHT_TO_LEFT)
1328 owner->view()->text->FinishUndo();
1329 moveCursorUpdate(false);
1330 owner->getMiniBuffer()->Set(CurrentState());
1335 if(!owner->view()->text->mark_set) owner->view()->beforeChange();
1336 owner->view()->update(-3);
1337 owner->view()->text->CursorUp();
1338 owner->view()->text->FinishUndo();
1339 moveCursorUpdate(false);
1340 owner->getMiniBuffer()->Set(CurrentState());
1344 if(!owner->view()->text->mark_set)
1345 owner->view()->beforeChange();
1346 owner->view()->update(-3);
1347 owner->view()->text->CursorDown();
1348 owner->view()->text->FinishUndo();
1349 moveCursorUpdate(false);
1350 owner->getMiniBuffer()->Set(CurrentState());
1353 case LFUN_UP_PARAGRAPH:
1354 if(!owner->view()->text->mark_set)
1355 owner->view()->beforeChange();
1356 owner->view()->update(-3);
1357 owner->view()->text->CursorUpParagraph();
1358 owner->view()->text->FinishUndo();
1359 moveCursorUpdate(false);
1360 owner->getMiniBuffer()->Set(CurrentState());
1363 case LFUN_DOWN_PARAGRAPH:
1364 if(!owner->view()->text->mark_set)
1365 owner->view()->beforeChange();
1366 owner->view()->update(-3);
1367 owner->view()->text->CursorDownParagraph();
1368 owner->view()->text->FinishUndo();
1369 moveCursorUpdate(false);
1370 owner->getMiniBuffer()->Set(CurrentState());
1374 if(!owner->view()->text->mark_set)
1375 owner->view()->beforeChange();
1376 owner->view()->update(-3);
1377 owner->view()->cursorPrevious();
1378 owner->view()->text->FinishUndo();
1379 moveCursorUpdate(false);
1380 owner->getMiniBuffer()->Set(CurrentState());
1384 if(!owner->view()->text->mark_set)
1385 owner->view()->beforeChange();
1386 owner->view()->update(-3);
1387 owner->view()->cursorNext();
1388 owner->view()->text->FinishUndo();
1389 moveCursorUpdate(false);
1390 owner->getMiniBuffer()->Set(CurrentState());
1394 if(!owner->view()->text->mark_set)
1395 owner->view()->beforeChange();
1396 owner->view()->update(-2);
1397 owner->view()->text->CursorHome();
1398 owner->view()->text->FinishUndo();
1399 moveCursorUpdate(false);
1400 owner->getMiniBuffer()->Set(CurrentState());
1404 if(!owner->view()->text->mark_set)
1405 owner->view()->beforeChange();
1406 owner->view()->update(-2);
1407 owner->view()->text->CursorEnd();
1408 owner->view()->text->FinishUndo();
1409 moveCursorUpdate(false);
1410 owner->getMiniBuffer()->Set(CurrentState());
1414 if(!owner->view()->text->mark_set)
1415 owner->view()->beforeChange();
1416 owner->view()->update(-2);
1417 owner->view()->text->CursorTab();
1418 owner->view()->text->FinishUndo();
1419 moveCursorUpdate(false);
1420 owner->getMiniBuffer()->Set(CurrentState());
1423 case LFUN_WORDRIGHT:
1424 if(!owner->view()->text->mark_set)
1425 owner->view()->beforeChange();
1426 owner->view()->update(-2);
1427 if (owner->view()->text->cursor.par->getParDirection()
1428 == LYX_DIR_LEFT_TO_RIGHT)
1429 owner->view()->text->CursorRightOneWord();
1431 owner->view()->text->CursorLeftOneWord();
1432 owner->view()->text->FinishUndo();
1433 moveCursorUpdate(false);
1434 owner->getMiniBuffer()->Set(CurrentState());
1438 if(!owner->view()->text->mark_set)
1439 owner->view()->beforeChange();
1440 owner->view()->update(-2);
1441 if (owner->view()->text->cursor.par->getParDirection()
1442 == LYX_DIR_LEFT_TO_RIGHT)
1443 owner->view()->text->CursorLeftOneWord();
1445 owner->view()->text->CursorRightOneWord();
1446 owner->view()->text->FinishUndo();
1447 moveCursorUpdate(false);
1448 owner->getMiniBuffer()->Set(CurrentState());
1451 case LFUN_BEGINNINGBUF:
1452 if(!owner->view()->text->mark_set)
1453 owner->view()->beforeChange();
1454 owner->view()->update(-2);
1455 owner->view()->text->CursorTop();
1456 owner->view()->text->FinishUndo();
1457 moveCursorUpdate(false);
1458 owner->getMiniBuffer()->Set(CurrentState());
1462 if(!owner->view()->text->mark_set)
1463 owner->view()->beforeChange();
1464 owner->view()->update(-2);
1465 owner->view()->text->CursorBottom();
1466 owner->view()->text->FinishUndo();
1467 moveCursorUpdate(false);
1468 owner->getMiniBuffer()->Set(CurrentState());
1472 /* cursor selection ---------------------------- */
1474 owner->view()->update(-2);
1475 if (owner->view()->text->cursor.par->getParDirection()
1476 == LYX_DIR_LEFT_TO_RIGHT)
1477 owner->view()->text->CursorRight();
1479 owner->view()->text->CursorLeft();
1480 owner->view()->text->FinishUndo();
1481 moveCursorUpdate(true);
1482 owner->getMiniBuffer()->Set(CurrentState());
1486 owner->view()->update(-2);
1487 if (owner->view()->text->cursor.par->getParDirection()
1488 == LYX_DIR_LEFT_TO_RIGHT)
1489 owner->view()->text->CursorLeft();
1491 owner->view()->text->CursorRight();
1492 owner->view()->text->FinishUndo();
1493 moveCursorUpdate(true);
1494 owner->getMiniBuffer()->Set(CurrentState());
1498 owner->view()->update(-2);
1499 owner->view()->text->CursorUp();
1500 owner->view()->text->FinishUndo();
1501 moveCursorUpdate(true);
1502 owner->getMiniBuffer()->Set(CurrentState());
1506 owner->view()->update(-2);
1507 owner->view()->text->CursorDown();
1508 owner->view()->text->FinishUndo();
1509 moveCursorUpdate(true);
1510 owner->getMiniBuffer()->Set(CurrentState());
1513 case LFUN_UP_PARAGRAPHSEL:
1514 owner->view()->update(-2);
1515 owner->view()->text->CursorUpParagraph();
1516 owner->view()->text->FinishUndo();
1517 moveCursorUpdate(true);
1518 owner->getMiniBuffer()->Set(CurrentState());
1521 case LFUN_DOWN_PARAGRAPHSEL:
1522 owner->view()->update(-2);
1523 owner->view()->text->CursorDownParagraph();
1524 owner->view()->text->FinishUndo();
1525 moveCursorUpdate(true);
1526 owner->getMiniBuffer()->Set(CurrentState());
1530 owner->view()->update(-2);
1531 owner->view()->cursorPrevious();
1532 owner->view()->text->FinishUndo();
1533 moveCursorUpdate(true);
1534 owner->getMiniBuffer()->Set(CurrentState());
1538 owner->view()->update(-2);
1539 owner->view()->cursorNext();
1540 owner->view()->text->FinishUndo();
1541 moveCursorUpdate(true);
1542 owner->getMiniBuffer()->Set(CurrentState());
1546 owner->view()->update(-2);
1547 owner->view()->text->CursorHome();
1548 owner->view()->text->FinishUndo();
1549 moveCursorUpdate(true);
1550 owner->getMiniBuffer()->Set(CurrentState());
1554 owner->view()->update(-2);
1555 owner->view()->text->CursorEnd();
1556 owner->view()->text->FinishUndo();
1557 moveCursorUpdate(true);
1558 owner->getMiniBuffer()->Set(CurrentState());
1561 case LFUN_WORDRIGHTSEL:
1562 owner->view()->update(-2);
1563 if (owner->view()->text->cursor.par->getParDirection()
1564 == LYX_DIR_LEFT_TO_RIGHT)
1565 owner->view()->text->CursorRightOneWord();
1567 owner->view()->text->CursorLeftOneWord();
1568 owner->view()->text->FinishUndo();
1569 moveCursorUpdate(true);
1570 owner->getMiniBuffer()->Set(CurrentState());
1573 case LFUN_WORDLEFTSEL:
1574 owner->view()->update(-2);
1575 if (owner->view()->text->cursor.par->getParDirection()
1576 == LYX_DIR_LEFT_TO_RIGHT)
1577 owner->view()->text->CursorLeftOneWord();
1579 owner->view()->text->CursorRightOneWord();
1580 owner->view()->text->FinishUndo();
1581 moveCursorUpdate(true);
1582 owner->getMiniBuffer()->Set(CurrentState());
1585 case LFUN_BEGINNINGBUFSEL:
1586 owner->view()->update(-2);
1587 owner->view()->text->CursorTop();
1588 owner->view()->text->FinishUndo();
1589 moveCursorUpdate(true);
1590 owner->getMiniBuffer()->Set(CurrentState());
1593 case LFUN_ENDBUFSEL:
1594 owner->view()->update(-2);
1595 owner->view()->text->CursorBottom();
1596 owner->view()->text->FinishUndo();
1597 moveCursorUpdate(true);
1598 owner->getMiniBuffer()->Set(CurrentState());
1601 // --- text changing commands ------------------------
1602 case LFUN_BREAKLINE:
1603 owner->view()->beforeChange();
1604 owner->view()->text->InsertChar(LyXParagraph::META_NEWLINE);
1605 owner->view()->smallUpdate(1);
1606 SetUpdateTimer(0.01);
1607 moveCursorUpdate(false);
1610 case LFUN_PROTECTEDSPACE:
1611 owner->view()->beforeChange();
1612 owner->view()->text->
1613 InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
1614 owner->view()->smallUpdate(1);
1616 moveCursorUpdate(false);
1620 if(owner->view()->text->mark_set) {
1621 owner->view()->beforeChange();
1622 owner->view()->update(0);
1623 setMessage(N_("Mark removed"));
1625 owner->view()->beforeChange();
1626 owner->view()->text->mark_set = 1;
1627 owner->view()->update(0);
1628 setMessage(N_("Mark set"));
1630 owner->view()->text->sel_cursor =
1631 owner->view()->text->cursor;
1636 if (!owner->view()->text->selection) {
1637 owner->view()->text->Delete();
1638 owner->view()->text->sel_cursor =
1639 owner->view()->text->cursor;
1640 owner->view()->smallUpdate(1);
1641 // It is possible to make it a lot faster still
1642 // just comment out the lone below...
1643 owner->view()->showCursor();
1645 owner->view()->cut();
1648 moveCursorUpdate(false);
1649 owner->getMiniBuffer()->Set(CurrentState());
1650 owner->view()->setState();
1653 case LFUN_DELETE_SKIP:
1655 // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
1657 LyXCursor cursor = owner->view()->text->cursor;
1660 if (!owner->view()->text->selection) {
1661 if (cursor.pos == cursor.par->Last()) {
1662 owner->view()->text->CursorRight();
1663 cursor = owner->view()->text->cursor;
1665 && !(cursor.par->added_space_top
1666 == VSpace (VSpace::NONE))) {
1667 owner->view()->text->SetParagraph
1668 (cursor.par->line_top,
1669 cursor.par->line_bottom,
1670 cursor.par->pagebreak_top,
1671 cursor.par->pagebreak_bottom,
1672 VSpace(VSpace::NONE),
1673 cursor.par->added_space_bottom,
1675 cursor.par->labelwidthstring, 0);
1676 owner->view()->text->CursorLeft();
1677 owner->view()->update (1);
1679 owner->view()->text->CursorLeft();
1680 owner->view()->text->Delete();
1681 owner->view()->text->sel_cursor =
1682 owner->view()->text->cursor;
1683 owner->view()->smallUpdate(1);
1686 owner->view()->text->Delete();
1687 owner->view()->text->sel_cursor =
1688 owner->view()->text->cursor;
1689 owner->view()->smallUpdate(1);
1692 owner->view()->cut();
1698 /* -------> Delete word forward. */
1699 case LFUN_DELETE_WORD_FORWARD:
1700 owner->view()->update(-2);
1702 owner->view()->text->DeleteWordForward();
1703 owner->view()->update( 1 );
1705 moveCursorUpdate(false);
1706 owner->getMiniBuffer()->Set(CurrentState());
1709 /* -------> Delete word backward. */
1710 case LFUN_DELETE_WORD_BACKWARD:
1711 owner->view()->update(-2);
1713 owner->view()->text->DeleteWordBackward();
1714 owner->view()->update( 1 );
1716 moveCursorUpdate(false);
1717 owner->getMiniBuffer()->Set(CurrentState());
1720 /* -------> Kill to end of line. */
1721 case LFUN_DELETE_LINE_FORWARD:
1723 owner->view()->update(-2);
1724 owner->view()->text->DeleteLineForward();
1725 owner->view()->update( 1 );
1727 moveCursorUpdate(false);
1730 /* -------> Set mark off. */
1732 owner->view()->beforeChange();
1733 owner->view()->update(0);
1734 owner->view()->text->sel_cursor =
1735 owner->view()->text->cursor;
1736 setMessage(N_("Mark off"));
1739 /* -------> Set mark on. */
1741 owner->view()->beforeChange();
1742 owner->view()->text->mark_set = 1;
1743 owner->view()->update( 0 );
1744 owner->view()->text->sel_cursor =
1745 owner->view()->text->cursor;
1746 setMessage(N_("Mark on"));
1749 case LFUN_BACKSPACE:
1752 if (!owner->view()->text->selection) {
1753 if (owner->getIntl()->getTrans()->backspace()) {
1754 owner->view()->text->Backspace();
1755 owner->view()->text->sel_cursor =
1756 owner->view()->text->cursor;
1757 owner->view()->smallUpdate(1);
1758 // It is possible to make it a lot faster still
1759 // just comment out the lone below...
1760 owner->view()->showCursor();
1763 owner->view()->cut();
1766 owner->getMiniBuffer()->Set(CurrentState());
1767 owner->view()->setState();
1771 case LFUN_BACKSPACE_SKIP:
1773 // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
1775 LyXCursor cursor = owner->view()->text->cursor;
1778 if (!owner->view()->text->selection) {
1780 && !(cursor.par->added_space_top
1781 == VSpace (VSpace::NONE))) {
1782 owner->view()->text->SetParagraph
1783 (cursor.par->line_top,
1784 cursor.par->line_bottom,
1785 cursor.par->pagebreak_top,
1786 cursor.par->pagebreak_bottom,
1787 VSpace(VSpace::NONE), cursor.par->added_space_bottom,
1789 cursor.par->labelwidthstring, 0);
1790 owner->view()->update (1);
1792 owner->view()->text->Backspace();
1793 owner->view()->text->sel_cursor
1795 owner->view()->smallUpdate (1);
1798 owner->view()->cut();
1803 case LFUN_BREAKPARAGRAPH:
1805 owner->view()->beforeChange();
1806 owner->view()->text->BreakParagraph(0);
1807 owner->view()->smallUpdate(1);
1808 SetUpdateTimer(0.01);
1809 owner->view()->text->sel_cursor =
1810 owner->view()->text->cursor;
1811 owner->view()->setState();
1812 owner->getMiniBuffer()->Set(CurrentState());
1816 case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
1818 owner->view()->beforeChange();
1819 owner->view()->text->BreakParagraph(1);
1820 owner->view()->smallUpdate(1);
1821 SetUpdateTimer(0.01);
1822 owner->view()->text->sel_cursor =
1823 owner->view()->text->cursor;
1824 owner->view()->setState();
1825 owner->getMiniBuffer()->Set(CurrentState());
1829 case LFUN_BREAKPARAGRAPH_SKIP:
1831 // When at the beginning of a paragraph, remove
1832 // indentation and add a "defskip" at the top.
1833 // Otherwise, do the same as LFUN_BREAKPARAGRAPH.
1835 LyXCursor cursor = owner->view()->text->cursor;
1837 owner->view()->beforeChange();
1838 if (cursor.pos == 0) {
1839 if (cursor.par->added_space_top == VSpace(VSpace::NONE)) {
1840 owner->view()->text->SetParagraph
1841 (cursor.par->line_top,
1842 cursor.par->line_bottom,
1843 cursor.par->pagebreak_top,
1844 cursor.par->pagebreak_bottom,
1845 VSpace(VSpace::DEFSKIP), cursor.par->added_space_bottom,
1847 cursor.par->labelwidthstring, 1);
1848 owner->view()->update(1);
1852 owner->view()->text->BreakParagraph(0);
1853 owner->view()->smallUpdate(1);
1855 SetUpdateTimer(0.01);
1856 owner->view()->text->sel_cursor = cursor;
1857 owner->view()->setState();
1858 owner->getMiniBuffer()->Set(CurrentState());
1863 owner->view()->beforeChange();
1864 owner->view()->text->InsertChar('\"'); // This " matches the single quote in the code
1865 owner->view()->smallUpdate(1);
1867 moveCursorUpdate(false);
1873 InsetCommand * new_inset;
1874 if (action == LFUN_HTMLURL)
1875 new_inset = new InsetUrl("htmlurl", "", "");
1877 new_inset = new InsetUrl("url", "", "");
1878 owner->view()->insertInset(new_inset);
1879 new_inset->Edit(owner->view(), 0, 0);
1883 // --- lyxserver commands ----------------------------
1885 case LFUN_CHARATCURSOR:
1887 LyXParagraph::size_type pos =
1888 owner->view()->text->cursor.pos;
1889 if(pos < owner->view()->text->cursor.par->size())
1890 dispatch_buffer = owner->view()->text->
1891 cursor.par->text[pos];
1893 dispatch_buffer = "EOF";
1899 tostr(owner->view()->text->cursor.x) + ' '
1900 + tostr(owner->view()->text->cursor.y);
1907 sscanf(argument.c_str(), " %d %ld", &x, &y);
1908 owner->view()->text->SetCursorFromCoordinates(x, y);
1912 case LFUN_GETLAYOUT:
1914 tostr(owner->view()->text->cursor.par->layout);
1919 LyXFont * font = &(owner->view()->text->current_font);
1920 if(font->shape() == LyXFont::ITALIC_SHAPE)
1921 dispatch_buffer = 'E';
1922 else if(font->shape() == LyXFont::SMALLCAPS_SHAPE)
1923 dispatch_buffer = 'N';
1925 dispatch_buffer = '0';
1932 LyXFont * font = &(owner->view()->text->current_font);
1933 if(font->latex() == LyXFont::ON)
1934 dispatch_buffer = 'L';
1936 dispatch_buffer = '0';
1941 setMessage(owner->buffer()->fileName());
1942 lyxerr.debug() << "FNAME["
1943 << owner->buffer()->fileName()
1951 dispatch_buffer = buf;
1952 lyxserver->notifyClient(dispatch_buffer);
1956 case LFUN_GOTOFILEROW:
1958 char file_name[100];
1960 sscanf(argument.c_str(), " %s %d", file_name, &row);
1962 // Must replace extension of the file to be .lyx and get full path
1963 string s = ChangeExtension(string(file_name), ".lyx", false);
1965 // Either change buffer or load the file
1966 if (bufferlist.exists(s))
1967 owner->view()->buffer(bufferlist.getBuffer(s));
1969 owner->view()->buffer(bufferlist.loadLyXFile(s));
1972 owner->view()->setCursorFromRow(row);
1975 owner->view()->center();
1982 int qa = lyxaction.LookupFunc(argument.c_str());
1983 setMessage(lyxaction.helpText(static_cast<kb_action>(qa)));
1987 // --- accented characters ---------------------------
1990 case LFUN_CIRCUMFLEX:
2000 case LFUN_SPECIAL_CARON:
2003 case LFUN_HUNG_UMLAUT:
2009 if (keyseq.length == -1 && keyseq.getiso() != 0)
2010 c = keyseq.getiso();
2014 owner->getIntl()->getTrans()->
2015 deadkey(c, get_accent(action).accent,
2016 owner->view()->text);
2018 // Need to reset, in case the minibuffer calls these
2023 // copied verbatim from do_accent_char
2024 owner->view()->smallUpdate(1);
2026 owner->view()->text->sel_cursor =
2027 owner->view()->text->cursor;
2031 // --- toolbar ----------------------------------
2032 case LFUN_PUSH_TOOLBAR:
2034 int nth = strToInt(argument);
2035 if (lyxerr.debugging(Debug::TOOLBAR)) {
2036 lyxerr << "LFUN_PUSH_TOOLBAR: argument = `"
2037 << argument << "'\n"
2038 << "LFUN_PUSH_TOOLBAR: nth = `"
2039 << nth << "'" << endl;
2044 setErrorMessage(N_("Push-toolbar needs argument > 0"));
2046 owner->getToolbar()->push(nth);
2051 case LFUN_ADD_TO_TOOLBAR:
2053 if (lyxerr.debugging(Debug::TOOLBAR)) {
2054 lyxerr << "LFUN_ADD_TO_TOOLBAR:"
2055 "argument = `" << argument << '\'' << endl;
2057 string tmp(argument);
2058 //lyxerr <<string("Argument: ") + argument);
2059 //lyxerr <<string("Tmp : ") + tmp);
2062 setErrorMessage(N_("Usage: toolbar-add-to <LyX command>"));
2064 owner->getToolbar()->add(argument, false);
2065 owner->getToolbar()->set();
2070 // --- insert characters ----------------------------------------
2072 // --- Mathed stuff. If we are here, there is no locked inset yet.
2077 if (!greek_kb_flag) {
2079 setMessage(N_("Math greek mode on"));
2086 case LFUN_GREEK_TOGGLE:
2088 greek_kb_flag = greek_kb_flag ? 0 : 2;
2089 if (greek_kb_flag) {
2090 setMessage(N_("Math greek keyboard on"));
2092 setMessage(N_("Math greek keyboard off"));
2097 case LFUN_MATH_DELIM:
2098 case LFUN_INSERT_MATRIX:
2100 if (owner->view()->available()) {
2102 open_new_inset(new InsetFormula(false));
2104 the_locking_inset->LocalDispatch(owner->view(),
2111 case LFUN_INSERT_MATH:
2113 math_insert_symbol(argument.c_str());
2117 case LFUN_MATH_DISPLAY:
2119 if (owner->view()->available())
2120 owner->view()->open_new_inset(new InsetFormula(true));
2124 case LFUN_MATH_MACRO:
2126 if (owner->view()->available()) {
2129 setErrorMessage(N_("Missing argument"));
2131 string s1 = token(s, ' ', 1);
2132 int na = s1.empty() ? 0: atoi(s1.c_str());
2134 open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na));
2140 case LFUN_MATH_MODE: // Open or create a math inset
2143 if (owner->view()->available())
2144 owner->view()->open_new_inset(new InsetFormula);
2145 setMessage(N_("Math editor mode"));
2149 case LFUN_MATH_NUMBER:
2150 case LFUN_MATH_LIMITS:
2152 setErrorMessage(N_("This is only allowed in math mode!"));
2156 case LFUN_INSERT_CITATION:
2158 InsetCitation * new_inset = new InsetCitation();
2160 // The note, if any, must be after the key, delimited
2161 // by a | so both key and remark can have spaces.
2162 if (!argument.empty()) {
2163 string lsarg(argument);
2164 if (contains(lsarg, "|")) {
2165 new_inset->setContents(token(lsarg, '|', 0));
2166 new_inset->setOptions(token(lsarg, '|', 1));
2168 new_inset->setContents(lsarg);
2169 owner->view()->insertInset(new_inset);
2171 owner->view()->insertInset(new_inset);
2172 new_inset->Edit(owner->view(), 0, 0);
2177 case LFUN_INSERT_BIBTEX:
2179 // ale970405+lasgoutt970425
2180 // The argument can be up to two tokens separated
2181 // by a space. The first one is the bibstyle.
2182 string lsarg(argument);
2183 string bibstyle = token(lsarg, ' ', 1);
2184 if (bibstyle.empty())
2186 InsetBibtex * new_inset
2187 = new InsetBibtex(token(lsarg, ' ', 0),
2191 owner->view()->insertInset(new_inset);
2192 if (lsarg.empty()) {
2193 new_inset->Edit(owner->view(), 0, 0);
2198 // BibTeX data bases
2199 case LFUN_BIBDB_ADD:
2201 InsetBibtex * inset =
2202 static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
2204 inset->addDatabase(argument);
2209 case LFUN_BIBDB_DEL:
2211 InsetBibtex * inset =
2212 static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
2214 inset->delDatabase(argument);
2219 case LFUN_BIBTEX_STYLE:
2221 InsetBibtex * inset =
2222 static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
2224 inset->setOptions(argument);
2229 case LFUN_INDEX_INSERT:
2230 case LFUN_INDEX_INSERT_LAST:
2232 // Can't do that at the beginning of a paragraph.
2233 if (owner->view()->text->cursor.pos - 1 < 0)
2236 InsetIndex * new_inset = new InsetIndex();
2237 if (!argument.empty()) {
2238 string lsarg(argument);
2239 new_inset->setContents(lsarg);
2240 owner->view()->insertInset(new_inset);
2243 //get the current word for an argument
2244 LyXParagraph::size_type lastpos =
2245 owner->view()->text->cursor.pos - 1;
2246 // Get the current word. note that this must be done
2247 // before inserting the inset, or the inset will
2249 string curstring(owner->view()
2250 ->text->cursor.par->GetWord(lastpos));
2252 //make the new inset and write the current word into it
2253 InsetIndex * new_inset = new InsetIndex();
2255 new_inset->setContents(curstring);
2257 //don't edit it if the call was to INSERT_LAST
2258 if(action != LFUN_INDEX_INSERT_LAST) {
2259 new_inset->Edit(owner->view(), 0, 0);
2261 //it looks blank on the screen unless
2262 //we do something. put it here.
2264 // move the cursor to the returned value of lastpos
2265 // but only for the auto-insert
2266 owner->view()->text->cursor.pos = lastpos;
2269 //put the new inset into the buffer.
2270 // there should be some way of knowing the user
2271 //cancelled & avoiding this, but i don't know how
2272 owner->view()->insertInset(new_inset);
2277 case LFUN_INDEX_PRINT:
2279 Inset * new_inset = new InsetPrintIndex(owner->buffer());
2280 owner->view()->insertInset(new_inset, "Standard", true);
2284 case LFUN_PARENTINSERT:
2286 lyxerr << "arg " << argument << endl;
2287 Inset * new_inset = new InsetParent(argument, owner->buffer());
2288 owner->view()->insertInset(new_inset, "Standard", true);
2292 case LFUN_CHILDINSERT:
2294 Inset * new_inset = new InsetInclude(argument,
2296 owner->view()->insertInset(new_inset, "Standard", true);
2297 new_inset->Edit(owner->view(), 0, 0);
2301 case LFUN_CHILDOPEN:
2304 MakeAbsPath(argument,
2305 OnlyPath(owner->buffer()->fileName()));
2306 setMessage(N_("Opening child document ") +
2307 MakeDisplayPath(filename) + "...");
2308 owner->view()->savePosition();
2309 if (bufferlist.exists(filename))
2310 owner->view()->buffer(bufferlist.getBuffer(filename));
2312 owner->view()->buffer(bufferlist.loadLyXFile(filename));
2316 case LFUN_INSERT_NOTE:
2317 owner->view()->insertNote();
2320 case LFUN_INSERTFOOTNOTE:
2322 LyXParagraph::footnote_kind kind;
2323 if (argument == "footnote")
2324 { kind = LyXParagraph::FOOTNOTE; }
2325 else if (argument == "margin")
2326 { kind = LyXParagraph::MARGIN; }
2327 else if (argument == "figure")
2328 { kind = LyXParagraph::FIG; }
2329 else if (argument == "table")
2330 { kind = LyXParagraph::TAB; }
2331 else if (argument == "wide-fig")
2332 { kind = LyXParagraph::WIDE_FIG; }
2333 else if (argument == "wide-tab")
2334 { kind = LyXParagraph::WIDE_TAB; }
2335 else if (argument == "algorithm")
2336 { kind = LyXParagraph::ALGORITHM; }
2338 setErrorMessage(N_("Unknown kind of footnote"));
2341 owner->view()->text->InsertFootnoteEnvironment(kind);
2342 owner->view()->update(1);
2343 owner->view()->setState();
2347 case LFUN_BUFFERBULLETSSELECT:
2351 case LFUN_TOGGLECURSORFOLLOW:
2352 cursor_follows_scrollbar = !cursor_follows_scrollbar;
2355 case LFUN_KMAP_OFF: // keymap off
2356 owner->getIntl()->KeyMapOn(false);
2359 case LFUN_KMAP_PRIM: // primary keymap
2360 owner->getIntl()->KeyMapPrim();
2363 case LFUN_KMAP_SEC: // secondary keymap
2364 owner->getIntl()->KeyMapSec();
2367 case LFUN_KMAP_TOGGLE: // toggle keymap
2368 owner->getIntl()->ToggleKeyMap();
2371 case LFUN_SELFINSERT:
2373 for (string::size_type i = 0; i < argument.length(); ++i) {
2374 owner->view()->text->InsertChar(argument[i]);
2375 // This needs to be in the loop, or else we
2376 // won't break lines correctly. (Asger)
2377 owner->view()->smallUpdate(1);
2380 owner->view()->text->sel_cursor =
2381 owner->view()->text->cursor;
2382 moveCursorUpdate(false);
2388 // argument contains ';'-terminated commands
2389 while (argument.find(';') != string::npos) {
2391 argument = split(argument, first, ';');
2397 case LFUN_DATE_INSERT: // jdblair: date-insert cmd
2405 now_time_t = time(NULL);
2406 now_tm = localtime(&now_time_t);
2407 (void)setlocale(LC_TIME, "");
2408 if (!argument.empty())
2410 else if (arg.empty())
2411 arg = lyxrc->date_insert_format;
2412 datetmp_len = (int) strftime(datetmp, 32, arg.c_str(), now_tm);
2413 for (int i = 0; i < datetmp_len; i++) {
2414 owner->view()->text->InsertChar(datetmp[i]);
2415 owner->view()->smallUpdate(1);
2418 owner->view()->text->sel_cursor = owner->view()->text->cursor;
2419 moveCursorUpdate(false);
2423 case LFUN_SAVEPREFERENCES:
2425 Path p(user_lyxdir);
2426 lyxrc->write("preferences");
2430 case LFUN_UNKNOWN_ACTION:
2432 if(!owner->buffer()) {
2434 setErrorMessage(N_("No document open"));
2438 if (owner->buffer()->isReadonly()) {
2440 setErrorMessage(N_("Document is read only"));
2444 if (!argument.empty()) {
2446 /* Automatically delete the currently selected
2447 * text and replace it with what is being
2448 * typed in now. Depends on lyxrc settings
2449 * "auto_region_delete", which defaults to
2452 if ( lyxrc->auto_region_delete ) {
2453 if (owner->view()->text->selection){
2454 owner->view()->text->CutSelection(false);
2455 owner->view()->update(-1);
2459 owner->view()->beforeChange();
2460 for (string::size_type i = 0;
2461 i < argument.length(); ++i) {
2462 if (greek_kb_flag) {
2463 if (!math_insert_greek(argument[i]))
2464 owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->view()->text);
2466 owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->view()->text);
2469 owner->view()->smallUpdate(1);
2472 owner->view()->text->sel_cursor =
2473 owner->view()->text->cursor;
2474 moveCursorUpdate(false);
2477 // why is an "Unknown action" with empty
2478 // argument even dispatched in the first
2479 // place? I`ll probably change that. (Lgb)
2481 setErrorMessage(N_("Unknown action"));
2485 lyxerr << "A truly unknown func!" << endl;
2491 string res = getMessage();
2494 if (!commandshortcut.empty()) {
2495 string newbuf = owner->getMiniBuffer()->GetText();
2496 if (newbuf != commandshortcut) {
2497 owner->getMiniBuffer()->Set(newbuf
2503 owner->getMiniBuffer()->Set(string(_(res.c_str()))
2504 + " " + commandshortcut);
2511 void LyXFunc::setupLocalKeymap()
2513 keyseq.stdmap = keyseq.curmap = toplevel_keymap;
2514 cancel_meta_seq.stdmap = cancel_meta_seq.curmap = toplevel_keymap;
2518 void LyXFunc::MenuNew(bool fromTemplate)
2520 string fname, initpath = lyxrc->document_path;
2523 if (owner->view()->available()) {
2524 string trypath = owner->buffer()->filepath;
2525 // If directory is writeable, use this as default.
2526 if (IsDirWriteable(trypath) == 1)
2531 fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
2532 fileDlg.SetButton(1, _("Templates"), lyxrc->template_path);
2533 fname = fileDlg.Select(_("Enter Filename for new document"),
2534 initpath, "*.lyx", _("newfile"));
2537 if (fname.empty()) {
2538 owner->getMiniBuffer()->Set(_("Canceled."));
2539 lyxerr.debug() << "New Document Cancelled." << endl;
2543 // get absolute path of file and make sure the filename ends
2545 string s = MakeAbsPath(fname);
2546 if (!IsLyXFilename(s))
2549 // Check if the document already is open
2550 if (bufferlist.exists(s)){
2551 switch(AskConfirmation(_("Document is already open:"),
2552 MakeDisplayPath(s, 50),
2553 _("Do you want to close that document now?\n"
2554 "('No' will just switch to the open version)")))
2556 case 1: // Yes: close the document
2557 if (!bufferlist.close(bufferlist.getBuffer(s)))
2558 // If close is canceled, we cancel here too.
2561 case 2: // No: switch to the open document
2562 owner->view()->buffer(bufferlist.getBuffer(s));
2564 case 3: // Cancel: Do nothing
2565 owner->getMiniBuffer()->Set(_("Canceled."));
2570 // Check whether the file already exists
2571 if (IsLyXFilename(s)) {
2573 if (fi.readable() &&
2574 AskQuestion(_("File already exists:"),
2575 MakeDisplayPath(s, 50),
2576 _("Do you want to open the document?"))) {
2578 owner->getMiniBuffer()->Set(_("Opening document"),
2579 MakeDisplayPath(s), "...");
2581 owner->view()->buffer(
2582 bufferlist.loadLyXFile(s));
2583 owner->getMiniBuffer()->Set(_("Document"),
2590 // The template stuff
2594 fname = fileDlg.Select(_("Choose template"),
2595 lyxrc->template_path,
2601 // find a free buffer
2602 lyxerr.debug() << "Find a free buffer." << endl;
2603 owner->view()->buffer(bufferlist.newFile(s, templname));
2607 void LyXFunc::MenuOpen()
2609 string initpath = lyxrc->document_path;
2612 if (owner->view()->available()) {
2613 string trypath = owner->buffer()->filepath;
2614 // If directory is writeable, use this as default.
2615 if (IsDirWriteable(trypath) == 1)
2621 fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
2622 fileDlg.SetButton(1, _("Examples"),
2623 AddPath(system_lyxdir, "examples"));
2624 string filename = fileDlg.Select(_("Select Document to Open"),
2628 // check selected filename
2629 if (filename.empty()) {
2630 owner->getMiniBuffer()->Set(_("Canceled."));
2634 // get absolute path of file and make sure the filename ends
2636 filename = MakeAbsPath(filename);
2637 if (!IsLyXFilename(filename))
2641 owner->getMiniBuffer()->Set(_("Opening document"),
2642 MakeDisplayPath(filename), "...");
2643 Buffer * openbuf = bufferlist.loadLyXFile(filename);
2645 owner->view()->buffer(openbuf);
2646 owner->getMiniBuffer()->Set(_("Document"),
2647 MakeDisplayPath(filename),
2650 owner->getMiniBuffer()->Set(_("Could not open document"),
2651 MakeDisplayPath(filename));
2656 void LyXFunc::doImportASCII(bool linorpar)
2658 string initpath = lyxrc->document_path;
2661 if (owner->view()->available()) {
2662 string trypath = owner->buffer()->filepath;
2663 // If directory is writeable, use this as default.
2664 if (IsDirWriteable(trypath) == 1)
2670 fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
2671 fileDlg.SetButton(1, _("Examples"),
2672 AddPath(system_lyxdir, "examples"));
2673 string filename = fileDlg.Select(_("Select ASCII file to Import"),
2677 // check selected filename
2678 if (filename.empty()) {
2679 owner->getMiniBuffer()->Set(_("Canceled."));
2683 // get absolute path of file
2684 filename = MakeAbsPath(filename);
2686 string s = ChangeExtension(filename, ".lyx", false);
2688 // Check if the document already is open
2689 if (bufferlist.exists(s)) {
2690 switch(AskConfirmation(_("Document is already open:"),
2691 MakeDisplayPath(s, 50),
2692 _("Do you want to close that document now?\n"
2693 "('No' will just switch to the open version)")))
2695 case 1: // Yes: close the document
2696 if (!bufferlist.close(bufferlist.getBuffer(s)))
2697 // If close is canceled, we cancel here too.
2700 case 2: // No: switch to the open document
2701 owner->view()->buffer(bufferlist.getBuffer(s));
2703 case 3: // Cancel: Do nothing
2704 owner->getMiniBuffer()->Set(_("Canceled."));
2709 // Check if a LyX document by the same root exists in filesystem
2710 FileInfo f(s, true);
2711 if (f.exist() && !AskQuestion(_("A document by the name"),
2713 _("already exists. Overwrite?"))) {
2714 owner->getMiniBuffer()->Set(_("Canceled."));
2718 owner->view()->buffer(bufferlist.newFile(s, string()));
2719 owner->getMiniBuffer()->Set(_("Importing ASCII file"),
2720 MakeDisplayPath(filename), "...");
2721 // Insert ASCII file
2722 InsertAsciiFile(filename, linorpar);
2723 owner->getMiniBuffer()->Set(_("ASCII file "),
2724 MakeDisplayPath(filename),
2729 void LyXFunc::doImportLaTeX(bool isnoweb)
2731 string initpath = lyxrc->document_path;
2734 if (owner->view()->available()) {
2735 string trypath = owner->buffer()->filepath;
2736 // If directory is writeable, use this as default.
2737 if (IsDirWriteable(trypath) == 1)
2743 fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
2744 fileDlg.SetButton(1, _("Examples"),
2745 AddPath(system_lyxdir, "examples"));
2748 filename = fileDlg.Select(_("Select Noweb file to Import"),
2751 filename = fileDlg.Select(_("Select LaTeX file to Import"),
2757 // check selected filename
2758 if (filename.empty()) {
2759 owner->getMiniBuffer()->Set(_("Canceled."));
2763 // get absolute path of file
2764 filename = MakeAbsPath(filename);
2766 // Check if the document already is open
2767 string LyXfilename = ChangeExtension(filename, ".lyx", false);
2768 if (bufferlist.exists(LyXfilename)){
2769 switch(AskConfirmation(_("Document is already open:"),
2770 MakeDisplayPath(LyXfilename, 50),
2771 _("Do you want to close that document now?\n"
2772 "('No' will just switch to the open version)")))
2774 case 1: // Yes: close the document
2775 if (!bufferlist.close(bufferlist.getBuffer(LyXfilename)))
2776 // If close is canceled, we cancel here too.
2779 case 2: // No: switch to the open document
2780 owner->view()->buffer(
2781 bufferlist.getBuffer(LyXfilename));
2783 case 3: // Cancel: Do nothing
2784 owner->getMiniBuffer()->Set(_("Canceled."));
2789 // Check if a LyX document by the same root exists in filesystem
2790 FileInfo f(LyXfilename, true);
2791 if (f.exist() && !AskQuestion(_("A document by the name"),
2792 MakeDisplayPath(LyXfilename),
2793 _("already exists. Overwrite?"))) {
2794 owner->getMiniBuffer()->Set(_("Canceled."));
2801 owner->getMiniBuffer()->Set(_("Importing LaTeX file"),
2802 MakeDisplayPath(filename), "...");
2803 ImportLaTeX myImport(filename);
2804 openbuf = myImport.run();
2806 owner->getMiniBuffer()->Set(_("Importing Noweb file"),
2807 MakeDisplayPath(filename), "...");
2808 ImportNoweb myImport(filename);
2809 openbuf = myImport.run();
2812 owner->view()->buffer(openbuf);
2813 owner->getMiniBuffer()->Set(isnoweb ?
2814 _("Noweb file ") : _("LateX file "),
2815 MakeDisplayPath(filename),
2818 owner->getMiniBuffer()->Set(isnoweb ?
2819 _("Could not import Noweb file") :
2820 _("Could not import LaTeX file"),
2821 MakeDisplayPath(filename));
2826 void LyXFunc::MenuInsertLyXFile(string const & filen)
2828 string filename = filen;
2830 if (filename.empty()) {
2831 // Launch a file browser
2832 string initpath = lyxrc->document_path;
2835 if (owner->view()->available()) {
2836 string trypath = owner->buffer()->filepath;
2837 // If directory is writeable, use this as default.
2838 if (IsDirWriteable(trypath) == 1)
2844 fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
2845 fileDlg.SetButton(1, _("Examples"),
2846 AddPath(system_lyxdir, "examples"));
2847 filename = fileDlg.Select(_("Select Document to Insert"),
2851 // check selected filename
2852 if (filename.empty()) {
2853 owner->getMiniBuffer()->Set(_("Canceled."));
2858 // get absolute path of file and make sure the filename ends
2860 filename = MakeAbsPath(filename);
2861 if (!IsLyXFilename(filename))
2865 owner->getMiniBuffer()->Set(_("Inserting document"),
2866 MakeDisplayPath(filename), "...");
2867 bool res = owner->view()->insertLyXFile(filename);
2869 owner->getMiniBuffer()->Set(_("Document"),
2870 MakeDisplayPath(filename),
2873 owner->getMiniBuffer()->Set(_("Could not insert document"),
2874 MakeDisplayPath(filename));
2879 void LyXFunc::reloadBuffer()
2881 string fn = owner->buffer()->fileName();
2882 if (bufferlist.close(owner->buffer()))
2883 owner->view()->buffer(bufferlist.loadLyXFile(fn));
2887 void LyXFunc::CloseBuffer()
2889 if (bufferlist.close(owner->buffer()) && !quitting) {
2890 if (bufferlist.empty()) {
2891 // need this otherwise SEGV may occur while trying to
2892 // set variables that don't exist
2893 // since there's no current buffer
2894 CloseAllBufferRelatedPopups();
2897 owner->view()->buffer(bufferlist.first());
2903 Inset * LyXFunc::getInsetByCode(Inset::Code code)
2907 LyXCursor cursor = owner->view()->text->cursor;
2908 LyXParagraph::size_type pos = cursor.pos;
2909 LyXParagraph * par = cursor.par;
2911 while (par && !found) {
2912 while ((inset = par->ReturnNextInsetPointer(pos))){
2913 if (inset->LyxCode() == code) {
2921 return found ? inset : 0;
2925 // Each "owner" should have it's own message method. lyxview and
2926 // the minibuffer would use the minibuffer, but lyxserver would
2927 // send an ERROR signal to its client. Alejandro 970603
2928 // This func is bit problematic when it comes to NLS, to make the
2929 // lyx servers client be language indepenent we must not translate
2930 // strings sent to this func.
2931 void LyXFunc::setErrorMessage(string const & m) const
2933 dispatch_buffer = m;
2938 void LyXFunc::setMessage(string const & m)
2940 dispatch_buffer = m;