lyx_mirror/src/frontends/controllers/ControlChanges.C
Michael Schmitt 1396ade8b1 fix LFUN enum values (some of them were broken by r13801)
adjust some commands according to the LyX naming conventions
(toggle-tooltip => tooltip-toggle, *-change(s) => change(s)-*) 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13811 a592a061-630c-0410-9148-cb99ea01b6c8
2006-05-08 18:09:19 +00:00

94 lines
1.7 KiB
C

/**
* \file ControlChanges.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "ControlChanges.h"
#include "author.h"
#include "buffer.h"
#include "bufferparams.h"
#include "BufferView.h"
#include "changes.h"
#include "funcrequest.h"
#include "lyxfind.h"
#include "support/lyxtime.h"
using std::string;
namespace lyx {
namespace frontend {
ControlChanges::ControlChanges(Dialog & parent)
: Dialog::Controller(parent)
{}
bool ControlChanges::find()
{
return find::findNextChange(kernel().bufferview());
}
bool ControlChanges::changed()
{
Change c(kernel().bufferview()->getCurrentChange());
return c.type != Change::UNCHANGED;
}
string const ControlChanges::getChangeDate()
{
Change c(kernel().bufferview()->getCurrentChange());
if (c.type == Change::UNCHANGED || !c.changetime)
return string();
return formatted_time(c.changetime);
}
string const ControlChanges::getChangeAuthor()
{
Change c(kernel().bufferview()->getCurrentChange());
if (c.type == Change::UNCHANGED)
return string();
Author const & a(kernel().buffer().params().authors().get(c.author));
string author(a.name());
if (!a.email().empty()) {
author += " (";
author += a.email() + ")";
}
return author;
}
bool ControlChanges::accept()
{
kernel().dispatch(FuncRequest(LFUN_CHANGE_ACCEPT));
return find::findNextChange(kernel().bufferview());
}
bool ControlChanges::reject()
{
kernel().dispatch(FuncRequest(LFUN_CHANGE_REJECT));
return find::findNextChange(kernel().bufferview());
}
} // namespace frontend
} // namespace lyx