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-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
|
|
|
|
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-07-02 19:23:10 +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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Buffer const * ControlConnectBase::buffer() const
|
|
|
|
{
|
|
|
|
return lv_.buffer();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
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();
|
|
|
|
}
|