2003-08-19 10:04:35 +00:00
|
|
|
|
/**
|
2007-04-29 13:39:47 +00:00
|
|
|
|
* \file Inset.cpp
|
2003-08-19 10:04:35 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
2007-04-29 12:32:14 +00:00
|
|
|
|
* \author Alejandro Aguilar Sierra
|
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Matthias Ettrich
|
2003-08-19 10:04:35 +00:00
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-08-19 10:04:35 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
2003-09-05 09:01:27 +00:00
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
#include "Inset.h"
|
2004-01-30 11:41:12 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Buffer.h"
|
2007-08-13 12:13:17 +00:00
|
|
|
|
#include "BufferParams.h"
|
2004-01-30 11:41:12 +00:00
|
|
|
|
#include "BufferView.h"
|
2007-04-29 12:32:14 +00:00
|
|
|
|
#include "CoordCache.h"
|
2007-04-26 14:56:30 +00:00
|
|
|
|
#include "Cursor.h"
|
2003-11-06 16:43:12 +00:00
|
|
|
|
#include "debug.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Dimension.h"
|
|
|
|
|
#include "DispatchResult.h"
|
|
|
|
|
#include "FuncRequest.h"
|
2005-04-13 09:43:58 +00:00
|
|
|
|
#include "FuncStatus.h"
|
2004-01-26 10:13:15 +00:00
|
|
|
|
#include "gettext.h"
|
2007-04-29 23:33:02 +00:00
|
|
|
|
#include "Text.h"
|
2007-08-13 12:13:17 +00:00
|
|
|
|
#include "TextClass.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "MetricsInfo.h"
|
2007-04-29 12:32:14 +00:00
|
|
|
|
#include "MetricsInfo.h"
|
2004-01-30 11:41:12 +00:00
|
|
|
|
|
|
|
|
|
#include "frontends/Painter.h"
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
|
#include "support/convert.h"
|
|
|
|
|
|
2005-07-18 21:19:23 +00:00
|
|
|
|
#include <boost/current_function.hpp>
|
|
|
|
|
|
2004-03-30 12:36:33 +00:00
|
|
|
|
#include <map>
|
2005-07-17 01:13:36 +00:00
|
|
|
|
#include <typeinfo>
|
2004-03-30 12:36:33 +00:00
|
|
|
|
|
2004-04-08 15:03:33 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
2004-03-30 12:36:33 +00:00
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class InsetName {
|
|
|
|
|
public:
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetName(std::string const & n, InsetCode c)
|
2004-03-30 12:36:33 +00:00
|
|
|
|
: name(n), code(c) {}
|
|
|
|
|
std::string name;
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetCode code;
|
2004-03-30 12:36:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
2004-04-08 15:03:33 +00:00
|
|
|
|
|
2007-10-13 09:04:52 +00:00
|
|
|
|
typedef std::map<std::string, InsetCode> TranslatorMap;
|
2004-03-30 12:36:33 +00:00
|
|
|
|
|
2004-04-08 15:03:33 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
static TranslatorMap const build_translator()
|
2004-03-30 12:36:33 +00:00
|
|
|
|
{
|
|
|
|
|
InsetName const insetnames[] = {
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetName("toc", TOC_CODE),
|
|
|
|
|
InsetName("quote", QUOTE_CODE),
|
|
|
|
|
InsetName("ref", REF_CODE),
|
2007-10-13 19:06:09 +00:00
|
|
|
|
InsetName("href", HYPERLINK_CODE),
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetName("separator", SEPARATOR_CODE),
|
|
|
|
|
InsetName("ending", ENDING_CODE),
|
|
|
|
|
InsetName("label", LABEL_CODE),
|
|
|
|
|
InsetName("note", NOTE_CODE),
|
|
|
|
|
InsetName("accent", ACCENT_CODE),
|
|
|
|
|
InsetName("math", MATH_CODE),
|
|
|
|
|
InsetName("index", INDEX_CODE),
|
|
|
|
|
InsetName("nomenclature", NOMENCL_CODE),
|
|
|
|
|
InsetName("include", INCLUDE_CODE),
|
|
|
|
|
InsetName("graphics", GRAPHICS_CODE),
|
|
|
|
|
InsetName("bibitem", BIBITEM_CODE),
|
|
|
|
|
InsetName("bibtex", BIBTEX_CODE),
|
|
|
|
|
InsetName("text", TEXT_CODE),
|
|
|
|
|
InsetName("ert", ERT_CODE),
|
|
|
|
|
InsetName("foot", FOOT_CODE),
|
|
|
|
|
InsetName("margin", MARGIN_CODE),
|
|
|
|
|
InsetName("float", FLOAT_CODE),
|
|
|
|
|
InsetName("wrap", WRAP_CODE),
|
|
|
|
|
InsetName("specialchar", SPECIALCHAR_CODE),
|
|
|
|
|
InsetName("tabular", TABULAR_CODE),
|
|
|
|
|
InsetName("external", EXTERNAL_CODE),
|
|
|
|
|
InsetName("caption", CAPTION_CODE),
|
|
|
|
|
InsetName("mathmacro", MATHMACRO_CODE),
|
|
|
|
|
InsetName("citation", CITE_CODE),
|
|
|
|
|
InsetName("floatlist", FLOAT_LIST_CODE),
|
|
|
|
|
InsetName("index_print", INDEX_PRINT_CODE),
|
|
|
|
|
InsetName("nomencl_print", NOMENCL_PRINT_CODE),
|
|
|
|
|
InsetName("optarg", OPTARG_CODE),
|
|
|
|
|
InsetName("environment", ENVIRONMENT_CODE),
|
|
|
|
|
InsetName("hfill", HFILL_CODE),
|
|
|
|
|
InsetName("newline", NEWLINE_CODE),
|
|
|
|
|
InsetName("line", LINE_CODE),
|
|
|
|
|
InsetName("branch", BRANCH_CODE),
|
|
|
|
|
InsetName("box", BOX_CODE),
|
|
|
|
|
InsetName("flex", FLEX_CODE),
|
|
|
|
|
InsetName("vspace", VSPACE_CODE),
|
|
|
|
|
InsetName("mathmacroarg", MATHMACROARG_CODE),
|
|
|
|
|
InsetName("listings", LISTINGS_CODE),
|
|
|
|
|
InsetName("info", INFO_CODE),
|
2007-10-16 16:48:21 +00:00
|
|
|
|
InsetName("collapsable", COLLAPSABLE_CODE),
|
|
|
|
|
InsetName("pagebreak", PAGEBREAK_CODE),
|
2004-03-30 12:36:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
std::size_t const insetnames_size =
|
|
|
|
|
sizeof(insetnames) / sizeof(insetnames[0]);
|
|
|
|
|
|
2007-10-13 09:04:52 +00:00
|
|
|
|
std::map<std::string, InsetCode> data;
|
2004-03-30 12:36:33 +00:00
|
|
|
|
for (std::size_t i = 0; i != insetnames_size; ++i) {
|
|
|
|
|
InsetName const & var = insetnames[i];
|
|
|
|
|
data[var.name] = var.code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-23 23:04:52 +00:00
|
|
|
|
|
2007-11-01 22:17:22 +00:00
|
|
|
|
docstring Inset::name() const
|
|
|
|
|
{
|
|
|
|
|
return from_ascii("unknown");
|
|
|
|
|
}
|
2007-04-22 21:40:10 +00:00
|
|
|
|
|
|
|
|
|
|
2007-09-23 22:39:49 +00:00
|
|
|
|
Dimension const Inset::dimension(BufferView const & bv) const
|
2007-09-21 20:39:47 +00:00
|
|
|
|
{
|
2007-09-23 22:39:49 +00:00
|
|
|
|
return bv.coordCache().getInsets().dim(this);
|
2007-09-21 20:39:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-13 12:50:18 +00:00
|
|
|
|
InsetCode insetCode(std::string const & name)
|
2004-03-30 12:36:33 +00:00
|
|
|
|
{
|
|
|
|
|
static TranslatorMap const translator = build_translator();
|
|
|
|
|
|
|
|
|
|
TranslatorMap::const_iterator it = translator.find(name);
|
|
|
|
|
return it == translator.end() ? NO_CODE : it->second;
|
|
|
|
|
}
|
2003-02-18 11:47:16 +00:00
|
|
|
|
|
|
|
|
|
|
2007-10-19 17:22:55 +00:00
|
|
|
|
std::string insetName(InsetCode c)
|
|
|
|
|
{
|
|
|
|
|
static TranslatorMap const translator = build_translator();
|
|
|
|
|
|
|
|
|
|
TranslatorMap::const_iterator it = translator.begin();
|
|
|
|
|
TranslatorMap::const_iterator end = translator.end();
|
|
|
|
|
for (; it != end; ++it) {
|
|
|
|
|
if (it->second == c)
|
|
|
|
|
return it->first;
|
|
|
|
|
}
|
|
|
|
|
return std::string();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
void Inset::dispatch(Cursor & cur, FuncRequest & cmd)
|
2003-10-17 18:01:15 +00:00
|
|
|
|
{
|
2006-10-22 11:46:36 +00:00
|
|
|
|
cur.updateFlags(Update::Force | Update::FitCursor);
|
2004-08-13 14:56:06 +00:00
|
|
|
|
cur.dispatched();
|
2004-11-24 21:58:42 +00:00
|
|
|
|
doDispatch(cur, cmd);
|
2003-10-17 18:01:15 +00:00
|
|
|
|
}
|
2003-02-18 11:47:16 +00:00
|
|
|
|
|
2003-10-17 18:01:15 +00:00
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
void Inset::doDispatch(Cursor & cur, FuncRequest &)
|
2003-02-18 11:47:16 +00:00
|
|
|
|
{
|
2004-03-01 17:12:09 +00:00
|
|
|
|
cur.noUpdate();
|
|
|
|
|
cur.undispatched();
|
2003-02-18 11:47:16 +00:00
|
|
|
|
}
|
2003-11-04 12:36:59 +00:00
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
|
2005-04-13 09:43:58 +00:00
|
|
|
|
FuncStatus & flag) const
|
2004-02-20 17:19:53 +00:00
|
|
|
|
{
|
2005-04-13 09:43:58 +00:00
|
|
|
|
// LFUN_INSET_APPLY is sent from the dialogs when the data should
|
|
|
|
|
// be applied. This is either changed to LFUN_INSET_MODIFY (if the
|
|
|
|
|
// dialog belongs to us) or LFUN_INSET_INSERT (if the dialog does
|
|
|
|
|
// not belong to us, i. e. the dialog was open, and the user moved
|
|
|
|
|
// the cursor in our inset) in LyXFunc::getStatus().
|
|
|
|
|
// Dialogs::checkStatus() ensures that the dialog is deactivated if
|
|
|
|
|
// LFUN_INSET_APPLY is disabled.
|
|
|
|
|
|
|
|
|
|
switch (cmd.action) {
|
|
|
|
|
case LFUN_INSET_MODIFY:
|
2005-05-17 11:11:45 +00:00
|
|
|
|
// Allow modification of our data.
|
2005-04-13 09:43:58 +00:00
|
|
|
|
// This needs to be handled in the doDispatch method of our
|
|
|
|
|
// instantiatable children.
|
2005-05-17 11:11:45 +00:00
|
|
|
|
flag.enabled(true);
|
|
|
|
|
return true;
|
2005-04-13 09:43:58 +00:00
|
|
|
|
|
|
|
|
|
case LFUN_INSET_INSERT:
|
|
|
|
|
// Don't allow insertion of new insets.
|
|
|
|
|
// Every inset that wants to allow new insets from open
|
|
|
|
|
// dialogs needs to override this.
|
|
|
|
|
flag.enabled(false);
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2004-02-20 17:19:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
void Inset::edit(Cursor &, bool)
|
2003-11-06 16:43:12 +00:00
|
|
|
|
{
|
2007-04-01 10:09:49 +00:00
|
|
|
|
LYXERR(Debug::INSETS) << BOOST_CURRENT_FUNCTION
|
2006-04-05 23:56:29 +00:00
|
|
|
|
<< ": edit left/right" << std::endl;
|
2003-11-06 16:43:12 +00:00
|
|
|
|
}
|
2003-11-04 12:36:59 +00:00
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset * Inset::editXY(Cursor &, int x, int y)
|
2003-11-04 12:36:59 +00:00
|
|
|
|
{
|
2007-04-01 10:09:49 +00:00
|
|
|
|
LYXERR(Debug::INSETS) << BOOST_CURRENT_FUNCTION
|
2006-04-05 23:56:29 +00:00
|
|
|
|
<< ": x=" << x << " y= " << y
|
|
|
|
|
<< std::endl;
|
2005-07-15 00:39:44 +00:00
|
|
|
|
return this;
|
2003-11-04 12:36:59 +00:00
|
|
|
|
}
|
2004-01-26 10:13:15 +00:00
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset::idx_type Inset::index(row_type row, col_type col) const
|
2004-01-26 10:13:15 +00:00
|
|
|
|
{
|
|
|
|
|
if (row != 0)
|
2005-07-18 15:12:15 +00:00
|
|
|
|
lyxerr << BOOST_CURRENT_FUNCTION
|
2006-04-05 23:56:29 +00:00
|
|
|
|
<< ": illegal row: " << row << std::endl;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
if (col != 0)
|
2005-07-18 15:12:15 +00:00
|
|
|
|
lyxerr << BOOST_CURRENT_FUNCTION
|
2006-04-05 23:56:29 +00:00
|
|
|
|
<< ": illegal col: " << col << std::endl;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
bool Inset::idxBetween(idx_type idx, idx_type from, idx_type to) const
|
2004-01-26 10:13:15 +00:00
|
|
|
|
{
|
|
|
|
|
return from <= idx && idx <= to;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
bool Inset::idxUpDown(Cursor &, bool) const
|
2004-01-26 10:13:15 +00:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
int Inset::docbook(Buffer const &,
|
2006-10-21 00:16:43 +00:00
|
|
|
|
odocstream &, OutputParams const &) const
|
2004-01-26 10:13:15 +00:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
bool Inset::directWrite() const
|
2004-01-26 10:13:15 +00:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset::EDITABLE Inset::editable() const
|
2004-01-26 10:13:15 +00:00
|
|
|
|
{
|
|
|
|
|
return NOT_EDITABLE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
bool Inset::autoDelete() const
|
2004-01-26 10:13:15 +00:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
docstring const Inset::editMessage() const
|
2004-01-26 10:13:15 +00:00
|
|
|
|
{
|
2006-09-09 18:52:00 +00:00
|
|
|
|
return _("Opened inset");
|
2004-01-26 10:13:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
void Inset::cursorPos(BufferView const & /*bv*/, CursorSlice const &,
|
2006-10-17 16:23:27 +00:00
|
|
|
|
bool, int & x, int & y) const
|
2004-01-30 11:41:12 +00:00
|
|
|
|
{
|
2007-04-29 13:39:47 +00:00
|
|
|
|
lyxerr << "Inset::cursorPos called directly" << std::endl;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
x = 100;
|
|
|
|
|
y = 100;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
void Inset::metricsMarkers(Dimension & dim, int framesize) const
|
2004-01-30 11:41:12 +00:00
|
|
|
|
{
|
2004-08-13 15:08:25 +00:00
|
|
|
|
dim.wid += 2 * framesize;
|
2007-05-19 19:45:55 +00:00
|
|
|
|
dim.des += framesize;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
void Inset::metricsMarkers2(Dimension & dim, int framesize) const
|
2004-01-30 11:41:12 +00:00
|
|
|
|
{
|
2004-08-13 15:08:25 +00:00
|
|
|
|
dim.wid += 2 * framesize;
|
|
|
|
|
dim.asc += framesize;
|
|
|
|
|
dim.des += framesize;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-06-07 21:36:42 +00:00
|
|
|
|
void Inset::drawMarkers(PainterInfo & pi, int x, int y) const
|
|
|
|
|
{
|
2007-10-25 12:41:02 +00:00
|
|
|
|
ColorCode pen_color = mouseHovered() || editing(pi.base.bv)?
|
|
|
|
|
Color_mathframe : Color_mathcorners;
|
2007-06-07 21:36:42 +00:00
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
|
Dimension const dim = dimension(*pi.base.bv);
|
|
|
|
|
|
|
|
|
|
int const t = x + dim.width() - 1;
|
|
|
|
|
int const d = y + dim.descent();
|
2007-06-07 21:36:42 +00:00
|
|
|
|
pi.pain.line(x, d - 3, x, d, pen_color);
|
|
|
|
|
pi.pain.line(t, d - 3, t, d, pen_color);
|
|
|
|
|
pi.pain.line(x, d, x + 3, d, pen_color);
|
|
|
|
|
pi.pain.line(t - 3, d, t, d, pen_color);
|
|
|
|
|
setPosCache(pi, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Inset::drawMarkers2(PainterInfo & pi, int x, int y) const
|
|
|
|
|
{
|
2007-10-25 12:41:02 +00:00
|
|
|
|
ColorCode pen_color = mouseHovered() || editing(pi.base.bv)?
|
|
|
|
|
Color_mathframe : Color_mathcorners;
|
2007-06-07 21:36:42 +00:00
|
|
|
|
|
|
|
|
|
drawMarkers(pi, x, y);
|
2007-09-21 20:39:47 +00:00
|
|
|
|
Dimension const dim = dimension(*pi.base.bv);
|
|
|
|
|
int const t = x + dim.width() - 1;
|
|
|
|
|
int const a = y - dim.ascent();
|
2007-06-07 21:36:42 +00:00
|
|
|
|
pi.pain.line(x, a + 3, x, a, pen_color);
|
|
|
|
|
pi.pain.line(t, a + 3, t, a, pen_color);
|
|
|
|
|
pi.pain.line(x, a, x + 3, a, pen_color);
|
|
|
|
|
pi.pain.line(t - 3, a, t, a, pen_color);
|
|
|
|
|
setPosCache(pi, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
bool Inset::editing(BufferView * bv) const
|
2004-01-30 11:41:12 +00:00
|
|
|
|
{
|
|
|
|
|
return bv->cursor().isInside(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
int Inset::xo(BufferView const & bv) const
|
2004-08-14 14:03:42 +00:00
|
|
|
|
{
|
2006-10-13 16:44:44 +00:00
|
|
|
|
return bv.coordCache().getInsets().x(this);
|
2004-08-14 14:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
int Inset::yo(BufferView const & bv) const
|
2004-08-14 14:03:42 +00:00
|
|
|
|
{
|
2006-10-13 16:44:44 +00:00
|
|
|
|
return bv.coordCache().getInsets().y(this);
|
2004-08-14 14:03:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
bool Inset::covers(BufferView const & bv, int x, int y) const
|
2004-01-30 11:41:12 +00:00
|
|
|
|
{
|
2007-09-24 08:05:49 +00:00
|
|
|
|
return bv.coordCache().getInsets().covers(this, x, y);
|
2004-01-30 11:41:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-13 12:13:17 +00:00
|
|
|
|
InsetLayout const & Inset::getLayout(BufferParams const & bp) const
|
|
|
|
|
{
|
|
|
|
|
return bp.getTextClass().insetlayout(name());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
void Inset::dump() const
|
2004-02-02 17:32:56 +00:00
|
|
|
|
{
|
|
|
|
|
Buffer buf("foo", 1);
|
|
|
|
|
write(buf, lyxerr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-25 12:41:02 +00:00
|
|
|
|
ColorCode Inset::backgroundColor() const
|
2007-04-22 21:40:10 +00:00
|
|
|
|
{
|
2007-10-25 12:41:02 +00:00
|
|
|
|
return Color_background;
|
2007-04-22 21:40:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
void Inset::setPosCache(PainterInfo const & pi, int x, int y) const
|
2007-04-29 12:32:14 +00:00
|
|
|
|
{
|
2007-04-29 13:39:47 +00:00
|
|
|
|
//lyxerr << "Inset:: position cache to " << x << " " << y << std::endl;
|
2007-04-29 12:32:14 +00:00
|
|
|
|
pi.base.bv->coordCache().insets().add(this, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-23 22:39:49 +00:00
|
|
|
|
void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
|
|
|
|
|
{
|
|
|
|
|
mi.base.bv->coordCache().insets().add(this, dim);
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|