Remove a lot of pointless headers for dialogs

Most of the dialogs in Aegisub have a public interface consisting of a
single function, so there's really no need to expose the actual dialog
classes to the rest of the program. Add dialogs.h with the declarations
of all of those functions (most of which are just ShowFooDialog()), and
kill a million other headers.
This commit is contained in:
Thomas Goyne 2014-05-22 12:07:15 -07:00
parent 49357eec20
commit 2bf23af00a
64 changed files with 1023 additions and 1953 deletions

View file

@ -142,38 +142,15 @@
<ClInclude Include="$(SrcDir)command\command.h" />
<ClInclude Include="$(SrcDir)compat.h" />
<ClInclude Include="$(SrcDir)crash_writer.h" />
<ClInclude Include="$(SrcDir)dialog_about.h" />
<ClInclude Include="$(SrcDir)dialog_attachments.h" />
<ClInclude Include="$(SrcDir)dialog_automation.h" />
<ClInclude Include="$(SrcDir)dialog_autosave.h" />
<ClInclude Include="$(SrcDir)dialog_colorpicker.h" />
<ClInclude Include="$(SrcDir)dialog_detached_video.h" />
<ClInclude Include="$(SrcDir)dialog_dummy_video.h" />
<ClInclude Include="$(SrcDir)dialog_export.h" />
<ClInclude Include="$(SrcDir)dialog_export_ebu3264.h" />
<ClInclude Include="$(SrcDir)dialog_fonts_collector.h" />
<ClInclude Include="$(SrcDir)dialog_jumpto.h" />
<ClInclude Include="$(SrcDir)dialog_kara_timing_copy.h" />
<ClInclude Include="$(SrcDir)dialog_log.h" />
<ClInclude Include="$(SrcDir)dialog_manager.h" />
<ClInclude Include="$(SrcDir)dialog_paste_over.h" />
<ClInclude Include="$(SrcDir)dialog_progress.h" />
<ClInclude Include="$(SrcDir)dialog_properties.h" />
<ClInclude Include="$(SrcDir)dialog_resample.h" />
<ClInclude Include="$(SrcDir)dialog_search_replace.h" />
<ClInclude Include="$(SrcDir)dialog_selected_choices.h" />
<ClInclude Include="$(SrcDir)dialog_selection.h" />
<ClInclude Include="$(SrcDir)dialog_shift_times.h" />
<ClInclude Include="$(SrcDir)dialog_spellchecker.h" />
<ClInclude Include="$(SrcDir)dialog_style_editor.h" />
<ClInclude Include="$(SrcDir)dialog_style_manager.h" />
<ClInclude Include="$(SrcDir)dialog_styling_assistant.h" />
<ClInclude Include="$(SrcDir)dialog_text_import.h" />
<ClInclude Include="$(SrcDir)dialog_timing_processor.h" />
<ClInclude Include="$(SrcDir)dialog_translation.h" />
<ClInclude Include="$(SrcDir)dialog_version_check.h" />
<ClInclude Include="$(SrcDir)dialog_video_details.h" />
<ClInclude Include="$(SrcDir)dialog_video_properties.h" />
<ClInclude Include="$(SrcDir)dialogs.h" />
<ClInclude Include="$(SrcDir)export_fixstyle.h" />
<ClInclude Include="$(SrcDir)export_framerate.h" />
<ClInclude Include="$(SrcDir)factory_manager.h" />

View file

@ -219,18 +219,6 @@
<ClInclude Include="$(SrcDir)fft.h">
<Filter>Audio</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_attachments.h">
<Filter>Features\Attachments</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_jumpto.h">
<Filter>Video\UI</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_video_details.h">
<Filter>Video\UI</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_style_manager.h">
<Filter>Features\Style editor</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_style_editor.h">
<Filter>Features\Style editor</Filter>
</ClInclude>
@ -240,18 +228,9 @@
<ClInclude Include="$(SrcDir)font_file_lister_fontconfig.h">
<Filter>Features\Font collector</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_fonts_collector.h">
<Filter>Features\Font collector</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_dummy_video.h">
<Filter>Video\UI</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_detached_video.h">
<Filter>Video\UI</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_export.h">
<Filter>Features\Export</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_export_ebu3264.h">
<Filter>Features\Export</Filter>
</ClInclude>
@ -267,27 +246,12 @@
<ClInclude Include="$(SrcDir)auto4_lua_factory.h">
<Filter>Automation\Lua</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_automation.h">
<Filter>Automation\UI</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_paste_over.h">
<Filter>Features\Paste Over</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_shift_times.h">
<Filter>Features\Shift Times</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_translation.h">
<Filter>Features\Translation Assistant</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)colorspace.h">
<Filter>Features\Colour picker</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_colorpicker.h">
<Filter>Features\Colour picker</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_kara_timing_copy.h">
<Filter>Features\Karaoke copier</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)gl_wrap.h">
<Filter>Video\UI</Filter>
</ClInclude>
@ -324,30 +288,15 @@
<ClInclude Include="$(SrcDir)subtitle_format_ttxt.h">
<Filter>Subtitle formats</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_spellchecker.h">
<Filter>Features\Spell checker</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)spellchecker_hunspell.h">
<Filter>Features\Spell checker</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)thesaurus.h">
<Filter>Features\Thesaurus</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_resample.h">
<Filter>Features\Resolution resampler</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_text_import.h">
<Filter>Features\Import</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_timing_processor.h">
<Filter>Features\Timing post-processor</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_styling_assistant.h">
<Filter>Features\Styling assistant</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_version_check.h">
<Filter>Features\Update checker</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)video_controller.h">
<Filter>Video</Filter>
</ClInclude>
@ -510,36 +459,21 @@
<ClInclude Include="$(SrcDir)version.h">
<Filter>Features\About box</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_about.h">
<Filter>Features\About box</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_selection.h">
<Filter>Features\Conditional select lines</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_search_replace.h">
<Filter>Features\Search-replace</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_selected_choices.h">
<Filter>Utilities\UI utilities</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_progress.h">
<Filter>Utilities\UI utilities</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)persist_location.h">
<Filter>Utilities\UI utilities</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_log.h">
<Filter>Utilities\Logging</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)crash_writer.h">
<Filter>Utilities\Logging</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)utils.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_properties.h">
<Filter>Features\File properties</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)ass_karaoke.h">
<Filter>ASS</Filter>
</ClInclude>
@ -591,9 +525,6 @@
<ClInclude Include="$(SrcDir)placeholder_ctrl.h">
<Filter>Controls</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_autosave.h">
<Filter>Features\Autosave</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)ass_info.h">
<Filter>ASS</Filter>
</ClInclude>
@ -618,15 +549,15 @@
<ClInclude Include="$(SrcDir)subtitle_format_ssa.h">
<Filter>Subtitle formats</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialog_video_properties.h">
<Filter>Features\Resolution resampler</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)async_video_provider.h">
<Filter>Video\Providers</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)project.h">
<Filter>Main UI</Filter>
</ClInclude>
<ClInclude Include="$(SrcDir)dialogs.h">
<Filter>Features</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(SrcDir)ass_dialogue.cpp">
@ -1192,4 +1123,4 @@
<ResourceCompile Include="$(SrcDir)res\res.rc" />
<ResourceCompile Include="$(SrcDir)res\strings.rc" />
</ItemGroup>
</Project>
</Project>

View file

@ -17,7 +17,7 @@
#include "colour_button.h"
#include "compat.h"
#include "dialog_colorpicker.h"
#include "dialogs.h"
#include <boost/gil/gil_all.hpp>

View file

@ -37,11 +37,9 @@
#include <libaegisub/make_unique.h>
#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<LogWindow>(c);
ShowLogWindow(c);
}
};

View file

@ -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<DialogAutomation>(c);
ShowAutomationDialog(c);
}
};

View file

@ -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<bool>& 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();
}

View file

@ -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<DialogSpellChecker>(c);
ShowSpellcheckerDialog(c);
}
};
}

View file

@ -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<DialogShiftTimes>(c);
ShowShiftTimesDialog(c);
}
};

View file

@ -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<DialogFontsCollector>(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<DialogSelection>(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<DialogStyleManager>(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);
}
};

View file

@ -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);
}

View file

@ -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 <wx/button.h>
#include <wx/dialog.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/statbmp.h>
@ -40,110 +39,114 @@
#include <wx/stattext.h>
#include <wx/textctrl.h>
#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();
}

View file

@ -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 <wx/dialog.h>
/// @class AboutScreen
/// @brief About dialogue.
class AboutScreen: public wxDialog {
public:
AboutScreen(wxWindow *parent);
};

View file

@ -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 <wx/button.h>
#include <wx/filedlg.h>
#include <wx/dirdlg.h>
#include <wx/listctrl.h>
#include <wx/sizer.h>
#include "ass_attachment.h"
#include "ass_file.h"
#include "compat.h"
@ -48,6 +35,34 @@
#include "options.h"
#include "utils.h"
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/filedlg.h>
#include <wx/dirdlg.h>
#include <wx/listctrl.h>
#include <wx/sizer.h>
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();
}

View file

@ -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 <wx/dialog.h>
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);
};

View file

@ -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 <libaegisub/signal.h>
#include <algorithm>
#include <boost/range/algorithm.hpp>
#include <vector>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/filedlg.h>
#include <wx/listctrl.h>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h>
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<ExtraScriptInfo> 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<DialogAutomation>(c);
}

View file

@ -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 <vector>
#include <wx/dialog.h>
#include <libaegisub/signal.h>
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<ExtraScriptInfo> 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);
};

View file

@ -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 <libaegisub/path.h>
#include <cstdint>
#include <boost/range/adaptor/map.hpp>
#include <map>
#include <string>
#include <vector>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/listbox.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/string.h>
namespace {
struct Version {
wxString filename;
wxDateTime date;
wxString display;
};
struct AutosaveFile {
wxString name;
std::vector<Version> versions;
};
class DialogAutosave final : public wxDialog {
std::vector<AutosaveFile> files;
wxListBox *file_list;
wxListBox *version_list;
void Populate(std::map<wxString, AutosaveFile> &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 "";
}

View file

@ -1,50 +0,0 @@
// Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <cstdint>
#include <map>
#include <string>
#include <vector>
#include <wx/dialog.h>
#include <wx/string.h>
class wxListBox;
class DialogAutosave final : public wxDialog {
struct Version {
wxString filename;
wxDateTime date;
wxString display;
};
struct AutosaveFile {
wxString name;
std::vector<Version> versions;
};
std::vector<AutosaveFile> files;
wxListBox *file_list;
wxListBox *version_list;
void Populate(std::map<wxString, AutosaveFile> &files_map, std::string const& path, wxString const& filter, wxString const& name_fmt);
void OnSelectFile(wxCommandEvent&);
public:
DialogAutosave(wxWindow *parent);
std::string ChosenFile() const;
};

View file

@ -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"

View file

@ -1,34 +0,0 @@
// Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <functional>
#include <libaegisub/color.h>
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<void (agi::Color)> callback);

View file

@ -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 <libaegisub/color.h>
#include <wx/checkbox.h>
#include <wx/combobox.h>
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/spinctrl.h>
#include <wx/statline.h>
@ -32,15 +36,26 @@
#include <wx/valgen.h>
#include <wx/valnum.h>
#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<typename T>
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 "";

View file

@ -1,50 +0,0 @@
// Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <wx/dialog.h>
#include <libaegisub/color.h>
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<typename T>
void AddCtrl(wxString const& label, T *ctrl);
void OnResolutionShortcut(wxCommandEvent &evt);
void UpdateLengthDisplay();
public:
static std::string CreateDummyVideo(wxWindow *parent);
};

View file

@ -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 <algorithm>
#include <boost/filesystem/path.hpp>
#include <boost/tokenizer.hpp>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/checklst.h>
#include <wx/choice.h>
#include <wx/msgdlg.h>
@ -58,8 +51,39 @@
#include <wx/stattext.h>
#include <wx/textctrl.h>
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<AssExporter>(c))
, exporter(c)
{
SetIcon(GETICON(export_menu_16));
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
std::vector<std::string> filters = exporter->GetAllFilterNames();
std::vector<std::string> 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();
}

View file

@ -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 <memory>
#include <wx/dialog.h>
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<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();
};

View file

@ -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 <libaegisub/make_unique.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/dirdlg.h>
#include <wx/filedlg.h>
#include <wx/filename.h>
@ -54,6 +49,31 @@
#include <wx/wfstream.h>
#include <wx/zipstrm.h>
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<DialogFontsCollector>(c);
}

View file

@ -1,56 +0,0 @@
// Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <wx/dialog.h>
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);
};

View file

@ -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 <wx/button.h>
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
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();
}

View file

@ -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 <wx/dialog.h>
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);
};

View file

@ -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 <boost/locale/boundary.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <deque>
#include <list>
#include <vector>
#include <wx/checkbox.h>
#include <wx/combobox.h>
#include <wx/dcclient.h>
#include <wx/dialog.h>
#include <wx/listctrl.h>
#include <wx/msgdlg.h>
#include <wx/settings.h>
@ -64,6 +59,7 @@
#include <wx/stattext.h>
#include <wx/string.h>
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<std::pair<AssDialogue*, std::string>> 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<AssDialogue>::reverse_iterator(subs->iterator_to(*search_from)), subs->Events.rend(), search_style);
}
}
void ShowKanjiTimerDialog(agi::Context *c) {
DialogKanjiTimer(c).ShowModal();
}

View file

@ -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 <list>
#include <vector>
#include <wx/dialog.h>
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<std::pair<AssDialogue*, std::string>> 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);
};

View file

@ -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 <libaegisub/dispatch.h>
@ -44,12 +38,13 @@
#include <ctime>
#include <functional>
#include <string>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
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<LogWindow>(c);
}

View file

@ -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 <wx/dialog.h>
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();
};

View file

@ -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 <libaegisub/exception.h>
#include <map>
#include <typeinfo>
#include <wx/dialog.h>
#include "utils.h"
namespace agi { struct Context; }
/// @brief A manager for dialogs
///

View file

@ -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 <functional>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/checklst.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#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;
}

View file

@ -31,20 +31,3 @@
/// @see dialog_paste_over.cpp
/// @ingroup secondary_ui
///
#include <wx/dialog.h>
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);
};

View file

@ -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 <algorithm>
#include <boost/algorithm/string/predicate.hpp>
#include <vector>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/combobox.h>
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
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<std::pair<std::string, wxTextCtrl*>> 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();
}

View file

@ -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 <vector>
#include <wx/dialog.h>
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<std::pair<std::string, wxTextCtrl*>> 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);
};

View file

@ -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 <boost/range/size.hpp>
#include <wx/checkbox.h>
#include <wx/combobox.h>
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/spinctrl.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/valgen.h>
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;
}

View file

@ -1,72 +0,0 @@
// Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <wx/dialog.h>
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);
};

View file

@ -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 <numeric>
#include <wx/button.h>
#include <wx/choicdlg.h>
#include <wx/listbox.h>
#include <wx/sizer.h>
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);

View file

@ -1,36 +0,0 @@
// Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <wx/config.h>
#include <wx/choicdlg.h>
/// @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);

View file

@ -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 <wx/checkbox.h>
#include <wx/combobox.h>
#include <wx/dialog.h>
#include <wx/msgdlg.h>
#include <wx/radiobox.h>
#include <wx/radiobut.h>
@ -46,6 +41,28 @@
#include <wx/textctrl.h>
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<AssDialogue*> 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<DialogSelection>(c);
}

View file

@ -1,52 +0,0 @@
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <wx/dialog.h>
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();
};

View file

@ -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 <libaegisub/io.h>
#include <libaegisub/log.h>
#include <libaegisub/path.h>
#include <libaegisub/make_unique.h>
#include <libaegisub/signal.h>
#include <libaegisub/vfr.h>
#include <libaegisub/cajun/elements.h>
#include <libaegisub/cajun/reader.h>
#include <libaegisub/cajun/writer.h>
#include <algorithm>
#include <boost/filesystem/path.hpp>
#include <vector>
#include <wx/dialog.h>
#include <wx/listbox.h>
#include <wx/radiobox.h>
#include <wx/radiobut.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
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<json::Array>())
, 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<std::istream> 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<DialogShiftTimes>(c);
}

View file

@ -1,80 +0,0 @@
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <libaegisub/fs_fwd.h>
#include <libaegisub/signal.h>
#include <libaegisub/vfr.h>
#include <boost/filesystem/path.hpp>
#include <deque>
#include <memory>
#include <wx/dialog.h>
class AssDialogue;
class TimeEdit;
class wxListBox;
class wxRadioBox;
class wxRadioButton;
class wxTextCtrl;
namespace agi { struct Context; }
namespace json {
class UnknownElement;
typedef std::deque<UnknownElement> 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<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();
};

View file

@ -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 <libaegisub/spellchecker.h>
#include <boost/locale/conversion.hpp>
#include <map>
#include <memory>
#include <set>
#include <wx/arrstr.h>
#include <wx/checkbox.h>
#include <wx/combobox.h>
#include <wx/dialog.h>
#include <wx/intl.h>
#include <wx/listbox.h>
#include <wx/msgdlg.h>
@ -48,6 +47,60 @@
#include <wx/stattext.h>
#include <wx/textctrl.h>
namespace {
class DialogSpellChecker final : public wxDialog {
agi::Context *context; ///< The project context
std::unique_ptr<agi::SpellChecker> spellchecker; ///< The spellchecking engine
/// Words which the user has indicated should always be corrected
std::map<std::string, std::string> auto_replace;
/// Words which the user has temporarily added to the dictionary
std::set<std::string> 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<DialogSpellChecker>(c);
}

View file

@ -1,90 +0,0 @@
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <map>
#include <memory>
#include <set>
#include <wx/dialog.h>
#include <wx/arrstr.h>
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<agi::SpellChecker> spellchecker; ///< The spellchecking engine
/// Words which the user has indicated should always be corrected
std::map<std::string, std::string> auto_replace;
/// Words which the user has temporarily added to the dictionary
std::set<std::string> 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();
};

View file

@ -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 <libaegisub/fs.h>
#include <libaegisub/path.h>
#include <libaegisub/signal.h>
#include <libaegisub/split.h>
#include <libaegisub/make_unique.h>
#include <algorithm>
#include <boost/algorithm/string/trim.hpp>
#include <functional>
#include <future>
#include <memory>
#include <vector>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/combobox.h>
#include <wx/dialog.h>
#include <wx/filename.h>
#include <wx/fontenum.h>
#include <wx/intl.h>
#include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h>
#include <wx/textdlg.h>
#include <wx/choicdlg.h> // Keep this last so wxUSE_CHOICEDLG is set.
namespace {
class DialogStyleManager final : public wxDialog {
agi::Context *c; ///< Project context
std::unique_ptr<PersistLocation> persist;
agi::signal::Connection commit_connection;
agi::signal::Connection active_line_connection;
std::shared_future<wxArrayString> font_list;
/// Styles in the current subtitle file
std::vector<AssStyle*> 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<class T>
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<DialogStyleManager>(c);
}

View file

@ -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 <future>
#include <memory>
#include <vector>
#include <wx/button.h>
#include <wx/combobox.h>
#include <wx/dialog.h>
#include <wx/listbox.h>
#include <libaegisub/signal.h>
#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<PersistLocation> persist;
agi::signal::Connection commit_connection;
agi::signal::Connection active_line_connection;
std::shared_future<wxArrayString> font_list;
/// Styles in the current subtitle file
std::vector<AssStyle*> 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<class T>
void CopyToClipboard(wxListBox *list, T const& v);
void OnActiveLineChanged(AssDialogue *new_line);
public:
DialogStyleManager(agi::Context *context);
~DialogStyleManager();
};

View file

@ -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 <wx/checkbox.h>
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/valgen.h>
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;
}

View file

@ -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 <wx/dialog.h>
/// @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();
};

View file

@ -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 <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <functional>
#include <vector>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/checklst.h>
#include <wx/dialog.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h>
#include <wx/slider.h>
@ -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<AssDialogue*> SortDialogues();
public:
DialogTimingProcessor(agi::Context *c);
};
wxTextCtrl *make_ctrl(wxWindow *parent, wxSizer *sizer, wxString const& desc, int *value, wxCheckBox *cb, wxString const& tooltip) {
wxIntegerValidator<int> 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();
}

View file

@ -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 <vector>
#include <wx/dialog.h>
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<AssDialogue*> SortDialogues();
public:
/// Constructor
/// @param c Project context
DialogTimingProcessor(agi::Context *c);
};

View file

@ -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<Protocol>' : inherits 'std::basic_ostream<_Elem,_Traits>::std::basic_ostream<_Elem,_Traits>::_Add_vtordisp2' via dominance
#endif
@ -50,6 +43,17 @@
#include <libaegisub/line_iterator.h>
#include <libaegisub/scoped_ptr.h>
#include <algorithm>
#include <ctime>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/format.hpp>
#include <functional>
#include <memory>
#include <mutex>
#include <set>
#include <vector>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
@ -63,25 +67,13 @@
#include <wx/string.h>
#include <wx/textctrl.h>
#include <algorithm>
#include <ctime>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/format.hpp>
#include <functional>
#include <memory>
#include <set>
#include <vector>
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#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) {

View file

@ -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 <mutex>
/// @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;

View file

@ -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 <boost/rational.hpp>
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
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();
}

View file

@ -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 <wx/dialog.h>
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);
};

View file

@ -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"

View file

@ -1,22 +0,0 @@
// Copyright (c) 2014, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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);

75
src/dialogs.h Normal file
View file

@ -0,0 +1,75 @@
// Copyright (c) 2014, Thomas Goyne <plorkyeran@aegisub.org>
//
// 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 <libaegisub/color.h>
#include <functional>
#include <string>
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<void (agi::Color)> 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);

View file

@ -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"

View file

@ -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"

View file

@ -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<std::string> TXTSubtitleFormat::GetReadWildcards() const {
std::vector<std::string> formats;
formats.push_back("txt");
return formats;
return {"txt"};
}
std::vector<std::string> 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);

View file

@ -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"