/// @brief DOCME /// @param parent /// @param _local_manager /// DialogAutomation::DialogAutomation(wxWindow *parent, Automation4::ScriptManager *_local_manager) : wxDialog(parent, -1, _("Automation Manager"), wxDefaultPosition, wxDefaultSize) { // Set icon SetIcon(BitmapToIcon(GETIMAGE(automation_toolbutton_24))); local_manager = _local_manager; global_manager = wxGetApp().global_scripts; // create main controls list = new wxListView(this, Automation_List_Box, wxDefaultPosition, wxSize(600, 175), wxLC_REPORT|wxLC_SINGLE_SEL); add_button = new wxButton(this, Automation_Add_Script, _("&Add")); remove_button = new wxButton(this, Automation_Remove_Script, _("&Remove")); reload_button = new wxButton(this, Automation_Reload_Script, _("Re&load")); info_button = new wxButton(this, Automation_Show_Info, _("Show &Info")); reload_autoload_button = new wxButton(this, Automation_Reload_Autoload, _("Re&scan Autoload Dir")); close_button = new wxButton(this, wxID_CANCEL, _("&Close")); // add headers to list view list->InsertColumn(0, _T(""), wxLIST_FORMAT_CENTER, 20); list->InsertColumn(1, _("Name"), wxLIST_FORMAT_LEFT, 140); list->InsertColumn(2, _("Filename"), wxLIST_FORMAT_LEFT, 90); list->InsertColumn(3, _("Description"), wxLIST_FORMAT_LEFT, 330); // button layout wxSizer *button_box = new wxBoxSizer(wxHORIZONTAL); button_box->AddStretchSpacer(2); button_box->Add(add_button, 0); button_box->Add(remove_button, 0); button_box->AddSpacer(10); button_box->Add(reload_button, 0); button_box->Add(info_button, 0); button_box->AddSpacer(10); button_box->Add(reload_autoload_button, 0); button_box->AddSpacer(10); button_box->Add(new HelpButton(this,_T("Automation Manager")), 0); button_box->Add(close_button, 0); button_box->AddStretchSpacer(2); // main layout wxSizer *main_box = new wxBoxSizer(wxVERTICAL); main_box->Add(list, 1, wxEXPAND|wxALL, 5); main_box->Add(button_box, 0, wxEXPAND|(wxALL&~wxTOP), 5); main_box->SetSizeHints(this); SetSizer(main_box); Center(); // why doesn't this work... the button gets the "default" decoration but doesn't answer to Enter // ("esc" does work) SetDefaultItem(close_button); SetAffirmativeId(wxID_CANCEL); close_button->SetDefault(); RebuildList(); UpdateDisplay(); }
void ShowAboutDialog(wxWindow *parent) { wxDialog d(parent, -1, _("About Aegisub"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX); wxString translatorCredit = _("Translated into LANGUAGE by PERSON\n"); if (translatorCredit == "Translated into LANGUAGE by PERSON\n") translatorCredit.clear(); // Generate about string wxString aboutString = wxString("Aegisub ") + GetAegisubShortVersionString() + ".\n" "Copyright (c) 2005-2014 Rodrigo Braz Monteiro, Niels Martin Hansen, Thomas Goyne et al.\n\n" "Programmers:\n" " Alysson Souza e Silva\n" " Amar Takhar\n" " Dan Donovan\n" " Daniel Moscoviter\n" " David Conrad\n" " David Lamparter\n" " Eric Batalitzky\n" " Evgeniy Stepanov\n" " Fredrik Mellbin\n" " Grigori Goronzy\n" " Karl Blomster\n" " Mike Matsnev\n" " Moritz Brunner\n" " Muhammad Lukman Nasaruddin\n" " Niels Martin Hansen\n" " Patryk Pomykalski\n" " Ravi Pinjala\n" " Rodrigo Braz Monteiro\n" " Simone Cociancich\n" " Thomas Goyne\n" "User manual written by:\n" " Karl Blomster\n" " Niels Martin Hansen\n" " Rodrigo Braz Monteiro\n" "Icons by:\n" " Philip Cash\n" "Additional thanks to:\n" " Mentar\n" " Sigurd Tao Lyngse\n" " Everyone in the Aegisub IRC channel\n" " Everyone who ever reported a bug\n" + translatorCredit + "\n" "Aegisub includes portions from the following other projects:\n" " wxWidgets - Copyright (c) Julian Smart, Robert Roebling et al;\n" " wxStyledTextCtrl - Copyright (c) Robin Dunn, Neil Hodgson;\n" " Scintilla - Copyright (c) Neil Hodgson;\n" " Boost - Copyright (c) Beman Dawes, David Abrahams et al;\n" " UniversalCharDet - Copyright (c) Netscape Communications Corp.;\n" " ICU - Copyright (c) International Business Machines Corp.;\n" " Lua - Copyright (c) Lua.org, PUC-Rio;\n" " LuaJIT - Copyright (c) Mike Pall;\n" " luabins - Copyright (c) Alexander Gladysh;\n" #ifdef WITH_HUNSPELL " Hunspell - Copyright (c) Kevin Hendricks;\n" #endif #ifdef WITH_PORTAUDIO " PortAudio - Copyright (c) Ross Bencina, Phil Burk;\n" #endif #ifdef WITH_FFMS2 " FFmpeg - Copyright (c) Fabrice Bellard;\n" " FFMS2 - Copyright (c) Fredrik Mellbin;\n" #endif #ifdef WITH_AVISYNTH " Avisynth 2.5 - Copyright (c) Ben Rudiak-Gould et al;\n" #endif #ifdef WITH_CSRI " csri - Copyright (c) David Lamparter;\n" # ifdef __WINDOWS__ " vsfilter - Copyright (c) Gabest et al;\n" # endif #endif " libass - Copyright (c) Evgeniy Stepanov, Grigori Goronzy;\n" " Matroska Parser - Copyright (c) Mike Matsnev;\n" " Freetype - Copyright (c) David Turner, Robert Wilhelm, Werner Lemberg;\n" " Fontconfig - Copyright (c) Keith Packard et al;\n" #ifdef WITH_FFTW3 " FFTW - Copyright (c) Matteo Frigo, Massachusetts Institute of Technology;\n" #endif + _("\nSee the help file for full credits.\n") #ifdef BUILD_CREDIT + fmt_tl("Built by %s on %s.", GetAegisubBuildCredit(), GetAegisubBuildTime()) #endif ; // Replace copyright symbol wxChar copySymbol = 0xA9; aboutString.Replace("(c)", wxString(copySymbol)); wxTextCtrl *textctrl = new wxTextCtrl(&d, -1, aboutString, wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE | wxTE_READONLY | wxBORDER_NONE); wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL); MainSizer->Add(new wxStaticBitmap(&d, -1, GETIMAGE(splash)), 0, wxCENTER, 0); MainSizer->Add(new wxStaticLine(&d, wxID_ANY), 0, wxEXPAND | wxALL, 0); MainSizer->Add(textctrl, 0, wxEXPAND | wxALL, 0); MainSizer->Add(new wxStaticLine(&d, wxID_ANY), 0, wxEXPAND | wxALL, 0); MainSizer->Add(d.CreateButtonSizer(wxOK), 0, wxEXPAND | wxALL, 6); d.SetSizerAndFit(MainSizer); d.CentreOnParent(); d.ShowModal(); }
DialogTimingProcessor::DialogTimingProcessor(agi::Context *c) : wxDialog(c->parent,-1,_("Timing Post-Processor"),wxDefaultPosition,wxSize(400,250),wxDEFAULT_DIALOG_STYLE) , c(c) { SetIcon(BitmapToIcon(GETIMAGE(timing_processor_toolbutton_24))); // Set variables wxString leadInTime(wxString::Format("%d", OPT_GET("Audio/Lead/IN")->GetInt())); wxString leadOutTime(wxString::Format("%d", OPT_GET("Audio/Lead/OUT")->GetInt())); wxString thresStartBefore(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key Start Before")->GetInt())); wxString thresStartAfter(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key Start After")->GetInt())); wxString thresEndBefore(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key End Before")->GetInt())); wxString thresEndAfter(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key End After")->GetInt())); wxString adjsThresTime(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Adjacent")->GetInt())); // Styles box wxSizer *LeftSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Apply to styles")); wxArrayString styles = c->ass->GetStyles(); StyleList = new wxCheckListBox(this,TIMING_STYLE_LIST,wxDefaultPosition,wxSize(150,150),styles); StyleList->SetToolTip(_("Select styles to process. Unchecked ones will be ignored.")); wxButton *all = new wxButton(this,BUTTON_SELECT_ALL,_("All")); all->SetToolTip(_("Select all styles.")); wxButton *none = new wxButton(this,BUTTON_SELECT_NONE,_("None")); none->SetToolTip(_("Deselect all styles.")); // Options box wxSizer *optionsSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Options")); onlySelection = new wxCheckBox(this,-1,_("Affect selection only")); onlySelection->SetValue(OPT_GET("Tool/Timing Post Processor/Only Selection")->GetBool()); optionsSizer->Add(onlySelection,1,wxALL,0); // Lead-in/out box wxSizer *LeadSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Lead-in/Lead-out")); hasLeadIn = new wxCheckBox(this,CHECK_ENABLE_LEADIN,_("Add lead in:")); hasLeadIn->SetToolTip(_("Enable adding of lead-ins to lines.")); hasLeadIn->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/IN")->GetBool()); leadIn = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadInTime)); leadIn->SetToolTip(_("Lead in to be added, in milliseconds.")); hasLeadOut = new wxCheckBox(this,CHECK_ENABLE_LEADOUT,_("Add lead out:")); hasLeadOut->SetToolTip(_("Enable adding of lead-outs to lines.")); hasLeadOut->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/OUT")->GetBool()); leadOut = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadOutTime)); leadOut->SetToolTip(_("Lead out to be added, in milliseconds.")); LeadSizer->Add(hasLeadIn,0,wxRIGHT|wxEXPAND,5); LeadSizer->Add(leadIn,0,wxRIGHT|wxEXPAND,5); LeadSizer->Add(hasLeadOut,0,wxRIGHT|wxEXPAND,5); LeadSizer->Add(leadOut,0,wxRIGHT|wxEXPAND,0); LeadSizer->AddStretchSpacer(1); // Adjacent subs sizer wxSizer *AdjacentSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Make adjacent subtitles continuous")); adjsEnable = new wxCheckBox(this,CHECK_ENABLE_ADJASCENT,_("Enable")); adjsEnable->SetToolTip(_("Enable snapping of subtitles together if they are within a certain distance of each other.")); adjsEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Adjacent")->GetBool()); wxStaticText *adjsThresText = new wxStaticText(this,-1,_("Threshold:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); adjacentThres = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(adjsThresTime)); adjacentThres->SetToolTip(_("Maximum difference between start and end time for two subtitles to be made continuous, in milliseconds.")); adjacentBias = new wxSlider(this,-1,mid(0,int(OPT_GET("Tool/Timing Post Processor/Adjacent Bias")->GetDouble()*100),100),0,100,wxDefaultPosition,wxSize(-1,20)); adjacentBias->SetToolTip(_("Sets how to set the adjoining of lines. If set totally to left, it will extend start time of the second line; if totally to right, it will extend the end time of the first line.")); AdjacentSizer->Add(adjsEnable,0,wxRIGHT|wxEXPAND,10); AdjacentSizer->Add(adjsThresText,0,wxRIGHT|wxALIGN_CENTER,5); AdjacentSizer->Add(adjacentThres,0,wxRIGHT|wxEXPAND,5); AdjacentSizer->Add(new wxStaticText(this,-1,_("Bias: Start <- "),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE),0,wxALIGN_CENTER,0); AdjacentSizer->Add(adjacentBias,1,wxEXPAND,0); AdjacentSizer->Add(new wxStaticText(this,-1,_(" -> End"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE),0,wxALIGN_CENTER,0); // Keyframes sizer KeyframesSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Keyframe snapping")); wxSizer *KeyframesFlexSizer = new wxFlexGridSizer(2,5,5,0); keysEnable = new wxCheckBox(this,CHECK_ENABLE_KEYFRAME,_("Enable")); keysEnable->SetToolTip(_("Enable snapping of subtitles to nearest keyframe, if distance is within threshold.")); keysEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Keyframe")->GetBool()); wxStaticText *textStartBefore = new wxStaticText(this,-1,_("Starts before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); keysStartBefore = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartBefore)); keysStartBefore->SetToolTip(_("Threshold for 'before start' distance, that is, how many frames a subtitle must start before a keyframe to snap to it.")); wxStaticText *textStartAfter = new wxStaticText(this,-1,_("Starts after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); keysStartAfter = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartAfter)); keysStartAfter->SetToolTip(_("Threshold for 'after start' distance, that is, how many frames a subtitle must start after a keyframe to snap to it.")); wxStaticText *textEndBefore = new wxStaticText(this,-1,_("Ends before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); keysEndBefore = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndBefore)); keysEndBefore->SetToolTip(_("Threshold for 'before end' distance, that is, how many frames a subtitle must end before a keyframe to snap to it.")); wxStaticText *textEndAfter = new wxStaticText(this,-1,_("Ends after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); keysEndAfter = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndAfter)); keysEndAfter->SetToolTip(_("Threshold for 'after end' distance, that is, how many frames a subtitle must end after a keyframe to snap to it.")); KeyframesFlexSizer->Add(keysEnable,0,wxRIGHT|wxEXPAND,10); KeyframesFlexSizer->Add(textStartBefore,0,wxRIGHT|wxALIGN_CENTER,5); KeyframesFlexSizer->Add(keysStartBefore,0,wxRIGHT|wxEXPAND,5); KeyframesFlexSizer->Add(textStartAfter,0,wxRIGHT|wxALIGN_CENTER,5); KeyframesFlexSizer->Add(keysStartAfter,0,wxRIGHT|wxEXPAND,0); KeyframesFlexSizer->AddStretchSpacer(1); KeyframesFlexSizer->Add(textEndBefore,0,wxRIGHT|wxALIGN_CENTER,5); KeyframesFlexSizer->Add(keysEndBefore,0,wxRIGHT|wxEXPAND,5); KeyframesFlexSizer->Add(textEndAfter,0,wxRIGHT|wxALIGN_CENTER,5); KeyframesFlexSizer->Add(keysEndAfter,0,wxRIGHT|wxEXPAND,0); KeyframesSizer->Add(KeyframesFlexSizer,0,wxEXPAND); KeyframesSizer->AddStretchSpacer(1); // Button sizer wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer(); ApplyButton = new wxButton(this,wxID_OK); ButtonSizer->AddButton(ApplyButton); ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL)); ButtonSizer->AddButton(new HelpButton(this,_T("Timing Processor"))); ButtonSizer->Realize(); // Right Sizer wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL); RightSizer->Add(optionsSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(LeadSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(AdjacentSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(KeyframesSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->AddStretchSpacer(1); RightSizer->Add(ButtonSizer,0,wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND,0); // Style buttons sizer wxSizer *StyleButtonsSizer = new wxBoxSizer(wxHORIZONTAL); StyleButtonsSizer->Add(all,1,0,0); StyleButtonsSizer->Add(none,1,0,0); // Left sizer size_t len = StyleList->GetCount(); for (size_t i=0; i<len; i++) { StyleList->Check(i); } LeftSizer->Add(StyleList,1,wxBOTTOM|wxEXPAND,0); LeftSizer->Add(StyleButtonsSizer,0,wxEXPAND,0); // Top Sizer wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL); TopSizer->Add(LeftSizer,0,wxRIGHT|wxEXPAND,5); TopSizer->Add(RightSizer,1,wxALL|wxEXPAND,0); // Main Sizer wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL); MainSizer->Add(TopSizer,1,wxALL|wxEXPAND,5); MainSizer->SetSizeHints(this); SetSizer(MainSizer); CenterOnParent(); UpdateControls(); }
FrameMain::FrameMain() : wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) , context(agi::util::make_unique<agi::Context>()) { StartupLog("Entering FrameMain constructor"); #ifdef __WXGTK__ // XXX HACK XXX // We need to set LC_ALL to "" here for input methods to work reliably. setlocale(LC_ALL, ""); // However LC_NUMERIC must be "C", otherwise some parsing fails. setlocale(LC_NUMERIC, "C"); #endif #ifdef __APPLE__ // When run from an app bundle, LC_CTYPE defaults to "C", which breaks on // anything involving unicode and in some cases number formatting. // The right thing to do here would be to query CoreFoundation for the user's // locale and add .UTF-8 to that, but :effort: LOG_D("locale") << setlocale(LC_ALL, nullptr); setlocale(LC_CTYPE, "en_US.UTF-8"); LOG_D("locale") << setlocale(LC_ALL, nullptr); #endif StartupLog("Initializing context models"); memset(context.get(), 0, sizeof(*context)); context->ass = new AssFile; StartupLog("Initializing context controls"); context->subsController = new SubsController(context.get()); context->ass->AddCommitListener(&FrameMain::UpdateTitle, this); context->subsController->AddFileOpenListener(&FrameMain::OnSubtitlesOpen, this); context->subsController->AddFileSaveListener(&FrameMain::UpdateTitle, this); context->audioController = new AudioController(context.get()); context->audioController->AddAudioOpenListener(&FrameMain::OnAudioOpen, this); context->audioController->AddAudioCloseListener(&FrameMain::OnAudioClose, this); context->local_scripts = new Automation4::LocalScriptManager(context.get()); // Initialized later due to that the selection controller is currently the subtitles grid context->selectionController = nullptr; context->videoController = VideoContext::Get(); // derp context->videoController->AddVideoOpenListener(&FrameMain::OnVideoOpen, this); StartupLog("Initializing context frames"); context->parent = this; context->previousFocus = nullptr; StartupLog("Install PNG handler"); wxImage::AddHandler(new wxPNGHandler); #ifndef __APPLE__ wxSafeYield(); #endif StartupLog("Apply saved Maximized state"); if (OPT_GET("App/Maximized")->GetBool()) Maximize(true); StartupLog("Initialize toolbar"); InitToolbar(); StartupLog("Initialize menu bar"); menu::GetMenuBar("main", this, context.get()); StartupLog("Create status bar"); CreateStatusBar(2); StartupLog("Set icon"); #ifdef _WIN32 SetIcon(wxICON(wxicon)); #else wxIcon icon; icon.CopyFromBitmap(GETIMAGE(wxicon)); SetIcon(icon); #endif StartupLog("Create views and inner main window controls"); context->dialog = new DialogManager; InitContents(); OPT_SUB("Video/Detached/Enabled", &FrameMain::OnVideoDetach, this, agi::signal::_1); StartupLog("Complete context initialization"); context->videoController->SetContext(context.get()); StartupLog("Set up drag/drop target"); SetDropTarget(new AegisubFileDropTarget(this)); StartupLog("Load default file"); context->subsController->Close(); StartupLog("Display main window"); AddFullScreenButton(this); Show(); SetDisplayMode(1, 1); // Version checker StartupLog("Possibly perform automatic updates check"); if (OPT_GET("App/First Start")->GetBool()) { OPT_SET("App/First Start")->SetBool(false); #ifdef WITH_UPDATE_CHECKER int result = wxMessageBox(_("Do you want Aegisub to check for updates whenever it starts? You can still do it manually via the Help menu."),_("Check for updates?"), wxYES_NO | wxCENTER); OPT_SET("App/Auto/Check For Updates")->SetBool(result == wxYES); config::opt->Flush(); #endif } #ifdef WITH_UPDATE_CHECKER PerformVersionCheck(false); #endif Bind(FILE_LIST_DROPPED, &FrameMain::OnFilesDropped, this); StartupLog("Leaving FrameMain constructor"); }