Don't show an error when cancelling subtitle analysis.
[dcpomatic.git] / src / wx / text_panel.h
1 /*
2     Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21
22 #include "content_sub_panel.h"
23 #include "wx_ptr.h"
24
25
26 class CheckBox;
27 class wxSpinCtrl;
28 class LanguageTagWidget;
29 class TextView;
30 class FontsDialog;
31 class SpinCtrl;
32 class SubtitleAnalysis;
33
34
35 class TextPanel : public ContentSubPanel
36 {
37 public:
38         TextPanel (ContentPanel *, TextType t);
39
40         void create () override;
41         void film_changed (Film::Property) override;
42         void film_content_changed (int) override;
43         void content_selection_changed () override;
44
45 private:
46         void use_toggled ();
47         void type_changed ();
48         void burn_toggled ();
49         void x_offset_changed ();
50         void y_offset_changed ();
51         void x_scale_changed ();
52         void y_scale_changed ();
53         void line_spacing_changed ();
54         void dcp_track_changed ();
55         void stream_changed ();
56         void text_view_clicked ();
57         void fonts_dialog_clicked ();
58         void reference_clicked ();
59         void appearance_dialog_clicked ();
60         void outline_subtitles_changed ();
61         TextType current_type () const;
62         void update_dcp_tracks ();
63         void update_dcp_track_selection ();
64         void add_to_grid () override;
65         void try_to_load_analysis ();
66         void analysis_finished(Job::Result result);
67         void language_changed ();
68         void language_is_additional_changed ();
69
70         void setup_sensitivity ();
71         void setup_visibility ();
72
73         void update_outline_subtitles_in_viewer ();
74         void clear_outline_subtitles ();
75
76         CheckBox* _reference;
77         wxStaticText* _reference_note;
78         CheckBox* _outline_subtitles = nullptr;
79         CheckBox* _use;
80         wxChoice* _type;
81         CheckBox* _burn;
82         wxStaticText* _offset_label;
83         wxStaticText* _x_offset_label;
84         wxStaticText* _x_offset_pc_label;
85         wxStaticText* _y_offset_label;
86         wxStaticText* _y_offset_pc_label;
87         SpinCtrl* _x_offset;
88         SpinCtrl* _y_offset;
89         wxStaticText* _scale_label;
90         wxStaticText* _x_scale_label;
91         wxStaticText* _x_scale_pc_label;
92         wxStaticText* _y_scale_label;
93         wxStaticText* _y_scale_pc_label;
94         SpinCtrl* _x_scale;
95         SpinCtrl* _y_scale;
96         wxStaticText* _line_spacing_label;
97         wxStaticText* _line_spacing_pc_label;
98         SpinCtrl* _line_spacing;
99         wxStaticText* _dcp_track_label = nullptr;
100         wxChoice* _dcp_track = nullptr;
101         wxStaticText* _stream_label;
102         wxChoice* _stream;
103         wxButton* _text_view_button;
104         wx_ptr<TextView> _text_view;
105         wxButton* _fonts_dialog_button;
106         wx_ptr<FontsDialog> _fonts_dialog;
107         wxButton* _appearance_dialog_button;
108         TextType _original_type;
109         wxStaticText* _language_label = nullptr;
110         LanguageTagWidget* _language = nullptr;
111         wxSizer* _language_sizer = nullptr;
112         wxChoice* _language_type = nullptr;
113
114         int _outline_subtitles_row;
115         int _ccap_track_or_language_row;
116
117         std::weak_ptr<Content> _analysis_content;
118         boost::signals2::scoped_connection _analysis_finished_connection;
119         std::shared_ptr<SubtitleAnalysis> _analysis;
120         bool _loading_analysis = false;
121 };