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"
|
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"
|
2008-02-19 09:10:59 +00:00
|
|
|
|
#include "LyX.h" // quitting
|
|
|
|
|
#include "MetricsInfo.h"
|
2007-04-29 23:33:02 +00:00
|
|
|
|
#include "Text.h"
|
2007-08-13 12:13:17 +00:00
|
|
|
|
#include "TextClass.h"
|
2004-01-30 11:41:12 +00:00
|
|
|
|
|
|
|
|
|
#include "frontends/Painter.h"
|
2007-11-17 15:32:12 +00:00
|
|
|
|
#include "frontends/Application.h"
|
2004-01-30 11:41:12 +00:00
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
|
#include "support/convert.h"
|
2007-11-29 21:10:35 +00:00
|
|
|
|
#include "support/debug.h"
|
|
|
|
|
#include "support/gettext.h"
|
2005-07-18 21:19:23 +00:00
|
|
|
|
|
2004-03-30 12:36:33 +00:00
|
|
|
|
#include <map>
|
|
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
|
using namespace std;
|
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-12-12 19:28:07 +00:00
|
|
|
|
InsetName(string const & n, InsetCode c) : name(n), code(c) {}
|
|
|
|
|
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-12-12 19:28:07 +00:00
|
|
|
|
typedef map<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),
|
2007-11-23 02:10:00 +00:00
|
|
|
|
InsetName("newpage", NEWPAGE_CODE),
|
2004-03-30 12:36:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-11-28 22:12:03 +00:00
|
|
|
|
size_t const insetnames_size =
|
2004-03-30 12:36:33 +00:00
|
|
|
|
sizeof(insetnames) / sizeof(insetnames[0]);
|
|
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
|
map<string, InsetCode> data;
|
2007-11-28 22:12:03 +00:00
|
|
|
|
for (size_t i = 0; i != insetnames_size; ++i) {
|
2004-03-30 12:36:33 +00:00
|
|
|
|
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-12-25 18:53:38 +00:00
|
|
|
|
docstring Inset::toolTip(BufferView const &, int, int) const
|
|
|
|
|
{
|
|
|
|
|
return docstring();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-12-26 12:40:58 +00:00
|
|
|
|
docstring Inset::contextMenu(BufferView const &, int, int) const
|
|
|
|
|
{
|
|
|
|
|
return docstring();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-12-12 19:28:07 +00:00
|
|
|
|
InsetCode insetCode(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-12-12 19:28:07 +00:00
|
|
|
|
string insetName(InsetCode c)
|
2007-10-19 17:22:55 +00:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
2007-12-12 19:28:07 +00:00
|
|
|
|
return string();
|
2007-10-19 17:22:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-02-11 08:20:13 +00:00
|
|
|
|
void Inset::edit(Cursor &, bool, EntryDirection)
|
2003-11-06 16:43:12 +00:00
|
|
|
|
{
|
2007-11-29 21:10:35 +00:00
|
|
|
|
LYXERR(Debug::INSETS, "edit left/right");
|
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-11-29 21:10:35 +00:00
|
|
|
|
LYXERR(Debug::INSETS, "x: " << x << " y: " << y);
|
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)
|
2007-11-29 21:10:35 +00:00
|
|
|
|
LYXERR0("illegal row: " << row);
|
2004-01-26 10:13:15 +00:00
|
|
|
|
if (col != 0)
|
2007-11-29 21:10:35 +00:00
|
|
|
|
LYXERR0("illegal col: " << col);
|
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-11-28 22:12:03 +00:00
|
|
|
|
LYXERR0("Inset::cursorPos called directly");
|
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-12-22 14:38:43 +00:00
|
|
|
|
bool Inset::editing(BufferView const * 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-11-28 22:12:03 +00:00
|
|
|
|
//LYXERR("Inset: set position cache to " << x << " " << y);
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-17 15:32:12 +00:00
|
|
|
|
|
|
|
|
|
Buffer const * Inset::updateFrontend() const
|
|
|
|
|
{
|
|
|
|
|
if (quitting)
|
|
|
|
|
return 0;
|
2007-11-17 20:47:50 +00:00
|
|
|
|
return theApp()->updateInset(this);
|
2007-11-17 15:32:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|