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 // set current buffer
335 cursor_ = LCursor(*bv_);
337 // if we're quitting lyx, don't bother updating stuff
342 lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl;
343 connectBuffer(*buffer_);
345 cursor_.push(buffer_->inset());
346 cursor_.resetAnchor();
347 buffer_->text().init(bv_);
348 buffer_->text().setCurrentFont(cursor_);
350 // If we don't have a text object for this, we make one
351 //if (bv_->text() == 0)
352 // resizeCurrentBuffer();
354 // Buffer-dependent dialogs should be updated or
355 // hidden. This should go here because some dialogs (eg ToC)
356 // require bv_->text.
357 owner_->getDialogs().updateBufferDependent(true);
359 lyxerr[Debug::INFO] << " No Buffer!" << endl;
360 // we are closing the buffer, use the first buffer as current
361 buffer_ = bufferlist.first();
362 owner_->getDialogs().hideBufferDependent();
367 owner_->updateMenubar();
368 owner_->updateToolbars();
369 owner_->updateLayoutChoice();
370 owner_->updateWindowTitle();
372 // This is done after the layout combox has been populated
374 owner_->setLayout(cursor_.paragraph().layout()->name());
376 if (buffer_ && lyx::graphics::Previews::status() != LyXRC::PREVIEW_OFF)
377 lyx::graphics::Previews::get().generateBufferPreviews(*buffer_);
381 bool BufferView::Pimpl::fitCursor()
383 // to get the correct y cursor info
384 lyxerr[Debug::DEBUG] << "BufferView::fitCursor" << std::endl;
385 lyx::par_type const pit = bv_->cursor().bottom().par();
386 bv_->text()->redoParagraph(pit);
387 refreshPar(*bv_, *bv_->text(), pit);
389 if (!screen().fitCursor(bv_))
396 void BufferView::Pimpl::redoCurrentBuffer()
398 lyxerr[Debug::DEBUG] << "BufferView::redoCurrentBuffer" << endl;
399 if (buffer_ && bv_->text()) {
400 resizeCurrentBuffer();
402 owner_->updateLayoutChoice();
407 void BufferView::Pimpl::resizeCurrentBuffer()
409 lyxerr[Debug::DEBUG] << "resizeCurrentBuffer" << endl;
411 owner_->message(_("Formatting document..."));
413 LyXText * text = bv_->text();
424 // reset the "Formatting..." message
425 owner_->clearMessage();
431 void BufferView::Pimpl::updateScrollbar()
434 lyxerr[Debug::DEBUG] << "no text in updateScrollbar" << endl;
435 workarea().setScrollbarParams(0, 0, 0);
439 LyXText const & t = *bv_->text();
442 << "Updating scrollbar: height: " << t.height()
443 << " top_y: " << top_y()
444 << " default height " << defaultRowHeight() << endl;
446 workarea().setScrollbarParams(t.height(), top_y(), defaultRowHeight());
450 void BufferView::Pimpl::scrollDocView(int value)
452 lyxerr[Debug::GUI] << "scrollDocView of " << value << endl;
457 screen().hideCursor();
460 screen().redraw(*bv_);
462 if (!lyxrc.cursor_follows_scrollbar)
465 int const height = defaultRowHeight();
466 int const first = top_y() + height;
467 int const last = top_y() + workarea().workHeight() - height;
469 bv_->cursor().reset(bv_->buffer()->inset());
470 LyXText * text = bv_->text();
471 int y = text->cursorY(bv_->cursor().front());
476 text->setCursorFromCoordinates(bv_->cursor(), 0, y);
478 owner_->updateLayoutChoice();
482 void BufferView::Pimpl::scroll(int lines)
487 LyXText const * t = bv_->text();
488 int const line_height = defaultRowHeight();
490 // The new absolute coordinate
491 int new_top_y = top_y() + lines * line_height;
493 // Restrict to a valid value
494 new_top_y = std::min(t->height() - 4 * line_height, new_top_y);
495 new_top_y = std::max(0, new_top_y);
497 scrollDocView(new_top_y);
499 // Update the scrollbar.
500 workarea().setScrollbarParams(t->height(), top_y(), defaultRowHeight());
504 void BufferView::Pimpl::workAreaKeyPress(LyXKeySymPtr key,
505 key_modifier::state state)
507 bv_->owner()->getLyXFunc().processKeySym(key, state);
509 /* This is perhaps a bit of a hack. When we move
510 * around, or type, it's nice to be able to see
511 * the cursor immediately after the keypress. So
512 * we reset the toggle timeout and force the visibility
513 * of the cursor. Note we cannot do this inside
514 * dispatch() itself, because that's called recursively.
517 cursor_timeout.restart();
518 screen().showCursor(*bv_);
523 void BufferView::Pimpl::selectionRequested()
530 LCursor & cur = bv_->cursor();
532 if (!cur.selection()) {
533 xsel_cache_.set = false;
537 if (!xsel_cache_.set ||
538 cur.back() != xsel_cache_.cursor ||
539 cur.anchor_.back() != xsel_cache_.anchor)
541 xsel_cache_.cursor = cur.back();
542 xsel_cache_.anchor = cur.anchor_.back();
543 xsel_cache_.set = cur.selection();
544 sel = cur.selectionAsString(false);
546 workarea().putClipboard(sel);
551 void BufferView::Pimpl::selectionLost()
554 screen().hideCursor();
555 bv_->cursor().clearSelection();
556 xsel_cache_.set = false;
561 void BufferView::Pimpl::workAreaResize()
563 static int work_area_width;
564 static int work_area_height;
566 bool const widthChange = workarea().workWidth() != work_area_width;
567 bool const heightChange = workarea().workHeight() != work_area_height;
569 // update from work area
570 work_area_width = workarea().workWidth();
571 work_area_height = workarea().workHeight();
573 if (buffer_ && widthChange) {
574 // The visible LyXView need a resize
575 resizeCurrentBuffer();
578 if (widthChange || heightChange)
581 // always make sure that the scrollbar is sane.
583 owner_->updateLayoutChoice();
587 void BufferView::Pimpl::update()
589 //lyxerr << "BufferView::Pimpl::update(), buffer: " << buffer_ << endl;
590 // fix cursor coordinate cache in case something went wrong
592 // check needed to survive LyX startup
594 // update macro store
595 buffer_->buildMacros();
597 // update all 'visible' paragraphs
598 lyx::par_type beg, end;
599 getParsInRange(buffer_->paragraphs(),
600 top_y(), top_y() + workarea().workHeight(),
602 bv_->text()->redoParagraphs(beg, end);
608 // remove old position cache
611 // The real, big redraw.
612 screen().redraw(*bv_);
614 bv_->owner()->view_state_changed();
618 // Callback for cursor timer
619 void BufferView::Pimpl::cursorToggle()
622 screen().toggleCursor(*bv_);
624 // Use this opportunity to deal with any child processes that
625 // have finished but are waiting to communicate this fact
626 // to the rest of LyX.
627 ForkedcallsController & fcc = ForkedcallsController::get();
628 if (fcc.processesCompleted())
629 fcc.handleCompletedProcesses();
632 cursor_timeout.restart();
636 bool BufferView::Pimpl::available() const
638 return buffer_ && bv_->text();
642 Change const BufferView::Pimpl::getCurrentChange()
644 if (!bv_->buffer()->params().tracking_changes)
645 return Change(Change::UNCHANGED);
647 LyXText * text = bv_->getLyXText();
648 LCursor & cur = bv_->cursor();
650 if (!cur.selection())
651 return Change(Change::UNCHANGED);
653 return text->getPar(cur.selBegin().par()).
654 lookupChangeFull(cur.selBegin().pos());
658 void BufferView::Pimpl::savePosition(unsigned int i)
660 if (i >= saved_positions_num)
662 BOOST_ASSERT(bv_->cursor().inTexted());
663 saved_positions[i] = Position(buffer_->fileName(),
664 bv_->cursor().paragraph().id(),
665 bv_->cursor().pos());
667 owner_->message(bformat(_("Saved bookmark %1$s"), tostr(i)));
671 void BufferView::Pimpl::restorePosition(unsigned int i)
673 if (i >= saved_positions_num)
676 string const fname = saved_positions[i].filename;
678 bv_->cursor().clearSelection();
680 if (fname != buffer_->fileName()) {
682 if (bufferlist.exists(fname))
683 b = bufferlist.getBuffer(fname);
685 b = bufferlist.newBuffer(fname);
686 ::loadLyXFile(b, fname); // don't ask, just load it
692 ParIterator par = buffer_->getParFromID(saved_positions[i].par_id);
693 if (par == buffer_->par_iterator_end())
696 bv_->text()->setCursor(bv_->cursor(), par.pit(),
697 min(par->size(), saved_positions[i].par_pos));
700 owner_->message(bformat(_("Moved to bookmark %1$s"), tostr(i)));
704 bool BufferView::Pimpl::isSavedPosition(unsigned int i)
706 return i < saved_positions_num && !saved_positions[i].filename.empty();
710 void BufferView::Pimpl::switchKeyMap()
712 if (!lyxrc.rtl_support)
715 Intl & intl = owner_->getIntl();
716 if (bv_->getLyXText()->real_current_font.isRightToLeft()) {
717 if (intl.keymap == Intl::PRIMARY)
720 if (intl.keymap == Intl::SECONDARY)
726 void BufferView::Pimpl::center()
728 LyXText * text = bv_->text();
730 bv_->cursor().clearSelection();
731 int const half_height = workarea().workHeight() / 2;
732 int new_y = text->cursorY(bv_->cursor().front()) - half_height;
736 // FIXME: look at this comment again ...
737 // This updates top_y() but means the fitCursor() call
738 // from the update(FITCUR) doesn't realise that we might
739 // have moved (e.g. from GOTOPARAGRAPH), so doesn't cause
740 // the scrollbar to be updated as it should, so we have
741 // to do it manually. Any operation that does a center()
742 // and also might have moved top_y() must make sure to call
743 // updateScrollbar() currently. Never mind that this is a
744 // pretty obfuscated way of updating text->top_y()
749 void BufferView::Pimpl::stuffClipboard(string const & stuff) const
751 workarea().putClipboard(stuff);
755 void BufferView::Pimpl::MenuInsertLyXFile(string const & filenm)
757 string filename = filenm;
759 if (filename.empty()) {
760 // Launch a file browser
761 string initpath = lyxrc.document_path;
764 string const trypath = owner_->buffer()->filePath();
765 // If directory is writeable, use this as default.
766 if (IsDirWriteable(trypath))
770 FileDialog fileDlg(_("Select LyX document to insert"),
772 make_pair(string(_("Documents|#o#O")),
773 string(lyxrc.document_path)),
774 make_pair(string(_("Examples|#E#e")),
775 string(AddPath(system_lyxdir(), "examples"))));
777 FileDialog::Result result =
778 fileDlg.open(initpath,
779 FileFilterList(_("LyX Documents (*.lyx)")),
782 if (result.first == FileDialog::Later)
785 filename = result.second;
787 // check selected filename
788 if (filename.empty()) {
789 owner_->message(_("Canceled."));
794 // get absolute path of file and add ".lyx" to the filename if
796 filename = FileSearch(string(), filename, "lyx");
798 string const disp_fn = MakeDisplayPath(filename);
799 owner_->message(bformat(_("Inserting document %1$s..."), disp_fn));
801 bv_->cursor().clearSelection();
802 bv_->text()->breakParagraph(bv_->cursor());
804 BOOST_ASSERT(bv_->cursor().inTexted());
806 string const fname = MakeAbsPath(filename);
807 bool const res = bv_->buffer()->readFile(fname, bv_->cursor().par());
810 string s = res ? _("Document %1$s inserted.")
811 : _("Could not insert document %1$s");
812 owner_->message(bformat(s, disp_fn));
816 void BufferView::Pimpl::trackChanges()
818 Buffer * buf = bv_->buffer();
819 bool const tracking = buf->params().tracking_changes;
822 ParIterator const end = buf->par_iterator_end();
823 for (ParIterator it = buf->par_iterator_begin(); it != end; ++it)
825 buf->params().tracking_changes = true;
827 // we cannot allow undos beyond the freeze point
828 buf->undostack().clear();
831 bv_->text()->setCursor(bv_->cursor(), 0, 0);
833 #warning changes FIXME
835 bool found = lyx::find::findNextChange(bv_);
837 owner_->getDialogs().show("changes");
841 ParIterator const end = buf->par_iterator_end();
842 for (ParIterator it = buf->par_iterator_begin(); it != end; ++it)
843 it->untrackChanges();
844 buf->params().tracking_changes = false;
847 buf->redostack().clear();
851 bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
853 lyxerr << "BufferView::Pimpl::workAreaDispatch: request: "
854 << cmd0 << std::endl;
855 // this is only called for mouse related events including
856 // LFUN_FILE_OPEN generated by drag-and-drop.
857 FuncRequest cmd = cmd0;
860 if (cmd.action == LFUN_FILE_OPEN) {
861 owner_->dispatch(cmd);
865 cmd.y += bv_->top_y();
870 cur.push(bv_->buffer()->inset());
871 cur.selection() = bv_->cursor().selection();
873 // Doesn't go through lyxfunc, so we need to update
874 // the layout choice etc. ourselves
876 // e.g. Qt mouse press when no buffer
880 screen().hideCursor();
882 // Either the inset under the cursor or the
883 // surrounding LyXText will handle this event.
885 // Build temporary cursor.
886 InsetBase * inset = bv_->text()->editXY(cur, cmd.x, cmd.y);
887 lyxerr << " * created temp cursor: " << inset << endl;
888 lyxerr << " * hit inset at tip: " << inset << endl;
889 lyxerr << " * created temp cursor:" << cur << endl;
891 // Put anchor at the same position.
894 // Try to dispatch to an non-editable inset near this position
895 // via the temp cursor. If the inset wishes to change the real
896 // cursor it has to do so explicitly by using
897 // cur.bv().cursor() = cur; (or similar)
899 inset->dispatch(cur, cmd);
901 // Now dispatch to the temporary cursor. If the real cursor should
902 // be modified, the inset's dispatch has to do so explicitly.
903 if (!cur.result().dispatched())
906 if (cur.result().dispatched()) {
907 // Redraw if requested or necessary.
908 if (fitCursor() || cur.result().update())
912 // see workAreaKeyPress
913 cursor_timeout.restart();
914 screen().showCursor(*bv_);
916 // skip these when selecting
917 if (cmd.action != LFUN_MOUSE_MOTION) {
918 owner_->updateLayoutChoice();
919 owner_->updateToolbars();
922 // slight hack: this is only called currently when we
923 // clicked somewhere, so we force through the display
924 // of the new status here.
925 owner_->clearMessage();
930 FuncStatus BufferView::Pimpl::getStatus(FuncRequest const & cmd)
932 Buffer * buf = bv_->buffer();
936 switch (cmd.action) {
939 flag.enabled(!buf->undostack().empty());
942 flag.enabled(!buf->redostack().empty());
944 case LFUN_FILE_INSERT:
945 case LFUN_FILE_INSERT_ASCII_PARA:
946 case LFUN_FILE_INSERT_ASCII:
947 case LFUN_FONT_STATE:
948 case LFUN_INSERT_LABEL:
949 case LFUN_BOOKMARK_SAVE:
952 case LFUN_WORD_REPLACE:
957 case LFUN_BEGINNINGBUF:
959 case LFUN_BEGINNINGBUFSEL:
963 case LFUN_BOOKMARK_GOTO:
964 flag.enabled(bv_->isSavedPosition(strToUnsignedInt(cmd.argument)));
966 case LFUN_TRACK_CHANGES:
968 flag.setOnOff(buf->params().tracking_changes);
971 case LFUN_MERGE_CHANGES:
972 case LFUN_ACCEPT_CHANGE: // what about these two
973 case LFUN_REJECT_CHANGE: // what about these two
974 case LFUN_ACCEPT_ALL_CHANGES:
975 case LFUN_REJECT_ALL_CHANGES:
976 flag.enabled(buf && buf->params().tracking_changes);
987 bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
989 //lyxerr << "BufferView::Pimpl::dispatch cmd: " << cmd << std::endl;
990 // Make sure that the cached BufferView is correct.
991 lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch:"
992 << " action[" << cmd.action << ']'
993 << " arg[" << cmd.argument << ']'
994 << " x[" << cmd.x << ']'
995 << " y[" << cmd.y << ']'
996 << " button[" << cmd.button() << ']'
999 LCursor & cur = bv_->cursor();
1001 switch (cmd.action) {
1005 cur.message(_("Undo"));
1006 cur.clearSelection();
1007 if (!textUndo(*bv_))
1008 cur.message(_("No further undo information"));
1016 cur.message(_("Redo"));
1017 cur.clearSelection();
1018 if (!textRedo(*bv_))
1019 cur.message(_("No further redo information"));
1025 case LFUN_FILE_INSERT:
1026 MenuInsertLyXFile(cmd.argument);
1029 case LFUN_FILE_INSERT_ASCII_PARA:
1030 InsertAsciiFile(bv_, cmd.argument, true);
1033 case LFUN_FILE_INSERT_ASCII:
1034 InsertAsciiFile(bv_, cmd.argument, false);
1037 case LFUN_FONT_STATE:
1038 cur.message(cur.currentState());
1041 case LFUN_BOOKMARK_SAVE:
1042 savePosition(strToUnsignedInt(cmd.argument));
1045 case LFUN_BOOKMARK_GOTO:
1046 restorePosition(strToUnsignedInt(cmd.argument));
1049 case LFUN_REF_GOTO: {
1050 string label = cmd.argument;
1051 if (label.empty()) {
1053 getInsetByCode<InsetRef>(bv_->cursor(),
1054 InsetBase::REF_CODE);
1056 label = inset->getContents();
1062 bv_->gotoLabel(label);
1066 case LFUN_TRACK_CHANGES:
1070 case LFUN_MERGE_CHANGES:
1071 owner_->getDialogs().show("changes");
1074 case LFUN_ACCEPT_ALL_CHANGES: {
1075 bv_->cursor().reset(bv_->buffer()->inset());
1076 #ifdef WITH_WARNINGS
1077 #warning FIXME changes
1079 while (lyx::find::findNextChange(bv_))
1080 bv_->getLyXText()->acceptChange(bv_->cursor());
1085 case LFUN_REJECT_ALL_CHANGES: {
1086 bv_->cursor().reset(bv_->buffer()->inset());
1087 #ifdef WITH_WARNINGS
1088 #warning FIXME changes
1090 while (lyx::find::findNextChange(bv_))
1091 bv_->getLyXText()->rejectChange(bv_->cursor());
1095 case LFUN_WORD_FIND:
1096 lyx::find::find(bv_, cmd);
1099 case LFUN_WORD_REPLACE:
1100 lyx::find::replace(bv_, cmd);
1104 cur.clearSelection();
1106 cur.message(N_("Mark off"));
1110 cur.clearSelection();
1113 cur.message(N_("Mark on"));
1117 cur.clearSelection();
1120 cur.message(N_("Mark removed"));
1123 cur.message(N_("Mark set"));
1132 case LFUN_BEGINNINGBUFSEL:
1133 bv_->cursor().reset(bv_->buffer()->inset());
1134 if (!cur.selection())
1136 bv_->text()->cursorTop(cur);
1140 case LFUN_ENDBUFSEL:
1141 bv_->cursor().reset(bv_->buffer()->inset());
1142 if (!cur.selection())
1144 bv_->text()->cursorBottom(cur);