lyx_mirror/src/frontends/controllers/Kernel.C
Angus Leeming a8a852b4e9 Make the Qt Alert boxes recognize their parent.
Lots of gratuitous changes that should not alter Lyx's behaviour.

**************************************************************************
You're all going to get failure on link. Please "rm -f lengthvalidator.*".
**************************************************************************


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9940 a592a061-630c-0410-9148-cb99ea01b6c8
2005-05-12 22:37:43 +00:00

118 lines
1.8 KiB
C

/**
* \file Kernel.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 "Kernel.h"
#include "buffer.h"
#include "BufferView.h"
#include "funcrequest.h"
#include "lyxfunc.h"
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
using std::string;
namespace lyx {
namespace frontend {
Kernel::Kernel(LyXView & lyxview)
: lyxview_(lyxview)
{}
void Kernel::dispatch(FuncRequest const & fr) const
{
lyxview_.getLyXFunc().dispatch(fr);
}
void Kernel::updateDialog(string const & name) const
{
dispatch(FuncRequest(LFUN_DIALOG_UPDATE, name));
}
void Kernel::disconnect(string const & name) const
{
lyxview_.getDialogs().disconnect(name);
}
bool Kernel::isBufferAvailable() const
{
if (!lyxview_.view().get())
return false;
return lyxview_.view()->available();
}
bool Kernel::isBufferReadonly() const
{
if (!lyxview_.buffer())
return true;
return lyxview_.buffer()->isReadonly();
}
string const Kernel::bufferFilepath() const
{
return buffer().filePath();
}
Kernel::DocType Kernel::docType() const
{
if (buffer().isLatex())
return LATEX;
if (buffer().isLiterate())
return LITERATE;
if (buffer().isLinuxDoc())
return LINUXDOC;
return DOCBOOK;
}
void Kernel::redrawGUI() const
{
lyxview_.getDialogs().redrawGUI();
}
BufferView * Kernel::bufferview()
{
return lyxview_.view().get();
}
BufferView const * Kernel::bufferview() const
{
return lyxview_.view().get();
}
Buffer & Kernel::buffer()
{
BOOST_ASSERT(lyxview_.buffer());
return *lyxview_.buffer();
}
Buffer const & Kernel::buffer() const
{
BOOST_ASSERT(lyxview_.buffer());
return *lyxview_.buffer();
}
} // namespace frontend
} // namespace lyx