#include "frontends/Painter.h"
+#include <boost/current_function.hpp>
+
#include <map>
#include <typeinfo>
-namespace {
+namespace lyx {
class InsetName {
public:
typedef std::map<std::string, InsetBase::Code> TranslatorMap;
-TranslatorMap const build_translator()
+static TranslatorMap const build_translator()
{
InsetName const insetnames[] = {
InsetName("toc", InsetBase::TOC_CODE),
InsetName("accent", InsetBase::ACCENT_CODE),
InsetName("math", InsetBase::MATH_CODE),
InsetName("index", InsetBase::INDEX_CODE),
+ InsetName("nomenclature", InsetBase::NOMENCL_CODE),
InsetName("include", InsetBase::INCLUDE_CODE),
InsetName("graphics", InsetBase::GRAPHICS_CODE),
InsetName("bibitem", InsetBase::BIBITEM_CODE),
InsetName("external", InsetBase::EXTERNAL_CODE),
InsetName("caption", InsetBase::CAPTION_CODE),
InsetName("mathmacro", InsetBase::MATHMACRO_CODE),
- InsetName("error", InsetBase::ERROR_CODE),
InsetName("cite", InsetBase::CITE_CODE),
InsetName("float_list", InsetBase::FLOAT_LIST_CODE),
InsetName("index_print", InsetBase::INDEX_PRINT_CODE),
+ InsetName("nomencl_print", InsetBase::NOMENCL_PRINT_CODE),
InsetName("optarg", InsetBase::OPTARG_CODE),
InsetName("environment", InsetBase::ENVIRONMENT_CODE),
InsetName("hfill", InsetBase::HFILL_CODE),
return data;
}
-} // namespace anon
-
-
-InsetBase::InsetBase()
-{}
-
-
-InsetBase::InsetBase(InsetBase const &)
-{}
-
std::auto_ptr<InsetBase> InsetBase::clone() const
{
void InsetBase::dispatch(LCursor & cur, FuncRequest & cmd)
{
- cur.needsUpdate();
+ cur.updateFlags(Update::Force | Update::FitCursor);
cur.dispatched();
doDispatch(cur, cmd);
}
void InsetBase::edit(LCursor &, bool)
{
- lyxerr << "InsetBase: edit left/right" << std::endl;
+ lyxerr[Debug::INSETS] << BOOST_CURRENT_FUNCTION
+ << ": edit left/right" << std::endl;
}
InsetBase * InsetBase::editXY(LCursor &, int x, int y)
{
- lyxerr << "InsetBase: editXY x:" << x << " y: " << y << std::endl;
+ lyxerr[Debug::INSETS] << BOOST_CURRENT_FUNCTION
+ << ": x=" << x << " y= " << y
+ << std::endl;
return this;
}
InsetBase::idx_type InsetBase::index(row_type row, col_type col) const
{
if (row != 0)
- lyxerr << "illegal row: " << row << std::endl;
+ lyxerr << BOOST_CURRENT_FUNCTION
+ << ": illegal row: " << row << std::endl;
if (col != 0)
- lyxerr << "illegal col: " << col << std::endl;
+ lyxerr << BOOST_CURRENT_FUNCTION
+ << ": illegal col: " << col << std::endl;
return 0;
}
int InsetBase::plaintext(Buffer const &,
- std::ostream &, OutputParams const &) const
-{
- return 0;
-}
-
-
-int InsetBase::linuxdoc(Buffer const &,
- std::ostream &, OutputParams const &) const
+ odocstream &, OutputParams const &) const
{
return 0;
}
int InsetBase::docbook(Buffer const &,
- std::ostream &, OutputParams const &) const
+ odocstream &, OutputParams const &) const
{
return 0;
}
}
-std::string const InsetBase::editMessage() const
+docstring const InsetBase::editMessage() const
{
return _("Opened inset");
}
-std::string const & InsetBase::getInsetName() const
+docstring const & InsetBase::getInsetName() const
{
- static std::string const name = "unknown";
+ static docstring const name = from_ascii("unknown");
return name;
}
-void InsetBase::markErased()
-{}
-
-
-void InsetBase::cursorPos(CursorSlice const &, bool, int & x, int & y) const
+void InsetBase::cursorPos(BufferView const & /*bv*/, CursorSlice const &,
+ bool, int & x, int & y) const
{
lyxerr << "InsetBase::cursorPos called directly" << std::endl;
x = 100;
}
-int InsetBase::xo() const
+int InsetBase::xo(BufferView const & bv) const
{
- return theCoords.getInsets().x(this);
+ return bv.coordCache().getInsets().x(this);
}
-int InsetBase::yo() const
+int InsetBase::yo(BufferView const & bv) const
{
- return theCoords.getInsets().y(this);
+ return bv.coordCache().getInsets().y(this);
}
-bool InsetBase::covers(int x, int y) const
+bool InsetBase::covers(BufferView const & bv, int x, int y) const
{
//lyxerr << "InsetBase::covers, x: " << x << " y: " << y
- // << " xo: " << xo() << " yo: " << yo()
- // << " x1: " << xo() << " x2: " << xo() + width()
- // << " y1: " << yo() - ascent() << " y2: " << yo() + descent()
+ // << " xo: " << xo(bv) << " yo: " << yo()
+ // << " x1: " << xo(bv) << " x2: " << xo() + width()
+ // << " y1: " << yo(bv) - ascent() << " y2: " << yo() + descent()
// << std::endl;
- return theCoords.getInsets().has(this)
- && x >= xo()
- && x <= xo() + width()
- && y >= yo() - ascent()
- && y <= yo() + descent();
+ return bv.coordCache().getInsets().has(this)
+ && x >= xo(bv)
+ && x <= xo(bv) + width()
+ && y >= yo(bv) - ascent()
+ && y <= yo(bv) + descent();
}
{
return inset && inset->editable() == InsetBase::HIGHLY_EDITABLE;
}
+
+
+} // namespace lyx