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>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2001-04-26 18:40:38 +00:00
|
|
|
#include "ViewBase.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
#include "ControlConnections.h"
|
|
|
|
#include "Dialogs.h"
|
2002-05-23 12:08:47 +00:00
|
|
|
#include "frontends/LyXView.h"
|
2001-03-22 11:24:36 +00:00
|
|
|
#include "buffer.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
using SigC::slot;
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
|
2001-03-22 11:24:36 +00:00
|
|
|
: lv_(lv), d_(d), h_(0), r_(0)
|
2001-03-15 13:37:04 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlConnectBase::connect()
|
|
|
|
{
|
|
|
|
r_ = Dialogs::redrawGUI.
|
|
|
|
connect(slot(this, &ControlConnectBase::redraw));
|
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
h_ = d_.hideAll.connect(slot(this, &ControlConnectBI::hide));
|
|
|
|
ControlConnectBase::connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
|
|
|
|
: ControlConnectBase(lv, d),
|
|
|
|
u_(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlConnectBD::connect()
|
|
|
|
{
|
|
|
|
u_ = d_.updateBufferDependent.
|
|
|
|
connect(slot(this, &ControlConnectBD::updateSlot));
|
|
|
|
h_ = d_.hideBufferDependent.
|
|
|
|
connect(slot(this, &ControlConnectBD::hide));
|
|
|
|
ControlConnectBase::connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ControlConnectBD::disconnect()
|
|
|
|
{
|
|
|
|
u_.disconnect();
|
|
|
|
ControlConnectBase::disconnect();
|
|
|
|
}
|