]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlMinipage.C
Address most (if not all?) of the problems raised by Garst about the
[lyx.git] / src / frontends / controllers / ControlMinipage.C
1 /* This file is part of
2  * ====================================================== 
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 2001 The LyX Team.
7  *
8  * ======================================================
9  *
10  * \author Jürgen Vigna, jug@sad.it
11  * \author Angus Leeming, a.leeming@ic.ac.uk
12  */
13
14 #include <config.h>
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include "ViewBase.h"
21 #include "ButtonControllerBase.h"
22 #include "ControlMinipage.h"
23 #include "Dialogs.h"
24 #include "LyXView.h"
25 #include "buffer.h"
26 #include "BufferView.h"
27 #include "helper_funcs.h"
28
29 using std::vector;
30 using SigC::slot;
31
32
33 ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
34         : ControlInset<InsetMinipage, MinipageParams>(lv, d)
35 {
36         d_.showMinipage.connect(slot(this, &ControlMinipage::showInset));
37
38         // We could have an extra method updateInset that calls
39         // view().update() rather than view().show(), but I don't see why
40         // it is really needed.
41         d_.updateMinipage.connect(slot(this, &ControlMinipage::showInset));
42 }
43
44
45 void ControlMinipage::applyParamsToInset()
46 {
47         inset()->width(params().width);
48         inset()->pos(params().pos);
49
50         lv_.view()->updateInset(inset(), true);
51 }
52
53
54 void ControlMinipage::applyParamsNoInset()
55 {
56 }
57
58
59 MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
60 {
61         return MinipageParams(inset);
62 }
63
64
65 MinipageParams::MinipageParams()
66         : pos(InsetMinipage::top)
67 {}
68
69 MinipageParams::MinipageParams(InsetMinipage const & inset)
70         : width(inset.width()), pos(inset.pos())
71 {}
72
73
74 bool operator==(MinipageParams const & p1, MinipageParams const & p2)
75 {
76         return (p1.width == p2.width && p1.pos == p2.pos);
77 }
78
79
80 bool operator!=(MinipageParams const & p1, MinipageParams const & p2)
81 {
82         return !(p1 == p2);
83 }