]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiInfo.cpp
Preliminar InsetInfo dialog. This was done as an exercise to show Bo (an others)...
[lyx.git] / src / frontends / qt4 / GuiInfo.cpp
1 /**
2  * \file GuiInfo.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Abdelrazak Younes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiInfo.h"
14
15 #include "qt_helpers.h"
16
17 #include "Buffer.h"
18 #include "buffer_funcs.h"
19 #include "BufferParams.h"
20 #include "BufferView.h"
21 #include "Cursor.h"
22 #include "FuncRequest.h"
23
24 #include "insets/InsetInfo.h"
25
26 #include "support/debug.h"
27
28
29 using namespace std;
30
31 namespace lyx {
32 namespace frontend {
33
34 /////////////////////////////////////////////////////////////////
35 //
36 // GuiInfo
37 //
38 /////////////////////////////////////////////////////////////////
39
40 GuiInfo::GuiInfo(GuiView & lv)
41         : DialogView(lv, "info", qt_("Info"))
42 {
43         setupUi(this);
44 }
45
46
47 void GuiInfo::on_closePB_clicked()
48 {
49         hide();
50 }
51
52
53 InsetInfo * GuiInfo::inset() const
54 {
55         return static_cast<InsetInfo *>(bufferview()->cursor().
56                 innerInsetOfType(INFO_CODE));
57 }
58
59
60 void GuiInfo::applyView()
61 {
62         InsetInfo * ii = inset();
63         if (!ii)
64                 return;
65         
66         // FIXME: update the inset contents
67
68         updateLabels(bufferview()->buffer());
69         bufferview()->updateMetrics();
70         bufferview()->buffer().changed();
71 }
72
73
74 void GuiInfo::updateView()
75 {
76         InsetInfo * ii = inset();
77         if (!ii) {
78                 // FIXME: A New button to create an InsetInfo at the cursor location
79                 // would be nice.
80                 enableView(false);
81                 return;
82         }
83         //FIXME: update the controls.
84 }
85
86
87 void GuiInfo::enableView(bool enable)
88 {
89         //FIXME: enable controls that need enabling.
90 }
91
92
93 void GuiInfo::dispatchParams()
94 {
95 }
96
97
98 Dialog * createGuiInfo(GuiView & lv) { return new GuiInfo(lv); }
99
100
101 } // namespace frontend
102 } // namespace lyx
103
104 #include "GuiInfo_moc.cpp"