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 "bufferlist.h"
27 #include "buffer_funcs.h"
28 #include "BufferView.h"
29 #include "lyxserver.h"
33 #include "LyXAction.h"
39 #include "trans_mgr.h"
42 #include "bufferview_funcs.h"
43 #include "frontends/LyXView.h"
44 #include "frontends/lyx_gui.h"
46 #include "FloatList.h"
50 #include "TextCache.h"
52 #include "undo_funcs.h"
53 #include "ParagraphParameters.h"
55 #include "insets/insetbibtex.h"
56 #include "insets/insetcommand.h"
57 #include "insets/insetexternal.h"
58 #include "insets/insettabular.h"
60 #include "mathed/formulamacro.h"
61 #include "mathed/math_cursor.h"
62 #include "mathed/math_inset.h"
64 #include "frontends/FileDialog.h"
65 #include "frontends/Dialogs.h"
66 #include "frontends/Toolbar.h"
67 #include "frontends/Menubar.h"
68 #include "frontends/Alert.h"
70 #include "graphics/GraphicsCache.h"
72 #include "support/lyxalgo.h"
73 #include "support/LAssert.h"
74 #include "support/filetools.h"
75 #include "support/FileInfo.h"
76 #include "support/forkedcontr.h"
77 #include "support/lstrings.h"
78 #include "support/tostr.h"
79 #include "support/path.h"
80 #include "support/path_defines.h"
81 #include "support/lyxfunctional.h"
91 using namespace lyx::support;
99 using std::back_inserter;
100 using namespace bv_funcs;
102 extern BufferList bufferlist;
103 extern LyXServer * lyxserver;
104 extern bool selection_possible;
106 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
109 extern tex_accent_struct get_accent(kb_action action);
111 extern void ShowLatexLog();
114 LyXFunc::LyXFunc(LyXView * o)
117 keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
118 cancel_meta_seq(toplevel_keymap.get(), toplevel_keymap.get()),
119 meta_fake_bit(key_modifier::none)
124 void LyXFunc::moveCursorUpdate()
126 LyXText * lt = view()->text;
127 if (lt->selection.mark())
130 view()->switchKeyMap();
134 void LyXFunc::handleKeyFunc(kb_action action)
136 char c = encoded_last_key;
138 if (keyseq.length()) {
142 owner->getIntl().getTransManager()
143 .deadkey(c, get_accent(action).accent, view()->getLyXText());
144 // Need to clear, in case the minibuffer calls these
147 // copied verbatim from do_accent_char
149 view()->getLyXText()->selection.cursor = view()->getLyXText()->cursor;
153 void LyXFunc::processKeySym(LyXKeySymPtr keysym,
154 key_modifier::state state)
158 if (lyxerr.debugging(Debug::KEY)) {
159 lyxerr << "KeySym is "
160 << keysym->getSymbolName()
164 // Do nothing if we have nothing (JMarc)
165 if (!keysym->isOK()) {
166 lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
171 if (keysym->isModifier()) {
172 lyxerr[Debug::KEY] << "isModifier true" << endl;
176 Encoding const * encoding = view()->getEncoding();
178 encoded_last_key = keysym->getISOEncoded(encoding ? encoding->Name() : "");
180 // Do a one-deep top-level lookup for
181 // cancel and meta-fake keys. RVDK_PATCH_5
182 cancel_meta_seq.reset();
184 int action = cancel_meta_seq.addkey(keysym, state);
185 lyxerr[Debug::KEY] << "action first set to [" << action << ']' << endl;
187 // When not cancel or meta-fake, do the normal lookup.
188 // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
189 // Mostly, meta_fake_bit = key_modifier::none. RVDK_PATCH_5.
190 if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) {
191 // remove Caps Lock and Mod2 as a modifiers
192 action = keyseq.addkey(keysym, (state | meta_fake_bit));
193 lyxerr[Debug::KEY] << "action now set to ["
194 << action << ']' << endl;
197 // Dont remove this unless you know what you are doing.
198 meta_fake_bit = key_modifier::none;
200 // can this happen now ?
201 if (action == LFUN_NOACTION) {
202 action = LFUN_PREFIX;
205 if (lyxerr.debugging(Debug::KEY)) {
206 lyxerr << "Key [action="
208 << keyseq.print() << ']'
212 // already here we know if it any point in going further
213 // why not return already here if action == -1 and
214 // num_bytes == 0? (Lgb)
216 if (keyseq.length() > 1) {
217 owner->message(keyseq.print());
221 // Maybe user can only reach the key via holding down shift.
222 // Let's see. But only if shift is the only modifier
223 if (action == LFUN_UNKNOWN_ACTION && state == key_modifier::shift) {
224 lyxerr[Debug::KEY] << "Trying without shift" << endl;
225 action = keyseq.addkey(keysym, key_modifier::none);
226 lyxerr[Debug::KEY] << "Action now " << action << endl;
229 if (action == LFUN_UNKNOWN_ACTION) {
230 // Hmm, we didn't match any of the keysequences. See
231 // if it's normal insertable text not already covered
233 if (keysym->isText() && keyseq.length() == 1) {
234 lyxerr[Debug::KEY] << "isText() is true, inserting." << endl;
235 action = LFUN_SELFINSERT;
237 lyxerr[Debug::KEY] << "Unknown, !isText() - giving up" << endl;
238 owner->message(_("Unknown function."));
243 if (action == LFUN_SELFINSERT) {
244 if (encoded_last_key != 0) {
246 arg += encoded_last_key;
248 dispatch(FuncRequest(view(), LFUN_SELFINSERT, arg));
250 lyxerr[Debug::KEY] << "SelfInsert arg[`"
251 << argument << "']" << endl;
259 FuncStatus LyXFunc::getStatus(int ac) const
261 return getStatus(lyxaction.retrieveActionArg(ac));
265 FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
268 Buffer * buf = owner->buffer();
270 if (ev.action == LFUN_NOACTION) {
271 setStatusMessage(N_("Nothing to do"));
272 return flag.disabled(true);
276 case LFUN_UNKNOWN_ACTION:
277 #ifndef HAVE_LIBAIKSAURUS
278 case LFUN_THESAURUS_ENTRY:
283 flag |= lyx_gui::getStatus(ev);
286 if (flag.unknown()) {
287 setStatusMessage(N_("Unknown action"));
291 // the default error message if we disable the command
292 setStatusMessage(N_("Command disabled"));
294 // Check whether we need a buffer
295 if (!lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)) {
296 // Yes we need a buffer, do we have one?
299 // Can we use a readonly buffer?
300 if (buf->isReadonly() &&
301 !lyxaction.funcHasFlag(ev.action,
302 LyXAction::ReadOnly)) {
304 setStatusMessage(N_("Document is read-only"));
309 setStatusMessage(N_("Command not allowed with"
310 "out any document open"));
311 return flag.disabled(true);
315 UpdatableInset * tli = view()->theLockingInset();
317 // I would really like to avoid having this switch and rather try to
318 // encode this in the function itself.
319 bool disable = false;
322 disable = ev.argument != "custom"
323 && !Exporter::IsExportable(*buf, ev.argument);
326 disable = buf->undostack.empty();
329 disable = buf->redostack.empty();
334 UpdatableInset * in = tli;
335 if (in->lyxCode() != InsetOld::TABULAR_CODE) {
336 in = tli->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE);
338 if (in && static_cast<InsetTabular*>(in)->hasSelection()) {
343 disable = !mathcursor && !view()->getLyXText()->selection.set();
346 disable = !buf->isLatex() || lyxrc.chktex_command == "none";
349 disable = !Exporter::IsExportable(*buf, "program");
352 case LFUN_LAYOUT_TABULAR:
354 || (tli->lyxCode() != InsetOld::TABULAR_CODE
355 && !tli->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE));
359 disable = !changeDepth(view(), view()->getLyXText(), DEC_DEPTH, true);
362 case LFUN_DEPTH_PLUS:
363 disable = !changeDepth(view(), view()->getLyXText(), INC_DEPTH, true);
367 case LFUN_LAYOUT_PARAGRAPH: {
368 InsetOld * inset = view()->getLyXText()->cursor.par()->inInset();
369 disable = inset && inset->forceDefaultParagraphs(inset);
373 case LFUN_INSET_OPTARG:
374 disable = (view()->getLyXText()->cursor.par()->layout()->optionalargs == 0);
377 case LFUN_TABULAR_FEATURE:
380 // FIXME: check temporarily disabled
382 char align = mathcursor->valign();
387 if (ev.argument.empty()) {
391 if (!contains("tcb", ev.argument[0])) {
395 flag.setOnOff(ev.argument[0] == align);
399 char align = mathcursor->halign();
404 if (ev.argument.empty()) {
408 if (!contains("lcr", ev.argument[0])) {
412 flag.setOnOff(ev.argument[0] == align);
415 disable = !mathcursor->halign();
421 //ret.disabled(true);
422 if (tli->lyxCode() == InsetOld::TABULAR_CODE) {
423 ret = static_cast<InsetTabular *>(tli)
424 ->getStatus(ev.argument);
427 } else if (tli->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE)) {
428 ret = static_cast<InsetTabular *>
429 (tli->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE))
430 ->getStatus(ev.argument);
437 static InsetTabular inset(*owner->buffer(), 1, 1);
441 ret = inset.getStatus(ev.argument);
442 if (ret.onoff(true) || ret.onoff(false))
443 flag.setOnOff(false);
447 case LFUN_VC_REGISTER:
448 disable = buf->lyxvc.inUse();
450 case LFUN_VC_CHECKIN:
451 disable = !buf->lyxvc.inUse() || buf->isReadonly();
453 case LFUN_VC_CHECKOUT:
454 disable = !buf->lyxvc.inUse() || !buf->isReadonly();
458 disable = !buf->lyxvc.inUse();
460 case LFUN_MENURELOAD:
461 disable = buf->isUnnamed() || buf->isClean();
463 case LFUN_BOOKMARK_GOTO:
465 isSavedPosition(strToUnsignedInt(ev.argument));
467 case LFUN_MERGE_CHANGES:
468 case LFUN_ACCEPT_CHANGE:
469 case LFUN_REJECT_CHANGE:
470 case LFUN_ACCEPT_ALL_CHANGES:
471 case LFUN_REJECT_ALL_CHANGES:
472 disable = !buf->params.tracking_changes;
474 case LFUN_INSET_TOGGLE: {
475 LyXText * lt = view()->getLyXText();
476 disable = !(isEditableInset(lt->getInset())
478 && lt->inset_owner->owner()
479 && lt->inset_owner->owner()->isOpen()));
483 case LFUN_INSET_SETTINGS: {
485 UpdatableInset * inset = view()->theLockingInset();
490 // get the innermost inset
491 inset = inset->getLockingInset();
493 // jump back to owner if an InsetText, so
494 // we get back to the InsetTabular or whatever
495 if (inset->lyxCode() == InsetOld::TEXT_CODE)
496 inset = inset->owner();
498 InsetOld::Code code = inset->lyxCode();
500 case InsetOld::TABULAR_CODE:
501 disable = ev.argument != "tabular";
503 case InsetOld::ERT_CODE:
504 disable = ev.argument != "ert";
506 case InsetOld::FLOAT_CODE:
507 disable = ev.argument != "float";
509 case InsetOld::MINIPAGE_CODE:
510 disable = ev.argument != "minipage";
512 case InsetOld::WRAP_CODE:
513 disable = ev.argument != "wrap";
515 case InsetOld::NOTE_CODE:
516 disable = ev.argument != "note";
518 case InsetOld::BRANCH_CODE:
519 disable = ev.argument != "branch";
527 case LFUN_MATH_MUTATE:
529 //flag.setOnOff(mathcursor->formula()->hullType() == ev.argument);
530 flag.setOnOff(false);
535 // we just need to be in math mode to enable that
537 case LFUN_MATH_SPACE:
538 case LFUN_MATH_LIMITS:
539 case LFUN_MATH_NONUMBER:
540 case LFUN_MATH_NUMBER:
541 case LFUN_MATH_EXTERN:
542 disable = !mathcursor;
545 case LFUN_DIALOG_SHOW: {
546 string const name = ev.getArg(0);
548 disable = !(name == "aboutlyx" ||
551 name == "preferences" ||
556 if (name == "print") {
557 disable = !Exporter::IsExportable(*buf, "dvi") ||
558 lyxrc.print_command == "none";
559 } else if (name == "character") {
560 UpdatableInset * tli = view()->theLockingInset();
561 disable = tli && tli->lyxCode() == InsetOld::ERT_CODE;
562 } else if (name == "vclog") {
563 disable = !buf->lyxvc.inUse();
564 } else if (name == "latexlog") {
565 disable = !IsFileReadable(buf->getLogName().second);
574 // the functions which insert insets
575 InsetOld::Code code = InsetOld::NO_CODE;
577 case LFUN_DIALOG_SHOW_NEW_INSET:
578 if (ev.argument == "bibitem")
579 code = InsetOld::BIBITEM_CODE;
580 else if (ev.argument == "bibtex")
581 code = InsetOld::BIBTEX_CODE;
582 else if (ev.argument == "citation")
583 code = InsetOld::CITE_CODE;
584 else if (ev.argument == "ert")
585 code = InsetOld::ERT_CODE;
586 else if (ev.argument == "external")
587 code = InsetOld::EXTERNAL_CODE;
588 else if (ev.argument == "float")
589 code = InsetOld::FLOAT_CODE;
590 else if (ev.argument == "graphics")
591 code = InsetOld::GRAPHICS_CODE;
592 else if (ev.argument == "include")
593 code = InsetOld::INCLUDE_CODE;
594 else if (ev.argument == "index")
595 code = InsetOld::INDEX_CODE;
596 else if (ev.argument == "label")
597 code = InsetOld::LABEL_CODE;
598 else if (ev.argument == "minipage")
599 code = InsetOld::MINIPAGE_CODE;
600 else if (ev.argument == "ref")
601 code = InsetOld::REF_CODE;
602 else if (ev.argument == "toc")
603 code = InsetOld::TOC_CODE;
604 else if (ev.argument == "url")
605 code = InsetOld::URL_CODE;
606 else if (ev.argument == "wrap")
607 code = InsetOld::WRAP_CODE;
611 code = InsetOld::ERT_CODE;
613 case LFUN_INSET_FOOTNOTE:
614 code = InsetOld::FOOT_CODE;
616 case LFUN_TABULAR_INSERT:
617 code = InsetOld::TABULAR_CODE;
619 case LFUN_INSET_MARGINAL:
620 code = InsetOld::MARGIN_CODE;
622 case LFUN_INSET_MINIPAGE:
623 code = InsetOld::MINIPAGE_CODE;
625 case LFUN_INSET_FLOAT:
626 case LFUN_INSET_WIDE_FLOAT:
627 code = InsetOld::FLOAT_CODE;
629 case LFUN_INSET_WRAP:
630 code = InsetOld::WRAP_CODE;
632 case LFUN_FLOAT_LIST:
633 code = InsetOld::FLOAT_LIST_CODE;
636 case LFUN_INSET_LIST:
637 code = InsetOld::LIST_CODE;
639 case LFUN_INSET_THEOREM:
640 code = InsetOld::THEOREM_CODE;
643 case LFUN_INSET_CAPTION:
644 code = InsetOld::CAPTION_CODE;
646 case LFUN_INSERT_NOTE:
647 code = InsetOld::NOTE_CODE;
649 case LFUN_INSERT_BRANCH:
650 code = InsetOld::BRANCH_CODE;
651 if (buf->params.branchlist.empty())
654 case LFUN_INSERT_LABEL:
655 code = InsetOld::LABEL_CODE;
657 case LFUN_INSET_OPTARG:
658 code = InsetOld::OPTARG_CODE;
660 case LFUN_ENVIRONMENT_INSERT:
661 code = InsetOld::MINIPAGE_CODE;
663 case LFUN_INDEX_INSERT:
664 code = InsetOld::INDEX_CODE;
666 case LFUN_INDEX_PRINT:
667 code = InsetOld::INDEX_PRINT_CODE;
669 case LFUN_TOC_INSERT:
670 code = InsetOld::TOC_CODE;
674 code = InsetOld::URL_CODE;
677 // always allow this, since we will inset a raw quote
678 // if an inset is not allowed.
680 case LFUN_HYPHENATION:
681 case LFUN_LIGATURE_BREAK:
683 case LFUN_MENU_SEPARATOR:
685 case LFUN_END_OF_SENTENCE:
686 code = InsetOld::SPECIALCHAR_CODE;
688 case LFUN_SPACE_INSERT:
689 // slight hack: we know this is allowed in math mode
691 code = InsetOld::SPACE_CODE;
696 if (code != InsetOld::NO_CODE && tli && !tli->insetAllowed(code))
702 // A few general toggles
704 case LFUN_TOOLTIPS_TOGGLE:
705 flag.setOnOff(owner->getDialogs().tooltipsEnabled());
708 case LFUN_READ_ONLY_TOGGLE:
709 flag.setOnOff(buf->isReadonly());
712 flag.setOnOff(view()->getLyXText()->cursor.par()->params().startOfAppendix());
714 case LFUN_SWITCHBUFFER:
715 // toggle on the current buffer, but do not toggle off
716 // the other ones (is that a good idea?)
717 if (ev.argument == buf->fileName())
720 case LFUN_TRACK_CHANGES:
721 flag.setOnOff(buf->params.tracking_changes);
727 // the font related toggles
729 LyXFont const & font = view()->getLyXText()->real_current_font;
732 flag.setOnOff(font.emph() == LyXFont::ON);
735 flag.setOnOff(font.noun() == LyXFont::ON);
738 flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
741 flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
744 flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
747 flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
753 string tc = mathcursor->getLastCode();
756 flag.setOnOff(tc == "mathbf");
759 flag.setOnOff(tc == "mathsf");
762 flag.setOnOff(tc == "mathcal");
765 flag.setOnOff(tc == "mathrm");
768 flag.setOnOff(tc == "mathtt");
771 flag.setOnOff(tc == "mathbb");
774 flag.setOnOff(tc == "mathnormal");
781 // this one is difficult to get right. As a half-baked
782 // solution, we consider only the first action of the sequence
783 if (ev.action == LFUN_SEQUENCE) {
784 // argument contains ';'-terminated commands
785 flag = getStatus(lyxaction.LookupFunc(token(ev.argument, ';', 0)));
792 void LyXFunc::dispatch(string const & s, bool verbose)
794 int const action = lyxaction.LookupFunc(s);
796 if (action == LFUN_UNKNOWN_ACTION) {
797 owner->message(bformat(_("Unknown function (%1$s)"), s));
801 dispatch(action, verbose);
805 void LyXFunc::dispatch(int ac, bool verbose)
807 dispatch(lyxaction.retrieveActionArg(ac), verbose);
811 bool ensureBufferClean(BufferView * bv) {
813 Buffer & buf = *bv->buffer();
817 string const file = MakeDisplayPath(buf.fileName(), 30);
818 string text = bformat(_("The document %1$s has unsaved "
819 "changes.\n\nDo you want to save "
820 "the document?"), file);
821 int const ret = Alert::prompt(_("Save changed document?"),
822 text, 0, 1, _("&Save"),
826 bv->owner()->dispatch(FuncRequest(LFUN_MENUWRITE));
828 return buf.isClean();
834 void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
836 lyxerr[Debug::ACTION] << "LyXFunc::dispatch: action[" << ev.action
837 <<"] arg[" << ev.argument << ']' << endl;
839 // we have not done anything wrong yet.
841 dispatch_buffer.erase();
843 #ifdef NEW_DISPATCHER
844 // We try do call the most specific dispatcher first:
845 // 1. the lockinginset's dispatch
846 // 2. the bufferview's dispatch
847 // 3. the lyxview's dispatch
850 selection_possible = false;
852 string argument = ev.argument;
853 kb_action action = ev.action;
855 // We cannot use this function here
856 if (getStatus(ev).disabled()) {
857 lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
858 << lyxaction.getActionName(action)
859 << " [" << action << "] is disabled at this location"
861 setErrorMessage(getStatusMessage());
862 goto exit_with_message;
865 if (view()->available())
866 view()->hideCursor();
868 if (view()->available() && view()->theLockingInset()) {
869 InsetOld::RESULT result;
870 if (action > 1 || (action == LFUN_UNKNOWN_ACTION &&
873 UpdatableInset * inset = view()->theLockingInset();
877 inset->getCursorPos(view(), inset_x, dummy_y);
879 if ((action == LFUN_UNKNOWN_ACTION)
880 && argument.empty()) {
881 argument = encoded_last_key;
884 // the insets can't try to handle this,
885 // a table cell in the dummy position will
886 // lock its insettext, the insettext will
887 // pass it the bufferview, and succeed,
888 // so it will stay not locked. Not good
889 // if we've just done LFUN_ESCAPE (which
890 // injects an LFUN_PARAGRAPH_UPDATE)
891 if (action == LFUN_PARAGRAPH_UPDATE) {
892 view()->dispatch(ev);
893 goto exit_with_message;
896 // Undo/Redo is a bit tricky for insets.
897 if (action == LFUN_UNDO) {
899 goto exit_with_message;
900 } else if (action == LFUN_REDO) {
902 goto exit_with_message;
903 } else if (((result=inset->
904 // Hand-over to inset's own dispatch:
905 localDispatch(FuncRequest(view(), action, argument))) ==
907 (result == DISPATCHED_NOUPDATE))
908 goto exit_with_message;
909 // If UNDISPATCHED, just soldier on
910 else if (result == FINISHED) {
911 owner->clearMessage();
912 goto exit_with_message;
913 // We do not need special RTL handling here:
914 // FINISHED means that the cursor should be
915 // one position after the inset.
916 } else if (result == FINISHED_RIGHT) {
917 view()->text->cursorRight(view());
919 owner->clearMessage();
920 goto exit_with_message;
921 } else if (result == FINISHED_UP) {
922 RowList::iterator const irow = view()->text->cursorIRow();
923 if (irow != view()->text->firstRow()) {
925 view()->text->setCursorFromCoordinates(
926 view()->text->cursor.x() + inset_x,
927 view()->text->cursor.y() -
928 irow->baseline() - 1);
929 view()->text->cursor.x_fix(view()->text->cursor.x());
931 view()->text->cursorUp(view());
937 owner->clearMessage();
938 goto exit_with_message;
939 } else if (result == FINISHED_DOWN) {
940 RowList::iterator const irow = view()->text->cursorIRow();
941 if (irow != view()->text->lastRow()) {
943 view()->text->setCursorFromCoordinates(
944 view()->text->cursor.x() + inset_x,
945 view()->text->cursor.y() -
948 view()->text->cursor.x_fix(view()->text->cursor.x());
950 view()->text->cursorDown(view());
953 view()->text->cursorRight(view());
956 owner->clearMessage();
957 goto exit_with_message;
959 #warning I am not sure this is still right, please have a look! (Jug 20020417)
960 else { // result == UNDISPATCHED
961 //setMessage(N_("Text mode"));
963 case LFUN_UNKNOWN_ACTION:
964 case LFUN_BREAKPARAGRAPH:
966 view()->text->cursorRight(view());
967 view()->switchKeyMap();
968 owner->view_state_changed();
971 if (!view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
972 view()->text->cursorRight(view());
974 owner->view_state_changed();
976 goto exit_with_message;
978 if (view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
979 view()->text->cursorRight(view());
981 owner->view_state_changed();
983 goto exit_with_message;
985 if (view()->text->cursorRow() != view()->text->lastRow())
986 view()->text->cursorDown(view());
988 view()->text->cursorRight(view());
990 owner->view_state_changed();
991 goto exit_with_message;
1002 if (!view()->available())
1004 // this function should be used always [asierra060396]
1005 UpdatableInset * tli = view()->theLockingInset();
1007 UpdatableInset * lock = tli->getLockingInset();
1010 view()->unlockInset(tli);
1011 view()->text->cursorRight(view());
1013 owner->view_state_changed();
1015 tli->unlockInsetInInset(view(), lock, true);
1018 // Tell the paragraph dialog that we changed paragraph
1019 dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
1024 case LFUN_WORDFINDFORWARD:
1025 case LFUN_WORDFINDBACKWARD: {
1026 static string last_search;
1027 string searched_string;
1029 if (!argument.empty()) {
1030 last_search = argument;
1031 searched_string = argument;
1033 searched_string = last_search;
1035 bool fw = (action == LFUN_WORDFINDFORWARD);
1036 if (!searched_string.empty())
1037 lyx::find::find(view(), searched_string, fw);
1042 if (view()->available() && !view()->theLockingInset())
1044 owner->message(keyseq.printOptions());
1047 // --- Misc -------------------------------------------
1048 case LFUN_EXEC_COMMAND:
1049 owner->focus_command_buffer();
1054 meta_fake_bit = key_modifier::none;
1055 if (view()->available())
1056 // cancel any selection
1057 dispatch(LFUN_MARK_OFF);
1058 setMessage(N_("Cancel"));
1061 case LFUN_META_FAKE:
1062 meta_fake_bit = key_modifier::alt;
1063 setMessage(keyseq.print());
1066 case LFUN_READ_ONLY_TOGGLE:
1067 if (owner->buffer()->lyxvc.inUse())
1068 owner->buffer()->lyxvc.toggleReadOnly();
1070 owner->buffer()->setReadonly(
1071 !owner->buffer()->isReadonly());
1074 case LFUN_CENTER: // this is center and redraw.
1078 // --- Menus -----------------------------------------------
1080 menuNew(argument, false);
1083 case LFUN_MENUNEWTMPLT:
1084 menuNew(argument, true);
1087 case LFUN_CLOSEBUFFER:
1091 case LFUN_MENUWRITE:
1092 if (!owner->buffer()->isUnnamed()) {
1093 string const str = bformat(_("Saving document %1$s..."),
1094 MakeDisplayPath(owner->buffer()->fileName()));
1095 owner->message(str);
1096 MenuWrite(owner->buffer());
1097 owner->message(str + _(" done."));
1099 WriteAs(owner->buffer());
1103 WriteAs(owner->buffer(), argument);
1106 case LFUN_MENURELOAD: {
1107 string const file = MakeDisplayPath(view()->buffer()->fileName(), 20);
1108 string text = bformat(_("Any changes will be lost. Are you sure "
1109 "you want to revert to the saved version of the document %1$s?"), file);
1110 int const ret = Alert::prompt(_("Revert to saved document?"),
1111 text, 0, 1, _("&Revert"), _("&Cancel"));
1119 Exporter::Export(owner->buffer(), argument, true);
1120 view()->showErrorList(BufferFormat(*owner->buffer()));
1124 Exporter::Preview(owner->buffer(), argument);
1125 view()->showErrorList(BufferFormat(*owner->buffer()));
1128 case LFUN_BUILDPROG:
1129 Exporter::Export(owner->buffer(), "program", true);
1130 view()->showErrorList(_("Build"));
1133 case LFUN_RUNCHKTEX:
1134 owner->buffer()->runChktex();
1135 view()->showErrorList(_("ChkTeX"));
1139 if (argument == "custom")
1140 owner->getDialogs().showSendto();
1142 Exporter::Export(owner->buffer(), argument, false);
1143 view()->showErrorList(BufferFormat(*owner->buffer()));
1157 InsetCommandParams p("tableofcontents");
1158 string const data = InsetCommandMailer::params2string("toc", p);
1159 owner->getDialogs().show("toc", data, 0);
1175 case LFUN_DEPTH_MIN:
1176 changeDepth(view(), view()->getLyXText(), DEC_DEPTH, false);
1177 owner->view_state_changed();
1180 case LFUN_DEPTH_PLUS:
1181 changeDepth(view(), view()->getLyXText(), INC_DEPTH, false);
1182 owner->view_state_changed();
1185 case LFUN_FREEFONT_APPLY:
1186 apply_freefont(view());
1189 case LFUN_FREEFONT_UPDATE:
1190 update_and_apply_freefont(view(), argument);
1193 case LFUN_RECONFIGURE:
1194 Reconfigure(view());
1198 case LFUN_FLOATSOPERATE:
1199 if (argument == "openfoot")
1200 view()->allFloats(1,0);
1201 else if (argument == "closefoot")
1202 view()->allFloats(0,0);
1203 else if (argument == "openfig")
1204 view()->allFloats(1,1);
1205 else if (argument == "closefig")
1206 view()->allFloats(0,1);
1209 #ifdef WITH_WARNINGS
1210 //#warning Find another implementation here (or another lyxfunc)!
1213 case LFUN_HELP_OPEN:
1215 string const arg = argument;
1217 setErrorMessage(N_("Missing argument"));
1220 string const fname = i18nLibFileSearch("doc", arg, "lyx");
1221 if (fname.empty()) {
1222 lyxerr << "LyX: unable to find documentation file `"
1223 << arg << "'. Bad installation?" << endl;
1226 owner->message(bformat(_("Opening help file %1$s..."),
1227 MakeDisplayPath(fname)));
1228 view()->loadLyXFile(fname, false);
1232 // --- version control -------------------------------
1233 case LFUN_VC_REGISTER:
1235 if (!ensureBufferClean(view()))
1237 if (!owner->buffer()->lyxvc.inUse()) {
1238 owner->buffer()->lyxvc.registrer();
1244 case LFUN_VC_CHECKIN:
1246 if (!ensureBufferClean(view()))
1248 if (owner->buffer()->lyxvc.inUse()
1249 && !owner->buffer()->isReadonly()) {
1250 owner->buffer()->lyxvc.checkIn();
1256 case LFUN_VC_CHECKOUT:
1258 if (!ensureBufferClean(view()))
1260 if (owner->buffer()->lyxvc.inUse()
1261 && owner->buffer()->isReadonly()) {
1262 owner->buffer()->lyxvc.checkOut();
1268 case LFUN_VC_REVERT:
1270 owner->buffer()->lyxvc.revert();
1277 owner->buffer()->lyxvc.undoLast();
1282 // --- buffers ----------------------------------------
1284 case LFUN_SWITCHBUFFER:
1285 view()->buffer(bufferlist.getBuffer(argument));
1289 NewFile(view(), argument);
1292 case LFUN_FILE_OPEN:
1296 case LFUN_LAYOUT_TABULAR:
1297 if (view()->theLockingInset()) {
1298 if (view()->theLockingInset()->lyxCode()== InsetOld::TABULAR_CODE) {
1299 InsetTabular * inset = static_cast<InsetTabular *>
1300 (view()->theLockingInset());
1301 inset->openLayoutDialog(view());
1302 } else if (view()->theLockingInset()->
1303 getFirstLockingInsetOfType(InsetOld::TABULAR_CODE)!=0) {
1304 InsetTabular * inset = static_cast<InsetTabular *>(
1305 view()->theLockingInset()->getFirstLockingInsetOfType(InsetOld::TABULAR_CODE));
1306 inset->openLayoutDialog(view());
1311 case LFUN_DROP_LAYOUTS_CHOICE:
1312 owner->getToolbar().openLayoutList();
1315 case LFUN_MENU_OPEN_BY_NAME:
1316 owner->getMenubar().openByName(argument);
1317 break; // RVDK_PATCH_5
1319 // --- lyxserver commands ----------------------------
1323 setMessage(owner->buffer()->fileName());
1324 lyxerr[Debug::INFO] << "FNAME["
1325 << owner->buffer()->fileName()
1331 dispatch_buffer = keyseq.print();
1332 lyxserver->notifyClient(dispatch_buffer);
1336 case LFUN_GOTOFILEROW:
1340 istringstream istr(argument.c_str());
1341 istr >> file_name >> row;
1342 // Must replace extension of the file to be .lyx and get full path
1343 string const s(ChangeExtension(file_name, ".lyx"));
1345 // Either change buffer or load the file
1346 if (bufferlist.exists(s)) {
1347 view()->buffer(bufferlist.getBuffer(s));
1349 view()->loadLyXFile(s);
1352 view()->setCursorFromRow(row);
1355 // see BufferView_pimpl::center()
1356 view()->updateScrollbar();
1360 case LFUN_GOTO_PARAGRAPH:
1362 istringstream istr(argument.c_str());
1366 ParIterator par = owner->buffer()->getParFromID(id);
1367 if (par == owner->buffer()->par_iterator_end()) {
1368 lyxerr[Debug::INFO] << "No matching paragraph found! ["
1369 << id << ']' << endl;
1372 lyxerr[Debug::INFO] << "Paragraph " << par->id()
1373 << " found." << endl;
1376 if (view()->theLockingInset())
1377 view()->unlockInset(view()->theLockingInset());
1378 if (par->inInset()) {
1379 FuncRequest cmd(view(), LFUN_INSET_EDIT, "left");
1380 par->inInset()->localDispatch(cmd);
1383 view()->getLyXText()->setCursor(par.pit(), 0);
1384 view()->switchKeyMap();
1385 owner->view_state_changed();
1388 // see BufferView_pimpl::center()
1389 view()->updateScrollbar();
1393 // --- insert characters ----------------------------------------
1395 // --- Mathed stuff. If we are here, there is no locked inset yet.
1396 case LFUN_MATH_EXTERN:
1397 case LFUN_MATH_NUMBER:
1398 case LFUN_MATH_NONUMBER:
1399 case LFUN_MATH_LIMITS:
1401 setErrorMessage(N_("This is only allowed in math mode!"));
1405 // passthrough hat and underscore outside mathed:
1406 case LFUN_SUBSCRIPT:
1407 dispatch(FuncRequest(view(), LFUN_SELFINSERT, "_"));
1409 case LFUN_SUPERSCRIPT:
1410 dispatch(FuncRequest(view(), LFUN_SELFINSERT, "^"));
1413 case LFUN_DIALOG_SHOW: {
1414 string const name = ev.getArg(0);
1415 string data = trim(ev.argument.substr(name.size()));
1417 if (name == "character") {
1418 data = freefont2string();
1420 owner->getDialogs().show("character", data);
1421 } else if (name == "document")
1422 owner->getDialogs().showDocument();
1423 else if (name == "findreplace")
1424 owner->getDialogs().showSearch();
1425 else if (name == "forks")
1426 owner->getDialogs().showForks();
1427 else if (name == "preamble")
1428 owner->getDialogs().showPreamble();
1429 else if (name == "preferences")
1430 owner->getDialogs().showPreferences();
1431 else if (name == "print")
1432 owner->getDialogs().showPrint();
1433 else if (name == "spellchecker")
1434 owner->getDialogs().showSpellchecker();
1436 owner->getDialogs().show(name, data);
1440 case LFUN_DIALOG_SHOW_NEW_INSET: {
1441 string const & name = argument;
1443 if (name == "bibitem" ||
1444 name == "include" ||
1449 InsetCommandParams p(name);
1450 data = InsetCommandMailer::params2string(name, p);
1451 } else if (name == "bibtex") {
1452 InsetBibtexParams p;
1453 Buffer const & buffer = *owner->buffer();
1454 data = InsetBibtexMailer::params2string(p, buffer);
1455 } else if (name == "citation") {
1456 InsetCommandParams p("cite");
1457 data = InsetCommandMailer::params2string(name, p);
1459 owner->getDialogs().show(name, data, 0);
1463 case LFUN_DIALOG_SHOW_NEXT_INSET: {
1467 case LFUN_DIALOG_UPDATE: {
1468 string const & name = argument;
1469 // Can only update a dialog connected to an existing inset
1470 InsetBase * inset = owner->getDialogs().getOpenInset(name);
1472 FuncRequest fr(view(), LFUN_INSET_DIALOG_UPDATE,
1474 inset->localDispatch(fr);
1475 } else if (name == "paragraph") {
1476 dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
1481 case LFUN_DIALOG_HIDE:
1482 Dialogs::hide(argument, 0);
1485 case LFUN_DIALOG_DISCONNECT_INSET:
1486 owner->getDialogs().disconnect(argument);
1489 case LFUN_CHILDOPEN:
1491 string const filename =
1492 MakeAbsPath(argument,
1493 owner->buffer()->filePath());
1494 setMessage(N_("Opening child document ") +
1495 MakeDisplayPath(filename) + "...");
1496 view()->savePosition(0);
1497 if (bufferlist.exists(filename))
1498 view()->buffer(bufferlist.getBuffer(filename));
1500 view()->loadLyXFile(filename);
1504 case LFUN_TOGGLECURSORFOLLOW:
1505 lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
1509 owner->getIntl().KeyMapOn(false);
1512 case LFUN_KMAP_PRIM:
1513 owner->getIntl().KeyMapPrim();
1517 owner->getIntl().KeyMapSec();
1520 case LFUN_KMAP_TOGGLE:
1521 owner->getIntl().ToggleKeyMap();
1526 // argument contains ';'-terminated commands
1527 while (!argument.empty()) {
1529 argument = split(argument, first, ';');
1535 case LFUN_SAVEPREFERENCES:
1537 Path p(user_lyxdir());
1538 lyxrc.write("preferences");
1542 case LFUN_SCREEN_FONT_UPDATE:
1544 // handle the screen font changes.
1545 lyxrc.set_font_norm_type();
1546 lyx_gui::update_fonts();
1547 // We also need to empty the textcache so that
1548 // the buffer will be formatted correctly after
1551 // Of course we should only do the resize and the textcache.clear
1552 // if values really changed...but not very important right now. (Lgb)
1553 // All visible buffers will need resize
1559 case LFUN_SET_COLOR:
1562 string const x11_name = split(argument, lyx_name, ' ');
1563 if (lyx_name.empty() || x11_name.empty()) {
1564 setErrorMessage(N_("Syntax: set-color <lyx_name>"
1569 bool const graphicsbg_changed =
1570 (lyx_name == lcolor.getLyXName(LColor::graphicsbg) &&
1571 x11_name != lcolor.getX11Name(LColor::graphicsbg));
1573 if (!lcolor.setColor(lyx_name, x11_name)) {
1575 bformat(_("Set-color \"%1$s\" failed "
1576 "- color is undefined or "
1577 "may not be redefined"), lyx_name));
1581 lyx_gui::update_color(lcolor.getFromLyXName(lyx_name));
1583 if (graphicsbg_changed) {
1584 #ifdef WITH_WARNINGS
1585 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
1588 lyx::graphics::GCache & gc =
1589 lyx::graphics::GCache::get();
1590 gc.changeDisplay(true);
1599 owner->message(argument);
1602 case LFUN_FORKS_KILL:
1604 if (!isStrInt(argument))
1607 pid_t const pid = strToInt(argument);
1608 ForkedcallsController & fcc = ForkedcallsController::get();
1613 case LFUN_TOOLTIPS_TOGGLE:
1614 owner->getDialogs().toggleTooltips();
1617 case LFUN_EXTERNAL_EDIT: {
1619 .localDispatch(FuncRequest(view(), action, argument));
1624 // Then if it was none of the above
1625 // Trying the BufferView::pimpl dispatch:
1626 if (!view()->dispatch(ev))
1627 lyxerr << "A truly unknown func ["
1628 << lyxaction.getActionName(ev.action) << "]!"
1635 view()->owner()->updateLayoutChoice();
1637 if (view()->available()) {
1638 view()->fitCursor();
1640 // If we executed a mutating lfun, mark the buffer as dirty
1641 if (!getStatus(ev).disabled()
1642 && !lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)
1643 && !lyxaction.funcHasFlag(ev.action, LyXAction::ReadOnly))
1644 view()->buffer()->markDirty();
1647 sendDispatchMessage(getMessage(), ev, verbose);
1651 void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose)
1653 owner->updateMenubar();
1654 owner->updateToolbar();
1656 if (ev.action == LFUN_SELFINSERT || !verbose) {
1657 lyxerr[Debug::ACTION] << "dispatch msg is " << msg << endl;
1659 owner->message(msg);
1663 string dispatch_msg = msg;
1664 if (!dispatch_msg.empty())
1665 dispatch_msg += ' ';
1667 string comname = lyxaction.getActionName(ev.action);
1669 int pseudoaction = ev.action;
1670 bool argsadded = false;
1672 if (!ev.argument.empty()) {
1673 // the pseudoaction is useful for the bindings
1674 pseudoaction = lyxaction.searchActionArg(ev.action, ev.argument);
1676 if (pseudoaction == LFUN_UNKNOWN_ACTION) {
1677 pseudoaction = ev.action;
1679 comname += ' ' + ev.argument;
1684 string const shortcuts = toplevel_keymap->findbinding(pseudoaction);
1686 if (!shortcuts.empty()) {
1687 comname += ": " + shortcuts;
1688 } else if (!argsadded && !ev.argument.empty()) {
1689 comname += ' ' + ev.argument;
1692 if (!comname.empty()) {
1693 comname = rtrim(comname);
1694 dispatch_msg += '(' + comname + ')';
1697 lyxerr[Debug::ACTION] << "verbose dispatch msg " << dispatch_msg << endl;
1698 if (!dispatch_msg.empty())
1699 owner->message(dispatch_msg);
1703 void LyXFunc::setupLocalKeymap()
1705 keyseq.stdmap = keyseq.curmap = toplevel_keymap.get();
1706 cancel_meta_seq.stdmap = cancel_meta_seq.curmap = toplevel_keymap.get();
1710 void LyXFunc::menuNew(string const & name, bool fromTemplate)
1712 string initpath = lyxrc.document_path;
1713 string filename(name);
1715 if (view()->available()) {
1716 string const trypath = owner->buffer()->filePath();
1717 // If directory is writeable, use this as default.
1718 if (IsDirWriteable(trypath))
1722 static int newfile_number;
1724 if (filename.empty()) {
1725 filename = AddName(lyxrc.document_path,
1726 "newfile" + tostr(++newfile_number) + ".lyx");
1727 FileInfo fi(filename);
1728 while (bufferlist.exists(filename) || fi.readable()) {
1730 filename = AddName(lyxrc.document_path,
1731 "newfile" + tostr(newfile_number) +
1733 fi.newFile(filename);
1737 // The template stuff
1740 FileDialog fileDlg(_("Select template file"),
1741 LFUN_SELECT_FILE_SYNC,
1742 make_pair(string(_("Documents|#o#O")),
1743 string(lyxrc.document_path)),
1744 make_pair(string(_("Templates|#T#t")),
1745 string(lyxrc.template_path)));
1747 FileDialog::Result result =
1748 fileDlg.open(lyxrc.template_path,
1749 _("*.lyx| LyX Documents (*.lyx)"));
1751 if (result.first == FileDialog::Later)
1754 string const fname = result.second;
1761 view()->newFile(filename, templname, !name.empty());
1765 void LyXFunc::open(string const & fname)
1767 string initpath = lyxrc.document_path;
1769 if (view()->available()) {
1770 string const trypath = owner->buffer()->filePath();
1771 // If directory is writeable, use this as default.
1772 if (IsDirWriteable(trypath))
1778 if (fname.empty()) {
1779 FileDialog fileDlg(_("Select document to open"),
1781 make_pair(string(_("Documents|#o#O")),
1782 string(lyxrc.document_path)),
1783 make_pair(string(_("Examples|#E#e")),
1784 string(AddPath(system_lyxdir(), "examples"))));
1786 FileDialog::Result result =
1787 fileDlg.open(initpath,
1788 _("*.lyx| LyX Documents (*.lyx)"));
1790 if (result.first == FileDialog::Later)
1793 filename = result.second;
1795 // check selected filename
1796 if (filename.empty()) {
1797 owner->message(_("Canceled."));
1803 // get absolute path of file and add ".lyx" to the filename if
1805 string const fullpath = FileSearch(string(), filename, "lyx");
1806 if (!fullpath.empty()) {
1807 filename = fullpath;
1810 string const disp_fn(MakeDisplayPath(filename));
1812 // if the file doesn't exist, let the user create one
1813 FileInfo const f(filename, true);
1815 // the user specifically chose this name. Believe them.
1816 view()->newFile(filename, "", true);
1820 owner->message(bformat(_("Opening document %1$s..."), disp_fn));
1823 if (view()->loadLyXFile(filename)) {
1824 str2 = bformat(_("Document %1$s opened."), disp_fn);
1826 str2 = bformat(_("Could not open document %1$s"), disp_fn);
1828 owner->message(str2);
1832 void LyXFunc::doImport(string const & argument)
1835 string filename = split(argument, format, ' ');
1837 lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format
1838 << " file: " << filename << endl;
1840 // need user interaction
1841 if (filename.empty()) {
1842 string initpath = lyxrc.document_path;
1844 if (view()->available()) {
1845 string const trypath = owner->buffer()->filePath();
1846 // If directory is writeable, use this as default.
1847 if (IsDirWriteable(trypath))
1851 string const text = bformat(_("Select %1$s file to import"),
1852 formats.prettyName(format));
1854 FileDialog fileDlg(text,
1856 make_pair(string(_("Documents|#o#O")),
1857 string(lyxrc.document_path)),
1858 make_pair(string(_("Examples|#E#e")),
1859 string(AddPath(system_lyxdir(), "examples"))));
1861 string const extension = "*." + formats.extension(format)
1862 + "| " + formats.prettyName(format)
1863 + " (*." + formats.extension(format) + ')';
1865 FileDialog::Result result = fileDlg.open(initpath,
1868 if (result.first == FileDialog::Later)
1871 filename = result.second;
1873 // check selected filename
1874 if (filename.empty())
1875 owner->message(_("Canceled."));
1878 if (filename.empty())
1881 // get absolute path of file
1882 filename = MakeAbsPath(filename);
1884 string const lyxfile = ChangeExtension(filename, ".lyx");
1886 // Check if the document already is open
1887 if (lyx_gui::use_gui && bufferlist.exists(lyxfile)) {
1888 if (!bufferlist.close(bufferlist.getBuffer(lyxfile), true)) {
1889 owner->message(_("Canceled."));
1894 // if the file exists already, and we didn't do
1895 // -i lyx thefile.lyx, warn
1896 if (FileInfo(lyxfile, true).exist() && filename != lyxfile) {
1897 string const file = MakeDisplayPath(lyxfile, 30);
1899 string text = bformat(_("The document %1$s already exists.\n\n"
1900 "Do you want to over-write that document?"), file);
1901 int const ret = Alert::prompt(_("Over-write document?"),
1902 text, 0, 1, _("&Over-write"), _("&Cancel"));
1905 owner->message(_("Canceled."));
1910 Importer::Import(owner, filename, format);
1914 void LyXFunc::closeBuffer()
1916 if (bufferlist.close(owner->buffer(), true) && !quitting) {
1917 if (bufferlist.empty()) {
1918 // need this otherwise SEGV may occur while
1919 // trying to set variables that don't exist
1920 // since there's no current buffer
1921 owner->getDialogs().hideBufferDependent();
1923 view()->buffer(bufferlist.first());
1929 // Each "owner" should have it's own message method. lyxview and
1930 // the minibuffer would use the minibuffer, but lyxserver would
1931 // send an ERROR signal to its client. Alejandro 970603
1932 // This func is bit problematic when it comes to NLS, to make the
1933 // lyx servers client be language indepenent we must not translate
1934 // strings sent to this func.
1935 void LyXFunc::setErrorMessage(string const & m) const
1937 dispatch_buffer = m;
1942 void LyXFunc::setMessage(string const & m) const
1944 dispatch_buffer = m;
1948 void LyXFunc::setStatusMessage(string const & m) const
1954 string const LyXFunc::view_status_message()
1956 // When meta-fake key is pressed, show the key sequence so far + "M-".
1958 return keyseq.print() + "M-";
1961 // Else, when a non-complete key sequence is pressed,
1962 // show the available options.
1963 if (keyseq.length() > 0 && !keyseq.deleted()) {
1964 return keyseq.printOptions();
1967 if (!view()->available())
1968 return _("Welcome to LyX!");
1970 return currentState(view());
1974 BufferView * LyXFunc::view() const
1977 return owner->view().get();
1981 bool LyXFunc::wasMetaKey() const
1983 return (meta_fake_bit != key_modifier::none);