1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2001 The LyX Team.
9 * ====================================================== */
17 #include "bufferlist.h"
18 #include "BufferView.h"
19 #include "lyxserver.h"
23 #include "LyXAction.h"
29 #include "trans_mgr.h"
32 #include "bufferview_funcs.h"
33 #include "frontends/LyXView.h"
34 #include "frontends/lyx_gui.h"
36 #include "FloatList.h"
40 #include "TextCache.h"
42 #include "undo_funcs.h"
43 #include "ParagraphParameters.h"
45 #include "insets/insetcommand.h"
46 #include "insets/insettabular.h"
48 #include "mathed/formulamacro.h"
49 #include "mathed/math_cursor.h"
50 #include "mathed/math_inset.h"
52 #include "frontends/FileDialog.h"
53 #include "frontends/Dialogs.h"
54 #include "frontends/Toolbar.h"
55 #include "frontends/Menubar.h"
56 #include "frontends/Alert.h"
58 #include "graphics/GraphicsCache.h"
60 #include "support/lyxalgo.h"
61 #include "support/LAssert.h"
62 #include "support/filetools.h"
63 #include "support/FileInfo.h"
64 #include "support/forkedcontr.h"
65 #include "support/lstrings.h"
66 #include "support/path.h"
67 #include "support/lyxfunctional.h"
69 #include "support/BoostFormat.h"
85 using std::back_inserter;
86 using namespace bv_funcs;
88 extern BufferList bufferlist;
89 extern LyXServer * lyxserver;
90 extern bool selection_possible;
92 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
95 extern tex_accent_struct get_accent(kb_action action);
97 extern void ShowLatexLog();
100 LyXFunc::LyXFunc(LyXView * o)
103 keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
104 cancel_meta_seq(toplevel_keymap.get(), toplevel_keymap.get()),
105 meta_fake_bit(key_modifier::none)
111 LyXText * LyXFunc::TEXT(bool flag = true) const
115 return view()->getLyXText();
120 void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
122 if (selecting || TEXT(flag)->selection.mark()) {
123 TEXT(flag)->setSelection();
124 if (!TEXT(flag)->isInInset())
125 view()->toggleToggle();
127 view()->update(TEXT(flag), BufferView::SELECT);
128 view()->showCursor();
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, TEXT(false));
144 // Need to clear, in case the minibuffer calls these
147 // copied verbatim from do_accent_char
148 view()->update(TEXT(false), BufferView::SELECT);
149 TEXT(false)->selection.cursor = TEXT(false)->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 = !Exporter::IsExportable(buf, "dvi")
323 || lyxrc.print_command == "none";
326 disable = ev.argument != "custom"
327 && !Exporter::IsExportable(buf, ev.argument);
330 disable = buf->undostack.empty();
333 disable = buf->redostack.empty();
338 UpdatableInset * in = tli;
339 if (in->lyxCode() != Inset::TABULAR_CODE) {
340 in = tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE);
342 if (in && static_cast<InsetTabular*>(in)->hasSelection()) {
347 disable = !mathcursor && !view()->getLyXText()->selection.set();
350 disable = !buf->isLatex() || lyxrc.chktex_command == "none";
353 disable = !Exporter::IsExportable(buf, "program");
356 case LFUN_LAYOUT_CHARACTER:
357 disable = tli && tli->lyxCode() == Inset::ERT_CODE;
360 case LFUN_LAYOUT_TABULAR:
362 || (tli->lyxCode() != Inset::TABULAR_CODE
363 && !tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
367 disable = !changeDepth(view(), TEXT(false), DEC_DEPTH, true);
370 case LFUN_DEPTH_PLUS:
371 disable = !changeDepth(view(), TEXT(false), INC_DEPTH, true);
375 case LFUN_LAYOUT_PARAGRAPH: {
376 Inset * inset = TEXT(false)->cursor.par()->inInset();
377 disable = inset && inset->forceDefaultParagraphs(inset);
381 case LFUN_INSET_OPTARG:
382 disable = (TEXT(false)->cursor.par()->layout()->optionalargs == 0);
385 case LFUN_TABULAR_FEATURE:
388 // FIXME: check temporarily disabled
390 char align = mathcursor->valign();
395 if (ev.argument.empty()) {
399 if (!contains("tcb", ev.argument[0])) {
403 flag.setOnOff(ev.argument[0] == align);
407 char align = mathcursor->halign();
412 if (ev.argument.empty()) {
416 if (!contains("lcr", ev.argument[0])) {
420 flag.setOnOff(ev.argument[0] == align);
423 disable = !mathcursor->halign();
429 //ret.disabled(true);
430 if (tli->lyxCode() == Inset::TABULAR_CODE) {
431 ret = static_cast<InsetTabular *>(tli)
432 ->getStatus(ev.argument);
433 } else if (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
434 ret = static_cast<InsetTabular *>
435 (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE))
436 ->getStatus(ev.argument);
441 static InsetTabular inset(*owner->buffer(), 1, 1);
445 ret = inset.getStatus(ev.argument);
446 if (ret.onoff(true) || ret.onoff(false))
447 flag.setOnOff(false);
451 case LFUN_VC_REGISTER:
452 disable = buf->lyxvc.inUse();
454 case LFUN_VC_CHECKIN:
455 disable = !buf->lyxvc.inUse() || buf->isReadonly();
457 case LFUN_VC_CHECKOUT:
458 disable = !buf->lyxvc.inUse() || !buf->isReadonly();
462 case LFUN_VC_HISTORY:
463 disable = !buf->lyxvc.inUse();
465 case LFUN_MENURELOAD:
466 disable = buf->isUnnamed() || buf->isClean();
468 case LFUN_BOOKMARK_GOTO:
470 isSavedPosition(strToUnsignedInt(ev.argument));
472 case LFUN_MERGE_CHANGES:
473 case LFUN_ACCEPT_CHANGE:
474 case LFUN_REJECT_CHANGE:
475 case LFUN_ACCEPT_ALL_CHANGES:
476 case LFUN_REJECT_ALL_CHANGES:
477 disable = !buf->params.tracking_changes;
479 case LFUN_INSET_TOGGLE: {
480 LyXText * lt = view()->getLyXText();
481 disable = !(isEditableInset(lt->getInset())
483 && lt->inset_owner->owner()
484 && lt->inset_owner->owner()->isOpen()));
488 disable = !IsFileReadable(buf->getLogName().second);
491 case LFUN_MATH_MUTATE:
493 //flag.setOnOff(mathcursor->formula()->hullType() == ev.argument);
494 flag.setOnOff(false);
499 // we just need to be in math mode to enable that
501 case LFUN_MATH_SPACE:
502 case LFUN_MATH_LIMITS:
503 case LFUN_MATH_NONUMBER:
504 case LFUN_MATH_NUMBER:
505 case LFUN_MATH_EXTERN:
506 disable = !mathcursor;
513 // the functions which insert insets
514 Inset::Code code = Inset::NO_CODE;
516 case LFUN_DIALOG_SHOW_NEW_INSET:
517 if (ev.argument == "bibitem")
518 code = Inset::BIBITEM_CODE;
519 else if (ev.argument == "bibtex")
520 code = Inset::BIBTEX_CODE;
521 else if (ev.argument == "citation")
522 code = Inset::CITE_CODE;
523 else if (ev.argument == "ert")
524 code = Inset::ERT_CODE;
525 else if (ev.argument == "external")
526 code = Inset::EXTERNAL_CODE;
527 else if (ev.argument == "float")
528 code = Inset::FLOAT_CODE;
529 else if (ev.argument == "graphics")
530 code = Inset::GRAPHICS_CODE;
531 else if (ev.argument == "include")
532 code = Inset::INCLUDE_CODE;
533 else if (ev.argument == "index")
534 code = Inset::INDEX_CODE;
535 else if (ev.argument == "label")
536 code = Inset::LABEL_CODE;
537 else if (ev.argument == "minipage")
538 code = Inset::MINIPAGE_CODE;
539 else if (ev.argument == "ref")
540 code = Inset::REF_CODE;
541 else if (ev.argument == "toc")
542 code = Inset::TOC_CODE;
543 else if (ev.argument == "url")
544 code = Inset::URL_CODE;
545 else if (ev.argument == "wrap")
546 code = Inset::WRAP_CODE;
550 code = Inset::ERT_CODE;
552 case LFUN_INSET_FOOTNOTE:
553 code = Inset::FOOT_CODE;
555 case LFUN_TABULAR_INSERT:
556 code = Inset::TABULAR_CODE;
558 case LFUN_INSET_MARGINAL:
559 code = Inset::MARGIN_CODE;
561 case LFUN_INSET_MINIPAGE:
562 code = Inset::MINIPAGE_CODE;
564 case LFUN_INSET_FLOAT:
565 case LFUN_INSET_WIDE_FLOAT:
566 code = Inset::FLOAT_CODE;
568 case LFUN_INSET_WRAP:
569 code = Inset::WRAP_CODE;
571 case LFUN_FLOAT_LIST:
572 code = Inset::FLOAT_LIST_CODE;
575 case LFUN_INSET_LIST:
576 code = Inset::LIST_CODE;
578 case LFUN_INSET_THEOREM:
579 code = Inset::THEOREM_CODE;
582 case LFUN_INSET_CAPTION:
583 code = Inset::CAPTION_CODE;
585 case LFUN_INSERT_NOTE:
586 code = Inset::NOTE_CODE;
588 case LFUN_INSERT_LABEL:
589 code = Inset::LABEL_CODE;
591 case LFUN_INSET_OPTARG:
592 code = Inset::OPTARG_CODE;
594 case LFUN_ENVIRONMENT_INSERT:
595 code = Inset::MINIPAGE_CODE;
597 case LFUN_INDEX_INSERT:
598 code = Inset::INDEX_CODE;
600 case LFUN_INDEX_PRINT:
601 code = Inset::INDEX_PRINT_CODE;
603 case LFUN_TOC_INSERT:
604 code = Inset::TOC_CODE;
606 case LFUN_PARENTINSERT:
607 code = Inset::PARENT_CODE;
611 code = Inset::URL_CODE;
614 // always allow this, since we will inset a raw quote
615 // if an inset is not allowed.
617 case LFUN_HYPHENATION:
618 case LFUN_LIGATURE_BREAK:
620 case LFUN_MENU_SEPARATOR:
622 case LFUN_END_OF_SENTENCE:
623 code = Inset::SPECIALCHAR_CODE;
625 case LFUN_PROTECTEDSPACE:
626 // slight hack: we know this is allowed in math mode
628 code = Inset::SPECIALCHAR_CODE;
633 if (code != Inset::NO_CODE && tli && !tli->insetAllowed(code))
639 // A few general toggles
641 case LFUN_TOOLTIPS_TOGGLE:
642 flag.setOnOff(owner->getDialogs().tooltipsEnabled());
645 case LFUN_READ_ONLY_TOGGLE:
646 flag.setOnOff(buf->isReadonly());
649 flag.setOnOff(TEXT(false)->cursor.par()->params().startOfAppendix());
651 case LFUN_SWITCHBUFFER:
652 // toggle on the current buffer, but do not toggle off
653 // the other ones (is that a good idea?)
654 if (ev.argument == buf->fileName())
657 case LFUN_TRACK_CHANGES:
658 flag.setOnOff(buf->params.tracking_changes);
664 // the font related toggles
666 LyXFont const & font = TEXT(false)->real_current_font;
669 flag.setOnOff(font.emph() == LyXFont::ON);
672 flag.setOnOff(font.noun() == LyXFont::ON);
675 flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
678 flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
681 flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
684 flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
690 string tc = mathcursor->getLastCode();
693 flag.setOnOff(tc == "mathbf");
696 flag.setOnOff(tc == "mathsf");
699 flag.setOnOff(tc == "mathcal");
702 flag.setOnOff(tc == "mathrm");
705 flag.setOnOff(tc == "mathtt");
708 flag.setOnOff(tc == "mathbb");
711 flag.setOnOff(tc == "mathnormal");
718 // this one is difficult to get right. As a half-baked
719 // solution, we consider only the first action of the sequence
720 if (ev.action == LFUN_SEQUENCE) {
721 // argument contains ';'-terminated commands
722 flag = getStatus(lyxaction.LookupFunc(token(ev.argument, ';', 0)));
729 void LyXFunc::dispatch(string const & s, bool verbose)
731 int const action = lyxaction.LookupFunc(s);
733 if (action == LFUN_UNKNOWN_ACTION) {
735 boost::format fmt(_("Unknown function (%1$s)"));
737 owner->message(fmt.str());
739 string const msg = string(_("Unknown function ("))
746 dispatch(action, verbose);
750 void LyXFunc::dispatch(int ac, bool verbose)
752 dispatch(lyxaction.retrieveActionArg(ac), verbose);
757 void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
759 lyxerr[Debug::ACTION] << "LyXFunc::dispatch: action[" << ev.action
760 <<"] arg[" << ev.argument << ']' << endl;
762 // we have not done anything wrong yet.
764 dispatch_buffer.erase();
766 #ifdef NEW_DISPATCHER
767 // We try do call the most specific dispatcher first:
768 // 1. the lockinginset's dispatch
769 // 2. the bufferview's dispatch
770 // 3. the lyxview's dispatch
773 selection_possible = false;
775 if (view()->available())
776 view()->hideCursor();
778 string argument = ev.argument;
779 kb_action action = ev.action;
781 // We cannot use this function here
782 if (getStatus(ev).disabled()) {
783 lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
784 << lyxaction.getActionName(action)
785 << " [" << action << "] is disabled at this location"
787 setErrorMessage(getStatusMessage());
788 goto exit_with_message;
791 if (view()->available() && view()->theLockingInset()) {
792 Inset::RESULT result;
793 if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
794 (!keyseq.deleted())))
796 UpdatableInset * inset = view()->theLockingInset();
800 inset->getCursorPos(view(), inset_x, dummy_y);
802 if ((action == LFUN_UNKNOWN_ACTION)
803 && argument.empty()) {
804 argument = encoded_last_key;
806 // Undo/Redo is a bit tricky for insets.
807 if (action == LFUN_UNDO) {
809 goto exit_with_message;
810 } else if (action == LFUN_REDO) {
812 goto exit_with_message;
813 } else if (((result=inset->
814 // Hand-over to inset's own dispatch:
815 localDispatch(FuncRequest(view(), action, argument))) ==
817 (result == DISPATCHED_NOUPDATE))
818 goto exit_with_message;
819 // If UNDISPATCHED, just soldier on
820 else if (result == FINISHED) {
821 goto exit_with_message;
822 // We do not need special RTL handling here:
823 // FINISHED means that the cursor should be
824 // one position after the inset.
825 } else if (result == FINISHED_RIGHT) {
826 TEXT()->cursorRight(view());
827 moveCursorUpdate(true, false);
828 owner->view_state_changed();
829 goto exit_with_message;
830 } else if (result == FINISHED_UP) {
831 if (TEXT()->cursor.irow() != TEXT()->rows().begin()) {
833 TEXT()->setCursorFromCoordinates(
834 TEXT()->cursor.ix() + inset_x,
835 TEXT()->cursor.iy() -
836 TEXT()->cursor.irow()->baseline() - 1);
837 TEXT()->cursor.x_fix(TEXT()->cursor.x());
839 TEXT()->cursorUp(view());
841 moveCursorUpdate(true, false);
842 owner->view_state_changed();
844 view()->update(TEXT(), BufferView::SELECT);
846 goto exit_with_message;
847 } else if (result == FINISHED_DOWN) {
848 if (boost::next(TEXT()->cursor.irow()) != TEXT()->rows().end()) {
850 TEXT()->setCursorFromCoordinates(
851 TEXT()->cursor.ix() + inset_x,
852 TEXT()->cursor.iy() -
853 TEXT()->cursor.irow()->baseline() +
854 TEXT()->cursor.irow()->height() + 1);
855 TEXT()->cursor.x_fix(TEXT()->cursor.x());
857 TEXT()->cursorDown(view());
860 TEXT()->cursorRight(view());
862 moveCursorUpdate(true, false);
863 owner->view_state_changed();
864 goto exit_with_message;
866 #warning I am not sure this is still right, please have a look! (Jug 20020417)
867 else { // result == UNDISPATCHED
868 //setMessage(N_("Text mode"));
870 case LFUN_UNKNOWN_ACTION:
871 case LFUN_BREAKPARAGRAPH:
873 TEXT()->cursorRight(view());
874 view()->switchKeyMap();
875 owner->view_state_changed();
878 if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
879 TEXT()->cursorRight(view());
880 moveCursorUpdate(true, false);
881 owner->view_state_changed();
883 goto exit_with_message;
885 if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
886 TEXT()->cursorRight(view());
887 moveCursorUpdate(true, false);
888 owner->view_state_changed();
890 goto exit_with_message;
892 if (boost::next(TEXT()->cursor.row()) != TEXT()->rows().end())
893 TEXT()->cursorDown(view());
895 TEXT()->cursorRight(view());
896 moveCursorUpdate(true, false);
897 owner->view_state_changed();
898 goto exit_with_message;
910 if (!view()->available()) break;
911 // this function should be used always [asierra060396]
912 UpdatableInset * tli =
913 view()->theLockingInset();
915 UpdatableInset * lock = tli->getLockingInset();
918 view()->unlockInset(tli);
919 TEXT()->cursorRight(view());
920 moveCursorUpdate(true, false);
921 owner->view_state_changed();
923 tli->unlockInsetInInset(view(),
928 // Tell the paragraph dialog that we changed paragraph
929 dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
934 // --- Misc -------------------------------------------
935 case LFUN_WORDFINDFORWARD :
936 case LFUN_WORDFINDBACKWARD : {
937 static string last_search;
938 string searched_string;
940 if (!argument.empty()) {
941 last_search = argument;
942 searched_string = argument;
944 searched_string = last_search;
946 bool fw = (action == LFUN_WORDFINDFORWARD);
947 if (!searched_string.empty()) {
948 lyxfind::LyXFind(view(), searched_string, fw);
950 // view()->showCursor();
956 if (view()->available() && !view()->theLockingInset()) {
957 view()->update(TEXT(), BufferView::SELECT);
959 owner->message(keyseq.printOptions());
963 // --- Misc -------------------------------------------
964 case LFUN_EXEC_COMMAND:
965 owner->focus_command_buffer();
968 case LFUN_CANCEL: // RVDK_PATCH_5
970 meta_fake_bit = key_modifier::none;
971 if (view()->available())
972 // cancel any selection
973 dispatch(LFUN_MARK_OFF);
974 setMessage(N_("Cancel"));
977 case LFUN_META_FAKE: // RVDK_PATCH_5
979 meta_fake_bit = key_modifier::alt;
980 setMessage(keyseq.print());
984 case LFUN_READ_ONLY_TOGGLE:
985 if (owner->buffer()->lyxvc.inUse()) {
986 owner->buffer()->lyxvc.toggleReadOnly();
988 owner->buffer()->setReadonly(
989 !owner->buffer()->isReadonly());
993 case LFUN_CENTER: // this is center and redraw.
997 // --- Menus -----------------------------------------------
999 menuNew(argument, false);
1002 case LFUN_MENUNEWTMPLT:
1003 menuNew(argument, true);
1006 case LFUN_CLOSEBUFFER:
1010 case LFUN_MENUWRITE:
1011 if (!owner->buffer()->isUnnamed()) {
1013 #if USE_BOOST_FORMAT
1014 s1 << boost::format(_("Saving document %1$s..."))
1015 % MakeDisplayPath(owner->buffer()->fileName());
1017 s1 << _("Saving document ")
1018 << MakeDisplayPath(owner->buffer()->fileName())
1021 owner->message(STRCONV(s1.str()));
1022 MenuWrite(view(), owner->buffer());
1024 owner->message(STRCONV(s1.str()));
1026 WriteAs(view(), owner->buffer());
1030 WriteAs(view(), owner->buffer(), argument);
1033 case LFUN_MENURELOAD: {
1034 string const file = MakeDisplayPath(view()->buffer()->fileName(), 20);
1035 #if USE_BOOST_FORMAT
1036 boost::format fmt(_("Any changes will be lost. Are you sure you want to revert to the saved version of the document %1$s?"));
1038 string text = fmt.str();
1040 string text = _("Any changes will be lost. Are you sure you want to revert to the saved version of the document");
1041 text += file + _("?");
1043 int const ret = Alert::prompt(_("Revert to saved document?"),
1044 text, 1, _("&Revert"), _("&Cancel"));
1052 Exporter::Export(owner->buffer(), argument, true);
1056 Exporter::Preview(owner->buffer(), argument);
1059 case LFUN_BUILDPROG:
1060 Exporter::Export(owner->buffer(), "program", true);
1063 case LFUN_RUNCHKTEX:
1064 owner->buffer()->runChktex();
1067 case LFUN_MENUPRINT:
1068 owner->getDialogs().showPrint();
1072 if (argument == "custom")
1073 owner->getDialogs().showSendto();
1075 Exporter::Export(owner->buffer(), argument, false);
1088 InsetCommandParams p("tableofcontents");
1089 string const data = InsetCommandMailer::params2string("toc", p);
1090 owner->getDialogs().show("toc", data, 0);
1106 case LFUN_MENUSEARCH:
1107 owner->getDialogs().showSearch();
1110 case LFUN_REMOVEERRORS:
1111 if (view()->removeAutoInsets()) {
1112 #warning repaint() or update() or nothing ?
1114 view()->fitCursor();
1118 case LFUN_DEPTH_MIN:
1119 changeDepth(view(), TEXT(false), DEC_DEPTH, false);
1122 case LFUN_DEPTH_PLUS:
1123 changeDepth(view(), TEXT(false), INC_DEPTH, false);
1126 case LFUN_FREEFONT_APPLY:
1127 apply_freefont(view());
1130 case LFUN_FREEFONT_UPDATE:
1131 update_and_apply_freefont(view(), argument);
1134 case LFUN_RECONFIGURE:
1135 Reconfigure(view());
1139 case LFUN_FLOATSOPERATE:
1140 if (argument == "openfoot")
1141 view()->allFloats(1,0);
1142 else if (argument == "closefoot")
1143 view()->allFloats(0,0);
1144 else if (argument == "openfig")
1145 view()->allFloats(1,1);
1146 else if (argument == "closefig")
1147 view()->allFloats(0,1);
1150 #ifdef WITH_WARNINGS
1151 //#warning Find another implementation here (or another lyxfunc)!
1154 case LFUN_HELP_ABOUTLYX:
1155 owner->getDialogs().show("about");
1158 case LFUN_HELP_TEXINFO:
1159 owner->getDialogs().showTexinfo();
1162 case LFUN_HELP_OPEN:
1164 string const arg = argument;
1166 setErrorMessage(N_("Missing argument"));
1169 string const fname = i18nLibFileSearch("doc", arg, "lyx");
1170 if (fname.empty()) {
1171 lyxerr << "LyX: unable to find documentation file `"
1172 << arg << "'. Bad installation?" << endl;
1176 #if USE_BOOST_FORMAT
1177 str << boost::format(_("Opening help file %1$s..."))
1178 % MakeDisplayPath(fname);
1180 str << _("Opening help file ")
1181 << MakeDisplayPath(fname) << _("...");
1183 owner->message(STRCONV(str.str()));
1184 view()->buffer(bufferlist.loadLyXFile(fname, false));
1188 // --- version control -------------------------------
1189 case LFUN_VC_REGISTER:
1191 if (!owner->buffer()->lyxvc.inUse())
1192 owner->buffer()->lyxvc.registrer();
1196 case LFUN_VC_CHECKIN:
1198 if (owner->buffer()->lyxvc.inUse()
1199 && !owner->buffer()->isReadonly())
1200 owner->buffer()->lyxvc.checkIn();
1204 case LFUN_VC_CHECKOUT:
1206 if (owner->buffer()->lyxvc.inUse()
1207 && owner->buffer()->isReadonly())
1208 owner->buffer()->lyxvc.checkOut();
1212 case LFUN_VC_REVERT:
1214 owner->buffer()->lyxvc.revert();
1220 owner->buffer()->lyxvc.undoLast();
1224 case LFUN_VC_HISTORY:
1226 owner->getDialogs().show("vclog");
1230 // --- buffers ----------------------------------------
1232 case LFUN_SWITCHBUFFER:
1233 view()->buffer(bufferlist.getBuffer(argument));
1238 // servercmd: argument must be <file>:<template>
1239 Buffer * tmpbuf = NewFile(argument);
1241 view()->buffer(tmpbuf);
1245 case LFUN_FILE_OPEN:
1249 case LFUN_LATEX_LOG:
1250 owner->getDialogs().show("log");
1253 case LFUN_LAYOUT_DOCUMENT:
1254 owner->getDialogs().showDocument();
1257 case LFUN_LAYOUT_CHARACTER: {
1258 string data = freefont2string();
1260 owner->getDialogs().show("character", data);
1264 case LFUN_LAYOUT_TABULAR:
1265 if (view()->theLockingInset()) {
1266 if (view()->theLockingInset()->lyxCode()==Inset::TABULAR_CODE) {
1267 InsetTabular * inset = static_cast<InsetTabular *>
1268 (view()->theLockingInset());
1269 inset->openLayoutDialog(view());
1270 } else if (view()->theLockingInset()->
1271 getFirstLockingInsetOfType(Inset::TABULAR_CODE)!=0) {
1272 InsetTabular * inset = static_cast<InsetTabular *>(
1273 view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
1274 inset->openLayoutDialog(view());
1279 case LFUN_LAYOUT_PREAMBLE:
1280 owner->getDialogs().showPreamble();
1283 case LFUN_DROP_LAYOUTS_CHOICE:
1284 owner->getToolbar().openLayoutList();
1287 case LFUN_MENU_OPEN_BY_NAME:
1288 owner->getMenubar().openByName(argument);
1289 break; // RVDK_PATCH_5
1291 case LFUN_SPELLCHECK:
1292 owner->getDialogs().showSpellchecker();
1295 // --- lyxserver commands ----------------------------
1299 setMessage(owner->buffer()->fileName());
1300 lyxerr[Debug::INFO] << "FNAME["
1301 << owner->buffer()->fileName()
1307 dispatch_buffer = keyseq.print();
1308 lyxserver->notifyClient(dispatch_buffer);
1312 case LFUN_GOTOFILEROW:
1316 istringstream istr(argument.c_str());
1317 istr >> file_name >> row;
1318 // Must replace extension of the file to be .lyx and get full path
1319 string const s(ChangeExtension(file_name, ".lyx"));
1321 // Either change buffer or load the file
1322 if (bufferlist.exists(s)) {
1323 view()->buffer(bufferlist.getBuffer(s));
1325 view()->buffer(bufferlist.loadLyXFile(s));
1328 view()->setCursorFromRow(row);
1331 // see BufferView_pimpl::center()
1332 view()->updateScrollbar();
1336 case LFUN_GOTO_PARAGRAPH:
1338 istringstream istr(argument.c_str());
1342 Paragraph * par = owner->buffer()->getParFromID(id);
1344 lyxerr[Debug::INFO] << "No matching paragraph found! ["
1345 << id << ']' << endl;
1348 lyxerr[Debug::INFO] << "Paragraph " << par->id()
1349 << " found." << endl;
1352 if (view()->theLockingInset())
1353 view()->unlockInset(view()->theLockingInset());
1354 if (par->inInset()) {
1355 par->inInset()->edit(view());
1358 view()->getLyXText()->setCursor(par, 0);
1359 view()->switchKeyMap();
1360 owner->view_state_changed();
1363 // see BufferView_pimpl::center()
1364 view()->updateScrollbar();
1371 int const qa = lyxaction.LookupFunc(argument);
1372 setMessage(lyxaction.helpText(static_cast<kb_action>(qa)));
1376 // --- insert characters ----------------------------------------
1378 // --- Mathed stuff. If we are here, there is no locked inset yet.
1379 case LFUN_MATH_EXTERN:
1380 case LFUN_MATH_NUMBER:
1381 case LFUN_MATH_NONUMBER:
1382 case LFUN_MATH_LIMITS:
1384 setErrorMessage(N_("This is only allowed in math mode!"));
1388 // passthrough hat and underscore outside mathed:
1389 case LFUN_SUBSCRIPT:
1390 dispatch(FuncRequest(view(), LFUN_SELFINSERT, "_"));
1392 case LFUN_SUPERSCRIPT:
1393 dispatch(FuncRequest(view(), LFUN_SELFINSERT, "^"));
1396 case LFUN_MATH_PANEL:
1397 owner->getDialogs().showMathPanel();
1400 case LFUN_DIALOG_SHOW_NEW_INSET: {
1401 string const & name = argument;
1403 if (name == "bibitem" ||
1405 name == "include" ||
1410 InsetCommandParams p(name);
1411 data = InsetCommandMailer::params2string(name, p);
1412 } else if (name == "citation") {
1413 InsetCommandParams p("cite");
1414 data = InsetCommandMailer::params2string(name, p);
1416 owner->getDialogs().show(name, data, 0);
1420 case LFUN_DIALOG_SHOW_NEXT_INSET: {
1424 case LFUN_DIALOG_UPDATE: {
1425 string const & name = argument;
1426 // Can only update a dialog connected to an existing inset
1427 InsetBase * inset = owner->getDialogs().getOpenInset(name);
1429 FuncRequest fr(view(), LFUN_INSET_DIALOG_UPDATE,
1431 inset->localDispatch(fr);
1432 } else if (name == "paragraph") {
1433 dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
1438 case LFUN_DIALOG_HIDE:
1439 Dialogs::hide(argument, 0);
1442 case LFUN_DIALOG_DISCONNECT_INSET:
1443 owner->getDialogs().disconnect(argument);
1446 case LFUN_CHILDOPEN:
1448 string const filename =
1449 MakeAbsPath(argument,
1450 owner->buffer()->filePath());
1451 setMessage(N_("Opening child document ") +
1452 MakeDisplayPath(filename) + "...");
1453 view()->savePosition(0);
1454 if (bufferlist.exists(filename))
1455 view()->buffer(bufferlist.getBuffer(filename));
1457 view()->buffer(bufferlist.loadLyXFile(filename));
1461 case LFUN_TOGGLECURSORFOLLOW:
1462 lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
1466 owner->getIntl().KeyMapOn(false);
1469 case LFUN_KMAP_PRIM:
1470 owner->getIntl().KeyMapPrim();
1474 owner->getIntl().KeyMapSec();
1477 case LFUN_KMAP_TOGGLE:
1478 owner->getIntl().ToggleKeyMap();
1483 // argument contains ';'-terminated commands
1484 while (!argument.empty()) {
1486 argument = split(argument, first, ';');
1492 case LFUN_DIALOG_PREFERENCES:
1493 owner->getDialogs().showPreferences();
1496 case LFUN_SAVEPREFERENCES:
1498 Path p(user_lyxdir);
1499 lyxrc.write("preferences");
1503 case LFUN_SCREEN_FONT_UPDATE:
1505 // handle the screen font changes.
1506 lyxrc.set_font_norm_type();
1507 lyx_gui::update_fonts();
1508 // We also need to empty the textcache so that
1509 // the buffer will be formatted correctly after
1512 // Of course we should only do the resize and the textcache.clear
1513 // if values really changed...but not very important right now. (Lgb)
1514 // All visible buffers will need resize
1520 case LFUN_SET_COLOR:
1523 string const x11_name = split(argument, lyx_name, ' ');
1524 if (lyx_name.empty() || x11_name.empty()) {
1525 setErrorMessage(N_("Syntax: set-color <lyx_name>"
1530 bool const graphicsbg_changed =
1531 (lyx_name == lcolor.getLyXName(LColor::graphicsbg) &&
1532 x11_name != lcolor.getX11Name(LColor::graphicsbg));
1534 if (!lcolor.setColor(lyx_name, x11_name)) {
1535 #if USE_BOOST_FORMAT
1539 _("Set-color \"%1$s\" failed "
1540 "- color is undefined or "
1541 "may not be redefined"))
1544 setErrorMessage(_("Set-color ") + lyx_name
1545 + _(" failed - color is undefined"
1546 " or may not be redefined"));
1552 lyx_gui::update_color(lcolor.getFromLyXName(lyx_name));
1554 if (graphicsbg_changed) {
1555 #ifdef WITH_WARNINGS
1556 #warning FIXME!! The graphics cache no longer has a changeDisplay method.
1559 grfx::GCache & gc = grfx::GCache::get();
1560 gc.changeDisplay(true);
1569 owner->message(argument);
1572 case LFUN_FORKS_SHOW:
1573 owner->getDialogs().showForks();
1576 case LFUN_FORKS_KILL:
1578 if (!isStrInt(argument))
1581 pid_t const pid = strToInt(argument);
1582 ForkedcallsController & fcc = ForkedcallsController::get();
1587 case LFUN_TOOLTIPS_TOGGLE:
1588 owner->getDialogs().toggleTooltips();
1592 // Then if it was none of the above
1593 // Trying the BufferView::pimpl dispatch:
1594 if (!view()->dispatch(ev))
1595 lyxerr << "A truly unknown func ["
1596 << lyxaction.getActionName(ev.action) << "]!"
1603 view()->owner()->updateLayoutChoice();
1605 if (view()->available()) {
1606 view()->fitCursor();
1608 // If we executed a mutating lfun, mark the buffer as dirty
1609 if (!lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)
1610 && !lyxaction.funcHasFlag(ev.action, LyXAction::ReadOnly))
1611 view()->buffer()->markDirty();
1614 sendDispatchMessage(getMessage(), ev, verbose);
1618 void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose)
1620 owner->updateMenubar();
1621 owner->updateToolbar();
1623 if (ev.action == LFUN_SELFINSERT || !verbose) {
1624 lyxerr[Debug::ACTION] << "dispatch msg is " << msg << endl;
1626 owner->message(msg);
1630 string dispatch_msg = msg;
1631 if (!dispatch_msg.empty())
1632 dispatch_msg += ' ';
1634 string comname = lyxaction.getActionName(ev.action);
1636 int pseudoaction = ev.action;
1637 bool argsadded = false;
1639 if (!ev.argument.empty()) {
1640 // the pseudoaction is useful for the bindings
1641 pseudoaction = lyxaction.searchActionArg(ev.action, ev.argument);
1643 if (pseudoaction == LFUN_UNKNOWN_ACTION) {
1644 pseudoaction = ev.action;
1646 comname += ' ' + ev.argument;
1651 string const shortcuts = toplevel_keymap->findbinding(pseudoaction);
1653 if (!shortcuts.empty()) {
1654 comname += ": " + shortcuts;
1655 } else if (!argsadded && !ev.argument.empty()) {
1656 comname += ' ' + ev.argument;
1659 if (!comname.empty()) {
1660 comname = rtrim(comname);
1661 dispatch_msg += '(' + comname + ')';
1664 lyxerr[Debug::ACTION] << "verbose dispatch msg " << dispatch_msg << endl;
1665 if (!dispatch_msg.empty())
1666 owner->message(dispatch_msg);
1670 void LyXFunc::setupLocalKeymap()
1672 keyseq.stdmap = keyseq.curmap = toplevel_keymap.get();
1673 cancel_meta_seq.stdmap = cancel_meta_seq.curmap = toplevel_keymap.get();
1677 void LyXFunc::menuNew(string const & name, bool fromTemplate)
1679 string initpath = lyxrc.document_path;
1680 string filename(name);
1682 if (view()->available()) {
1683 string const trypath = owner->buffer()->filePath();
1684 // If directory is writeable, use this as default.
1685 if (IsDirWriteable(trypath))
1689 static int newfile_number;
1691 if (filename.empty()) {
1692 filename = AddName(lyxrc.document_path,
1693 "newfile" + tostr(++newfile_number) + ".lyx");
1694 FileInfo fi(filename);
1695 while (bufferlist.exists(filename) || fi.readable()) {
1697 filename = AddName(lyxrc.document_path,
1698 "newfile" + tostr(newfile_number) +
1700 fi.newFile(filename);
1704 // The template stuff
1707 FileDialog fileDlg(_("Select template file"),
1708 LFUN_SELECT_FILE_SYNC,
1709 make_pair(string(_("Documents|#o#O")),
1710 string(lyxrc.document_path)),
1711 make_pair(string(_("Templates|#T#t")),
1712 string(lyxrc.template_path)));
1714 FileDialog::Result result =
1715 fileDlg.open(lyxrc.template_path,
1716 _("*.lyx| LyX Documents (*.lyx)"));
1718 if (result.first == FileDialog::Later)
1721 string const fname = result.second;
1728 view()->buffer(bufferlist.newFile(filename, templname, !name.empty()));
1732 void LyXFunc::open(string const & fname)
1734 string initpath = lyxrc.document_path;
1736 if (view()->available()) {
1737 string const trypath = owner->buffer()->filePath();
1738 // If directory is writeable, use this as default.
1739 if (IsDirWriteable(trypath))
1745 if (fname.empty()) {
1746 FileDialog fileDlg(_("Select document to open"),
1748 make_pair(string(_("Documents|#o#O")),
1749 string(lyxrc.document_path)),
1750 make_pair(string(_("Examples|#E#e")),
1751 string(AddPath(system_lyxdir, "examples"))));
1753 FileDialog::Result result =
1754 fileDlg.open(initpath,
1755 _("*.lyx| LyX Documents (*.lyx)"));
1757 if (result.first == FileDialog::Later)
1760 filename = result.second;
1762 // check selected filename
1763 if (filename.empty()) {
1764 owner->message(_("Canceled."));
1770 // get absolute path of file and add ".lyx" to the filename if
1772 string const fullpath = FileSearch(string(), filename, "lyx");
1773 if (!fullpath.empty()) {
1774 filename = fullpath;
1777 string const disp_fn(MakeDisplayPath(filename));
1779 // if the file doesn't exist, let the user create one
1780 FileInfo const f(filename, true);
1782 // the user specifically chose this name. Believe them.
1783 Buffer * buffer = bufferlist.newFile(filename, "", true);
1784 view()->buffer(buffer);
1789 #if USE_BOOST_FORMAT
1790 str << boost::format(_("Opening document %1$s...")) % disp_fn;
1792 str << _("Opening document ") << disp_fn << _("...");
1795 owner->message(STRCONV(str.str()));
1797 Buffer * openbuf = bufferlist.loadLyXFile(filename);
1800 view()->buffer(openbuf);
1801 #if USE_BOOST_FORMAT
1802 str2 << boost::format(_("Document %1$s opened.")) % disp_fn;
1804 str2 << _("Document ") << disp_fn << _(" opened.");
1807 #if USE_BOOST_FORMAT
1808 str2 << boost::format(_("Could not open document %1$s"))
1811 str2 << _("Could not open document ") << disp_fn;
1814 owner->message(STRCONV(str2.str()));
1818 void LyXFunc::doImport(string const & argument)
1821 string filename = split(argument, format, ' ');
1823 lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format
1824 << " file: " << filename << endl;
1826 // need user interaction
1827 if (filename.empty()) {
1828 string initpath = lyxrc.document_path;
1830 if (view()->available()) {
1831 string const trypath = owner->buffer()->filePath();
1832 // If directory is writeable, use this as default.
1833 if (IsDirWriteable(trypath))
1837 #if USE_BOOST_FORMAT
1838 boost::format fmt(_("Select %1$s file to import"));
1839 fmt % formats.prettyName(format);
1840 string const text = fmt.str();
1842 string const text = _("Select ") + formats.prettyName(format)
1843 + _(" file to import");;
1846 FileDialog fileDlg(text,
1848 make_pair(string(_("Documents|#o#O")),
1849 string(lyxrc.document_path)),
1850 make_pair(string(_("Examples|#E#e")),
1851 string(AddPath(system_lyxdir, "examples"))));
1853 string const extension = "*." + formats.extension(format)
1854 + "| " + formats.prettyName(format)
1855 + " (*." + formats.extension(format) + ')';
1857 FileDialog::Result result = fileDlg.open(initpath,
1860 if (result.first == FileDialog::Later)
1863 filename = result.second;
1865 // check selected filename
1866 if (filename.empty())
1867 owner->message(_("Canceled."));
1870 if (filename.empty())
1873 // get absolute path of file
1874 filename = MakeAbsPath(filename);
1876 string const lyxfile = ChangeExtension(filename, ".lyx");
1878 // Check if the document already is open
1879 if (lyx_gui::use_gui && bufferlist.exists(lyxfile)) {
1880 string const file = MakeDisplayPath(lyxfile, 30);
1882 // FIXME: sucky UI !
1884 #if USE_BOOST_FORMAT
1885 boost::format fmt(_("The document %1$s is already open.\n\nDo you want to close that document?"));
1887 string text = fmt.str();
1889 string text = _("The document ");
1890 text += file + _(" is already open.\n\nDo you want to close that document?");
1892 int const ret = Alert::prompt(_("Close open document?"),
1893 text, 1, _("&Close"), _("&Cancel"));
1895 if (ret == 0 || !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 #if USE_BOOST_FORMAT
1907 boost::format fmt(_("The document %1$s already exists.\n\nDo you want to over-write that document?"));
1909 string text = fmt.str();
1911 string text = _("The document ");
1912 text += file + _(" already exists.\n\nDo you want to over-write that document?");
1914 int const ret = Alert::prompt(_("Over-write document?"),
1915 text, 1, _("&Over-write"), _("&Cancel"));
1918 owner->message(_("Canceled."));
1923 Importer::Import(owner, filename, format);
1927 void LyXFunc::closeBuffer()
1929 if (bufferlist.close(owner->buffer(), true) && !quitting) {
1930 if (bufferlist.empty()) {
1931 // need this otherwise SEGV may occur while trying to
1932 // set variables that don't exist
1933 // since there's no current buffer
1934 owner->getDialogs().hideBufferDependent();
1936 view()->buffer(bufferlist.first());
1942 // Each "owner" should have it's own message method. lyxview and
1943 // the minibuffer would use the minibuffer, but lyxserver would
1944 // send an ERROR signal to its client. Alejandro 970603
1945 // This func is bit problematic when it comes to NLS, to make the
1946 // lyx servers client be language indepenent we must not translate
1947 // strings sent to this func.
1948 void LyXFunc::setErrorMessage(string const & m) const
1950 dispatch_buffer = m;
1955 void LyXFunc::setMessage(string const & m) const
1957 dispatch_buffer = m;
1961 void LyXFunc::setStatusMessage(string const & m) const
1967 string const LyXFunc::view_status_message()
1969 // When meta-fake key is pressed, show the key sequence so far + "M-".
1971 return keyseq.print() + "M-";
1974 // Else, when a non-complete key sequence is pressed,
1975 // show the available options.
1976 if (keyseq.length() > 0 && !keyseq.deleted()) {
1977 return keyseq.printOptions();
1980 if (!view()->available())
1981 return _("Welcome to LyX!");
1983 return currentState(view());
1987 BufferView * LyXFunc::view() const
1990 return owner->view().get();