Fixes for building with wx 2.8 without 2.6-compat mode. (Hopefully) more workyness for config dialogs in auto3.

Originally committed to SVN as r876.
This commit is contained in:
Niels Martin Hansen 2007-01-22 19:31:49 +00:00
parent 914671d0a4
commit 2d1fdcdfb9
18 changed files with 45 additions and 37 deletions

View file

@ -430,7 +430,9 @@ void AssDialogue::ParseSRTTags () {
}
// Replace whole tag
Text = Text.substr(0,start) + replaced + Text.substr(end);
//Text = Text.substr(0,start) + replaced + Text.substr(end);
Text = Text.substr(0, start);
Text << replaced << Text.substr(end);
total++;
}
@ -453,7 +455,9 @@ void AssDialogue::ParseSRTTags () {
replaced += _T("}");
// Replace
Text = Text.substr(0,start) + replaced + Text.substr(end);
//Text = Text.substr(0,start) + replaced + Text.substr(end);
Text = Text.substr(0, start);
Text << replaced << Text.substr(end);
total++;
}

View file

@ -405,11 +405,11 @@ void AssStyle::UpdateData() {
final = wxString::Format(_T("Style: %s,%s,%.0f,%s,%s,%s,%s,%d,%d,%d,%d,%.0f,%.0f,%.0f,%.0f,%d,%.0f,%.0f,%i,%i,%i,%i,%i"),
name, font, fontsize,
primary.GetASSFormatted(true,false,true),
secondary.GetASSFormatted(true,false,true),
outline.GetASSFormatted(true,false,true),
shadow.GetASSFormatted(true,false,true),
name.c_str(), font.c_str(), fontsize,
primary.GetASSFormatted(true,false,true).c_str(),
secondary.GetASSFormatted(true,false,true).c_str(),
outline.GetASSFormatted(true,false,true).c_str(),
shadow.GetASSFormatted(true,false,true).c_str(),
(bold? -1 : 0), (italic ? -1 : 0),
(underline?-1:0),(strikeout?-1:0),
scalex,scaley,spacing,angle,

View file

@ -72,7 +72,7 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE
sashSizer->Add(audioDisplay,1,wxEXPAND,0);
Sash->SetSizer(sashSizer);
Sash->SetSashVisible(wxSASH_BOTTOM,true);
Sash->SetSashBorder(wxSASH_BOTTOM,true);
//Sash->SetSashBorder(wxSASH_BOTTOM,true);
Sash->SetMinimumSizeY(50);
audioDisplay->ScrollBar = audioScroll;
audioDisplay->box = this;

View file

@ -594,7 +594,7 @@ continue_invalid_option:
break;
}
}
if (result.Last() == _T('|'))
if (!result.IsEmpty() && result.Last() == _T('|'))
result.RemoveLast();
return result;
}
@ -660,15 +660,19 @@ continue_invalid_option:
throw _T("Script error: No 'process_lines' function provided");
}
// configuration (let the config object do all the loading)
lua_getglobal(L, "configuration");
config = new Auto3ConfigDialog(L, GetName());
lua_pop(L, 2);
}
ScriptConfigDialog* Auto3Filter::GenerateConfigDialog(wxWindow *parent)
{
// configuration (let the config object do all the loading)
lua_getglobal(L, "configuration");
config = new Auto3ConfigDialog(L, GetName());
wxString opthname = wxString::Format(_T("Automation Settings %s"), GetName().c_str());
wxString serialized = AssFile::top->GetScriptInfo(opthname);
config->unserialize(serialized);
return config;
}

View file

@ -500,7 +500,6 @@ namespace Automation4 {
if (!path.IsOk()) continue;
if (path.IsRelative()) continue;
if (!path.DirExists()) continue;
if (include_path.Member(path.GetLongPath())) continue;
include_path.Add(path.GetLongPath());
}
}

View file

@ -107,6 +107,7 @@ namespace Automation4 {
first = true;
databuf = new char[bufsize];
}
LuaScriptReader::~LuaScriptReader()
{
if (databuf)

View file

@ -938,7 +938,7 @@ void BaseGrid::OnKeyPress(wxKeyEvent &event) {
GetClientSize(&w,&h);
// Get scan code
int key = event.KeyCode();
int key = event.GetKeyCode();
bool ctrl = event.m_controlDown;
bool alt = event.m_altDown;
bool shift = event.m_shiftDown;
@ -965,11 +965,11 @@ void BaseGrid::OnKeyPress(wxKeyEvent &event) {
int step = 1;
if (key == WXK_UP) dir = -1;
if (key == WXK_DOWN) dir = 1;
if (key == WXK_PRIOR) {
if (key == WXK_PAGEUP) {
dir = -1;
step = h/lineHeight - 2;
}
if (key == WXK_NEXT) {
if (key == WXK_PAGEDOWN) {
dir = 1;
step = h/lineHeight - 2;
}

View file

@ -133,7 +133,7 @@ void DialogAttachments::OnAttachFont(wxCommandEvent &event) {
wxArrayString filenames;
wxArrayString paths;
{
wxFileDialog diag (this,_("Choose file to be attached"), Options.AsText(_T("Fonts Collector Destination")), _T(""), _T("Font Files (*.ttf)|*.ttf"), wxOPEN | wxFILE_MUST_EXIST | wxMULTIPLE);
wxFileDialog diag (this,_("Choose file to be attached"), Options.AsText(_T("Fonts Collector Destination")), _T(""), _T("Font Files (*.ttf)|*.ttf"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
if (diag.ShowModal() == wxID_CANCEL) return;
diag.GetFilenames(filenames);
diag.GetPaths(paths);
@ -166,7 +166,7 @@ void DialogAttachments::OnAttachGraphics(wxCommandEvent &event) {
wxArrayString filenames;
wxArrayString paths;
{
wxFileDialog diag (this,_("Choose file to be attached"), _T(""), _T(""), _T("Graphic Files (*.bmp,*.gif,*.jpg,*.ico,*.wmf)|*.bmp;*.gif;*.jpg;*.ico;*.wmf"), wxOPEN | wxFILE_MUST_EXIST | wxMULTIPLE);
wxFileDialog diag (this,_("Choose file to be attached"), _T(""), _T(""), _T("Graphic Files (*.bmp,*.gif,*.jpg,*.ico,*.wmf)|*.bmp;*.gif;*.jpg;*.ico;*.wmf"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
if (diag.ShowModal() == wxID_CANCEL) return;
diag.GetFilenames(filenames);
diag.GetPaths(paths);

View file

@ -189,7 +189,7 @@ void DialogAutomation::OnAdd(wxCommandEvent &evt)
fnfilter = _T("All supported scripts|") + catchall + _T("|") + fnfilter;
}
wxString fname = wxFileSelector(_("Add Automation script"), Options.AsText(_T("Last open automation path")), wxEmptyString, wxEmptyString, fnfilter, wxOPEN|wxFILE_MUST_EXIST, this);
wxString fname = wxFileSelector(_("Add Automation script"), Options.AsText(_T("Last open automation path")), wxEmptyString, wxEmptyString, fnfilter, wxFD_OPEN|wxFD_FILE_MUST_EXIST, this);
if (!fname.IsEmpty()) {

View file

@ -182,7 +182,7 @@ END_EVENT_TABLE()
// Process start
void DialogExport::OnProcess(wxCommandEvent &event) {
// Get destination
wxString filename = wxFileSelector(_("Export subtitles file"),_T(""),_T(""),_T(""),AssFile::GetWildcardList(2),wxSAVE | wxOVERWRITE_PROMPT,this);
wxString filename = wxFileSelector(_("Export subtitles file"),_T(""),_T(""),_T(""),AssFile::GetWildcardList(2),wxFD_SAVE | wxFD_OVERWRITE_PROMPT,this);
if (filename.empty()) return;
// Add filters

View file

@ -222,7 +222,7 @@ void DialogFontsCollector::OnBrowse(wxCommandEvent &event) {
// Chose file name
if (ArchiveCheck->IsChecked()) {
wxFileName fname(DestBox->GetValue());
wxString dest = wxFileSelector(_("Select archive file name"),DestBox->GetValue(),fname.GetFullName(),_T(".zip"),_T("Zip Archives (*.zip)|*.zip"),wxSAVE|wxOVERWRITE_PROMPT);
wxString dest = wxFileSelector(_("Select archive file name"),DestBox->GetValue(),fname.GetFullName(),_T(".zip"),_T("Zip Archives (*.zip)|*.zip"),wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (!dest.empty()) {
DestBox->SetValue(dest);
}

View file

@ -725,7 +725,7 @@ void DialogStyleManager::OnCurrentDelete (wxCommandEvent &event) {
void DialogStyleManager::OnCurrentImport(wxCommandEvent &event) {
// Get file name
wxString path = Options.AsText(_T("Last open subtitles path"));
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxOPEN | wxFILE_MUST_EXIST);
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!filename.IsEmpty()) {
// Save path

View file

@ -226,12 +226,12 @@ void DialogStyling::OnKeyDown(wxKeyEvent &event) {
int keycode = event.GetKeyCode();
// Previous line
if (keycode == WXK_PRIOR) {
if (keycode == WXK_PAGEUP) {
JumpToLine(linen-1);
}
// Next line
if (keycode == WXK_NEXT) {
if (keycode == WXK_PAGEDOWN) {
JumpToLine(linen+1);
}

View file

@ -648,7 +648,7 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
VideoContext::Get()->Stop();
wxString path = Options.AsText(_T("Last open subtitles path"));
wxFileName origPath(AssFile::top->filename);
filename = wxFileSelector(_("Save subtitles file"),path,origPath.GetName() + _T(".ass"),_T("ass"),AssFile::GetWildcardList(1),wxSAVE | wxOVERWRITE_PROMPT,this);
filename = wxFileSelector(_("Save subtitles file"),path,origPath.GetName() + _T(".ass"),_T("ass"),AssFile::GetWildcardList(1),wxFD_SAVE | wxFD_OVERWRITE_PROMPT,this);
}
// Actually save

View file

@ -626,7 +626,7 @@ void FrameMain::OnVideoPlay(wxCommandEvent &event) {
// Open video
void FrameMain::OnOpenVideo(wxCommandEvent& WXUNUSED(event)) {
wxString path = Options.AsText(_T("Last open video path"));
wxString filename = wxFileSelector(_("Open video file"),path,_T(""),_T(""),_T("Recommended Formats (*.avi,*.avs,*.d2v)|*.avi;*.avs;*.d2v|Other supported formats (*.mkv,*.ogm,*.mp4,*.mpeg,*.mpg,*.vob)|*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob|All Files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
wxString filename = wxFileSelector(_("Open video file"),path,_T(""),_T(""),_T("Recommended Formats (*.avi,*.avs,*.d2v)|*.avi;*.avs;*.d2v|Other supported formats (*.mkv,*.ogm,*.mp4,*.mpeg,*.mpg,*.vob)|*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob|All Files (*.*)|*.*"),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!filename.empty()) {
LoadVideo(filename);
Options.SetText(_T("Last open video path"), filename);
@ -646,7 +646,7 @@ void FrameMain::OnCloseVideo(wxCommandEvent& WXUNUSED(event)) {
// Open Audio
void FrameMain::OnOpenAudio (wxCommandEvent& WXUNUSED(event)) {
wxString path = Options.AsText(_T("Last open audio path"));
wxString filename = wxFileSelector(_("Open audio file"),path,_T(""),_T(""),_T("Audio Formats (*.wav,*.mp3,*.ogg,*.flac,*.mp4,*.ac3,*.aac,*.mka)|*.wav;*.mp3;*.ogg;*.flac;*.mp4;*.ac3;*.aac;*.mka|All files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
wxString filename = wxFileSelector(_("Open audio file"),path,_T(""),_T(""),_T("Audio Formats (*.wav,*.mp3,*.ogg,*.flac,*.mp4,*.ac3,*.aac,*.mka)|*.wav;*.mp3;*.ogg;*.flac;*.mp4;*.ac3;*.aac;*.mka|All files (*.*)|*.*"),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!filename.empty()) {
LoadAudio(filename);
Options.SetText(_T("Last open audio path"), filename);
@ -669,7 +669,7 @@ void FrameMain::OnCloseAudio (wxCommandEvent& WXUNUSED(event)) {
// Open subtitles
void FrameMain::OnOpenSubtitles(wxCommandEvent& WXUNUSED(event)) {
wxString path = Options.AsText(_T("Last open subtitles path"));
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxOPEN | wxFILE_MUST_EXIST);
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!filename.empty()) {
LoadSubtitles(filename);
wxFileName filepath(filename);
@ -687,7 +687,7 @@ void FrameMain::OnOpenSubtitlesCharset(wxCommandEvent& WXUNUSED(event)) {
wxString path = Options.AsText(_T("Last open subtitles path"));
// Get options and load
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxOPEN | wxFILE_MUST_EXIST);
wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!filename.empty()) {
wxString charset = wxGetSingleChoice(_("Choose charset code:"), _("Charset"),choices,this,-1, -1,true,250,200);
if (!charset.empty()) {
@ -760,7 +760,7 @@ void FrameMain::OnExportSubtitles(wxCommandEvent & WXUNUSED(event)) {
// Open VFR tags
void FrameMain::OnOpenVFR(wxCommandEvent &event) {
wxString path = Options.AsText(_T("Last open timecodes path"));
wxString filename = wxFileSelector(_("Open timecodes file"),path,_T(""),_T(""),_T("All Supported Types (*.txt)|*.txt|All Files (*.*)|*.*"),wxOPEN | wxFILE_MUST_EXIST);
wxString filename = wxFileSelector(_("Open timecodes file"),path,_T(""),_T(""),_T("All Supported Types (*.txt)|*.txt|All Files (*.*)|*.*"),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!filename.empty()) {
LoadVFR(filename);
Options.SetText(_T("Last open timecodes path"), filename);
@ -781,7 +781,7 @@ void FrameMain::OnCloseVFR(wxCommandEvent &event) {
void FrameMain::OnOpenKeyframes (wxCommandEvent &event) {
// Pick file
wxString path = Options.AsText(_T("Last open keyframes path"));
wxString filename = wxFileSelector(_T("Select the Keyframes file to open"),path,_T(""),_T(".txt"),_T("Text files (*.txt)|*.txt"),wxFILE_MUST_EXIST | wxOPEN);
wxString filename = wxFileSelector(_T("Select the Keyframes file to open"),path,_T(""),_T(".txt"),_T("Text files (*.txt)|*.txt"),wxFD_FILE_MUST_EXIST | wxFD_OPEN);
if (filename.IsEmpty()) return;
Options.SetText(_T("Last open keyframes path"),filename);
Options.Save();
@ -803,7 +803,7 @@ void FrameMain::OnCloseKeyframes (wxCommandEvent &event) {
void FrameMain::OnSaveKeyframes (wxCommandEvent &event) {
// Pick file
wxString path = Options.AsText(_T("Last open keyframes path"));
wxString filename = wxFileSelector(_T("Select the Keyframes file to open"),path,_T(""),_T("*.key.txt"),_T("Text files (*.txt)|*.txt"),wxOVERWRITE_PROMPT | wxSAVE);
wxString filename = wxFileSelector(_T("Select the Keyframes file to open"),path,_T(""),_T("*.key.txt"),_T("Text files (*.txt)|*.txt"),wxFD_OVERWRITE_PROMPT | wxFD_SAVE);
if (filename.IsEmpty()) return;
Options.SetText(_T("Last open keyframes path"),filename);
Options.Save();

View file

@ -171,8 +171,8 @@ void HotkeyType::FillMap() {
keyName[WXK_DELETE] = _T("Delete");
keyName[WXK_HOME] = _T("Home");
keyName[WXK_END] = _T("End");
keyName[WXK_PRIOR] = _T("PgUp");
keyName[WXK_NEXT] = _T("PgDn");
keyName[WXK_PAGEUP] = _T("PgUp");
keyName[WXK_PAGEDOWN] = _T("PgDn");
keyName[WXK_NUMPAD0] = _T("KP_0");
keyName[WXK_NUMPAD1] = _T("KP_1");

View file

@ -648,7 +648,7 @@ void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) {
__int64 start = audioDisplay->GetSampleAtMS(cur->StartMS);
__int64 end = audioDisplay->GetSampleAtMS(cur->End.GetMS());
end=(end>=num_samples+1)?num_samples:end;
wxString filename = wxFileSelector(_("Save audio clip"),0,0,_T("wav"),0,wxSAVE|wxOVERWRITE_PROMPT,this);
wxString filename = wxFileSelector(_("Save audio clip"),0,0,_T("wav"),0,wxFD_SAVE|wxFD_OVERWRITE_PROMPT,this);
if (!filename.empty()) {
std::ofstream outfile(filename.mb_str(wxConvLocal),std::ios::binary);

View file

@ -238,7 +238,7 @@ wxString TextFileReader::ReadLineFromFile() {
wxString final = wxString(wxbuffer);
// Remove BOM
if (final[0] == 0xFEFF) {
if (final.length() > 0 && final[0] == 0xFEFF) {
final = final.Mid(1);
}