mirror of https://github.com/odrling/Aegisub
Fix #441 (Join/Split karaoke buttons now become Cancel/Accept Split buttons when in karaoke split mode)
Originally committed to SVN as r1288.
This commit is contained in:
parent
cee5c46ab7
commit
3818649af7
|
@ -200,20 +200,16 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE
|
||||||
KaraokeButton->SetToolTip(_("Toggle karaoke mode"));
|
KaraokeButton->SetToolTip(_("Toggle karaoke mode"));
|
||||||
karaokeSizer->Add(KaraokeButton,0,wxRIGHT|wxEXPAND,0);
|
karaokeSizer->Add(KaraokeButton,0,wxRIGHT|wxEXPAND,0);
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
JoinButton = new wxButton(this,Audio_Button_Join,_("Join"),wxDefaultPosition,wxSize(-1,10));
|
JoinButton = new wxButton(this,Audio_Button_Join,_T(""),wxDefaultPosition,wxSize(-1,10));
|
||||||
#else
|
#else
|
||||||
// we use this custom class to match the button style of toggle buttons in wxMac
|
// we use this custom class to match the button style of toggle buttons in wxMac
|
||||||
JoinButton = new wxBevelButton(this,Audio_Button_Join,_("Join"),wxDefaultPosition,wxSize(-1,-1));
|
JoinButton = new wxBevelButton(this,Audio_Button_Join,_T(""),wxDefaultPosition,wxSize(-1,-1));
|
||||||
#endif
|
#endif
|
||||||
JoinButton->SetToolTip(_("Join selected syllables"));
|
|
||||||
JoinButton->Enable(false);
|
|
||||||
karaokeSizer->Add(JoinButton,0,wxRIGHT|wxEXPAND,0);
|
karaokeSizer->Add(JoinButton,0,wxRIGHT|wxEXPAND,0);
|
||||||
SplitButton = new wxToggleButton(this,Audio_Button_Split,_("Split"),wxDefaultPosition,wxSize(-1,-1));
|
SplitButton = new wxButton(this,Audio_Button_Split,_T(""),wxDefaultPosition,wxSize(-1,-1));
|
||||||
SplitButton->SetToolTip(_("Toggle splitting-mode"));
|
|
||||||
SplitButton->Enable(false);
|
|
||||||
SplitButton->SetValue(false);
|
|
||||||
karaokeSizer->Add(SplitButton,0,wxRIGHT|wxEXPAND,5);
|
karaokeSizer->Add(SplitButton,0,wxRIGHT|wxEXPAND,5);
|
||||||
karaokeSizer->Add(audioKaraoke,1,wxEXPAND,0);
|
karaokeSizer->Add(audioKaraoke,1,wxEXPAND,0);
|
||||||
|
SetKaraokeButtons(); // labels, hints and enabled-ness for join/split buttons set here
|
||||||
|
|
||||||
// Main sizer
|
// Main sizer
|
||||||
MainSizer = new wxBoxSizer(wxVERTICAL);
|
MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
@ -278,13 +274,13 @@ BEGIN_EVENT_TABLE(AudioBox,wxPanel)
|
||||||
EVT_BUTTON(Audio_Button_Commit, AudioBox::OnCommit)
|
EVT_BUTTON(Audio_Button_Commit, AudioBox::OnCommit)
|
||||||
EVT_BUTTON(Audio_Button_Goto, AudioBox::OnGoto)
|
EVT_BUTTON(Audio_Button_Goto, AudioBox::OnGoto)
|
||||||
EVT_BUTTON(Audio_Button_Join,AudioBox::OnJoin)
|
EVT_BUTTON(Audio_Button_Join,AudioBox::OnJoin)
|
||||||
|
EVT_BUTTON(Audio_Button_Split,AudioBox::OnSplit)
|
||||||
EVT_BUTTON(Audio_Button_Leadin,AudioBox::OnLeadIn)
|
EVT_BUTTON(Audio_Button_Leadin,AudioBox::OnLeadIn)
|
||||||
EVT_BUTTON(Audio_Button_Leadout,AudioBox::OnLeadOut)
|
EVT_BUTTON(Audio_Button_Leadout,AudioBox::OnLeadOut)
|
||||||
|
|
||||||
EVT_TOGGLEBUTTON(Audio_Vertical_Link, AudioBox::OnVerticalLink)
|
EVT_TOGGLEBUTTON(Audio_Vertical_Link, AudioBox::OnVerticalLink)
|
||||||
EVT_TOGGLEBUTTON(Audio_Button_Karaoke, AudioBox::OnKaraoke)
|
EVT_TOGGLEBUTTON(Audio_Button_Karaoke, AudioBox::OnKaraoke)
|
||||||
EVT_TOGGLEBUTTON(Audio_Check_AutoGoto,AudioBox::OnAutoGoto)
|
EVT_TOGGLEBUTTON(Audio_Check_AutoGoto,AudioBox::OnAutoGoto)
|
||||||
EVT_TOGGLEBUTTON(Audio_Button_Split,AudioBox::OnSplit)
|
|
||||||
EVT_TOGGLEBUTTON(Audio_Check_Medusa,AudioBox::OnMedusaMode)
|
EVT_TOGGLEBUTTON(Audio_Check_Medusa,AudioBox::OnMedusaMode)
|
||||||
EVT_TOGGLEBUTTON(Audio_Check_Spectrum,AudioBox::OnSpectrumMode)
|
EVT_TOGGLEBUTTON(Audio_Check_Spectrum,AudioBox::OnSpectrumMode)
|
||||||
EVT_TOGGLEBUTTON(Audio_Check_AutoCommit,AudioBox::OnAutoCommit)
|
EVT_TOGGLEBUTTON(Audio_Check_AutoCommit,AudioBox::OnAutoCommit)
|
||||||
|
@ -523,7 +519,7 @@ void AudioBox::OnKaraoke(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
karaokeMode = false;
|
karaokeMode = false;
|
||||||
audioKaraoke->enabled = false;
|
audioKaraoke->enabled = false;
|
||||||
SetKaraokeButtons(false,false);
|
SetKaraokeButtons();
|
||||||
audioDisplay->SetDialogue();
|
audioDisplay->SetDialogue();
|
||||||
audioKaraoke->Refresh(false);
|
audioKaraoke->Refresh(false);
|
||||||
}
|
}
|
||||||
|
@ -532,7 +528,7 @@ void AudioBox::OnKaraoke(wxCommandEvent &event) {
|
||||||
wxLogDebug(_T("AudioBox::OnKaraoke: karaoke disabled, enabling"));
|
wxLogDebug(_T("AudioBox::OnKaraoke: karaoke disabled, enabling"));
|
||||||
karaokeMode = true;
|
karaokeMode = true;
|
||||||
audioKaraoke->enabled = true;
|
audioKaraoke->enabled = true;
|
||||||
SetKaraokeButtons(true,true);
|
SetKaraokeButtons();
|
||||||
audioDisplay->SetDialogue();
|
audioDisplay->SetDialogue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,15 +538,25 @@ void AudioBox::OnKaraoke(wxCommandEvent &event) {
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Sets karaoke buttons
|
// Sets karaoke buttons
|
||||||
void AudioBox::SetKaraokeButtons(bool join,bool split) {
|
void AudioBox::SetKaraokeButtons() {
|
||||||
|
// What to enable
|
||||||
|
bool join,split;
|
||||||
|
join = audioKaraoke->enabled && (audioKaraoke->splitting || audioKaraoke->selectionCount>=2);
|
||||||
|
split = audioKaraoke->enabled;
|
||||||
|
|
||||||
audioDisplay->SetFocus();
|
audioDisplay->SetFocus();
|
||||||
JoinButton->Enable(join && !audioKaraoke->splitting);
|
JoinButton->Enable(join);
|
||||||
SplitButton->Enable(split);
|
SplitButton->Enable(split);
|
||||||
SplitButton->SetValue(audioKaraoke->splitting);
|
|
||||||
if (audioKaraoke->splitting) {
|
if (audioKaraoke->splitting) {
|
||||||
SplitButton->SetLabel(_("Cancel Split"));
|
JoinButton->SetLabel(_("Cancel Split"));
|
||||||
|
JoinButton->SetToolTip(_("Discard all splits and leave split-mode"));
|
||||||
|
SplitButton->SetLabel(_("Accept Split"));
|
||||||
|
SplitButton->SetToolTip(_("Commit splits and leave split-mode"));
|
||||||
} else {
|
} else {
|
||||||
|
JoinButton->SetLabel(_("Join"));
|
||||||
|
JoinButton->SetToolTip(_("Join selected syllables"));
|
||||||
SplitButton->SetLabel(_("Split"));
|
SplitButton->SetLabel(_("Split"));
|
||||||
|
SplitButton->SetToolTip(_("Enter split-mode"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,7 +566,11 @@ void AudioBox::SetKaraokeButtons(bool join,bool split) {
|
||||||
void AudioBox::OnJoin(wxCommandEvent &event) {
|
void AudioBox::OnJoin(wxCommandEvent &event) {
|
||||||
wxLogDebug(_T("AudioBox::OnJoin"));
|
wxLogDebug(_T("AudioBox::OnJoin"));
|
||||||
audioDisplay->SetFocus();
|
audioDisplay->SetFocus();
|
||||||
audioKaraoke->Join();
|
if (!audioKaraoke->splitting) {
|
||||||
|
audioKaraoke->Join();
|
||||||
|
} else {
|
||||||
|
audioKaraoke->EndSplit(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,7 +582,7 @@ void AudioBox::OnSplit(wxCommandEvent &event) {
|
||||||
if (!audioKaraoke->splitting) {
|
if (!audioKaraoke->splitting) {
|
||||||
audioKaraoke->BeginSplit();
|
audioKaraoke->BeginSplit();
|
||||||
} else {
|
} else {
|
||||||
audioKaraoke->EndSplit(false);
|
audioKaraoke->EndSplit(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ private:
|
||||||
wxSashWindow *Sash;
|
wxSashWindow *Sash;
|
||||||
ToggleBitmap *VerticalLink;
|
ToggleBitmap *VerticalLink;
|
||||||
|
|
||||||
wxToggleButton *SplitButton;
|
wxButton *SplitButton;
|
||||||
wxButton *JoinButton;
|
wxButton *JoinButton;
|
||||||
ToggleBitmap *AutoScroll;
|
ToggleBitmap *AutoScroll;
|
||||||
ToggleBitmap *NextCommit;
|
ToggleBitmap *NextCommit;
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
~AudioBox();
|
~AudioBox();
|
||||||
|
|
||||||
void SetFile(wxString file,bool FromVideo);
|
void SetFile(wxString file,bool FromVideo);
|
||||||
void SetKaraokeButtons(bool join,bool split);
|
void SetKaraokeButtons();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
|
@ -1107,7 +1107,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
bool wasKaraSplitting = false;
|
bool wasKaraSplitting = false;
|
||||||
bool validCommit = true;
|
bool validCommit = true;
|
||||||
if (!karaoke->enabled && !karaoke->splitting) {
|
if (!karaoke->enabled && !karaoke->splitting) {
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: was not splitting karaoke"));
|
|
||||||
if (!NeedCommit || curEndMS < curStartMS) validCommit = false;
|
if (!NeedCommit || curEndMS < curStartMS) validCommit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,9 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) {
|
||||||
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue(diag=%p)"), _diag);
|
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue(diag=%p)"), _diag);
|
||||||
// Make sure we're not in splitting-mode
|
// Make sure we're not in splitting-mode
|
||||||
if (splitting) {
|
if (splitting) {
|
||||||
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: is splitting, so going to commit"));
|
wxLogDebug(_T("AudioKaraoke::LoadFromDialogue: is splitting, discarding splits"));
|
||||||
// Commit by default, discarding the splits requires explicitly cancelling
|
// Discard any splits and leave split-mode
|
||||||
// This doesn't seem to work when changing line in the grid, WHY?
|
EndSplit(false);
|
||||||
Commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set dialogue
|
// Set dialogue
|
||||||
|
@ -596,6 +595,7 @@ void AudioKaraoke::SetSelection(int start,int end) {
|
||||||
max = min;
|
max = min;
|
||||||
min = temp;
|
min = temp;
|
||||||
}
|
}
|
||||||
|
wxLogDebug(_T("AudioKaraoke::SetSelection: min=%d, max=%d"), min, max);
|
||||||
|
|
||||||
// Set values
|
// Set values
|
||||||
bool state;
|
bool state;
|
||||||
|
@ -607,9 +607,11 @@ void AudioKaraoke::SetSelection(int start,int end) {
|
||||||
if (state) sels++;
|
if (state) sels++;
|
||||||
}
|
}
|
||||||
curSyllable = min;
|
curSyllable = min;
|
||||||
|
selectionCount = max-min+1;
|
||||||
|
wxLogDebug(_T("AudioKaraoke::SetSelection: new curSyllable=%d, selectionCount=%d"), curSyllable, selectionCount);
|
||||||
|
|
||||||
// Set box buttons
|
// Set box buttons
|
||||||
box->SetKaraokeButtons(sels > 1,sels > 0);
|
box->SetKaraokeButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -642,7 +644,7 @@ void AudioKaraoke::Join() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set selection
|
// Set selection
|
||||||
curSyllable = first;
|
SetSelection(first);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
must_rebuild = true;
|
must_rebuild = true;
|
||||||
|
@ -659,7 +661,7 @@ void AudioKaraoke::BeginSplit() {
|
||||||
splitting = true;
|
splitting = true;
|
||||||
split_cursor_syl = -1;
|
split_cursor_syl = -1;
|
||||||
split_cursor_x = -1;
|
split_cursor_x = -1;
|
||||||
box->SetKaraokeButtons(false, true);
|
box->SetKaraokeButtons();
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,6 +691,7 @@ void AudioKaraoke::EndSplit(bool commit) {
|
||||||
display->Update();
|
display->Update();
|
||||||
}
|
}
|
||||||
// Always redraw, since the display is different in splitting mode
|
// Always redraw, since the display is different in splitting mode
|
||||||
|
box->SetKaraokeButtons();
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
|
|
||||||
wxLogDebug(_T("AudioKaraoke::EndSplit: returning"));
|
wxLogDebug(_T("AudioKaraoke::EndSplit: returning"));
|
||||||
|
|
|
@ -110,6 +110,7 @@ public:
|
||||||
AudioBox *box;
|
AudioBox *box;
|
||||||
|
|
||||||
int curSyllable;
|
int curSyllable;
|
||||||
|
int selectionCount;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool splitting;
|
bool splitting;
|
||||||
SylVector syllables;
|
SylVector syllables;
|
||||||
|
|
Loading…
Reference in New Issue