3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alfredo Braunstein
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
9 * \author Angus Leeming
11 * \author André Pönitz
14 * \author Martin Vermeer
15 * \author Jürgen Vigna
17 * Full author contact details are available in file CREDITS.
25 #include "buffer_funcs.h"
26 #include "bufferlist.h"
27 #include "BufferView.h"
32 #include "funcrequest.h"
36 #include "iterators.h"
39 #include "LyXAction.h"
42 #include "lyxserver.h"
43 #include "paragraph.h"
44 #include "ParagraphParameters.h"
45 #include "TextCache.h"
46 #include "undo_funcs.h"
48 #include "insets/insetcommand.h"
49 #include "insets/insetexternal.h"
50 #include "insets/insettabular.h"
52 #include "mathed/math_cursor.h"
54 #include "frontends/Alert.h"
55 #include "frontends/Dialogs.h"
56 #include "frontends/FileDialog.h"
57 #include "frontends/lyx_gui.h"
58 #include "frontends/LyXView.h"
59 #include "frontends/Menubar.h"
60 #include "frontends/Toolbar.h"
62 #include "support/FileInfo.h"
63 #include "support/filetools.h"
64 #include "support/forkedcontr.h"
65 #include "support/LAssert.h"
66 #include "support/path.h"
67 #include "support/path_defines.h"
68 #include "support/tostr.h"
70 #include "support/std_sstream.h"
72 using namespace lyx::support;
78 using std::istringstream;
81 using std::back_inserter;
82 using namespace bv_funcs;
84 extern BufferList bufferlist;
85 extern LyXServer * lyxserver;
86 extern bool selection_possible;
88 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
91 extern tex_accent_struct get_accent(kb_action action);
93 extern void ShowLatexLog();
96 LyXFunc::LyXFunc(LyXView * o)
99 keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
100 cancel_meta_seq(toplevel_keymap.get(), toplevel_keymap.get()),
101 meta_fake_bit(key_modifier::none)
106 void LyXFunc::moveCursorUpdate()
108 LyXText * lt = view()->text;
109 if (lt->selection.mark())
112 view()->switchKeyMap();
116 void LyXFunc::handleKeyFunc(kb_action action)
118 char c = encoded_last_key;
120 if (keyseq.length()) {
124 owner->getIntl().getTransManager()
125 .deadkey(c, get_accent(action).accent, view()->getLyXText());
126 // Need to clear, in case the minibuffer calls these
129 // copied verbatim from do_accent_char
131 view()->getLyXText()->selection.cursor = view()->getLyXText()->cursor;
135 void LyXFunc::processKeySym(LyXKeySymPtr keysym,
136 key_modifier::state state)
140 if (lyxerr.debugging(Debug::KEY)) {
141 lyxerr << "KeySym is "
142 << keysym->getSymbolName()
146 // Do nothing if we have nothing (JMarc)
147 if (!keysym->isOK()) {
148 lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
153 if (keysym->isModifier()) {
154 lyxerr[Debug::KEY] << "isModifier true" << endl;
158 Encoding const * encoding = view()->getEncoding();
160 encoded_last_key = keysym->getISOEncoded(encoding ? encoding->Name() : "");
162 // Do a one-deep top-level lookup for
163 // cancel and meta-fake keys. RVDK_PATCH_5
164 cancel_meta_seq.reset();
166 int action = cancel_meta_seq.addkey(keysym, state);
167 lyxerr[Debug::KEY] << "action first set to [" << action << ']' << endl;
169 // When not cancel or meta-fake, do the normal lookup.
170 // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
171 // Mostly, meta_fake_bit = key_modifier::none. RVDK_PATCH_5.
172 if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) {
173 // remove Caps Lock and Mod2 as a modifiers
174 action = keyseq.addkey(keysym, (state | meta_fake_bit));
175 lyxerr[Debug::KEY] << "action now set to ["
176 << action << ']' << endl;
179 // Dont remove this unless you know what you are doing.
180 meta_fake_bit = key_modifier::none;
182 // can this happen now ?
183 if (action == LFUN_NOACTION) {
184 action = LFUN_PREFIX;
187 if (lyxerr.debugging(Debug::KEY)) {
188 lyxerr << "Key [action="
190 << keyseq.print() << ']'
194 // already here we know if it any point in going further
195 // why not return already here if action == -1 and
196 // num_bytes == 0? (Lgb)
198 if (keyseq.length() > 1) {
199 owner->message(keyseq.print());
203 // Maybe user can only reach the key via holding down shift.
204 // Let's see. But only if shift is the only modifier
205 if (action == LFUN_UNKNOWN_ACTION && state == key_modifier::shift) {
206 lyxerr[Debug::KEY] << "Trying without shift" << endl;
207 action = keyseq.addkey(keysym, key_modifier::none);
208 lyxerr[Debug::KEY] << "Action now " << action << endl;
211 if (action == LFUN_UNKNOWN_ACTION) {
212 // Hmm, we didn't match any of the keysequences. See
213 // if it's normal insertable text not already covered
215 if (keysym->isText() && keyseq.length() == 1) {
216 lyxerr[Debug::KEY] << "isText() is true, inserting." << endl;
217 action = LFUN_SELFINSERT;
219 lyxerr[Debug::KEY] << "Unknown, !isText() - giving up" << endl;
220 owner->message(_("Unknown function."));
225 if (action == LFUN_SELFINSERT) {
226 if (encoded_last_key != 0) {
228 arg += encoded_last_key;
230 dispatch(FuncRequest(view(), LFUN_SELFINSERT, arg));
232 lyxerr[Debug::KEY] << "SelfInsert arg[`"
233 << argument << "']" << endl;
241 FuncStatus LyXFunc::getStatus(int ac) const
243 return getStatus(lyxaction.retrieveActionArg(ac));
247 FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
250 Buffer * buf = owner->buffer();
252 if (ev.action == LFUN_NOACTION) {
253 setStatusMessage(N_("Nothing to do"));
254 return flag.disabled(true);
258 case LFUN_UNKNOWN_ACTION:
259 #ifndef HAVE_LIBAIKSAURUS
260 case LFUN_THESAURUS_ENTRY:
265 flag |= lyx_gui::getStatus(ev);
268 if (flag.unknown()) {
269 setStatusMessage(N_("Unknown action"));
273 // the default error message if we disable the command
274 setStatusMessage(N_("Command disabled"));
276 // Check whether we need a buffer
277 if (!lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)) {
278 // Yes we need a buffer, do we have one?
281 // Can we use a readonly buffer?
282 if (buf->isReadonly() &&
283 !lyxaction.funcHasFlag(ev.action,
284 LyXAction::ReadOnly)) {
286 setStatusMessage(N_("Document is read-only"));
291 setStatusMessage(N_("Command not allowed with"
292 "out any document open"));
293 return flag.disabled(true);
297 UpdatableInset * tli = view()->theLockingInset();
299 // I would really like to avoid having this switch and rather try to
300 // encode this in the function itself.
301 bool disable = false;
304 disable = ev.argument != "custom"
305 && !Exporter::IsExportable(*buf, ev.argument);
308 disable = buf->undostack.empty();
311 disable = buf->redostack.empty();
316 UpdatableInset * in = tli;
317 if (in->lyxCode() != InsetOld::TABULAR_CODE) {
318 in = tli->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE);
320 if (in && static_cast<InsetTabular*>(in)->hasSelection()) {
325 disable = !mathcursor && !view()->getLyXText()->selection.set();
328 disable = !buf->isLatex() || lyxrc.chktex_command == "none";
331 disable = !Exporter::IsExportable(*buf, "program");
334 case LFUN_LAYOUT_TABULAR:
336 || (tli->lyxCode() != InsetOld::TABULAR_CODE
337 && !tli->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE));
341 disable = !changeDepth(view(), view()->getLyXText(), DEC_DEPTH, true);
344 case LFUN_DEPTH_PLUS:
345 disable = !changeDepth(view(), view()->getLyXText(), INC_DEPTH, true);
349 case LFUN_LAYOUT_PARAGRAPH: {
350 InsetOld * inset = view()->getLyXText()->cursor.par()->inInset();
351 disable = inset && inset->forceDefaultParagraphs(inset);
355 case LFUN_INSET_OPTARG:
356 disable = (view()->getLyXText()->cursor.par()->layout()->optionalargs == 0);
359 case LFUN_TABULAR_FEATURE:
362 // FIXME: check temporarily disabled
364 char align = mathcursor->valign();
369 if (ev.argument.empty()) {
373 if (!contains("tcb", ev.argument[0])) {
377 flag.setOnOff(ev.argument[0] == align);
381 char align = mathcursor->halign();
386 if (ev.argument.empty()) {
390 if (!contains("lcr", ev.argument[0])) {
394 flag.setOnOff(ev.argument[0] == align);
397 disable = !mathcursor->halign();
403 //ret.disabled(true);
404 if (tli->lyxCode() == InsetOld::TABULAR_CODE) {
405 ret = static_cast<InsetTabular *>(tli)
406 ->getStatus(ev.argument);
409 } else if (tli->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE)) {
410 ret = static_cast<InsetTabular *>
411 (tli->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE))
412 ->getStatus(ev.argument);
419 static InsetTabular inset(*owner->buffer(), 1, 1);
423 ret = inset.getStatus(ev.argument);
424 if (ret.onoff(true) || ret.onoff(false))
425 flag.setOnOff(false);
429 case LFUN_VC_REGISTER:
430 disable = buf->lyxvc.inUse();
432 case LFUN_VC_CHECKIN:
433 disable = !buf->lyxvc.inUse() || buf->isReadonly();
435 case LFUN_VC_CHECKOUT:
436 disable = !buf->lyxvc.inUse() || !buf->isReadonly();
440 disable = !buf->lyxvc.inUse();
442 case LFUN_MENURELOAD:
443 disable = buf->isUnnamed() || buf->isClean();
445 case LFUN_BOOKMARK_GOTO:
447 isSavedPosition(strToUnsignedInt(ev.argument));
449 case LFUN_MERGE_CHANGES:
450 case LFUN_ACCEPT_CHANGE:
451 case LFUN_REJECT_CHANGE:
452 case LFUN_ACCEPT_ALL_CHANGES:
453 case LFUN_REJECT_ALL_CHANGES:
454 disable = !buf->params.tracking_changes;
456 case LFUN_INSET_TOGGLE: {
457 LyXText * lt = view()->getLyXText();
458 disable = !(isEditableInset(lt->getInset())
460 && lt->inset_owner->owner()
461 && lt->inset_owner->owner()->isOpen()));
465 case LFUN_INSET_SETTINGS: {
467 UpdatableInset * inset = view()->theLockingInset();
472 // get the innermost inset
473 inset = inset->getLockingInset();
475 // jump back to owner if an InsetText, so
476 // we get back to the InsetTabular or whatever
477 if (inset->lyxCode() == InsetOld::TEXT_CODE)
478 inset = inset->owner();
480 InsetOld::Code code = inset->lyxCode();
482 case InsetOld::TABULAR_CODE:
483 disable = ev.argument != "tabular";
485 case InsetOld::ERT_CODE:
486 disable = ev.argument != "ert";
488 case InsetOld::FLOAT_CODE:
489 disable = ev.argument != "float";
491 case InsetOld::MINIPAGE_CODE:
492 disable = ev.argument != "minipage";
494 case InsetOld::WRAP_CODE:
495 disable = ev.argument != "wrap";
497 case InsetOld::NOTE_CODE:
498 disable = ev.argument != "note";
500 case InsetOld::BRANCH_CODE:
501 disable = ev.argument != "branch";
509 case LFUN_MATH_MUTATE:
511 //flag.setOnOff(mathcursor->formula()->hullType() == ev.argument);
512 flag.setOnOff(false);
517 // we just need to be in math mode to enable that
519 case LFUN_MATH_SPACE:
520 case LFUN_MATH_LIMITS:
521 case LFUN_MATH_NONUMBER:
522 case LFUN_MATH_NUMBER:
523 case LFUN_MATH_EXTERN:
524 disable = !mathcursor;
527 case LFUN_DIALOG_SHOW: {
528 string const name = ev.getArg(0);
530 disable = !(name == "aboutlyx" ||
533 name == "preferences" ||
538 if (name == "print") {
539 disable = !Exporter::IsExportable(*buf, "dvi") ||
540 lyxrc.print_command == "none";
541 } else if (name == "character") {
542 UpdatableInset * tli = view()->theLockingInset();
543 disable = tli && tli->lyxCode() == InsetOld::ERT_CODE;
544 } else if (name == "vclog") {
545 disable = !buf->lyxvc.inUse();
546 } else if (name == "latexlog") {
547 disable = !IsFileReadable(buf->getLogName().second);
556 // the functions which insert insets
557 InsetOld::Code code = InsetOld::NO_CODE;
559 case LFUN_DIALOG_SHOW_NEW_INSET:
560 if (ev.argument == "bibitem")
561 code = InsetOld::BIBITEM_CODE;
562 else if (ev.argument == "bibtex")
563 code = InsetOld::BIBTEX_CODE;
564 else if (ev.argument == "citation")
565 code = InsetOld::CITE_CODE;
566 else if (ev.argument == "ert")
567 code = InsetOld::ERT_CODE;
568 else if (ev.argument == "external")
569 code = InsetOld::EXTERNAL_CODE;
570 else if (ev.argument == "float")
571 code = InsetOld::FLOAT_CODE;
572 else if (ev.argument == "graphics")
573 code = InsetOld::GRAPHICS_CODE;
574 else if (ev.argument == "include")
575 code = InsetOld::INCLUDE_CODE;
576 else if (ev.argument == "index")
577 code = InsetOld::INDEX_CODE;
578 else if (ev.argument == "label")
579 code = InsetOld::LABEL_CODE;
580 else if (ev.argument == "minipage")
581 code = InsetOld::MINIPAGE_CODE;
582 else if (ev.argument == "ref")
583 code = InsetOld::REF_CODE;
584 else if (ev.argument == "toc")
585 code = InsetOld::TOC_CODE;
586 else if (ev.argument == "url")
587 code = InsetOld::URL_CODE;
588 else if (ev.argument == "wrap")
589 code = InsetOld::WRAP_CODE;
593 code = InsetOld::ERT_CODE;
595 case LFUN_INSET_FOOTNOTE:
596 code = InsetOld::FOOT_CODE;
598 case LFUN_TABULAR_INSERT:
599 code = InsetOld::TABULAR_CODE;
601 case LFUN_INSET_MARGINAL:
602 code = InsetOld::MARGIN_CODE;
604 case LFUN_INSET_MINIPAGE:
605 code = InsetOld::MINIPAGE_CODE;
607 case LFUN_INSET_FLOAT:
608 case LFUN_INSET_WIDE_FLOAT:
609 code = InsetOld::FLOAT_CODE;
611 case LFUN_INSET_WRAP:
612 code = InsetOld::WRAP_CODE;
614 case LFUN_FLOAT_LIST:
615 code = InsetOld::FLOAT_LIST_CODE;
618 case LFUN_INSET_LIST:
619 code = InsetOld::LIST_CODE;
621 case LFUN_INSET_THEOREM:
622 code = InsetOld::THEOREM_CODE;
625 case LFUN_INSET_CAPTION:
626 code = InsetOld::CAPTION_CODE;
628 case LFUN_INSERT_NOTE:
629 code = InsetOld::NOTE_CODE;
631 case LFUN_INSERT_BRANCH:
632 code = InsetOld::BRANCH_CODE;
633 if (buf->params.branchlist.empty())
636 case LFUN_INSERT_LABEL:
637 code = InsetOld::LABEL_CODE;
639 case LFUN_INSET_OPTARG:
640 code = InsetOld::OPTARG_CODE;
642 case LFUN_ENVIRONMENT_INSERT:
643 code = InsetOld::MINIPAGE_CODE;
645 case LFUN_INDEX_INSERT:
646 code = InsetOld::INDEX_CODE;
648 case LFUN_INDEX_PRINT:
649 code = InsetOld::INDEX_PRINT_CODE;
651 case LFUN_TOC_INSERT:
652 code = InsetOld::TOC_CODE;
656 code = InsetOld::URL_CODE;
659 // always allow this, since we will inset a raw quote
660 // if an inset is not allowed.
662 case LFUN_HYPHENATION:
663 case LFUN_LIGATURE_BREAK:
665 case LFUN_MENU_SEPARATOR:
667 case LFUN_END_OF_SENTENCE:
668 code = InsetOld::SPECIALCHAR_CODE;
670 case LFUN_SPACE_INSERT:
671 // slight hack: we know this is allowed in math mode
673 code = InsetOld::SPACE_CODE;
675 case LFUN_INSET_DIALOG_SHOW: {
676 LyXText * lt = view()->getLyXText();
677 InsetOld * inset = lt->getInset();
680 code = inset->lyxCode();
681 if (!(code == InsetOld::INCLUDE_CODE
682 || code == InsetOld::BIBTEX_CODE
683 || code == InsetOld::FLOAT_LIST_CODE
684 || code == InsetOld::TOC_CODE))
692 if (code != InsetOld::NO_CODE && tli && !tli->insetAllowed(code))
698 // A few general toggles
700 case LFUN_TOOLTIPS_TOGGLE:
701 flag.setOnOff(owner->getDialogs().tooltipsEnabled());
704 case LFUN_READ_ONLY_TOGGLE:
705 flag.setOnOff(buf->isReadonly());
708 flag.setOnOff(view()->getLyXText()->cursor.par()->params().startOfAppendix());
710 case LFUN_SWITCHBUFFER:
711 // toggle on the current buffer, but do not toggle off
712 // the other ones (is that a good idea?)
713 if (ev.argument == buf->fileName())
716 case LFUN_TRACK_CHANGES:
717 flag.setOnOff(buf->params.tracking_changes);
723 // the font related toggles
725 LyXFont const & font = view()->getLyXText()->real_current_font;
728 flag.setOnOff(font.emph() == LyXFont::ON);
731 flag.setOnOff(font.noun() == LyXFont::ON);
734 flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
737 flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
740 flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
743 flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
749 string tc = mathcursor->getLastCode();
752 flag.setOnOff(tc == "mathbf");
755 flag.setOnOff(tc == "mathsf");
758 flag.setOnOff(tc == "mathcal");
761 flag.setOnOff(tc == "mathrm");
764 flag.setOnOff(tc == "mathtt");
767 flag.setOnOff(tc == "mathbb");
770 flag.setOnOff(tc == "mathnormal");
777 // this one is difficult to get right. As a half-baked
778 // solution, we consider only the first action of the sequence
779 if (ev.action == LFUN_SEQUENCE) {
780 // argument contains ';'-terminated commands
781 flag = getStatus(lyxaction.LookupFunc(token(ev.argument, ';', 0)));
788 void LyXFunc::dispatch(string const & s, bool verbose)
790 int const action = lyxaction.LookupFunc(s);
792 if (action == LFUN_UNKNOWN_ACTION) {
793 owner->message(bformat(_("Unknown function (%1$s)"), s));
797 dispatch(action, verbose);
801 void LyXFunc::dispatch(int ac, bool verbose)
803 dispatch(lyxaction.retrieveActionArg(ac), verbose);
807 bool ensureBufferClean(BufferView * bv) {
809 Buffer & buf = *bv->buffer();
813 string const file = MakeDisplayPath(buf.fileName(), 30);
814 string text = bformat(_("The document %1$s has unsaved "
815 "changes.\n\nDo you want to save "
816 "the document?"), file);
817 int const ret = Alert::prompt(_("Save changed document?"),
818 text, 0, 1, _("&Save"),
822 bv->owner()->dispatch(FuncRequest(LFUN_MENUWRITE));
824 return buf.isClean();
830 void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
832 lyxerr[Debug::ACTION] << "LyXFunc::dispatch: action[" << ev.action
833 <<"] arg[" << ev.argument << ']' << endl;
835 // we have not done anything wrong yet.
837 dispatch_buffer.erase();
839 #ifdef NEW_DISPATCHER
840 // We try do call the most specific dispatcher first:
841 // 1. the lockinginset's dispatch
842 // 2. the bufferview's dispatch
843 // 3. the lyxview's dispatch
846 selection_possible = false;
848 string argument = ev.argument;
849 kb_action action = ev.action;
851 // We cannot use this function here
852 if (getStatus(ev).disabled()) {
853 lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
854 << lyxaction.getActionName(action)
855 << " [" << action << "] is disabled at this location"
857 setErrorMessage(getStatusMessage());
858 goto exit_with_message;
861 if (view()->available())
862 view()->hideCursor();
864 if (view()->available() && view()->theLockingInset()) {
865 InsetOld::RESULT result;
866 if (action > 1 || (action == LFUN_UNKNOWN_ACTION &&
869 UpdatableInset * inset = view()->theLockingInset();
873 inset->getCursorPos(view(), inset_x, dummy_y);
875 if ((action == LFUN_UNKNOWN_ACTION)
876 && argument.empty()) {
877 argument = encoded_last_key;
880 // the insets can't try to handle this,
881 // a table cell in the dummy position will
882 // lock its insettext, the insettext will
883 // pass it the bufferview, and succeed,
884 // so it will stay not locked. Not good
885 // if we've just done LFUN_ESCAPE (which
886 // injects an LFUN_PARAGRAPH_UPDATE)
887 if (action == LFUN_PARAGRAPH_UPDATE) {
888 view()->dispatch(ev);
889 goto exit_with_message;
892 // Undo/Redo is a bit tricky for insets.
893 if (action == LFUN_UNDO) {
895 goto exit_with_message;
896 } else if (action == LFUN_REDO) {
898 goto exit_with_message;
899 } else if (((result=inset->
900 // Hand-over to inset's own dispatch:
901 localDispatch(FuncRequest(view(), action, argument))) ==
903 (result == DISPATCHED_NOUPDATE))
904 goto exit_with_message;
905 // If UNDISPATCHED, just soldier on
906 else if (result == FINISHED) {
907 owner->clearMessage();
908 goto exit_with_message;
909 // We do not need special RTL handling here:
910 // FINISHED means that the cursor should be
911 // one position after the inset.
912 } else if (result == FINISHED_RIGHT) {
913 view()->text->cursorRight(view());
915 owner->clearMessage();
916 goto exit_with_message;
917 } else if (result == FINISHED_UP) {
918 RowList::iterator const irow = view()->text->cursorIRow();
919 if (irow != view()->text->firstRow()) {
921 view()->text->setCursorFromCoordinates(
922 view()->text->cursor.x() + inset_x,
923 view()->text->cursor.y() -
924 irow->baseline() - 1);
925 view()->text->cursor.x_fix(view()->text->cursor.x());
927 view()->text->cursorUp(view());
933 owner->clearMessage();
934 goto exit_with_message;
935 } else if (result == FINISHED_DOWN) {
936 RowList::iterator const irow = view()->text->cursorIRow();
937 if (irow != view()->text->lastRow()) {
939 view()->text->setCursorFromCoordinates(
940 view()->text->cursor.x() + inset_x,
941 view()->text->cursor.y() -
944 view()->text->cursor.x_fix(view()->text->cursor.x());
946 view()->text->cursorDown(view());
949 view()->text->cursorRight(view());
952 owner->clearMessage();
953 goto exit_with_message;
955 #warning I am not sure this is still right, please have a look! (Jug 20020417)
956 else { // result == UNDISPATCHED
957 //setMessage(N_("Text mode"));
959 case LFUN_UNKNOWN_ACTION:
960 case LFUN_BREAKPARAGRAPH:
962 view()->text->cursorRight(view());
963 view()->switchKeyMap();
964 owner->view_state_changed();
967 if (!view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
968 view()->text->cursorRight(view());
970 owner->view_state_changed();
972 goto exit_with_message;
974 if (view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
975 view()->text->cursorRight(view());
977 owner->view_state_changed();
979 goto exit_with_message;
981 if (view()->text->cursorRow() != view()->text->lastRow())
982 view()->text->cursorDown(view());
984 view()->text->cursorRight(view());
986 owner->view_state_changed();
987 goto exit_with_message;
998 if (!view()->available())
1000 // this function should be used always [asierra060396]
1001 UpdatableInset * tli = view()->theLockingInset();
1003 UpdatableInset * lock = tli->getLockingInset();
1006 view()->unlockInset(tli);
1007 view()->text->cursorRight(view());
1009 owner->view_state_changed();
1011 tli->unlockInsetInInset(view(), lock, true);
1014 // Tell the paragraph dialog that we changed paragraph
1015 dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
1020 case LFUN_WORDFINDFORWARD:
1021 case LFUN_WORDFINDBACKWARD: {
1022 static string last_search;
1023 string searched_string;
1025 if (!argument.empty()) {
1026 last_search = argument;
1027 searched_string = argument;
1029 searched_string = last_search;
1031 bool fw = (action == LFUN_WORDFINDFORWARD);
1032 if (!searched_string.empty())
1033 lyx::find::find(view(), searched_string, fw);
1038 if (view()->available() && !view()->theLockingInset())
1040 owner->message(keyseq.printOptions());
1043 // --- Misc -------------------------------------------
1044 case LFUN_EXEC_COMMAND:
1045 owner->focus_command_buffer();
1050 meta_fake_bit = key_modifier::none;
1051 if (view()->available())
1052 // cancel any selection
1053 dispatch(LFUN_MARK_OFF);
1054 setMessage(N_("Cancel"));
1057 case LFUN_META_FAKE:
1058 meta_fake_bit = key_modifier::alt;
1059 setMessage(keyseq.print());
1062 case LFUN_READ_ONLY_TOGGLE:
1063 if (owner->buffer()->lyxvc.inUse())
1064 owner->buffer()->lyxvc.toggleReadOnly();
1066 owner->buffer()->setReadonly(
1067 !owner->buffer()->isReadonly());
1070 case LFUN_CENTER: // this is center and redraw.
1074 // --- Menus -----------------------------------------------
1076 menuNew(argument, false);
1079 case LFUN_MENUNEWTMPLT:
1080 menuNew(argument, true);
1083 case LFUN_CLOSEBUFFER:
1087 case LFUN_MENUWRITE:
1088 if (!owner->buffer()->isUnnamed()) {
1089 string const str = bformat(_("Saving document %1$s..."),
1090 MakeDisplayPath(owner->buffer()->fileName()));
1091 owner->message(str);
1092 MenuWrite(owner->buffer());
1093 owner->message(str + _(" done."));
1095 WriteAs(owner->buffer());
1099 WriteAs(owner->buffer(), argument);
1102 case LFUN_MENURELOAD: {
1103 string const file = MakeDisplayPath(view()->buffer()->fileName(), 20);
1104 string text = bformat(_("Any changes will be lost. Are you sure "
1105 "you want to revert to the saved version of the document %1$s?"), file);
1106 int const ret = Alert::prompt(_("Revert to saved document?"),
1107 text, 0, 1, _("&Revert"), _("&Cancel"));
1115 Exporter::Export(owner->buffer(), argument, true);
1116 view()->showErrorList(BufferFormat(*owner->buffer()));
1120 Exporter::Preview(owner->buffer(), argument);
1121 view()->showErrorList(BufferFormat(*owner->buffer()));
1124 case LFUN_BUILDPROG:
1125 Exporter::Export(owner->buffer(), "program", true);
1126 view()->showErrorList(_("Build"));
1129 case LFUN_RUNCHKTEX:
1130 owner->buffer()->runChktex();
1131 view()->showErrorList(_("ChkTeX"));
1135 if (argument == "custom")
1136 owner->getDialogs().showSendto();
1138 Exporter::Export(owner->buffer(), argument, false);
1139 view()->showErrorList(BufferFormat(*owner->buffer()));
1153 InsetCommandParams p("tableofcontents");
1154 string const data = InsetCommandMailer::params2string("toc", p);
1155 owner->getDialogs().show("toc", data, 0);
1171 case LFUN_DEPTH_MIN:
1172 changeDepth(view(), view()->getLyXText(), DEC_DEPTH, false);
1173 owner->view_state_changed();
1176 case LFUN_DEPTH_PLUS:
1177 changeDepth(view(), view()->getLyXText(), INC_DEPTH, false);
1178 owner->view_state_changed();
1181 case LFUN_FREEFONT_APPLY:
1182 apply_freefont(view());
1185 case LFUN_FREEFONT_UPDATE:
1186 update_and_apply_freefont(view(), argument);
1189 case LFUN_RECONFIGURE:
1190 Reconfigure(view());
1194 case LFUN_FLOATSOPERATE:
1195 if (argument == "openfoot")
1196 view()->allFloats(1,0);
1197 else if (argument == "closefoot")
1198 view()->allFloats(0,0);
1199 else if (argument == "openfig")
1200 view()->allFloats(1,1);
1201 else if (argument == "closefig")
1202 view()->allFloats(0,1);
1205 #ifdef WITH_WARNINGS
1206 //#warning Find another implementation here (or another lyxfunc)!
1209 case LFUN_HELP_OPEN:
1211 string const arg = argument;
1213 setErrorMessage(N_("Missing argument"));
1216 string const fname = i18nLibFileSearch("doc", arg, "lyx");
1217 if (fname.empty()) {
1218 lyxerr << "LyX: unable to find documentation file `"
1219 << arg << "'. Bad installation?" << endl;
1222 owner->message(bformat(_("Opening help file %1$s..."),
1223 MakeDisplayPath(fname)));
1224 view()->loadLyXFile(fname, false);
1228 // --- version control -------------------------------
1229 case LFUN_VC_REGISTER:
1231 if (!ensureBufferClean(view()))
1233 if (!owner->buffer()->lyxvc.inUse()) {
1234 owner->buffer()->lyxvc.registrer();
1240 case LFUN_VC_CHECKIN:
1242 if (!ensureBufferClean(view()))
1244 if (owner->buffer()->lyxvc.inUse()
1245 && !owner->buffer()->isReadonly()) {
1246 owner->buffer()->lyxvc.checkIn();
1252 case LFUN_VC_CHECKOUT:
1254 if (!ensureBufferClean(view()))
1256 if (owner->buffer()->lyxvc.inUse()
1257 && owner->buffer()->isReadonly()) {
1258 owner->buffer()->lyxvc.checkOut();
1264 case LFUN_VC_REVERT:
1266 owner->buffer()->lyxvc.revert();
1273 owner->buffer()->lyxvc.undoLast();
1278 // --- buffers ----------------------------------------
1280 case LFUN_SWITCHBUFFER:
1281 view()->buffer(bufferlist.getBuffer(argument));
1285 NewFile(view(), argument);
1288 case LFUN_FILE_OPEN:
1292 case LFUN_LAYOUT_TABULAR:
1293 if (view()->theLockingInset()) {
1294 if (view()->theLockingInset()->lyxCode()== InsetOld::TABULAR_CODE) {
1295 InsetTabular * inset = static_cast<InsetTabular *>
1296 (view()->theLockingInset());
1297 inset->openLayoutDialog(view());
1298 } else if (view()->theLockingInset()->
1299 getFirstLockingInsetOfType(InsetOld::TABULAR_CODE)!=0) {
1300 InsetTabular * inset = static_cast<InsetTabular *>(
1301 view()->theLockingInset()->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE));
1302 inset->openLayoutDialog(view());
1307 case LFUN_DROP_LAYOUTS_CHOICE:
1308 owner->getToolbar().openLayoutList();
1311 case LFUN_MENU_OPEN_BY_NAME:
1312 owner->getMenubar().openByName(argument);
1313 break; // RVDK_PATCH_5
1315 // --- lyxserver commands ----------------------------
1319 setMessage(owner->buffer()->fileName());
1320 lyxerr[Debug::INFO] << "FNAME["
1321 << owner->buffer()->fileName()
1327 dispatch_buffer = keyseq.print();
1328 lyxserver->notifyClient(dispatch_buffer);
1332 case LFUN_GOTOFILEROW:
1336 istringstream istr(argument.c_str());
1337 istr >> file_name >> row;
1338 // Must replace extension of the file to be .lyx and get full path
1339 string const s(ChangeExtension(file_name, ".lyx"));
1341 // Either change buffer or load the file
1342 if (bufferlist.exists(s)) {
1343 view()->buffer(bufferlist.getBuffer(s));
1345 view()->loadLyXFile(s);
1348 view()->setCursorFromRow(row);
1351 // see BufferView_pimpl::center()
1352 view()->updateScrollbar();
1356 case LFUN_GOTO_PARAGRAPH:
1358 istringstream istr(argument.c_str());
1362 ParIterator par = owner->buffer()->getParFromID(id);
1363 if (par == owner->buffer()->par_iterator_end()) {
1364 lyxerr[Debug::INFO] << "No matching paragraph found! ["
1365 << id << ']' << endl;
1368 lyxerr[Debug::INFO] << "Paragraph " << par->id()
1369 << " found." << endl;
1372 if (view()->theLockingInset())
1373 view()->unlockInset(view()->theLockingInset());
1374 if (par->inInset()) {
1375 FuncRequest cmd(view(), LFUN_INSET_EDIT, "left");
1376 par->inInset()->localDispatch(cmd);
1379 view()->getLyXText()->setCursor(par.pit(), 0);
1380 view()->switchKeyMap();
1381 owner->view_state_changed();
1384 // see BufferView_pimpl::center()
1385 view()->updateScrollbar();
1389 // --- insert characters ----------------------------------------
1391 // --- Mathed stuff. If we are here, there is no locked inset yet.
1392 case LFUN_MATH_EXTERN:
1393 case LFUN_MATH_NUMBER:
1394 case LFUN_MATH_NONUMBER:
1395 case LFUN_MATH_LIMITS:
1397 setErrorMessage(N_("This is only allowed in math mode!"));
1401 // passthrough hat and underscore outside mathed:
1402 case LFUN_SUBSCRIPT:
1403 dispatch(FuncRequest(view(), LFUN_SELFINSERT, "_"));
1405 case LFUN_SUPERSCRIPT:
1406 dispatch(FuncRequest(view(), LFUN_SELFINSERT, "^"));
1409 case LFUN_DIALOG_SHOW: {
1410 string const name = ev.getArg(0);
1411 string data = trim(ev.argument.substr(name.size()));
1413 if (name == "character") {
1414 data = freefont2string();
1416 owner->getDialogs().show("character", data);
1417 } else if (name == "document")
1418 owner->getDialogs().showDocument();
1419 else if (name == "findreplace")
1420 owner->getDialogs().showSearch();
1421 else if (name == "forks")
1422 owner->getDialogs().showForks();
1423 else if (name == "preamble")
1424 owner->getDialogs().showPreamble();
1425 else if (name == "preferences")
1426 owner->getDialogs().showPreferences();
1427 else if (name == "print")
1428 owner->getDialogs().showPrint();
1429 else if (name == "spellchecker")
1430 owner->getDialogs().showSpellchecker();
1432 owner->getDialogs().show(name, data);
1436 case LFUN_DIALOG_SHOW_NEW_INSET: {
1437 string const & name = argument;
1439 if (name == "bibitem" ||
1441 name == "include" ||
1446 InsetCommandParams p(name);
1447 data = InsetCommandMailer::params2string(name, p);
1448 } else if (name == "citation") {
1449 InsetCommandParams p("cite");
1450 data = InsetCommandMailer::params2string(name, p);
1452 owner->getDialogs().show(name, data, 0);
1456 case LFUN_DIALOG_SHOW_NEXT_INSET: {
1460 case LFUN_INSET_DIALOG_SHOW: {
1461 LyXText * lt = view()->getLyXText();
1462 InsetOld * inset = lt->getInset();
1464 FuncRequest cmd(view(), LFUN_INSET_DIALOG_SHOW);
1465 inset->localDispatch(cmd);
1470 case LFUN_DIALOG_UPDATE: {
1471 string const & name = argument;
1472 // Can only update a dialog connected to an existing inset
1473 InsetBase * inset = owner->getDialogs().getOpenInset(name);
1475 FuncRequest fr(view(), LFUN_INSET_DIALOG_UPDATE,
1477 inset->localDispatch(fr);
1478 } else if (name == "paragraph") {
1479 dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
1484 case LFUN_DIALOG_HIDE:
1485 Dialogs::hide(argument, 0);
1488 case LFUN_DIALOG_DISCONNECT_INSET:
1489 owner->getDialogs().disconnect(argument);
1492 case LFUN_CHILDOPEN:
1494 string const filename =
1495 MakeAbsPath(argument,
1496 owner->buffer()->filePath());
1497 setMessage(N_("Opening child document ") +
1498 MakeDisplayPath(filename) + "...");
1499 view()->savePosition(0);
1500 if (bufferlist.exists(filename))
1501 view()->buffer(bufferlist.getBuffer(filename));
1503 view()->loadLyXFile(filename);
1507 case LFUN_TOGGLECURSORFOLLOW:
1508 lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
1512 owner->getIntl().KeyMapOn(false);
1515 case LFUN_KMAP_PRIM:
1516 owner->getIntl().KeyMapPrim();
1520 owner->getIntl().KeyMapSec();
1523 case LFUN_KMAP_TOGGLE:
1524 owner->getIntl().ToggleKeyMap();
1529 // argument contains ';'-terminated commands
1530 while (!argument.empty()) {
1532 argument = split(argument, first, ';');
1538 case LFUN_SAVEPREFERENCES:
1540 Path p(user_lyxdir());
1541 lyxrc.write("preferences");
1545 case LFUN_SCREEN_FONT_UPDATE:
1547 // handle the screen font changes.
1548 lyxrc.set_font_norm_type();
1549 lyx_gui::update_fonts();
1550 // We also need to empty the textcache so that
1551 // the buffer will be formatted correctly after
1554 // Of course we should only do the resize and the textcache.clear
1555 // if values really changed...but not very important right now. (Lgb)
1556 // All visible buffers will need resize
1562 case LFUN_SET_COLOR:
1565 string const x11_name = split(argument, lyx_name, ' ');
1566 if (lyx_name.empty() || x11_name.empty()) {
1567 setErrorMessage(N_("Syntax: set-color <lyx_name>"
1572 bool const graphicsbg_changed =
1573 (lyx_name == lcolor.getLyXName(LColor::graphicsbg) &&
1574 x11_name != lcolor.getX11Name(LColor::graphicsbg));
1576 if (!lcolor.setColor(lyx_name, x11_name)) {
1578 bformat(_("Set-color \"%1$s\" failed "
1579 "- color is undefined or "
1580 "may not be redefined"), lyx_name));
1584 lyx_gui::update_color(lcolor.getFromLyXName(lyx_name));
1586 if (graphicsbg_changed) {
1587 #ifdef WITH_WARNINGS
1588 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
1591 lyx::graphics::GCache & gc =
1592 lyx::graphics::GCache::get();
1593 gc.changeDisplay(true);
1602 owner->message(argument);
1605 case LFUN_FORKS_KILL:
1607 if (!isStrInt(argument))
1610 pid_t const pid = strToInt(argument);
1611 ForkedcallsController & fcc = ForkedcallsController::get();
1616 case LFUN_TOOLTIPS_TOGGLE:
1617 owner->getDialogs().toggleTooltips();
1620 case LFUN_EXTERNAL_EDIT: {
1622 .localDispatch(FuncRequest(view(), action, argument));
1627 // Then if it was none of the above
1628 // Trying the BufferView::pimpl dispatch:
1629 if (!view()->dispatch(ev))
1630 lyxerr << "A truly unknown func ["
1631 << lyxaction.getActionName(ev.action) << "]!"
1638 view()->owner()->updateLayoutChoice();
1640 if (view()->available()) {
1641 if (view()->fitCursor()) {
1642 lyxerr << "LyXFunc->fitCursor->update" << endl;
1647 // If we executed a mutating lfun, mark the buffer as dirty
1648 if (!getStatus(ev).disabled()
1649 && !lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)
1650 && !lyxaction.funcHasFlag(ev.action, LyXAction::ReadOnly))
1651 view()->buffer()->markDirty();
1654 sendDispatchMessage(getMessage(), ev, verbose);
1658 void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose)
1660 owner->updateMenubar();
1661 owner->updateToolbar();
1663 if (ev.action == LFUN_SELFINSERT || !verbose) {
1664 lyxerr[Debug::ACTION] << "dispatch msg is " << msg << endl;
1666 owner->message(msg);
1670 string dispatch_msg = msg;
1671 if (!dispatch_msg.empty())
1672 dispatch_msg += ' ';
1674 string comname = lyxaction.getActionName(ev.action);
1676 int pseudoaction = ev.action;
1677 bool argsadded = false;
1679 if (!ev.argument.empty()) {
1680 // the pseudoaction is useful for the bindings
1681 pseudoaction = lyxaction.searchActionArg(ev.action, ev.argument);
1683 if (pseudoaction == LFUN_UNKNOWN_ACTION) {
1684 pseudoaction = ev.action;
1686 comname += ' ' + ev.argument;
1691 string const shortcuts = toplevel_keymap->findbinding(pseudoaction);
1693 if (!shortcuts.empty()) {
1694 comname += ": " + shortcuts;
1695 } else if (!argsadded && !ev.argument.empty()) {
1696 comname += ' ' + ev.argument;
1699 if (!comname.empty()) {
1700 comname = rtrim(comname);
1701 dispatch_msg += '(' + comname + ')';
1704 lyxerr[Debug::ACTION] << "verbose dispatch msg " << dispatch_msg << endl;
1705 if (!dispatch_msg.empty())
1706 owner->message(dispatch_msg);
1710 void LyXFunc::setupLocalKeymap()
1712 keyseq.stdmap = keyseq.curmap = toplevel_keymap.get();
1713 cancel_meta_seq.stdmap = cancel_meta_seq.curmap = toplevel_keymap.get();
1717 void LyXFunc::menuNew(string const & name, bool fromTemplate)
1719 string initpath = lyxrc.document_path;
1720 string filename(name);
1722 if (view()->available()) {
1723 string const trypath = owner->buffer()->filePath();
1724 // If directory is writeable, use this as default.
1725 if (IsDirWriteable(trypath))
1729 static int newfile_number;
1731 if (filename.empty()) {
1732 filename = AddName(lyxrc.document_path,
1733 "newfile" + tostr(++newfile_number) + ".lyx");
1734 FileInfo fi(filename);
1735 while (bufferlist.exists(filename) || fi.readable()) {
1737 filename = AddName(lyxrc.document_path,
1738 "newfile" + tostr(newfile_number) +
1740 fi.newFile(filename);
1744 // The template stuff
1747 FileDialog fileDlg(_("Select template file"),
1748 LFUN_SELECT_FILE_SYNC,
1749 make_pair(string(_("Documents|#o#O")),
1750 string(lyxrc.document_path)),
1751 make_pair(string(_("Templates|#T#t")),
1752 string(lyxrc.template_path)));
1754 FileDialog::Result result =
1755 fileDlg.open(lyxrc.template_path,
1756 _("*.lyx| LyX Documents (*.lyx)"));
1758 if (result.first == FileDialog::Later)
1761 string const fname = result.second;
1768 view()->newFile(filename, templname, !name.empty());
1772 void LyXFunc::open(string const & fname)
1774 string initpath = lyxrc.document_path;
1776 if (view()->available()) {
1777 string const trypath = owner->buffer()->filePath();
1778 // If directory is writeable, use this as default.
1779 if (IsDirWriteable(trypath))
1785 if (fname.empty()) {
1786 FileDialog fileDlg(_("Select document to open"),
1788 make_pair(string(_("Documents|#o#O")),
1789 string(lyxrc.document_path)),
1790 make_pair(string(_("Examples|#E#e")),
1791 string(AddPath(system_lyxdir(), "examples"))));
1793 FileDialog::Result result =
1794 fileDlg.open(initpath,
1795 _("*.lyx| LyX Documents (*.lyx)"));
1797 if (result.first == FileDialog::Later)
1800 filename = result.second;
1802 // check selected filename
1803 if (filename.empty()) {
1804 owner->message(_("Canceled."));
1810 // get absolute path of file and add ".lyx" to the filename if
1812 string const fullpath = FileSearch(string(), filename, "lyx");
1813 if (!fullpath.empty()) {
1814 filename = fullpath;
1817 string const disp_fn(MakeDisplayPath(filename));
1819 // if the file doesn't exist, let the user create one
1820 FileInfo const f(filename, true);
1822 // the user specifically chose this name. Believe them.
1823 view()->newFile(filename, "", true);
1827 owner->message(bformat(_("Opening document %1$s..."), disp_fn));
1830 if (view()->loadLyXFile(filename)) {
1831 str2 = bformat(_("Document %1$s opened."), disp_fn);
1833 str2 = bformat(_("Could not open document %1$s"), disp_fn);
1835 owner->message(str2);
1839 void LyXFunc::doImport(string const & argument)
1842 string filename = split(argument, format, ' ');
1844 lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format
1845 << " file: " << filename << endl;
1847 // need user interaction
1848 if (filename.empty()) {
1849 string initpath = lyxrc.document_path;
1851 if (view()->available()) {
1852 string const trypath = owner->buffer()->filePath();
1853 // If directory is writeable, use this as default.
1854 if (IsDirWriteable(trypath))
1858 string const text = bformat(_("Select %1$s file to import"),
1859 formats.prettyName(format));
1861 FileDialog fileDlg(text,
1863 make_pair(string(_("Documents|#o#O")),
1864 string(lyxrc.document_path)),
1865 make_pair(string(_("Examples|#E#e")),
1866 string(AddPath(system_lyxdir(), "examples"))));
1868 string const extension = "*." + formats.extension(format)
1869 + "| " + formats.prettyName(format)
1870 + " (*." + formats.extension(format) + ')';
1872 FileDialog::Result result = fileDlg.open(initpath,
1875 if (result.first == FileDialog::Later)
1878 filename = result.second;
1880 // check selected filename
1881 if (filename.empty())
1882 owner->message(_("Canceled."));
1885 if (filename.empty())
1888 // get absolute path of file
1889 filename = MakeAbsPath(filename);
1891 string const lyxfile = ChangeExtension(filename, ".lyx");
1893 // Check if the document already is open
1894 if (lyx_gui::use_gui && bufferlist.exists(lyxfile)) {
1895 if (!bufferlist.close(bufferlist.getBuffer(lyxfile), true)) {
1896 owner->message(_("Canceled."));
1901 // if the file exists already, and we didn't do
1902 // -i lyx thefile.lyx, warn
1903 if (FileInfo(lyxfile, true).exist() && filename != lyxfile) {
1904 string const file = MakeDisplayPath(lyxfile, 30);
1906 string text = bformat(_("The document %1$s already exists.\n\n"
1907 "Do you want to over-write that document?"), file);
1908 int const ret = Alert::prompt(_("Over-write document?"),
1909 text, 0, 1, _("&Over-write"), _("&Cancel"));
1912 owner->message(_("Canceled."));
1917 Importer::Import(owner, filename, format);
1921 void LyXFunc::closeBuffer()
1923 if (bufferlist.close(owner->buffer(), true) && !quitting) {
1924 if (bufferlist.empty()) {
1925 // need this otherwise SEGV may occur while
1926 // trying to set variables that don't exist
1927 // since there's no current buffer
1928 owner->getDialogs().hideBufferDependent();
1930 view()->buffer(bufferlist.first());
1936 // Each "owner" should have it's own message method. lyxview and
1937 // the minibuffer would use the minibuffer, but lyxserver would
1938 // send an ERROR signal to its client. Alejandro 970603
1939 // This func is bit problematic when it comes to NLS, to make the
1940 // lyx servers client be language indepenent we must not translate
1941 // strings sent to this func.
1942 void LyXFunc::setErrorMessage(string const & m) const
1944 dispatch_buffer = m;
1949 void LyXFunc::setMessage(string const & m) const
1951 dispatch_buffer = m;
1955 void LyXFunc::setStatusMessage(string const & m) const
1961 string const LyXFunc::view_status_message()
1963 // When meta-fake key is pressed, show the key sequence so far + "M-".
1965 return keyseq.print() + "M-";
1968 // Else, when a non-complete key sequence is pressed,
1969 // show the available options.
1970 if (keyseq.length() > 0 && !keyseq.deleted()) {
1971 return keyseq.printOptions();
1974 if (!view()->available())
1975 return _("Welcome to LyX!");
1977 return currentState(view());
1981 BufferView * LyXFunc::view() const
1984 return owner->view().get();
1988 bool LyXFunc::wasMetaKey() const
1990 return (meta_fake_bit != key_modifier::none);