]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiGraphics.h
next one
[lyx.git] / src / frontends / qt4 / GuiGraphics.h
1 // -*- C++ -*-
2 /**
3  * \file GuiGraphics.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Herbert Voß
9  * \author Baruch Even
10  * \author Angus Leeming
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef GUIGRAPHICS_H
16 #define GUIGRAPHICS_H
17
18 #include "GuiDialog.h"
19 #include "ui_GraphicsUi.h"
20
21 #include "support/docstring.h"
22 #include "insets/InsetGraphics.h"
23
24 #include <utility>
25 #include <vector>
26
27 class QString;
28
29 namespace lyx {
30
31 class InsetGraphics;
32 class InsetGraphicsParams;
33
34 namespace frontend {
35
36 class LyXView;
37
38 class GuiGraphics : public GuiDialog, public Ui::GraphicsUi, public Controller
39 {
40         Q_OBJECT
41
42 public:
43         GuiGraphics(LyXView & lv);
44         void setAutoText();
45
46 private Q_SLOTS:
47         void change_adaptor();
48         void change_bb();
49         void on_browsePB_clicked();
50         void on_getPB_clicked();
51         void on_editPB_clicked();
52         void on_filename_textChanged(const QString &);
53         void on_scaleCB_toggled(bool);
54         void on_WidthCB_toggled(bool);
55         void on_HeightCB_toggled(bool);
56         void on_angle_textChanged(const QString &);
57
58 private:
59         void closeEvent(QCloseEvent * e);
60         /// parent controller
61         Controller & controller() { return *this; }
62         bool isValid();
63         /// Apply changes
64         void applyView();
65         /// update
66         void updateContents();
67         /// get bounding box from file
68         void getBB();
69
70         /// Store the LaTeX names for the rotation origins.
71         std::vector<std::string> origin_ltx;
72         ///
73         bool initialiseParams(std::string const & data);
74         /// clean-up on hide.
75         void clearParams();
76         /// clean-up on hide.
77         void dispatchParams();
78         ///
79         bool isBufferDependent() const { return true; }
80
81         /// Browse for a file
82         docstring const browse(docstring const &) const;
83         /// Read the Bounding Box from a eps or ps-file
84         std::string const readBB(std::string const & file);
85         /// Control the bb
86         bool bbChanged;
87         /// test if file exist
88         bool isFilenameValid(std::string const & fname) const;
89         /// edit file
90         void editGraphics();
91
92 private:
93         ///
94         InsetGraphicsParams params_;
95 };
96
97
98 /// get the units for the bounding box
99 std::vector<std::string> const getBBUnits();
100
101 /// The (tranlated) GUI std::string and it's LaTeX equivalent.
102 typedef std::pair<docstring, std::string> RotationOriginPair;
103 ///
104 std::vector<RotationOriginPair> getRotationOriginData();
105
106 } // namespace frontend
107 } // namespace lyx
108
109 #endif // GUIGRAPHICS_H