lyxerr << BOOST_CURRENT_FUNCTION
<< " Key [action="
<< func.action << "]["
- << keyseq->print() << ']'
+ << to_utf8(keyseq->print()) << ']'
<< endl;
}
// num_bytes == 0? (Lgb)
if (keyseq->length() > 1) {
- lyx_view_->message(from_utf8(keyseq->print()));
+ lyx_view_->message(keyseq->print());
}
case LFUN_COMMAND_PREFIX:
BOOST_ASSERT(lyx_view_);
- lyx_view_->message(from_utf8(keyseq->printOptions()));
+ lyx_view_->message(keyseq->printOptions());
break;
case LFUN_COMMAND_EXECUTE:
case LFUN_META_PREFIX:
meta_fake_bit = key_modifier::alt;
- setMessage(from_utf8(keyseq->print()));
+ setMessage(keyseq->print());
break;
case LFUN_BUFFER_TOGGLE_READ_ONLY:
break;
case LFUN_LYX_QUIT:
- // FIXME: this code needs to be transfered somewhere else
- // as lyx_view_ will most certainly be null and a same buffer
- // might be visible in more than one LyXView.
- if (lyx_view_ && lyx_view_->view()->buffer()) {
- // save cursor Position for opened files to .lyx/session
- LyX::ref().session().lastFilePos().save(FileName(lyx_view_->buffer()->fileName()),
- boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
- }
-
- // save the geometry of the current view
- lyx_view_->saveGeometry();
- // quitting is triggered by the gui code (leaving the event loop)
- theApp()->gui().closeAllViews();
+ // quitting is triggered by the gui code
+ // (leaving the event loop).
+ if (theBufferList().quitWriteAll())
+ theApp()->gui().closeAllViews();
break;
case LFUN_TOC_VIEW: {
break;
case LFUN_SERVER_NOTIFY:
- dispatch_buffer = from_utf8(keyseq->print());
+ dispatch_buffer = keyseq->print();
theLyXServer().notifyClient(to_utf8(dispatch_buffer));
break;
InsetCommandParams p(name);
data = InsetCommandMailer::params2string(name, p);
} else if (name == "include") {
+ // data is the include type: one of "include",
+ // "input", "verbatiminput" or "verbatiminput*"
+ if (data.empty())
+ // default type is requested
+ data = "include";
InsetCommandParams p(data);
data = InsetIncludeMailer::params2string(p);
} else if (name == "box") {
case LFUN_WINDOW_CLOSE:
BOOST_ASSERT(lyx_view_);
BOOST_ASSERT(theApp());
+ // ask the user for saving changes or cancel quit
+ if (!theBufferList().quitWriteAll())
+ break;
lyx_view_->close();
return;
}
}
- string const shortcuts = theTopLevelKeymap().printbindings(cmd);
+ string const shortcuts = to_utf8(theTopLevelKeymap().printbindings(cmd));
if (!shortcuts.empty())
comname += ": " + shortcuts;
}
-string const LyXFunc::viewStatusMessage()
+docstring const LyXFunc::viewStatusMessage()
{
// When meta-fake key is pressed, show the key sequence so far + "M-".
if (wasMetaKey())
return keyseq->printOptions();
if (!view()->buffer())
- return to_utf8(_("Welcome to LyX!"));
+ return _("Welcome to LyX!");
return view()->cursor().currentState();
}