#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("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);
}
int InsetBase::plaintext(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
{
- // FIXME UNICODE
- return lyx::to_utf8(_("Opened inset"));
+ 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(bool)
-{}
-
-
-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