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.
24 #include "LayoutFile.h"
25 #include "BranchList.h"
26 #include "buffer_funcs.h"
28 #include "BufferList.h"
29 #include "BufferParams.h"
30 #include "BufferView.h"
33 #include "Converter.h"
35 #include "CutAndPaste.h"
36 #include "DispatchResult.h"
38 #include "ErrorList.h"
40 #include "FuncRequest.h"
41 #include "FuncStatus.h"
42 #include "InsetIterator.h"
46 #include "LaTeXFeatures.h"
48 #include "LyXAction.h"
53 #include "Paragraph.h"
54 #include "ParagraphParameters.h"
55 #include "ParIterator.h"
59 #include "SpellChecker.h"
61 #include "frontends/alert.h"
62 #include "frontends/Application.h"
63 #include "frontends/KeySymbol.h"
64 #include "frontends/LyXView.h"
65 #include "frontends/Selection.h"
67 #include "support/debug.h"
68 #include "support/environment.h"
69 #include "support/FileName.h"
70 #include "support/filetools.h"
71 #include "support/gettext.h"
72 #include "support/lassert.h"
73 #include "support/lstrings.h"
74 #include "support/Path.h"
75 #include "support/Package.h"
76 #include "support/Systemcall.h"
77 #include "support/convert.h"
78 #include "support/os.h"
84 using namespace lyx::support;
88 using frontend::LyXView;
90 namespace Alert = frontend::Alert;
95 // This function runs "configure" and then rereads lyx.defaults to
96 // reconfigure the automatic settings.
97 void reconfigure(LyXView * lv, string const & option)
99 // emit message signal.
101 lv->message(_("Running configure..."));
103 // Run configure in user lyx directory
104 PathChanger p(package().user_support());
105 string configure_command = package().configure_command();
106 configure_command += option;
108 int ret = one.startscript(Systemcall::Wait, configure_command);
110 // emit message signal.
112 lv->message(_("Reloading configuration..."));
113 lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
114 // Re-read packages.lst
115 LaTeXFeatures::getAvailable();
118 Alert::information(_("System reconfiguration failed"),
119 _("The system reconfiguration has failed.\n"
120 "Default textclass is used but LyX may "
121 "not be able to work properly.\n"
122 "Please reconfigure again if needed."));
125 Alert::information(_("System reconfigured"),
126 _("The system has been reconfigured.\n"
127 "You need to restart LyX to make use of any\n"
128 "updated document class specifications."));
135 : encoded_last_key(0), meta_fake_bit(NoModifier)
140 void LyXFunc::initKeySequences(KeyMap * kb)
142 keyseq = KeySequence(kb, kb);
143 cancel_meta_seq = KeySequence(kb, kb);
147 void LyXFunc::handleKeyFunc(FuncCode action)
149 char_type c = encoded_last_key;
153 LyXView * lv = theApp()->currentWindow();
154 LASSERT(lv && lv->currentBufferView(), /**/);
155 BufferView * bv = lv->currentBufferView();
156 bv->getIntl().getTransManager().deadkey(
157 c, get_accent(action).accent, bv->cursor().innerText(),
159 // Need to clear, in case the minibuffer calls these
162 // copied verbatim from do_accent_char
163 bv->cursor().resetAnchor();
164 bv->processUpdateFlags(Update::FitCursor);
167 //FIXME: bookmark handling is a frontend issue. This code should be transferred
168 // to GuiView and be GuiView and be window dependent.
169 void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
171 LyXView * lv = theApp()->currentWindow();
173 if (!theSession().bookmarks().isValid(idx))
175 BookmarksSection::Bookmark const & bm = theSession().bookmarks().bookmark(idx);
176 LASSERT(!bm.filename.empty(), /**/);
177 string const file = bm.filename.absFilename();
178 // if the file is not opened, open it.
179 if (!theBufferList().exists(bm.filename)) {
181 dispatch(FuncRequest(LFUN_FILE_OPEN, file));
185 // open may fail, so we need to test it again
186 if (!theBufferList().exists(bm.filename))
189 // bm can be changed when saving
190 BookmarksSection::Bookmark tmp = bm;
192 // Special case idx == 0 used for back-from-back jump navigation
194 dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
196 // if the current buffer is not that one, switch to it.
197 if (!lv->documentBufferView()
198 || lv->documentBufferView()->buffer().fileName() != tmp.filename) {
201 dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
204 // moveToPosition try paragraph id first and then paragraph (pit, pos).
205 if (!lv->documentBufferView()->moveToPosition(
206 tmp.bottom_pit, tmp.bottom_pos, tmp.top_id, tmp.top_pos))
213 // Cursor jump succeeded!
214 Cursor const & cur = lv->documentBufferView()->cursor();
215 pit_type new_pit = cur.pit();
216 pos_type new_pos = cur.pos();
217 int new_id = cur.paragraph().id();
219 // if bottom_pit, bottom_pos or top_id has been changed, update bookmark
220 // see http://bugzilla.lyx.org/show_bug.cgi?id=3092
221 if (bm.bottom_pit != new_pit || bm.bottom_pos != new_pos
222 || bm.top_id != new_id) {
223 const_cast<BookmarksSection::Bookmark &>(bm).updatePos(
224 new_pit, new_pos, new_id);
229 void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
231 LYXERR(Debug::KEY, "KeySym is " << keysym.getSymbolName());
233 LyXView * lv = theApp()->currentWindow();
235 // Do nothing if we have nothing (JMarc)
236 if (!keysym.isOK()) {
237 LYXERR(Debug::KEY, "Empty kbd action (probably composing)");
242 if (keysym.isModifier()) {
243 LYXERR(Debug::KEY, "isModifier true");
249 //Encoding const * encoding = lv->documentBufferView()->cursor().getEncoding();
250 //encoded_last_key = keysym.getISOEncoded(encoding ? encoding->name() : "");
251 // FIXME: encoded_last_key shadows the member variable of the same
252 // name. Is that intended?
253 char_type encoded_last_key = keysym.getUCSEncoded();
255 // Do a one-deep top-level lookup for
256 // cancel and meta-fake keys. RVDK_PATCH_5
257 cancel_meta_seq.reset();
259 FuncRequest func = cancel_meta_seq.addkey(keysym, state);
260 LYXERR(Debug::KEY, "action first set to [" << func.action << ']');
262 // When not cancel or meta-fake, do the normal lookup.
263 // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
264 // Mostly, meta_fake_bit = NoModifier. RVDK_PATCH_5.
265 if ((func.action != LFUN_CANCEL) && (func.action != LFUN_META_PREFIX)) {
266 // remove Caps Lock and Mod2 as a modifiers
267 func = keyseq.addkey(keysym, (state | meta_fake_bit));
268 LYXERR(Debug::KEY, "action now set to [" << func.action << ']');
271 // Dont remove this unless you know what you are doing.
272 meta_fake_bit = NoModifier;
274 // Can this happen now ?
275 if (func.action == LFUN_NOACTION)
276 func = FuncRequest(LFUN_COMMAND_PREFIX);
278 LYXERR(Debug::KEY, " Key [action=" << func.action << "]["
279 << keyseq.print(KeySequence::Portable) << ']');
281 // already here we know if it any point in going further
282 // why not return already here if action == -1 and
283 // num_bytes == 0? (Lgb)
285 if (keyseq.length() > 1)
286 lv->message(keyseq.print(KeySequence::ForGui));
289 // Maybe user can only reach the key via holding down shift.
290 // Let's see. But only if shift is the only modifier
291 if (func.action == LFUN_UNKNOWN_ACTION && state == ShiftModifier) {
292 LYXERR(Debug::KEY, "Trying without shift");
293 func = keyseq.addkey(keysym, NoModifier);
294 LYXERR(Debug::KEY, "Action now " << func.action);
297 if (func.action == LFUN_UNKNOWN_ACTION) {
298 // Hmm, we didn't match any of the keysequences. See
299 // if it's normal insertable text not already covered
301 if (keysym.isText() && keyseq.length() == 1) {
302 LYXERR(Debug::KEY, "isText() is true, inserting.");
303 func = FuncRequest(LFUN_SELF_INSERT,
304 FuncRequest::KEYBOARD);
306 LYXERR(Debug::KEY, "Unknown, !isText() - giving up");
307 lv->message(_("Unknown function."));
313 if (func.action == LFUN_SELF_INSERT) {
314 if (encoded_last_key != 0) {
315 docstring const arg(1, encoded_last_key);
316 dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
317 FuncRequest::KEYBOARD));
318 LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']");
328 FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
330 //lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
333 if (cmd.action == LFUN_NOACTION) {
334 flag.message(from_utf8(N_("Nothing to do")));
335 flag.setEnabled(false);
339 switch (cmd.action) {
340 case LFUN_UNKNOWN_ACTION:
342 flag.setEnabled(false);
349 if (flag.unknown()) {
350 flag.message(from_utf8(N_("Unknown action")));
354 if (!flag.enabled()) {
355 if (flag.message().empty())
356 flag.message(from_utf8(N_("Command disabled")));
360 // I would really like to avoid having this switch and rather try to
361 // encode this in the function itself.
362 // -- And I'd rather let an inset decide which LFUNs it is willing
363 // to handle (Andre')
365 switch (cmd.action) {
367 // This could be used for the no-GUI version. The GUI version is handled in
368 // LyXView::getStatus(). See above.
370 case LFUN_BUFFER_WRITE:
371 case LFUN_BUFFER_WRITE_AS: {
372 Buffer * b = theBufferList().getBuffer(FileName(cmd.getArg(0)));
373 enable = b && (b->isUnnamed() || !b->isClean());
378 case LFUN_BOOKMARK_GOTO: {
379 const unsigned int num = convert<unsigned int>(to_utf8(cmd.argument()));
380 enable = theSession().bookmarks().isValid(num);
384 case LFUN_BOOKMARK_CLEAR:
385 enable = theSession().bookmarks().hasValid();
388 // this one is difficult to get right. As a half-baked
389 // solution, we consider only the first action of the sequence
390 case LFUN_COMMAND_SEQUENCE: {
391 // argument contains ';'-terminated commands
392 string const firstcmd = token(to_utf8(cmd.argument()), ';', 0);
393 FuncRequest func(lyxaction.lookupFunc(firstcmd));
394 func.origin = cmd.origin;
395 flag = getStatus(func);
399 // we want to check if at least one of these is enabled
400 case LFUN_COMMAND_ALTERNATIVES: {
401 // argument contains ';'-terminated commands
402 string arg = to_utf8(cmd.argument());
403 while (!arg.empty()) {
405 arg = split(arg, first, ';');
406 FuncRequest func(lyxaction.lookupFunc(first));
407 func.origin = cmd.origin;
408 flag = getStatus(func);
409 // if this one is enabled, the whole thing is
418 string name = to_utf8(cmd.argument());
419 if (theTopLevelCmdDef().lock(name, func)) {
420 func.origin = cmd.origin;
421 flag = getStatus(func);
422 theTopLevelCmdDef().release(name);
424 // catch recursion or unknown command
425 // definition. all operations until the
426 // recursion or unknown command definition
427 // occurs are performed, so set the state to
434 case LFUN_COMMAND_PREFIX:
436 case LFUN_META_PREFIX:
437 case LFUN_RECONFIGURE:
438 case LFUN_DROP_LAYOUTS_CHOICE:
439 case LFUN_SERVER_GET_FILENAME:
440 case LFUN_SERVER_NOTIFY:
441 case LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE:
443 case LFUN_PREFERENCES_SAVE:
444 case LFUN_INSET_EDIT:
445 case LFUN_BUFFER_SAVE_AS_DEFAULT:
446 case LFUN_LYXRC_APPLY:
447 // these are handled in our dispatch()
455 if (theApp()->getStatus(cmd, flag))
458 // Does the view know something?
459 LyXView * lv = theApp()->currentWindow();
464 if (lv->getStatus(cmd, flag))
467 BufferView * bv = lv->currentBufferView();
468 BufferView * doc_bv = lv->documentBufferView();
469 // If we do not have a BufferView, then other functions are disabled
474 // try the BufferView
475 bool decided = bv->getStatus(cmd, flag);
478 decided = bv->buffer().getStatus(cmd, flag);
479 if (!decided && doc_bv)
480 // try the Document Buffer
481 decided = doc_bv->buffer().getStatus(cmd, flag);
485 flag.setEnabled(false);
487 // the default error message if we disable the command
488 if (!flag.enabled() && flag.message().empty())
489 flag.message(from_utf8(N_("Command disabled")));
494 /// send a post-dispatch status message
495 static docstring sendDispatchMessage(docstring const & msg, FuncRequest const & cmd)
497 const bool verbose = (cmd.origin == FuncRequest::MENU
498 || cmd.origin == FuncRequest::TOOLBAR
499 || cmd.origin == FuncRequest::COMMANDBUFFER);
501 if (cmd.action == LFUN_SELF_INSERT || !verbose) {
502 LYXERR(Debug::ACTION, "dispatch msg is " << msg);
506 docstring dispatch_msg = msg;
507 if (!dispatch_msg.empty())
510 docstring comname = from_utf8(lyxaction.getActionName(cmd.action));
512 bool argsadded = false;
514 if (!cmd.argument().empty()) {
515 if (cmd.action != LFUN_UNKNOWN_ACTION) {
516 comname += ' ' + cmd.argument();
520 docstring const shortcuts = theTopLevelKeymap().
521 printBindings(cmd, KeySequence::ForGui);
523 if (!shortcuts.empty())
524 comname += ": " + shortcuts;
525 else if (!argsadded && !cmd.argument().empty())
526 comname += ' ' + cmd.argument();
528 if (!comname.empty()) {
529 comname = rtrim(comname);
530 dispatch_msg += '(' + rtrim(comname) + ')';
532 LYXERR(Debug::ACTION, "verbose dispatch msg " << to_utf8(dispatch_msg));
537 void LyXFunc::dispatch(FuncRequest const & cmd)
539 string const argument = to_utf8(cmd.argument());
540 FuncCode const action = cmd.action;
542 LYXERR(Debug::ACTION, "\nLyXFunc::dispatch: cmd: " << cmd);
543 //lyxerr << "LyXFunc::dispatch: cmd: " << cmd << endl;
545 // we have not done anything wrong yet.
547 dispatch_buffer.erase();
549 // redraw the screen at the end (first of the two drawing steps).
550 //This is done unless explicitely requested otherwise
551 Update::flags updateFlags = Update::FitCursor;
553 LyXView * lv = theApp()->currentWindow();
555 FuncStatus const flag = getStatus(cmd);
556 if (!flag.enabled()) {
557 // We cannot use this function here
558 LYXERR(Debug::ACTION, "LyXFunc::dispatch: "
559 << lyxaction.getActionName(action)
560 << " [" << action << "] is disabled at this location");
561 setErrorMessage(flag.message());
567 case LFUN_COMMAND_PREFIX:
568 dispatch(FuncRequest(LFUN_MESSAGE, keyseq.printOptions(true)));
573 meta_fake_bit = NoModifier;
574 if (lv && lv->currentBufferView())
575 // cancel any selection
576 dispatch(FuncRequest(LFUN_MARK_OFF));
577 setMessage(from_ascii(N_("Cancel")));
580 case LFUN_META_PREFIX:
581 meta_fake_bit = AltModifier;
582 setMessage(keyseq.print(KeySequence::ForGui));
585 // --- Menus -----------------------------------------------
586 case LFUN_RECONFIGURE:
587 // argument is any additional parameter to the configure.py command
588 reconfigure(lv, argument);
591 // --- lyxserver commands ----------------------------
592 case LFUN_SERVER_GET_FILENAME: {
593 LASSERT(lv && lv->documentBufferView(), return);
594 docstring const fname = from_utf8(
595 lv->documentBufferView()->buffer().absFileName());
597 LYXERR(Debug::INFO, "FNAME[" << fname << ']');
600 case LFUN_SERVER_NOTIFY:
601 dispatch_buffer = keyseq.print(KeySequence::Portable);
602 theServer().notifyClient(to_utf8(dispatch_buffer));
605 case LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE:
606 lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
612 string rest = split(argument, countstr, ' ');
613 istringstream is(countstr);
616 //lyxerr << "repeat: count: " << count << " cmd: " << rest << endl;
617 for (int i = 0; i < count; ++i)
618 dispatch(lyxaction.lookupFunc(rest));
622 case LFUN_COMMAND_SEQUENCE: {
623 // argument contains ';'-terminated commands
624 string arg = argument;
625 // FIXME: this LFUN should also work without any view.
626 Buffer * buffer = (lv && lv->documentBufferView())
627 ? &(lv->documentBufferView()->buffer()) : 0;
628 buffer = &lv->currentBufferView()->buffer();
629 if (buffer && !theBufferList().isLoaded(buffer))
632 buffer->undo().beginUndoGroup();
633 while (!arg.empty()) {
635 arg = split(arg, first, ';');
636 FuncRequest func(lyxaction.lookupFunc(first));
637 func.origin = cmd.origin;
641 buffer->undo().endUndoGroup();
645 case LFUN_COMMAND_ALTERNATIVES: {
646 // argument contains ';'-terminated commands
647 string arg = argument;
648 while (!arg.empty()) {
650 arg = split(arg, first, ';');
651 FuncRequest func(lyxaction.lookupFunc(first));
652 func.origin = cmd.origin;
653 FuncStatus stat = getStatus(func);
654 if (stat.enabled()) {
664 if (theTopLevelCmdDef().lock(argument, func)) {
665 func.origin = cmd.origin;
667 theTopLevelCmdDef().release(argument);
669 if (func.action == LFUN_UNKNOWN_ACTION) {
670 // unknown command definition
671 lyxerr << "Warning: unknown command definition `"
675 // recursion detected
676 lyxerr << "Warning: Recursion in the command definition `"
677 << argument << "' detected"
684 case LFUN_PREFERENCES_SAVE: {
685 lyxrc.write(makeAbsPath("preferences",
686 package().user_support().absFilename()),
691 case LFUN_BUFFER_SAVE_AS_DEFAULT: {
693 addName(addPath(package().user_support().absFilename(), "templates/"),
695 Buffer defaults(fname);
697 istringstream ss(argument);
700 int const unknown_tokens = defaults.readHeader(lex);
702 if (unknown_tokens != 0) {
703 lyxerr << "Warning in LFUN_BUFFER_SAVE_AS_DEFAULT!\n"
704 << unknown_tokens << " unknown token"
705 << (unknown_tokens == 1 ? "" : "s")
709 if (defaults.writeFile(FileName(defaults.absFileName())))
710 setMessage(bformat(_("Document defaults saved in %1$s"),
711 makeDisplayPath(fname)));
713 setErrorMessage(from_ascii(N_("Unable to save document defaults")));
717 case LFUN_LYXRC_APPLY: {
718 // reset active key sequences, since the bindings
719 // are updated (bug 6064)
721 LyXRC const lyxrc_orig = lyxrc;
723 istringstream ss(argument);
724 bool const success = lyxrc.read(ss) == 0;
727 lyxerr << "Warning in LFUN_LYXRC_APPLY!\n"
728 << "Unable to read lyxrc data"
733 actOnUpdatedPrefs(lyxrc_orig, lyxrc);
737 theApp()->resetGui();
739 /// We force the redraw in any case because there might be
740 /// some screen font changes.
741 /// FIXME: only the current view will be updated. the Gui
742 /// class is able to furnish the list of views.
743 updateFlags = Update::Force;
747 case LFUN_BOOKMARK_GOTO:
748 // go to bookmark, open unopened file and switch to buffer if necessary
749 gotoBookmark(convert<unsigned int>(to_utf8(cmd.argument())), true, true);
750 updateFlags = Update::FitCursor;
753 case LFUN_BOOKMARK_CLEAR:
754 theSession().bookmarks().clear();
758 LASSERT(theApp(), /**/);
759 // Let the frontend dispatch its own actions.
760 if (theApp()->dispatch(cmd))
761 // Nothing more to do.
764 // Everything below is only for active window
768 // Let the current LyXView dispatch its own actions.
769 if (lv->dispatch(cmd)) {
770 BufferView * bv = lv->currentBufferView();
772 updateFlags = bv->cursor().result().update();
776 BufferView * bv = lv->currentBufferView();
779 // Let the current BufferView dispatch its own actions.
780 if (bv->dispatch(cmd)) {
781 // The BufferView took care of its own updates if needed.
782 updateFlags = Update::None;
786 BufferView * doc_bv = lv->documentBufferView();
787 // Try with the document BufferView dispatch if any.
788 if (doc_bv && doc_bv->dispatch(cmd)) {
789 updateFlags = Update::None;
793 // OK, so try the current Buffer itself...
795 bv->buffer().dispatch(cmd, dr);
796 if (dr.dispatched()) {
797 updateFlags = dr.update();
800 // and with the document Buffer.
802 doc_bv->buffer().dispatch(cmd, dr);
803 if (dr.dispatched()) {
804 updateFlags = dr.update();
809 // Is this a function that acts on inset at point?
810 Inset * inset = bv->cursor().nextInset();
811 if (lyxaction.funcHasFlag(action, LyXAction::AtPoint)
813 bv->cursor().result().dispatched(true);
814 bv->cursor().result().update(Update::FitCursor | Update::Force);
815 FuncRequest tmpcmd = cmd;
816 inset->dispatch(bv->cursor(), tmpcmd);
817 if (bv->cursor().result().dispatched()) {
818 updateFlags = bv->cursor().result().update();
823 // Let the current Cursor dispatch its own actions.
824 Cursor old = bv->cursor();
825 bv->cursor().getPos(cursorPosBeforeDispatchX_,
826 cursorPosBeforeDispatchY_);
827 bv->cursor().dispatch(cmd);
829 // notify insets we just left
830 if (bv->cursor() != old) {
832 bool badcursor = notifyCursorLeavesOrEnters(old, bv->cursor());
834 bv->cursor().fixIfBroken();
837 // update completion. We do it here and not in
838 // processKeySym to avoid another redraw just for a
839 // changed inline completion
840 if (cmd.origin == FuncRequest::KEYBOARD) {
841 if (cmd.action == LFUN_SELF_INSERT
842 || (cmd.action == LFUN_ERT_INSERT && bv->cursor().inMathed()))
843 lv->updateCompletion(bv->cursor(), true, true);
844 else if (cmd.action == LFUN_CHAR_DELETE_BACKWARD)
845 lv->updateCompletion(bv->cursor(), false, true);
847 lv->updateCompletion(bv->cursor(), false, false);
850 updateFlags = bv->cursor().result().update();
853 // if we executed a mutating lfun, mark the buffer as dirty
854 Buffer * doc_buffer = (lv && lv->documentBufferView())
855 ? &(lv->documentBufferView()->buffer()) : 0;
856 if (doc_buffer && theBufferList().isLoaded(doc_buffer)
858 && !lyxaction.funcHasFlag(action, LyXAction::NoBuffer)
859 && !lyxaction.funcHasFlag(action, LyXAction::ReadOnly))
860 doc_buffer->markDirty();
862 if (lv && lv->currentBufferView()) {
863 // BufferView::update() updates the ViewMetricsInfo and
864 // also initializes the position cache for all insets in
865 // (at least partially) visible top-level paragraphs.
866 // We will redraw the screen only if needed.
867 lv->currentBufferView()->processUpdateFlags(updateFlags);
869 // Do we have a selection?
870 theSelection().haveSelection(
871 lv->currentBufferView()->cursor().selection());
878 // Some messages may already be translated, so we cannot use _()
879 lv->message(sendDispatchMessage(
880 translateIfPossible(getMessage()), cmd));
885 // Each LyXView should have it's own message method. lyxview and
886 // the minibuffer would use the minibuffer, but lyxserver would
887 // send an ERROR signal to its client. Alejandro 970603
888 // This function is bit problematic when it comes to NLS, to make the
889 // lyx servers client be language indepenent we must not translate
890 // strings sent to this func.
891 void LyXFunc::setErrorMessage(docstring const & m) const
898 void LyXFunc::setMessage(docstring const & m) const
904 docstring LyXFunc::viewStatusMessage()
906 // When meta-fake key is pressed, show the key sequence so far + "M-".
908 return keyseq.print(KeySequence::ForGui) + "M-";
910 // Else, when a non-complete key sequence is pressed,
911 // show the available options.
912 if (keyseq.length() > 0 && !keyseq.deleted())
913 return keyseq.printOptions(true);
919 bool LyXFunc::wasMetaKey() const
921 return (meta_fake_bit != NoModifier);