Renamings (s/strong_stem_width/stem_width_mode/ etc.).
[ttfautohint.git] / frontend / maingui.h
blobb7e4297257f85a3c4babb3fcbd7b6cf5791d55ec
1 // maingui.h
3 // Copyright (C) 2012-2017 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 int, int,
68 int, 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 browse_reference();
85 void check_min();
86 void check_max();
87 void check_limit();
88 void check_dehint();
89 void check_no_limit();
90 void check_no_x_increase();
91 void check_default_stem_width();
92 void absolute_input();
93 void absolute_output();
94 void absolute_control();
95 void absolute_reference();
96 void set_ref_idx_box_max();
97 void check_number_set();
98 void check_family_suffix();
99 void clear_status_bar();
100 void start_timer();
101 void check_watch();
102 void watch_files();
103 void check_run();
104 void run();
106 private:
107 int hinting_range_min;
108 int hinting_range_max;
109 int hinting_limit;
110 int gray_stem_width_mode;
111 int gdi_cleartype_stem_width_mode;
112 int dw_cleartype_stem_width_mode;
113 int increase_x_height;
114 QString x_height_snapping_exceptions_string;
115 number_range* x_height_snapping_exceptions;
116 int fallback_stem_width;
117 int ignore_restrictions;
118 int windows_compatibility;
119 int adjust_subglyphs;
120 int hint_composites;
121 int no_info;
122 int detailed_info;
123 int default_script_idx;
124 int fallback_script_idx;
125 int fallback_scaling;
126 QString family_suffix;
127 int reference_index;
128 int symbol;
129 int dehint;
130 int TTFA_info;
132 const int fallback_do_scale;
133 const int fallback_do_hint;
135 int latn_script_idx;
136 int none_script_idx;
138 void create_layout(bool);
139 void create_horizontal_layout();
140 void create_vertical_layout();
142 enum CheckState {
143 DoCheck,
144 CheckNow,
145 CheckLater
148 QFileSystemWatcher* file_watcher;
149 QTimer* timer;
150 QFileInfo fileinfo_input_file;
151 QFileInfo fileinfo_control_file;
152 QFileInfo fileinfo_reference_file;
153 QDateTime datetime_input_file;
154 QDateTime datetime_control_file;
155 QDateTime datetime_reference_file;
156 CheckState check;
158 void create_connections();
159 void create_actions();
160 void create_menus();
161 void create_status_bar();
162 void set_defaults();
163 void read_settings();
164 void write_settings();
166 int check_filenames(const QString&,
167 const QString&,
168 const QString&,
169 const QString&);
170 int open_files(const QString&, FILE**,
171 const QString&, FILE**,
172 const QString&, FILE**,
173 const QString&, FILE**);
174 int handle_error(TA_Error, const unsigned char*, QString);
176 void stop_watching();
178 QMenu* file_menu;
179 QMenu* help_menu;
181 QLabel* input_label;
182 Drag_Drop_Line_Edit* input_line;
183 QPushButton* input_button;
185 QLabel* output_label;
186 Drag_Drop_Line_Edit* output_line;
187 QPushButton* output_button;
189 QLabel* control_label;
190 Drag_Drop_Line_Edit* control_line;
191 QPushButton* control_button;
193 QLabel* reference_label;
194 Drag_Drop_Line_Edit* reference_line;
195 QPushButton* reference_button;
197 QLabel* ref_idx_label;
198 QSpinBox* ref_idx_box;
200 QLabel* min_label;
201 QSpinBox* min_box;
202 QLabel* max_label;
203 QSpinBox* max_box;
205 QLabel* stem_label;
206 QCheckBox* gray_box;
207 QCheckBox* gdi_box;
208 QCheckBox* dw_box;
210 QLabel* default_label;
211 QComboBox* default_box;
212 QLabel* fallback_label;
213 QComboBox* fallback_box;
214 QComboBox* fallback_hint_or_scale_box;
216 QLabel* limit_label;
217 QString limit_label_text_with_key;
218 QString limit_label_text;
219 QSpinBox* limit_box;
220 QCheckBox* no_limit_box;
221 QString no_limit_box_text_with_key;
222 QString no_limit_box_text;
224 QLabel* x_increase_label;
225 QString x_increase_label_text_with_key;
226 QString x_increase_label_text;
227 QSpinBox* x_increase_box;
228 QCheckBox* no_x_increase_box;
229 QString no_x_increase_box_text_with_key;
230 QString no_x_increase_box_text;
232 QLabel* snapping_label;
233 Tooltip_Line_Edit* snapping_line;
234 QLabel* family_suffix_label;
235 Tooltip_Line_Edit* family_suffix_line;
237 QLabel* stem_width_label;
238 QString stem_width_label_text_with_key;
239 QString stem_width_label_text;
240 QSpinBox* stem_width_box;
241 QCheckBox* default_stem_width_box;
242 QString default_stem_width_box_text_with_key;
243 QString default_stem_width_box_text;
245 QCheckBox* wincomp_box;
246 QCheckBox* adjust_box;
247 QCheckBox* hint_box;
248 QCheckBox* symbol_box;
249 QCheckBox* dehint_box;
250 QLabel* info_label;
251 QComboBox* info_box;
252 QCheckBox* TTFA_box;
254 QCheckBox* watch_box;
255 QPushButton* run_button;
257 QAction* exit_act;
258 QAction* about_act;
259 QAction* about_Qt_act;
261 QLocale* locale;
264 #endif // MAINGUI_H_
266 // end of maingui.h