]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GExternal.h
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / gtk / GExternal.h
1 // -*- C++ -*-
2 /**
3  * \file GExternal.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Bernhard Reiter
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GEXTERNAL_H
13 #define GEXTERNAL_H
14
15 #include "GViewBase.h"
16
17 #include "GtkLengthEntry.h"
18
19 #include "insets/ExternalTemplate.h"
20 #include "insets/insetexternal.h"
21
22
23 namespace lyx {
24 namespace frontend {
25
26
27 class ControlExternal;
28
29 /** This class provides a GTK+ implementation of the External Dialog.
30  */
31 class GExternal : public GViewCB<ControlExternal, GViewGladeB> {
32 public:
33         GExternal(Dialog & parent);
34 private:
35         virtual void apply();
36         virtual void doBuild();
37         virtual void update();
38
39         /** Called if a different template is selected from the templates combo
40             Updates the dialog widgets accordingly
41         */
42         void update_template();
43
44         /** Called if the "Get from file" button in the Crop tab is pressed
45             Inserts bounding box coordinates from file into coordinate entries
46         */
47         void get_bb();
48
49         /** Checks if the Aspect Ratio CheckButton is to be activated
50             True if widthlength_'s unit is not Scale% and both widthlength and
51             heightlength_ are nonzero
52         */
53         bool activate_ar() const;
54
55         /** Calls controller().bbChanged() providing it with new coordinates
56             if they any of them were changed
57         */
58         void bb_changed();
59
60         /** Calls controller().editExternal() if corresponding button is 
61             clicked
62         */
63         void edit_clicked();
64
65         /** Sets Aspect Ratio CheckButton and Height Length sensitive or greys
66             them out depending on widthlength_'s and heightlength_'s status
67             Called if either widthlength_ or heightlength_ were changed
68         */
69         void size_changed();
70
71         /// enables the apply button
72         void template_changed();
73
74         /** Sets sensitivity of the LyxView tab's other widgets depending und 
75             the 'Show in LyX' CheckButton
76         */
77         void showcheck_toggled();
78
79
80         /** Sets sensitivity of the Crop tab's other widgets depending und 
81             the 'Clip to bounding box' CheckButton
82         */
83         void clipcheck_toggled();
84
85         /** Sets sensitivity of the 'Edit file' and 
86             'Get [bounding box] from file' buttons if there was a file selected
87         */
88         void file_changed();
89
90         /// Holds the currently selected template
91         Gtk::TreeModel::iterator currenttemplate_;
92
93
94         //  Widgets & couple of corresponding models
95
96         Gtk::Button * cancelbutton_;
97         Gtk::Button * okbutton_;
98         Gtk::Button * applybutton_;
99
100         Glib::RefPtr<Gtk::ListStore> templatestore_;
101         Gtk::ComboBox * templatecombo_;
102
103         Glib::RefPtr<Gtk::TextBuffer> templatebuffer_;          
104         Gtk::TextView * templateview_;
105
106         Gtk::Notebook * notebook_;
107
108         // *** Start "File" Page ***
109         Gtk::Label * filelabel_;
110         Gtk::FileChooserButton * templatefcbutton_; //requires gtkmm>=2.6
111         Gtk::Button * editfilebutton_;
112         Gtk::CheckButton * draftcheck_;
113         // *** End "File" Page ***
114
115         // *** Start "LyX View" Page ***
116         Gtk::CheckButton * showcheck_;
117         Gtk::Label * displaylabel_;
118         Glib::RefPtr<Gtk::ListStore> displaystore_;
119         Gtk::ComboBox * displaycombo_;
120         Gtk::Label * scalelabel_;
121         GtkLengthEntry * scalelength_;
122         Gtk::ComboBoxText * scalecombo_;
123         Gtk::SpinButton * scalespin_;
124         Gtk::Label * percentlabel_;
125         // *** End "LyX View" Page ***
126
127         // *** Start "Rotate" Page ***
128         Gtk::Entry * angleentry_;
129         Gtk::Label * originlabel_;
130         Gtk::ComboBoxText origincombo_;
131         // *** End "Rotate" Page ***
132
133         // *** Start "Scale" Page ***
134         Gtk::CheckButton * archeck_;
135         Gtk::Label * widthlabel_;
136         GtkLengthEntry * widthlength_;
137         Gtk::Label * heightlabel_;
138         GtkLengthEntry * heightlength_;
139
140         Gtk::ComboBoxText * widthcombo_;
141         // *** End "Scale" Page ***
142
143         // *** Start "Crop" Page ***
144         Gtk::CheckButton * clipcheck_;
145         Gtk::Button * bbfromfilebutton_;
146
147         Gtk::Label * xlabel_;
148         Gtk::Label * ylabel_;
149         Gtk::Label * rtlabel_;
150         Gtk::Label * lblabel_;
151
152         Gtk::Entry * xlentry_;
153         Gtk::Entry * ybentry_;
154         Gtk::Entry * xrentry_;
155         Gtk::Entry * ytentry_;
156         // *** End "Crop" Page ***
157
158         // *** Start "Options" Page ***
159         Glib::RefPtr<Gtk::ListStore> formatstore_;
160         Gtk::TreeView * optionsview_;
161         // *** End "Options" Page ***
162
163 };
164
165 } // namespace frontend
166 } // namespace lyx
167
168 #endif // GEXTERNAL_H