X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfunc.C;h=4570bfba8f511ab85c6e4ac5f501e9d105ff67ce;hb=969ab85d985485f503790cb13f98a582d4e1cdb5;hp=7bc580d7e7f633961509e0250f74c665b9be1d43;hpb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;p=lyx.git diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 7bc580d7e7..4570bfba8f 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -296,7 +296,9 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state) //Encoding const * encoding = view()->cursor().getEncoding(); //encoded_last_key = keysym->getISOEncoded(encoding ? encoding->name() : ""); - size_t encoded_last_key = keysym->getUCSEncoded(); + // FIXME: encoded_last_key shadows the member variable of the same + // name. Is that intended? + char_type encoded_last_key = keysym->getUCSEncoded(); // Do a one-deep top-level lookup for // cancel and meta-fake keys. RVDK_PATCH_5 @@ -575,6 +577,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const case LFUN_DIALOG_SHOW_NEW_INSET: enable = cur.inset().lyxCode() != InsetBase::ERT_CODE; + if (cur.inset().lyxCode() == InsetBase::CAPTION_CODE) { + FuncStatus flag; + if (cur.inset().getStatus(cur, cmd, flag)) + return flag; + } break; case LFUN_DIALOG_UPDATE: { @@ -878,8 +885,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd) lyx_view_->message(str); menuWrite(lyx_view_->buffer()); lyx_view_->message(str + _(" done.")); - } else - writeAs(lyx_view_->buffer()); + } else { + writeAs(lyx_view_->buffer()); + } updateFlags = Update::None; break; @@ -1052,9 +1060,20 @@ void LyXFunc::dispatch(FuncRequest const & cmd) } else { // case 1: print to a file + FileName const filename(makeAbsPath(target_name, path)); + if (fs::exists(filename.toFilesystemEncoding())) { + docstring text = bformat( + _("The file %1$s already exists.\n\n" + "Do you want to over-write that file?"), + makeDisplayPath(filename.absFilename())); + if (Alert::prompt(_("Over-write file?"), + text, 0, 1, _("&Over-write"), _("&Cancel")) != 0) { + showPrintError(buffer->fileName()); + break; + } + } command += lyxrc.print_to_file - + quoteName(makeAbsPath(target_name, - path).toFilesystemEncoding()) + + quoteName(filename.toFilesystemEncoding()) + ' ' + quoteName(dviname); res = one.startscript(Systemcall::DontWait, @@ -1163,9 +1182,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd) // --- buffers ---------------------------------------- case LFUN_BUFFER_SWITCH: BOOST_ASSERT(lyx_view_); - // update bookmark pit of the current buffer before switch - for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i) - gotoBookmark(i+1, false, false); lyx_view_->setBuffer(theBufferList().getBuffer(argument)); break; @@ -1237,8 +1253,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) view()->setCursorFromRow(row); - view()->center(); - // see BufferView::center() + updateFlags = Update::FitCursor; break; } @@ -1738,8 +1753,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) view()->cursor().dispatch(cmd); updateFlags = view()->cursor().result().update(); if (!view()->cursor().result().dispatched()) - if (view()->dispatch(cmd)) - updateFlags = Update::Force | Update::FitCursor; + updateFlags = view()->dispatch(cmd); break; } } @@ -1760,8 +1774,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd) // if we executed a mutating lfun, mark the buffer as dirty if (flag.enabled() - && !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer) - && !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)) + && !lyxaction.funcHasFlag(action, LyXAction::NoBuffer) + && !lyxaction.funcHasFlag(action, LyXAction::ReadOnly)) view()->buffer()->markDirty(); if (view()->cursor().inTexted()) {