RIP, Vernon...
[ttfautohint.git] / frontend / maingui.h
blob050d9c01247cc0636ab16cb59f482661ccc22266
1 // maingui.h
3 // Copyright (C) 2012-2016 by Werner Lemberg.
4 //
5 // This file is part of the ttfautohint library, and may only be used,
6 // modified, and distributed under the terms given in `COPYING'. By
7 // continuing to use, modify, or distribute this file you indicate that you
8 // have read `COPYING' and understand and accept it fully.
9 //
10 // The file `COPYING' mentioned in the previous paragraph is distributed
11 // with the ttfautohint library.
14 #ifndef MAINGUI_H_
15 #define MAINGUI_H_
17 #include <config.h>
19 #include <QAction>
20 #include <QCheckBox>
21 #include <QComboBox>
22 #include <QCompleter>
23 #include <QDateTime>
24 #include <QDesktopWidget>
25 #include <QFileDialog>
26 #include <QFileSystemModel>
27 #include <QFileSystemWatcher>
28 #include <QGridLayout>
29 #include <QLabel>
30 #include <QMainWindow>
31 #include <QMenuBar>
32 #include <QMessageBox>
33 #include <QProgressDialog>
34 #include <QPushButton>
35 #include <QSpinBox>
36 #include <QStatusBar>
38 #include "ddlineedit.h"
39 #include "ttlineedit.h"
41 #include <stdio.h>
42 #include <ttfautohint.h>
43 #include <numberset.h>
45 class QAction;
46 class QButtonGroup;
47 class QCheckBox;
48 class QComboBox;
49 class QFile;
50 class QLabel;
51 class QLocale;
52 class QMenu;
53 class QPushButton;
54 class QSpinBox;
56 class Drag_Drop_Line_Edit;
57 class Tooltip_Line_Edit;
59 class Main_GUI
60 : public QMainWindow
62 Q_OBJECT
64 public:
65 Main_GUI(bool,
66 int, int, int,
67 bool, bool,
68 bool, int,
69 const char*, int,
70 bool, bool, bool,
71 bool, bool, bool,
72 const char*, const char*, bool,
73 const char*, bool, bool, bool);
74 ~Main_GUI();
76 protected:
77 void closeEvent(QCloseEvent*);
79 private slots:
80 void about();
81 void browse_input();
82 void browse_output();
83 void browse_control();
84 void check_min();
85 void check_max();
86 void check_limit();
87 void check_dehint();
88 void check_no_limit();
89 void check_no_x_increase();
90 void check_default_stem_width();
91 void absolute_input();
92 void absolute_output();
93 void absolute_control();
94 void check_number_set();
95 void check_family_suffix();
96 void clear_status_bar();
97 void start_timer();
98 void check_watch();
99 void watch_files();
100 void check_run();
101 void run();
103 private:
104 int hinting_range_min;
105 int hinting_range_max;
106 int hinting_limit;
107 int gray_strong_stem_width;
108 int gdi_cleartype_strong_stem_width;
109 int dw_cleartype_strong_stem_width;
110 int increase_x_height;
111 QString x_height_snapping_exceptions_string;
112 number_range* x_height_snapping_exceptions;
113 int fallback_stem_width;
114 int ignore_restrictions;
115 int windows_compatibility;
116 int adjust_subglyphs;
117 int hint_composites;
118 int no_info;
119 int detailed_info;
120 int default_script_idx;
121 int fallback_script_idx;
122 int fallback_scaling;
123 QString family_suffix;
124 int symbol;
125 int dehint;
126 int TTFA_info;
128 const int fallback_do_scale;
129 const int fallback_do_hint;
131 int latn_script_idx;
132 int none_script_idx;
134 void create_layout(bool);
135 void create_horizontal_layout();
136 void create_vertical_layout();
138 enum CheckState {
139 DoCheck,
140 CheckNow,
141 CheckLater
144 QFileSystemWatcher* file_watcher;
145 QTimer* timer;
146 QFileInfo fileinfo_input_file;
147 QFileInfo fileinfo_control_file;
148 QDateTime datetime_input_file;
149 QDateTime datetime_control_file;
150 CheckState check;
152 void create_connections();
153 void create_actions();
154 void create_menus();
155 void create_status_bar();
156 void set_defaults();
157 void read_settings();
158 void write_settings();
160 int check_filenames(const QString&,
161 const QString&,
162 const QString&);
163 int open_files(const QString&, FILE**,
164 const QString&, FILE**,
165 const QString&, FILE**);
166 int handle_error(TA_Error, const unsigned char*, QString);
168 void stop_watching();
170 QMenu* file_menu;
171 QMenu* help_menu;
173 QLabel* input_label;
174 Drag_Drop_Line_Edit* input_line;
175 QPushButton* input_button;
177 QLabel* output_label;
178 Drag_Drop_Line_Edit* output_line;
179 QPushButton* output_button;
181 QLabel* control_label;
182 Drag_Drop_Line_Edit* control_line;
183 QPushButton* control_button;
185 QLabel* min_label;
186 QSpinBox* min_box;
187 QLabel* max_label;
188 QSpinBox* max_box;
190 QLabel* stem_label;
191 QCheckBox* gray_box;
192 QCheckBox* gdi_box;
193 QCheckBox* dw_box;
195 QLabel* default_label;
196 QComboBox* default_box;
197 QLabel* fallback_label;
198 QComboBox* fallback_box;
199 QComboBox* fallback_hint_or_scale_box;
201 QLabel* limit_label;
202 QString limit_label_text_with_key;
203 QString limit_label_text;
204 QSpinBox* limit_box;
205 QCheckBox* no_limit_box;
206 QString no_limit_box_text_with_key;
207 QString no_limit_box_text;
209 QLabel* x_increase_label;
210 QString x_increase_label_text_with_key;
211 QString x_increase_label_text;
212 QSpinBox* x_increase_box;
213 QCheckBox* no_x_increase_box;
214 QString no_x_increase_box_text_with_key;
215 QString no_x_increase_box_text;
217 QLabel* snapping_label;
218 Tooltip_Line_Edit* snapping_line;
219 QLabel* family_suffix_label;
220 Tooltip_Line_Edit* family_suffix_line;
222 QLabel* stem_width_label;
223 QString stem_width_label_text_with_key;
224 QString stem_width_label_text;
225 QSpinBox* stem_width_box;
226 QCheckBox* default_stem_width_box;
227 QString default_stem_width_box_text_with_key;
228 QString default_stem_width_box_text;
230 QCheckBox* wincomp_box;
231 QCheckBox* adjust_box;
232 QCheckBox* hint_box;
233 QCheckBox* symbol_box;
234 QCheckBox* dehint_box;
235 QLabel* info_label;
236 QComboBox* info_box;
237 QCheckBox* TTFA_box;
239 QCheckBox* watch_box;
240 QPushButton* run_button;
242 QAction* exit_act;
243 QAction* about_act;
244 QAction* about_Qt_act;
246 QLocale* locale;
249 #endif // MAINGUI_H_
251 // end of maingui.h