mirror of https://github.com/odrling/Aegisub
Fixed compilation support with wxWidgets 2.9.0 (seems to work correctly besides some minor gui issues)
Originally committed to SVN as r3049.
This commit is contained in:
parent
41f71ca3be
commit
4eeb89710d
|
@ -232,7 +232,11 @@ AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename,
|
|||
wxString error;
|
||||
for (unsigned int i=0;i<list.Count();i++) {
|
||||
try {
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
AudioProvider *prov = GetFactory(list[i])->CreateProvider(filename.wc_str());
|
||||
#else
|
||||
AudioProvider *prov = GetFactory(list[i])->CreateProvider(filename.c_str());
|
||||
#endif
|
||||
if (prov) {
|
||||
provider = prov;
|
||||
break;
|
||||
|
|
|
@ -991,7 +991,11 @@ void BaseGrid::OnKeyPress(wxKeyEvent &event) {
|
|||
if (key == WXK_LEFT || key == WXK_RIGHT) {
|
||||
if (VideoContext::Get()->IsLoaded()) {
|
||||
parentFrame->videoBox->videoSlider->SetFocus();
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
parentFrame->videoBox->videoSlider->GetEventHandler()->ProcessEvent(event);
|
||||
#else
|
||||
parentFrame->videoBox->videoSlider->AddPendingEvent(event);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
event.Skip();
|
||||
|
@ -1082,7 +1086,11 @@ void BaseGrid::OnKeyPress(wxKeyEvent &event) {
|
|||
|
||||
// Other events, send to audio display
|
||||
if (VideoContext::Get()->audio->loaded) {
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
VideoContext::Get()->audio->GetEventHandler()->ProcessEvent(event);
|
||||
#else
|
||||
VideoContext::Get()->audio->AddPendingEvent(event);
|
||||
#endif
|
||||
}
|
||||
else event.Skip();
|
||||
}
|
||||
|
|
|
@ -120,7 +120,11 @@ END_EVENT_TABLE()
|
|||
void DialogDetachedVideo::OnKey(wxKeyEvent &event) {
|
||||
// Send to parent... except that it doesn't work
|
||||
event.Skip();
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
GetParent()->GetEventHandler()->ProcessEvent(event);
|
||||
#else
|
||||
GetParent()->AddPendingEvent(event);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -177,5 +177,9 @@ wxThread::ExitCode DialogProgressThread::Entry() {
|
|||
void DialogProgressThread::Close() {
|
||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
|
||||
dialog->canceled = NULL;
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
dialog->GetEventHandler()->ProcessEvent(event);
|
||||
#else
|
||||
dialog->AddPendingEvent(event);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -898,7 +898,11 @@ void DialogStyleManager::OnCurrentImport(wxCommandEvent &event) {
|
|||
|
||||
// Get selection
|
||||
wxArrayInt selections;
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
int res = wxGetSelectedChoices(selections,_("Choose styles to import:"),_("Import Styles"),styles);
|
||||
#else
|
||||
int res = wxGetMultipleChoices(selections,_("Choose styles to import:"),_("Import Styles"),styles);
|
||||
#endif
|
||||
if (res == -1 || selections.Count() == 0) return;
|
||||
bool modified = false;
|
||||
|
||||
|
|
|
@ -124,7 +124,11 @@ wxString FFmpegSourceProvider::GetCacheFilename(const wxString& filename)
|
|||
md5_state_t state;
|
||||
md5_byte_t digest[16];
|
||||
md5_init(&state);
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
md5_append(&state,(md5_byte_t*)toHash.wc_str(),toHash.Length()*sizeof(wxChar));
|
||||
#else
|
||||
md5_append(&state,(md5_byte_t*)toHash.c_str(),toHash.Length()*sizeof(wxChar));
|
||||
#endif
|
||||
md5_finish(&state,digest);
|
||||
|
||||
// Generate the filename
|
||||
|
|
|
@ -234,7 +234,11 @@ END_EVENT_TABLE()
|
|||
////////////////////////////////
|
||||
// Redirect grid events to grid
|
||||
void FrameMain::OnGridEvent (wxCommandEvent &event) {
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
SubsBox->GetEventHandler()->ProcessEvent(event);
|
||||
#else
|
||||
SubsBox->AddPendingEvent(event);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -482,7 +482,11 @@ void AegisubApp::OnMouseWheel(wxMouseEvent &event) {
|
|||
wxPoint pt;
|
||||
wxWindow *target = wxFindWindowAtPointer(pt);
|
||||
if (frame && (target == frame->audioBox->audioDisplay || target == frame->SubsBox)) {
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
if (target->IsShownOnScreen()) target->GetEventHandler()->ProcessEvent(event);
|
||||
#else
|
||||
if (target->IsShownOnScreen()) target->AddPendingEvent(event);
|
||||
#endif
|
||||
else event.Skip();
|
||||
}
|
||||
else event.Skip();
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#pragma comment(lib, "wxmsw29ud_adv.lib")
|
||||
#pragma comment(lib, "wxmsw29ud_gl.lib")
|
||||
#pragma comment(lib, "wxmsw29ud_stc.lib")
|
||||
#pragma comment(lib, "wxscintillad.lib")
|
||||
#pragma comment(lib, "wxbase29ud_xml.lib")
|
||||
#pragma comment(lib, "wxexpatd.lib")
|
||||
#else
|
||||
|
@ -78,6 +79,7 @@
|
|||
#pragma comment(lib, "wxmsw29u_adv.lib")
|
||||
#pragma comment(lib, "wxmsw29u_gl.lib")
|
||||
#pragma comment(lib, "wxmsw29u_stc.lib")
|
||||
#pragma comment(lib, "wxscintilla.lib")
|
||||
#pragma comment(lib, "wxbase29u_xml.lib")
|
||||
#pragma comment(lib, "wxexpat.lib")
|
||||
#endif
|
||||
|
|
|
@ -756,7 +756,11 @@ void SubsTextEditCtrl::OnMouseEvent(wxMouseEvent &event) {
|
|||
}
|
||||
|
||||
event.Skip();
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
GetParent()->GetEventHandler()->ProcessEvent(event);
|
||||
#else
|
||||
GetParent()->AddPendingEvent(event);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,7 +97,11 @@ void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
|||
if (doc.GetRoot()->GetName() != _T("TextStream")) throw _T("Invalid TTXT file.");
|
||||
|
||||
// Check version
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
wxString verStr = doc.GetRoot()->GetAttribute(_T("version"),_T(""));
|
||||
#else
|
||||
wxString verStr = doc.GetRoot()->GetPropVal(_T("version"),_T(""));
|
||||
#endif
|
||||
version = -1;
|
||||
if (verStr == _T("1.0")) version = 0;
|
||||
else if (verStr == _T("1.1")) version = 1;
|
||||
|
@ -138,7 +142,11 @@ void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) {
|
|||
// Process a dialogue line
|
||||
bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) {
|
||||
// Get time
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
wxString sampleTime = node->GetAttribute(_T("sampleTime"),_T("00:00:00.000"));
|
||||
#else
|
||||
wxString sampleTime = node->GetPropVal(_T("sampleTime"),_T("00:00:00.000"));
|
||||
#endif
|
||||
AssTime time;
|
||||
time.ParseASS(sampleTime);
|
||||
|
||||
|
@ -148,7 +156,11 @@ bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) {
|
|||
|
||||
// Get text
|
||||
wxString text;
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
if (version == 0) text = node->GetAttribute(_T("text"),_T(""));
|
||||
#else
|
||||
if (version == 0) text = node->GetPropVal(_T("text"),_T(""));
|
||||
#endif
|
||||
else text = node->GetNodeContent();
|
||||
|
||||
// Create line
|
||||
|
@ -211,7 +223,11 @@ void TTXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
|||
// Create XML structure
|
||||
wxXmlDocument doc;
|
||||
wxXmlNode *root = new wxXmlNode(NULL,wxXML_ELEMENT_NODE,_T("TextStream"));
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
root->AddAttribute(_T("version"),_T("1.1"));
|
||||
#else
|
||||
root->AddProperty(_T("version"),_T("1.1"));
|
||||
#endif
|
||||
doc.SetRoot(root);
|
||||
|
||||
// Create header
|
||||
|
@ -244,16 +260,33 @@ void TTXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
|||
void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) {
|
||||
// Write stream header
|
||||
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextStreamHeader"));
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
node->AddAttribute(_T("width"),_T("400"));
|
||||
node->AddAttribute(_T("height"),_T("60"));
|
||||
node->AddAttribute(_T("layer"),_T("0"));
|
||||
node->AddAttribute(_T("translation_x"),_T("0"));
|
||||
node->AddAttribute(_T("translation_y"),_T("0"));
|
||||
#else
|
||||
node->AddProperty(_T("width"),_T("400"));
|
||||
node->AddProperty(_T("height"),_T("60"));
|
||||
node->AddProperty(_T("layer"),_T("0"));
|
||||
node->AddProperty(_T("translation_x"),_T("0"));
|
||||
node->AddProperty(_T("translation_y"),_T("0"));
|
||||
#endif
|
||||
root->AddChild(node);
|
||||
root = node;
|
||||
|
||||
// Write sample description
|
||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextSampleDescription"));
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
node->AddAttribute(_T("horizontalJustification"),_T("center"));
|
||||
node->AddAttribute(_T("verticalJustification"),_T("bottom"));
|
||||
node->AddAttribute(_T("backColor"),_T("0 0 0 0"));
|
||||
node->AddAttribute(_T("verticalText"),_T("no"));
|
||||
node->AddAttribute(_T("fillTextRegion"),_T("no"));
|
||||
node->AddAttribute(_T("continuousKaraoke"),_T("no"));
|
||||
node->AddAttribute(_T("scroll"),_T("None"));
|
||||
#else
|
||||
node->AddProperty(_T("horizontalJustification"),_T("center"));
|
||||
node->AddProperty(_T("verticalJustification"),_T("bottom"));
|
||||
node->AddProperty(_T("backColor"),_T("0 0 0 0"));
|
||||
|
@ -261,31 +294,51 @@ void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) {
|
|||
node->AddProperty(_T("fillTextRegion"),_T("no"));
|
||||
node->AddProperty(_T("continuousKaraoke"),_T("no"));
|
||||
node->AddProperty(_T("scroll"),_T("None"));
|
||||
#endif
|
||||
root->AddChild(node);
|
||||
root = node;
|
||||
|
||||
// Write font table
|
||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("FontTable"));
|
||||
wxXmlNode *subNode = new wxXmlNode(wxXML_ELEMENT_NODE,_T("FontTableEntry"));
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
subNode->AddAttribute(_T("fontName"),_T("Sans"));
|
||||
subNode->AddAttribute(_T("fontID"),_T("1"));
|
||||
#else
|
||||
subNode->AddProperty(_T("fontName"),_T("Sans"));
|
||||
subNode->AddProperty(_T("fontID"),_T("1"));
|
||||
#endif
|
||||
node->AddChild(subNode);
|
||||
root->AddChild(node);
|
||||
|
||||
// Write text box
|
||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextBox"));
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
node->AddAttribute(_T("top"),_T("0"));
|
||||
node->AddAttribute(_T("left"),_T("0"));
|
||||
node->AddAttribute(_T("bottom"),_T("60"));
|
||||
node->AddAttribute(_T("right"),_T("400"));
|
||||
#else
|
||||
node->AddProperty(_T("top"),_T("0"));
|
||||
node->AddProperty(_T("left"),_T("0"));
|
||||
node->AddProperty(_T("bottom"),_T("60"));
|
||||
node->AddProperty(_T("right"),_T("400"));
|
||||
#endif
|
||||
root->AddChild(node);
|
||||
|
||||
// Write style
|
||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("Style"));
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
node->AddAttribute(_T("styles"),_T("Normal"));
|
||||
node->AddAttribute(_T("fontID"),_T("1"));
|
||||
node->AddAttribute(_T("fontSize"),_T("18"));
|
||||
node->AddAttribute(_T("color"),_T("ff ff ff ff"));
|
||||
#else
|
||||
node->AddProperty(_T("styles"),_T("Normal"));
|
||||
node->AddProperty(_T("fontID"),_T("1"));
|
||||
node->AddProperty(_T("fontSize"),_T("18"));
|
||||
node->AddProperty(_T("color"),_T("ff ff ff ff"));
|
||||
#endif
|
||||
root->AddChild(node);
|
||||
}
|
||||
|
||||
|
@ -297,8 +350,13 @@ void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *line) {
|
|||
wxXmlNode *node,*subNode;
|
||||
if (prev && prev->End != line->Start) {
|
||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextSample"));
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
node->AddAttribute(_T("sampleTime"),_T("0") + prev->End.GetASSFormated(true));
|
||||
node->AddAttribute(_T("xml:space"),_T("preserve"));
|
||||
#else
|
||||
node->AddProperty(_T("sampleTime"),_T("0") + prev->End.GetASSFormated(true));
|
||||
node->AddProperty(_T("xml:space"),_T("preserve"));
|
||||
#endif
|
||||
subNode = new wxXmlNode(wxXML_TEXT_NODE,_T(""),_T(""));
|
||||
node->AddChild(subNode);
|
||||
root->AddChild(node);
|
||||
|
@ -306,8 +364,13 @@ void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *line) {
|
|||
|
||||
// Generate and insert node
|
||||
node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextSample"));
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
node->AddAttribute(_T("sampleTime"),_T("0") + line->Start.GetASSFormated(true));
|
||||
node->AddAttribute(_T("xml:space"),_T("preserve"));
|
||||
#else
|
||||
node->AddProperty(_T("sampleTime"),_T("0") + line->Start.GetASSFormated(true));
|
||||
node->AddProperty(_T("xml:space"),_T("preserve"));
|
||||
#endif
|
||||
subNode = new wxXmlNode(wxXML_TEXT_NODE,_T(""),line->Text);
|
||||
node->AddChild(subNode);
|
||||
root->AddChild(node);
|
||||
|
|
|
@ -478,7 +478,10 @@ wxGLContext *VideoContext::GetGLContext(wxGLCanvas *canvas) {
|
|||
// Everywhere else, we can just create a wxGLContext using the documented interface
|
||||
// and be over with it after that.
|
||||
// Also see bug #850.
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
#else
|
||||
if (!glContext) glContext = canvas->GetContext();
|
||||
#endif
|
||||
#ifndef __WXMAC__
|
||||
if (!glContext) glContext = new wxGLContext(canvas);
|
||||
#endif
|
||||
|
|
|
@ -63,7 +63,11 @@
|
|||
VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video,double fps) {
|
||||
// First check special case of dummy video
|
||||
if (video.StartsWith(_T("?dummy:"))) {
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
return new DummyVideoProvider(video.wc_str(), fps);
|
||||
#else
|
||||
return new DummyVideoProvider(video.c_str(), fps);
|
||||
#endif
|
||||
}
|
||||
|
||||
// List of providers
|
||||
|
@ -77,7 +81,11 @@ VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video,double fp
|
|||
for (unsigned int i=0;i<list.Count();i++) {
|
||||
try {
|
||||
// Create provider
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video.wc_str(),fps);
|
||||
#else
|
||||
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video.c_str(),fps);
|
||||
#endif
|
||||
if (provider) {
|
||||
// Cache if necessary
|
||||
if (provider->GetDesiredCacheSize()) {
|
||||
|
|
|
@ -370,7 +370,11 @@ void VideoSlider::OnKeyDown(wxKeyEvent &event) {
|
|||
|
||||
// Forward up/down to grid
|
||||
if (key == WXK_UP || key == WXK_DOWN) {
|
||||
#if wxCHECK_VERSION(2,9,0)
|
||||
grid->GetEventHandler()->ProcessEvent(event);
|
||||
#else
|
||||
grid->AddPendingEvent(event);
|
||||
#endif
|
||||
grid->SetFocus();
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue