]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlMinipage.C
ws cleanup
[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 "ControlInset.tmpl"
24 #include "Dialogs.h"
25 #include "LyXView.h"
26 #include "buffer.h"
27 #include "BufferView.h"
28 #include "helper_funcs.h"
29
30 using std::vector;
31 using SigC::slot;
32
33
34 ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
35         : ControlInset<InsetMinipage, MinipageParams>(lv, d)
36 {
37         d_.showMinipage.connect(slot(this, &ControlMinipage::showInset));
38
39         // We could have an extra method updateInset that calls
40         // view().update() rather than view().show(), but I don't see why
41         // it is really needed.
42         d_.updateMinipage.connect(slot(this, &ControlMinipage::showInset));
43 }
44
45
46 void ControlMinipage::applyParamsToInset()
47 {
48         inset()->pageWidth(params().pageWidth);
49         inset()->pos(params().pos);
50
51         lv_.view()->updateInset(inset(), true);
52 }
53
54
55 void ControlMinipage::applyParamsNoInset()
56 {
57 }
58
59
60 MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
61 {
62         return MinipageParams(inset);
63 }
64
65
66 MinipageParams::MinipageParams()
67         : pos(InsetMinipage::top)
68 {}
69
70 MinipageParams::MinipageParams(InsetMinipage const & inset)
71         : pageWidth(inset.pageWidth()), pos(inset.pos())
72 {}
73
74
75 bool operator==(MinipageParams const & p1, MinipageParams const & p2)
76 {
77         return (p1.pageWidth == p2.pageWidth && p1.pos == p2.pos);
78 }
79
80
81 bool operator!=(MinipageParams const & p1, MinipageParams const & p2)
82 {
83         return !(p1 == p2);
84 }