From 072520bf5ff616b6d1db9c5c540421bb8b8f8218 Mon Sep 17 00:00:00 2001 From: harukalover Date: Sat, 25 Jul 2009 18:45:30 +0000 Subject: [PATCH] Removed most of the wxWidgets 2.8 compatibility code Originally committed to SVN as r3280. --- aegisub/src/base_grid.cpp | 8 ---- aegisub/src/dialog_detached_video.cpp | 4 -- aegisub/src/dialog_progress.cpp | 4 -- aegisub/src/dialog_style_manager.cpp | 4 -- aegisub/src/frame_main_events.cpp | 4 -- aegisub/src/main.cpp | 4 -- aegisub/src/subs_edit_box.cpp | 11 +---- aegisub/src/subs_edit_ctrl.cpp | 6 +-- aegisub/src/subtitle_format_ttxt.cpp | 63 --------------------------- aegisub/src/video_context.cpp | 7 --- aegisub/src/video_slider.cpp | 4 -- 11 files changed, 2 insertions(+), 117 deletions(-) diff --git a/aegisub/src/base_grid.cpp b/aegisub/src/base_grid.cpp index 2ac1cb741..08889c32f 100644 --- a/aegisub/src/base_grid.cpp +++ b/aegisub/src/base_grid.cpp @@ -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(); } diff --git a/aegisub/src/dialog_detached_video.cpp b/aegisub/src/dialog_detached_video.cpp index 396c5138a..23425521e 100644 --- a/aegisub/src/dialog_detached_video.cpp +++ b/aegisub/src/dialog_detached_video.cpp @@ -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 } diff --git a/aegisub/src/dialog_progress.cpp b/aegisub/src/dialog_progress.cpp index 764ee18fc..f7a41efcf 100644 --- a/aegisub/src/dialog_progress.cpp +++ b/aegisub/src/dialog_progress.cpp @@ -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 } diff --git a/aegisub/src/dialog_style_manager.cpp b/aegisub/src/dialog_style_manager.cpp index 50204b85d..825adbc4e 100644 --- a/aegisub/src/dialog_style_manager.cpp +++ b/aegisub/src/dialog_style_manager.cpp @@ -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; diff --git a/aegisub/src/frame_main_events.cpp b/aegisub/src/frame_main_events.cpp index 2e2fcf35c..2a452fa1c 100644 --- a/aegisub/src/frame_main_events.cpp +++ b/aegisub/src/frame_main_events.cpp @@ -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 } diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index f3bbbe7c3..b9be28d7e 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -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(); diff --git a/aegisub/src/subs_edit_box.cpp b/aegisub/src/subs_edit_box.cpp index fb85381ba..eab7350b2 100644 --- a/aegisub/src/subs_edit_box.cpp +++ b/aegisub/src/subs_edit_box.cpp @@ -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; diff --git a/aegisub/src/subs_edit_ctrl.cpp b/aegisub/src/subs_edit_ctrl.cpp index 84866349e..e3e928621 100644 --- a/aegisub/src/subs_edit_ctrl.cpp +++ b/aegisub/src/subs_edit_ctrl.cpp @@ -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;iSetFont(font); #endif } diff --git a/aegisub/src/subtitle_format_ttxt.cpp b/aegisub/src/subtitle_format_ttxt.cpp index 5d3c74410..c4715e445 100644 --- a/aegisub/src/subtitle_format_ttxt.cpp +++ b/aegisub/src/subtitle_format_ttxt.cpp @@ -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); diff --git a/aegisub/src/video_context.cpp b/aegisub/src/video_context.cpp index dc2cd51d0..c3f28e5da 100644 --- a/aegisub/src/video_context.cpp +++ b/aegisub/src/video_context.cpp @@ -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); diff --git a/aegisub/src/video_slider.cpp b/aegisub/src/video_slider.cpp index 3bdf32e31..e6f483c95 100644 --- a/aegisub/src/video_slider.cpp +++ b/aegisub/src/video_slider.cpp @@ -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; }