Added an early GUI for visual typesetting.

Originally committed to SVN as r771.
This commit is contained in:
Rodrigo Braz Monteiro 2007-01-11 06:15:56 +00:00
parent 71b8e4b81f
commit 31c2cd5455
5 changed files with 112 additions and 10 deletions

View File

@ -128,7 +128,6 @@ void OptionsManager::LoadDefaults() {
SetInt(_T("Video Default Zoom"), 7);
SetInt(_T("Video Fast Jump Step"), 10);
SetText(_T("Video Screenshot Path"),_T("?video"));
SetBool(_T("Video Visual Realtime"),false);
SetModificationType(MOD_VIDEO);
SetBool(_T("Show keyframes on video slider"),true);
@ -282,6 +281,8 @@ void OptionsManager::LoadDefaults() {
SetBool(_T("Audio Spectrum"),false);
SetInt(_T("Audio Sample Rate"),0);
SetBool(_T("Video Visual Realtime"),false);
SetInt(_T("Timing processor key start before thres"),5);
SetInt(_T("Timing processor key start after thres"),4);
SetInt(_T("Timing processor key end before thres"),5);

View File

@ -43,6 +43,7 @@
#include <wx/rawbmp.h>
#include "video_box.h"
#include "video_display.h"
#include "video_display_visual.h"
#include "video_zoom.h"
#include "video_slider.h"
#include "frame_main.h"
@ -116,12 +117,30 @@ VideoBox::VideoBox(wxWindow *parent)
videoSlider->Display = videoDisplay;
// Typesetting buttons
standard = new wxButton(videoPage,Video_Mode_Standard,_T("n"),wxDefaultPosition,wxSize(20,20));
standard->SetToolTip(_("Standard mode, double click sets position."));
drag = new wxButton(videoPage,Video_Mode_Drag,_T("d"),wxDefaultPosition,wxSize(20,20));
drag->SetToolTip(_("Drag subtitles."));
rotatez = new wxButton(videoPage,Video_Mode_Rotate_Z,_T("z"),wxDefaultPosition,wxSize(20,20));
rotatez->SetToolTip(_("Rotate subtitles on their Z axis."));
rotatexy = new wxButton(videoPage,Video_Mode_Rotate_XY,_T("x"),wxDefaultPosition,wxSize(20,20));
rotatexy->SetToolTip(_("Rotate subtitles on their X and Y axes."));
scale = new wxButton(videoPage,Video_Mode_Scale,_T("s"),wxDefaultPosition,wxSize(20,20));
scale->SetToolTip(_("Scale subtitles on X and Y axes."));
clip = new wxButton(videoPage,Video_Mode_Clip,_T("c"),wxDefaultPosition,wxSize(20,20));
clip->SetToolTip(_("Clip subtitles to a rectangle."));
realtime = new wxToggleButton(videoPage,Video_Mode_Realtime,_T("r"),wxDefaultPosition,wxSize(20,20));
realtime->SetToolTip(_("Toggle realtime display of changes."));
bool isRealtime = Options.AsBool(_T("Video Visual Realtime"));
realtime->SetValue(isRealtime);
wxSizer *typeSizer = new wxBoxSizer(wxVERTICAL);
//typeSizer->Add(new wxButton(videoPage,-1,_T("a"),wxDefaultPosition,wxSize(20,20)),0,0,0);
//typeSizer->Add(new wxButton(videoPage,-1,_T("b"),wxDefaultPosition,wxSize(20,20)),0,0,0);
//typeSizer->Add(new wxButton(videoPage,-1,_T("c"),wxDefaultPosition,wxSize(20,20)),0,0,0);
//typeSizer->Add(new wxButton(videoPage,-1,_T("d"),wxDefaultPosition,wxSize(20,20)),0,0,0);
//typeSizer->Add(new wxButton(videoPage,-1,_T("e"),wxDefaultPosition,wxSize(20,20)),0,0,0);
typeSizer->Add(standard,0,0,0);
typeSizer->Add(drag,0,0,0);
typeSizer->Add(rotatez,0,0,0);
typeSizer->Add(rotatexy,0,0,0);
typeSizer->Add(scale,0,0,0);
typeSizer->Add(clip,0,wxBOTTOM,5);
typeSizer->Add(realtime,0,0,0);
typeSizer->AddStretchSpacer(1);
// Top sizer
@ -160,6 +179,14 @@ BEGIN_EVENT_TABLE(VideoBox, wxPanel)
EVT_BUTTON(Video_Stop, VideoBox::OnVideoStop)
EVT_TOGGLEBUTTON(Video_Auto_Scroll, VideoBox::OnVideoToggleScroll)
EVT_BUTTON(Video_Mode_Standard, VideoBox::OnModeStandard)
EVT_BUTTON(Video_Mode_Drag, VideoBox::OnModeDrag)
EVT_BUTTON(Video_Mode_Rotate_Z, VideoBox::OnModeRotateZ)
EVT_BUTTON(Video_Mode_Rotate_XY, VideoBox::OnModeRotateXY)
EVT_BUTTON(Video_Mode_Scale, VideoBox::OnModeScale)
EVT_BUTTON(Video_Mode_Clip, VideoBox::OnModeClip)
EVT_TOGGLEBUTTON(Video_Mode_Realtime, VideoBox::OnToggleRealtime)
#if USE_FEXTRACKER == 1
EVT_BUTTON(Video_Tracker_Menu, VideoBox::OnVideoTrackerMenu)
EVT_MENU(Video_Track_Points, VideoBox::OnVideoTrackPoints)
@ -207,6 +234,55 @@ void VideoBox::OnVideoToggleScroll(wxCommandEvent &event) {
}
/////////////////
// Standard mode
void VideoBox::OnModeStandard(wxCommandEvent &event) {
videoDisplay->visual->SetMode(0);
}
/////////////
// Drag mode
void VideoBox::OnModeDrag(wxCommandEvent &event) {
videoDisplay->visual->SetMode(1);
}
/////////////////
// Rotate Z mode
void VideoBox::OnModeRotateZ(wxCommandEvent &event) {
videoDisplay->visual->SetMode(2);
}
//////////////////
// Rotate XY mode
void VideoBox::OnModeRotateXY(wxCommandEvent &event) {
videoDisplay->visual->SetMode(3);
}
//////////////
// Scale mode
void VideoBox::OnModeScale(wxCommandEvent &event) {
videoDisplay->visual->SetMode(4);
}
/////////////
// Clip mode
void VideoBox::OnModeClip(wxCommandEvent &event) {
videoDisplay->visual->SetMode(5);
}
///////////////////
// Realtime toggle
void VideoBox::OnToggleRealtime(wxCommandEvent &event) {
Options.SetBool(_T("Video Visual Realtime"),realtime->GetValue());
Options.Save();
}
/////////////////////// HERE BE DRAGONS //////////////////////////////

View File

@ -41,6 +41,7 @@
///////////
// Headers
#include <wx/wxprec.h>
#include <wx/tglbtn.h>
//////////////
@ -55,11 +56,27 @@ class FrameMain;
// Video box class
class VideoBox : public wxPanel {
private:
wxButton *standard;
wxButton *drag;
wxButton *rotatez;
wxButton *rotatexy;
wxButton *scale;
wxButton *clip;
wxToggleButton *realtime;
void OnVideoPlay(wxCommandEvent &event);
void OnVideoPlayLine(wxCommandEvent &event);
void OnVideoStop(wxCommandEvent &event);
void OnVideoToggleScroll(wxCommandEvent &event);
void OnModeStandard(wxCommandEvent &event);
void OnModeDrag(wxCommandEvent &event);
void OnModeRotateZ(wxCommandEvent &event);
void OnModeRotateXY(wxCommandEvent &event);
void OnModeScale(wxCommandEvent &event);
void OnModeClip(wxCommandEvent &event);
void OnToggleRealtime(wxCommandEvent &event);
void OnVideoTrackerMenu(wxCommandEvent &event);
void OnVideoTrackPoints(wxCommandEvent &event);
void OnVideoTrackPointAdd(wxCommandEvent &event);
@ -111,7 +128,15 @@ enum {
Video_Track_Movement_MoveAfter,
Video_Track_Split_Line,
Video_Track_Link_File,
Video_Track_Movement_Empty
Video_Track_Movement_Empty,
Video_Mode_Standard,
Video_Mode_Drag,
Video_Mode_Rotate_Z,
Video_Mode_Rotate_XY,
Video_Mode_Scale,
Video_Mode_Clip,
Video_Mode_Realtime
};
#endif

View File

@ -87,8 +87,6 @@ private:
double arValue;
int arType;
VideoDisplayVisual *visual;
wxBitmap GetFrame(int n);
wxBitmap GetFrame() { return GetFrame(frame_n); };
@ -114,6 +112,7 @@ public:
wxString GetKeyFramesName() { return keyFramesFilename; }
void SetKeyFramesName(wxString name) { keyFramesFilename = name; }
VideoDisplayVisual *visual;
VideoProvider *provider;
VideoBox *box;

View File

@ -78,11 +78,12 @@ private:
void DrawTrackingOverlay(wxDC &dc);
void DrawOverlay();
void SetMode(int mode);
void OnMouseEvent(wxMouseEvent &event);
void OnKeyEvent(wxKeyEvent &event);
public:
void SetMode(int mode);
VideoDisplayVisual(VideoDisplay *parent);
~VideoDisplayVisual();
};