Removed most of the wxWidgets 2.8 compatibility code

Originally committed to SVN as r3280.
This commit is contained in:
harukalover 2009-07-25 18:45:30 +00:00
parent 075439f405
commit 072520bf5f
11 changed files with 2 additions and 117 deletions

View file

@ -991,11 +991,7 @@ 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();
@ -1086,11 +1082,7 @@ 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();
}

View file

@ -120,11 +120,7 @@ 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
}

View file

@ -177,9 +177,5 @@ 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
}

View file

@ -889,11 +889,7 @@ 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;

View file

@ -237,11 +237,7 @@ 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
}

View file

@ -486,11 +486,7 @@ 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();

View file

@ -185,16 +185,7 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
MiddleBotSizer->Add(ByFrame,0,wxRIGHT | wxALIGN_CENTER | wxEXPAND,5);
// Text editor
int textStyle = 0;
#if wxCHECK_VERSION(2,9,0)
textStyle = wxBORDER_SUNKEN;
#else
#ifdef _WIN32
textStyle = wxWindow::GetThemedBorderStyle();
#else
textStyle = wxBORDER_SUNKEN;
#endif
#endif
int textStyle = wxBORDER_SUNKEN;
TextEdit = new SubsTextEditCtrl(this,EDIT_BOX,_T(""),wxDefaultPosition,wxSize(300,50),textStyle);
TextEdit->PushEventHandler(new SubsEditBoxEvent(this));
TextEdit->control = this;

View file

@ -756,11 +756,7 @@ void SubsTextEditCtrl::OnMouseEvent(wxMouseEvent &event) {
}
event.Skip();
#if wxCHECK_VERSION(2,9,0)
GetParent()->GetEventHandler()->ProcessEvent(event);
#else
GetParent()->AddPendingEvent(event);
#endif
}
@ -802,7 +798,7 @@ void SubsTextEditCtrl::ShowPopupMenu(int activePos) {
for (int i=0;i<nSugs;i++) {
wxMenuItem *itm;
itm = menu.Append(EDIT_MENU_SUGGESTIONS+i,sugs[i]);
#if wxCHECK_VERSION(2, 8, 0) && defined(__WINDOWS__)
#ifdef __WINDOWS__
itm->SetFont(font);
#endif
}

View file

@ -97,11 +97,7 @@ 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;
@ -142,11 +138,7 @@ 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);
@ -156,11 +148,7 @@ 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
@ -223,11 +211,7 @@ 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
@ -260,25 +244,16 @@ 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"));
@ -286,59 +261,31 @@ void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) {
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"));
node->AddProperty(_T("verticalText"),_T("no"));
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);
}
@ -350,13 +297,8 @@ 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);
@ -364,13 +306,8 @@ 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);

View file

@ -471,13 +471,6 @@ 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();
ownGlContext = false;
}
#endif
#ifndef __WXMAC__
if (!glContext) {
glContext = new wxGLContext(canvas);

View file

@ -370,11 +370,7 @@ 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;
}