From 2f911574d61d84294efbb5de80695decf70ed0b1 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Thu, 28 Jun 2007 21:35:37 +0000 Subject: [PATCH] Overscan mask fully implemented. Toggleable via video menu. Originally committed to SVN as r1310. --- aegisub/frame_main.cpp | 1 + aegisub/frame_main.h | 2 ++ aegisub/frame_main_events.cpp | 14 ++++++++++++++ aegisub/options.cpp | 1 + aegisub/video_display.cpp | 4 ++-- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/aegisub/frame_main.cpp b/aegisub/frame_main.cpp index d7c6bc2d7..153807f86 100644 --- a/aegisub/frame_main.cpp +++ b/aegisub/frame_main.cpp @@ -392,6 +392,7 @@ void FrameMain::InitMenu() { AspectMenu->AppendCheckItem(Menu_Video_AR_235, _("&Cinematic (2.35)"), _("Forces video to 2.35 aspect ratio")); AspectMenu->AppendCheckItem(Menu_Video_AR_Custom, _("Custom..."), _("Forces video to a custom aspect ratio")); videoMenu->Append(AspectParent); + videoMenu->AppendCheckItem(Menu_Video_Overscan, _("Show overscan mask"), _("Show a mask over the video, indicating areas that might get cropped off by overscan on televisions.")); videoMenu->AppendSeparator(); AppendBitmapMenuItem(videoMenu,Menu_Video_JumpTo, _("&Jump To...\t") + Hotkeys.GetText(_T("Video Jump")), _("Jump to frame or time"), wxBITMAP(jumpto_button)); AppendBitmapMenuItem(videoMenu,Menu_Subs_Snap_Video_To_Start, _("Jump video to start\t") + Hotkeys.GetText(_T("Jump Video To Start")), _("Jumps the video to the start frame of current subtitle"), wxBITMAP(video_to_substart)); diff --git a/aegisub/frame_main.h b/aegisub/frame_main.h index 999896756..681f3d7f3 100644 --- a/aegisub/frame_main.h +++ b/aegisub/frame_main.h @@ -161,6 +161,7 @@ private: void OnSetARCustom (wxCommandEvent &event); void OnDetachVideo (wxCommandEvent &event); void OnDummyVideo (wxCommandEvent &event); + void OnOverscan (wxCommandEvent &event); void OnOpenAudio (wxCommandEvent &event); void OnOpenAudioFromVideo (wxCommandEvent &event); @@ -320,6 +321,7 @@ enum { Menu_Video_Play, Menu_Video_Detach, Menu_Video_Dummy, + Menu_Video_Overscan, Menu_Audio_Open_File, Menu_Audio_Open_From_Video, diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index 7dcaaa902..6fce263da 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -135,6 +135,7 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame) EVT_MENU(Menu_Video_Select_Visible, FrameMain::OnSelectVisible) EVT_MENU(Menu_Video_Detach, FrameMain::OnDetachVideo) EVT_MENU(Menu_Video_Dummy, FrameMain::OnDummyVideo) + EVT_MENU(Menu_Video_Overscan, FrameMain::OnOverscan) EVT_MENU(Menu_Audio_Open_File, FrameMain::OnOpenAudio) EVT_MENU(Menu_Audio_Open_From_Video, FrameMain::OnOpenAudioFromVideo) @@ -319,6 +320,9 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) { case 4: MenuBar->Check(Menu_Video_AR_Custom,true); break; } + // Set overscan mask + MenuBar->Check(Menu_Video_Overscan,Options.AsBool(_T("Show Overscan Mask"))); + // Rebuild recent lists RebuildRecentList(_T("Recent vid"),RecentVids,Menu_Video_Recent); RebuildRecentList(_T("Recent timecodes"),RecentTimecodes,Menu_Timecodes_Recent); @@ -816,6 +820,16 @@ void FrameMain::OnDummyVideo (wxCommandEvent &event) { } +/////////////////// +// Overscan toggle +void FrameMain::OnOverscan (wxCommandEvent &event) { + Options.SetBool(_T("Show overscan mask"),event.IsChecked()); + Options.Save(); + VideoContext::Get()->Stop(); + videoBox->videoDisplay->Render(); +} + + /////////////////////// // Open jump to dialog void FrameMain::OnJumpTo(wxCommandEvent& WXUNUSED(event)) { diff --git a/aegisub/options.cpp b/aegisub/options.cpp index b818a5421..2f13dc697 100644 --- a/aegisub/options.cpp +++ b/aegisub/options.cpp @@ -144,6 +144,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults) { SetText(_T("Video Screenshot Path"),_T("?video")); SetModificationType(MOD_VIDEO); SetBool(_T("Show keyframes on video slider"),true); + SetBool(_T("Show overscan mask"),false); // Video Provider (Advanced) SetModificationType(MOD_VIDEO_RELOAD); diff --git a/aegisub/video_display.cpp b/aegisub/video_display.cpp index ed805e2ea..2b53b48c8 100644 --- a/aegisub/video_display.cpp +++ b/aegisub/video_display.cpp @@ -292,7 +292,7 @@ void VideoDisplay::DrawTVEffects() { int sw,sh; VideoContext *context = VideoContext::Get(); context->GetScriptSize(sw,sh); - bool drawOverscan = false; + bool drawOverscan = Options.AsBool(_T("Show Overscan Mask")); // Draw overscan mask if (drawOverscan) { @@ -310,7 +310,7 @@ void VideoDisplay::DrawOverscanMask(int sizeH,int sizeV,wxColour colour,double a int sw,sh; VideoContext *context = VideoContext::Get(); context->GetScriptSize(sw,sh); - int rad1 = 24; + int rad1 = int(sh * 0.05); int gapH = sizeH+rad1; int gapV = sizeV+rad1; int rad2 = (int)sqrt(double(gapH*gapH + gapV*gapV))+1;