using support::changeExtension;
using support::contains;
using support::FileFilterList;
+using support::FileName;
using support::fileSearch;
using support::ForkedcallsController;
using support::i18nLibFileSearch;
Note that this code is not perfect, as bug 1941 attests:
http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
*/
- Buffer * buf;
- if (cmd.origin == FuncRequest::MENU && !lyx_view_->hasFocus())
+ Buffer * buf = lyx_view_? lyx_view_->buffer() : 0;
+ if (lyx_view_ && cmd.origin == FuncRequest::MENU && !lyx_view_->hasFocus())
buf = 0;
- else
- buf = lyx_view_->buffer();
if (cmd.action == LFUN_NOACTION) {
flag.message(from_utf8(N_("Nothing to do")));
else if (name == "character" || name == "mathpanel")
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
else if (name == "latexlog")
- enable = isFileReadable(buf->getLogName().second);
+ enable = isFileReadable(FileName(buf->getLogName().second));
#if !defined (USE_ASPELL) && !defined (USE_ISPELL) && !defined (USE_PSPELL)
else if (name == "spellchecker")
enable = false;
break;
case LFUN_LYX_QUIT:
- if (argument != "force") {
+ if (argument == "closeOnly") {
if (!theApp->gui().closeAll())
break;
lyx_view_ = 0;
setErrorMessage(_("Missing argument"));
break;
}
- string const fname = i18nLibFileSearch("doc", arg, "lyx");
+ string const fname = i18nLibFileSearch("doc", arg, "lyx").absFilename();
if (fname.empty()) {
lyxerr << "LyX: unable to find documentation file `"
<< arg << "'. Bad installation?" << endl;
}
if (lyx_view_ && view()->buffer()) {
- // Redraw screen unless explicitly told otherwise.
- // This also initializes the position cache for all insets
- // in (at least partially) visible top-level paragraphs.
- std::pair<bool, bool> needSecondUpdate = view()->update(updateFlags);
+ // BufferView::update() updates the ViewMetricsInfo and
+ // also initializes the position cache for all insets in
+ // (at least partially) visible top-level paragraphs.
+ std::pair<bool, bool> needSecondUpdate
+ = view()->update(updateFlags);
+ // Redraw screen unless explicitly told otherwise.
if (needSecondUpdate.first)
+ // Buffer::changed() signals that a repaint is needed.
+ // The frontend (WorkArea) knows which area to repaint
+ // thanks to the ViewMetricsInfo updated above.
view()->buffer()->changed();
lyx_view_->updateStatusBar();
// get absolute path of file and add ".lyx" to the filename if
// necessary
- string const fullpath = fileSearch(string(), filename, "lyx");
+ string const fullpath = fileSearch(string(), filename, "lyx").absFilename();
if (!fullpath.empty()) {
filename = fullpath;
}