mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* BufferList: new begin() and end() methods.
* LyX::exec(): in non-GUI mode, execute batch commands on all buffers. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16068 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7ac9c50824
commit
0dae88fca6
@ -72,6 +72,30 @@ bool BufferList::empty() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList::iterator BufferList::begin()
|
||||||
|
{
|
||||||
|
return bstore.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList::const_iterator BufferList::begin() const
|
||||||
|
{
|
||||||
|
return bstore.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList::iterator BufferList::end()
|
||||||
|
{
|
||||||
|
return bstore.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList::const_iterator BufferList::end() const
|
||||||
|
{
|
||||||
|
return bstore.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BufferList::quitWriteBuffer(Buffer * buf)
|
bool BufferList::quitWriteBuffer(Buffer * buf)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(buf);
|
BOOST_ASSERT(buf);
|
||||||
|
@ -28,9 +28,19 @@ class OutputParams;
|
|||||||
* and deletions of new ones.
|
* and deletions of new ones.
|
||||||
*/
|
*/
|
||||||
class BufferList : boost::noncopyable {
|
class BufferList : boost::noncopyable {
|
||||||
|
public:
|
||||||
|
typedef std::vector<Buffer *>::iterator iterator;
|
||||||
|
typedef std::vector<Buffer *>::const_iterator const_iterator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BufferList();
|
BufferList();
|
||||||
|
|
||||||
|
iterator begin();
|
||||||
|
const_iterator begin() const;
|
||||||
|
|
||||||
|
iterator end();
|
||||||
|
const_iterator end() const;
|
||||||
|
|
||||||
/// write all buffers, asking the user, returns false if cancelled
|
/// write all buffers, asking the user, returns false if cancelled
|
||||||
bool quitWriteAll();
|
bool quitWriteAll();
|
||||||
|
|
||||||
|
@ -336,17 +336,24 @@ int LyX::exec(int & argc, char * argv[])
|
|||||||
prepareExit();
|
prepareExit();
|
||||||
return exit_status;
|
return exit_status;
|
||||||
}
|
}
|
||||||
Buffer * last_loaded = pimpl_->buffer_list_.last();
|
|
||||||
if (batch_command.empty() || !last_loaded) {
|
if (batch_command.empty() || pimpl_->buffer_list_.empty()) {
|
||||||
prepareExit();
|
prepareExit();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to dispatch to last loaded buffer first
|
BufferList::iterator begin = pimpl_->buffer_list_.begin();
|
||||||
bool success = false;
|
BufferList::iterator end = pimpl_->buffer_list_.end();
|
||||||
last_loaded->dispatch(batch_command, &success);
|
|
||||||
|
bool final_success = false;
|
||||||
|
for (BufferList::iterator I = begin; I != end; ++I) {
|
||||||
|
Buffer * buf = *I;
|
||||||
|
bool success = false;
|
||||||
|
buf->dispatch(batch_command, &success);
|
||||||
|
final_success |= success;
|
||||||
|
}
|
||||||
prepareExit();
|
prepareExit();
|
||||||
return !success;
|
return !final_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force adding of font path _before_ Application is initialized
|
// Force adding of font path _before_ Application is initialized
|
||||||
|
Loading…
Reference in New Issue
Block a user