mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
* src/buffer_funcs.{cpp,h}:
- add optional bool "acceptDirty" to checkAndLoadLyXFiles. If true, the method doesn't care for buffer dirtiness * src/Buffer.cpp: - when checking for master buffer, do not care if it's dirty (fix bug 5514) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27774 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6edb56cf03
commit
f4b8f4528f
@ -588,7 +588,7 @@ bool Buffer::readDocument(Lexer & lex)
|
|||||||
FileName const master_file = makeAbsPath(params().master,
|
FileName const master_file = makeAbsPath(params().master,
|
||||||
onlyPath(absFileName()));
|
onlyPath(absFileName()));
|
||||||
if (isLyXFilename(master_file.absFilename())) {
|
if (isLyXFilename(master_file.absFilename())) {
|
||||||
Buffer * master = checkAndLoadLyXFile(master_file);
|
Buffer * master = checkAndLoadLyXFile(master_file, true);
|
||||||
d->parent_buffer = master;
|
d->parent_buffer = master;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,12 +57,15 @@ namespace lyx {
|
|||||||
namespace Alert = frontend::Alert;
|
namespace Alert = frontend::Alert;
|
||||||
|
|
||||||
|
|
||||||
Buffer * checkAndLoadLyXFile(FileName const & filename)
|
Buffer * checkAndLoadLyXFile(FileName const & filename, bool const acceptDirty)
|
||||||
{
|
{
|
||||||
// File already open?
|
// File already open?
|
||||||
Buffer * checkBuffer = theBufferList().getBuffer(filename);
|
Buffer * checkBuffer = theBufferList().getBuffer(filename);
|
||||||
if (checkBuffer) {
|
if (checkBuffer) {
|
||||||
if (checkBuffer->isClean())
|
// sometimes (when setting the master buffer from a child)
|
||||||
|
// we accept a dirty buffer right away (otherwise we'd get
|
||||||
|
// an infinite loop (bug 5514)
|
||||||
|
if (checkBuffer->isClean() || acceptDirty)
|
||||||
return checkBuffer;
|
return checkBuffer;
|
||||||
docstring const file = makeDisplayPath(filename.absFilename(), 20);
|
docstring const file = makeDisplayPath(filename.absFilename(), 20);
|
||||||
docstring text = bformat(_(
|
docstring text = bformat(_(
|
||||||
|
@ -27,7 +27,8 @@ class ParIterator;
|
|||||||
* \retval the newly created \c Buffer pointer if successful or 0.
|
* \retval the newly created \c Buffer pointer if successful or 0.
|
||||||
* \retval 0 if the \c Buffer could not be created.
|
* \retval 0 if the \c Buffer could not be created.
|
||||||
*/
|
*/
|
||||||
Buffer * checkAndLoadLyXFile(support::FileName const & filename);
|
Buffer * checkAndLoadLyXFile(support::FileName const & filename,
|
||||||
|
bool acceptDirty = false);
|
||||||
|
|
||||||
/** Make a new file (buffer) with name \c filename based on a template
|
/** Make a new file (buffer) with name \c filename based on a template
|
||||||
* named \c templatename
|
* named \c templatename
|
||||||
|
Loading…
Reference in New Issue
Block a user