* src/Author.h:

* src/Changes.cpp:
	* src/support/userinfo.cpp:
	* src/Paragraph.cpp:
	* src/Changes.h:
	* src/Buffer.cpp:
	* src/Paragraph.h:
	* src/BufferParams.cpp: do not save the name of authors
	in LyX documents, who have not made a single change in 
	change tracking mode


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19019 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2007-07-09 20:52:34 +00:00
parent 39cf8bcf16
commit 7f74d469a4
8 changed files with 52 additions and 8 deletions

View File

@ -26,7 +26,7 @@ public:
Author() {}
Author(docstring const & name, docstring const & email)
: name_(name), email_(email) {}
: name_(name), email_(email), used_(true) {}
docstring const name() const {
return name_;
@ -36,12 +36,22 @@ public:
return email_;
}
void used(bool u) const {
used_ = u;
}
bool used() const {
return used_;
}
friend std::istream & operator>>(std::istream & os, Author & a);
private:
docstring name_;
docstring email_;
mutable bool used_;
};

View File

@ -846,6 +846,19 @@ bool Buffer::write(ostream & ofs) const
<< "\\lyxformat " << LYX_FORMAT << "\n"
<< "\\begin_document\n";
/// For each author, set 'used' to true if there is a change
/// by this author in the document; otherwise set it to 'false'.
AuthorList::Authors::const_iterator a_it = params().authors().begin();
AuthorList::Authors::const_iterator a_end = params().authors().end();
for (; a_it != a_end; ++a_it)
a_it->second.used(false);
ParIterator const end = par_iterator_end();
ParIterator it = par_iterator_begin();
for ( ; it != end; ++it)
it->checkAuthors(params().authors());
// now write out the buffer parameters.
ofs << "\\begin_header\n";
params().writeFile(ofs);

View File

@ -766,7 +766,10 @@ void BufferParams::writeFile(ostream & os) const
AuthorList::Authors::const_iterator a_it = pimpl_->authorlist.begin();
AuthorList::Authors::const_iterator a_end = pimpl_->authorlist.end();
for (; a_it != a_end; ++a_it) {
os << "\\author " << a_it->second << "\n";
if (a_it->second.used())
os << "\\author " << a_it->second << "\n";
else
os << "\\author " << Author() << "\n";
}
}

View File

@ -357,4 +357,13 @@ void Changes::lyxMarkChange(std::ostream & os, int & column,
}
void Changes::checkAuthors(AuthorList const & authorList)
{
ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator endit = table_.end();
for ( ; it != endit ; ++it)
if (it->change.type != Change::UNCHANGED)
authorList.get(it->change.author).used(true);
}
} // namespace lyx

View File

@ -23,6 +23,7 @@
namespace lyx {
class AuthorList;
class Change {
public:
@ -85,6 +86,9 @@ public:
static void lyxMarkChange(std::ostream & os, int & column,
Change const & old, Change const & change);
///
void checkAuthors(AuthorList const & authorList);
private:
class Range {
public:

View File

@ -210,7 +210,7 @@ public:
///
ParagraphParameters params;
private:
//private:
///
pos_type size() const { return owner_->size(); }
/// match a string against a particular point in the paragraph
@ -2682,4 +2682,10 @@ int Paragraph::checkBiblio(bool track_changes)
return 1;
}
void Paragraph::checkAuthors(AuthorList const & authorList)
{
pimpl_->changes_.checkAuthors(authorList);
}
} // namespace lyx

View File

@ -368,6 +368,10 @@ public:
/// was previously past that position. Return 0 otherwise.
int checkBiblio(bool track_changes);
/// For each author, set 'used' to true if there is a change
/// by this author in the paragraph.
void checkAuthors(AuthorList const & authorList);
public:
///
InsetList insetlist;

View File

@ -36,11 +36,6 @@ namespace support {
docstring const user_name()
{
//FIXME: quick fix wrt bug #3764; only Anonymous is detected now.
//The code after should be used only after user approval.
return from_ascii("Anonymous");
#if defined (_WIN32)
char name[UNLEN + 1];