mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 16:50:39 +00:00
Introduce LFUN to save all modified files, and add menu entries.
Patch from Guillaume Pothier for 1.4.x adapted by me to current branch. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19342 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f4b8546ee5
commit
c237753110
@ -130,6 +130,7 @@ void LyXAction::init()
|
||||
{ LFUN_BUFFER_VIEW, "buffer-view", ReadOnly },
|
||||
{ LFUN_BUFFER_WRITE, "buffer-write", ReadOnly },
|
||||
{ LFUN_BUFFER_WRITE_AS, "buffer-write-as", ReadOnly },
|
||||
{ LFUN_BUFFER_WRITE_ALL, "buffer-write-all", ReadOnly },
|
||||
{ LFUN_CANCEL, "cancel", NoBuffer },
|
||||
{ LFUN_CAPTION_INSERT, "caption-insert", Noop },
|
||||
{ LFUN_CHAR_BACKWARD, "char-backward", ReadOnly | NoUpdate},
|
||||
|
@ -612,6 +612,29 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case LFUN_BUFFER_WRITE_ALL: {
|
||||
// We enable the command only if there are some modified buffers
|
||||
Buffer * first = theBufferList().first();
|
||||
bool modified = false;
|
||||
if (first) {
|
||||
Buffer * b = first;
|
||||
|
||||
// We cannot use a for loop as the buffer list is a cycle.
|
||||
do {
|
||||
if (!b->isClean()) {
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
b = theBufferList().next(b);
|
||||
} while (b != first);
|
||||
}
|
||||
|
||||
enable = modified;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BOOKMARK_GOTO: {
|
||||
const unsigned int num = convert<unsigned int>(to_utf8(cmd.argument()));
|
||||
enable = LyX::ref().session().bookmarks().isValid(num);
|
||||
@ -907,6 +930,30 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
updateFlags = Update::None;
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_WRITE_ALL: {
|
||||
Buffer * first = theBufferList().first();
|
||||
if (first) {
|
||||
Buffer * b = first;
|
||||
lyx_view_->message(_("Saving all documents..."));
|
||||
|
||||
// We cannot use a for loop as the buffer list cycles.
|
||||
do {
|
||||
if (!b->isClean()) {
|
||||
if (!b->isUnnamed()) {
|
||||
menuWrite(b);
|
||||
lyxerr[Debug::ACTION] << "Saved " << b->fileName() << endl;
|
||||
} else
|
||||
writeAs(b);
|
||||
}
|
||||
b = theBufferList().next(b);
|
||||
} while (b != first);
|
||||
lyx_view_->message(_("All documents saved."));
|
||||
}
|
||||
|
||||
updateFlags = Update::None;
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BUFFER_RELOAD: {
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
docstring const file = makeDisplayPath(view()->buffer()->fileName(), 20);
|
||||
|
@ -378,6 +378,7 @@ enum kb_action {
|
||||
LFUN_CLEARDOUBLEPAGE_INSERT, // Ugras 20061125
|
||||
LFUN_LISTING_INSERT, // Herbert 20011110, bpeng 20070502
|
||||
LFUN_TOOLBAR_TOGGLE, // Edwin 20070521
|
||||
LFUN_BUFFER_WRITE_ALL, // rgh, gpothier 200707XX
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user