2001-03-15 13:37:04 +00:00
|
|
|
/* This file is part of
|
2002-03-21 21:21:28 +00:00
|
|
|
* ======================================================
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-03-21 13:27:03 +00:00
|
|
|
* Copyright 2001 The LyX Team.
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* \file ControlConnections.C
|
|
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
|
|
|
*/
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ControlConnections.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
#include "ViewBase.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
#include "Dialogs.h"
|
2001-03-22 11:24:36 +00:00
|
|
|
#include "buffer.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include "frontends/LyXView.h"
|
|
|
|
|
|
|
|
#include <boost/bind.hpp>
|
2001-03-16 12:08:14 +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()
|
|
|
|
{
|
|
|
|
r_ = Dialogs::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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-22 11:24:36 +00:00
|
|
|
bool ControlConnectBase::isReadonly() const
|
|
|
|
{
|
|
|
|
if (!lv_.buffer())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return lv_.buffer()->isReadonly();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
2002-05-29 16:21:03 +00:00
|
|
|
h_ = d_.hideAll.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()
|
|
|
|
{
|
|
|
|
u_ = d_.updateBufferDependent.
|
2002-05-29 16:21:03 +00:00
|
|
|
connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
|
2001-03-15 13:37:04 +00:00
|
|
|
h_ = d_.hideBufferDependent.
|
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();
|
|
|
|
}
|