]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiGraphics.h
PrefShortcuts: ShortcutEdit, adapted from Edwin's patch
[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
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         bool isValid();
61         /// Apply changes
62         void applyView();
63         /// update
64         void updateContents();
65         /// get bounding box from file
66         void getBB();
67
68         /// Store the LaTeX names for the rotation origins.
69         std::vector<std::string> origin_ltx;
70         ///
71         bool initialiseParams(std::string const & data);
72         /// clean-up on hide.
73         void clearParams();
74         /// clean-up on hide.
75         void dispatchParams();
76         ///
77         bool isBufferDependent() const { return true; }
78
79         /// Browse for a file
80         docstring const browse(docstring const &) const;
81         /// Read the Bounding Box from a eps or ps-file
82         std::string const readBB(std::string const & file);
83         /// Control the bb
84         bool bbChanged;
85         /// test if file exist
86         bool isFilenameValid(std::string const & fname) const;
87         /// edit file
88         void editGraphics();
89
90 private:
91         ///
92         InsetGraphicsParams params_;
93 };
94
95
96 /// get the units for the bounding box
97 std::vector<std::string> const getBBUnits();
98
99 /// The (tranlated) GUI std::string and it's LaTeX equivalent.
100 typedef std::pair<docstring, std::string> RotationOriginPair;
101 ///
102 std::vector<RotationOriginPair> getRotationOriginData();
103
104 } // namespace frontend
105 } // namespace lyx
106
107 #endif // GUIGRAPHICS_H