2006-12-28 23:31:33 +01:00
|
|
|
// Copyright (c) 2006, 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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-12-28 23:31:33 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file dialog_automation.cpp
|
|
|
|
/// @brief Manage loaded Automation scripts
|
|
|
|
/// @ingroup secondary_ui
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
|
2008-01-16 19:29:29 +01:00
|
|
|
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
2006-12-28 23:31:33 +01:00
|
|
|
#include <wx/filedlg.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#include <wx/filename.h>
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/log.h>
|
|
|
|
#include <wx/msgdlg.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#endif
|
2006-12-28 23:31:33 +01:00
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "auto4_base.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "compat.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "dialog_automation.h"
|
|
|
|
#include "help_button.h"
|
|
|
|
#include "libresrc/libresrc.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "utils.h"
|
2006-12-28 23:31:33 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param parent
|
|
|
|
/// @param _local_manager
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
DialogAutomation::DialogAutomation(wxWindow *parent, Automation4::ScriptManager *_local_manager)
|
|
|
|
: wxDialog(parent, -1, _("Automation Manager"), wxDefaultPosition, wxDefaultSize)
|
|
|
|
{
|
2007-07-05 01:09:40 +02:00
|
|
|
// Set icon
|
2009-07-25 06:49:59 +02:00
|
|
|
SetIcon(BitmapToIcon(GETIMAGE(automation_toolbutton_24)));
|
2007-07-05 01:09:40 +02:00
|
|
|
|
2006-12-28 23:31:33 +01:00
|
|
|
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"));
|
2007-06-17 04:51:11 +02:00
|
|
|
close_button = new wxButton(this, wxID_CANCEL, _("&Close"));
|
2006-12-28 23:31:33 +01:00
|
|
|
|
|
|
|
// add headers to list view
|
2011-09-28 21:43:11 +02:00
|
|
|
list->InsertColumn(0, "", wxLIST_FORMAT_CENTER, 20);
|
2006-12-28 23:31:33 +01:00
|
|
|
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);
|
2011-09-28 21:43:11 +02:00
|
|
|
button_box->Add(new HelpButton(this,"Automation Manager"), 0);
|
2006-12-28 23:31:33 +01:00
|
|
|
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);
|
2009-09-02 10:21:09 +02:00
|
|
|
main_box->Add(button_box, 0, wxEXPAND|(wxALL&~wxTOP), 5);
|
2006-12-28 23:31:33 +01:00
|
|
|
main_box->SetSizeHints(this);
|
|
|
|
SetSizer(main_box);
|
|
|
|
Center();
|
|
|
|
|
2007-07-05 17:23:31 +02:00
|
|
|
// 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();
|
|
|
|
|
2006-12-28 23:31:33 +01:00
|
|
|
RebuildList();
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::RebuildList()
|
|
|
|
{
|
|
|
|
script_info.clear();
|
|
|
|
list->DeleteAllItems();
|
|
|
|
|
|
|
|
// fill the list view
|
2007-01-18 09:15:02 +01:00
|
|
|
const std::vector<Automation4::Script*> &local_scripts = local_manager->GetScripts();
|
|
|
|
for (std::vector<Automation4::Script*>::const_iterator i = local_scripts.begin(); i != local_scripts.end(); ++i) {
|
2006-12-28 23:31:33 +01:00
|
|
|
ExtraScriptInfo ei;
|
|
|
|
ei.script = *i;
|
2007-01-18 09:15:02 +01:00
|
|
|
ei.is_global = false;
|
2006-12-28 23:31:33 +01:00
|
|
|
AddScript(ei);
|
|
|
|
}
|
2007-01-18 09:15:02 +01:00
|
|
|
const std::vector<Automation4::Script*> &global_scripts = global_manager->GetScripts();
|
|
|
|
for (std::vector<Automation4::Script*>::const_iterator i = global_scripts.begin(); i != global_scripts.end(); ++i) {
|
2006-12-28 23:31:33 +01:00
|
|
|
ExtraScriptInfo ei;
|
|
|
|
ei.script = *i;
|
2007-01-18 09:15:02 +01:00
|
|
|
ei.is_global = true;
|
2006-12-28 23:31:33 +01:00
|
|
|
AddScript(ei);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param ei
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::AddScript(ExtraScriptInfo &ei)
|
|
|
|
{
|
|
|
|
script_info.push_back(ei);
|
|
|
|
|
|
|
|
wxListItem itm;
|
|
|
|
if (ei.is_global) {
|
2011-09-28 21:43:11 +02:00
|
|
|
itm.SetText("G");
|
2006-12-28 23:31:33 +01:00
|
|
|
} else {
|
2011-09-28 21:43:11 +02:00
|
|
|
itm.SetText("L");
|
2006-12-28 23:31:33 +01:00
|
|
|
}
|
|
|
|
itm.SetData((int)script_info.size()-1);
|
|
|
|
itm.SetId(list->GetItemCount());
|
|
|
|
int i = list->InsertItem(itm);
|
|
|
|
list->SetItem(i, 1, ei.script->GetName());
|
|
|
|
list->SetItem(i, 2, wxFileName(ei.script->GetFilename()).GetFullName());
|
|
|
|
list->SetItem(i, 3, ei.script->GetDescription());
|
|
|
|
if (ei.script->GetLoadedState() == false) {
|
|
|
|
list->SetItemBackgroundColour(i, wxColour(255,128,128));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::UpdateDisplay()
|
|
|
|
{
|
|
|
|
int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
bool selected = i >= 0;
|
|
|
|
bool global = true;
|
|
|
|
if (selected) {
|
|
|
|
const ExtraScriptInfo &ei = script_info[list->GetItemData(i)];
|
|
|
|
global = ei.is_global;
|
|
|
|
}
|
|
|
|
add_button->Enable(true);
|
|
|
|
remove_button->Enable(selected && !global);
|
|
|
|
reload_button->Enable(selected);
|
|
|
|
info_button->Enable(true);
|
|
|
|
reload_autoload_button->Enable(true);
|
|
|
|
close_button->Enable(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(DialogAutomation, wxDialog)
|
|
|
|
EVT_BUTTON(Automation_Add_Script,DialogAutomation::OnAdd)
|
|
|
|
EVT_BUTTON(Automation_Remove_Script,DialogAutomation::OnRemove)
|
|
|
|
EVT_BUTTON(Automation_Reload_Script,DialogAutomation::OnReload)
|
|
|
|
EVT_BUTTON(Automation_Show_Info,DialogAutomation::OnInfo)
|
|
|
|
EVT_BUTTON(Automation_Reload_Autoload,DialogAutomation::OnReloadAutoload)
|
|
|
|
EVT_LIST_ITEM_SELECTED(Automation_List_Box,DialogAutomation::OnSelectionChange)
|
|
|
|
EVT_LIST_ITEM_DESELECTED(Automation_List_Box,DialogAutomation::OnSelectionChange)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param evt
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::OnAdd(wxCommandEvent &evt)
|
|
|
|
{
|
|
|
|
// build filename filter list
|
2007-01-18 09:15:02 +01:00
|
|
|
wxString fnfilter, catchall;
|
2006-12-28 23:31:33 +01:00
|
|
|
const std::vector<Automation4::ScriptFactory*> &factories = Automation4::ScriptFactory::GetFactories();
|
|
|
|
for (int i = 0; i < (int)factories.size(); i++) {
|
|
|
|
const Automation4::ScriptFactory *fact = factories[i];
|
|
|
|
if (fact->GetEngineName().IsEmpty() || fact->GetFilenamePattern().IsEmpty())
|
|
|
|
continue;
|
2011-09-28 21:43:48 +02:00
|
|
|
fnfilter = wxString::Format("%s%s scripts (%s)|%s|", fnfilter, fact->GetEngineName(), fact->GetFilenamePattern(), fact->GetFilenamePattern());
|
2011-09-28 21:43:11 +02:00
|
|
|
catchall << fact->GetFilenamePattern() << ";";
|
2006-12-28 23:31:33 +01:00
|
|
|
}
|
|
|
|
#ifdef __WINDOWS__
|
2011-09-28 21:43:11 +02:00
|
|
|
fnfilter += "All files|*.*";
|
2006-12-28 23:31:33 +01:00
|
|
|
#else
|
2011-09-28 21:43:11 +02:00
|
|
|
fnfilter += "All files|*";
|
2006-12-28 23:31:33 +01:00
|
|
|
#endif
|
2007-01-18 09:15:02 +01:00
|
|
|
if (!catchall.IsEmpty()) {
|
|
|
|
catchall.RemoveLast();
|
|
|
|
}
|
|
|
|
if (factories.size() > 1) {
|
2011-09-28 21:43:11 +02:00
|
|
|
fnfilter = "All supported scripts|" + catchall + "|" + fnfilter;
|
2007-01-18 09:15:02 +01:00
|
|
|
}
|
2006-12-28 23:31:33 +01:00
|
|
|
|
2010-05-21 03:13:36 +02:00
|
|
|
wxString fname = wxFileSelector(_("Add Automation script"), lagi_wxString(OPT_GET("Path/Last/Automation")->GetString()), wxEmptyString, wxEmptyString, fnfilter, wxFD_OPEN|wxFD_FILE_MUST_EXIST, this);
|
2006-12-28 23:31:33 +01:00
|
|
|
|
|
|
|
if (!fname.IsEmpty()) {
|
|
|
|
|
|
|
|
wxFileName fnpath(fname);
|
2010-05-21 03:13:36 +02:00
|
|
|
OPT_SET("Path/Last/Automation")->SetString(STD_STR(fnpath.GetPath()));
|
2006-12-28 23:31:33 +01:00
|
|
|
|
|
|
|
// TODO: make sure each script is only loaded once. check in both local and global managers!!
|
|
|
|
// it doesn't break for macros, but will for export filters, and maybe for file formats,
|
|
|
|
// and makes for confusion in the UI anyhow
|
|
|
|
|
|
|
|
try {
|
|
|
|
ExtraScriptInfo ei;
|
2007-06-10 03:49:11 +02:00
|
|
|
ei.script = Automation4::ScriptFactory::CreateFromFile(fname, false);
|
2006-12-28 23:31:33 +01:00
|
|
|
local_manager->Add(ei.script);
|
|
|
|
ei.is_global = false;
|
|
|
|
AddScript(ei);
|
|
|
|
}
|
2011-09-28 21:43:11 +02:00
|
|
|
catch (const char *e) {
|
2006-12-28 23:31:33 +01:00
|
|
|
wxLogError(e);
|
|
|
|
}
|
|
|
|
catch (...) {
|
2011-09-28 21:43:11 +02:00
|
|
|
wxLogError("Unknown error loading script");
|
2006-12-28 23:31:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param evt
|
|
|
|
/// @return
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::OnRemove(wxCommandEvent &evt)
|
|
|
|
{
|
|
|
|
int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (i < 0) return;
|
|
|
|
const ExtraScriptInfo &ei = script_info[list->GetItemData(i)];
|
|
|
|
if (ei.is_global) return;
|
|
|
|
list->DeleteItem(i);
|
|
|
|
local_manager->Remove(ei.script);
|
|
|
|
// don't bother doing anything in script_info, it's relatively short-lived, and having any indexes change would break stuff
|
|
|
|
list->Select(i);
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param evt
|
|
|
|
/// @return
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::OnReload(wxCommandEvent &evt)
|
|
|
|
{
|
|
|
|
int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (i < 0) return;
|
|
|
|
const ExtraScriptInfo &ei = script_info[list->GetItemData(i)];
|
|
|
|
|
|
|
|
try {
|
|
|
|
ei.script->Reload();
|
|
|
|
}
|
2011-09-28 21:43:11 +02:00
|
|
|
catch (const char *e) {
|
|
|
|
wxMessageBox(e, "Error reloading Automation script", wxOK|wxICON_ERROR, this);
|
2006-12-28 23:31:33 +01:00
|
|
|
}
|
|
|
|
catch (...) {
|
2011-09-28 21:43:11 +02:00
|
|
|
wxMessageBox("An unknown error occurred reloading Automation script.", "Error reloading Automation script", wxOK|wxICON_ERROR, this);
|
2006-12-28 23:31:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
list->SetItem(i, 1, ei.script->GetName());
|
|
|
|
list->SetItem(i, 2, wxFileName(ei.script->GetFilename()).GetFullName());
|
|
|
|
list->SetItem(i, 3, ei.script->GetDescription());
|
|
|
|
if (ei.script->GetLoadedState() == false) {
|
|
|
|
list->SetItemBackgroundColour(i, wxColour(255,128,128));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param evt
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::OnInfo(wxCommandEvent &evt)
|
|
|
|
{
|
|
|
|
int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
ExtraScriptInfo *ei = 0;
|
|
|
|
if (i >= 0)
|
|
|
|
ei = &script_info[list->GetItemData(i)];
|
|
|
|
|
|
|
|
wxString info = wxString::Format(
|
|
|
|
_("Total scripts loaded: %d\nGlobal scripts loaded: %d\nLocal scripts loaded: %d\n\n"),
|
|
|
|
local_manager->GetScripts().size() + global_manager->GetScripts().size(),
|
|
|
|
global_manager->GetScripts().size(),
|
|
|
|
local_manager->GetScripts().size());
|
|
|
|
|
|
|
|
info += _("Scripting engines installed:\n");
|
|
|
|
const std::vector<Automation4::ScriptFactory*> &factories = Automation4::ScriptFactory::GetFactories();
|
2010-06-11 04:24:59 +02:00
|
|
|
for (std::vector<Automation4::ScriptFactory*>::const_iterator c = factories.begin(); c != factories.end(); ++c) {
|
2011-09-28 21:43:48 +02:00
|
|
|
info += wxString::Format("- %s (%s)\n", (*c)->GetEngineName(), (*c)->GetFilenamePattern());
|
2006-12-28 23:31:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ei) {
|
2007-08-22 15:03:37 +02:00
|
|
|
info += wxString::Format(_("\nScript info:\nName: %s\nDescription: %s\nAuthor: %s\nVersion: %s\nFull path: %s\nState: %s\n\nFeatures provided by script:\n"),
|
2011-09-28 21:43:48 +02:00
|
|
|
ei->script->GetName(),
|
|
|
|
ei->script->GetDescription(),
|
|
|
|
ei->script->GetAuthor(),
|
|
|
|
ei->script->GetVersion(),
|
|
|
|
ei->script->GetFilename(),
|
2007-01-19 12:47:37 +01:00
|
|
|
ei->script->GetLoadedState() ? _("Correctly loaded") : _("Failed to load"));
|
2007-08-22 15:03:37 +02:00
|
|
|
for (std::vector<Automation4::Feature*>::iterator f = ei->script->GetFeatures().begin(); f != ei->script->GetFeatures().end(); ++f) {
|
|
|
|
switch ((*f)->GetClass()) {
|
|
|
|
case Automation4::SCRIPTFEATURE_MACRO:
|
|
|
|
info += _(" Macro: "); break;
|
|
|
|
case Automation4::SCRIPTFEATURE_FILTER:
|
|
|
|
info += _(" Export filter: "); break;
|
|
|
|
case Automation4::SCRIPTFEATURE_SUBFORMAT:
|
|
|
|
info += _(" Subtitle format handler: "); break;
|
|
|
|
default:
|
2011-09-28 21:43:11 +02:00
|
|
|
info += " Unknown class: "; break;
|
2007-08-22 15:03:37 +02:00
|
|
|
}
|
2011-09-28 21:43:11 +02:00
|
|
|
info += (*f)->GetName() + "\n";
|
2007-08-22 15:03:37 +02:00
|
|
|
}
|
2006-12-28 23:31:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
wxMessageBox(info, _("Automation Script Info"));
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param evt
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::OnReloadAutoload(wxCommandEvent &evt)
|
|
|
|
{
|
|
|
|
global_manager->Reload();
|
|
|
|
RebuildList();
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param evt
|
|
|
|
///
|
2006-12-28 23:31:33 +01:00
|
|
|
void DialogAutomation::OnSelectionChange(wxListEvent &evt)
|
|
|
|
{
|
|
|
|
UpdateDisplay();
|
|
|
|
}
|