diff --git a/aegisub/src/agi_pre.h b/aegisub/src/agi_pre.h index 529cbadfe..1e7a8830f 100644 --- a/aegisub/src/agi_pre.h +++ b/aegisub/src/agi_pre.h @@ -149,7 +149,6 @@ #include #include #include -#include #include #include #include diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index 76ebafd0d..205775f77 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include diff --git a/aegisub/src/help_button.cpp b/aegisub/src/help_button.cpp index 5375389bd..ed0effb5d 100644 --- a/aegisub/src/help_button.cpp +++ b/aegisub/src/help_button.cpp @@ -44,7 +44,6 @@ #include #include -#include #include #endif @@ -94,20 +93,22 @@ HelpButton::HelpButton(wxWindow *parent, wxString const& page, wxPoint position, void HelpButton::OpenPage(wxString const& pageID) { init_static(); + wxString page = (*pages)[pageID]; - // Get the file type - wxFileType *type = wxTheMimeTypesManager->GetFileTypeFromExtension("html"); - if (type) { - wxString docsPath = StandardPaths::DecodePath("?data/docs"); -#ifdef __WINDOWS__ - docsPath.Replace("\\","/"); - docsPath = "/" + docsPath; -#endif - wxString path = wxString::Format("file://%s/%s.html",docsPath,page); - if (!wxLaunchDefaultBrowser(path)) - wxMessageBox("Documentation files not found.", "Error", wxOK | wxICON_ERROR); - } + wxFileName docFile(StandardPaths::DecodePath("?data/docs/"), page, "html", wxPATH_NATIVE); + + wxString url; + // If we can read a file by the constructed name, assume we have a local copy of the manual + if (docFile.IsFileReadable()) + // Tested IE8, Firefox 3.5, Safari 4, Chrome 4 and Opera 10 on Windows, they all handle + // various variations of slashes, missing one at the start and using backslashes throughout + // is safe with everything everyone uses. Blame Microsoft. + url = wxString("file://") + docFile.GetFullPath(wxPATH_NATIVE); + else + url = wxString::Format("http://docs.aegisub.org/manual/%s", page); + + wxLaunchDefaultBrowser(url); } void HelpButton::ClearPages() { diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 461f51607..fbdaa76ff 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include diff --git a/aegisub/src/video_box.cpp b/aegisub/src/video_box.cpp index 0c2d9e3c0..70ab65f69 100644 --- a/aegisub/src/video_box.cpp +++ b/aegisub/src/video_box.cpp @@ -38,7 +38,6 @@ #ifndef AGI_PRE #include -#include #include #include #endif