Applied Harukalover's patch #2 - Added play audio/video buttons to Styling Assistant
Originally committed to SVN as r2190.
This commit is contained in:
parent
0de8190b21
commit
baf52a3430
2 changed files with 51 additions and 17 deletions
|
@ -43,6 +43,7 @@
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "audio_display.h"
|
#include "audio_display.h"
|
||||||
|
@ -50,6 +51,7 @@
|
||||||
#include "hotkeys.h"
|
#include "hotkeys.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "help_button.h"
|
#include "help_button.h"
|
||||||
|
#include "subs_edit_box.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -63,6 +65,7 @@ wxDialog (parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize,
|
||||||
// Variables
|
// Variables
|
||||||
grid = _grid;
|
grid = _grid;
|
||||||
audio = VideoContext::Get()->audio->box->audioDisplay;
|
audio = VideoContext::Get()->audio->box->audioDisplay;
|
||||||
|
video = video->Get();
|
||||||
needCommit = false;
|
needCommit = false;
|
||||||
linen = -1;
|
linen = -1;
|
||||||
|
|
||||||
|
@ -79,7 +82,8 @@ wxDialog (parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize,
|
||||||
// Right sizer
|
// Right sizer
|
||||||
wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
wxSizer *RightTop = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Set style"));
|
wxSizer *RightTop = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Set style"));
|
||||||
wxSizer *RightBottom = new wxStaticBoxSizer(wxVERTICAL,this,_("Keys"));
|
wxSizer *RightMiddle = new wxStaticBoxSizer(wxVERTICAL,this,_("Keys"));
|
||||||
|
wxSizer *RightBottom = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Actions"));
|
||||||
TypeBox = new StyleEditBox(this);
|
TypeBox = new StyleEditBox(this);
|
||||||
RightTop->Add(TypeBox,1,wxEXPAND);
|
RightTop->Add(TypeBox,1,wxEXPAND);
|
||||||
|
|
||||||
|
@ -94,19 +98,33 @@ wxDialog (parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize,
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Previous line")));
|
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Previous line")));
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Next")) + _T(": ")));
|
KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Next")) + _T(": ")));
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Next line")));
|
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Next line")));
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Play")) + _T(": ")));
|
KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Play Video")) + _T(": ")));
|
||||||
|
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Play Video")));
|
||||||
|
KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Play Audio")) + _T(": ")));
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Play Audio")));
|
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Play Audio")));
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Click on list:")));
|
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Click on list:")));
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Select style")));
|
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Select style")));
|
||||||
|
|
||||||
// Rest of right sizer
|
// Right Middle
|
||||||
PreviewCheck = new wxCheckBox(this,-1,_("Enable preview (slow)"));
|
PreviewCheck = new wxCheckBox(this,-1,_("Enable preview (slow)"));
|
||||||
PreviewCheck->SetValue(true);
|
PreviewCheck->SetValue(true);
|
||||||
RightBottom->Add(KeysInnerSizer,0,wxEXPAND | wxBOTTOM,5);
|
RightMiddle->Add(KeysInnerSizer,0,wxEXPAND | wxBOTTOM,5);
|
||||||
RightBottom->Add(PreviewCheck,0,0,0);
|
RightMiddle->Add(PreviewCheck,0,0,0);
|
||||||
|
RightMiddle->AddStretchSpacer(1);
|
||||||
|
|
||||||
|
// Rest of right sizer
|
||||||
|
wxButton *PlayVideoButton = new wxButton(this,BUTTON_PLAY_VIDEO,_("Play Video"));
|
||||||
|
wxButton *PlayAudioButton = new wxButton(this,BUTTON_PLAY_AUDIO,_("Play Audio"));
|
||||||
|
PlayVideoButton->Enable(video->IsLoaded());
|
||||||
|
PlayAudioButton->Enable(audio->loaded);
|
||||||
RightBottom->AddStretchSpacer(1);
|
RightBottom->AddStretchSpacer(1);
|
||||||
|
RightBottom->Add(PlayAudioButton,0,wxLEFT | wxRIGHT | wxBOTTOM,5);
|
||||||
|
RightBottom->Add(PlayVideoButton,0,wxBOTTOM | wxRIGHT,5);
|
||||||
|
RightBottom->AddStretchSpacer(1);
|
||||||
|
|
||||||
RightSizer->Add(RightTop,0,wxEXPAND | wxBOTTOM,5);
|
RightSizer->Add(RightTop,0,wxEXPAND | wxBOTTOM,5);
|
||||||
RightSizer->Add(RightBottom,1,wxEXPAND | wxBOTTOM,0);
|
RightSizer->Add(RightMiddle,0,wxEXPAND | wxBOTTOM,5);
|
||||||
|
RightSizer->Add(RightBottom,0,wxEXPAND,5);
|
||||||
|
|
||||||
// Bottom sizer
|
// Bottom sizer
|
||||||
wxSizer *BottomSizer = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *BottomSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -115,12 +133,8 @@ wxDialog (parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize,
|
||||||
|
|
||||||
// Button sizer
|
// Button sizer
|
||||||
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
||||||
wxButton *PlayButton = new wxButton(this,BUTTON_PLAY,_("Play Audio"));
|
|
||||||
PlayButton->Enable(audio->loaded);
|
|
||||||
ButtonSizer->AddButton(PlayButton);
|
|
||||||
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
||||||
ButtonSizer->AddButton(new HelpButton(this,_T("Styling Assistant")));
|
ButtonSizer->AddButton(new HelpButton(this,_T("Styling Assistant")));
|
||||||
ButtonSizer->SetAffirmativeButton(PlayButton);
|
|
||||||
ButtonSizer->Realize();
|
ButtonSizer->Realize();
|
||||||
|
|
||||||
// Main sizer
|
// Main sizer
|
||||||
|
@ -185,6 +199,7 @@ void DialogStyling::JumpToLine(int n) {
|
||||||
// Update grid
|
// Update grid
|
||||||
grid->SelectRow(linen,false);
|
grid->SelectRow(linen,false);
|
||||||
grid->MakeCellVisible(linen,0);
|
grid->MakeCellVisible(linen,0);
|
||||||
|
grid->editBox->SetToLine(linen);
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
if (PreviewCheck->IsChecked()) VideoContext::Get()->JumpToFrame(VFR_Output.GetFrameAtTime(line->Start.GetMS(),true));
|
if (PreviewCheck->IsChecked()) VideoContext::Get()->JumpToFrame(VFR_Output.GetFrameAtTime(line->Start.GetMS(),true));
|
||||||
|
@ -217,7 +232,8 @@ void DialogStyling::SetStyle (wxString curName, bool jump) {
|
||||||
///////////////
|
///////////////
|
||||||
// Event table
|
// Event table
|
||||||
BEGIN_EVENT_TABLE(DialogStyling,wxDialog)
|
BEGIN_EVENT_TABLE(DialogStyling,wxDialog)
|
||||||
EVT_BUTTON(BUTTON_PLAY, DialogStyling::OnPlayButton)
|
EVT_BUTTON(BUTTON_PLAY_VIDEO, DialogStyling::OnPlayVideoButton)
|
||||||
|
EVT_BUTTON(BUTTON_PLAY_AUDIO, DialogStyling::OnPlayAudioButton)
|
||||||
//EVT_TEXT_ENTER(ENTER_STYLE_BOX, DialogStyling::OnStyleBoxEnter)
|
//EVT_TEXT_ENTER(ENTER_STYLE_BOX, DialogStyling::OnStyleBoxEnter)
|
||||||
EVT_TEXT(ENTER_STYLE_BOX, DialogStyling::OnStyleBoxModified)
|
EVT_TEXT(ENTER_STYLE_BOX, DialogStyling::OnStyleBoxModified)
|
||||||
EVT_LISTBOX(STYLE_LIST, DialogStyling::OnListClicked)
|
EVT_LISTBOX(STYLE_LIST, DialogStyling::OnListClicked)
|
||||||
|
@ -302,10 +318,16 @@ void DialogStyling::OnListClicked(wxCommandEvent &event) {
|
||||||
TypeBox->SetFocus();
|
TypeBox->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////
|
||||||
|
// Play video button
|
||||||
|
void DialogStyling::OnPlayVideoButton(wxCommandEvent &event) {
|
||||||
|
video->PlayLine();
|
||||||
|
TypeBox->SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
///////////////
|
/////////////////////
|
||||||
// Play button
|
// Play audio button
|
||||||
void DialogStyling::OnPlayButton(wxCommandEvent &event) {
|
void DialogStyling::OnPlayAudioButton(wxCommandEvent &event) {
|
||||||
audio->Play(line->Start.GetMS(),line->End.GetMS());
|
audio->Play(line->Start.GetMS(),line->End.GetMS());
|
||||||
TypeBox->SetFocus();
|
TypeBox->SetFocus();
|
||||||
}
|
}
|
||||||
|
@ -360,8 +382,16 @@ void StyleEditBox::OnKeyDown(wxKeyEvent &event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Play video
|
||||||
|
if (Hotkeys.IsPressed(_T("Styling Assistant Play Video"))) {
|
||||||
|
if (diag->video->IsLoaded()) {
|
||||||
|
diag->video->PlayLine();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Play audio
|
// Play audio
|
||||||
if (Hotkeys.IsPressed(_T("Styling Assistant Play"))) {
|
if (Hotkeys.IsPressed(_T("Styling Assistant Play Audio"))) {
|
||||||
if (diag->audio->loaded) {
|
if (diag->audio->loaded) {
|
||||||
diag->audio->Play(diag->line->Start.GetMS(),diag->line->End.GetMS());
|
diag->audio->Play(diag->line->Start.GetMS(),diag->line->End.GetMS());
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ class AssDialogue;
|
||||||
class SubtitlesGrid;
|
class SubtitlesGrid;
|
||||||
class DialogStyling;
|
class DialogStyling;
|
||||||
class AudioDisplay;
|
class AudioDisplay;
|
||||||
|
class VideoContext;
|
||||||
|
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
|
@ -90,7 +91,8 @@ private:
|
||||||
void OnStyleBoxEnter (wxCommandEvent &event);
|
void OnStyleBoxEnter (wxCommandEvent &event);
|
||||||
void OnListClicked (wxCommandEvent &event);
|
void OnListClicked (wxCommandEvent &event);
|
||||||
void OnKeyDown(wxKeyEvent &event);
|
void OnKeyDown(wxKeyEvent &event);
|
||||||
void OnPlayButton(wxCommandEvent &event);
|
void OnPlayVideoButton(wxCommandEvent &event);
|
||||||
|
void OnPlayAudioButton(wxCommandEvent &event);
|
||||||
|
|
||||||
void SetStyle (wxString curName,bool jump=true);
|
void SetStyle (wxString curName,bool jump=true);
|
||||||
|
|
||||||
|
@ -100,6 +102,7 @@ public:
|
||||||
int linen;
|
int linen;
|
||||||
AssDialogue *line;
|
AssDialogue *line;
|
||||||
AudioDisplay *audio;
|
AudioDisplay *audio;
|
||||||
|
VideoContext *video;
|
||||||
|
|
||||||
DialogStyling (wxWindow *parent,SubtitlesGrid *grid);
|
DialogStyling (wxWindow *parent,SubtitlesGrid *grid);
|
||||||
~DialogStyling ();
|
~DialogStyling ();
|
||||||
|
@ -115,7 +118,8 @@ public:
|
||||||
enum {
|
enum {
|
||||||
ENTER_STYLE_BOX,
|
ENTER_STYLE_BOX,
|
||||||
STYLE_LIST,
|
STYLE_LIST,
|
||||||
BUTTON_PLAY
|
BUTTON_PLAY_VIDEO,
|
||||||
|
BUTTON_PLAY_AUDIO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue