lyx_mirror/src/frontends/controllers/ControlForks.C
Lars Gullik Bjønnes 44cd0fc9a1 The std::string mammoth path.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7862 a592a061-630c-0410-9148-cb99ea01b6c8
2003-10-06 15:43:21 +00:00

92 lines
1.5 KiB
C

/**
* \file ControlForks.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "ControlForks.h"
#include "ViewBase.h"
#include "lyxfunc.h"
#include "funcrequest.h"
#include "support/forkedcontr.h"
#include "support/tostr.h"
#include <boost/bind.hpp>
using lyx::support::ForkedcallsController;
using std::string;
using std::vector;
ControlForks::ControlForks(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
{}
vector<pid_t> const ControlForks::getPIDs() const
{
return ForkedcallsController::get().getPIDs();
}
string const ControlForks::getCommand(pid_t pid) const
{
return ForkedcallsController::get().getCommand(pid);
}
void ControlForks::kill(pid_t pid)
{
pids_.push_back(pid);
}
void ControlForks::apply()
{
if (!bufferIsAvailable())
return;
view().apply();
// Nothing to apply?
if (pids_.empty())
return;
for (vector<pid_t>::const_iterator it = pids_.begin();
it != pids_.end(); ++it) {
lyxfunc().dispatch(FuncRequest(LFUN_FORKS_KILL, tostr(*it)));
}
pids_.clear();
}
void ControlForks::setParams()
{
if (childrenChanged_.connected())
return;
pids_.clear();
ForkedcallsController & fcc = ForkedcallsController::get();
childrenChanged_ =
fcc.childrenChanged.connect(boost::bind(&ControlForks::update, this));
}
void ControlForks::clearParams()
{
pids_.clear();
childrenChanged_.disconnect();
}