コード例 #1
0
void NewFromTemplateDlg::OnEditGlobalScript(cb_unused wxCommandEvent& event)
{
    cbMessageBox(_("Any changes you make to the global wizard registration script will "
                    "take effect after you restart Code::Blocks."),
                    _("Information"), wxICON_INFORMATION, this);
    EditScript(_T("config.script"));
}
コード例 #2
0
void DialogAutomationManager::OnEdit(wxCommandEvent &event)
{
	int selid = script_list->GetFirstSelected();
	AssAutomationFilter *filter = (AssAutomationFilter*)script_list->GetItemData(selid);
	AutomationScript *script = filter->GetScript();
	EditScript(script);
}
コード例 #3
0
void NewFromTemplateDlg::OnEditScript(cb_unused wxCommandEvent& event)
{
    wxListCtrl* list = GetVisibleListCtrl();
    if (!list)
        return;
    long index = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    if (index == -1)
        return;
    ListItemData* data = (ListItemData*)list->GetItemData(index);
    cbWizardPlugin* wiz = data->plugin;
    EditScript(wiz->GetScriptFilename(data->wizPluginIndex));
}
コード例 #4
0
void DialogAutomationManager::OnCreate(wxCommandEvent &event)
{
	wxString path = Options.AsText(_T("Last open automation path"));	
	wxString sfnames = wxFileSelector(_("Create Automation script"), path, _T("*.lua"), _T("lua"), _T("Automation Lua scripts (*.lua)|*.lua|All files (*.*)|*.*"), wxSAVE|wxOVERWRITE_PROMPT, this);
	if (sfnames.empty()) return;
	Options.SetText(_T("Last open automation path"), sfnames);
	
	wxFileName sfname(sfnames);

	if (sfname.FileExists()) {
		if (!wxRemoveFile(sfnames)) {
			wxMessageBox(_T("The old file by this name could not be deleted."), _T("Error creating Automation script"), wxOK|wxICON_ERROR, this);
			return;
		}
	}

	wxTextFile file;
	file.Create(sfnames);
	file.AddLine(_T("-- Aegisub Automation script"));
	file.AddLine(_T(""));
	file.AddLine(_T("-- You should change these two lines"));
	file.AddLine(wxString::Format(_T("name = \"%s\""), sfname.GetName().c_str()));
	file.AddLine(_T("description = \"New Automation script\""));
	file.AddLine(_T(""));
	file.AddLine(_T("-- Enter the configuration settings here, if needed. Refer to the manual for details"));
	file.AddLine(_T("configuration = {}"));
	file.AddLine(_T(""));
	file.AddLine(_T("-- You should NOT change this line!"));
	file.AddLine(_T("version, kind = 3, 'basic_ass'"));
	file.AddLine(_T(""));
	file.AddLine(_T("-- You should write your script in this function (don't change its name!)"));
	file.AddLine(_T("function process_lines(meta, styles, lines, config)"));
	file.AddLine(_T("\t-- For now, just return the subtitles as-is, no changes"));
	file.AddLine(_T("\treturn lines"));
	file.AddLine(_T("end"));
	file.AddLine(_T(""));
	file.Write(wxTextFileType_None, wxConvUTF8);
	file.Close();

	AutomationScriptFile *sfile = AutomationScriptFile::CreateFromFile(sfnames);
	AutomationScript *script = new AutomationScript(sfile);
	AssAutomationFilter *filter = new AssAutomationFilter(script);
	AddScriptToList(filter);
	delete sfile;

	EditScript(script);
}