Remove the ability for Aegisub to do its own file type associations. It's something the installer should be doing.

Originally committed to SVN as r3757.
This commit is contained in:
Niels Martin Hansen 2009-11-03 02:42:19 +00:00
parent 88d6c783b1
commit 129585a2f8
10 changed files with 0 additions and 317 deletions

View File

@ -1031,14 +1031,6 @@
RelativePath="..\..\src\dialog_about.h" RelativePath="..\..\src\dialog_about.h"
> >
</File> </File>
<File
RelativePath="..\..\src\dialog_associations.cpp"
>
</File>
<File
RelativePath="..\..\src\dialog_associations.h"
>
</File>
<File <File
RelativePath="..\..\src\dialog_attachments.cpp" RelativePath="..\..\src\dialog_attachments.cpp"
> >

View File

@ -166,7 +166,6 @@ EXTRA_aegisub_2_2_SOURCES = \
auto4_lua_dialog.cpp \ auto4_lua_dialog.cpp \
auto4_lua_scriptreader.cpp \ auto4_lua_scriptreader.cpp \
avisynth_wrap.cpp \ avisynth_wrap.cpp \
dialog_associations.cpp \
setup.cpp \ setup.cpp \
spellchecker_hunspell.cpp \ spellchecker_hunspell.cpp \
subtitle_format_prs.cpp \ subtitle_format_prs.cpp \

View File

@ -1,154 +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/
//
// $Id$
/// @file dialog_associations.cpp
/// @brief Configure file associations for Aegisub
/// @ingroup configuration_ui
///
///////////
// Headers
#include "config.h"
#ifndef AGI_PRE
#include <wx/button.h>
#include <wx/config.h>
#include <wx/sizer.h>
#endif
#include "dialog_associations.h"
/// @brief Constructor
/// @param parent
///
DialogAssociations::DialogAssociations (wxWindow *parent)
: wxDialog (parent,-1,_("Associate extensions"),wxDefaultPosition,wxDefaultSize)
{
// List box
wxArrayString choices;
choices.Add(_T("Advanced Substation Alpha (.ass)"));
choices.Add(_T("Substation Alpha (.ssa)"));
choices.Add(_T("SubRip (.srt)"));
choices.Add(_T("MicroDVD (.sub)"));
choices.Add(_T("MPEG-4 Timed Text (.ttxt)"));
ListBox = new wxCheckListBox(this,-1,wxDefaultPosition,wxSize(200,80), choices);
ListBox->Check(0,CheckAssociation(_T("ass")));
ListBox->Check(1,CheckAssociation(_T("ssa")));
ListBox->Check(2,CheckAssociation(_T("srt")));
ListBox->Check(3,CheckAssociation(_T("sub")));
ListBox->Check(4,CheckAssociation(_T("ttxt")));
// Label and list sizer
wxStaticText *label = new wxStaticText(this,-1,_("Please select the formats you want to\nassociate with Aegisub:"),wxDefaultPosition,wxDefaultSize);
wxSizer *ListSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Associations"));
ListSizer->Add(label,0,0,0);
ListSizer->Add(ListBox,0,wxTOP,5);
// Buttons
wxButton *ok = new wxButton(this, wxID_OK);
wxSizer *ButtonSizer = new wxBoxSizer(wxHORIZONTAL);
ButtonSizer->AddStretchSpacer(1);
ButtonSizer->Add(ok,0,0,0);
// Main sizer
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
MainSizer->Add(ListSizer,0,wxLEFT | wxRIGHT,5);
MainSizer->Add(ButtonSizer,0,wxALL | wxEXPAND,5);
SetSizer(MainSizer);
MainSizer->SetSizeHints(this);
Center();
}
/// @brief Destructor
///
DialogAssociations::~DialogAssociations() {
}
/// @brief Associates a type with Aegisub
/// @param type
///
void DialogAssociations::AssociateType(wxString type) {
type.Lower();
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\.") + type);
if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("Aegisub"));
delete key;
}
/// @brief Checks if a type is associated with Aegisub
/// @param type
/// @return
///
bool DialogAssociations::CheckAssociation(wxString type) {
type.Lower();
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\.") + type);
if (!key->Exists()) {
delete key;
return false;
}
else {
wxString value;
key->QueryValue(_T(""),value);
delete key;
return (value == _T("Aegisub"));
}
}
///////////////
// Event table
BEGIN_EVENT_TABLE(DialogAssociations, wxDialog)
EVT_BUTTON(wxID_OK,DialogAssociations::OnOK)
END_EVENT_TABLE()
/// @brief OK pressed
/// @param event
///
void DialogAssociations::OnOK(wxCommandEvent &event) {
if (ListBox->IsChecked(0)) AssociateType(_T("ass"));
if (ListBox->IsChecked(1)) AssociateType(_T("ssa"));
if (ListBox->IsChecked(2)) AssociateType(_T("srt"));
if (ListBox->IsChecked(3)) AssociateType(_T("sub"));
if (ListBox->IsChecked(4)) AssociateType(_T("ttxt"));
event.Skip();
}

View File

@ -1,71 +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/
//
// $Id$
/// @file dialog_associations.h
/// @see dialog_associations.cpp
/// @ingroup configuration_ui
///
///////////
// Headers
#ifndef AGI_PRE
#include <wx/dialog.h>
#include <wx/checklst.h>
#include <wx/slider.h>
#endif
/// DOCME
/// @class DialogAssociations
/// @brief DOCME
///
/// DOCME
class DialogAssociations : public wxDialog {
private:
/// DOCME
wxCheckListBox *ListBox;
void OnOK(wxCommandEvent &event);
public:
DialogAssociations(wxWindow *parent);
~DialogAssociations();
static bool CheckAssociation(wxString type);
static void AssociateType(wxString type);
DECLARE_EVENT_TABLE()
};

View File

@ -541,9 +541,6 @@ void FrameMain::InitMenu() {
viewMenu = new wxMenu(); viewMenu = new wxMenu();
AppendBitmapMenuItem(viewMenu,Menu_View_Language, _T("&Language..."), _("Select Aegisub interface language"), GETIMAGE(languages_menu_16)); AppendBitmapMenuItem(viewMenu,Menu_View_Language, _T("&Language..."), _("Select Aegisub interface language"), GETIMAGE(languages_menu_16));
AppendBitmapMenuItem(viewMenu,Menu_Tools_Options, MakeHotkeyText(_("&Options..."), _T("Options")), _("Configure Aegisub"), GETIMAGE(options_button_16)); AppendBitmapMenuItem(viewMenu,Menu_Tools_Options, MakeHotkeyText(_("&Options..."), _T("Options")), _("Configure Aegisub"), GETIMAGE(options_button_16));
#ifdef WIN32
AppendBitmapMenuItem(viewMenu,Menu_View_Associations, _("&Associations..."), _("Associate file types with Aegisub"), GETIMAGE(blank_button_16));
#endif
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
viewMenu->AppendRadioItem(Menu_View_Subs, _("Subs Only View"), _("Display subtitles only")); viewMenu->AppendRadioItem(Menu_View_Subs, _("Subs Only View"), _("Display subtitles only"));
viewMenu->AppendRadioItem(Menu_View_Video, _("Video+Subs View"), _("Display video and subtitles only")); viewMenu->AppendRadioItem(Menu_View_Video, _("Video+Subs View"), _("Display video and subtitles only"));

View File

@ -250,7 +250,6 @@ private:
#endif #endif
void OnChooseLanguage (wxCommandEvent &event); void OnChooseLanguage (wxCommandEvent &event);
void OnPickAssociations (wxCommandEvent &event);
void OnViewStandard (wxCommandEvent &event); void OnViewStandard (wxCommandEvent &event);
void OnViewVideo (wxCommandEvent &event); void OnViewVideo (wxCommandEvent &event);
void OnViewAudio (wxCommandEvent &event); void OnViewAudio (wxCommandEvent &event);
@ -590,9 +589,6 @@ enum {
/// DOCME /// DOCME
Menu_View_Language, Menu_View_Language,
/// DOCME
Menu_View_Associations,
/// DOCME /// DOCME
Menu_View_Standard, Menu_View_Standard,

View File

@ -58,7 +58,6 @@
#endif #endif
#include "charset_conv.h" #include "charset_conv.h"
#include "dialog_about.h" #include "dialog_about.h"
#include "dialog_associations.h"
#include "dialog_attachments.h" #include "dialog_attachments.h"
#include "dialog_automation.h" #include "dialog_automation.h"
#include "dialog_dummy_video.h" #include "dialog_dummy_video.h"
@ -202,7 +201,6 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame)
EVT_MENU(Menu_Help_About, FrameMain::OnAbout) EVT_MENU(Menu_Help_About, FrameMain::OnAbout)
EVT_MENU(Menu_View_Language, FrameMain::OnChooseLanguage) EVT_MENU(Menu_View_Language, FrameMain::OnChooseLanguage)
EVT_MENU(Menu_View_Associations, FrameMain::OnPickAssociations)
EVT_MENU(Menu_View_Standard, FrameMain::OnViewStandard) EVT_MENU(Menu_View_Standard, FrameMain::OnViewStandard)
EVT_MENU(Menu_View_Audio, FrameMain::OnViewAudio) EVT_MENU(Menu_View_Audio, FrameMain::OnViewAudio)
EVT_MENU(Menu_View_Video, FrameMain::OnViewVideo) EVT_MENU(Menu_View_Video, FrameMain::OnViewVideo)
@ -1926,18 +1924,6 @@ void FrameMain::OnChooseLanguage (wxCommandEvent &event) {
/// @brief Pick associations
/// @param event
///
void FrameMain::OnPickAssociations(wxCommandEvent &event) {
#ifdef WIN32
DialogAssociations diag(NULL);
diag.ShowModal();
#endif
}
/// @brief View standard /// @brief View standard
/// @param event /// @param event
/// @return /// @return

View File

@ -60,7 +60,6 @@
#include "auto4_base.h" #include "auto4_base.h"
#endif #endif
#include "charset_conv.h" #include "charset_conv.h"
#include "dialog_associations.h"
#include "export_framerate.h" #include "export_framerate.h"
#include "frame_main.h" #include "frame_main.h"
#include "hotkeys.h" #include "hotkeys.h"
@ -228,13 +227,6 @@ bool AegisubApp::OnInit() {
StartupLog(_T("Prepare export filters")); StartupLog(_T("Prepare export filters"));
AssExportFilterChain::PrepareFilters(); AssExportFilterChain::PrepareFilters();
// Set association
#ifndef _DEBUG
StartupLog(_T("Install file type associations"));
if (!Options.AsBool(_T("Local config")))
RegistryAssociate();
#endif
// Get parameter subs // Get parameter subs
StartupLog(_T("Parse command line")); StartupLog(_T("Parse command line"));
wxArrayString subs; wxArrayString subs;
@ -448,56 +440,6 @@ int AegisubApp::OnRun() {
/// @brief Registry program to filetypes
/// @note On UNIX this is handled by desktop/.
/// @todo Add something for OSX?
void AegisubApp::RegistryAssociate () {
#if defined(__WINDOWS__)
// Command to open with this
wxString command;
wxStandardPaths stand;
wxString fullPath = stand.GetExecutablePath();
command = _T("\"") + fullPath + _T("\" \"%1\"");
// Main program association
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("Aegisub Subtitle Script"));
delete key;
key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\DefaultIcon"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),fullPath);
delete key;
key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("open"));
delete key;
key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell\\Open"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("&Open with Aegisub"));
delete key;
key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell\\Open\\Command"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),command);
delete key;
// Check associations
if (Options.AsBool(_T("Show associations"))) {
bool gotAll = DialogAssociations::CheckAssociation(_T("ass")) && DialogAssociations::CheckAssociation(_T("ssa")) &&
DialogAssociations::CheckAssociation(_T("srt")) && DialogAssociations::CheckAssociation(_T("sub")) &&
DialogAssociations::CheckAssociation(_T("ttxt"));
if (!gotAll) {
DialogAssociations diag(NULL);
diag.ShowModal();
Options.SetBool(_T("Show associations"),false);
Options.Save();
}
}
#endif
}
/// @brief Open URL /// @brief Open URL
/// @param url /// @param url
/// ///

View File

@ -90,9 +90,6 @@ public:
static AegisubApp* Get() { return (AegisubApp*) wxTheApp; } static AegisubApp* Get() { return (AegisubApp*) wxTheApp; }
static void OpenURL(wxString url); static void OpenURL(wxString url);
void RegistryAssociate();
void AssociateType(wxString type);
bool OnInit(); bool OnInit();
int OnExit(); int OnExit();
int OnRun(); int OnRun();

View File

@ -348,7 +348,6 @@ void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) {
SetBool(_T("Shift Times Direction"),true); SetBool(_T("Shift Times Direction"),true);
SetInt(_T("Tips current"),0); SetInt(_T("Tips current"),0);
SetBool(_T("Show associations"),true,1700);
SetBool(_T("Maximized"),false); SetBool(_T("Maximized"),false);
SetBool(_T("Find Match Case"),false); SetBool(_T("Find Match Case"),false);