mirror of https://github.com/odrling/Aegisub
Add super secret WITH_STARTUPLOG define, if enabled it causes insane amounts of message box spam during startup. Currently only implemented on Windows and should be disabled for almost all conceivable purposes.
Originally committed to SVN as r3051.
This commit is contained in:
parent
769f61eaf3
commit
ac18b4889b
|
@ -82,12 +82,20 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WITH_STARTUPLOG
|
||||||
|
#define StartupLog(a) MessageBox(0, a, _T("Aegisub startup log"), 0)
|
||||||
|
#else
|
||||||
|
#define StartupLog(a)
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// FrameMain constructor
|
// FrameMain constructor
|
||||||
|
|
||||||
FrameMain::FrameMain (wxArrayString args)
|
FrameMain::FrameMain (wxArrayString args)
|
||||||
: wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
: wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
||||||
{
|
{
|
||||||
|
StartupLog(_T("Entering FrameMain constructor"));
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
/* XXX HACK XXX
|
/* XXX HACK XXX
|
||||||
* Gtk just got initialized. And if we're using the SCIM IME,
|
* Gtk just got initialized. And if we're using the SCIM IME,
|
||||||
|
@ -102,6 +110,7 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
// Set application's frame
|
// Set application's frame
|
||||||
AegisubApp::Get()->frame = this;
|
AegisubApp::Get()->frame = this;
|
||||||
|
|
||||||
|
StartupLog(_T("Create log window"));
|
||||||
LogWindow = new wxLogWindow(this, _T("Aegisub log window"), false);
|
LogWindow = new wxLogWindow(this, _T("Aegisub log window"), false);
|
||||||
|
|
||||||
// Initialize flags
|
// Initialize flags
|
||||||
|
@ -110,24 +119,31 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
blockAudioLoad = false;
|
blockAudioLoad = false;
|
||||||
blockAudioLoad = false;
|
blockAudioLoad = false;
|
||||||
|
|
||||||
|
StartupLog(_T("Install PNG handler"));
|
||||||
// Create PNG handler
|
// Create PNG handler
|
||||||
wxPNGHandler *png = new wxPNGHandler;
|
wxPNGHandler *png = new wxPNGHandler;
|
||||||
wxImage::AddHandler(png);
|
wxImage::AddHandler(png);
|
||||||
|
|
||||||
// Storage for subs-file-local scripts
|
// Storage for subs-file-local scripts
|
||||||
#ifdef WITH_AUTOMATION
|
#ifdef WITH_AUTOMATION
|
||||||
|
StartupLog(_T("Create local Automation script manager"));
|
||||||
local_scripts = new Automation4::ScriptManager();
|
local_scripts = new Automation4::ScriptManager();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create menu and tool bars
|
// Create menu and tool bars
|
||||||
|
StartupLog(_T("Apply saved Maximized state"));
|
||||||
if (Options.AsBool(_T("Maximized"))) Maximize(true);
|
if (Options.AsBool(_T("Maximized"))) Maximize(true);
|
||||||
|
StartupLog(_T("Initialize toolbar"));
|
||||||
InitToolbar();
|
InitToolbar();
|
||||||
|
StartupLog(_T("Initialize menu bar"));
|
||||||
InitMenu();
|
InitMenu();
|
||||||
|
|
||||||
// Create status bar
|
// Create status bar
|
||||||
|
StartupLog(_T("Create status bar"));
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
|
|
||||||
// Set icon
|
// Set icon
|
||||||
|
StartupLog(_T("Set icon"));
|
||||||
SetIcon(wxICON(wxicon));
|
SetIcon(wxICON(wxicon));
|
||||||
|
|
||||||
// Contents
|
// Contents
|
||||||
|
@ -135,7 +151,9 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
showAudio = true;
|
showAudio = true;
|
||||||
detachedVideo = NULL;
|
detachedVideo = NULL;
|
||||||
stylingAssistant = NULL;
|
stylingAssistant = NULL;
|
||||||
|
StartupLog(_T("Initialize inner main window controls"));
|
||||||
InitContents();
|
InitContents();
|
||||||
|
StartupLog(_T("Display main window"));
|
||||||
Show();
|
Show();
|
||||||
|
|
||||||
// Splash screen
|
// Splash screen
|
||||||
|
@ -153,6 +171,7 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
wxSafeYield();
|
wxSafeYield();
|
||||||
|
|
||||||
// Set autosave timer
|
// Set autosave timer
|
||||||
|
StartupLog(_T("Set up Auto Save"));
|
||||||
AutoSave.SetOwner(this,AutoSave_Timer);
|
AutoSave.SetOwner(this,AutoSave_Timer);
|
||||||
int time = Options.AsInt(_T("Auto save every seconds"));
|
int time = Options.AsInt(_T("Auto save every seconds"));
|
||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
|
@ -160,19 +179,24 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set accelerator keys
|
// Set accelerator keys
|
||||||
|
StartupLog(_T("Install hotkeys"));
|
||||||
PreviousFocus = NULL;
|
PreviousFocus = NULL;
|
||||||
SetAccelerators();
|
SetAccelerators();
|
||||||
|
|
||||||
// Set drop target
|
// Set drop target
|
||||||
|
StartupLog(_T("Set up drag/drop target"));
|
||||||
SetDropTarget(new AegisubFileDropTarget(this));
|
SetDropTarget(new AegisubFileDropTarget(this));
|
||||||
|
|
||||||
// Parse arguments
|
// Parse arguments
|
||||||
|
StartupLog(_T("Initialize empty file"));
|
||||||
LoadSubtitles(_T(""));
|
LoadSubtitles(_T(""));
|
||||||
|
StartupLog(_T("Load files specified on command line"));
|
||||||
LoadList(args);
|
LoadList(args);
|
||||||
|
|
||||||
// Version checker
|
// Version checker
|
||||||
// Fails on non-Windows platforms with a crash
|
// Fails on non-Windows platforms with a crash
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
StartupLog(_T("Possibly perform automatic updates check"));
|
||||||
int option = Options.AsInt(_T("Auto check for updates"));
|
int option = Options.AsInt(_T("Auto check for updates"));
|
||||||
if (option == -1) {
|
if (option == -1) {
|
||||||
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);
|
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);
|
||||||
|
@ -188,6 +212,7 @@ FrameMain::FrameMain (wxArrayString args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//ShowFullScreen(true,wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
|
//ShowFullScreen(true,wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
|
||||||
|
StartupLog(_T("Leaving FrameMain constructor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -527,41 +552,51 @@ void FrameMain::InitMenu() {
|
||||||
// Initialize contents
|
// Initialize contents
|
||||||
void FrameMain::InitContents() {
|
void FrameMain::InitContents() {
|
||||||
// Set a background panel
|
// Set a background panel
|
||||||
|
StartupLog(_T("Create background panel"));
|
||||||
Panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
Panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
||||||
|
|
||||||
// Initialize sizers
|
// Initialize sizers
|
||||||
|
StartupLog(_T("Create main sizers"));
|
||||||
MainSizer = new wxBoxSizer(wxVERTICAL);
|
MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
TopSizer = new wxBoxSizer(wxHORIZONTAL);
|
TopSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
BottomSizer = new wxBoxSizer(wxHORIZONTAL);
|
BottomSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
// Video area;
|
// Video area;
|
||||||
|
StartupLog(_T("Create video box"));
|
||||||
videoBox = new VideoBox(Panel, false);
|
videoBox = new VideoBox(Panel, false);
|
||||||
TopSizer->Add(videoBox,0,wxEXPAND,0);
|
TopSizer->Add(videoBox,0,wxEXPAND,0);
|
||||||
videoBox->videoDisplay->zoomBox = ZoomBox;
|
videoBox->videoDisplay->zoomBox = ZoomBox;
|
||||||
|
|
||||||
// Subtitles area
|
// Subtitles area
|
||||||
|
StartupLog(_T("Create subtitles grid"));
|
||||||
SubsBox = new SubtitlesGrid(this,Panel,-1,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid"));
|
SubsBox = new SubtitlesGrid(this,Panel,-1,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid"));
|
||||||
BottomSizer->Add(SubsBox,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,0);
|
BottomSizer->Add(SubsBox,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,0);
|
||||||
|
StartupLog(_T("Reset undo stack"));
|
||||||
AssFile::StackReset();
|
AssFile::StackReset();
|
||||||
videoBox->videoSlider->grid = SubsBox;
|
videoBox->videoSlider->grid = SubsBox;
|
||||||
VideoContext::Get()->grid = SubsBox;
|
VideoContext::Get()->grid = SubsBox;
|
||||||
|
StartupLog(_T("Reset video zoom"));
|
||||||
videoBox->videoDisplay->SetZoomPos(Options.AsInt(_T("Video Default Zoom")));
|
videoBox->videoDisplay->SetZoomPos(Options.AsInt(_T("Video Default Zoom")));
|
||||||
Search.grid = SubsBox;
|
Search.grid = SubsBox;
|
||||||
|
|
||||||
// Audio area
|
// Audio area
|
||||||
|
StartupLog(_T("Create audio box"));
|
||||||
audioBox = new AudioBox(Panel);
|
audioBox = new AudioBox(Panel);
|
||||||
audioBox->frameMain = this;
|
audioBox->frameMain = this;
|
||||||
VideoContext::Get()->audio = audioBox->audioDisplay;
|
VideoContext::Get()->audio = audioBox->audioDisplay;
|
||||||
|
|
||||||
// Top sizer
|
// Top sizer
|
||||||
|
StartupLog(_T("Create subtitle editing box"));
|
||||||
EditBox = new SubsEditBox(Panel,SubsBox);
|
EditBox = new SubsEditBox(Panel,SubsBox);
|
||||||
EditBox->audio = audioBox->audioDisplay;
|
EditBox->audio = audioBox->audioDisplay;
|
||||||
|
StartupLog(_T("Arrange controls in sizers"));
|
||||||
ToolSizer = new wxBoxSizer(wxVERTICAL);
|
ToolSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
ToolSizer->Add(audioBox,0,wxEXPAND | wxBOTTOM,5);
|
ToolSizer->Add(audioBox,0,wxEXPAND | wxBOTTOM,5);
|
||||||
ToolSizer->Add(EditBox,1,wxEXPAND,5);
|
ToolSizer->Add(EditBox,1,wxEXPAND,5);
|
||||||
TopSizer->Add(ToolSizer,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5);
|
TopSizer->Add(ToolSizer,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5);
|
||||||
|
|
||||||
// Set sizers/hints
|
// Set sizers/hints
|
||||||
|
StartupLog(_T("Arrange main sizers"));
|
||||||
MainSizer->Add(new wxStaticLine(Panel),0,wxEXPAND | wxALL,0);
|
MainSizer->Add(new wxStaticLine(Panel),0,wxEXPAND | wxALL,0);
|
||||||
MainSizer->Add(TopSizer,0,wxEXPAND | wxALL,0);
|
MainSizer->Add(TopSizer,0,wxEXPAND | wxALL,0);
|
||||||
MainSizer->Add(BottomSizer,1,wxEXPAND | wxALL,0);
|
MainSizer->Add(BottomSizer,1,wxEXPAND | wxALL,0);
|
||||||
|
@ -570,9 +605,13 @@ void FrameMain::InitContents() {
|
||||||
//SetSizer(MainSizer);
|
//SetSizer(MainSizer);
|
||||||
|
|
||||||
// Set display
|
// Set display
|
||||||
|
StartupLog(_T("Set display mode"));
|
||||||
SetDisplayMode(0,0);
|
SetDisplayMode(0,0);
|
||||||
|
StartupLog(_T("Perform layout"));
|
||||||
Layout();
|
Layout();
|
||||||
|
StartupLog(_T("Set focus to edting box"));
|
||||||
EditBox->TextEdit->SetFocus();
|
EditBox->TextEdit->SetFocus();
|
||||||
|
StartupLog(_T("Leaving InitContents"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,16 +76,8 @@
|
||||||
IMPLEMENT_APP(AegisubApp)
|
IMPLEMENT_APP(AegisubApp)
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#ifdef WITH_STARTUPLOG
|
||||||
void StartupLog(const wxString &msg) {
|
#define StartupLog(a) MessageBox(0, a, _T("Aegisub startup log"), 0)
|
||||||
static wxStopWatch clock;
|
|
||||||
wxString nmsg = wxString::Format(_T("Startup: %d - %s\n"), clock.Time(), msg.c_str());
|
|
||||||
#ifdef WIN32
|
|
||||||
OutputDebugStringW(nmsg.wc_str());
|
|
||||||
#else
|
|
||||||
printf(nmsg.mb_str(wxConvLocal));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#define StartupLog(a)
|
#define StartupLog(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue