]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetminipage.C
updates to minipage inset
[lyx.git] / src / insets / insetminipage.C
index 606648bcb9da111cae6bcbc6e4943c72529a7387..aafab15c0e4579e9ef3405ddcea7eba1bdce1116 100644 (file)
 #include "gettext.h"
 #include "lyxfont.h"
 #include "BufferView.h"
-#include "Painter.h"
 #include "lyxtext.h"
+#include "insets/insettext.h"
 #include "support/LOstream.h"
+#include "debug.h"
 
 using std::ostream;
 using std::endl;
@@ -54,7 +55,8 @@ using std::endl;
 // (Lgb)
 
 InsetMinipage::InsetMinipage()
-       : InsetCollapsable()
+       : InsetCollapsable(), pos_(center),
+         inner_pos_(inner_center)
 {
        setLabel(_("minipage"));
        LyXFont font(LyXFont::ALL_SANE);
@@ -74,17 +76,17 @@ void InsetMinipage::Write(Buffer const * buf, ostream & os) const
 }
 
 
-Inset * InsetMinipage::Clone() const
+Inset * InsetMinipage::Clone(Buffer const &) const
 {
        InsetMinipage * result = new InsetMinipage;
-       result->init(this);
+       result->inset->init(inset);
        
        result->collapsed = collapsed;
        return result;
 }
 
 
-char const * InsetMinipage::EditMessage() const
+string const InsetMinipage::EditMessage() const
 {
        return _("Opened Minipage Inset");
 }
@@ -95,36 +97,66 @@ int InsetMinipage::Latex(Buffer const * buf,
 {
        os << "\\begin{minipage}{\\columnwidth}%\n";
        
-       int i = InsetText::Latex(buf, os, fragile, fp);
+       int i = inset->Latex(buf, os, fragile, fp);
        os << "\\end{minipage}%\n";
        
        return i + 2;
 }
 
 
-bool InsetMinipage::InsertInset(BufferView * bv, Inset * inset)
+bool InsetMinipage::InsertInsetAllowed(Inset * in) const
 {
-       if (!InsertInsetAllowed(inset))
+       if ((in->LyxCode() == Inset::FLOAT_CODE) ||
+           (in->LyxCode() == Inset::MARGIN_CODE)) {
                return false;
-       
-       return InsetText::InsertInset(bv, inset);
+       }
+       return true;
 }
 
 
-bool InsetMinipage::InsertInsetAllowed(Inset * inset) const
+InsetMinipage::Position InsetMinipage::pos() const 
 {
-       if ((inset->LyxCode() == Inset::FLOAT_CODE) ||
-           (inset->LyxCode() == Inset::MARGIN_CODE)) {
-               return false;
-       }
-       return true;
+       return pos_;
+}
+
+
+void InsetMinipage::pos(InsetMinipage::Position p)
+{
+       pos_ = p;
+}
+
+
+InsetMinipage::InnerPosition InsetMinipage::innerPos() const
+{
+       return inner_pos_;
+}
+
+
+void InsetMinipage::innerPos(InsetMinipage::InnerPosition ip)
+{
+       inner_pos_ = ip;
+}
+
+
+LyXLength const & InsetMinipage::height() const
+{
+       return height_;
+}
+
+
+void InsetMinipage::height(LyXLength const & ll)
+{
+       height_ = ll;
+}
+
+
+LyXLength const & InsetMinipage::width() const
+{
+       return width_;
 }
 
 
-LyXFont InsetMinipage::GetDrawFont(BufferView * bv,
-                                  LyXParagraph * p, int pos) const
+void InsetMinipage::width(LyXLength const & ll)
 {
-       LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
-       fn.decSize().decSize();
-       return fn;
+       width_ = ll;
 }