]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiGraphics.h
Create new graphics from within LyX choosing a sample file to copy from.
[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 "insets/InsetGraphicsParams.h"
22
23 #include <vector>
24
25 class QString;
26
27 namespace lyx {
28
29 namespace frontend {
30
31 class GuiGraphics : public GuiDialog, public Ui::GraphicsUi
32 {
33         Q_OBJECT
34
35 public:
36         GuiGraphics(GuiView & lv);
37         void setAutoText();
38
39 private Q_SLOTS:
40         void change_adaptor();
41         void changeGroup(int);
42         void changeBB();
43         void on_newGroupPB_clicked();
44         void on_browsePB_clicked();
45         void on_getPB_clicked();
46         void on_editPB_clicked();
47         void on_chooseSamplePB_clicked();
48         void on_okPB_clicked();
49         void on_scaleCB_toggled(bool);
50         void on_WidthCB_toggled(bool);
51         void on_HeightCB_toggled(bool);
52         void updateAspectRatioStatus();
53         void on_aspectratio_toggled(bool);
54         void on_angle_textChanged(const QString &);
55
56 private:
57         ///
58         bool isValid();
59         /// Dialog inherited methods
60         //@{
61         void applyView();
62         void updateContents() {}
63         bool initialiseParams(std::string const & data);
64         void clearParams();
65         void dispatchParams();
66         bool isBufferDependent() const { return true; }
67         //@}
68
69         ///
70         void paramsToDialog(InsetGraphicsParams const & params);
71
72         /// get bounding box from file
73         void getBB();
74         /// Browse for a file
75         QString browse(QString const &) const;
76         /// Read the Bounding Box from a eps or ps-file
77         std::string readBoundingBox(std::string const & file);
78         /// test if file exist
79         bool isFileNameValid(std::string const & fname) const;
80         /// Check if file exists, if not, ask whether ok to continue
81         bool checkFileExists();
82
83         /// Control the bb
84         bool bbChanged;
85         /// Store the LaTeX names for the rotation origins.
86         std::vector<std::string> origin_ltx;
87         ///
88         InsetGraphicsParams params_;
89         /// the current graphics group
90         std::string current_group_;
91 };
92
93 } // namespace frontend
94 } // namespace lyx
95
96 #endif // GUIGRAPHICS_H