2003-02-08 19:18:01 +00:00
|
|
|
/**
|
|
|
|
* \file ControlChanges.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-02-08 19:18:01 +00:00
|
|
|
*/
|
|
|
|
|
2003-02-13 16:53:15 +00:00
|
|
|
#include <config.h>
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
#include "ControlChanges.h"
|
2003-09-09 17:00:19 +00:00
|
|
|
|
|
|
|
#include "author.h"
|
2003-02-08 19:18:01 +00:00
|
|
|
#include "buffer.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
#include "bufferparams.h"
|
2003-02-08 19:18:01 +00:00
|
|
|
#include "BufferView.h"
|
2003-09-06 17:23:08 +00:00
|
|
|
#include "changes.h"
|
2003-02-08 19:18:01 +00:00
|
|
|
#include "funcrequest.h"
|
2003-03-09 21:03:43 +00:00
|
|
|
#include "lyxfind.h"
|
2005-07-05 09:01:52 +00:00
|
|
|
#include "support/lyxtime.h"
|
2003-02-08 19:18:01 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
namespace frontend {
|
|
|
|
|
2003-03-09 21:03:43 +00:00
|
|
|
|
|
|
|
ControlChanges::ControlChanges(Dialog & parent)
|
|
|
|
: Dialog::Controller(parent)
|
|
|
|
{}
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
|
2003-03-14 11:31:07 +00:00
|
|
|
bool ControlChanges::find()
|
2003-02-08 19:18:01 +00:00
|
|
|
{
|
2004-05-19 15:11:37 +00:00
|
|
|
return find::findNextChange(kernel().bufferview());
|
2003-02-08 19:18:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-10 16:46:03 +00:00
|
|
|
bool ControlChanges::changed()
|
|
|
|
{
|
|
|
|
Change c(kernel().bufferview()->getCurrentChange());
|
|
|
|
return c.type != Change::UNCHANGED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
string const ControlChanges::getChangeDate()
|
|
|
|
{
|
2003-03-09 21:03:43 +00:00
|
|
|
Change c(kernel().bufferview()->getCurrentChange());
|
2003-02-08 19:18:01 +00:00
|
|
|
if (c.type == Change::UNCHANGED || !c.changetime)
|
|
|
|
return string();
|
2003-03-14 11:31:07 +00:00
|
|
|
|
2005-07-05 09:01:52 +00:00
|
|
|
return formatted_time(c.changetime);
|
2003-02-08 19:18:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const ControlChanges::getChangeAuthor()
|
|
|
|
{
|
2003-03-09 21:03:43 +00:00
|
|
|
Change c(kernel().bufferview()->getCurrentChange());
|
2003-02-08 19:18:01 +00:00
|
|
|
if (c.type == Change::UNCHANGED)
|
|
|
|
return string();
|
2003-02-13 16:53:15 +00:00
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
Author const & a(kernel().buffer().params().authors().get(c.author));
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
string author(a.name());
|
2003-02-13 16:53:15 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
if (!a.email().empty()) {
|
|
|
|
author += " (";
|
|
|
|
author += a.email() + ")";
|
|
|
|
}
|
|
|
|
|
|
|
|
return author;
|
|
|
|
}
|
|
|
|
|
2003-02-13 16:53:15 +00:00
|
|
|
|
2004-10-11 14:29:15 +00:00
|
|
|
bool ControlChanges::accept()
|
2003-02-08 19:18:01 +00:00
|
|
|
{
|
2006-05-08 18:09:19 +00:00
|
|
|
kernel().dispatch(FuncRequest(LFUN_CHANGE_ACCEPT));
|
2004-10-11 14:29:15 +00:00
|
|
|
return find::findNextChange(kernel().bufferview());
|
2003-02-08 19:18:01 +00:00
|
|
|
}
|
2003-02-13 16:53:15 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
2004-10-11 14:29:15 +00:00
|
|
|
bool ControlChanges::reject()
|
2003-02-08 19:18:01 +00:00
|
|
|
{
|
2006-05-08 18:09:19 +00:00
|
|
|
kernel().dispatch(FuncRequest(LFUN_CHANGE_REJECT));
|
2004-10-11 14:29:15 +00:00
|
|
|
return find::findNextChange(kernel().bufferview());
|
2003-02-08 19:18:01 +00:00
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
2004-10-11 14:29:15 +00:00
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|