2002-09-05 14:10:50 +00:00
|
|
|
/**
|
|
|
|
* \file ControlConnections.C
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Angus Leeming
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-03-15 13:37:04 +00:00
|
|
|
*/
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
|
|
#include "ControlConnections.h"
|
2002-08-14 19:19:47 +00:00
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include "ViewBase.h"
|
2002-08-14 19:19:47 +00:00
|
|
|
|
2001-03-22 11:24:36 +00:00
|
|
|
#include "buffer.h"
|
2002-08-12 20:17:41 +00:00
|
|
|
#include "BufferView.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2002-08-14 19:19:47 +00:00
|
|
|
#include "frontends/Dialogs.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
#include "frontends/LyXView.h"
|
|
|
|
|
|
|
|
#include <boost/bind.hpp>
|
2001-03-16 12:08:14 +00:00
|
|
|
|
2002-10-21 17:38:09 +00:00
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
|
2002-05-29 16:21:03 +00:00
|
|
|
: lv_(lv), d_(d)
|
2001-03-15 13:37:04 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlConnectBase::connect()
|
|
|
|
{
|
2002-08-15 17:48:53 +00:00
|
|
|
r_ = d_.redrawGUI().
|
2002-05-29 16:21:03 +00:00
|
|
|
connect(boost::bind(&ControlConnectBase::redraw, this));
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ControlConnectBase::disconnect()
|
|
|
|
{
|
|
|
|
h_.disconnect();
|
|
|
|
r_.disconnect();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlConnectBase::redraw()
|
|
|
|
{
|
|
|
|
view().redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-12 20:17:41 +00:00
|
|
|
bool ControlConnectBase::bufferIsReadonly() const
|
2001-03-22 11:24:36 +00:00
|
|
|
{
|
|
|
|
if (!lv_.buffer())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return lv_.buffer()->isReadonly();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-12 20:17:41 +00:00
|
|
|
bool ControlConnectBase::bufferIsAvailable() const
|
|
|
|
{
|
|
|
|
if (!lv_.view())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return lv_.view()->available();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BufferView * ControlConnectBase::bufferview()
|
|
|
|
{
|
|
|
|
return lv_.view().get();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BufferView const * ControlConnectBase::bufferview() const
|
|
|
|
{
|
|
|
|
return lv_.view().get();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Buffer * ControlConnectBase::buffer()
|
|
|
|
{
|
|
|
|
return lv_.buffer();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
Buffer const & ControlConnectBase::buffer() const
|
2002-08-12 20:17:41 +00:00
|
|
|
{
|
2003-08-28 07:41:31 +00:00
|
|
|
return *lv_.buffer();
|
2002-08-12 20:17:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXFunc & ControlConnectBase::lyxfunc()
|
|
|
|
{
|
2002-08-13 14:40:38 +00:00
|
|
|
return lv_.getLyXFunc();
|
2002-08-12 20:17:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXFunc const & ControlConnectBase::lyxfunc() const
|
|
|
|
{
|
2002-08-13 14:40:38 +00:00
|
|
|
return lv_.getLyXFunc();
|
2002-08-12 20:17:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-26 13:16:57 +00:00
|
|
|
ControlConnectBase::DocTypes ControlConnectBase::docType() const
|
|
|
|
{
|
|
|
|
if (!lv_.buffer())
|
|
|
|
return LATEX;
|
|
|
|
|
|
|
|
if (lv_.buffer()->isLatex())
|
|
|
|
return LATEX;
|
|
|
|
else if (lv_.buffer()->isLiterate())
|
|
|
|
return LITERATE;
|
|
|
|
else if (lv_.buffer()->isLinuxDoc())
|
|
|
|
return LINUXDOC;
|
|
|
|
/* else if (lv_.buffer()->isDocBook()) */
|
|
|
|
return DOCBOOK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
|
2002-03-21 21:21:28 +00:00
|
|
|
: ControlConnectBase(lv, d)
|
2001-03-15 13:37:04 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlConnectBI::connect()
|
|
|
|
{
|
2003-02-25 14:51:38 +00:00
|
|
|
h_ = d_.hideAllSignal.connect(boost::bind(&ControlConnectBI::hide, this));
|
2001-03-15 13:37:04 +00:00
|
|
|
ControlConnectBase::connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
|
2002-05-29 16:21:03 +00:00
|
|
|
: ControlConnectBase(lv, d)
|
2001-03-15 13:37:04 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlConnectBD::connect()
|
|
|
|
{
|
2003-02-25 14:51:38 +00:00
|
|
|
u_ = d_.updateBufferDependentSignal.
|
2002-05-29 16:21:03 +00:00
|
|
|
connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
|
2003-02-25 14:51:38 +00:00
|
|
|
h_ = d_.hideBufferDependentSignal.
|
2002-05-29 16:21:03 +00:00
|
|
|
connect(boost::bind(&ControlConnectBD::hide, this));
|
2001-03-15 13:37:04 +00:00
|
|
|
ControlConnectBase::connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ControlConnectBD::disconnect()
|
|
|
|
{
|
|
|
|
u_.disconnect();
|
|
|
|
ControlConnectBase::disconnect();
|
|
|
|
}
|