]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/GuiInclude.h
Fix up 'Reduce metrics updates from 4 to 1 when loading file'
[lyx.git] / src / frontends / qt / GuiInclude.h
1 // -*- C++ -*-
2 /**
3  * \file GuiInclude.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author Angus Leeming
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUIINCLUDE_H
15 #define GUIINCLUDE_H
16
17 #include "GuiDialog.h"
18 #include "ui_IncludeUi.h"
19
20 #include "insets/InsetCommandParams.h"
21
22
23 namespace lyx {
24 namespace frontend {
25
26 class GuiInclude : public GuiDialog, public Ui::IncludeUi
27 {
28         Q_OBJECT
29
30 public:
31         GuiInclude(GuiView & lv);
32
33 private Q_SLOTS:
34         void change_adaptor();
35         /// edit the child document, .lyx file will be opened in lyx
36         /// other formats will be edited by external applications.
37         void edit();
38         /// browse for a file
39         void browse();
40         ///
41         void typeChanged(int v);
42         /// AFAIK, QValidator only works for QLineEdit so
43         /// I have to validate listingsED (QTextEdit) manually.
44         /// This function displays a hint or error message returned by
45         /// validate_listings_params
46         void setListingsMsg();
47
48 private:
49         ///
50         bool initialiseParams(std::string const & sdata) override;
51         ///
52         void paramsToDialog(InsetCommandParams const & icp);
53         /// clean-up on hide.
54         void clearParams() override { params_.clear(); }
55         /// clean-up on hide.
56         void dispatchParams() override;
57         ///
58         bool isBufferDependent() const override { return true; }
59
60         ///
61         enum Type {
62                 ///
63                 INPUT,
64                 ///
65                 VERBATIM,
66                 ///
67                 INCLUDE,
68                 ///
69                 LISTINGS
70         };
71         ///
72         void updateLists();
73         /// validate listings parameters and return an error message, if any
74         docstring validate_listings_params();
75         ///
76         bool isValid() override;
77         /// Apply changes
78         void applyView() override;
79         /// update
80         void updateContents() override {}
81         /// Browse for a file
82         QString browse(QString const &, Type);
83
84 private:
85         ///
86         InsetCommandParams params_;
87 };
88
89 } // namespace frontend
90 } // namespace lyx
91
92 #endif // GUIINCLUDE_H