diff --git a/build/Aegisub/Aegisub.vcxproj b/build/Aegisub/Aegisub.vcxproj index 7d6b05077..d65900d02 100644 --- a/build/Aegisub/Aegisub.vcxproj +++ b/build/Aegisub/Aegisub.vcxproj @@ -142,38 +142,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/build/Aegisub/Aegisub.vcxproj.filters b/build/Aegisub/Aegisub.vcxproj.filters index 75c0d3d9f..fac782817 100644 --- a/build/Aegisub/Aegisub.vcxproj.filters +++ b/build/Aegisub/Aegisub.vcxproj.filters @@ -219,18 +219,6 @@ Audio - - Features\Attachments - - - Video\UI - - - Video\UI - - - Features\Style editor - Features\Style editor @@ -240,18 +228,9 @@ Features\Font collector - - Features\Font collector - - - Video\UI - Video\UI - - Features\Export - Features\Export @@ -267,27 +246,12 @@ Automation\Lua - - Automation\UI - - - Features\Paste Over - - - Features\Shift Times - Features\Translation Assistant Features\Colour picker - - Features\Colour picker - - - Features\Karaoke copier - Video\UI @@ -324,30 +288,15 @@ Subtitle formats - - Features\Spell checker - Features\Spell checker Features\Thesaurus - - Features\Resolution resampler - - - Features\Import - - - Features\Timing post-processor - Features\Styling assistant - - Features\Update checker - Video @@ -510,36 +459,21 @@ Features\About box - - Features\About box - - - Features\Conditional select lines - Features\Search-replace - - Utilities\UI utilities - Utilities\UI utilities Utilities\UI utilities - - Utilities\Logging - Utilities\Logging Utilities - - Features\File properties - ASS @@ -591,9 +525,6 @@ Controls - - Features\Autosave - ASS @@ -618,15 +549,15 @@ Subtitle formats - - Features\Resolution resampler - Video\Providers Main UI + + Features + @@ -1192,4 +1123,4 @@ - + \ No newline at end of file diff --git a/src/colour_button.cpp b/src/colour_button.cpp index 85791098d..1e37d81c7 100644 --- a/src/colour_button.cpp +++ b/src/colour_button.cpp @@ -17,7 +17,7 @@ #include "colour_button.h" #include "compat.h" -#include "dialog_colorpicker.h" +#include "dialogs.h" #include diff --git a/src/command/app.cpp b/src/command/app.cpp index d867140b7..d6ca8f216 100644 --- a/src/command/app.cpp +++ b/src/command/app.cpp @@ -37,11 +37,9 @@ #include #include "../compat.h" -#include "../dialog_about.h" #include "../dialog_detached_video.h" -#include "../dialog_log.h" #include "../dialog_manager.h" -#include "../dialog_version_check.h" +#include "../dialogs.h" #include "../frame_main.h" #include "../include/aegisub/context.h" #include "../libresrc/libresrc.h" @@ -62,7 +60,7 @@ struct app_about final : public Command { STR_HELP("About Aegisub") void operator()(agi::Context *c) override { - AboutScreen(c->parent).ShowModal(); + ShowAboutDialog(c->parent); } }; @@ -186,7 +184,7 @@ struct app_log final : public Command { STR_HELP("View the event log") void operator()(agi::Context *c) override { - c->dialog->Show(c); + ShowLogWindow(c); } }; diff --git a/src/command/automation.cpp b/src/command/automation.cpp index 83d435bb0..fb8fe282e 100644 --- a/src/command/automation.cpp +++ b/src/command/automation.cpp @@ -32,8 +32,7 @@ #include "command.h" #include "../auto4_base.h" -#include "../dialog_automation.h" -#include "../dialog_manager.h" +#include "../dialogs.h" #include "../frame_main.h" #include "../include/aegisub/context.h" #include "../libresrc/libresrc.h" @@ -80,7 +79,7 @@ struct open_manager final : public Command { STR_HELP("Open automation manager") void operator()(agi::Context *c) override { - c->dialog->Show(c); + ShowAutomationDialog(c); } }; diff --git a/src/command/edit.cpp b/src/command/edit.cpp index 5153921d5..a78fe090d 100644 --- a/src/command/edit.cpp +++ b/src/command/edit.cpp @@ -36,9 +36,8 @@ #include "../ass_karaoke.h" #include "../ass_style.h" #include "../compat.h" -#include "../dialog_colorpicker.h" -#include "../dialog_paste_over.h" #include "../dialog_search_replace.h" +#include "../dialogs.h" #include "../include/aegisub/context.h" #include "../initial_line_state.h" #include "../libresrc/libresrc.h" @@ -138,7 +137,7 @@ void paste_lines(agi::Context *c, bool paste_over, Paster&& paste_line) { AssDialogue *paste_over(wxWindow *parent, std::vector& pasteOverOptions, AssDialogue *new_line, AssDialogue *old_line) { if (pasteOverOptions.empty()) { - if (DialogPasteOver(parent).ShowModal()) return nullptr; + if (!ShowPasteOverDialog(parent)) return nullptr; pasteOverOptions = OPT_GET("Tool/Paste Lines Over/Fields")->GetListBool(); } diff --git a/src/command/subtitle.cpp b/src/command/subtitle.cpp index b20cda562..c95590690 100644 --- a/src/command/subtitle.cpp +++ b/src/command/subtitle.cpp @@ -34,12 +34,8 @@ #include "../ass_dialogue.h" #include "../ass_file.h" #include "../compat.h" -#include "../dialog_attachments.h" -#include "../dialog_autosave.h" -#include "../dialog_manager.h" -#include "../dialog_properties.h" #include "../dialog_search_replace.h" -#include "../dialog_spellchecker.h" +#include "../dialogs.h" #include "../include/aegisub/context.h" #include "../libresrc/libresrc.h" #include "../options.h" @@ -85,7 +81,7 @@ struct subtitle_attachment final : public Command { void operator()(agi::Context *c) override { c->videoController->Stop(); - DialogAttachments(c->parent, c->ass.get()).ShowModal(); + ShowAttachmentsDialog(c->parent, c->ass.get()); } }; @@ -255,9 +251,9 @@ struct subtitle_open_autosave final : public Command { void operator()(agi::Context *c) override { if (c->subsController->TryToClose() == wxCANCEL) return; - DialogAutosave dialog(c->parent); - if (dialog.ShowModal() == wxID_OK) - c->project->LoadSubtitles(dialog.ChosenFile()); + auto file = PickAutosaveFile(c->parent); + if (!file.empty()) + c->project->LoadSubtitles(file); } }; @@ -307,7 +303,7 @@ struct subtitle_properties final : public Command { void operator()(agi::Context *c) override { c->videoController->Stop(); - DialogProperties(c).ShowModal(); + ShowPropertiesDialog(c); } }; @@ -417,7 +413,7 @@ struct subtitle_spellcheck final : public Command { void operator()(agi::Context *c) override { c->videoController->Stop(); - c->dialog->Show(c); + ShowSpellcheckerDialog(c); } }; } diff --git a/src/command/time.cpp b/src/command/time.cpp index 9ebaa16ea..da21265b0 100644 --- a/src/command/time.cpp +++ b/src/command/time.cpp @@ -36,8 +36,7 @@ #include "../async_video_provider.h" #include "../audio_controller.h" #include "../audio_timing.h" -#include "../dialog_manager.h" -#include "../dialog_shift_times.h" +#include "../dialogs.h" #include "../include/aegisub/context.h" #include "../libresrc/libresrc.h" #include "../options.h" @@ -156,7 +155,7 @@ struct time_shift final : public Command { STR_HELP("Shift subtitles by time or frames") void operator()(agi::Context *c) override { - c->dialog->Show(c); + ShowShiftTimesDialog(c); } }; diff --git a/src/command/tool.cpp b/src/command/tool.cpp index 5be716035..82ce746a3 100644 --- a/src/command/tool.cpp +++ b/src/command/tool.cpp @@ -32,16 +32,10 @@ #include "command.h" #include "../compat.h" -#include "../dialog_export.h" -#include "../dialog_fonts_collector.h" -#include "../dialog_kara_timing_copy.h" #include "../dialog_manager.h" -#include "../dialog_resample.h" -#include "../dialog_selection.h" -#include "../dialog_style_manager.h" #include "../dialog_styling_assistant.h" -#include "../dialog_timing_processor.h" #include "../dialog_translation.h" +#include "../dialogs.h" #include "../include/aegisub/context.h" #include "../libresrc/libresrc.h" #include "../options.h" @@ -79,7 +73,7 @@ struct tool_export final : public Command { void operator()(agi::Context *c) override { c->videoController->Stop(); - DialogExport(c).ShowModal(); + ShowExportDialog(c); } }; @@ -91,7 +85,7 @@ struct tool_font_collector final : public Command { STR_HELP("Open fonts collector") void operator()(agi::Context *c) override { - c->dialog->Show(c); + ShowFontsCollectorDialog(c); } }; @@ -103,7 +97,7 @@ struct tool_line_select final : public Command { STR_HELP("Select lines based on defined criteria") void operator()(agi::Context *c) override { - c->dialog->Show(c); + ShowSelectLinesDialog(c); } }; @@ -117,7 +111,7 @@ struct tool_resampleres final : public Command { void operator()(agi::Context *c) override { c->videoController->Stop(); ResampleSettings settings; - if (DialogResample(c, settings).ShowModal() == wxID_OK) + if (PromptForResampleSettings(c, settings)) ResampleResolution(c->ass.get(), settings); } }; @@ -172,7 +166,7 @@ struct tool_style_manager final : public Command { STR_HELP("Open the styles manager") void operator()(agi::Context *c) override { - c->dialog->Show(c); + ShowStyleManagerDialog(c); } }; @@ -184,7 +178,7 @@ struct tool_time_kanji final : public Command { STR_HELP("Open the Kanji timer copier") void operator()(agi::Context *c) override { - DialogKanjiTimer(c).ShowModal(); + ShowKanjiTimerDialog(c); } }; @@ -196,7 +190,7 @@ struct tool_time_postprocess final : public Command { STR_HELP("Post-process the subtitle timing to add lead-ins and lead-outs, snap timing to scene changes, etc.") void operator()(agi::Context *c) override { - DialogTimingProcessor(c).ShowModal(); + ShowTimingProcessorDialog(c); } }; diff --git a/src/command/video.cpp b/src/command/video.cpp index 48ff9d8a0..f4823ab57 100644 --- a/src/command/video.cpp +++ b/src/command/video.cpp @@ -36,10 +36,8 @@ #include "../async_video_provider.h" #include "../compat.h" #include "../dialog_detached_video.h" -#include "../dialog_dummy_video.h" -#include "../dialog_jumpto.h" #include "../dialog_manager.h" -#include "../dialog_video_details.h" +#include "../dialogs.h" #include "../frame_main.h" #include "../include/aegisub/context.h" #include "../include/aegisub/subtitles_provider.h" @@ -270,7 +268,7 @@ struct video_details final : public validator_video_loaded { void operator()(agi::Context *c) override { c->videoController->Stop(); - DialogVideoDetails(c).ShowModal(); + ShowVideoDetailsDialog(c); } }; @@ -529,7 +527,7 @@ struct video_jump final : public validator_video_loaded { void operator()(agi::Context *c) override { c->videoController->Stop(); - DialogJumpTo(c).ShowModal(); + ShowJumpToDialog(c); c->videoSlider->SetFocus(); } }; @@ -584,7 +582,7 @@ struct video_open_dummy final : public Command { STR_HELP("Open a placeholder video clip with solid color") void operator()(agi::Context *c) override { - std::string fn = DialogDummyVideo::CreateDummyVideo(c->parent); + std::string fn = CreateDummyVideo(c->parent); if (!fn.empty()) c->project->LoadVideo(fn); } diff --git a/src/dialog_about.cpp b/src/dialog_about.cpp index a8cb6dd76..75d51f0cf 100644 --- a/src/dialog_about.cpp +++ b/src/dialog_about.cpp @@ -27,12 +27,11 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_about.cpp -/// @brief About-dialogue box -/// @ingroup configuration_ui -/// +#include "libresrc/libresrc.h" +#include "version.h" #include +#include #include #include #include @@ -40,110 +39,114 @@ #include #include -#include "dialog_about.h" -#include "libresrc/libresrc.h" -#include "version.h" - -AboutScreen::AboutScreen(wxWindow *parent) -: wxDialog (parent, -1, _("About Aegisub"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX , _("About Aegisub")) -{ - // Generate library string - wxString libString = "Aegisub includes portions from the following other projects:\n"; - libString += " wxWidgets - Copyright (c) Julian Smart, Robert Roebling et al;\n"; - libString += " wxStyledTextCtrl - Copyright (c) Robin Dunn, Neil Hodgson;\n"; - libString += " Scintilla - Copyright (c) Neil Hodgson;\n"; - libString += " Boost - Copyright (c) Beman Dawes, David Abrahams et al;\n"; - libString += " UniversalCharDet - Copyright (c) Netscape Communications Corp.;\n"; - libString += " ICU - Copyright (c) International Business Machines Corp.;\n"; - libString += " Lua - Copyright (c) Lua.org, PUC-Rio;\n"; - libString += " LuaJIT - Copyright (c) Mike Pall;\n"; - libString += " luabins - Copyright (c) Alexander Gladysh;\n"; +namespace { +struct AboutScreen : wxDialog { + AboutScreen(wxWindow *parent) + : wxDialog(parent, -1, _("About Aegisub"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX, _("About Aegisub")) + { + // Generate library string + wxString libString = "Aegisub includes portions from the following other projects:\n"; + libString += " wxWidgets - Copyright (c) Julian Smart, Robert Roebling et al;\n"; + libString += " wxStyledTextCtrl - Copyright (c) Robin Dunn, Neil Hodgson;\n"; + libString += " Scintilla - Copyright (c) Neil Hodgson;\n"; + libString += " Boost - Copyright (c) Beman Dawes, David Abrahams et al;\n"; + libString += " UniversalCharDet - Copyright (c) Netscape Communications Corp.;\n"; + libString += " ICU - Copyright (c) International Business Machines Corp.;\n"; + libString += " Lua - Copyright (c) Lua.org, PUC-Rio;\n"; + libString += " LuaJIT - Copyright (c) Mike Pall;\n"; + libString += " luabins - Copyright (c) Alexander Gladysh;\n"; #ifdef WITH_HUNSPELL - libString += " Hunspell - Copyright (c) Kevin Hendricks;\n"; + libString += " Hunspell - Copyright (c) Kevin Hendricks;\n"; #endif #ifdef WITH_PORTAUDIO - libString += " PortAudio - Copyright (c) Ross Bencina, Phil Burk;\n"; + libString += " PortAudio - Copyright (c) Ross Bencina, Phil Burk;\n"; #endif #ifdef WITH_FFMS2 - libString += " FFmpeg - Copyright (c) Fabrice Bellard;\n"; - libString += " FFMS2 - Copyright (c) Fredrik Mellbin;\n"; + libString += " FFmpeg - Copyright (c) Fabrice Bellard;\n"; + libString += " FFMS2 - Copyright (c) Fredrik Mellbin;\n"; #endif #ifdef WITH_AVISYNTH - libString += " Avisynth 2.5 - Copyright (c) Ben Rudiak-Gould et al;\n"; + libString += " Avisynth 2.5 - Copyright (c) Ben Rudiak-Gould et al;\n"; #endif #ifdef WITH_CSRI - libString += " csri - Copyright (c) David Lamparter;\n"; + libString += " csri - Copyright (c) David Lamparter;\n"; # ifdef __WINDOWS__ - libString += " vsfilter - Copyright (c) Gabest et al;\n"; + libString += " vsfilter - Copyright (c) Gabest et al;\n"; # endif #endif - libString += " libass - Copyright (c) Evgeniy Stepanov, Grigori Goronzy;\n"; + libString += " libass - Copyright (c) Evgeniy Stepanov, Grigori Goronzy;\n"; #ifdef __WINDOWS__ - libString += " Matroska Parser - Copyright (c) Mike Matsnev;\n"; + libString += " Matroska Parser - Copyright (c) Mike Matsnev;\n"; #endif - libString += " Freetype - Copyright (c) David Turner, Robert Wilhelm, Werner Lemberg;\n"; - libString += " Fontconfig - Copyright (c) Keith Packard et al;\n"; + libString += " Freetype - Copyright (c) David Turner, Robert Wilhelm, Werner Lemberg;\n"; + libString += " Fontconfig - Copyright (c) Keith Packard et al;\n"; #ifdef WITH_FFTW3 - libString += " FFTW - Copyright (c) Matteo Frigo, Massachusetts Institute of Technology;\n"; + libString += " FFTW - Copyright (c) Matteo Frigo, Massachusetts Institute of Technology;\n"; #endif - wxString translatorCredit = _("Translated into LANGUAGE by PERSON\n"); - if (translatorCredit == "Translated into LANGUAGE by PERSON\n") translatorCredit.Clear(); + wxString translatorCredit = _("Translated into LANGUAGE by PERSON\n"); + if (translatorCredit == "Translated into LANGUAGE by PERSON\n") translatorCredit.Clear(); - // Generate about string - wxString aboutString; - aboutString += wxString("Aegisub ") + GetAegisubShortVersionString() + ".\n"; - aboutString += "Copyright (c) 2005-2014 Rodrigo Braz Monteiro, Niels Martin Hansen, Thomas Goyne et al.\n\n"; - aboutString += "Programmers:\n"; - aboutString += " Alysson Souza e Silva\n"; - aboutString += " Amar Takhar\n"; - aboutString += " Dan Donovan\n"; - aboutString += " Daniel Moscoviter\n"; - aboutString += " David Conrad\n"; - aboutString += " David Lamparter\n"; - aboutString += " Eric Batalitzky\n"; - aboutString += " Evgeniy Stepanov\n"; - aboutString += " Fredrik Mellbin\n"; - aboutString += " Grigori Goronzy\n"; - aboutString += " Karl Blomster\n"; - aboutString += " Mike Matsnev\n"; - aboutString += " Moritz Brunner\n"; - aboutString += " Muhammad Lukman Nasaruddin\n"; - aboutString += " Niels Martin Hansen\n"; - aboutString += " Patryk Pomykalski\n"; - aboutString += " Ravi Pinjala\n"; - aboutString += " Rodrigo Braz Monteiro\n"; - aboutString += " Simone Cociancich\n"; - aboutString += " Thomas Goyne\n"; - aboutString += "User manual written by:\n"; - aboutString += " Karl Blomster\n"; - aboutString += " Niels Martin Hansen\n"; - aboutString += " Rodrigo Braz Monteiro\n"; - aboutString += "Icons by:\n"; - aboutString += " Philip Cash\n"; - aboutString += "Additional thanks to:\n"; - aboutString += " Mentar\n"; - aboutString += " Sigurd Tao Lyngse\n"; - aboutString += " Everyone in the Aegisub IRC channel\n"; - aboutString += " Everyone who ever reported a bug\n"; - aboutString += translatorCredit; - aboutString += "\n" + libString; - aboutString += _("\nSee the help file for full credits.\n"); - aboutString += wxString::Format(_("Built by %s on %s."), GetAegisubBuildCredit(), GetAegisubBuildTime()); + // Generate about string + wxString aboutString; + aboutString += wxString("Aegisub ") + GetAegisubShortVersionString() + ".\n"; + aboutString += "Copyright (c) 2005-2014 Rodrigo Braz Monteiro, Niels Martin Hansen, Thomas Goyne et al.\n\n"; + aboutString += "Programmers:\n"; + aboutString += " Alysson Souza e Silva\n"; + aboutString += " Amar Takhar\n"; + aboutString += " Dan Donovan\n"; + aboutString += " Daniel Moscoviter\n"; + aboutString += " David Conrad\n"; + aboutString += " David Lamparter\n"; + aboutString += " Eric Batalitzky\n"; + aboutString += " Evgeniy Stepanov\n"; + aboutString += " Fredrik Mellbin\n"; + aboutString += " Grigori Goronzy\n"; + aboutString += " Karl Blomster\n"; + aboutString += " Mike Matsnev\n"; + aboutString += " Moritz Brunner\n"; + aboutString += " Muhammad Lukman Nasaruddin\n"; + aboutString += " Niels Martin Hansen\n"; + aboutString += " Patryk Pomykalski\n"; + aboutString += " Ravi Pinjala\n"; + aboutString += " Rodrigo Braz Monteiro\n"; + aboutString += " Simone Cociancich\n"; + aboutString += " Thomas Goyne\n"; + aboutString += "User manual written by:\n"; + aboutString += " Karl Blomster\n"; + aboutString += " Niels Martin Hansen\n"; + aboutString += " Rodrigo Braz Monteiro\n"; + aboutString += "Icons by:\n"; + aboutString += " Philip Cash\n"; + aboutString += "Additional thanks to:\n"; + aboutString += " Mentar\n"; + aboutString += " Sigurd Tao Lyngse\n"; + aboutString += " Everyone in the Aegisub IRC channel\n"; + aboutString += " Everyone who ever reported a bug\n"; + aboutString += translatorCredit; + aboutString += "\n" + libString; + aboutString += _("\nSee the help file for full credits.\n"); + aboutString += wxString::Format(_("Built by %s on %s."), GetAegisubBuildCredit(), GetAegisubBuildTime()); - // Replace copyright symbol - wxChar copySymbol = 0xA9; - aboutString.Replace("(c)",wxString(copySymbol)); + // Replace copyright symbol + wxChar copySymbol = 0xA9; + aboutString.Replace("(c)", wxString(copySymbol)); - wxTextCtrl *textctrl = new wxTextCtrl(this, -1, aboutString, wxDefaultPosition, wxSize(-1,200), wxTE_MULTILINE|wxTE_READONLY|wxBORDER_NONE); + wxTextCtrl *textctrl = new wxTextCtrl(this, -1, aboutString, wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE | wxTE_READONLY | wxBORDER_NONE); - wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL); - MainSizer->Add(new wxStaticBitmap(this, -1, GETIMAGE(splash)), 0, wxCENTER, 0); - MainSizer->Add(new wxStaticLine(this, wxID_ANY), 0, wxEXPAND|wxALL, 0); - MainSizer->Add(textctrl, 0, wxEXPAND|wxALL, 0); - MainSizer->Add(new wxStaticLine(this, wxID_ANY), 0, wxEXPAND|wxALL, 0); - MainSizer->Add(CreateButtonSizer(wxOK), 0, wxEXPAND|wxALL, 6); + wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL); + MainSizer->Add(new wxStaticBitmap(this, -1, GETIMAGE(splash)), 0, wxCENTER, 0); + MainSizer->Add(new wxStaticLine(this, wxID_ANY), 0, wxEXPAND | wxALL, 0); + MainSizer->Add(textctrl, 0, wxEXPAND | wxALL, 0); + MainSizer->Add(new wxStaticLine(this, wxID_ANY), 0, wxEXPAND | wxALL, 0); + MainSizer->Add(CreateButtonSizer(wxOK), 0, wxEXPAND | wxALL, 6); - SetSizerAndFit(MainSizer); - CentreOnParent(); + SetSizerAndFit(MainSizer); + CentreOnParent(); + } +}; +} + +void ShowAboutDialog(wxWindow *parent) { + AboutScreen(parent).ShowModal(); } diff --git a/src/dialog_about.h b/src/dialog_about.h deleted file mode 100644 index 751c5161e..000000000 --- a/src/dialog_about.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_about.h -/// @see dialog_about.cpp -/// @ingroup configuration_ui -/// - -#include - -/// @class AboutScreen -/// @brief About dialogue. -class AboutScreen: public wxDialog { -public: - AboutScreen(wxWindow *parent); -}; diff --git a/src/dialog_attachments.cpp b/src/dialog_attachments.cpp index ce7100a55..4e20be6cd 100644 --- a/src/dialog_attachments.cpp +++ b/src/dialog_attachments.cpp @@ -27,19 +27,6 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_attachments.cpp -/// @brief Manage files attached to the subtitle file -/// @ingroup tools_ui -/// - -#include "dialog_attachments.h" - -#include -#include -#include -#include -#include - #include "ass_attachment.h" #include "ass_file.h" #include "compat.h" @@ -48,6 +35,34 @@ #include "options.h" #include "utils.h" +#include +#include +#include +#include +#include +#include + +namespace { +class DialogAttachments final : public wxDialog { + AssFile *ass; + + wxListView *listView; + wxButton *extractButton; + wxButton *deleteButton; + + void OnAttachFont(wxCommandEvent &event); + void OnAttachGraphics(wxCommandEvent &event); + void OnExtract(wxCommandEvent &event); + void OnDelete(wxCommandEvent &event); + void OnListClick(wxListEvent &event); + + void UpdateList(); + void AttachFile(wxFileDialog &diag, wxString const& commit_msg); + +public: + DialogAttachments(wxWindow *parent, AssFile *ass); +}; + DialogAttachments::DialogAttachments(wxWindow *parent, AssFile *ass) : wxDialog(parent, -1, _("Attachment List"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) , ass(ass) @@ -182,3 +197,8 @@ void DialogAttachments::OnListClick(wxListEvent &) { extractButton->Enable(hasSel); deleteButton->Enable(hasSel); } +} + +void ShowAttachmentsDialog(wxWindow *parent, AssFile *file) { + DialogAttachments(parent, file).ShowModal(); +} diff --git a/src/dialog_attachments.h b/src/dialog_attachments.h deleted file mode 100644 index 4329a9d89..000000000 --- a/src/dialog_attachments.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2006, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_attachments.h -/// @see dialog_attachments.cpp -/// @ingroup tools_ui -/// - -class AssFile; -class wxFileDialog; -class wxListView; -class wxListEvent; - -#include - -class DialogAttachments final : public wxDialog { - AssFile *ass; - - wxListView *listView; - wxButton *extractButton; - wxButton *deleteButton; - - void OnAttachFont(wxCommandEvent &event); - void OnAttachGraphics(wxCommandEvent &event); - void OnExtract(wxCommandEvent &event); - void OnDelete(wxCommandEvent &event); - void OnListClick(wxListEvent &event); - - void UpdateList(); - void AttachFile(wxFileDialog &diag, wxString const& commit_msg); - -public: - DialogAttachments(wxWindow *parent, AssFile *ass); -}; diff --git a/src/dialog_automation.cpp b/src/dialog_automation.cpp index 2ba546868..52a877954 100644 --- a/src/dialog_automation.cpp +++ b/src/dialog_automation.cpp @@ -27,16 +27,10 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_automation.cpp -/// @brief Manage loaded Automation scripts -/// @ingroup secondary_ui -/// - -#include "dialog_automation.h" - #include "auto4_base.h" #include "compat.h" #include "command/command.h" +#include "dialog_manager.h" #include "help_button.h" #include "include/aegisub/context.h" #include "libresrc/libresrc.h" @@ -44,16 +38,71 @@ #include "main.h" #include "subtitle_format.h" +#include + #include #include +#include #include +#include #include #include #include #include #include +namespace { +/// Struct to attach a flag for global/local to scripts +struct ExtraScriptInfo { + Automation4::Script *script; + bool is_global; +}; + +class DialogAutomation final : public wxDialog { + agi::Context *context; + + /// Currently loaded scripts + std::vector script_info; + + /// File-local script manager + Automation4::ScriptManager *local_manager; + + /// Listener for external changes to the local scripts + agi::signal::Connection local_scripts_changed; + + /// Global script manager + Automation4::ScriptManager *global_manager; + + /// Listener for external changes to the global scripts + agi::signal::Connection global_scripts_changed; + + + /// List of loaded scripts + wxListView *list; + + /// Unload a local script + wxButton *remove_button; + + /// Reload a script + wxButton *reload_button; + + void RebuildList(); + void AddScript(Automation4::Script *script, bool is_global); + void SetScriptInfo(int i, Automation4::Script *script); + void UpdateDisplay(); + + void OnAdd(wxCommandEvent &); + void OnRemove(wxCommandEvent &); + void OnReload(wxCommandEvent &); + + void OnInfo(wxCommandEvent &); + void OnReloadAutoload(wxCommandEvent &); + +public: + DialogAutomation(agi::Context *context); +}; + DialogAutomation::DialogAutomation(agi::Context *c) : wxDialog(c->parent, -1, _("Automation Manager"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , context(c) @@ -261,3 +310,8 @@ void DialogAutomation::OnReloadAutoload(wxCommandEvent &) { global_manager->Reload(); } +} + +void ShowAutomationDialog(agi::Context *c) { + c->dialog->Show(c); +} diff --git a/src/dialog_automation.h b/src/dialog_automation.h deleted file mode 100644 index fc4c5fa61..000000000 --- a/src/dialog_automation.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2005, Niels Martin Hansen -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_automation.h -/// @see dialog_automation.cpp -/// @ingroup secondary_ui -/// - -#include - -#include - -#include - -namespace Automation4 { - class ScriptManager; - class AutoloadScriptManager; - class Script; -} - -namespace agi { struct Context; } - -class wxButton; -class wxListEvent; -class wxListView; - -class DialogAutomation final : public wxDialog { - agi::Context *context; - - /// Struct to attach a flag for global/local to scripts - struct ExtraScriptInfo { - Automation4::Script *script; - bool is_global; - }; - - /// Currently loaded scripts - std::vector script_info; - - /// File-local script manager - Automation4::ScriptManager *local_manager; - - /// Listener for external changes to the local scripts - agi::signal::Connection local_scripts_changed; - - /// Global script manager - Automation4::ScriptManager *global_manager; - - /// Listener for external changes to the global scripts - agi::signal::Connection global_scripts_changed; - - - /// List of loaded scripts - wxListView *list; - - /// Unload a local script - wxButton *remove_button; - - /// Reload a script - wxButton *reload_button; - - void RebuildList(); - void AddScript(Automation4::Script *script, bool is_global); - void SetScriptInfo(int i, Automation4::Script *script); - void UpdateDisplay(); - - void OnAdd(wxCommandEvent &); - void OnRemove(wxCommandEvent &); - void OnReload(wxCommandEvent &); - - void OnInfo(wxCommandEvent &); - void OnReloadAutoload(wxCommandEvent &); - -public: - DialogAutomation(agi::Context *context); -}; diff --git a/src/dialog_autosave.cpp b/src/dialog_autosave.cpp index 25df63304..5c015aebb 100644 --- a/src/dialog_autosave.cpp +++ b/src/dialog_autosave.cpp @@ -14,24 +14,51 @@ // // Aegisub Project http://www.aegisub.org/ -#include "dialog_autosave.h" - #include "compat.h" #include "libresrc/libresrc.h" #include "options.h" #include +#include #include - #include - +#include +#include #include +#include #include #include #include #include #include +#include + +namespace { +struct Version { + wxString filename; + wxDateTime date; + wxString display; +}; + +struct AutosaveFile { + wxString name; + std::vector versions; +}; + +class DialogAutosave final : public wxDialog { + std::vector files; + + wxListBox *file_list; + wxListBox *version_list; + + void Populate(std::map &files_map, std::string const& path, wxString const& filter, wxString const& name_fmt); + void OnSelectFile(wxCommandEvent&); + +public: + DialogAutosave(wxWindow *parent); + std::string ChosenFile() const; +}; DialogAutosave::DialogAutosave(wxWindow *parent) : wxDialog(parent, -1, _("Open autosave file"), wxDefaultPosition, wxSize(800, 350), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) @@ -138,3 +165,11 @@ std::string DialogAutosave::ChosenFile() const { return from_wx(files[sel_file].versions[sel_version].filename); } +} + +std::string PickAutosaveFile(wxWindow *parent) { + DialogAutosave dialog(parent); + if (dialog.ShowModal() == wxID_OK) + return dialog.ChosenFile(); + return ""; +} diff --git a/src/dialog_autosave.h b/src/dialog_autosave.h deleted file mode 100644 index 1581c9ba6..000000000 --- a/src/dialog_autosave.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2012, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -#include -#include -#include -#include - -#include -#include - -class wxListBox; - -class DialogAutosave final : public wxDialog { - struct Version { - wxString filename; - wxDateTime date; - wxString display; - }; - - struct AutosaveFile { - wxString name; - std::vector versions; - }; - - std::vector files; - - wxListBox *file_list; - wxListBox *version_list; - - void Populate(std::map &files_map, std::string const& path, wxString const& filter, wxString const& name_fmt); - void OnSelectFile(wxCommandEvent&); - -public: - DialogAutosave(wxWindow *parent); - std::string ChosenFile() const; -}; diff --git a/src/dialog_colorpicker.cpp b/src/dialog_colorpicker.cpp index 6fa680723..e5e7f2354 100644 --- a/src/dialog_colorpicker.cpp +++ b/src/dialog_colorpicker.cpp @@ -27,13 +27,6 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_colorpicker.cpp -/// @brief Custom colour-selection dialogue box -/// @ingroup tools_ui -/// - -#include "dialog_colorpicker.h" - #include "ass_style.h" #include "colorspace.h" #include "compat.h" diff --git a/src/dialog_colorpicker.h b/src/dialog_colorpicker.h deleted file mode 100644 index 1ae5f4e43..000000000 --- a/src/dialog_colorpicker.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2012, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_colorpicker.h -/// @see dialog_colorpicker.cpp -/// @ingroup tools_ui -/// - -#include - -#include - -class wxWindow; - -/// @brief Get a color from the user via a color picker dialog -/// @param parent Parent window -/// @param original Initial color to select -/// @param alpha Include controls for alpha -/// @param callback Function called whenever the selected color changes -/// @return Did the user accept the new color? -bool GetColorFromUser(wxWindow* parent, agi::Color original, bool alpha, std::function callback); diff --git a/src/dialog_dummy_video.cpp b/src/dialog_dummy_video.cpp index 0743db8b8..be56aad0d 100644 --- a/src/dialog_dummy_video.cpp +++ b/src/dialog_dummy_video.cpp @@ -14,15 +14,19 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_dummy_video.cpp -/// @brief Set up dummy video provider -/// @ingroup secondary_ui -/// +#include "ass_time.h" +#include "colour_button.h" +#include "help_button.h" +#include "libresrc/libresrc.h" +#include "options.h" +#include "validators.h" +#include "video_provider_dummy.h" -#include "dialog_dummy_video.h" +#include #include #include +#include #include #include #include @@ -32,15 +36,26 @@ #include #include -#include "ass_time.h" -#include "colour_button.h" -#include "help_button.h" -#include "libresrc/libresrc.h" -#include "options.h" -#include "validators.h" -#include "video_provider_dummy.h" - namespace { +struct DialogDummyVideo final : wxDialog { + double fps = OPT_GET("Video/Dummy/FPS")->GetDouble(); + int width = OPT_GET("Video/Dummy/Last/Width")->GetInt(); + int height = OPT_GET("Video/Dummy/Last/Height")->GetInt(); + int length = OPT_GET("Video/Dummy/Last/Length")->GetInt(); + agi::Color color = OPT_GET("Colour/Video Dummy/Last Colour")->GetColor(); + bool pattern = OPT_GET("Video/Dummy/Pattern")->GetBool(); + + wxStaticText *length_display; + wxFlexGridSizer *sizer; + + template + void AddCtrl(wxString const& label, T *ctrl); + + void OnResolutionShortcut(wxCommandEvent &evt); + void UpdateLengthDisplay(); + + DialogDummyVideo(wxWindow *parent); +}; struct ResolutionShortcut { const char *name; @@ -82,16 +97,8 @@ wxComboBox *resolution_shortcuts(wxWindow *parent, int width, int height) { return ctrl; } -} - DialogDummyVideo::DialogDummyVideo(wxWindow *parent) : wxDialog(parent, -1, _("Dummy video options")) -, fps(OPT_GET("Video/Dummy/FPS")->GetDouble()) -, width(OPT_GET("Video/Dummy/Last/Width")->GetInt()) -, height(OPT_GET("Video/Dummy/Last/Height")->GetInt()) -, length(OPT_GET("Video/Dummy/Last/Length")->GetInt()) -, color(OPT_GET("Colour/Video Dummy/Last Colour")->GetColor()) -, pattern(OPT_GET("Video/Dummy/Pattern")->GetBool()) { SetIcon(GETICON(use_dummy_video_menu_16)); @@ -154,8 +161,9 @@ void DialogDummyVideo::OnResolutionShortcut(wxCommandEvent &e) { void DialogDummyVideo::UpdateLengthDisplay() { length_display->SetLabel(wxString::Format(_("Resulting duration: %s"), AssTime(length / fps * 1000).GetAssFormated(true))); } +} -std::string DialogDummyVideo::CreateDummyVideo(wxWindow *parent) { +std::string CreateDummyVideo(wxWindow *parent) { DialogDummyVideo dlg(parent); if (dlg.ShowModal() != wxID_OK) return ""; diff --git a/src/dialog_dummy_video.h b/src/dialog_dummy_video.h deleted file mode 100644 index 7739ff788..000000000 --- a/src/dialog_dummy_video.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2012, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_dummy_video.h -/// @see dialog_dummy_video.cpp -/// @ingroup secondary_ui -/// - -#include - -#include - -class wxFlexGridSizer; -class wxStaticText; - -class DialogDummyVideo final : public wxDialog { - DialogDummyVideo(wxWindow *parent); - - double fps; - int width; - int height; - int length; - agi::Color color; - bool pattern; - - wxStaticText *length_display; - wxFlexGridSizer *sizer; - - template - void AddCtrl(wxString const& label, T *ctrl); - - void OnResolutionShortcut(wxCommandEvent &evt); - void UpdateLengthDisplay(); - -public: - static std::string CreateDummyVideo(wxWindow *parent); -}; diff --git a/src/dialog_export.cpp b/src/dialog_export.cpp index a3805d697..347ba863e 100644 --- a/src/dialog_export.cpp +++ b/src/dialog_export.cpp @@ -27,13 +27,6 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_export.cpp -/// @brief Export set-up dialogue box -/// @ingroup export -/// - -#include "dialog_export.h" - #include "ass_exporter.h" #include "ass_file.h" #include "compat.h" @@ -49,8 +42,8 @@ #include #include #include - #include +#include #include #include #include @@ -58,8 +51,39 @@ #include #include +namespace { +class DialogExport final : public wxDialog { + agi::Context *c; + + /// The export transform engine + AssExporter exporter; + + /// The description of the currently selected export filter + wxTextCtrl *filter_description; + + /// A list of all registered export filters + wxCheckListBox *filter_list; + + /// A list of available target charsets + wxChoice *charset_list; + + wxSizer *opt_sizer; + + void OnProcess(wxCommandEvent &); + void OnChange(wxCommandEvent &); + + /// Set all the checkboxes + void SetAll(bool new_value); + /// Update which options sizers are shown + void RefreshOptions(); + +public: + DialogExport(agi::Context *c); + ~DialogExport(); +}; + // Swap the items at idx and idx + 1 -static void swap(wxCheckListBox *list, int idx, int sel_dir) { +void swap(wxCheckListBox *list, int idx, int sel_dir) { if (idx < 0 || idx + 1 == (int)list->GetCount()) return; list->Freeze(); @@ -76,12 +100,12 @@ static void swap(wxCheckListBox *list, int idx, int sel_dir) { DialogExport::DialogExport(agi::Context *c) : wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX) , c(c) -, exporter(agi::make_unique(c)) +, exporter(c) { SetIcon(GETICON(export_menu_16)); SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY); - std::vector filters = exporter->GetAllFilterNames(); + std::vector filters = exporter.GetAllFilterNames(); filter_list = new wxCheckListBox(this, -1, wxDefaultPosition, wxSize(200, 100), to_wx(filters)); filter_list->Bind(wxEVT_CHECKLISTBOX, [=](wxCommandEvent&) { RefreshOptions(); }); filter_list->Bind(wxEVT_LISTBOX, &DialogExport::OnChange, this); @@ -135,7 +159,7 @@ DialogExport::DialogExport(agi::Context *c) wxSizer *horz_sizer = new wxBoxSizer(wxHORIZONTAL); opt_sizer = new wxBoxSizer(wxVERTICAL); - exporter->DrawSettings(this, opt_sizer); + exporter.DrawSettings(this, opt_sizer); horz_sizer->Add(top_sizer, wxSizerFlags().Expand().Border(wxALL & ~wxRIGHT)); horz_sizer->Add(opt_sizer, wxSizerFlags(1).Expand().Border(wxALL & ~wxLEFT)); @@ -166,13 +190,13 @@ void DialogExport::OnProcess(wxCommandEvent &) { for (size_t i = 0; i < filter_list->GetCount(); ++i) { if (filter_list->IsChecked(i)) - exporter->AddFilter(from_wx(filter_list->GetString(i))); + exporter.AddFilter(from_wx(filter_list->GetString(i))); } try { wxBusyCursor busy; c->ass->Properties.export_encoding = from_wx(charset_list->GetStringSelection()); - exporter->Export(filename, from_wx(charset_list->GetStringSelection()), this); + exporter.Export(filename, from_wx(charset_list->GetStringSelection()), this); } catch (agi::UserCancelException const&) { } @@ -198,7 +222,7 @@ void DialogExport::OnProcess(wxCommandEvent &) { void DialogExport::OnChange(wxCommandEvent &) { wxString sel = filter_list->GetStringSelection(); if (!sel.empty()) - filter_description->SetValue(to_wx(exporter->GetDescription(from_wx(sel)))); + filter_description->SetValue(to_wx(exporter.GetDescription(from_wx(sel)))); } void DialogExport::SetAll(bool new_value) { @@ -212,9 +236,14 @@ void DialogExport::SetAll(bool new_value) { void DialogExport::RefreshOptions() { for (size_t i = 0; i < filter_list->GetCount(); ++i) { - if (wxSizer *sizer = exporter->GetSettingsSizer(from_wx(filter_list->GetString(i)))) + if (wxSizer *sizer = exporter.GetSettingsSizer(from_wx(filter_list->GetString(i)))) opt_sizer->Show(sizer, filter_list->IsChecked(i), true); } Layout(); GetSizer()->Fit(this); } +} + +void ShowExportDialog(agi::Context *c) { + DialogExport(c).ShowModal(); +} diff --git a/src/dialog_export.h b/src/dialog_export.h deleted file mode 100644 index 0ce3645e4..000000000 --- a/src/dialog_export.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro, Niels Martin Hansen -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_export.h -/// @see dialog_export.cpp -/// @ingroup export -/// - -#include -#include - -class AssExporter; -namespace agi { struct Context; } -class wxCheckListBox; -class wxChoice; -class wxSizer; -class wxTextCtrl; - -class DialogExport final : public wxDialog { - agi::Context *c; - - /// The export transform engine - std::unique_ptr exporter; - - /// The description of the currently selected export filter - wxTextCtrl *filter_description; - - /// A list of all registered export filters - wxCheckListBox *filter_list; - - /// A list of available target charsets - wxChoice *charset_list; - - wxSizer *opt_sizer; - - void OnProcess(wxCommandEvent &); - void OnChange(wxCommandEvent &); - - /// Set all the checkboxes - void SetAll(bool new_value); - /// Update which options sizers are shown - void RefreshOptions(); - -public: - DialogExport(agi::Context *c); - ~DialogExport(); -}; diff --git a/src/dialog_fonts_collector.cpp b/src/dialog_fonts_collector.cpp index 3b4dffa15..059046bbf 100644 --- a/src/dialog_fonts_collector.cpp +++ b/src/dialog_fonts_collector.cpp @@ -14,18 +14,12 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_fonts_collector.cpp -/// @brief Font collector dialogue box -/// @ingroup tools_ui font_collector -/// - -#include "dialog_fonts_collector.h" - #include "font_file_lister.h" #include "font_file_lister_fontconfig.h" #include "ass_file.h" #include "compat.h" +#include "dialog_manager.h" #include "help_button.h" #include "include/aegisub/context.h" #include "libresrc/libresrc.h" @@ -41,6 +35,7 @@ #include #include +#include #include #include #include @@ -54,6 +49,31 @@ #include #include +namespace { +class DialogFontsCollector final : public wxDialog { + AssFile *subs; + + ScintillaTextCtrl *collection_log; + wxButton *close_btn; + wxButton *dest_browse_button; + wxButton *start_btn; + wxRadioBox *collection_mode; + wxStaticText *dest_label; + wxTextCtrl *dest_ctrl; + + void OnStart(wxCommandEvent &); + void OnBrowse(wxCommandEvent &); + void OnRadio(wxCommandEvent &e); + + /// Append text to log message from worker thread + void OnAddText(wxThreadEvent &event); + /// Collection complete notification from the worker thread to reenable buttons + void OnCollectionComplete(wxThreadEvent &); + +public: + DialogFontsCollector(agi::Context *c); +}; + enum FcMode { CheckFontsOnly = 0, CopyToFolder = 1, @@ -386,3 +406,8 @@ void DialogFontsCollector::OnCollectionComplete(wxThreadEvent &) { wxCommandEvent evt; OnRadio(evt); } +} + +void ShowFontsCollectorDialog(agi::Context *c) { + c->dialog->Show(c); +} diff --git a/src/dialog_fonts_collector.h b/src/dialog_fonts_collector.h deleted file mode 100644 index 72409bf87..000000000 --- a/src/dialog_fonts_collector.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_fonts_collector.h -/// @see dialog_fonts_collector.cpp -/// @ingroup tools_ui font_collector -/// - -#include - -namespace agi { struct Context; } - -class AssFile; -class ScintillaTextCtrl; -class wxButton; -class wxRadioBox; -class wxStaticText; -class wxTextCtrl; -class wxThreadEvent; - -class DialogFontsCollector final : public wxDialog { - AssFile *subs; - - ScintillaTextCtrl *collection_log; - wxButton *close_btn; - wxButton *dest_browse_button; - wxButton *start_btn; - wxRadioBox *collection_mode; - wxStaticText *dest_label; - wxTextCtrl *dest_ctrl; - - void OnStart(wxCommandEvent &); - void OnBrowse(wxCommandEvent &); - void OnRadio(wxCommandEvent &e); - - /// Append text to log message from worker thread - void OnAddText(wxThreadEvent &event); - /// Collection complete notification from the worker thread to reenable buttons - void OnCollectionComplete(wxThreadEvent &); - -public: - DialogFontsCollector(agi::Context *c); -}; diff --git a/src/dialog_jumpto.cpp b/src/dialog_jumpto.cpp index f86671cc5..6356483f0 100644 --- a/src/dialog_jumpto.cpp +++ b/src/dialog_jumpto.cpp @@ -27,13 +27,6 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_jumpto.cpp -/// @brief Dialogue box to enter a time to seek video to -/// @ingroup secondary_ui -/// - -#include "dialog_jumpto.h" - #include "ass_time.h" #include "async_video_provider.h" #include "include/aegisub/context.h" @@ -44,10 +37,31 @@ #include "video_controller.h" #include +#include #include #include #include +namespace { +class DialogJumpTo final : public wxDialog { + agi::Context *c; ///< Project context + long jumpframe; ///< Target frame to jump to + TimeEdit *JumpTime; ///< Target time edit control + wxTextCtrl *JumpFrame; ///< Target frame edit control + + /// Enter/OK button handler + void OnOK(wxCommandEvent &event); + /// Update target frame on target time changed + void OnEditTime(wxCommandEvent &event); + /// Update target time on target frame changed + void OnEditFrame(wxCommandEvent &event); + /// Dialog initializer to set default focus and selection + void OnInitDialog(wxInitDialogEvent&); + +public: + DialogJumpTo(agi::Context *c); +}; + DialogJumpTo::DialogJumpTo(agi::Context *c) : wxDialog(c->parent, -1, _("Jump to"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS) , c(c) @@ -112,3 +126,8 @@ void DialogJumpTo::OnEditFrame (wxCommandEvent &event) { JumpFrame->GetValue().ToLong(&jumpframe); JumpTime->SetTime(c->videoController->TimeAtFrame(jumpframe)); } +} + +void ShowJumpToDialog(agi::Context *c) { + DialogJumpTo(c).ShowModal(); +} diff --git a/src/dialog_jumpto.h b/src/dialog_jumpto.h deleted file mode 100644 index b4a9612ae..000000000 --- a/src/dialog_jumpto.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_jumpto.h -/// @see dialog_jumpto.cpp -/// @ingroup secondary_ui -/// - -#include - -namespace agi { struct Context; } -class TimeEdit; -class wxTextCtrl; - -class DialogJumpTo final : public wxDialog { - agi::Context *c; ///< Project context - long jumpframe; ///< Target frame to jump to - TimeEdit *JumpTime; ///< Target time edit control - wxTextCtrl *JumpFrame; ///< Target frame edit control - - /// Enter/OK button handler - void OnOK(wxCommandEvent &event); - /// Update target frame on target time changed - void OnEditTime(wxCommandEvent &event); - /// Update target time on target frame changed - void OnEditFrame(wxCommandEvent &event); - /// Dialog initializer to set default focus and selection - void OnInitDialog(wxInitDialogEvent&); - -public: - /// Constructor - /// @param c Project context - DialogJumpTo(agi::Context *c); -}; diff --git a/src/dialog_kara_timing_copy.cpp b/src/dialog_kara_timing_copy.cpp index e929f502e..0940e8a06 100644 --- a/src/dialog_kara_timing_copy.cpp +++ b/src/dialog_kara_timing_copy.cpp @@ -28,13 +28,6 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_kara_timing_copy.cpp -/// @brief Karaoke timing copier dialogue box and logic -/// @ingroup tools_ui kara_timing_copy -/// - -#include "dialog_kara_timing_copy.h" - #include "ass_dialogue.h" #include "ass_file.h" #include "ass_karaoke.h" @@ -53,10 +46,12 @@ #include #include #include - +#include +#include #include #include #include +#include #include #include #include @@ -64,6 +59,7 @@ #include #include +namespace { #define TEXT_LABEL_SOURCE _("Source: ") #define TEXT_LABEL_DEST _("Dest: ") @@ -443,6 +439,39 @@ bool KaraokeLineMatchDisplay::UndoMatch() return true; } +class DialogKanjiTimer final : public wxDialog { + AssFile *subs; + + KaraokeLineMatchDisplay *display; + + wxComboBox *SourceStyle, *DestStyle; + wxCheckBox *Interpolate; + + std::vector> LinesToChange; + + AssDialogue *currentSourceLine = nullptr; + AssDialogue *currentDestinationLine = nullptr; + + void OnClose(wxCommandEvent &event); + void OnStart(wxCommandEvent &event); + void OnLink(wxCommandEvent &event); + void OnUnlink(wxCommandEvent &event); + void OnSkipSource(wxCommandEvent &event); + void OnSkipDest(wxCommandEvent &event); + void OnGoBack(wxCommandEvent &event); + void OnAccept(wxCommandEvent &event); + void OnKeyDown(wxKeyEvent &event); + + void ResetForNewLine(); + void TryAutoMatch(); + + AssDialogue *FindNextStyleMatch(AssDialogue *search_from, const std::string &search_style); + AssDialogue *FindPrevStyleMatch(AssDialogue *search_from, const std::string &search_style); + +public: + DialogKanjiTimer(agi::Context *context); +}; + DialogKanjiTimer::DialogKanjiTimer(agi::Context *c) : wxDialog(c->parent, -1, _("Kanji timing")) , subs(c->ass.get()) @@ -685,3 +714,8 @@ AssDialogue *DialogKanjiTimer::FindPrevStyleMatch(AssDialogue *search_from, cons if (!search_from) return search_from; return find_next(EntryList::reverse_iterator(subs->iterator_to(*search_from)), subs->Events.rend(), search_style); } +} + +void ShowKanjiTimerDialog(agi::Context *c) { + DialogKanjiTimer(c).ShowModal(); +} diff --git a/src/dialog_kara_timing_copy.h b/src/dialog_kara_timing_copy.h deleted file mode 100644 index 2431944dc..000000000 --- a/src/dialog_kara_timing_copy.h +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2006-2009, Dan Donovan (Dansolo), Niels Martin Hansen -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_kara_timing_copy.h -/// @see dialog_kara_timing_copy.cpp -/// @ingroup tools_ui kara_timing_copy -/// - -#include -#include - -#include - -namespace agi { struct Context; } -class AssDialogue; -class AssFile; -class KaraokeLineMatchDisplay; -class wxComboBox; -class wxCheckBox; - -class DialogKanjiTimer final : public wxDialog { - AssFile *subs; - - KaraokeLineMatchDisplay *display; - - wxComboBox *SourceStyle, *DestStyle; - wxCheckBox *Interpolate; - - std::vector> LinesToChange; - - AssDialogue *currentSourceLine = nullptr; - AssDialogue *currentDestinationLine = nullptr; - - void OnClose(wxCommandEvent &event); - void OnStart(wxCommandEvent &event); - void OnLink(wxCommandEvent &event); - void OnUnlink(wxCommandEvent &event); - void OnSkipSource(wxCommandEvent &event); - void OnSkipDest(wxCommandEvent &event); - void OnGoBack(wxCommandEvent &event); - void OnAccept(wxCommandEvent &event); - void OnKeyDown(wxKeyEvent &event); - - void ResetForNewLine(); - void TryAutoMatch(); - - AssDialogue *FindNextStyleMatch(AssDialogue *search_from, const std::string &search_style); - AssDialogue *FindPrevStyleMatch(AssDialogue *search_from, const std::string &search_style); - -public: - DialogKanjiTimer(agi::Context *context); -}; diff --git a/src/dialog_log.cpp b/src/dialog_log.cpp index 9fc4d4582..02e3962ef 100644 --- a/src/dialog_log.cpp +++ b/src/dialog_log.cpp @@ -27,14 +27,8 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_log.cpp -/// @brief Log window. -/// @ingroup libaegisub -/// - -#include "dialog_log.h" - #include "compat.h" +#include "dialog_manager.h" #include "include/aegisub/context.h" #include @@ -44,12 +38,13 @@ #include #include #include - #include +#include #include #include #include +namespace { class EmitLog final : public agi::log::Emitter { wxTextCtrl *text_ctrl; public: @@ -93,6 +88,14 @@ public: } }; +class LogWindow : public wxDialog { + agi::log::Emitter *emit_log; + +public: + LogWindow(agi::Context *c); + ~LogWindow(); +}; + LogWindow::LogWindow(agi::Context *c) : wxDialog(c->parent, -1, _("Log window"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER) { @@ -110,3 +113,8 @@ LogWindow::LogWindow(agi::Context *c) LogWindow::~LogWindow() { agi::log::log->Unsubscribe(emit_log); } +} + +void ShowLogWindow(agi::Context *c) { + c->dialog->Show(c); +} diff --git a/src/dialog_log.h b/src/dialog_log.h deleted file mode 100644 index 896be8c70..000000000 --- a/src/dialog_log.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2010, Amar Takhar -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_log.h -/// @see dialog_log.cpp -/// @ingroup libaegisub -/// - -#include - -namespace agi { - namespace log { class Emitter; } - struct Context; -} - -class LogWindow: public wxDialog { - agi::log::Emitter *emit_log; - -public: - /// @brief Constructor - /// @param c Project context - LogWindow(agi::Context *c); - ~LogWindow(); -}; diff --git a/src/dialog_manager.h b/src/dialog_manager.h index 478596949..50f138fb4 100644 --- a/src/dialog_manager.h +++ b/src/dialog_manager.h @@ -11,17 +11,18 @@ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// +// Aegisub Project http://www.aegisub.org/ -/// @file dialog_manager.h -/// @brief Manager for dialogs -/// @ingroup utility +#include "utils.h" + +#include #include #include - #include -#include "utils.h" +namespace agi { struct Context; } /// @brief A manager for dialogs /// diff --git a/src/dialog_paste_over.cpp b/src/dialog_paste_over.cpp index 30cc6c110..f3f60df3a 100644 --- a/src/dialog_paste_over.cpp +++ b/src/dialog_paste_over.cpp @@ -27,22 +27,29 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_paste_over.cpp -/// @brief Paste Over set-up dialogue box -/// @ingroup secondary_ui -/// - -#include "dialog_paste_over.h" +#include "help_button.h" +#include "options.h" #include - #include +#include #include #include #include -#include "help_button.h" -#include "options.h" +namespace { +class DialogPasteOver final : public wxDialog { + wxCheckListBox *ListBox; + + void CheckAll(bool check); + + void OnOK(wxCommandEvent &); + void OnTimes(wxCommandEvent &); + void OnText(wxCommandEvent &); + +public: + DialogPasteOver(wxWindow *parent); +}; DialogPasteOver::DialogPasteOver(wxWindow *parent) : wxDialog(parent, -1, _("Select Fields to Paste Over")) @@ -125,3 +132,8 @@ void DialogPasteOver::CheckAll(bool check) { for (size_t i = 0; i < ListBox->GetCount(); ++i) ListBox->Check(i, check); } +} + +bool ShowPasteOverDialog(wxWindow *parent) { + return DialogPasteOver(parent).ShowModal() == wxID_OK; +} diff --git a/src/dialog_paste_over.h b/src/dialog_paste_over.h index 26d4afe34..8b88077fa 100644 --- a/src/dialog_paste_over.h +++ b/src/dialog_paste_over.h @@ -31,20 +31,3 @@ /// @see dialog_paste_over.cpp /// @ingroup secondary_ui /// - -#include - -class wxCheckListBox; - -class DialogPasteOver final : public wxDialog { - wxCheckListBox *ListBox; - - void CheckAll(bool check); - - void OnOK(wxCommandEvent &); - void OnTimes(wxCommandEvent &); - void OnText(wxCommandEvent &); - -public: - DialogPasteOver(wxWindow *parent); -}; diff --git a/src/dialog_properties.cpp b/src/dialog_properties.cpp index a59f00714..d209fb8dc 100644 --- a/src/dialog_properties.cpp +++ b/src/dialog_properties.cpp @@ -27,13 +27,6 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_properties.cpp -/// @brief Dialogue box to set subtitle meta-data -/// @ingroup secondary_ui -/// - -#include "dialog_properties.h" - #include "ass_file.h" #include "async_video_provider.h" #include "compat.h" @@ -46,14 +39,51 @@ #include #include - +#include #include #include #include +#include #include #include #include +namespace { +class DialogProperties final : public wxDialog { + agi::Context *c; ///< Project this dialog is adjusting the properties of + + /// Pairs of a script property and a text control for that property + std::vector> properties; + + // Things that effect rendering + wxComboBox *WrapStyle; ///< Wrapping style for long lines + wxTextCtrl *ResX; ///< Script x resolution + wxTextCtrl *ResY; ///< Script y resolution + wxCheckBox *ScaleBorder; ///< If script resolution != video resolution how should borders be handled + wxComboBox *YCbCrMatrix; + + /// OK button handler + void OnOK(wxCommandEvent &event); + /// Set script resolution to video resolution button + void OnSetFromVideo(wxCommandEvent &event); + /// Set a script info field + /// @param key Name of field + /// @param value New value + /// @return Did the value actually need to be changed? + int SetInfoIfDifferent(std::string const& key, std::string const& value); + + /// Add a property with label and text box for updating the property + /// @param sizer Sizer to add the label and control to + /// @param label Label text to use + /// @param property Script info property name + void AddProperty(wxSizer *sizer, wxString const& label, std::string const& property); + +public: + /// Constructor + /// @param c Project context + DialogProperties(agi::Context *c); +}; + DialogProperties::DialogProperties(agi::Context *c) : wxDialog(c->parent, -1, _("Script Properties")) , c(c) @@ -176,3 +206,8 @@ void DialogProperties::OnSetFromVideo(wxCommandEvent &) { ResX->SetValue(std::to_wstring(c->project->VideoProvider()->GetWidth())); ResY->SetValue(std::to_wstring(c->project->VideoProvider()->GetHeight())); } +} + +void ShowPropertiesDialog(agi::Context *c) { + DialogProperties(c).ShowModal(); +} diff --git a/src/dialog_properties.h b/src/dialog_properties.h deleted file mode 100644 index fd1bb1b92..000000000 --- a/src/dialog_properties.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_properties.h -/// @see dialog_properties.cpp -/// @ingroup secondary_ui -/// - -#include -#include - -class AssFile; -namespace agi { struct Context; } -class wxCheckBox; -class wxComboBox; -class wxTextCtrl; - -class DialogProperties final : public wxDialog { - agi::Context *c; ///< Project this dialog is adjusting the properties of - - /// Pairs of a script property and a text control for that property - std::vector> properties; - - // Things that effect rendering - wxComboBox *WrapStyle; ///< Wrapping style for long lines - wxTextCtrl *ResX; ///< Script x resolution - wxTextCtrl *ResY; ///< Script y resolution - wxCheckBox *ScaleBorder; ///< If script resolution != video resolution how should borders be handled - wxComboBox *YCbCrMatrix; - - /// OK button handler - void OnOK(wxCommandEvent &event); - /// Set script resolution to video resolution button - void OnSetFromVideo(wxCommandEvent &event); - /// Set a script info field - /// @param key Name of field - /// @param value New value - /// @return Did the value actually need to be changed? - int SetInfoIfDifferent(std::string const& key, std::string const& value); - - /// Add a property with label and text box for updating the property - /// @param sizer Sizer to add the label and control to - /// @param label Label text to use - /// @param property Script info property name - void AddProperty(wxSizer *sizer, wxString const& label, std::string const& property); - -public: - /// Constructor - /// @param c Project context - DialogProperties(agi::Context *c); -}; diff --git a/src/dialog_resample.cpp b/src/dialog_resample.cpp index 2b022f488..e0271d6b3 100644 --- a/src/dialog_resample.cpp +++ b/src/dialog_resample.cpp @@ -11,13 +11,8 @@ // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -/// @file dialog_resample.cpp -/// @brief Resample Resolution dialogue box and logic -/// @ingroup tools_ui -/// - -#include "dialog_resample.h" +// +// Aegisub Project http://www.aegisub.org/ #include "ass_file.h" #include "async_video_provider.h" @@ -32,12 +27,57 @@ #include #include #include +#include #include #include #include #include #include +namespace { +/// @class DialogResample +/// @brief Configuration dialog for resolution resampling +/// +/// Populate a ResampleSettings structure with data from the user +class DialogResample final : public wxDialog { + agi::Context *c; ///< Project context + + int script_w; + int script_h; + YCbCrMatrix script_mat; + int video_w = 0; + int video_h = 0; + YCbCrMatrix video_mat; + + wxSpinCtrl *source_x; + wxSpinCtrl *source_y; + wxSpinCtrl *dest_x; + wxSpinCtrl *dest_y; + wxComboBox *source_matrix; + wxComboBox *dest_matrix; + wxCheckBox *symmetrical; + wxRadioBox *ar_mode; + wxSpinCtrl *margin_ctrl[4]; + + wxButton *from_script; + wxButton *from_video; + + void SetSourceFromScript(wxCommandEvent &); + /// Set the destination resolution to the video's resolution + void SetDestFromVideo(wxCommandEvent &); + /// Symmetrical checkbox toggle handler + void OnSymmetrical(wxCommandEvent &); + /// Copy margin values over if symmetrical is enabled + void OnMarginChange(wxSpinCtrl *src, wxSpinCtrl *dst); + void UpdateButtons(); + +public: + /// Constructor + /// @param context Project context + /// @param[out] settings Settings struct to populate + DialogResample(agi::Context *context, ResampleSettings &settings); +}; + enum { LEFT = 0, RIGHT = 1, @@ -220,3 +260,8 @@ void DialogResample::OnMarginChange(wxSpinCtrl *src, wxSpinCtrl *dst) { if (symmetrical->IsChecked()) dst->SetValue(src->GetValue()); } +} + +bool PromptForResampleSettings(agi::Context *c, ResampleSettings &settings) { + return DialogResample(c, settings).ShowModal() == wxID_OK; +} diff --git a/src/dialog_resample.h b/src/dialog_resample.h deleted file mode 100644 index 74ac43164..000000000 --- a/src/dialog_resample.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2012, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -/// @file dialog_resample.h -/// @see dialog_resample.cpp -/// @ingroup tools_ui -/// - -#include - -namespace agi { struct Context; } -class AssFile; -class wxCheckBox; -class wxComboBox; -class wxRadioBox; -class wxSpinCtrl; -enum class YCbCrMatrix : int; -struct ResampleSettings; - -/// @class DialogResample -/// @brief Configuration dialog for resolution resampling -/// -/// Populate a ResampleSettings structure with data from the user -class DialogResample final : public wxDialog { - agi::Context *c; ///< Project context - - int script_w; - int script_h; - YCbCrMatrix script_mat; - int video_w = 0; - int video_h = 0; - YCbCrMatrix video_mat; - - wxSpinCtrl *source_x; - wxSpinCtrl *source_y; - wxSpinCtrl *dest_x; - wxSpinCtrl *dest_y; - wxComboBox *source_matrix; - wxComboBox *dest_matrix; - wxCheckBox *symmetrical; - wxRadioBox *ar_mode; - wxSpinCtrl *margin_ctrl[4]; - - wxButton *from_script; - wxButton *from_video; - - void SetSourceFromScript(wxCommandEvent &); - /// Set the destination resolution to the video's resolution - void SetDestFromVideo(wxCommandEvent &); - /// Symmetrical checkbox toggle handler - void OnSymmetrical(wxCommandEvent &); - /// Copy margin values over if symmetrical is enabled - void OnMarginChange(wxSpinCtrl *src, wxSpinCtrl *dst); - void UpdateButtons(); - -public: - /// Constructor - /// @param context Project context - /// @param[out] settings Settings struct to populate - DialogResample(agi::Context *context, ResampleSettings &settings); -}; diff --git a/src/dialog_selected_choices.cpp b/src/dialog_selected_choices.cpp index 5f9cef5dc..27b3b3a97 100644 --- a/src/dialog_selected_choices.cpp +++ b/src/dialog_selected_choices.cpp @@ -14,17 +14,22 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_selected_choices.cpp -/// @brief wxMultiChoiceDialog with Select All and Select None -/// @ingroup - -#include "dialog_selected_choices.h" - #include #include +#include #include #include +namespace { +/// @class SelectedChoicesDialog +/// @brief wxMultiChoiceDialog with Select All and Select None +class SelectedChoicesDialog final : public wxMultiChoiceDialog { + void SelectAll(wxCommandEvent&); + +public: + SelectedChoicesDialog(wxWindow *parent, wxString const& message, wxString const& caption, wxArrayString const& choices); +}; + SelectedChoicesDialog::SelectedChoicesDialog(wxWindow *parent, wxString const& message, wxString const& caption, wxArrayString const& choices) { Create(parent, message, caption, choices); @@ -47,6 +52,7 @@ void SelectedChoicesDialog::SelectAll(wxCommandEvent&) { std::iota(sel.begin(), sel.end(), 0); SetSelections(sel); } +} int GetSelectedChoices(wxWindow *parent, wxArrayInt& selections, wxString const& message, wxString const& caption, wxArrayString const& choices) { SelectedChoicesDialog dialog(parent, message, caption, choices); diff --git a/src/dialog_selected_choices.h b/src/dialog_selected_choices.h deleted file mode 100644 index cf46bef58..000000000 --- a/src/dialog_selected_choices.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2012, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_selected_choices.cpp -/// @brief wxMultiChoiceDialog with Select All and Select None -/// @ingroup - -#include -#include - -/// @class SelectedChoicesDialog -/// @brief wxMultiChoiceDialog with Select All and Select None -class SelectedChoicesDialog final : public wxMultiChoiceDialog { - SelectedChoicesDialog(SelectedChoicesDialog const&); - SelectedChoicesDialog& operator=(SelectedChoicesDialog const&); - - void SelectAll(wxCommandEvent&); - -public: - SelectedChoicesDialog(wxWindow *parent, wxString const& message, wxString const& caption, wxArrayString const& choices); -}; - -int GetSelectedChoices(wxWindow *parent, wxArrayInt& selections, wxString const& message, wxString const& caption, wxArrayString const& choices); diff --git a/src/dialog_selection.cpp b/src/dialog_selection.cpp index 1e8529c36..0dd29518f 100644 --- a/src/dialog_selection.cpp +++ b/src/dialog_selection.cpp @@ -14,16 +14,10 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_selection.cpp -/// @brief Select Lines dialogue box and logic -/// @ingroup secondary_ui -/// - -#include "dialog_selection.h" - #include "ass_dialogue.h" #include "ass_file.h" #include "compat.h" +#include "dialog_manager.h" #include "frame_main.h" #include "help_button.h" #include "include/aegisub/context.h" @@ -39,6 +33,7 @@ #include #include +#include #include #include #include @@ -46,6 +41,28 @@ #include namespace { +class DialogSelection final : public wxDialog { + agi::Context *con; ///< Project context + + wxTextCtrl *match_text; ///< Text to search for + wxCheckBox *case_sensitive; ///< Should the search be case-sensitive + wxCheckBox *apply_to_dialogue; ///< Select/deselect uncommented lines + wxCheckBox *apply_to_comments; ///< Select/deselect commented lines + wxRadioButton *select_unmatching_lines; ///< Select lines which don't match instead + wxRadioBox *selection_change_type; ///< What sort of action to take on the selection + wxRadioBox *dialogue_field; ///< Which dialogue field to look at + wxRadioBox *match_mode; + + void Process(wxCommandEvent&); + + /// Dialogue/Comment check handler to ensure at least one is always checked + /// @param chk The checkbox to check if both are clear + void OnDialogueCheckbox(wxCheckBox *chk); + +public: + DialogSelection(agi::Context *c); + ~DialogSelection(); +}; enum class Action { SET = 0, @@ -87,8 +104,6 @@ std::set process(std::string const& match_text, bool match_case, M return matches; } -} - DialogSelection::DialogSelection(agi::Context *c) : wxDialog (c->parent, -1, _("Select"), wxDefaultPosition, wxDefaultSize, wxCAPTION) , con(c) @@ -236,3 +251,8 @@ void DialogSelection::OnDialogueCheckbox(wxCheckBox *chk) { if(!apply_to_dialogue->IsChecked() && !apply_to_comments->GetValue()) chk->SetValue(true); } +} + +void ShowSelectLinesDialog(agi::Context *c) { + c->dialog->Show(c); +} \ No newline at end of file diff --git a/src/dialog_selection.h b/src/dialog_selection.h deleted file mode 100644 index 7389b67d9..000000000 --- a/src/dialog_selection.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2011, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_selection.h -/// @see dialog_selection.cpp -/// @ingroup secondary_ui -/// - -#include - -namespace agi { struct Context; } -class AssDialogue; -class wxCheckBox; -class wxRadioBox; -class wxRadioButton; -class wxTextCtrl; - -class DialogSelection final : public wxDialog { - agi::Context *con; ///< Project context - - wxTextCtrl *match_text; ///< Text to search for - wxCheckBox *case_sensitive; ///< Should the search be case-sensitive - wxCheckBox *apply_to_dialogue; ///< Select/deselect uncommented lines - wxCheckBox *apply_to_comments; ///< Select/deselect commented lines - wxRadioButton *select_unmatching_lines; ///< Select lines which don't match instead - wxRadioBox *selection_change_type; ///< What sort of action to take on the selection - wxRadioBox *dialogue_field; ///< Which dialogue field to look at - wxRadioBox *match_mode; - - void Process(wxCommandEvent&); - - /// Dialogue/Comment check handler to ensure at least one is always checked - /// @param chk The checkbox to check if both are clear - void OnDialogueCheckbox(wxCheckBox *chk); - -public: - DialogSelection(agi::Context *c); - ~DialogSelection(); -}; diff --git a/src/dialog_shift_times.cpp b/src/dialog_shift_times.cpp index 51edaa02d..a36b3e5b3 100644 --- a/src/dialog_shift_times.cpp +++ b/src/dialog_shift_times.cpp @@ -14,17 +14,11 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_shift_times.cpp -/// @brief Shift Times dialogue box and logic -/// @ingroup secondary_ui -/// - -#include "dialog_shift_times.h" - #include "ass_dialogue.h" #include "ass_file.h" #include "ass_time.h" #include "compat.h" +#include "dialog_manager.h" #include "include/aegisub/context.h" #include "help_button.h" #include "libresrc/libresrc.h" @@ -38,21 +32,61 @@ #include #include #include -#include +#include +#include #include #include #include #include +#include #include - +#include #include #include #include #include #include +namespace { +class DialogShiftTimes final : public wxDialog { + agi::Context *context; + + agi::fs::path history_filename; + json::Array history; + agi::vfr::Framerate fps; + agi::signal::Connection timecodes_loaded_slot; + agi::signal::Connection selected_set_changed_slot; + + TimeEdit *shift_time; + wxTextCtrl *shift_frames; + wxRadioButton *shift_by_time; + wxRadioButton *shift_by_frames; + wxRadioButton *shift_forward; + wxRadioButton *shift_backward; + wxRadioBox *selection_mode; + wxRadioBox *time_fields; + wxListBox *history_box; + + void SaveHistory(json::Array const& shifted_blocks); + void LoadHistory(); + void Process(wxCommandEvent&); + int Shift(int initial_time, int shift, bool by_time, agi::vfr::Time type); + + void OnClear(wxCommandEvent&); + void OnByTime(wxCommandEvent&); + void OnByFrames(wxCommandEvent&); + void OnHistoryClick(wxCommandEvent&); + + void OnSelectedSetChanged(); + void OnTimecodesLoaded(agi::vfr::Framerate const& new_fps); + +public: + DialogShiftTimes(agi::Context *context); + ~DialogShiftTimes(); +}; + static wxString get_history_string(json::Object &obj) { wxString filename = to_wx(obj["filename"]); if (filename.empty()) @@ -99,7 +133,6 @@ DialogShiftTimes::DialogShiftTimes(agi::Context *context) : wxDialog(context->parent, -1, _("Shift Times")) , context(context) , history_filename(config::path->Decode("?user/shift_history.json")) -, history(agi::make_unique()) , timecodes_loaded_slot(context->project->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this)) , selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this)) { @@ -234,7 +267,7 @@ void DialogShiftTimes::OnSelectedSetChanged() { void DialogShiftTimes::OnClear(wxCommandEvent &) { agi::fs::Remove(history_filename); history_box->Clear(); - history->clear(); + history.clear(); } void DialogShiftTimes::OnByTime(wxCommandEvent &) { @@ -249,9 +282,9 @@ void DialogShiftTimes::OnByFrames(wxCommandEvent &) { void DialogShiftTimes::OnHistoryClick(wxCommandEvent &evt) { size_t entry = evt.GetInt(); - if (entry >= history->size()) return; + if (entry >= history.size()) return; - json::Object& obj = (*history)[entry]; + json::Object& obj = history[entry]; if (obj["is by time"]) { shift_time->SetTime(AssTime((std::string)obj["amount"])); shift_by_time->SetValue(true); @@ -284,12 +317,12 @@ void DialogShiftTimes::SaveHistory(json::Array const& shifted_blocks) { new_entry["mode"] = selection_mode->GetSelection(); new_entry["selection"] = shifted_blocks; - history->push_front(new_entry); - if (history->size() > 50) - history->resize(50); + history.push_front(new_entry); + if (history.size() > 50) + history.resize(50); try { - json::Writer::Write(*history, agi::io::Save(history_filename).Get()); + json::Writer::Write(history, agi::io::Save(history_filename).Get()); } catch (agi::fs::FileSystemError const& e) { LOG_E("dialog_shift_times/save_history") << "Cannot save shift times history: " << e.GetChainedMessage(); @@ -304,9 +337,9 @@ void DialogShiftTimes::LoadHistory() { std::unique_ptr file(agi::io::Open(history_filename)); json::UnknownElement root; json::Reader::Read(root, *file); - *history = root; + history = root; - for (auto& history_entry : *history) + for (auto& history_entry : history) history_box->Append(get_history_string(history_entry)); } catch (agi::fs::FileSystemError const& e) { @@ -389,3 +422,8 @@ int DialogShiftTimes::Shift(int initial_time, int shift, bool by_time, agi::vfr: else return fps.TimeAtFrame(shift + fps.FrameAtTime(initial_time, type), type); } +} + +void ShowShiftTimesDialog(agi::Context *c) { + c->dialog->Show(c); +} diff --git a/src/dialog_shift_times.h b/src/dialog_shift_times.h deleted file mode 100644 index 29bc9b3d7..000000000 --- a/src/dialog_shift_times.h +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2011, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_shift_times.h -/// @see dialog_shift_times.cpp -/// @ingroup secondary_ui -/// - -#include -#include -#include - -#include -#include -#include - -#include - -class AssDialogue; -class TimeEdit; -class wxListBox; -class wxRadioBox; -class wxRadioButton; -class wxTextCtrl; -namespace agi { struct Context; } -namespace json { - class UnknownElement; - typedef std::deque Array; -} - -class DialogShiftTimes final : public wxDialog { - wxDECLARE_NO_COPY_CLASS(DialogShiftTimes); // clang + libc++ herps a derp without this - agi::Context *context; - - agi::fs::path history_filename; - std::unique_ptr history; - agi::vfr::Framerate fps; - agi::signal::Connection timecodes_loaded_slot; - agi::signal::Connection selected_set_changed_slot; - - TimeEdit *shift_time; - wxTextCtrl *shift_frames; - wxRadioButton *shift_by_time; - wxRadioButton *shift_by_frames; - wxRadioButton *shift_forward; - wxRadioButton *shift_backward; - wxRadioBox *selection_mode; - wxRadioBox *time_fields; - wxListBox *history_box; - - void SaveHistory(json::Array const& shifted_blocks); - void LoadHistory(); - void Process(wxCommandEvent&); - int Shift(int initial_time, int shift, bool by_time, agi::vfr::Time type); - - void OnClear(wxCommandEvent&); - void OnByTime(wxCommandEvent&); - void OnByFrames(wxCommandEvent&); - void OnHistoryClick(wxCommandEvent&); - - void OnSelectedSetChanged(); - void OnTimecodesLoaded(agi::vfr::Framerate const& new_fps); - -public: - DialogShiftTimes(agi::Context *context); - ~DialogShiftTimes(); -}; diff --git a/src/dialog_spellchecker.cpp b/src/dialog_spellchecker.cpp index 3f2688d20..99314fbea 100644 --- a/src/dialog_spellchecker.cpp +++ b/src/dialog_spellchecker.cpp @@ -14,16 +14,10 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_spellchecker.cpp -/// @brief Spell checker dialogue box -/// @ingroup spelling -/// - -#include "dialog_spellchecker.h" - #include "ass_dialogue.h" #include "ass_file.h" #include "compat.h" +#include "dialog_manager.h" #include "help_button.h" #include "include/aegisub/context.h" #include "include/aegisub/spellchecker.h" @@ -39,8 +33,13 @@ #include #include +#include +#include +#include +#include #include #include +#include #include #include #include @@ -48,6 +47,60 @@ #include #include +namespace { +class DialogSpellChecker final : public wxDialog { + agi::Context *context; ///< The project context + std::unique_ptr spellchecker; ///< The spellchecking engine + + /// Words which the user has indicated should always be corrected + std::map auto_replace; + + /// Words which the user has temporarily added to the dictionary + std::set auto_ignore; + + /// Dictionaries available + wxArrayString dictionary_lang_codes; + + int word_start; ///< Start index of the current misspelled word + int word_len; ///< Length of the current misspelled word + + wxTextCtrl *orig_word; ///< The word being corrected + wxTextCtrl *replace_word; ///< The replacement that will be used if "Replace" is clicked + wxListBox *suggest_list; ///< The list of suggested replacements + + wxComboBox *language; ///< The list of available languages + wxButton *add_button; ///< Add word to currently active dictionary + wxButton *remove_button; ///< Remove word from currently active dictionary + + AssDialogue *start_line = nullptr; ///< The first line checked + AssDialogue *active_line = nullptr; ///< The most recently checked line + bool has_looped = false; ///< Has the search already looped from the end to beginning? + + /// Find the next misspelled word and close the dialog if there are none + /// @return Are there any more misspelled words? + bool FindNext(); + + /// Check a single line for misspellings + /// @param active_line Line to check + /// @param start_pos Index in the line to start at + /// @param[in,out] commit_id Commit id for coalescing autoreplace commits + /// @return Was a misspelling found? + bool CheckLine(AssDialogue *active_line, int start_pos, int *commit_id); + + /// Set the current word to be corrected + void SetWord(std::string const& word); + /// Correct the currently selected word + void Replace(); + + void OnChangeLanguage(wxCommandEvent&); + void OnChangeSuggestion(wxCommandEvent&); + + void OnReplace(wxCommandEvent&); + +public: + DialogSpellChecker(agi::Context *context); +}; + DialogSpellChecker::DialogSpellChecker(agi::Context *context) : wxDialog(context->parent, -1, _("Spell Checker")) , context(context) @@ -176,9 +229,6 @@ DialogSpellChecker::DialogSpellChecker(agi::Context *context) Show(); } -DialogSpellChecker::~DialogSpellChecker() { -} - void DialogSpellChecker::OnReplace(wxCommandEvent&) { Replace(); FindNext(); @@ -310,3 +360,8 @@ void DialogSpellChecker::SetWord(std::string const& word) { add_button->Enable(spellchecker->CanAddWord(word)); } +} + +void ShowSpellcheckerDialog(agi::Context *c) { + c->dialog->Show(c); +} diff --git a/src/dialog_spellchecker.h b/src/dialog_spellchecker.h deleted file mode 100644 index f11cb67d1..000000000 --- a/src/dialog_spellchecker.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2011, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_spellchecker.h -/// @see dialog_spellchecker.cpp -/// @ingroup spelling -/// - -#include -#include -#include - -#include -#include - -namespace agi { struct Context; } -namespace agi { class SpellChecker; } -class AssDialogue; -class wxButton; -class wxCheckBox; -class wxComboBox; -class wxListBox; -class wxTextCtrl; - -class DialogSpellChecker final : public wxDialog { - agi::Context *context; ///< The project context - std::unique_ptr spellchecker; ///< The spellchecking engine - - /// Words which the user has indicated should always be corrected - std::map auto_replace; - - /// Words which the user has temporarily added to the dictionary - std::set auto_ignore; - - /// Dictionaries available - wxArrayString dictionary_lang_codes; - - int word_start; ///< Start index of the current misspelled word - int word_len; ///< Length of the current misspelled word - - wxTextCtrl *orig_word; ///< The word being corrected - wxTextCtrl *replace_word; ///< The replacement that will be used if "Replace" is clicked - wxListBox *suggest_list; ///< The list of suggested replacements - - wxComboBox *language; ///< The list of available languages - wxButton *add_button; ///< Add word to currently active dictionary - wxButton *remove_button; ///< Remove word from currently active dictionary - - AssDialogue *start_line = nullptr; ///< The first line checked - AssDialogue *active_line = nullptr; ///< The most recently checked line - bool has_looped = false; ///< Has the search already looped from the end to beginning? - - /// Find the next misspelled word and close the dialog if there are none - /// @return Are there any more misspelled words? - bool FindNext(); - - /// Check a single line for misspellings - /// @param active_line Line to check - /// @param start_pos Index in the line to start at - /// @param[in,out] commit_id Commit id for coalescing autoreplace commits - /// @return Was a misspelling found? - bool CheckLine(AssDialogue *active_line, int start_pos, int *commit_id); - - /// Set the current word to be corrected - void SetWord(std::string const& word); - /// Correct the currently selected word - void Replace(); - - void OnChangeLanguage(wxCommandEvent&); - void OnChangeSuggestion(wxCommandEvent&); - - void OnReplace(wxCommandEvent&); - -public: - DialogSpellChecker(agi::Context *context); - ~DialogSpellChecker(); -}; diff --git a/src/dialog_style_manager.cpp b/src/dialog_style_manager.cpp index 7d8068e3b..4fceb00e7 100644 --- a/src/dialog_style_manager.cpp +++ b/src/dialog_style_manager.cpp @@ -27,19 +27,15 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_style_manager.cpp -/// @brief Style Manager dialogue box and partial logic -/// @ingroup style_editor - -#include "dialog_style_manager.h" - #include "ass_dialogue.h" #include "ass_file.h" #include "ass_style.h" +#include "ass_style_storage.h" #include "charset_detect.h" #include "compat.h" -#include "dialog_selected_choices.h" +#include "dialog_manager.h" #include "dialog_style_editor.h" +#include "dialogs.h" #include "include/aegisub/context.h" #include "help_button.h" #include "libresrc/libresrc.h" @@ -52,23 +48,128 @@ #include #include +#include #include #include #include #include #include - +#include +#include +#include #include +#include +#include +#include #include #include #include +#include #include #include #include #include // Keep this last so wxUSE_CHOICEDLG is set. namespace { +class DialogStyleManager final : public wxDialog { + agi::Context *c; ///< Project context + std::unique_ptr persist; + + agi::signal::Connection commit_connection; + agi::signal::Connection active_line_connection; + + std::shared_future font_list; + + /// Styles in the current subtitle file + std::vector styleMap; + + /// Style storage manager + AssStyleStorage Store; + + wxComboBox *CatalogList; + wxListBox *StorageList; + wxListBox *CurrentList; + + wxButton *CatalogDelete; + + wxButton *MoveToLocal; + wxButton *MoveToStorage; + + wxButton *StorageNew; + wxButton *StorageEdit; + wxButton *StorageCopy; + wxButton *StorageDelete; + wxButton *StorageMoveUp; + wxButton *StorageMoveDown; + wxButton *StorageMoveTop; + wxButton *StorageMoveBottom; + wxButton *StorageSort; + + wxButton *CurrentNew; + wxButton *CurrentEdit; + wxButton *CurrentCopy; + wxButton *CurrentDelete; + wxButton *CurrentMoveUp; + wxButton *CurrentMoveDown; + wxButton *CurrentMoveTop; + wxButton *CurrentMoveBottom; + wxButton *CurrentSort; + + /// Load the list of available storages + void LoadCatalog(); + /// Load the style list from the subtitles file + void LoadCurrentStyles(int commit_type); + /// Enable/disable all of the buttons as appropriate + void UpdateButtons(); + /// Move styles up or down + /// @param storage Storage or current file styles + /// @param type 0: up; 1: top; 2: down; 3: bottom; 4: sort + void MoveStyles(bool storage, int type); + + /// Open the style editor for the given style on the script + /// @param style Style to edit, or nullptr for new + /// @param new_name Default new name for copies + void ShowCurrentEditor(AssStyle *style, std::string const& new_name = ""); + + /// Open the style editor for the given style in the storage + /// @param style Style to edit, or nullptr for new + /// @param new_name Default new name for copies + void ShowStorageEditor(AssStyle *style, std::string const& new_name = ""); + + /// Save the storage and update the view after a change + void UpdateStorage(); + + void OnChangeCatalog(); + void OnCatalogNew(); + void OnCatalogDelete(); + + void OnCopyToCurrent(); + void OnCopyToStorage(); + + void OnCurrentCopy(); + void OnCurrentDelete(); + void OnCurrentEdit(); + void OnCurrentImport(); + void OnCurrentNew(); + + void OnStorageCopy(); + void OnStorageDelete(); + void OnStorageEdit(); + void OnStorageNew(); + + void OnKeyDown(wxKeyEvent &event); + void PasteToCurrent(); + void PasteToStorage(); + + template + void CopyToClipboard(wxListBox *list, T const& v); + + void OnActiveLineChanged(AssDialogue *new_line); + +public: + DialogStyleManager(agi::Context *context); +}; wxBitmapButton *add_bitmap_button(wxWindow *parent, wxSizer *sizer, wxBitmap const& img, wxString const& tooltip) { wxBitmapButton *btn = new wxBitmapButton(parent, -1, img); @@ -151,8 +252,6 @@ int get_single_sel(wxListBox *lb) { return n == 1 ? selections[0] : -1; } -} - DialogStyleManager::DialogStyleManager(agi::Context *context) : wxDialog(context->parent, -1, _("Styles Manager")) , c(context) @@ -274,9 +373,6 @@ DialogStyleManager::DialogStyleManager(agi::Context *context) CurrentList->Bind(wxEVT_LISTBOX_DCLICK, bind(&DialogStyleManager::OnCurrentEdit, this)); } -DialogStyleManager::~DialogStyleManager() { -} - void DialogStyleManager::LoadCurrentStyles(int commit_type) { if (commit_type & AssFile::COMMIT_STYLES || commit_type == AssFile::COMMIT_NEW) { CurrentList->Clear(); @@ -826,3 +922,8 @@ void DialogStyleManager::OnKeyDown(wxKeyEvent &event) { break; } } +} + +void ShowStyleManagerDialog(agi::Context *c) { + c->dialog->Show(c); +} diff --git a/src/dialog_style_manager.h b/src/dialog_style_manager.h deleted file mode 100644 index ed04d627a..000000000 --- a/src/dialog_style_manager.h +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_style_manager.h -/// @see dialog_style_manager.cpp -/// @ingroup style_editor -/// - -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "ass_style_storage.h" - -namespace agi { struct Context; } -class AssDialogue; -class AssFile; -class AssStyle; -class DialogStyleEditor; -class PersistLocation; - -class DialogStyleManager final : public wxDialog { - agi::Context *c; ///< Project context - std::unique_ptr persist; - - agi::signal::Connection commit_connection; - agi::signal::Connection active_line_connection; - - std::shared_future font_list; - - /// Styles in the current subtitle file - std::vector styleMap; - - /// Style storage manager - AssStyleStorage Store; - - wxComboBox *CatalogList; - wxListBox *StorageList; - wxListBox *CurrentList; - - wxButton *CatalogDelete; - - wxButton *MoveToLocal; - wxButton *MoveToStorage; - - wxButton *StorageNew; - wxButton *StorageEdit; - wxButton *StorageCopy; - wxButton *StorageDelete; - wxButton *StorageMoveUp; - wxButton *StorageMoveDown; - wxButton *StorageMoveTop; - wxButton *StorageMoveBottom; - wxButton *StorageSort; - - wxButton *CurrentNew; - wxButton *CurrentEdit; - wxButton *CurrentCopy; - wxButton *CurrentDelete; - wxButton *CurrentMoveUp; - wxButton *CurrentMoveDown; - wxButton *CurrentMoveTop; - wxButton *CurrentMoveBottom; - wxButton *CurrentSort; - - /// Load the list of available storages - void LoadCatalog(); - /// Load the style list from the subtitles file - void LoadCurrentStyles(int commit_type); - /// Enable/disable all of the buttons as appropriate - void UpdateButtons(); - /// Move styles up or down - /// @param storage Storage or current file styles - /// @param type 0: up; 1: top; 2: down; 3: bottom; 4: sort - void MoveStyles(bool storage, int type); - - /// Open the style editor for the given style on the script - /// @param style Style to edit, or nullptr for new - /// @param new_name Default new name for copies - void ShowCurrentEditor(AssStyle *style, std::string const& new_name = ""); - - /// Open the style editor for the given style in the storage - /// @param style Style to edit, or nullptr for new - /// @param new_name Default new name for copies - void ShowStorageEditor(AssStyle *style, std::string const& new_name = ""); - - /// Save the storage and update the view after a change - void UpdateStorage(); - - void OnChangeCatalog(); - void OnCatalogNew(); - void OnCatalogDelete(); - - void OnCopyToCurrent(); - void OnCopyToStorage(); - - void OnCurrentCopy(); - void OnCurrentDelete(); - void OnCurrentEdit(); - void OnCurrentImport(); - void OnCurrentNew(); - - void OnStorageCopy(); - void OnStorageDelete(); - void OnStorageEdit(); - void OnStorageNew(); - - void OnKeyDown(wxKeyEvent &event); - void PasteToCurrent(); - void PasteToStorage(); - - template - void CopyToClipboard(wxListBox *list, T const& v); - - void OnActiveLineChanged(AssDialogue *new_line); - -public: - DialogStyleManager(agi::Context *context); - ~DialogStyleManager(); -}; diff --git a/src/dialog_text_import.cpp b/src/dialog_text_import.cpp index 630168b88..27145d8b0 100644 --- a/src/dialog_text_import.cpp +++ b/src/dialog_text_import.cpp @@ -27,22 +27,31 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_text_import.cpp -/// @brief Set-up import from plain text files -/// @ingroup secondary_ui -/// - -#include "dialog_text_import.h" - #include "options.h" #include "validators.h" #include +#include #include #include #include #include +namespace { +/// @class DialogTextImport +/// @brief Plain text import separator character selection dialog +/// +/// A simple dialog to let the user select the format of a plain text file +/// being imported into Aegisub +class DialogTextImport final : public wxDialog { + std::string seperator; + std::string comment; + bool include_blank; + +public: + DialogTextImport(); +}; + DialogTextImport::DialogTextImport() : wxDialog(nullptr , -1, _("Text import options")) , seperator(OPT_GET("Tool/Import/Text/Actor Separator")->GetString()) @@ -75,3 +84,8 @@ DialogTextImport::DialogTextImport() EndModal(wxID_OK); }, wxID_OK); } +} + +bool ShowPlainTextImportDialog() { + return DialogTextImport().ShowModal() == wxID_OK; +} diff --git a/src/dialog_text_import.h b/src/dialog_text_import.h deleted file mode 100644 index e3078a6ba..000000000 --- a/src/dialog_text_import.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2007, Alysson Souza e Silva -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_text_import.h -/// @see dialog_text_import.cpp -/// @ingroup secondary_ui -/// - -#include - -/// @class DialogTextImport -/// @brief Plain text import separator character selection dialog -/// -/// A simple dialog to let the user select the format of a plain text file -/// being imported into Aegisub -class DialogTextImport final : public wxDialog { - std::string seperator; - std::string comment; - bool include_blank; - -public: - DialogTextImport(); -}; diff --git a/src/dialog_timing_processor.cpp b/src/dialog_timing_processor.cpp index b43773ab5..af4cb8d9d 100644 --- a/src/dialog_timing_processor.cpp +++ b/src/dialog_timing_processor.cpp @@ -27,13 +27,6 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_timing_processor.cpp -/// @brief Timing Post-processor dialogue box and logic -/// @ingroup tools_ui -/// - -#include "dialog_timing_processor.h" - #include "ass_dialogue.h" #include "ass_file.h" #include "ass_time.h" @@ -54,10 +47,11 @@ #include #include #include - +#include #include #include #include +#include #include #include #include @@ -69,6 +63,47 @@ using namespace boost::adaptors; namespace { +/// @class DialogTimingProcessor +/// @brief Automatic postprocessor for correcting common timing issues +class DialogTimingProcessor final : public wxDialog { + agi::Context *c; ///< Project context + + int leadIn; ///< Lead-in to add in milliseconds + int leadOut; ///< Lead-out to add in milliseconds + int beforeStart; ///< Maximum time in milliseconds to move start time of line backwards to land on a keyframe + int afterStart; ///< Maximum time in milliseconds to move start time of line forwards to land on a keyframe + int beforeEnd; ///< Maximum time in milliseconds to move end time of line backwards to land on a keyframe + int afterEnd; ///< Maximum time in milliseconds to move end time of line forwards to land on a keyframe + int adjGap; ///< Maximum gap in milliseconds to snap adjacent lines to each other + int adjOverlap; ///< Maximum overlap in milliseconds to snap adjacent lines to each other + + wxCheckBox *onlySelection; ///< Only process selected lines of the selected styles + wxCheckBox *hasLeadIn; ///< Enable adding lead-in + wxCheckBox *hasLeadOut; ///< Enable adding lead-out + wxCheckBox *keysEnable; ///< Enable snapping to keyframes + wxCheckBox *adjsEnable; ///< Enable snapping adjacent lines to each other + wxSlider *adjacentBias; ///< Bias between shifting start and end times when snapping adjacent lines + wxCheckListBox *StyleList; ///< List of styles to process + wxButton *ApplyButton; ///< Button to apply the processing + + void OnApply(wxCommandEvent &event); + + /// Check or uncheck all styles + void CheckAll(bool check); + + /// Enable and disable text boxes based on which checkboxes are checked + void UpdateControls(); + + /// Process the file + void Process(); + + /// Get a list of dialogue lines in the file sorted by start time + std::vector SortDialogues(); + +public: + DialogTimingProcessor(agi::Context *c); +}; + wxTextCtrl *make_ctrl(wxWindow *parent, wxSizer *sizer, wxString const& desc, int *value, wxCheckBox *cb, wxString const& tooltip) { wxIntegerValidator validator(value); validator.SetMin(0); @@ -98,7 +133,6 @@ wxCheckBox *make_check(wxStaticBoxSizer *sizer, wxString const& desc, const char sizer->Add(cb, wxSizerFlags().Border(wxRIGHT).Expand()); return cb; } -} DialogTimingProcessor::DialogTimingProcessor(agi::Context *c) : wxDialog(c->parent, -1, _("Timing Post-Processor")) @@ -409,3 +443,8 @@ void DialogTimingProcessor::Process() { c->ass->Commit(_("timing processor"), AssFile::COMMIT_DIAG_TIME); } +} + +void ShowTimingProcessorDialog(agi::Context *c) { + DialogTimingProcessor(c).ShowModal(); +} \ No newline at end of file diff --git a/src/dialog_timing_processor.h b/src/dialog_timing_processor.h deleted file mode 100644 index 166a074a1..000000000 --- a/src/dialog_timing_processor.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2005, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_timing_processor.h -/// @see dialog_timing_processor.cpp -/// @ingroup tools_ui -/// - -#include - -#include - -namespace agi { struct Context; } -class AssDialogue; -class wxButton; -class wxCheckBox; -class wxCheckListBox; -class wxSlider; - -/// @class DialogTimingProcessor -/// @brief Automatic postprocessor for correcting common timing issues -class DialogTimingProcessor final : public wxDialog { - agi::Context *c; ///< Project context - - int leadIn; ///< Lead-in to add in milliseconds - int leadOut; ///< Lead-out to add in milliseconds - int beforeStart; ///< Maximum time in milliseconds to move start time of line backwards to land on a keyframe - int afterStart; ///< Maximum time in milliseconds to move start time of line forwards to land on a keyframe - int beforeEnd; ///< Maximum time in milliseconds to move end time of line backwards to land on a keyframe - int afterEnd; ///< Maximum time in milliseconds to move end time of line forwards to land on a keyframe - int adjGap; ///< Maximum gap in milliseconds to snap adjacent lines to each other - int adjOverlap; ///< Maximum overlap in milliseconds to snap adjacent lines to each other - - wxCheckBox *onlySelection; ///< Only process selected lines of the selected styles - wxCheckBox *hasLeadIn; ///< Enable adding lead-in - wxCheckBox *hasLeadOut; ///< Enable adding lead-out - wxCheckBox *keysEnable; ///< Enable snapping to keyframes - wxCheckBox *adjsEnable; ///< Enable snapping adjacent lines to each other - wxSlider *adjacentBias; ///< Bias between shifting start and end times when snapping adjacent lines - wxCheckListBox *StyleList; ///< List of styles to process - wxButton *ApplyButton; ///< Button to apply the processing - - void OnApply(wxCommandEvent &event); - - /// Check or uncheck all styles - void CheckAll(bool check); - - /// Enable and disable text boxes based on which checkboxes are checked - void UpdateControls(); - - /// Process the file - void Process(); - - /// Get a list of dialogue lines in the file sorted by start time - std::vector SortDialogues(); - -public: - /// Constructor - /// @param c Project context - DialogTimingProcessor(agi::Context *c); -}; diff --git a/src/dialog_version_check.cpp b/src/dialog_version_check.cpp index e3247d500..6c48f1cc3 100644 --- a/src/dialog_version_check.cpp +++ b/src/dialog_version_check.cpp @@ -27,15 +27,8 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_version_check.cpp -/// @brief Version Checker dialogue box and logic -/// @ingroup configuration_ui -/// - #ifdef WITH_UPDATE_CHECKER -#include "dialog_version_check.h" - #ifdef _MSC_VER #pragma warning(disable : 4250) // 'boost::asio::basic_socket_iostream' : inherits 'std::basic_ostream<_Elem,_Traits>::std::basic_ostream<_Elem,_Traits>::_Add_vtordisp2' via dominance #endif @@ -50,6 +43,17 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -63,25 +67,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #ifdef __APPLE__ #include #endif -// Allocate global lock mutex declared in header +namespace { std::mutex VersionCheckLock; -namespace { struct AegisubUpdateDescription { std::string url; std::string friendly_name; @@ -362,7 +354,6 @@ void DoCheck(bool interactive) { }); } } - } void PerformVersionCheck(bool interactive) { diff --git a/src/dialog_version_check.h b/src/dialog_version_check.h deleted file mode 100644 index d556d753a..000000000 --- a/src/dialog_version_check.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2007, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_version_check.h -/// @see dialog_version_check.cpp -/// @ingroup configuration_ui -/// - -#include - -/// @brief Check whether a newer version is available and report to the user if there is -/// @param interactive If true, always check and report all results, both success and failure. -/// If false, only check if auto-checking is enabled, and only report if a -/// new version actually exists. -void PerformVersionCheck(bool interactive); - -/// @brief Mutex that is taken while version checking is being performed. -/// -/// A new version check can't be performed while this mutex is locked, checking whether -/// it is locked is a way to disable UI to invoke a version check while one is being -/// performed. -extern std::mutex VersionCheckLock; diff --git a/src/dialog_video_details.cpp b/src/dialog_video_details.cpp index 0ff50cf69..bb895fca9 100644 --- a/src/dialog_video_details.cpp +++ b/src/dialog_video_details.cpp @@ -27,13 +27,6 @@ // // Aegisub Project http://www.aegisub.org/ -/// @file dialog_video_details.cpp -/// @brief Video Details dialogue box -/// @ingroup secondary_ui -/// - -#include "dialog_video_details.h" - #include "ass_time.h" #include "async_video_provider.h" #include "compat.h" @@ -41,10 +34,18 @@ #include "project.h" #include +#include #include #include #include +namespace { +/// @class DialogVideoDetails +/// @brief Display information about the video in a dialog +struct DialogVideoDetails final : wxDialog { + DialogVideoDetails(agi::Context *c); +}; + DialogVideoDetails::DialogVideoDetails(agi::Context *c) : wxDialog(c->parent , -1, _("Video Details")) { @@ -76,3 +77,8 @@ DialogVideoDetails::DialogVideoDetails(agi::Context *c) CenterOnParent(); } +} + +void ShowVideoDetailsDialog(agi::Context *c) { + DialogVideoDetails(c).ShowModal(); +} diff --git a/src/dialog_video_details.h b/src/dialog_video_details.h deleted file mode 100644 index f1b693b7f..000000000 --- a/src/dialog_video_details.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2007, Alysson Souza e Silva (demi_alucard) -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Aegisub Project http://www.aegisub.org/ - -/// @file dialog_video_details.h -/// @see dialog_video_details.cpp -/// @ingroup secondary_ui -/// - -#include - -namespace agi { struct Context; } - -/// @class DialogVideoDetails -/// @brief Display information about the video in a dialog -struct DialogVideoDetails final : public wxDialog { - /// Constructor - /// @param c Project context - DialogVideoDetails(agi::Context *c); -}; diff --git a/src/dialog_video_properties.cpp b/src/dialog_video_properties.cpp index dd7b5d8d1..00ece3407 100644 --- a/src/dialog_video_properties.cpp +++ b/src/dialog_video_properties.cpp @@ -14,8 +14,6 @@ // // Aegisub Project http://www.aegisub.org/ -#include "dialog_video_properties.h" - #include "ass_file.h" #include "async_video_provider.h" #include "options.h" diff --git a/src/dialog_video_properties.h b/src/dialog_video_properties.h deleted file mode 100644 index f2d293e7b..000000000 --- a/src/dialog_video_properties.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2014, Thomas Goyne -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// Aegisub Project http://www.aegisub.org/ - -class AssFile; -class AsyncVideoProvider; -class wxWindow; - -/// Update the video properties for a newly opened video, possibly prompting the user about what to do -void UpdateVideoProperties(AssFile *file, const AsyncVideoProvider *new_provider, wxWindow *parent); \ No newline at end of file diff --git a/src/dialogs.h b/src/dialogs.h new file mode 100644 index 000000000..e11d23419 --- /dev/null +++ b/src/dialogs.h @@ -0,0 +1,75 @@ +// Copyright (c) 2014, Thomas Goyne +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// +// Aegisub Project http://www.aegisub.org/ + +#include + +#include +#include + +class AssFile; +class AsyncVideoProvider; +class wxArrayInt; +class wxArrayString; +class wxWindow; +namespace agi { struct Context; } +struct ResampleSettings; + +/// @brief Get a color from the user via a color picker dialog +/// @param parent Parent window +/// @param original Initial color to select +/// @param alpha Include controls for alpha +/// @param callback Function called whenever the selected color changes +/// @return Did the user accept the new color? +bool GetColorFromUser(wxWindow *parent, agi::Color original, bool alpha, std::function callback); + +/// Ask the user to pick an autosaved file to open +/// @return Path to file or empty string if canceled +std::string PickAutosaveFile(wxWindow *parent); + +/// @brief Check whether a newer version is available and report to the user if there is +/// @param interactive If true, always check and report all results, both success and failure. +/// If false, only check if auto-checking is enabled, and only report if a +/// new version actually exists. +void PerformVersionCheck(bool interactive); + +/// Ask the user to pick settings for a script resampling +/// @return Does the user want to proceed with the resampling? +bool PromptForResampleSettings(agi::Context *c, ResampleSettings &settings); + +/// Update the video properties for a newly opened video, possibly prompting the user about what to do +void UpdateVideoProperties(AssFile *file, const AsyncVideoProvider *new_provider, wxWindow *parent); + +int GetSelectedChoices(wxWindow *parent, wxArrayInt& selections, wxString const& message, wxString const& caption, wxArrayString const& choices); + +std::string CreateDummyVideo(wxWindow *parent); + +void ShowAboutDialog(wxWindow *parent); +void ShowAttachmentsDialog(wxWindow *parent, AssFile *file); +void ShowSelectLinesDialog(agi::Context *c); +void ShowExportDialog(agi::Context *c); +void ShowPropertiesDialog(agi::Context *c); +void ShowFontsCollectorDialog(agi::Context *c); +bool ShowPlainTextImportDialog(); +void ShowKanjiTimerDialog(agi::Context *c); +bool ShowPasteOverDialog(wxWindow *parent); +void ShowSpellcheckerDialog(agi::Context *c); +void ShowShiftTimesDialog(agi::Context *c); +void ShowStyleManagerDialog(agi::Context *c); +void ShowTimingProcessorDialog(agi::Context *c); +void ShowJumpToDialog(agi::Context *c); +void ShowVideoDetailsDialog(agi::Context *c); +void ShowLogWindow(agi::Context *c); +void ShowAutomationDialog(agi::Context *c); diff --git a/src/main.cpp b/src/main.cpp index 116c85797..b3395e1b0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,7 +42,7 @@ #include "auto4_lua_factory.h" #include "compat.h" #include "crash_writer.h" -#include "dialog_version_check.h" +#include "dialogs.h" #include "export_fixstyle.h" #include "export_framerate.h" #include "frame_main.h" diff --git a/src/project.cpp b/src/project.cpp index eebae2843..82366b2b8 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -22,7 +22,7 @@ #include "charset_detect.h" #include "compat.h" #include "dialog_progress.h" -#include "dialog_video_properties.h" +#include "dialogs.h" #include "include/aegisub/audio_provider.h" #include "include/aegisub/context.h" #include "include/aegisub/video_provider.h" diff --git a/src/subtitle_format_txt.cpp b/src/subtitle_format_txt.cpp index 3a89b81dd..a56002356 100644 --- a/src/subtitle_format_txt.cpp +++ b/src/subtitle_format_txt.cpp @@ -36,7 +36,7 @@ #include "ass_dialogue.h" #include "ass_file.h" -#include "dialog_text_import.h" +#include "dialogs.h" #include "options.h" #include "text_file_reader.h" #include "text_file_writer.h" @@ -54,9 +54,7 @@ TXTSubtitleFormat::TXTSubtitleFormat() } std::vector TXTSubtitleFormat::GetReadWildcards() const { - std::vector formats; - formats.push_back("txt"); - return formats; + return {"txt"}; } std::vector TXTSubtitleFormat::GetWriteWildcards() const { @@ -69,8 +67,7 @@ bool TXTSubtitleFormat::CanWriteFile(agi::fs::path const& filename) const { } void TXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const { - DialogTextImport dlg; - if (dlg.ShowModal() == wxID_CANCEL) return; + if (!ShowPlainTextImportDialog()) return; TextFileReader file(filename, encoding, false); diff --git a/src/video_controller.cpp b/src/video_controller.cpp index ce2670b13..66178b320 100644 --- a/src/video_controller.cpp +++ b/src/video_controller.cpp @@ -35,7 +35,7 @@ #include "audio_controller.h" #include "compat.h" #include "dialog_progress.h" -#include "dialog_video_properties.h" +#include "dialogs.h" #include "include/aegisub/context.h" #include "include/aegisub/video_provider.h" #include "mkv_wrap.h"