1 // Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
2 //
3 // Permission to use, copy, modify, and distribute this software for any
4 // purpose with or without fee is hereby granted, provided that the above
5 // copyright notice and this permission notice appear in all copies.
6 //
7 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 //
15 // Aegisub Project http://www.aegisub.org/
16 
17 #include <libaegisub/signal.h>
18 
19 #include <memory>
20 #include <wx/dialog.h>
21 
22 class AssDialogue;
23 class PersistLocation;
24 class wxActivateEvent;
25 class wxButton;
26 class wxCheckBox;
27 class wxCommandEvent;
28 class wxKeyEvent;
29 class wxListBox;
30 class wxTextCtrl;
31 namespace agi { struct Context; }
32 
33 class DialogStyling final : public wxDialog {
34 	agi::Context *c;
35 	agi::signal::Connection active_line_connection;
36 
37 	wxButton *play_audio;
38 	wxButton *play_video;
39 	wxCheckBox *auto_seek;
40 	wxListBox *style_list;
41 	wxTextCtrl *current_line_text;
42 	wxTextCtrl *style_name;
43 
44 	void OnActivate(wxActivateEvent &evt);
45 	void OnKeyDown(wxKeyEvent &evt);
46 	void OnCharHook(wxKeyEvent &evt);
47 	void OnListClicked(wxCommandEvent &evt);
48 	void OnListDoubleClicked(wxCommandEvent &evt);
49 	void OnPlayAudioButton(wxCommandEvent &evt);
50 	void OnPlayVideoButton(wxCommandEvent &evt);
51 	void OnStyleBoxModified(wxCommandEvent &evt);
52 
53 	void OnActiveLineChanged(AssDialogue *);
54 
55 	AssDialogue *active_line = nullptr;
56 
57 	std::unique_ptr<PersistLocation> persist;
58 
59 public:
60 	void Commit(bool next);
61 
62 	DialogStyling(agi::Context *context);
63 	~DialogStyling();
64 };
65