]> git.lyx.org Git - lyx.git/blobdiff - src/insets/inset.C
more changes...read the Changelog
[lyx.git] / src / insets / inset.C
index 2bf343027453b510098879d6886e3b6c7a6bdf21..333c1a6b2c6dd91db3bba031e1f99187c78efe8e 100644 (file)
@@ -41,13 +41,6 @@ Inset::EDITABLE Inset::Editable() const
   return NOT_EDITABLE;
 }
 
-bool Inset::IsTextInset() const
-{
-       return ((LyxCode() == TEXT_CODE) ||
-               (LyxCode() == ERT_CODE) ||
-               (LyxCode() == FOOT_CODE) ||
-               (LyxCode() == MARGIN_CODE));
-}
 
 void Inset::Validate(LaTeXFeatures &) const
 {
@@ -65,9 +58,9 @@ void Inset::Edit(BufferView *, int, int, unsigned int)
 }
 
 
-LyXFont Inset::ConvertFont(LyXFont font)
+LyXFont Inset::ConvertFont(LyXFont const & font) const
 {
-  return font;
+       return LyXFont(font);
 }
 
 
@@ -76,6 +69,16 @@ char const * Inset::EditMessage() const
        return _("Opened inset");
 }
 
+
+LyXText * Inset::getLyXText(BufferView * bv) const
+{
+    if (owner())
+           return owner()->getLyXText(bv);
+    else
+           return bv->text;
+}
+
+
  /* some stuff for inset locking */
 
 void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)
@@ -122,10 +125,12 @@ void UpdatableInset::ToggleInsetCursor(BufferView *)
 {
 }
 
+
 void UpdatableInset::ShowInsetCursor(BufferView *)
 {
 }
 
+
 void UpdatableInset::HideInsetCursor(BufferView *)
 {
 }
@@ -137,16 +142,17 @@ void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
 
     scx = 0;
 
-    mx_scx = abs((width(bv->painter(), font) - bv->paperWidth()) / 2);
+    mx_scx = abs((width(bv, font) - bv->workWidth()) / 2);
 }
 
 
-void UpdatableInset::draw(Painter &, LyXFont const &,
-                         int baseline, float & x) const
+void UpdatableInset::draw(BufferView *, LyXFont const &,
+                         int /* baseline */, float & x, bool/*cleared*/) const
 {
     if (scx) x += float(scx);
-    top_x = int(x);
-    top_baseline = baseline;
+// ATTENTION: don't do the following here!!!
+//    top_x = int(x);
+//    top_baseline = baseline;
 }
 
 
@@ -178,9 +184,10 @@ UpdatableInset::LocalDispatch(BufferView *, int, string const &)
     return UNDISPATCHED; 
 }
 
-int UpdatableInset::getMaxWidth(Painter & pain, UpdatableInset const *inset) const
+
+int UpdatableInset::getMaxWidth(Painter & pain, UpdatableInset const *) const
 {
     if (owner())
-        return static_cast<UpdatableInset*>(owner())->getMaxWidth(pain, inset);
+        return static_cast<UpdatableInset*>(owner())->getMaxWidth(pain, this);
     return pain.paperWidth();
 }