]> git.lyx.org Git - lyx.git/blobdiff - src/insets/Inset.cpp
Fix GRAPHICS_EDIT of InsetGraphics
[lyx.git] / src / insets / Inset.cpp
index a59a0e36f34dc51f4679df4d23ec58ddc4c38232..cb689077e44c784f6a2e330fbfb6e9fb17daae61 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "Inset.h"
 
+#include "buffer_funcs.h"
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/docstream.h"
+#include "support/ExceptionMessage.h"
 #include "support/gettext.h"
 
 #include <map>
 
 using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
@@ -89,18 +93,19 @@ static TranslatorMap const build_translator()
                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("space", SPACE_CODE),
                InsetName("vspace", VSPACE_CODE),
                InsetName("mathmacroarg", MATHMACROARG_CODE),
                InsetName("listings", LISTINGS_CODE),
                InsetName("info", INFO_CODE),
                InsetName("collapsable", COLLAPSABLE_CODE),
                InsetName("newpage", NEWPAGE_CODE),
+               InsetName("tablecell", CELL_CODE)
        };
 
        size_t const insetnames_size =
@@ -122,19 +127,16 @@ void Inset::setBuffer(Buffer & buffer)
 }
 
 
-static Buffer & theDummyBuffer()
-{
-       static Buffer dummyBuffer("nobuffer.lyx", true);
-       return dummyBuffer;
-}
-
-
 Buffer & Inset::buffer()
 {
-       if (buffer_)
-               return *buffer_;
-       LYXERR0("DUMMYBUFFER FOR " << lyxCode());
-       return theDummyBuffer();
+       if (!buffer_) {
+               odocstringstream s;
+               s << "LyX Code: " << lyxCode() << " name: " << name();
+               BOOST_ASSERT(false);
+               throw ExceptionMessage(BufferException, 
+                       from_ascii("Inset::buffer_ member not initialized!"), s.str());
+       }
+       return *buffer_;
 }
 
 
@@ -150,6 +152,13 @@ docstring Inset::name() const
 }
 
 
+void Inset::initView()
+{
+       if (isLabeled())
+               lyx::updateLabels(buffer());
+}
+
+
 docstring Inset::toolTip(BufferView const &, int, int) const
 {
        return docstring();
@@ -421,4 +430,10 @@ Buffer const * Inset::updateFrontend() const
        return theApp() ? theApp()->updateInset(this) : 0;
 }
 
+
+docstring Inset::completionPrefix(Cursor const &) const 
+{
+       return docstring();
+}
+
 } // namespace lyx