]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlMinipage.C
The reference dialog now disconnects from the inset on Apply. Its behaviour
[lyx.git] / src / frontends / controllers / ControlMinipage.C
index f9ce97d0346be58f4b7edc237b4b9928b047ad86..7c7f2ee9406f749dbcfec73ecf2155cbcd443bea 100644 (file)
@@ -7,7 +7,7 @@
  *
  * ======================================================
  *
- * \author Juergen Vigna, jug@sad.it
+ * \author JΓΌrgen Vigna, jug@sad.it
  * \author Angus Leeming, a.leeming@ic.ac.uk
  */
 
 #pragma implementation
 #endif
 
+#include "ViewBase.h"
+#include "ButtonControllerBase.h"
 #include "ControlMinipage.h"
 #include "Dialogs.h"
 #include "LyXView.h"
 #include "buffer.h"
+#include "BufferView.h"
 
 using std::vector;
 using SigC::slot;
 
+// sorry this is just a temporary hack we should include vspace.h! (Jug)
+extern const char * stringFromUnit(int);
+
 ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
        : ControlInset<InsetMinipage, MinipageParams>(lv, d)
 {
@@ -40,7 +46,6 @@ ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
 void ControlMinipage::applyParamsToInset()
 {
        inset()->width(params().width);
-       inset()->widthp(params().widthp);
        inset()->pos(params().pos);
 
        lv_.view()->updateInset(inset(), true);
@@ -59,21 +64,23 @@ MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
 
 
 MinipageParams::MinipageParams()
-       : widthp(0), pos(InsetMinipage::top)
+       : pos(InsetMinipage::top)
 {}
 
 MinipageParams::MinipageParams(InsetMinipage const & inset)
-       : width(inset.width()), widthp(inset.widthp()), pos(inset.pos())
+       : width(inset.width()), pos(inset.pos())
 {}
 
-bool MinipageParams::operator==(MinipageParams const & o) const
+
+bool operator==(MinipageParams const & p1, MinipageParams const & p2)
 {
-       return (width == o.width && widthp == o.widthp && pos == o.pos);
+       return (p1.width == p2.width && p1.pos == p2.pos);
 }
 
-bool MinipageParams::operator!=(MinipageParams const & o) const
+
+bool operator!=(MinipageParams const & p1, MinipageParams const & p2)
 {
-       return !(*this == o);
+       return !(p1 == p2);
 }
 
 namespace minipage {
@@ -81,16 +88,11 @@ namespace minipage {
 vector<string> const getUnits()
 {
        vector<string> units;
-       units.push_back("mm");
-       units.push_back("in");
-       units.push_back("em");
-       units.push_back("%%");
-       units.push_back("%%c");
-       units.push_back("%%l");
-       units.push_back("%%p");
+       const char * str;
+       for(int i=0; (str = stringFromUnit(i)); ++i)
+           units.push_back(str);
 
        return units;
 }
  
 } // namespace minipage
-