]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiInfo.cpp
00bb882a14ad6f9939e0b75166ecc1d503165ebd
[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         Inset * ins = bufferview()->cursor().innerInsetOfType(INFO_CODE);
56         if (!ins)
57                 ins = bufferview()->cursor().nextInset();
58         if (ins->lyxCode() != INFO_CODE)
59                 return 0;
60         return static_cast<InsetInfo *>(ins);
61 }
62
63
64 void GuiInfo::applyView()
65 {
66         InsetInfo * ii = inset();
67         if (!ii)
68                 return;
69         
70         // FIXME: update the inset contents
71
72         updateLabels(bufferview()->buffer());
73         bufferview()->updateMetrics();
74         bufferview()->buffer().changed();
75 }
76
77
78 void GuiInfo::updateView()
79 {
80         InsetInfo * ii = inset();
81         if (!ii) {
82                 // FIXME: A New button to create an InsetInfo at the cursor location
83                 // would be nice.
84                 enableView(false);
85                 return;
86         }
87         //FIXME: update the controls.
88 }
89
90
91 void GuiInfo::enableView(bool enable)
92 {
93         //FIXME: enable controls that need enabling.
94 }
95
96
97 void GuiInfo::dispatchParams()
98 {
99 }
100
101
102 Dialog * createGuiInfo(GuiView & lv) { return new GuiInfo(lv); }
103
104
105 } // namespace frontend
106 } // namespace lyx
107
108 #include "GuiInfo_moc.cpp"