2 * \file BufferView_pimpl.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Asger Alstrup
7 * \author Alfredo Braunstein
8 * \author Lars Gullik Bjønnes
9 * \author Jean-Marc Lasgouttes
10 * \author Angus Leeming
12 * \author André Pönitz
14 * \author Jürgen Vigna
16 * Full author contact details are available in file CREDITS.
21 #include "BufferView_pimpl.h"
23 #include "buffer_funcs.h"
24 #include "bufferlist.h"
25 #include "bufferparams.h"
26 #include "coordcache.h"
29 #include "dispatchresult.h"
31 #include "FloatList.h"
32 #include "funcrequest.h"
33 #include "FuncStatus.h"
36 #include "insetiterator.h"
37 #include "lyx_cb.h" // added for Dispatch functions
43 #include "lastfiles.h"
44 #include "paragraph.h"
45 #include "paragraph_funcs.h"
46 #include "ParagraphParameters.h"
47 #include "pariterator.h"
48 #include "rowpainter.h"
52 #include "insets/insetref.h"
53 #include "insets/insettext.h"
55 #include "frontends/Alert.h"
56 #include "frontends/Dialogs.h"
57 #include "frontends/FileDialog.h"
58 #include "frontends/LyXView.h"
59 #include "frontends/LyXScreenFactory.h"
60 #include "frontends/screen.h"
61 #include "frontends/WorkArea.h"
62 #include "frontends/WorkAreaFactory.h"
64 #include "graphics/Previews.h"
66 #include "support/filetools.h"
67 #include "support/forkedcontr.h"
68 #include "support/globbing.h"
69 #include "support/path_defines.h"
70 #include "support/tostr.h"
71 #include "support/types.h"
73 #include <boost/bind.hpp>
77 using lyx::support::AddPath;
78 using lyx::support::bformat;
79 using lyx::support::FileFilterList;
80 using lyx::support::FileSearch;
81 using lyx::support::ForkedcallsController;
82 using lyx::support::IsDirWriteable;
83 using lyx::support::MakeDisplayPath;
84 using lyx::support::MakeAbsPath;
85 using lyx::support::strToUnsignedInt;
86 using lyx::support::system_lyxdir;
89 using std::istringstream;
95 extern BufferList bufferlist;
100 unsigned int const saved_positions_num = 20;
102 // All the below connection objects are needed because of a bug in some
103 // versions of GCC (<=2.96 are on the suspects list.) By having and assigning
104 // to these connections we avoid a segfault upon startup, and also at exit.
107 boost::signals::connection dispatchcon;
108 boost::signals::connection timecon;
109 boost::signals::connection doccon;
110 boost::signals::connection resizecon;
111 boost::signals::connection kpresscon;
112 boost::signals::connection selectioncon;
113 boost::signals::connection lostcon;
116 /// Get next inset of this class from current cursor position
118 T * getInsetByCode(LCursor & cur, InsetBase::Code code)
121 DocIterator it = cur;
122 if (it.nextInset() &&
123 it.nextInset()->lyxCode() == code) {
124 inset = static_cast<T*>(it.nextInset());
133 BufferView::Pimpl::Pimpl(BufferView & bv, LyXView * owner,
134 int width, int height)
135 : bv_(&bv), owner_(owner), buffer_(0), cursor_timeout(400),
136 using_xterm_cursor(false), cursor_(bv)
138 xsel_cache_.set = false;
140 workarea_.reset(WorkAreaFactory::create(*owner_, width, height));
141 screen_.reset(LyXScreenFactory::create(workarea()));
144 doccon = workarea().scrollDocView
145 .connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
146 resizecon = workarea().workAreaResize
147 .connect(boost::bind(&BufferView::Pimpl::workAreaResize, this));
148 dispatchcon = workarea().dispatch
149 .connect(boost::bind(&BufferView::Pimpl::workAreaDispatch, this, _1));
150 kpresscon = workarea().workAreaKeyPress
151 .connect(boost::bind(&BufferView::Pimpl::workAreaKeyPress, this, _1, _2));
152 selectioncon = workarea().selectionRequested
153 .connect(boost::bind(&BufferView::Pimpl::selectionRequested, this));
154 lostcon = workarea().selectionLost
155 .connect(boost::bind(&BufferView::Pimpl::selectionLost, this));
157 timecon = cursor_timeout.timeout
158 .connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
159 cursor_timeout.start();
160 saved_positions.resize(saved_positions_num);
164 void BufferView::Pimpl::addError(ErrorItem const & ei)
166 errorlist_.push_back(ei);
170 void BufferView::Pimpl::showReadonly(bool)
172 owner_->updateWindowTitle();
173 owner_->getDialogs().updateBufferDependent(false);
177 void BufferView::Pimpl::connectBuffer(Buffer & buf)
179 if (errorConnection_.connected())
184 boost::bind(&BufferView::Pimpl::addError, this, _1));
188 boost::bind(&LyXView::message, owner_, _1));
192 boost::bind(&LyXView::busy, owner_, _1));
195 buf.updateTitles.connect(
196 boost::bind(&LyXView::updateWindowTitle, owner_));
199 buf.resetAutosaveTimers.connect(
200 boost::bind(&LyXView::resetAutosaveTimer, owner_));
202 readonlyConnection_ =
203 buf.readonly.connect(
204 boost::bind(&BufferView::Pimpl::showReadonly, this, _1));
208 boost::bind(&BufferView::Pimpl::setBuffer, this, (Buffer *)0));
212 void BufferView::Pimpl::disconnectBuffer()
214 errorConnection_.disconnect();
215 messageConnection_.disconnect();
216 busyConnection_.disconnect();
217 titleConnection_.disconnect();
218 timerConnection_.disconnect();
219 readonlyConnection_.disconnect();
220 closingConnection_.disconnect();
224 void BufferView::Pimpl::newFile(string const & filename, string const & tname,
227 setBuffer(::newFile(filename, tname, isNamed));
231 bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
233 // get absolute path of file and add ".lyx" to the filename if
235 string s = FileSearch(string(), filename, "lyx");
237 bool const found = !s.empty();
242 // file already open?
243 if (bufferlist.exists(s)) {
244 string const file = MakeDisplayPath(s, 20);
245 string text = bformat(_("The document %1$s is already "
246 "loaded.\n\nDo you want to revert "
247 "to the saved version?"), file);
248 int const ret = Alert::prompt(_("Revert to saved document?"),
249 text, 0, 1, _("&Revert"), _("&Switch to document"));
252 setBuffer(bufferlist.getBuffer(s));
255 // FIXME: should be LFUN_REVERT
256 if (!bufferlist.close(bufferlist.getBuffer(s), false))
258 // Fall through to new load. (Asger)
264 b = bufferlist.newBuffer(s);
266 if (!::loadLyXFile(b, s)) {
267 bufferlist.release(b);
271 string text = bformat(_("The document %1$s does not yet "
272 "exist.\n\nDo you want to create "
273 "a new document?"), s);
274 int const ret = Alert::prompt(_("Create new document?"),
275 text, 0, 1, _("&Create"), _("Cancel"));
278 b = ::newFile(s, string(), true);
284 bv_->showErrorList(_("Parse"));
287 LyX::ref().lastfiles().newFile(b->fileName());
293 WorkArea & BufferView::Pimpl::workarea() const
295 return *workarea_.get();
299 LyXScreen & BufferView::Pimpl::screen() const
301 return *screen_.get();
305 Painter & BufferView::Pimpl::painter() const
307 return workarea().getPainter();
311 void BufferView::Pimpl::top_y(int y)
317 int BufferView::Pimpl::top_y() const
323 void BufferView::Pimpl::setBuffer(Buffer * b)
325 lyxerr[Debug::INFO] << "Setting buffer in BufferView ("
330 // if we are closing current buffer, switch to the first in
333 lyxerr[Debug::INFO] << " No Buffer!" << endl;
334 // we are closing the buffer, use the first buffer as current
335 buffer_ = bufferlist.first();
336 owner_->getDialogs().hideBufferDependent();
338 // set current buffer
344 cursor_ = LCursor(*bv_);
346 // if we're quitting lyx, don't bother updating stuff
351 lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl;
352 connectBuffer(*buffer_);
354 cursor_.push(buffer_->inset());
355 cursor_.resetAnchor();
356 buffer_->text().init(bv_);
357 buffer_->text().setCurrentFont(cursor_);
359 // If we don't have a text object for this, we make one
360 //if (bv_->text() == 0)
361 // resizeCurrentBuffer();
363 // Buffer-dependent dialogs should be updated or
364 // hidden. This should go here because some dialogs (eg ToC)
365 // require bv_->text.
366 owner_->getDialogs().updateBufferDependent(true);
371 owner_->updateMenubar();
372 owner_->updateToolbars();
373 owner_->updateLayoutChoice();
374 owner_->updateWindowTitle();
376 // This is done after the layout combox has been populated
378 owner_->setLayout(cursor_.paragraph().layout()->name());
380 if (buffer_ && lyx::graphics::Previews::status() != LyXRC::PREVIEW_OFF)
381 lyx::graphics::Previews::get().generateBufferPreviews(*buffer_);
385 bool BufferView::Pimpl::fitCursor()
387 // to get the correct y cursor info
388 lyxerr[Debug::DEBUG] << "BufferView::fitCursor" << std::endl;
389 lyx::par_type const pit = bv_->cursor().bottom().par();
390 bv_->text()->redoParagraph(pit);
391 refreshPar(*bv_, *bv_->text(), pit);
393 if (!screen().fitCursor(bv_))
400 void BufferView::Pimpl::redoCurrentBuffer()
402 lyxerr[Debug::DEBUG] << "BufferView::redoCurrentBuffer" << endl;
403 if (buffer_ && bv_->text()) {
404 resizeCurrentBuffer();
406 owner_->updateLayoutChoice();
411 void BufferView::Pimpl::resizeCurrentBuffer()
413 lyxerr[Debug::DEBUG] << "resizeCurrentBuffer" << endl;
415 owner_->message(_("Formatting document..."));
417 LyXText * text = bv_->text();
428 // reset the "Formatting..." message
429 owner_->clearMessage();
435 void BufferView::Pimpl::updateScrollbar()
438 lyxerr[Debug::DEBUG] << "no text in updateScrollbar" << endl;
439 workarea().setScrollbarParams(0, 0, 0);
443 LyXText const & t = *bv_->text();
446 << "Updating scrollbar: height: " << t.height()
447 << " top_y: " << top_y()
448 << " default height " << defaultRowHeight() << endl;
450 workarea().setScrollbarParams(t.height(), top_y(), defaultRowHeight());
454 void BufferView::Pimpl::scrollDocView(int value)
456 lyxerr[Debug::GUI] << "scrollDocView of " << value << endl;
461 screen().hideCursor();
464 screen().redraw(*bv_);
466 if (!lyxrc.cursor_follows_scrollbar)
469 int const height = defaultRowHeight();
470 int const first = top_y() + height;
471 int const last = top_y() + workarea().workHeight() - height;
473 bv_->cursor().reset(bv_->buffer()->inset());
474 LyXText * text = bv_->text();
475 int y = text->cursorY(bv_->cursor().front());
480 text->setCursorFromCoordinates(bv_->cursor(), 0, y);
482 owner_->updateLayoutChoice();
486 void BufferView::Pimpl::scroll(int lines)
491 LyXText const * t = bv_->text();
492 int const line_height = defaultRowHeight();
494 // The new absolute coordinate
495 int new_top_y = top_y() + lines * line_height;
497 // Restrict to a valid value
498 new_top_y = std::min(t->height() - 4 * line_height, new_top_y);
499 new_top_y = std::max(0, new_top_y);
501 scrollDocView(new_top_y);
503 // Update the scrollbar.
504 workarea().setScrollbarParams(t->height(), top_y(), defaultRowHeight());
508 void BufferView::Pimpl::workAreaKeyPress(LyXKeySymPtr key,
509 key_modifier::state state)
511 bv_->owner()->getLyXFunc().processKeySym(key, state);
513 /* This is perhaps a bit of a hack. When we move
514 * around, or type, it's nice to be able to see
515 * the cursor immediately after the keypress. So
516 * we reset the toggle timeout and force the visibility
517 * of the cursor. Note we cannot do this inside
518 * dispatch() itself, because that's called recursively.
521 cursor_timeout.restart();
522 screen().showCursor(*bv_);
527 void BufferView::Pimpl::selectionRequested()
534 LCursor & cur = bv_->cursor();
536 if (!cur.selection()) {
537 xsel_cache_.set = false;
541 if (!xsel_cache_.set ||
542 cur.back() != xsel_cache_.cursor ||
543 cur.anchor_.back() != xsel_cache_.anchor)
545 xsel_cache_.cursor = cur.back();
546 xsel_cache_.anchor = cur.anchor_.back();
547 xsel_cache_.set = cur.selection();
548 sel = cur.selectionAsString(false);
550 workarea().putClipboard(sel);
555 void BufferView::Pimpl::selectionLost()
558 screen().hideCursor();
559 bv_->cursor().clearSelection();
560 xsel_cache_.set = false;
565 void BufferView::Pimpl::workAreaResize()
567 static int work_area_width;
568 static int work_area_height;
570 bool const widthChange = workarea().workWidth() != work_area_width;
571 bool const heightChange = workarea().workHeight() != work_area_height;
573 // update from work area
574 work_area_width = workarea().workWidth();
575 work_area_height = workarea().workHeight();
577 if (buffer_ && widthChange) {
578 // The visible LyXView need a resize
579 resizeCurrentBuffer();
582 if (widthChange || heightChange)
585 // always make sure that the scrollbar is sane.
587 owner_->updateLayoutChoice();
591 void BufferView::Pimpl::update()
593 //lyxerr << "BufferView::Pimpl::update(), buffer: " << buffer_ << endl;
594 // fix cursor coordinate cache in case something went wrong
596 // check needed to survive LyX startup
598 // update macro store
599 buffer_->buildMacros();
601 // update all 'visible' paragraphs
602 lyx::par_type beg, end;
603 getParsInRange(buffer_->paragraphs(),
604 top_y(), top_y() + workarea().workHeight(),
606 bv_->text()->redoParagraphs(beg, end);
612 // remove old position cache
615 // The real, big redraw.
616 screen().redraw(*bv_);
618 bv_->owner()->view_state_changed();
622 // Callback for cursor timer
623 void BufferView::Pimpl::cursorToggle()
626 screen().toggleCursor(*bv_);
628 // Use this opportunity to deal with any child processes that
629 // have finished but are waiting to communicate this fact
630 // to the rest of LyX.
631 ForkedcallsController & fcc = ForkedcallsController::get();
632 if (fcc.processesCompleted())
633 fcc.handleCompletedProcesses();
636 cursor_timeout.restart();
640 bool BufferView::Pimpl::available() const
642 return buffer_ && bv_->text();
646 Change const BufferView::Pimpl::getCurrentChange()
648 if (!bv_->buffer()->params().tracking_changes)
649 return Change(Change::UNCHANGED);
651 LyXText * text = bv_->getLyXText();
652 LCursor & cur = bv_->cursor();
654 if (!cur.selection())
655 return Change(Change::UNCHANGED);
657 return text->getPar(cur.selBegin().par()).
658 lookupChangeFull(cur.selBegin().pos());
662 void BufferView::Pimpl::savePosition(unsigned int i)
664 if (i >= saved_positions_num)
666 BOOST_ASSERT(bv_->cursor().inTexted());
667 saved_positions[i] = Position(buffer_->fileName(),
668 bv_->cursor().paragraph().id(),
669 bv_->cursor().pos());
671 owner_->message(bformat(_("Saved bookmark %1$s"), tostr(i)));
675 void BufferView::Pimpl::restorePosition(unsigned int i)
677 if (i >= saved_positions_num)
680 string const fname = saved_positions[i].filename;
682 bv_->cursor().clearSelection();
684 if (fname != buffer_->fileName()) {
686 if (bufferlist.exists(fname))
687 b = bufferlist.getBuffer(fname);
689 b = bufferlist.newBuffer(fname);
690 ::loadLyXFile(b, fname); // don't ask, just load it
696 ParIterator par = buffer_->getParFromID(saved_positions[i].par_id);
697 if (par == buffer_->par_iterator_end())
700 bv_->text()->setCursor(bv_->cursor(), par.pit(),
701 min(par->size(), saved_positions[i].par_pos));
704 owner_->message(bformat(_("Moved to bookmark %1$s"), tostr(i)));
708 bool BufferView::Pimpl::isSavedPosition(unsigned int i)
710 return i < saved_positions_num && !saved_positions[i].filename.empty();
714 void BufferView::Pimpl::switchKeyMap()
716 if (!lyxrc.rtl_support)
719 Intl & intl = owner_->getIntl();
720 if (bv_->getLyXText()->real_current_font.isRightToLeft()) {
721 if (intl.keymap == Intl::PRIMARY)
724 if (intl.keymap == Intl::SECONDARY)
730 void BufferView::Pimpl::center()
732 LyXText * text = bv_->text();
734 bv_->cursor().clearSelection();
735 int const half_height = workarea().workHeight() / 2;
736 int new_y = text->cursorY(bv_->cursor().front()) - half_height;
740 // FIXME: look at this comment again ...
741 // This updates top_y() but means the fitCursor() call
742 // from the update(FITCUR) doesn't realise that we might
743 // have moved (e.g. from GOTOPARAGRAPH), so doesn't cause
744 // the scrollbar to be updated as it should, so we have
745 // to do it manually. Any operation that does a center()
746 // and also might have moved top_y() must make sure to call
747 // updateScrollbar() currently. Never mind that this is a
748 // pretty obfuscated way of updating text->top_y()
753 void BufferView::Pimpl::stuffClipboard(string const & stuff) const
755 workarea().putClipboard(stuff);
759 void BufferView::Pimpl::MenuInsertLyXFile(string const & filenm)
761 string filename = filenm;
763 if (filename.empty()) {
764 // Launch a file browser
765 string initpath = lyxrc.document_path;
768 string const trypath = owner_->buffer()->filePath();
769 // If directory is writeable, use this as default.
770 if (IsDirWriteable(trypath))
774 FileDialog fileDlg(_("Select LyX document to insert"),
776 make_pair(string(_("Documents|#o#O")),
777 string(lyxrc.document_path)),
778 make_pair(string(_("Examples|#E#e")),
779 string(AddPath(system_lyxdir(), "examples"))));
781 FileDialog::Result result =
782 fileDlg.open(initpath,
783 FileFilterList(_("LyX Documents (*.lyx)")),
786 if (result.first == FileDialog::Later)
789 filename = result.second;
791 // check selected filename
792 if (filename.empty()) {
793 owner_->message(_("Canceled."));
798 // get absolute path of file and add ".lyx" to the filename if
800 filename = FileSearch(string(), filename, "lyx");
802 string const disp_fn = MakeDisplayPath(filename);
803 owner_->message(bformat(_("Inserting document %1$s..."), disp_fn));
805 bv_->cursor().clearSelection();
806 bv_->text()->breakParagraph(bv_->cursor());
808 BOOST_ASSERT(bv_->cursor().inTexted());
810 string const fname = MakeAbsPath(filename);
811 bool const res = bv_->buffer()->readFile(fname, bv_->cursor().par());
814 string s = res ? _("Document %1$s inserted.")
815 : _("Could not insert document %1$s");
816 owner_->message(bformat(s, disp_fn));
820 void BufferView::Pimpl::trackChanges()
822 Buffer * buf = bv_->buffer();
823 bool const tracking = buf->params().tracking_changes;
826 ParIterator const end = buf->par_iterator_end();
827 for (ParIterator it = buf->par_iterator_begin(); it != end; ++it)
829 buf->params().tracking_changes = true;
831 // we cannot allow undos beyond the freeze point
832 buf->undostack().clear();
835 bv_->text()->setCursor(bv_->cursor(), 0, 0);
837 #warning changes FIXME
839 bool found = lyx::find::findNextChange(bv_);
841 owner_->getDialogs().show("changes");
845 ParIterator const end = buf->par_iterator_end();
846 for (ParIterator it = buf->par_iterator_begin(); it != end; ++it)
847 it->untrackChanges();
848 buf->params().tracking_changes = false;
851 buf->redostack().clear();
855 bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
857 lyxerr << "BufferView::Pimpl::workAreaDispatch: request: "
858 << cmd0 << std::endl;
859 // this is only called for mouse related events including
860 // LFUN_FILE_OPEN generated by drag-and-drop.
861 FuncRequest cmd = cmd0;
864 if (cmd.action == LFUN_FILE_OPEN) {
865 owner_->dispatch(cmd);
869 cmd.y += bv_->top_y();
874 cur.push(bv_->buffer()->inset());
875 cur.selection() = bv_->cursor().selection();
877 // Doesn't go through lyxfunc, so we need to update
878 // the layout choice etc. ourselves
880 // e.g. Qt mouse press when no buffer
884 screen().hideCursor();
886 // Either the inset under the cursor or the
887 // surrounding LyXText will handle this event.
889 // Build temporary cursor.
890 InsetBase * inset = bv_->text()->editXY(cur, cmd.x, cmd.y);
891 lyxerr << " * created temp cursor: " << inset << endl;
892 lyxerr << " * hit inset at tip: " << inset << endl;
893 lyxerr << " * created temp cursor:" << cur << endl;
895 // Put anchor at the same position.
898 // Try to dispatch to an non-editable inset near this position
899 // via the temp cursor. If the inset wishes to change the real
900 // cursor it has to do so explicitly by using
901 // cur.bv().cursor() = cur; (or similar)
903 inset->dispatch(cur, cmd);
905 // Now dispatch to the temporary cursor. If the real cursor should
906 // be modified, the inset's dispatch has to do so explicitly.
907 if (!cur.result().dispatched())
910 if (cur.result().dispatched()) {
911 // Redraw if requested or necessary.
912 if (fitCursor() || cur.result().update())
916 // see workAreaKeyPress
917 cursor_timeout.restart();
918 screen().showCursor(*bv_);
920 // skip these when selecting
921 if (cmd.action != LFUN_MOUSE_MOTION) {
922 owner_->updateLayoutChoice();
923 owner_->updateToolbars();
926 // slight hack: this is only called currently when we
927 // clicked somewhere, so we force through the display
928 // of the new status here.
929 owner_->clearMessage();
934 FuncStatus BufferView::Pimpl::getStatus(FuncRequest const & cmd)
936 Buffer * buf = bv_->buffer();
940 switch (cmd.action) {
943 flag.enabled(!buf->undostack().empty());
946 flag.enabled(!buf->redostack().empty());
948 case LFUN_FILE_INSERT:
949 case LFUN_FILE_INSERT_ASCII_PARA:
950 case LFUN_FILE_INSERT_ASCII:
951 case LFUN_FONT_STATE:
952 case LFUN_INSERT_LABEL:
953 case LFUN_BOOKMARK_SAVE:
956 case LFUN_WORD_REPLACE:
961 case LFUN_BEGINNINGBUF:
963 case LFUN_BEGINNINGBUFSEL:
967 case LFUN_BOOKMARK_GOTO:
968 flag.enabled(bv_->isSavedPosition(strToUnsignedInt(cmd.argument)));
970 case LFUN_TRACK_CHANGES:
972 flag.setOnOff(buf->params().tracking_changes);
975 case LFUN_MERGE_CHANGES:
976 case LFUN_ACCEPT_CHANGE: // what about these two
977 case LFUN_REJECT_CHANGE: // what about these two
978 case LFUN_ACCEPT_ALL_CHANGES:
979 case LFUN_REJECT_ALL_CHANGES:
980 flag.enabled(buf && buf->params().tracking_changes);
991 bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
993 //lyxerr << "BufferView::Pimpl::dispatch cmd: " << cmd << std::endl;
994 // Make sure that the cached BufferView is correct.
995 lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch:"
996 << " action[" << cmd.action << ']'
997 << " arg[" << cmd.argument << ']'
998 << " x[" << cmd.x << ']'
999 << " y[" << cmd.y << ']'
1000 << " button[" << cmd.button() << ']'
1003 LCursor & cur = bv_->cursor();
1005 switch (cmd.action) {
1009 cur.message(_("Undo"));
1010 cur.clearSelection();
1011 if (!textUndo(*bv_))
1012 cur.message(_("No further undo information"));
1020 cur.message(_("Redo"));
1021 cur.clearSelection();
1022 if (!textRedo(*bv_))
1023 cur.message(_("No further redo information"));
1029 case LFUN_FILE_INSERT:
1030 MenuInsertLyXFile(cmd.argument);
1033 case LFUN_FILE_INSERT_ASCII_PARA:
1034 InsertAsciiFile(bv_, cmd.argument, true);
1037 case LFUN_FILE_INSERT_ASCII:
1038 InsertAsciiFile(bv_, cmd.argument, false);
1041 case LFUN_FONT_STATE:
1042 cur.message(cur.currentState());
1045 case LFUN_BOOKMARK_SAVE:
1046 savePosition(strToUnsignedInt(cmd.argument));
1049 case LFUN_BOOKMARK_GOTO:
1050 restorePosition(strToUnsignedInt(cmd.argument));
1053 case LFUN_REF_GOTO: {
1054 string label = cmd.argument;
1055 if (label.empty()) {
1057 getInsetByCode<InsetRef>(bv_->cursor(),
1058 InsetBase::REF_CODE);
1060 label = inset->getContents();
1066 bv_->gotoLabel(label);
1070 case LFUN_TRACK_CHANGES:
1074 case LFUN_MERGE_CHANGES:
1075 owner_->getDialogs().show("changes");
1078 case LFUN_ACCEPT_ALL_CHANGES: {
1079 bv_->cursor().reset(bv_->buffer()->inset());
1080 #ifdef WITH_WARNINGS
1081 #warning FIXME changes
1083 while (lyx::find::findNextChange(bv_))
1084 bv_->getLyXText()->acceptChange(bv_->cursor());
1089 case LFUN_REJECT_ALL_CHANGES: {
1090 bv_->cursor().reset(bv_->buffer()->inset());
1091 #ifdef WITH_WARNINGS
1092 #warning FIXME changes
1094 while (lyx::find::findNextChange(bv_))
1095 bv_->getLyXText()->rejectChange(bv_->cursor());
1099 case LFUN_WORD_FIND:
1100 lyx::find::find(bv_, cmd);
1103 case LFUN_WORD_REPLACE:
1104 lyx::find::replace(bv_, cmd);
1108 cur.clearSelection();
1110 cur.message(N_("Mark off"));
1114 cur.clearSelection();
1117 cur.message(N_("Mark on"));
1121 cur.clearSelection();
1124 cur.message(N_("Mark removed"));
1127 cur.message(N_("Mark set"));
1136 case LFUN_BEGINNINGBUFSEL:
1137 bv_->cursor().reset(bv_->buffer()->inset());
1138 if (!cur.selection())
1140 bv_->text()->cursorTop(cur);
1144 case LFUN_ENDBUFSEL:
1145 bv_->cursor().reset(bv_->buffer()->inset());
1146 if (!cur.selection())
1148 bv_->text()->cursorBottom(cur);