using support::changeExtension;
using support::contains;
using support::FileFilterList;
+using support::FileName;
using support::fileSearch;
using support::ForkedcallsController;
using support::i18nLibFileSearch;
flag.message(from_utf8(N_("Exiting")));
flag.enabled(true);
return flag;
- } else if (cmd.action == LFUN_BOOKMARK_GOTO) {
+ } else if (cmd.action == LFUN_BOOKMARK_GOTO) {
// bookmarks can be valid even if there is no opened buffer
flag.enabled(LyX::ref().session().bookmarks().isValid(convert<unsigned int>(to_utf8(cmd.argument()))));
return flag;
} else if (cmd.action == LFUN_BOOKMARK_CLEAR) {
flag.enabled(LyX::ref().session().bookmarks().size() > 0);
return flag;
+ } else if (cmd.action == LFUN_TOOLBAR_TOGGLE_STATE) {
+ ToolbarBackend::Flags flags = lyx_view_->getToolbarState(to_utf8(cmd.argument()));
+ if (!(flags & ToolbarBackend::AUTO))
+ flag.setOnOff(flags & ToolbarBackend::ON);
+ return flag;
}
-
LCursor & cur = view()->cursor();
/* In LyX/Mac, when a dialog is open, the menus of the
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::UI && !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;
}
+
// this one is difficult to get right. As a half-baked
// solution, we consider only the first action of the sequence
case LFUN_COMMAND_SEQUENCE: {
case LFUN_BUFFER_PREVIOUS:
case LFUN_WINDOW_NEW:
case LFUN_WINDOW_CLOSE:
- case LFUN_TOOLBAR_TOGGLE_STATE:
// these are handled in our dispatch()
break;
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;
name == "bibtex" ||
name == "index" ||
name == "label" ||
+ name == "nomenclature" ||
name == "ref" ||
name == "toc" ||
name == "url") {
}
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.
- bool needSecondUpdate = false;
- if (updateFlags != Update::None)
- view()->update(updateFlags);
- else
- needSecondUpdate = view()->fitCursor();
+ // 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);
- if (needSecondUpdate || updateFlags != Update::None) {
+ // 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();
// if we executed a mutating lfun, mark the buffer as dirty
}
}
}
- if (!quitting)
- // FIXME UNICODE: _() does not support anything but ascii.
- // Do we need a to_ascii() method?
+ if (!quitting) {
+ lyx_view_->updateMenubar();
+ lyx_view_->updateToolbars();
sendDispatchMessage(getMessage(), cmd);
+ }
}
void LyXFunc::sendDispatchMessage(docstring const & msg, FuncRequest const & cmd)
{
- /* When an action did not originate from the UI/kbd, it makes
- * sense to avoid updating the GUI. It turns out that this
- * fixes bug 1941, for reasons that are described here:
- * http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
- */
- if (cmd.origin != FuncRequest::INTERNAL) {
- lyx_view_->updateMenubar();
- lyx_view_->updateToolbars();
- }
-
- const bool verbose = (cmd.origin == FuncRequest::UI
+ const bool verbose = (cmd.origin == FuncRequest::MENU
+ || cmd.origin == FuncRequest::TOOLBAR
|| cmd.origin == FuncRequest::COMMANDBUFFER);
if (cmd.action == LFUN_SELF_INSERT || !verbose) {
// 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;
}
case LyXRC::RC_LOADSESSION:
case LyXRC::RC_CHKTEX_COMMAND:
case LyXRC::RC_CONVERTER:
+ case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
case LyXRC::RC_COPIER:
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
case LyXRC::RC_CUSTOM_EXPORT_COMMAND:
case LyXRC::RC_USER_NAME:
case LyXRC::RC_USETEMPDIR:
case LyXRC::RC_USE_ALT_LANG:
+ case LyXRC::RC_USE_CONVERTER_CACHE:
case LyXRC::RC_USE_ESC_CHARS:
case LyXRC::RC_USE_INP_ENC:
case LyXRC::RC_USE_PERS_DICT: