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 =========================================================== */
161 // Initialization of static member var
162 bool LyXFunc::show_sc = true;
165 LyXFunc::LyXFunc(LyXView * o)
167 keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
168 cancel_meta_seq(toplevel_keymap.get(), toplevel_keymap.get())
171 lyx_dead_action = LFUN_NOACTION;
172 lyx_calling_dead_action = LFUN_NOACTION;
177 LyXText * LyXFunc::TEXT(bool flag = true) const
180 return owner->view()->text;
181 return owner->view()->getLyXText();
185 // I changed this func slightly. I commented out the ...FinishUndo(),
186 // this means that all places that used to have a moveCursorUpdate, now
187 // have a ...FinishUndo() as the preceeding statement. I have also added
188 // a moveCursorUpdate to some of the functions that updated the cursor, but
189 // that did not show its new position.
191 void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
193 if (selecting || TEXT(flag)->selection.mark()) {
194 TEXT(flag)->setSelection(owner->view());
195 if (TEXT(flag)->bv_owner)
196 owner->view()->toggleToggle();
198 owner->view()->update(TEXT(flag), BufferView::SELECT|BufferView::FITCUR);
199 owner->view()->showCursor();
201 /* ---> Everytime the cursor is moved, show the current font state. */
202 // should this too me moved out of this func?
203 owner->view()->setState();
207 void LyXFunc::handleKeyFunc(kb_action action)
209 char c = keyseq.getiso();
211 if (keyseq.length() > 1) {
215 owner->getIntl()->getTrans()
216 .deadkey(c, get_accent(action).accent, TEXT(false));
217 // Need to clear, in case the minibuffer calls these
220 // copied verbatim from do_accent_char
221 owner->view()->update(TEXT(false),
222 BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
223 TEXT(false)->selection.cursor = TEXT(false)->cursor;
227 void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
231 if (lyxerr.debugging(Debug::KEY)) {
232 char const * tmp = XKeysymToString(keysym);
233 string const stm = (tmp ? tmp : "");
234 lyxerr << "KeySym is "
237 << keysym << "] State is ["
241 // Do nothing if we have nothing (JMarc)
242 if (keysym == NoSymbol) {
243 lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
248 // Can we be sure that this will work for all X Window
249 // implementations? (Lgb)
250 // This code snippet makes lyx ignore some keys. Perhaps
251 // all of them should be explictly mentioned?
252 if ((keysym >= XK_Shift_L && keysym <= XK_Hyper_R)
253 || keysym == XK_Mode_switch || keysym == 0x0) {
257 // Do a one-deep top-level lookup for
258 // cancel and meta-fake keys. RVDK_PATCH_5
259 cancel_meta_seq.reset();
261 int action = cancel_meta_seq.addkey(keysym, state
262 &(ShiftMask|ControlMask
264 if (lyxerr.debugging(Debug::KEY)) {
265 lyxerr << "action first set to [" << action << "]" << endl;
268 // When not cancel or meta-fake, do the normal lookup.
269 // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
270 // Mostly, meta_fake_bit = 0. RVDK_PATCH_5.
271 if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) {
272 if (lyxerr.debugging(Debug::KEY)) {
273 lyxerr << "meta_fake_bit is ["
274 << meta_fake_bit << "]" << endl;
276 // remove Caps Lock and Mod2 as a modifiers
277 action = keyseq.addkey(keysym,
278 (state | meta_fake_bit)
279 &(ShiftMask|ControlMask
281 if (lyxerr.debugging(Debug::KEY)) {
282 lyxerr << "action now set to ["
283 << action << "]" << endl;
286 // Dont remove this unless you know what you are doing.
289 // can this happen now ?
290 if (action == LFUN_NOACTION) {
291 action = LFUN_PREFIX;
294 if (lyxerr.debugging(Debug::KEY)) {
295 lyxerr << "Key [action="
297 << keyseq.print() << "]"
301 // already here we know if it any point in going further
302 // why not return already here if action == -1 and
303 // num_bytes == 0? (Lgb)
305 if (keyseq.length() > 1 && !keyseq.deleted()) {
306 owner->message(keyseq.print());
309 if (action == LFUN_UNKNOWN_ACTION) {
310 // It is unknown, but what if we remove all
311 // the modifiers? (Lgb)
312 action = keyseq.addkey(keysym, 0);
314 if (lyxerr.debugging(Debug::KEY)) {
315 lyxerr << "Removing modifiers...\n"
316 << "Action now set to ["
317 << action << "]" << endl;
319 if (action == LFUN_UNKNOWN_ACTION) {
320 owner->message(_("Unknown function."));
325 if (action == LFUN_SELFINSERT) {
326 // This is very X dependent.
327 unsigned int c = keysym;
329 c = kb_keymap::getiso(c);
332 argument = static_cast<char>(c);
333 lyxerr[Debug::KEY] << "SelfInsert arg[`"
334 << argument << "']" << endl;
337 bool tmp_sc = show_sc;
339 dispatch(action, argument);
346 func_status::value_type LyXFunc::getStatus(int ac) const
348 return getStatus(ac, string());
352 func_status::value_type LyXFunc::getStatus(int ac,
353 string const & not_to_use_arg) const
356 func_status::value_type flag = func_status::OK;
358 Buffer * buf = owner->buffer();
360 if (lyxaction.isPseudoAction(ac))
361 action = lyxaction.retrieveActionArg(ac, argument);
363 action = static_cast<kb_action>(ac);
364 if (!not_to_use_arg.empty())
365 argument = not_to_use_arg; // exept here
368 if (action == LFUN_UNKNOWN_ACTION) {
369 setErrorMessage(N_("Unknown action"));
370 return func_status::Unknown;
373 // Check whether we need a buffer
374 if (!lyxaction.funcHasFlag(action, LyXAction::NoBuffer)) {
375 // Yes we need a buffer, do we have one?
378 // Can we use a readonly buffer?
379 if (buf->isReadonly() &&
380 !lyxaction.funcHasFlag(action,
381 LyXAction::ReadOnly)) {
383 setErrorMessage(N_("Document is read-only"));
384 flag |= func_status::Disabled;
388 setErrorMessage(N_("Command not allowed with"
389 "out any document open"));
390 flag |= func_status::Disabled;
395 // I would really like to avoid having this switch and rather try to
396 // encode this in the function itself.
397 bool disable = false;
400 disable = !Exporter::IsExportable(buf, "dvi")
401 || lyxrc.print_command == "none";
404 disable = argument == "fax" &&
405 !Exporter::IsExportable(buf, argument);
408 disable = buf->undostack.empty();
411 disable = buf->redostack.empty();
413 case LFUN_SPELLCHECK:
414 disable = lyxrc.isp_command == "none";
416 #ifndef HAVE_LIBAIKSAURUS
417 case LFUN_THESAURUS_ENTRY:
422 disable = lyxrc.chktex_command == "none";
425 disable = !Exporter::IsExportable(buf, "program");
428 case LFUN_LAYOUT_TABULAR:
430 if (owner->view()->theLockingInset()) {
431 disable = (owner->view()->theLockingInset()->lyxCode() != Inset::TABULAR_CODE) &&
432 !owner->view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE);
436 case LFUN_TABULAR_FEATURE:
438 if (owner->view()->theLockingInset()) {
439 func_status::value_type ret = func_status::Disabled;
440 if (owner->view()->theLockingInset()->lyxCode() == Inset::TABULAR_CODE) {
441 ret = static_cast<InsetTabular *>
442 (owner->view()->theLockingInset())->
444 } else if (owner->view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
445 ret = static_cast<InsetTabular *>
446 (owner->view()->theLockingInset()->
447 getFirstLockingInsetOfType(Inset::TABULAR_CODE))->
453 static InsetTabular inset(*owner->buffer(), 1, 1);
454 func_status::value_type ret;
457 ret = inset.getStatus(argument);
458 if ((ret & func_status::ToggleOn) ||
459 (ret & func_status::ToggleOff))
460 flag |= func_status::ToggleOff;
464 case LFUN_VC_REGISTER:
465 disable = buf->lyxvc.inUse();
467 case LFUN_VC_CHECKIN:
468 disable = !buf->lyxvc.inUse() || buf->isReadonly();
470 case LFUN_VC_CHECKOUT:
471 disable = !buf->lyxvc.inUse() || !buf->isReadonly();
475 case LFUN_VC_HISTORY:
476 disable = !buf->lyxvc.inUse();
478 case LFUN_BOOKMARK_GOTO:
479 disable = !owner->view()->
480 isSavedPosition(strToUnsignedInt(argument));
484 case LFUN_INSET_TOGGLE:
485 disable = (TEXT(false)->getInset() == 0);
488 case LFUN_MATH_VALIGN: {
489 // I think this test can be simplified (Andre')
490 // mathcursor is != 0 iff we are in math mode
491 //Inset * tli = owner->view()->theLockingInset();
492 //if (tli && (tli->lyxCode() == Inset::MATH_CODE
493 // || tli->lyxCode() == Inset::MATHMACRO_CODE)) {
496 char align = mathcursor->valign();
501 if (argument.empty()) {
502 flag = func_status::OK;
505 if (!contains("tcb", argument[0])) {
509 if (argument[0] == align)
510 flag |= func_status::ToggleOn;
512 flag |= func_status::ToggleOff;
517 case LFUN_MATH_HALIGN: {
518 //Inset * tli = owner->view()->theLockingInset();
519 //if (tli && (tli->lyxCode() == Inset::MATH_CODE
520 // || tli->lyxCode() == Inset::MATHMACRO_CODE)) {
522 char align = mathcursor->halign();
527 if (argument.empty()) {
528 flag = func_status::OK;
531 if (!contains("lcr", argument[0])) {
535 if (argument[0] == align)
536 flag |= func_status::ToggleOn;
538 flag |= func_status::ToggleOff;
543 case LFUN_MATH_MUTATE: {
544 Inset * tli = owner->view()->theLockingInset();
545 if (tli && (tli->lyxCode() == Inset::MATH_CODE)) {
546 MathInsetTypes type = mathcursor->formula()->getType();
547 func_status::value_type box = func_status::ToggleOff;
548 if (argument == "inline") {
549 if (type == LM_OT_SIMPLE)
550 box = func_status::ToggleOn;
551 } else if (argument == "display") {
552 if (type == LM_OT_EQUATION)
553 box = func_status::ToggleOn;
554 } else if (argument == "eqnarray") {
555 if (type == LM_OT_EQNARRAY)
556 box = func_status::ToggleOn;
557 } else if (argument == "align") {
558 if (type == LM_OT_ALIGN)
559 box = func_status::ToggleOn;
561 box = func_status::OK;
570 // we just need to be in math mode to enable that
572 case LFUN_MATH_SPACE:
573 case LFUN_MATH_LIMITS:
574 case LFUN_MATH_NONUMBER:
575 case LFUN_MATH_NUMBER:
577 case LFUN_SUPERSCRIPT:
578 disable = !mathcursor;
581 // we need to be math mode and a math array for that
582 // Hack: halign produces non-zero result iff we are in a math array
583 case LFUN_MATH_ROW_INSERT:
584 case LFUN_MATH_ROW_DELETE:
585 case LFUN_MATH_COLUMN_INSERT:
586 case LFUN_MATH_COLUMN_DELETE:
587 disable = !mathcursor || !mathcursor->halign();
594 // the functions which insert insets
595 Inset::Code code = Inset::NO_CODE;
597 case LFUN_INSET_TEXT:
598 code = Inset::TEXT_CODE;
601 code = Inset::ERT_CODE;
604 case LFUN_INSET_GRAPHICS:
605 code = Inset::GRAPHICS_CODE;
607 case LFUN_INSET_FOOTNOTE:
608 code = Inset::FOOT_CODE;
610 case LFUN_DIALOG_TABULAR_INSERT:
611 case LFUN_INSET_TABULAR:
612 code = Inset::TABULAR_CODE;
614 case LFUN_INSET_EXTERNAL:
615 code = Inset::EXTERNAL_CODE;
617 case LFUN_INSET_MARGINAL:
618 code = Inset::MARGIN_CODE;
620 case LFUN_INSET_MINIPAGE:
621 code = Inset::MINIPAGE_CODE;
623 case LFUN_INSET_FLOAT:
624 case LFUN_INSET_WIDE_FLOAT:
625 code = Inset::FLOAT_CODE;
627 case LFUN_FLOAT_LIST:
628 code = Inset::FLOAT_LIST_CODE;
631 case LFUN_INSET_LIST:
632 code = Inset::LIST_CODE;
634 case LFUN_INSET_THEOREM:
635 code = Inset::THEOREM_CODE;
638 case LFUN_INSET_CAPTION:
639 code = Inset::CAPTION_CODE;
641 case LFUN_INSERT_NOTE:
642 code = Inset::IGNORE_CODE;
644 case LFUN_INSERT_LABEL:
645 code = Inset::LABEL_CODE;
647 case LFUN_REF_INSERT:
648 code = Inset::REF_CODE;
650 case LFUN_CITATION_CREATE:
651 case LFUN_CITATION_INSERT:
652 code = Inset::CITE_CODE;
654 case LFUN_INSERT_BIBTEX:
655 code = Inset::BIBTEX_CODE;
657 case LFUN_INDEX_INSERT:
658 case LFUN_INDEX_INSERT_LAST:
659 case LFUN_INDEX_CREATE:
660 code = Inset::INDEX_CODE;
662 case LFUN_INDEX_PRINT:
663 code = Inset::INDEX_PRINT_CODE;
665 case LFUN_CHILD_INSERT:
666 code = Inset::INCLUDE_CODE;
668 case LFUN_TOC_INSERT:
669 code = Inset::TOC_CODE;
671 case LFUN_PARENTINSERT:
672 code = Inset::PARENT_CODE;
676 case LFUN_INSERT_URL:
677 code = Inset::URL_CODE;
680 // always allow this, since we will inset a raw quote
681 // if an inset is not allowed.
683 case LFUN_HYPHENATION:
684 case LFUN_LIGATURE_BREAK:
686 case LFUN_MENU_SEPARATOR:
688 case LFUN_END_OF_SENTENCE:
689 case LFUN_PROTECTEDSPACE:
690 code = Inset::SPECIALCHAR_CODE;
695 if (code != Inset::NO_CODE
696 && owner->view()->theLockingInset()
697 && !owner->view()->theLockingInset()->insetAllowed(code)) {
702 flag |= func_status::Disabled;
704 // the font related functions (and a few others)
705 func_status::value_type box = func_status::ToggleOff;
706 LyXFont const & font =
707 TEXT(false)->real_current_font;
710 if (font.emph() == LyXFont::ON)
711 box = func_status::ToggleOn;
714 if (font.noun() == LyXFont::ON)
715 box = func_status::ToggleOn;
718 if (font.series() == LyXFont::BOLD_SERIES)
719 box = func_status::ToggleOn;
721 case LFUN_READ_ONLY_TOGGLE:
722 if (buf->isReadonly())
723 box = func_status::ToggleOn;
726 if (TEXT(false)->cursor.par()->params().startOfAppendix())
727 box = func_status::ToggleOn;
730 box = func_status::OK;
739 // temporary dispatch method
740 void LyXFunc::miniDispatch(string const & s)
742 string s2(frontStrip(strip(s)));
750 string const LyXFunc::dispatch(string const & s)
752 // Split command string into command and argument
754 string line = frontStrip(s);
755 string const arg = strip(frontStrip(split(line, cmd, ' ')));
757 int action = lyxaction.LookupFunc(cmd);
759 if (action == LFUN_UNKNOWN_ACTION) {
760 string const msg = string(_("Unknown function ("))
765 return dispatch(action, arg);
770 string const LyXFunc::dispatch(int ac,
771 string const & do_not_use_this_arg)
773 lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: action[" << ac
774 <<"] arg[" << do_not_use_this_arg << "]" << endl;
779 // we have not done anything wrong yet.
781 dispatch_buffer.erase();
783 // if action is a pseudo-action, we need the real action
784 if (lyxaction.isPseudoAction(ac)) {
786 action = static_cast<kb_action>
787 (lyxaction.retrieveActionArg(ac, tmparg));
791 action = static_cast<kb_action>(ac);
792 if (!do_not_use_this_arg.empty())
793 argument = do_not_use_this_arg; // except here
797 #ifdef NEW_DISPATCHER
798 // We try do call the most specific dispatcher first:
799 // 1. the lockinginset's dispatch
800 // 2. the bufferview's dispatch
801 // 3. the lyxview's dispatch
804 selection_possible = false;
806 if (owner->view()->available())
807 owner->view()->hideCursor();
809 // We cannot use this function here
810 if (getStatus(ac, do_not_use_this_arg) & func_status::Disabled) {
811 lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: "
812 << lyxaction.getActionName(ac)
813 << " [" << ac << "] is disabled at this location"
815 goto exit_with_message;
818 if (owner->view()->available() && owner->view()->theLockingInset()) {
819 UpdatableInset::RESULT result;
820 if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
821 (!keyseq.deleted())))
823 if ((action==LFUN_UNKNOWN_ACTION) && argument.empty()){
824 argument = keyseq.getiso();
826 // Undo/Redo is a bit tricky for insets.
827 if (action == LFUN_UNDO) {
828 owner->view()->menuUndo();
830 } else if (action == LFUN_REDO) {
831 owner->view()->menuRedo();
833 } else if (((result=owner->view()->theLockingInset()->
834 localDispatch(owner->view(), action, argument)) ==
835 UpdatableInset::DISPATCHED) ||
836 (result == UpdatableInset::DISPATCHED_NOUPDATE))
838 else if (result == UpdatableInset::FINISHED) {
839 if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
840 TEXT()->cursorRight(owner->view());
841 moveCursorUpdate(true, false);
845 } else if (result == UpdatableInset::FINISHED_RIGHT) {
846 if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
847 TEXT()->cursorRight(owner->view());
848 moveCursorUpdate(true, false);
852 } else if (result == UpdatableInset::FINISHED_UP) {
853 if (TEXT()->cursor.row()->previous()) {
854 TEXT()->cursorUp(owner->view());
855 moveCursorUpdate(true, false);
859 } else if (result == UpdatableInset::FINISHED_DOWN) {
860 if (TEXT()->cursor.row()->next())
861 TEXT()->cursorDown(owner->view());
863 TEXT()->cursorRight(owner->view());
864 moveCursorUpdate(true, false);
868 //setMessage(N_("Text mode"));
870 case LFUN_UNKNOWN_ACTION:
871 case LFUN_BREAKPARAGRAPH:
873 TEXT()->cursorRight(owner->view());
874 owner->view()->setState();
878 if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
879 TEXT()->cursorRight(owner->view());
880 moveCursorUpdate(true, false);
885 if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
886 TEXT()->cursorRight(owner->view());
887 moveCursorUpdate(true, false);
892 if (TEXT()->cursor.row()->next())
893 TEXT()->cursorDown(owner->view());
895 TEXT()->cursorRight(owner->view());
896 moveCursorUpdate(true, false);
910 if (!owner->view()->available()) break;
912 // this function should be used always [asierra060396]
913 UpdatableInset * tli =
914 owner->view()->theLockingInset();
916 UpdatableInset * lock = tli->getLockingInset();
919 owner->view()->unlockInset(tli);
920 TEXT()->cursorRight(owner->view());
921 moveCursorUpdate(true, false);
924 tli->unlockInsetInInset(owner->view(),
932 // --- Misc -------------------------------------------
933 case LFUN_WORDFINDFORWARD :
934 case LFUN_WORDFINDBACKWARD : {
935 static string last_search;
936 string searched_string;
938 if (!argument.empty()) {
939 last_search = argument;
940 searched_string = argument;
942 searched_string = last_search;
944 bool fw = (action == LFUN_WORDFINDBACKWARD);
945 if (!searched_string.empty()) {
946 LyXFind(owner->view(), searched_string, fw);
948 // owner->view()->showCursor();
954 if (owner->view()->available() && !owner->view()->theLockingInset()) {
955 owner->view()->update(TEXT(),
956 BufferView::SELECT|BufferView::FITCUR);
958 owner->message(keyseq.print());
962 // --- Misc -------------------------------------------
963 case LFUN_EXEC_COMMAND:
965 std::vector<string> allCmds;
966 std::transform(lyxaction.func_begin(), lyxaction.func_end(),
967 std::back_inserter(allCmds), lyx::firster());
968 static std::vector<string> hist;
969 owner->getMiniBuffer()->getString(MiniBuffer::spaces,
974 case LFUN_CANCEL: // RVDK_PATCH_5
977 if (owner->view()->available())
978 // cancel any selection
979 dispatch(LFUN_MARK_OFF);
980 setMessage(N_("Cancel"));
983 case LFUN_META_FAKE: // RVDK_PATCH_5
985 meta_fake_bit = Mod1Mask;
986 setMessage(keyseq.print());
990 case LFUN_READ_ONLY_TOGGLE:
991 if (owner->buffer()->lyxvc.inUse()) {
992 owner->buffer()->lyxvc.toggleReadOnly();
994 owner->buffer()->setReadonly(
995 !owner->buffer()->isReadonly());
999 case LFUN_CENTER: // this is center and redraw.
1000 owner->view()->center();
1003 // --- Menus -----------------------------------------------
1008 case LFUN_MENUNEWTMPLT:
1012 case LFUN_CLOSEBUFFER:
1016 case LFUN_MENUWRITE:
1017 if (!owner->buffer()->isUnnamed()) {
1019 s1 << _("Saving document") << ' '
1020 << MakeDisplayPath(owner->buffer()->fileName() + "...");
1021 owner->message(s1.str().c_str());
1022 MenuWrite(owner->view(), owner->buffer());
1024 WriteAs(owner->view(), owner->buffer());
1028 WriteAs(owner->view(), owner->buffer(), argument);
1031 case LFUN_MENURELOAD:
1036 Exporter::Export(owner->buffer(), argument, true);
1040 Exporter::Preview(owner->buffer(), argument);
1043 case LFUN_BUILDPROG:
1044 Exporter::Export(owner->buffer(), "program", true);
1047 case LFUN_RUNCHKTEX:
1048 MenuRunChktex(owner->buffer());
1051 case LFUN_MENUPRINT:
1052 owner->getDialogs()->showPrint();
1056 if (argument == "custom")
1059 Exporter::Export(owner->buffer(), argument, false);
1077 InsetCommandParams p;
1080 if (action == LFUN_TOCVIEW)
1082 p.setCmdName("tableofcontents");
1084 else if (action == LFUN_LOAVIEW )
1085 p.setCmdName("listof{algorithm}{List of Algorithms}");
1086 else if (action == LFUN_LOFVIEW)
1087 p.setCmdName("listoffigures");
1089 p.setCmdName("listoftables");
1091 owner->getDialogs()->createTOC(p.getAsString());
1095 case LFUN_DIALOG_TABULAR_INSERT:
1096 owner->getDialogs()->showTabularCreate();
1104 AutoSave(owner->view());
1108 owner->view()->menuUndo();
1112 owner->view()->menuRedo();
1115 case LFUN_MENUSEARCH:
1116 owner->getDialogs()->showSearch();
1119 case LFUN_REMOVEERRORS:
1120 if (owner->view()->removeAutoInsets()) {
1121 owner->view()->redraw();
1122 owner->view()->fitCursor();
1127 changeDepth(owner->view(), TEXT(false), 0);
1130 case LFUN_DEPTH_MIN:
1131 changeDepth(owner->view(), TEXT(false), -1);
1134 case LFUN_DEPTH_PLUS:
1135 changeDepth(owner->view(), TEXT(false), 1);
1139 owner->getDialogs()->setUserFreeFont();
1142 case LFUN_RECONFIGURE:
1143 Reconfigure(owner->view());
1147 case LFUN_FLOATSOPERATE:
1148 if (argument == "openfoot")
1149 owner->view()->allFloats(1,0);
1150 else if (argument == "closefoot")
1151 owner->view()->allFloats(0,0);
1152 else if (argument == "openfig")
1153 owner->view()->allFloats(1,1);
1154 else if (argument == "closefig")
1155 owner->view()->allFloats(0,1);
1158 #ifdef WITH_WARNINGS
1159 //#warning Find another implementation here (or another lyxfunc)!
1162 case LFUN_HELP_ABOUTLYX:
1163 owner->getDialogs()->showAboutlyx();
1166 case LFUN_HELP_TEXINFO:
1167 owner->getDialogs()->showTexinfo();
1170 case LFUN_HELP_OPEN:
1172 string const arg = argument;
1174 setErrorMessage(N_("Missing argument"));
1177 owner->prohibitInput();
1178 string const fname = i18nLibFileSearch("doc", arg, "lyx");
1179 if (fname.empty()) {
1180 lyxerr << "LyX: unable to find documentation file `"
1181 << arg << "'. Bad installation?" << endl;
1182 owner->allowInput();
1186 str << _("Opening help file") << ' '
1187 << MakeDisplayPath(fname) << "...";
1188 owner->message(str.str().c_str());
1189 owner->view()->buffer(bufferlist.loadLyXFile(fname, false));
1190 owner->allowInput();
1194 // --- version control -------------------------------
1195 case LFUN_VC_REGISTER:
1197 if (!owner->buffer()->lyxvc.inUse())
1198 owner->buffer()->lyxvc.registrer();
1202 case LFUN_VC_CHECKIN:
1204 if (owner->buffer()->lyxvc.inUse()
1205 && !owner->buffer()->isReadonly())
1206 owner->buffer()->lyxvc.checkIn();
1210 case LFUN_VC_CHECKOUT:
1212 if (owner->buffer()->lyxvc.inUse()
1213 && owner->buffer()->isReadonly())
1214 owner->buffer()->lyxvc.checkOut();
1218 case LFUN_VC_REVERT:
1220 owner->buffer()->lyxvc.revert();
1226 owner->buffer()->lyxvc.undoLast();
1230 case LFUN_VC_HISTORY:
1232 owner->getDialogs()->showVCLogFile();
1236 // --- buffers ----------------------------------------
1238 case LFUN_SWITCHBUFFER:
1239 owner->view()->buffer(bufferlist.getBuffer(argument));
1244 // servercmd: argument must be <file>:<template>
1245 Buffer * tmpbuf = NewLyxFile(argument);
1247 owner->view()->buffer(tmpbuf);
1251 case LFUN_FILE_OPEN:
1255 case LFUN_LATEX_LOG:
1256 owner->getDialogs()->showLogFile();
1259 case LFUN_LAYOUT_DOCUMENT:
1260 owner->getDialogs()->showDocument();
1263 case LFUN_LAYOUT_PARAGRAPH:
1264 owner->getDialogs()->showParagraph();
1267 case LFUN_LAYOUT_CHARACTER:
1268 owner->getDialogs()->showCharacter();
1271 case LFUN_LAYOUT_TABULAR:
1272 if (owner->view()->theLockingInset()) {
1273 if (owner->view()->theLockingInset()->lyxCode()==Inset::TABULAR_CODE) {
1274 InsetTabular * inset = static_cast<InsetTabular *>
1275 (owner->view()->theLockingInset());
1276 inset->openLayoutDialog(owner->view());
1277 } else if (owner->view()->theLockingInset()->
1278 getFirstLockingInsetOfType(Inset::TABULAR_CODE)!=0) {
1279 InsetTabular * inset = static_cast<InsetTabular *>(
1280 owner->view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
1281 inset->openLayoutDialog(owner->view());
1286 case LFUN_LAYOUT_PREAMBLE:
1287 owner->getDialogs()->showPreamble();
1290 case LFUN_DROP_LAYOUTS_CHOICE:
1291 owner->getToolbar()->openLayoutList();
1294 case LFUN_MENU_OPEN_BY_NAME:
1295 owner->getMenubar()->openByName(argument);
1296 break; // RVDK_PATCH_5
1298 case LFUN_SPELLCHECK:
1299 if (lyxrc.isp_command != "none")
1300 owner->getDialogs()->showSpellchecker();
1303 // --- lyxserver commands ----------------------------
1307 setMessage(owner->buffer()->fileName());
1308 lyxerr[Debug::INFO] << "FNAME["
1309 << owner->buffer()->fileName()
1315 dispatch_buffer = keyseq.print();
1316 lyxserver->notifyClient(dispatch_buffer);
1320 case LFUN_GOTOFILEROW:
1324 istringstream istr(argument.c_str());
1325 istr >> file_name >> row;
1326 // Must replace extension of the file to be .lyx and get full path
1327 string const s(ChangeExtension(file_name, ".lyx"));
1329 // Either change buffer or load the file
1330 if (bufferlist.exists(s)) {
1331 owner->view()->buffer(bufferlist.getBuffer(s));
1333 owner->view()->buffer(bufferlist.loadLyXFile(s));
1337 owner->view()->setCursorFromRow(row);
1340 owner->view()->center();
1344 case LFUN_GOTO_PARAGRAPH:
1346 istringstream istr(argument.c_str());
1350 Paragraph * par = owner->buffer()->getParFromID(id);
1352 lyxerr[Debug::INFO] << "No matching paragraph found! ["
1353 << id << "]" << std::endl;
1356 lyxerr << "Paragraph " << par->id()
1357 << " found." << endl;
1361 owner->view()->text->setCursor(owner->view(), par, 0);
1362 owner->view()->setState();
1366 owner->view()->center();
1373 int const qa = lyxaction.LookupFunc(argument);
1374 setMessage(lyxaction.helpText(static_cast<kb_action>(qa)));
1378 // --- toolbar ----------------------------------
1379 case LFUN_PUSH_TOOLBAR:
1381 int nth = strToInt(argument);
1383 setErrorMessage(N_("Push-toolbar needs argument > 0"));
1385 owner->getToolbar()->push(nth);
1390 case LFUN_ADD_TO_TOOLBAR:
1392 if (lyxerr.debugging(Debug::GUI)) {
1393 lyxerr << "LFUN_ADD_TO_TOOLBAR:"
1394 "argument = `" << argument << '\'' << endl;
1396 string tmp(argument);
1397 //lyxerr <<string("Argument: ") + argument);
1398 //lyxerr <<string("Tmp : ") + tmp);
1400 setErrorMessage(N_("Usage: toolbar-add-to <LyX command>"));
1402 owner->getToolbar()->add(argument, false);
1403 owner->getToolbar()->set();
1408 // --- insert characters ----------------------------------------
1410 // --- Mathed stuff. If we are here, there is no locked inset yet.
1411 case LFUN_MATH_EXTERN:
1412 case LFUN_MATH_NUMBER:
1413 case LFUN_MATH_NONUMBER:
1414 case LFUN_MATH_LIMITS:
1415 case LFUN_SUBSCRIPT:
1416 case LFUN_SUPERSCRIPT:
1418 setErrorMessage(N_("This is only allowed in math mode!"));
1422 case LFUN_MATH_PANEL:
1423 owner->getDialogs()->showMathPanel();
1426 case LFUN_CITATION_CREATE:
1428 InsetCommandParams p( "cite" );
1430 if (!argument.empty()) {
1431 // This should be set at source, ie when typing
1432 // "citation-insert foo" in the minibuffer.
1433 // Question: would pybibliographer also need to be
1434 // changed. Suspect so. Leave as-is therefore.
1435 if (contains(argument, "|")) {
1436 p.setContents( token(argument, '|', 0) );
1437 p.setOptions( token(argument, '|', 1) );
1439 p.setContents( argument );
1441 dispatch(LFUN_CITATION_INSERT, p.getAsString());
1443 owner->getDialogs()->createCitation( p.getAsString() );
1447 case LFUN_CHILDOPEN:
1449 string const filename =
1450 MakeAbsPath(argument,
1451 OnlyPath(owner->buffer()->fileName()));
1452 setMessage(N_("Opening child document ") +
1453 MakeDisplayPath(filename) + "...");
1454 owner->view()->savePosition(0);
1455 if (bufferlist.exists(filename))
1456 owner->view()->buffer(bufferlist.getBuffer(filename));
1458 owner->view()->buffer(bufferlist.loadLyXFile(filename));
1462 case LFUN_TOGGLECURSORFOLLOW:
1463 lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
1466 case LFUN_KMAP_OFF: // keymap off
1467 owner->getIntl()->KeyMapOn(false);
1470 case LFUN_KMAP_PRIM: // primary keymap
1471 owner->getIntl()->KeyMapPrim();
1474 case LFUN_KMAP_SEC: // secondary keymap
1475 owner->getIntl()->KeyMapSec();
1478 case LFUN_KMAP_TOGGLE: // toggle keymap
1479 owner->getIntl()->ToggleKeyMap();
1484 // argument contains ';'-terminated commands
1485 while (argument.find(';') != string::npos) {
1487 argument = split(argument, first, ';');
1493 case LFUN_DIALOG_PREFERENCES:
1494 owner->getDialogs()->showPreferences();
1497 case LFUN_SAVEPREFERENCES:
1499 Path p(user_lyxdir);
1500 lyxrc.write("preferences");
1504 case LFUN_SCREEN_FONT_UPDATE:
1506 // handle the screen font changes.
1508 lyxrc.set_font_norm_type();
1509 fontloader.update();
1510 // Of course we should only do the resize and the textcache.clear
1511 // if values really changed...but not very important right now. (Lgb)
1512 // All visible buffers will need resize
1514 // We also need to empty the textcache so that
1515 // the buffer will be formatted correctly after
1521 case LFUN_SET_COLOR:
1524 string const x11_name = split(argument, lyx_name, ' ');
1525 if (lyx_name.empty() || x11_name.empty()) {
1526 setErrorMessage(N_("Syntax: set-color <lyx_name>"
1531 if (!lcolor.setColor(lyx_name, x11_name)) {
1532 static string const err1 (N_("Set-color \""));
1533 static string const err2 (
1534 N_("\" failed - color is undefined "
1535 "or may not be redefined"));
1536 setErrorMessage(_(err1) + lyx_name + _(err2));
1539 lyxColorHandler->updateColor(lcolor.getFromLyXName(lyx_name));
1540 owner->view()->redraw();
1545 owner->message(argument);
1548 case LFUN_MESSAGE_PUSH:
1549 owner->messagePush(argument);
1552 case LFUN_MESSAGE_POP:
1553 owner->messagePop();
1557 // Then if it was none of the above
1558 if (!owner->view()->Dispatch(action, argument))
1559 lyxerr << "A truly unknown func ["
1560 << lyxaction.getActionName(action) << "]!"
1567 commandshortcut.erase();
1569 if (lyxrc.display_shortcuts && show_sc) {
1570 if (action != LFUN_SELFINSERT) {
1571 // Put name of command and list of shortcuts
1572 // for it in minibuffer
1573 string comname = lyxaction.getActionName(action);
1575 kb_action pseudoaction = action;
1576 bool argsadded = false;
1578 if (!argument.empty()) {
1579 // If we have the command with argument,
1582 lyxaction.searchActionArg(action,
1585 if (pseudoaction == -1) {
1586 pseudoaction = action;
1588 comname += " " + argument;
1593 string const shortcuts =
1594 toplevel_keymap->findbinding(pseudoaction);
1596 if (!shortcuts.empty()) {
1597 comname += ": " + shortcuts;
1598 } else if (!argsadded && !argument.empty()) {
1599 comname += " " + argument;
1602 if (!comname.empty()) {
1603 comname = strip(comname);
1604 commandshortcut = "(" + comname + ')';
1606 // Here we could even add a small pause,
1607 // to annoy the user and make him learn
1609 // No! That will just annoy, not teach
1610 // anything. The user will read the messages
1611 // if they are interested. (Asger)
1616 string const res = getMessage();
1619 if (!commandshortcut.empty()) {
1620 owner->getMiniBuffer()->addSet(commandshortcut);
1623 string const msg(_(res) + ' ' + commandshortcut);
1624 owner->message(msg);
1631 void LyXFunc::setupLocalKeymap()
1633 keyseq.stdmap = keyseq.curmap = toplevel_keymap.get();
1634 cancel_meta_seq.stdmap = cancel_meta_seq.curmap = toplevel_keymap.get();
1638 void LyXFunc::menuNew(bool fromTemplate)
1640 string initpath = lyxrc.document_path;
1642 if (owner->view()->available()) {
1643 string const trypath = owner->buffer()->filepath;
1644 // If directory is writeable, use this as default.
1645 if (IsDirWriteable(trypath))
1649 static int newfile_number;
1652 if (lyxrc.new_ask_filename) {
1653 FileDialog fileDlg(owner, _("Enter filename for new document"),
1654 LFUN_SELECT_FILE_SYNC,
1655 make_pair(string(_("Documents")),
1656 string(lyxrc.document_path)),
1657 make_pair(string(_("Templates")),
1658 string(lyxrc.template_path)));
1660 FileDialog::Result result =
1661 fileDlg.Select(initpath,
1662 _("*.lyx|LyX Documents (*.lyx)"),
1665 if (result.second.empty()) {
1666 owner->message(_("Canceled."));
1667 lyxerr[Debug::INFO] << "New Document Cancelled." << endl;
1671 // get absolute path of file and make sure the filename ends
1673 s = MakeAbsPath(result.second);
1674 if (!IsLyXFilename(s))
1677 // Check if the document already is open
1678 if (bufferlist.exists(s)) {
1679 switch (Alert::askConfirmation(_("Document is already open:"),
1680 MakeDisplayPath(s, 50),
1681 _("Do you want to close that document now?\n"
1682 "('No' will just switch to the open version)")))
1684 case 1: // Yes: close the document
1685 if (!bufferlist.close(bufferlist.getBuffer(s)))
1686 // If close is canceled, we cancel here too.
1689 case 2: // No: switch to the open document
1690 owner->view()->buffer(bufferlist.getBuffer(s));
1692 case 3: // Cancel: Do nothing
1693 owner->message(_("Canceled."));
1697 // Check whether the file already exists
1699 if (fi.readable() &&
1700 Alert::askQuestion(_("File already exists:"),
1701 MakeDisplayPath(s, 50),
1702 _("Do you want to open the document?"))) {
1704 string const disp_fn(MakeDisplayPath(s));
1707 str << _("Opening document") << ' '
1708 << disp_fn << "...";
1710 owner->message(str.str().c_str());
1711 //XFlush(fl_get_display());
1712 owner->view()->buffer(bufferlist.loadLyXFile(s));
1714 str2 << _("Document") << ' '
1715 << disp_fn << ' ' << _("opened.");
1717 owner->message(str2.str().c_str());
1722 s = AddName(lyxrc.document_path,
1723 "newfile" + tostr(++newfile_number) + ".lyx");
1725 while (bufferlist.exists(s) || fi.readable()) {
1727 s = AddName(lyxrc.document_path,
1728 "newfile" + tostr(newfile_number) +
1734 // The template stuff
1737 FileDialog fileDlg(owner, _("Select template file"),
1738 LFUN_SELECT_FILE_SYNC,
1739 make_pair(string(_("Documents")),
1740 string(lyxrc.document_path)),
1741 make_pair(string(_("Templates")),
1742 string(lyxrc.template_path)));
1744 FileDialog::Result result =
1745 fileDlg.Select(lyxrc.template_path,
1746 _("*.lyx|LyX Documents (*.lyx)"));
1748 if (result.first == FileDialog::Later)
1751 string const fname = result.second;
1758 // find a free buffer
1759 lyxerr[Debug::INFO] << "Find a free buffer." << endl;
1760 owner->view()->buffer(bufferlist.newFile(s, templname));
1764 void LyXFunc::open(string const & fname)
1766 string initpath = lyxrc.document_path;
1768 if (owner->view()->available()) {
1769 string const trypath = owner->buffer()->filepath;
1770 // If directory is writeable, use this as default.
1771 if (IsDirWriteable(trypath))
1777 if (fname.empty()) {
1778 FileDialog fileDlg(owner, _("Select document to open"),
1780 make_pair(string(_("Documents")),
1781 string(lyxrc.document_path)),
1782 make_pair(string(_("Examples")),
1783 string(AddPath(system_lyxdir, "examples"))));
1785 FileDialog::Result result =
1786 fileDlg.Select(initpath,
1787 "*.lyx|LyX Documents (*.lyx)");
1789 if (result.first == FileDialog::Later)
1792 filename = result.second;
1794 // check selected filename
1795 if (filename.empty()) {
1796 owner->message(_("Canceled."));
1802 // get absolute path of file and add ".lyx" to the filename if
1804 string const fullpath = FileSearch(string(), filename, "lyx");
1805 if (fullpath.empty()) {
1806 Alert::alert(_("Error"), _("Could not find file"), filename);
1810 filename = fullpath;
1813 string const disp_fn(MakeDisplayPath(filename));
1816 str << _("Opening document") << ' ' << disp_fn << "...";
1818 owner->message(str.str().c_str());
1820 Buffer * openbuf = bufferlist.loadLyXFile(filename);
1822 owner->view()->buffer(openbuf);
1824 str << _("Document") << ' ' << disp_fn << ' ' << _("opened.");
1825 owner->message(str.str().c_str());
1828 str << _("Could not open document") << ' ' << disp_fn;
1829 owner->message(str.str().c_str());
1834 // checks for running without gui are missing.
1835 void LyXFunc::doImport(string const & argument)
1838 string filename = split(argument, format, ' ');
1839 lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format
1840 << " file: " << filename << endl;
1842 if (filename.empty()) { // need user interaction
1843 string initpath = lyxrc.document_path;
1845 if (owner->view()->available()) {
1846 string const trypath = owner->buffer()->filepath;
1847 // If directory is writeable, use this as default.
1848 if (IsDirWriteable(trypath))
1852 string const text = _("Select ") + formats.prettyName(format)
1853 + _(" file to import");
1855 FileDialog fileDlg(owner, text,
1857 make_pair(string(_("Documents")),
1858 string(lyxrc.document_path)),
1859 make_pair(string(_("Examples")),
1860 string(AddPath(system_lyxdir, "examples"))));
1862 string const extension = "*." + formats.extension(format)
1863 + "| " + formats.prettyName(format)
1864 + " (*." + formats.extension(format) + ")";
1866 FileDialog::Result result = fileDlg.Select(initpath,
1869 if (result.first == FileDialog::Later)
1872 filename = result.second;
1874 // check selected filename
1875 if (filename.empty())
1876 owner->message(_("Canceled."));
1879 // still no filename? abort
1880 if (filename.empty())
1883 // get absolute path of file
1884 filename = MakeAbsPath(filename);
1886 string const lyxfile = ChangeExtension(filename, ".lyx");
1888 // Check if the document already is open
1889 if (bufferlist.exists(lyxfile)) {
1890 switch (Alert::askConfirmation(_("Document is already open:"),
1891 MakeDisplayPath(lyxfile, 50),
1892 _("Do you want to close that document now?\n"
1893 "('No' will just switch to the open version)")))
1895 case 1: // Yes: close the document
1896 if (!bufferlist.close(bufferlist.getBuffer(lyxfile)))
1897 // If close is canceled, we cancel here too.
1900 case 2: // No: switch to the open document
1901 owner->view()->buffer(bufferlist.getBuffer(lyxfile));
1903 case 3: // Cancel: Do nothing
1904 owner->message(_("Canceled."));
1909 // Check if a LyX document by the same root exists in filesystem
1910 FileInfo const f(lyxfile, true);
1911 if (f.exist() && !Alert::askQuestion(_("A document by the name"),
1912 MakeDisplayPath(lyxfile),
1913 _("already exists. Overwrite?"))) {
1914 owner->message(_("Canceled"));
1917 // filename should be valid now
1919 Importer::Import(owner, filename, format);
1923 void LyXFunc::reloadBuffer()
1925 string const fn = owner->buffer()->fileName();
1926 if (bufferlist.close(owner->buffer()))
1927 owner->view()->buffer(bufferlist.loadLyXFile(fn));
1931 void LyXFunc::closeBuffer()
1933 if (bufferlist.close(owner->buffer()) && !quitting) {
1934 if (bufferlist.empty()) {
1935 // need this otherwise SEGV may occur while trying to
1936 // set variables that don't exist
1937 // since there's no current buffer
1938 owner->getDialogs()->hideBufferDependent();
1940 owner->view()->buffer(bufferlist.first());
1946 // Each "owner" should have it's own message method. lyxview and
1947 // the minibuffer would use the minibuffer, but lyxserver would
1948 // send an ERROR signal to its client. Alejandro 970603
1949 // This func is bit problematic when it comes to NLS, to make the
1950 // lyx servers client be language indepenent we must not translate
1951 // strings sent to this func.
1952 void LyXFunc::setErrorMessage(string const & m) const
1954 dispatch_buffer = m;
1959 void LyXFunc::setMessage(string const & m)
1961 dispatch_buffer = m;
1965 void LyXFunc::initMiniBuffer()
1967 string text = _("Welcome to LyX!");
1969 // When meta-fake key is pressed, show the key sequence so far + "M-".
1971 text = keyseq.print();
1975 // Else, when a non-complete key sequence is pressed,
1976 // show the available options.
1977 if (keyseq.length() > 0 && !keyseq.deleted()) {
1978 text = keyseq.printOptions();
1981 // Else, show the buffer state.
1982 else if (owner->view()->available()) {
1983 Buffer * tmpbuf = owner->buffer();
1985 string const nicename =
1986 MakeDisplayPath(tmpbuf->fileName());
1987 // Should we do this instead? (kindo like emacs)
1988 // leaves more room for other information
1991 if (tmpbuf->lyxvc.inUse()) {
1993 text += tmpbuf->lyxvc.versionString();
1995 text += tmpbuf->lyxvc.locker();
1996 if (tmpbuf->isReadonly())
1999 } else if (tmpbuf->isReadonly())
2001 if (!tmpbuf->isLyxClean())
2002 text += _(" (Changed)");
2004 if (text != _("Welcome to LyX!")) // this is a hack
2005 text = _("* No document open *");
2008 owner->message(text);