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 * ====================================================== */
14 #pragma implementation
21 #include "bufferlist.h"
22 #include "BufferView.h"
23 #include "ColorHandler.h"
24 #include "lyxserver.h"
28 #include "LyXAction.h"
34 #include "trans_mgr.h"
37 #include "bufferview_funcs.h"
38 #include "minibuffer.h"
41 #include "lyx_gui_misc.h"
42 #include "FloatList.h"
43 #include "converter.h"
46 #include "FontLoader.h"
47 #include "TextCache.h"
49 #include "undo_funcs.h"
50 #include "ParagraphParameters.h"
51 #include "figureForm.h"
53 #include "insets/inseturl.h"
54 #include "insets/insetlatexaccent.h"
55 #include "insets/insettoc.h"
56 #include "insets/insetref.h"
57 #include "insets/insetparent.h"
58 #include "insets/insetindex.h"
59 #include "insets/insetinclude.h"
60 #include "insets/insetbib.h"
61 #include "insets/insetcite.h"
62 #include "insets/insettext.h"
63 #include "insets/insetert.h"
64 #include "insets/insetexternal.h"
65 #include "insets/insetgraphics.h"
66 #include "insets/insetfoot.h"
67 #include "insets/insetmarginal.h"
68 #include "insets/insetminipage.h"
69 #include "insets/insetfloat.h"
71 #include "insets/insetlist.h"
72 #include "insets/insettheorem.h"
74 #include "insets/insettabular.h"
75 #include "insets/insetcaption.h"
77 #include "mathed/formulamacro.h"
78 #include "mathed/math_cursor.h"
79 #include "mathed/math_inset.h"
81 #include "frontends/FileDialog.h"
82 #include "frontends/Dialogs.h"
83 #include "frontends/Toolbar.h"
84 #include "frontends/Menubar.h"
85 #include "frontends/Alert.h"
87 #include "support/lyxalgo.h"
88 #include "support/LAssert.h"
89 #include "support/filetools.h"
90 #include "support/FileInfo.h"
91 #include "support/syscall.h"
92 #include "support/lstrings.h"
93 #include "support/path.h"
94 #include "support/lyxfunctional.h"
106 using std::make_pair;
110 extern BufferList bufferlist;
111 extern LyXServer * lyxserver;
112 extern bool selection_possible;
113 extern void MenuSendto();
115 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
117 extern void show_symbols_form(LyXFunc *);
119 extern LyXAction lyxaction;
121 extern tex_accent_struct get_accent(kb_action action);
123 extern void ShowLatexLog();
129 class MiniBufferController : public SigC::Object {
132 MiniBufferController() {
136 &MiniBufferController::receiveCommand));
140 &MiniBufferController::receiveArg));
143 void receiveCmd(string const & cmd) {}
145 void receiveArg(string const & arg) {}
153 MiniBufferController mb_ctrl;
159 /* === globals =========================================================== */
162 LyXFunc::LyXFunc(LyXView * o)
164 keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
165 cancel_meta_seq(toplevel_keymap.get(), toplevel_keymap.get())
168 lyx_dead_action = LFUN_NOACTION;
169 lyx_calling_dead_action = LFUN_NOACTION;
174 LyXText * LyXFunc::TEXT(bool flag = true) const
177 return owner->view()->text;
178 return owner->view()->getLyXText();
182 // I changed this func slightly. I commented out the ...FinishUndo(),
183 // this means that all places that used to have a moveCursorUpdate, now
184 // have a ...FinishUndo() as the preceeding statement. I have also added
185 // a moveCursorUpdate to some of the functions that updated the cursor, but
186 // that did not show its new position.
188 void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
190 if (selecting || TEXT(flag)->selection.mark()) {
191 TEXT(flag)->setSelection(owner->view());
192 if (TEXT(flag)->bv_owner)
193 owner->view()->toggleToggle();
195 owner->view()->update(TEXT(flag), BufferView::SELECT|BufferView::FITCUR);
196 owner->view()->showCursor();
198 /* ---> Everytime the cursor is moved, show the current font state. */
199 // should this too me moved out of this func?
200 owner->view()->setState();
204 void LyXFunc::handleKeyFunc(kb_action action)
206 char c = keyseq.getiso();
208 if (keyseq.length() > 1) {
212 owner->getIntl()->getTrans()
213 .deadkey(c, get_accent(action).accent, TEXT(false));
214 // Need to clear, in case the minibuffer calls these
217 // copied verbatim from do_accent_char
218 owner->view()->update(TEXT(false),
219 BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
220 TEXT(false)->selection.cursor = TEXT(false)->cursor;
224 void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
228 if (lyxerr.debugging(Debug::KEY)) {
229 char const * tmp = XKeysymToString(keysym);
230 string const stm = (tmp ? tmp : "");
231 lyxerr << "KeySym is "
234 << keysym << "] State is ["
238 // Do nothing if we have nothing (JMarc)
239 if (keysym == NoSymbol) {
240 lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
245 // Can we be sure that this will work for all X Window
246 // implementations? (Lgb)
247 // This code snippet makes lyx ignore some keys. Perhaps
248 // all of them should be explictly mentioned?
249 if ((keysym >= XK_Shift_L && keysym <= XK_Hyper_R)
250 || keysym == XK_Mode_switch || keysym == 0x0) {
254 // Do a one-deep top-level lookup for
255 // cancel and meta-fake keys. RVDK_PATCH_5
256 cancel_meta_seq.reset();
258 int action = cancel_meta_seq.addkey(keysym, state
259 &(ShiftMask|ControlMask
261 if (lyxerr.debugging(Debug::KEY)) {
262 lyxerr << "action first set to [" << action << "]" << endl;
265 // When not cancel or meta-fake, do the normal lookup.
266 // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
267 // Mostly, meta_fake_bit = 0. RVDK_PATCH_5.
268 if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) {
269 if (lyxerr.debugging(Debug::KEY)) {
270 lyxerr << "meta_fake_bit is ["
271 << meta_fake_bit << "]" << endl;
273 // remove Caps Lock and Mod2 as a modifiers
274 action = keyseq.addkey(keysym,
275 (state | meta_fake_bit)
276 &(ShiftMask|ControlMask
278 if (lyxerr.debugging(Debug::KEY)) {
279 lyxerr << "action now set to ["
280 << action << "]" << endl;
283 // Dont remove this unless you know what you are doing.
286 // can this happen now ?
287 if (action == LFUN_NOACTION) {
288 action = LFUN_PREFIX;
291 if (lyxerr.debugging(Debug::KEY)) {
292 lyxerr << "Key [action="
294 << keyseq.print() << "]"
298 // already here we know if it any point in going further
299 // why not return already here if action == -1 and
300 // num_bytes == 0? (Lgb)
302 if (keyseq.length() > 1 && !keyseq.deleted()) {
303 owner->message(keyseq.print());
306 if (action == LFUN_UNKNOWN_ACTION) {
307 // It is unknown, but what if we remove all
308 // the modifiers? (Lgb)
309 action = keyseq.addkey(keysym, 0);
311 if (lyxerr.debugging(Debug::KEY)) {
312 lyxerr << "Removing modifiers...\n"
313 << "Action now set to ["
314 << action << "]" << endl;
316 if (action == LFUN_UNKNOWN_ACTION) {
317 owner->message(_("Unknown function."));
322 if (action == LFUN_SELFINSERT) {
323 // This is very X dependent.
324 unsigned int c = keysym;
327 c = kb_keymap::getiso(c);
330 argument = static_cast<char>(c);
332 dispatch(LFUN_SELFINSERT, argument);
333 lyxerr[Debug::KEY] << "SelfInsert arg[`"
334 << argument << "']" << endl;
337 verboseDispatch(action, false);
341 FuncStatus LyXFunc::getStatus(int ac) const
345 action = lyxaction.retrieveActionArg(ac, argument);
346 return getStatus(action, argument);
350 FuncStatus LyXFunc::getStatus(kb_action action,
351 string const & argument) const
354 Buffer * buf = owner->buffer();
356 if (action == LFUN_UNKNOWN_ACTION) {
357 setStatusMessage(N_("Unknown action"));
358 return flag.unknown(true);
361 // Check whether we need a buffer
362 if (!lyxaction.funcHasFlag(action, LyXAction::NoBuffer)) {
363 // Yes we need a buffer, do we have one?
366 // Can we use a readonly buffer?
367 if (buf->isReadonly() &&
368 !lyxaction.funcHasFlag(action,
369 LyXAction::ReadOnly)) {
371 setStatusMessage(N_("Document is read-only"));
376 setStatusMessage(N_("Command not allowed with"
377 "out any document open"));
378 return flag.disabled(true);
382 UpdatableInset * tli = owner->view()->theLockingInset();
384 // I would really like to avoid having this switch and rather try to
385 // encode this in the function itself.
386 bool disable = false;
389 disable = !Exporter::IsExportable(buf, "dvi")
390 || lyxrc.print_command == "none";
393 disable = argument == "fax" &&
394 !Exporter::IsExportable(buf, argument);
397 disable = buf->undostack.empty();
400 disable = buf->redostack.empty();
402 case LFUN_SPELLCHECK:
403 disable = lyxrc.isp_command == "none";
405 #ifndef HAVE_LIBAIKSAURUS
406 case LFUN_THESAURUS_ENTRY:
411 disable = lyxrc.chktex_command == "none";
414 disable = !Exporter::IsExportable(buf, "program");
417 case LFUN_LAYOUT_TABULAR:
419 || (tli->lyxCode() != Inset::TABULAR_CODE
420 && !tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
424 case LFUN_LAYOUT_PARAGRAPH: {
425 Inset * inset = TEXT(false)->cursor.par()->inInset();
426 disable = inset && inset->forceDefaultParagraphs(inset);
430 case LFUN_TABULAR_FEATURE:
434 //ret.disabled(true);
435 if (tli->lyxCode() == Inset::TABULAR_CODE) {
436 ret = static_cast<InsetTabular *>(tli)
437 ->getStatus(argument);
438 } else if (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
439 ret = static_cast<InsetTabular *>
440 (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE))
441 ->getStatus(argument);
446 static InsetTabular inset(*owner->buffer(), 1, 1);
450 ret = inset.getStatus(argument);
451 if (ret.onoff(true) || ret.onoff(false))
452 flag.setOnOff(false);
456 case LFUN_VC_REGISTER:
457 disable = buf->lyxvc.inUse();
459 case LFUN_VC_CHECKIN:
460 disable = !buf->lyxvc.inUse() || buf->isReadonly();
462 case LFUN_VC_CHECKOUT:
463 disable = !buf->lyxvc.inUse() || !buf->isReadonly();
467 case LFUN_VC_HISTORY:
468 disable = !buf->lyxvc.inUse();
470 case LFUN_BOOKMARK_GOTO:
471 disable = !owner->view()->
472 isSavedPosition(strToUnsignedInt(argument));
476 case LFUN_INSET_TOGGLE:
477 disable = (TEXT(false)->getInset() == 0);
480 case LFUN_MATH_VALIGN:
482 char align = mathcursor->valign();
487 if (argument.empty()) {
491 if (!contains("tcb", argument[0])) {
495 flag.setOnOff(argument[0] == align);
500 case LFUN_MATH_HALIGN:
502 char align = mathcursor->halign();
507 if (argument.empty()) {
511 if (!contains("lcr", argument[0])) {
515 flag.setOnOff(argument[0] == align);
520 case LFUN_MATH_MUTATE:
521 if (tli && (tli->lyxCode() == Inset::MATH_CODE)) {
522 MathInsetTypes type = mathcursor->formula()->getType();
523 if (argument == "inline") {
524 flag.setOnOff(type == LM_OT_SIMPLE);
525 } else if (argument == "display") {
526 flag.setOnOff(type == LM_OT_EQUATION);
527 } else if (argument == "eqnarray") {
528 flag.setOnOff(type == LM_OT_EQNARRAY);
529 } else if (argument == "align") {
530 flag.setOnOff(type == LM_OT_ALIGN);
538 // we just need to be in math mode to enable that
540 case LFUN_MATH_SPACE:
541 case LFUN_MATH_LIMITS:
542 case LFUN_MATH_NONUMBER:
543 case LFUN_MATH_NUMBER:
544 disable = !mathcursor;
547 // we need to be math mode and a math array for that
548 // Hack: halign produces non-zero result iff we are in a math array
549 case LFUN_MATH_ROW_INSERT:
550 case LFUN_MATH_ROW_DELETE:
551 case LFUN_MATH_COLUMN_INSERT:
552 case LFUN_MATH_COLUMN_DELETE:
553 disable = !mathcursor || !mathcursor->halign();
560 // the functions which insert insets
561 Inset::Code code = Inset::NO_CODE;
563 case LFUN_INSET_TEXT:
564 code = Inset::TEXT_CODE;
567 code = Inset::ERT_CODE;
570 case LFUN_INSET_GRAPHICS:
571 code = Inset::GRAPHICS_CODE;
573 case LFUN_INSET_FOOTNOTE:
574 code = Inset::FOOT_CODE;
576 case LFUN_DIALOG_TABULAR_INSERT:
577 case LFUN_INSET_TABULAR:
578 code = Inset::TABULAR_CODE;
580 case LFUN_INSET_EXTERNAL:
581 code = Inset::EXTERNAL_CODE;
583 case LFUN_INSET_MARGINAL:
584 code = Inset::MARGIN_CODE;
586 case LFUN_INSET_MINIPAGE:
587 code = Inset::MINIPAGE_CODE;
589 case LFUN_INSET_FLOAT:
590 case LFUN_INSET_WIDE_FLOAT:
591 code = Inset::FLOAT_CODE;
593 case LFUN_FLOAT_LIST:
594 code = Inset::FLOAT_LIST_CODE;
597 case LFUN_INSET_LIST:
598 code = Inset::LIST_CODE;
600 case LFUN_INSET_THEOREM:
601 code = Inset::THEOREM_CODE;
604 case LFUN_INSET_CAPTION:
605 code = Inset::CAPTION_CODE;
607 case LFUN_INSERT_NOTE:
608 code = Inset::IGNORE_CODE;
610 case LFUN_INSERT_LABEL:
611 code = Inset::LABEL_CODE;
613 case LFUN_REF_INSERT:
614 code = Inset::REF_CODE;
616 case LFUN_CITATION_CREATE:
617 case LFUN_CITATION_INSERT:
618 code = Inset::CITE_CODE;
620 case LFUN_INSERT_BIBTEX:
621 code = Inset::BIBTEX_CODE;
623 case LFUN_INDEX_INSERT:
624 case LFUN_INDEX_INSERT_LAST:
625 case LFUN_INDEX_CREATE:
626 code = Inset::INDEX_CODE;
628 case LFUN_INDEX_PRINT:
629 code = Inset::INDEX_PRINT_CODE;
631 case LFUN_CHILD_INSERT:
632 code = Inset::INCLUDE_CODE;
634 case LFUN_TOC_INSERT:
635 code = Inset::TOC_CODE;
637 case LFUN_PARENTINSERT:
638 code = Inset::PARENT_CODE;
642 case LFUN_INSERT_URL:
643 code = Inset::URL_CODE;
646 // always allow this, since we will inset a raw quote
647 // if an inset is not allowed.
649 case LFUN_HYPHENATION:
650 case LFUN_LIGATURE_BREAK:
652 case LFUN_MENU_SEPARATOR:
654 case LFUN_END_OF_SENTENCE:
655 case LFUN_PROTECTEDSPACE:
656 code = Inset::SPECIALCHAR_CODE;
661 if (code != Inset::NO_CODE && tli && !tli->insetAllowed(code)) {
668 // A few general toggles
670 case LFUN_READ_ONLY_TOGGLE:
671 flag.setOnOff(buf->isReadonly());
674 flag.setOnOff(TEXT(false)->cursor.par()->params().startOfAppendix());
680 // the font related toggles
682 LyXFont const & font = TEXT(false)->real_current_font;
685 flag.setOnOff(font.emph() == LyXFont::ON);
688 flag.setOnOff(font.noun() == LyXFont::ON);
691 flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
694 flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
697 flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
700 flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
707 MathTextCodes tc = mathcursor->getLastCode();
710 flag.setOnOff(tc == LM_TC_BF);
713 flag.setOnOff(tc == LM_TC_SF);
716 flag.setOnOff(tc == LM_TC_CAL);
719 flag.setOnOff(tc == LM_TC_RM);
722 flag.setOnOff(tc == LM_TC_TT);
725 flag.setOnOff(tc == LM_TC_BB);
728 flag.setOnOff(tc == LM_TC_VAR);
739 // temporary dispatch method
740 void LyXFunc::miniDispatch(string const & s)
742 string s2(frontStrip(strip(s)));
745 verboseDispatch(s2, true);
750 void LyXFunc::verboseDispatch(string const & s, bool show_sc)
752 int action = lyxaction.LookupFunc(frontStrip(s));
754 if (action == LFUN_UNKNOWN_ACTION) {
755 string const msg = string(_("Unknown function ("))
759 verboseDispatch(action, show_sc);
764 void LyXFunc::verboseDispatch(int ac, bool show_sc)
769 // get the real action and argument
770 action = lyxaction.retrieveActionArg(ac, argument);
772 verboseDispatch(action, argument, show_sc);
777 void LyXFunc::verboseDispatch(kb_action action,
778 string const & argument, bool show_sc)
780 string res = dispatch(action, argument);
782 commandshortcut.erase();
784 if (lyxrc.display_shortcuts && show_sc) {
785 if (action != LFUN_SELFINSERT) {
786 // Put name of command and list of shortcuts
787 // for it in minibuffer
788 string comname = lyxaction.getActionName(action);
790 int pseudoaction = action;
791 bool argsadded = false;
793 if (!argument.empty()) {
794 // the pseudoaction is useful for the bindings
796 lyxaction.searchActionArg(action,
799 if (pseudoaction == LFUN_UNKNOWN_ACTION) {
800 pseudoaction = action;
802 comname += " " + argument;
807 string const shortcuts =
808 toplevel_keymap->findbinding(pseudoaction);
810 if (!shortcuts.empty()) {
811 comname += ": " + shortcuts;
812 } else if (!argsadded && !argument.empty()) {
813 comname += " " + argument;
816 if (!comname.empty()) {
817 comname = strip(comname);
818 commandshortcut = "(" + comname + ')';
824 if (!commandshortcut.empty()) {
825 owner->getMiniBuffer()->addSet(commandshortcut);
828 owner->getMiniBuffer()->addSet(' ' + commandshortcut);
833 string const LyXFunc::dispatch(kb_action action, string argument)
835 lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: action[" << action
836 <<"] arg[" << argument << "]" << endl;
838 // we have not done anything wrong yet.
840 dispatch_buffer.erase();
842 #ifdef NEW_DISPATCHER
843 // We try do call the most specific dispatcher first:
844 // 1. the lockinginset's dispatch
845 // 2. the bufferview's dispatch
846 // 3. the lyxview's dispatch
849 selection_possible = false;
851 if (owner->view()->available())
852 owner->view()->hideCursor();
854 // We cannot use this function here
855 if (getStatus(action, argument).disabled()) {
856 lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: "
857 << lyxaction.getActionName(action)
858 << " [" << action << "] is disabled at this location"
860 setErrorMessage(getStatusMessage());
861 goto exit_with_message;
864 if (owner->view()->available() && owner->view()->theLockingInset()) {
865 UpdatableInset::RESULT result;
866 if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
867 (!keyseq.deleted())))
869 if ((action == LFUN_UNKNOWN_ACTION)
870 && argument.empty()){
871 argument = keyseq.getiso();
873 // Undo/Redo is a bit tricky for insets.
874 if (action == LFUN_UNDO) {
875 owner->view()->menuUndo();
876 goto exit_with_message;
877 } else if (action == LFUN_REDO) {
878 owner->view()->menuRedo();
879 goto exit_with_message;
880 } else if (((result=owner->view()->theLockingInset()->
881 localDispatch(owner->view(), action, argument)) ==
882 UpdatableInset::DISPATCHED) ||
883 (result == UpdatableInset::DISPATCHED_NOUPDATE))
884 goto exit_with_message;
885 else if (result == UpdatableInset::FINISHED) {
886 if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
887 TEXT()->cursorRight(owner->view());
888 moveCursorUpdate(true, false);
891 goto exit_with_message;
892 } else if (result == UpdatableInset::FINISHED_RIGHT) {
893 if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
894 TEXT()->cursorRight(owner->view());
895 moveCursorUpdate(true, false);
898 goto exit_with_message;
899 } else if (result == UpdatableInset::FINISHED_UP) {
900 if (TEXT()->cursor.row()->previous()) {
901 TEXT()->cursorUp(owner->view());
902 moveCursorUpdate(true, false);
905 goto exit_with_message;
906 } else if (result == UpdatableInset::FINISHED_DOWN) {
907 if (TEXT()->cursor.row()->next())
908 TEXT()->cursorDown(owner->view());
910 TEXT()->cursorRight(owner->view());
911 moveCursorUpdate(true, false);
913 goto exit_with_message;
915 //setMessage(N_("Text mode"));
917 case LFUN_UNKNOWN_ACTION:
918 case LFUN_BREAKPARAGRAPH:
920 TEXT()->cursorRight(owner->view());
921 owner->view()->setState();
925 if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
926 TEXT()->cursorRight(owner->view());
927 moveCursorUpdate(true, false);
930 goto exit_with_message;
932 if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
933 TEXT()->cursorRight(owner->view());
934 moveCursorUpdate(true, false);
937 goto exit_with_message;
939 if (TEXT()->cursor.row()->next())
940 TEXT()->cursorDown(owner->view());
942 TEXT()->cursorRight(owner->view());
943 moveCursorUpdate(true, false);
945 goto exit_with_message;
957 if (!owner->view()->available()) break;
958 // this function should be used always [asierra060396]
959 UpdatableInset * tli =
960 owner->view()->theLockingInset();
962 UpdatableInset * lock = tli->getLockingInset();
965 owner->view()->unlockInset(tli);
966 TEXT()->cursorRight(owner->view());
967 moveCursorUpdate(true, false);
970 tli->unlockInsetInInset(owner->view(),
979 // --- Misc -------------------------------------------
980 case LFUN_WORDFINDFORWARD :
981 case LFUN_WORDFINDBACKWARD : {
982 static string last_search;
983 string searched_string;
985 if (!argument.empty()) {
986 last_search = argument;
987 searched_string = argument;
989 searched_string = last_search;
991 bool fw = (action == LFUN_WORDFINDBACKWARD);
992 if (!searched_string.empty()) {
993 LyXFind(owner->view(), searched_string, fw);
995 // owner->view()->showCursor();
1001 if (owner->view()->available() && !owner->view()->theLockingInset()) {
1002 owner->view()->update(TEXT(),
1003 BufferView::SELECT|BufferView::FITCUR);
1005 owner->message(keyseq.print());
1009 // --- Misc -------------------------------------------
1010 case LFUN_EXEC_COMMAND:
1012 std::vector<string> allCmds;
1013 std::transform(lyxaction.func_begin(), lyxaction.func_end(),
1014 std::back_inserter(allCmds), lyx::firster());
1015 static std::vector<string> hist;
1016 owner->getMiniBuffer()->getString(MiniBuffer::spaces,
1021 case LFUN_CANCEL: // RVDK_PATCH_5
1024 if (owner->view()->available())
1025 // cancel any selection
1026 dispatch(LFUN_MARK_OFF);
1027 setMessage(N_("Cancel"));
1030 case LFUN_META_FAKE: // RVDK_PATCH_5
1032 meta_fake_bit = Mod1Mask;
1033 setMessage(keyseq.print());
1037 case LFUN_READ_ONLY_TOGGLE:
1038 if (owner->buffer()->lyxvc.inUse()) {
1039 owner->buffer()->lyxvc.toggleReadOnly();
1041 owner->buffer()->setReadonly(
1042 !owner->buffer()->isReadonly());
1046 case LFUN_CENTER: // this is center and redraw.
1047 owner->view()->center();
1050 // --- Menus -----------------------------------------------
1055 case LFUN_MENUNEWTMPLT:
1059 case LFUN_CLOSEBUFFER:
1063 case LFUN_MENUWRITE:
1064 if (!owner->buffer()->isUnnamed()) {
1066 s1 << _("Saving document") << ' '
1067 << MakeDisplayPath(owner->buffer()->fileName() + "...");
1068 owner->message(s1.str().c_str());
1069 MenuWrite(owner->view(), owner->buffer());
1071 WriteAs(owner->view(), owner->buffer());
1075 WriteAs(owner->view(), owner->buffer(), argument);
1078 case LFUN_MENURELOAD:
1083 Exporter::Export(owner->buffer(), argument, true);
1087 Exporter::Preview(owner->buffer(), argument);
1090 case LFUN_BUILDPROG:
1091 Exporter::Export(owner->buffer(), "program", true);
1094 case LFUN_RUNCHKTEX:
1095 MenuRunChktex(owner->buffer());
1098 case LFUN_MENUPRINT:
1099 owner->getDialogs()->showPrint();
1103 if (argument == "custom")
1106 Exporter::Export(owner->buffer(), argument, false);
1124 InsetCommandParams p;
1127 if (action == LFUN_TOCVIEW)
1129 p.setCmdName("tableofcontents");
1131 else if (action == LFUN_LOAVIEW )
1132 p.setCmdName("listof{algorithm}{List of Algorithms}");
1133 else if (action == LFUN_LOFVIEW)
1134 p.setCmdName("listoffigures");
1136 p.setCmdName("listoftables");
1138 owner->getDialogs()->createTOC(p.getAsString());
1142 case LFUN_DIALOG_TABULAR_INSERT:
1143 owner->getDialogs()->showTabularCreate();
1151 AutoSave(owner->view());
1155 owner->view()->menuUndo();
1159 owner->view()->menuRedo();
1162 case LFUN_MENUSEARCH:
1163 owner->getDialogs()->showSearch();
1166 case LFUN_REMOVEERRORS:
1167 if (owner->view()->removeAutoInsets()) {
1168 owner->view()->redraw();
1169 owner->view()->fitCursor();
1174 changeDepth(owner->view(), TEXT(false), 0);
1177 case LFUN_DEPTH_MIN:
1178 changeDepth(owner->view(), TEXT(false), -1);
1181 case LFUN_DEPTH_PLUS:
1182 changeDepth(owner->view(), TEXT(false), 1);
1186 owner->getDialogs()->setUserFreeFont();
1189 case LFUN_RECONFIGURE:
1190 Reconfigure(owner->view());
1194 case LFUN_FLOATSOPERATE:
1195 if (argument == "openfoot")
1196 owner->view()->allFloats(1,0);
1197 else if (argument == "closefoot")
1198 owner->view()->allFloats(0,0);
1199 else if (argument == "openfig")
1200 owner->view()->allFloats(1,1);
1201 else if (argument == "closefig")
1202 owner->view()->allFloats(0,1);
1205 #ifdef WITH_WARNINGS
1206 //#warning Find another implementation here (or another lyxfunc)!
1209 case LFUN_HELP_ABOUTLYX:
1210 owner->getDialogs()->showAboutlyx();
1213 case LFUN_HELP_TEXINFO:
1214 owner->getDialogs()->showTexinfo();
1217 case LFUN_HELP_OPEN:
1219 string const arg = argument;
1221 setErrorMessage(N_("Missing argument"));
1224 owner->prohibitInput();
1225 string const fname = i18nLibFileSearch("doc", arg, "lyx");
1226 if (fname.empty()) {
1227 lyxerr << "LyX: unable to find documentation file `"
1228 << arg << "'. Bad installation?" << endl;
1229 owner->allowInput();
1233 str << _("Opening help file") << ' '
1234 << MakeDisplayPath(fname) << "...";
1235 owner->message(str.str().c_str());
1236 owner->view()->buffer(bufferlist.loadLyXFile(fname, false));
1237 owner->allowInput();
1241 // --- version control -------------------------------
1242 case LFUN_VC_REGISTER:
1244 if (!owner->buffer()->lyxvc.inUse())
1245 owner->buffer()->lyxvc.registrer();
1249 case LFUN_VC_CHECKIN:
1251 if (owner->buffer()->lyxvc.inUse()
1252 && !owner->buffer()->isReadonly())
1253 owner->buffer()->lyxvc.checkIn();
1257 case LFUN_VC_CHECKOUT:
1259 if (owner->buffer()->lyxvc.inUse()
1260 && owner->buffer()->isReadonly())
1261 owner->buffer()->lyxvc.checkOut();
1265 case LFUN_VC_REVERT:
1267 owner->buffer()->lyxvc.revert();
1273 owner->buffer()->lyxvc.undoLast();
1277 case LFUN_VC_HISTORY:
1279 owner->getDialogs()->showVCLogFile();
1283 // --- buffers ----------------------------------------
1285 case LFUN_SWITCHBUFFER:
1286 owner->view()->buffer(bufferlist.getBuffer(argument));
1291 // servercmd: argument must be <file>:<template>
1292 Buffer * tmpbuf = NewLyxFile(argument);
1294 owner->view()->buffer(tmpbuf);
1298 case LFUN_FILE_OPEN:
1302 case LFUN_LATEX_LOG:
1303 owner->getDialogs()->showLogFile();
1306 case LFUN_LAYOUT_DOCUMENT:
1307 owner->getDialogs()->showDocument();
1310 case LFUN_LAYOUT_PARAGRAPH:
1311 owner->getDialogs()->showParagraph();
1314 case LFUN_LAYOUT_CHARACTER:
1315 owner->getDialogs()->showCharacter();
1318 case LFUN_LAYOUT_TABULAR:
1319 if (owner->view()->theLockingInset()) {
1320 if (owner->view()->theLockingInset()->lyxCode()==Inset::TABULAR_CODE) {
1321 InsetTabular * inset = static_cast<InsetTabular *>
1322 (owner->view()->theLockingInset());
1323 inset->openLayoutDialog(owner->view());
1324 } else if (owner->view()->theLockingInset()->
1325 getFirstLockingInsetOfType(Inset::TABULAR_CODE)!=0) {
1326 InsetTabular * inset = static_cast<InsetTabular *>(
1327 owner->view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
1328 inset->openLayoutDialog(owner->view());
1333 case LFUN_LAYOUT_PREAMBLE:
1334 owner->getDialogs()->showPreamble();
1337 case LFUN_DROP_LAYOUTS_CHOICE:
1338 owner->getToolbar()->openLayoutList();
1341 case LFUN_MENU_OPEN_BY_NAME:
1342 owner->getMenubar()->openByName(argument);
1343 break; // RVDK_PATCH_5
1345 case LFUN_SPELLCHECK:
1346 if (lyxrc.isp_command != "none")
1347 owner->getDialogs()->showSpellchecker();
1350 // --- lyxserver commands ----------------------------
1354 setMessage(owner->buffer()->fileName());
1355 lyxerr[Debug::INFO] << "FNAME["
1356 << owner->buffer()->fileName()
1362 dispatch_buffer = keyseq.print();
1363 lyxserver->notifyClient(dispatch_buffer);
1367 case LFUN_GOTOFILEROW:
1371 istringstream istr(argument.c_str());
1372 istr >> file_name >> row;
1373 // Must replace extension of the file to be .lyx and get full path
1374 string const s(ChangeExtension(file_name, ".lyx"));
1376 // Either change buffer or load the file
1377 if (bufferlist.exists(s)) {
1378 owner->view()->buffer(bufferlist.getBuffer(s));
1380 owner->view()->buffer(bufferlist.loadLyXFile(s));
1384 owner->view()->setCursorFromRow(row);
1387 owner->view()->center();
1391 case LFUN_GOTO_PARAGRAPH:
1393 istringstream istr(argument.c_str());
1397 Paragraph * par = owner->buffer()->getParFromID(id);
1399 lyxerr[Debug::INFO] << "No matching paragraph found! ["
1400 << id << "]" << std::endl;
1403 lyxerr << "Paragraph " << par->id()
1404 << " found." << endl;
1407 if (owner->view()->theLockingInset())
1408 owner->view()->unlockInset(owner->view()->theLockingInset());
1409 if (par->inInset()) {
1410 par->inInset()->edit(owner->view());
1413 owner->view()->getLyXText()->setCursor(owner->view(), par, 0);
1414 owner->view()->setState();
1418 owner->view()->center();
1425 int const qa = lyxaction.LookupFunc(argument);
1426 setMessage(lyxaction.helpText(static_cast<kb_action>(qa)));
1430 // --- toolbar ----------------------------------
1431 case LFUN_PUSH_TOOLBAR:
1433 int nth = strToInt(argument);
1435 setErrorMessage(N_("Push-toolbar needs argument > 0"));
1437 owner->getToolbar()->push(nth);
1442 case LFUN_ADD_TO_TOOLBAR:
1444 if (lyxerr.debugging(Debug::GUI)) {
1445 lyxerr << "LFUN_ADD_TO_TOOLBAR:"
1446 "argument = `" << argument << '\'' << endl;
1448 string tmp(argument);
1449 //lyxerr <<string("Argument: ") + argument);
1450 //lyxerr <<string("Tmp : ") + tmp);
1452 setErrorMessage(N_("Usage: toolbar-add-to <LyX command>"));
1454 owner->getToolbar()->add(argument, false);
1455 owner->getToolbar()->set();
1460 // --- insert characters ----------------------------------------
1462 // --- Mathed stuff. If we are here, there is no locked inset yet.
1463 case LFUN_MATH_EXTERN:
1464 case LFUN_MATH_NUMBER:
1465 case LFUN_MATH_NONUMBER:
1466 case LFUN_MATH_LIMITS:
1468 setErrorMessage(N_("This is only allowed in math mode!"));
1472 // passthrough hat and underscore outside mathed:
1473 case LFUN_SUBSCRIPT:
1474 dispatch(LFUN_SELFINSERT, "_");
1476 case LFUN_SUPERSCRIPT:
1477 dispatch(LFUN_SELFINSERT, "^");
1480 case LFUN_MATH_PANEL:
1481 owner->getDialogs()->showMathPanel();
1484 case LFUN_CITATION_CREATE:
1486 InsetCommandParams p( "cite" );
1488 if (!argument.empty()) {
1489 // This should be set at source, ie when typing
1490 // "citation-insert foo" in the minibuffer.
1491 // Question: would pybibliographer also need to be
1492 // changed. Suspect so. Leave as-is therefore.
1493 if (contains(argument, "|")) {
1494 p.setContents( token(argument, '|', 0) );
1495 p.setOptions( token(argument, '|', 1) );
1497 p.setContents( argument );
1499 dispatch(LFUN_CITATION_INSERT, p.getAsString());
1501 owner->getDialogs()->createCitation( p.getAsString() );
1505 case LFUN_CHILDOPEN:
1507 string const filename =
1508 MakeAbsPath(argument,
1509 owner->buffer()->filePath());
1510 setMessage(N_("Opening child document ") +
1511 MakeDisplayPath(filename) + "...");
1512 owner->view()->savePosition(0);
1513 if (bufferlist.exists(filename))
1514 owner->view()->buffer(bufferlist.getBuffer(filename));
1516 owner->view()->buffer(bufferlist.loadLyXFile(filename));
1520 case LFUN_TOGGLECURSORFOLLOW:
1521 lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
1524 case LFUN_KMAP_OFF: // keymap off
1525 owner->getIntl()->KeyMapOn(false);
1528 case LFUN_KMAP_PRIM: // primary keymap
1529 owner->getIntl()->KeyMapPrim();
1532 case LFUN_KMAP_SEC: // secondary keymap
1533 owner->getIntl()->KeyMapSec();
1536 case LFUN_KMAP_TOGGLE: // toggle keymap
1537 owner->getIntl()->ToggleKeyMap();
1542 // argument contains ';'-terminated commands
1543 while (argument.find(';') != string::npos) {
1545 argument = split(argument, first, ';');
1546 verboseDispatch(first, false);
1551 case LFUN_DIALOG_PREFERENCES:
1552 owner->getDialogs()->showPreferences();
1555 case LFUN_SAVEPREFERENCES:
1557 Path p(user_lyxdir);
1558 lyxrc.write("preferences");
1562 case LFUN_SCREEN_FONT_UPDATE:
1564 // handle the screen font changes.
1566 lyxrc.set_font_norm_type();
1567 fontloader.update();
1568 // Of course we should only do the resize and the textcache.clear
1569 // if values really changed...but not very important right now. (Lgb)
1570 // All visible buffers will need resize
1572 // We also need to empty the textcache so that
1573 // the buffer will be formatted correctly after
1579 case LFUN_SET_COLOR:
1582 string const x11_name = split(argument, lyx_name, ' ');
1583 if (lyx_name.empty() || x11_name.empty()) {
1584 setErrorMessage(N_("Syntax: set-color <lyx_name>"
1589 if (!lcolor.setColor(lyx_name, x11_name)) {
1590 static string const err1 (N_("Set-color \""));
1591 static string const err2 (
1592 N_("\" failed - color is undefined "
1593 "or may not be redefined"));
1594 setErrorMessage(_(err1) + lyx_name + _(err2));
1597 lyxColorHandler->updateColor(lcolor.getFromLyXName(lyx_name));
1598 owner->view()->redraw();
1603 owner->message(argument);
1606 case LFUN_MESSAGE_PUSH:
1607 owner->messagePush(argument);
1610 case LFUN_MESSAGE_POP:
1611 owner->messagePop();
1615 // Then if it was none of the above
1616 if (!owner->view()->Dispatch(action, argument))
1617 lyxerr << "A truly unknown func ["
1618 << lyxaction.getActionName(action) << "]!"
1625 string const res = getMessage();
1628 owner->message(_(res));
1629 owner->updateMenubar();
1630 owner->updateToolbar();
1636 void LyXFunc::setupLocalKeymap()
1638 keyseq.stdmap = keyseq.curmap = toplevel_keymap.get();
1639 cancel_meta_seq.stdmap = cancel_meta_seq.curmap = toplevel_keymap.get();
1643 void LyXFunc::menuNew(bool fromTemplate)
1645 string initpath = lyxrc.document_path;
1647 if (owner->view()->available()) {
1648 string const trypath = owner->buffer()->filePath();
1649 // If directory is writeable, use this as default.
1650 if (IsDirWriteable(trypath))
1654 static int newfile_number;
1657 if (lyxrc.new_ask_filename) {
1658 FileDialog fileDlg(owner, _("Enter filename for new document"),
1659 LFUN_SELECT_FILE_SYNC,
1660 make_pair(string(_("Documents|#o#O")),
1661 string(lyxrc.document_path)),
1662 make_pair(string(_("Templates|#T#t")),
1663 string(lyxrc.template_path)));
1665 FileDialog::Result result =
1666 fileDlg.Select(initpath,
1667 _("*.lyx|LyX Documents (*.lyx)"),
1670 if (result.second.empty()) {
1671 owner->message(_("Canceled."));
1672 lyxerr[Debug::INFO] << "New Document Cancelled." << endl;
1676 // get absolute path of file and make sure the filename ends
1678 s = MakeAbsPath(result.second);
1679 if (!IsLyXFilename(s))
1682 // Check if the document already is open
1683 if (bufferlist.exists(s)) {
1684 switch (Alert::askConfirmation(_("Document is already open:"),
1685 MakeDisplayPath(s, 50),
1686 _("Do you want to close that document now?\n"
1687 "('No' will just switch to the open version)")))
1689 case 1: // Yes: close the document
1690 if (!bufferlist.close(bufferlist.getBuffer(s)))
1691 // If close is canceled, we cancel here too.
1694 case 2: // No: switch to the open document
1695 owner->view()->buffer(bufferlist.getBuffer(s));
1697 case 3: // Cancel: Do nothing
1698 owner->message(_("Canceled."));
1702 // Check whether the file already exists
1704 if (fi.readable() &&
1705 Alert::askQuestion(_("File already exists:"),
1706 MakeDisplayPath(s, 50),
1707 _("Do you want to open the document?"))) {
1709 string const disp_fn(MakeDisplayPath(s));
1712 str << _("Opening document") << ' '
1713 << disp_fn << "...";
1715 owner->message(str.str().c_str());
1716 //XFlush(fl_get_display());
1717 owner->view()->buffer(bufferlist.loadLyXFile(s));
1719 str2 << _("Document") << ' '
1720 << disp_fn << ' ' << _("opened.");
1722 owner->message(str2.str().c_str());
1727 s = AddName(lyxrc.document_path,
1728 "newfile" + tostr(++newfile_number) + ".lyx");
1730 while (bufferlist.exists(s) || fi.readable()) {
1732 s = AddName(lyxrc.document_path,
1733 "newfile" + tostr(newfile_number) +
1739 // The template stuff
1742 FileDialog fileDlg(owner, _("Select template file"),
1743 LFUN_SELECT_FILE_SYNC,
1744 make_pair(string(_("Documents|#o#O")),
1745 string(lyxrc.document_path)),
1746 make_pair(string(_("Templates|#T#t")),
1747 string(lyxrc.template_path)));
1749 FileDialog::Result result =
1750 fileDlg.Select(lyxrc.template_path,
1751 _("*.lyx|LyX Documents (*.lyx)"));
1753 if (result.first == FileDialog::Later)
1756 string const fname = result.second;
1763 // find a free buffer
1764 lyxerr[Debug::INFO] << "Find a free buffer." << endl;
1765 owner->view()->buffer(bufferlist.newFile(s, templname));
1769 void LyXFunc::open(string const & fname)
1771 string initpath = lyxrc.document_path;
1773 if (owner->view()->available()) {
1774 string const trypath = owner->buffer()->filePath();
1775 // If directory is writeable, use this as default.
1776 if (IsDirWriteable(trypath))
1782 if (fname.empty()) {
1783 FileDialog fileDlg(owner, _("Select document to open"),
1785 make_pair(string(_("Documents|#o#O")),
1786 string(lyxrc.document_path)),
1787 make_pair(string(_("Examples|#E#e")),
1788 string(AddPath(system_lyxdir, "examples"))));
1790 FileDialog::Result result =
1791 fileDlg.Select(initpath,
1792 "*.lyx|LyX Documents (*.lyx)");
1794 if (result.first == FileDialog::Later)
1797 filename = result.second;
1799 // check selected filename
1800 if (filename.empty()) {
1801 owner->message(_("Canceled."));
1807 // get absolute path of file and add ".lyx" to the filename if
1809 string const fullpath = FileSearch(string(), filename, "lyx");
1810 if (fullpath.empty()) {
1811 Alert::alert(_("Error"), _("Could not find file"), filename);
1815 filename = fullpath;
1818 string const disp_fn(MakeDisplayPath(filename));
1821 str << _("Opening document") << ' ' << disp_fn << "...";
1823 owner->message(str.str().c_str());
1825 Buffer * openbuf = bufferlist.loadLyXFile(filename);
1827 owner->view()->buffer(openbuf);
1829 str << _("Document") << ' ' << disp_fn << ' ' << _("opened.");
1830 owner->message(str.str().c_str());
1833 str << _("Could not open document") << ' ' << disp_fn;
1834 owner->message(str.str().c_str());
1839 // checks for running without gui are missing.
1840 void LyXFunc::doImport(string const & argument)
1843 string filename = split(argument, format, ' ');
1844 lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format
1845 << " file: " << filename << endl;
1847 if (filename.empty()) { // need user interaction
1848 string initpath = lyxrc.document_path;
1850 if (owner->view()->available()) {
1851 string const trypath = owner->buffer()->filePath();
1852 // If directory is writeable, use this as default.
1853 if (IsDirWriteable(trypath))
1857 string const text = _("Select ") + formats.prettyName(format)
1858 + _(" file to import");
1860 FileDialog fileDlg(owner, text,
1862 make_pair(string(_("Documents|#o#O")),
1863 string(lyxrc.document_path)),
1864 make_pair(string(_("Examples|#E#e")),
1865 string(AddPath(system_lyxdir, "examples"))));
1867 string const extension = "*." + formats.extension(format)
1868 + "| " + formats.prettyName(format)
1869 + " (*." + formats.extension(format) + ")";
1871 FileDialog::Result result = fileDlg.Select(initpath,
1874 if (result.first == FileDialog::Later)
1877 filename = result.second;
1879 // check selected filename
1880 if (filename.empty())
1881 owner->message(_("Canceled."));
1884 // still no filename? abort
1885 if (filename.empty())
1888 // get absolute path of file
1889 filename = MakeAbsPath(filename);
1891 string const lyxfile = ChangeExtension(filename, ".lyx");
1893 // Check if the document already is open
1894 if (bufferlist.exists(lyxfile)) {
1895 switch (Alert::askConfirmation(_("Document is already open:"),
1896 MakeDisplayPath(lyxfile, 50),
1897 _("Do you want to close that document now?\n"
1898 "('No' will just switch to the open version)")))
1900 case 1: // Yes: close the document
1901 if (!bufferlist.close(bufferlist.getBuffer(lyxfile)))
1902 // If close is canceled, we cancel here too.
1905 case 2: // No: switch to the open document
1906 owner->view()->buffer(bufferlist.getBuffer(lyxfile));
1908 case 3: // Cancel: Do nothing
1909 owner->message(_("Canceled."));
1914 // Check if a LyX document by the same root exists in filesystem
1915 FileInfo const f(lyxfile, true);
1916 if (f.exist() && !Alert::askQuestion(_("A document by the name"),
1917 MakeDisplayPath(lyxfile),
1918 _("already exists. Overwrite?"))) {
1919 owner->message(_("Canceled"));
1922 // filename should be valid now
1924 Importer::Import(owner, filename, format);
1928 void LyXFunc::reloadBuffer()
1930 string const fn = owner->buffer()->fileName();
1931 if (bufferlist.close(owner->buffer()))
1932 owner->view()->buffer(bufferlist.loadLyXFile(fn));
1936 void LyXFunc::closeBuffer()
1938 if (bufferlist.close(owner->buffer()) && !quitting) {
1939 if (bufferlist.empty()) {
1940 // need this otherwise SEGV may occur while trying to
1941 // set variables that don't exist
1942 // since there's no current buffer
1943 owner->getDialogs()->hideBufferDependent();
1945 owner->view()->buffer(bufferlist.first());
1951 // Each "owner" should have it's own message method. lyxview and
1952 // the minibuffer would use the minibuffer, but lyxserver would
1953 // send an ERROR signal to its client. Alejandro 970603
1954 // This func is bit problematic when it comes to NLS, to make the
1955 // lyx servers client be language indepenent we must not translate
1956 // strings sent to this func.
1957 void LyXFunc::setErrorMessage(string const & m) const
1959 dispatch_buffer = m;
1964 void LyXFunc::setMessage(string const & m) const
1966 dispatch_buffer = m;
1970 void LyXFunc::setStatusMessage(string const & m) const
1976 void LyXFunc::initMiniBuffer()
1978 string text = _("Welcome to LyX!");
1980 // When meta-fake key is pressed, show the key sequence so far + "M-".
1982 text = keyseq.print();
1986 // Else, when a non-complete key sequence is pressed,
1987 // show the available options.
1988 if (keyseq.length() > 0 && !keyseq.deleted()) {
1989 text = keyseq.printOptions();
1992 // Else, show the buffer state.
1993 else if (owner->view()->available()) {
1994 Buffer * tmpbuf = owner->buffer();
1996 string const nicename =
1997 MakeDisplayPath(tmpbuf->fileName());
1998 // Should we do this instead? (kindo like emacs)
1999 // leaves more room for other information
2002 if (tmpbuf->lyxvc.inUse()) {
2004 text += tmpbuf->lyxvc.versionString();
2006 text += tmpbuf->lyxvc.locker();
2007 if (tmpbuf->isReadonly())
2010 } else if (tmpbuf->isReadonly())
2012 if (!tmpbuf->isLyxClean())
2013 text += _(" (Changed)");
2015 if (text != _("Welcome to LyX!")) // this is a hack
2016 text = _("* No document open *");
2019 owner->message(text);