mirror of https://github.com/odrling/Aegisub
Pomyk's no focus on scrollbars patch
Originally committed to SVN as r208.
This commit is contained in:
parent
77543d7c45
commit
564e270e54
|
@ -61,6 +61,7 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
audioScroll = new wxScrollBar(this,Audio_Scrollbar);
|
audioScroll = new wxScrollBar(this,Audio_Scrollbar);
|
||||||
|
audioScroll->PushEventHandler(new FocusEvent());
|
||||||
audioScroll->SetToolTip(_("Seek bar"));
|
audioScroll->SetToolTip(_("Seek bar"));
|
||||||
Sash = new wxSashWindow(this,Audio_Sash,wxDefaultPosition,wxDefaultSize,wxCLIP_CHILDREN | wxSW_3DBORDER);
|
Sash = new wxSashWindow(this,Audio_Sash,wxDefaultPosition,wxDefaultSize,wxCLIP_CHILDREN | wxSW_3DBORDER);
|
||||||
sashSizer = new wxBoxSizer(wxVERTICAL);
|
sashSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
@ -73,10 +74,13 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE
|
||||||
audioDisplay->ScrollBar = audioScroll;
|
audioDisplay->ScrollBar = audioScroll;
|
||||||
audioDisplay->box = this;
|
audioDisplay->box = this;
|
||||||
HorizontalZoom = new wxSlider(this,Audio_Horizontal_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL);
|
HorizontalZoom = new wxSlider(this,Audio_Horizontal_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL);
|
||||||
|
HorizontalZoom->PushEventHandler(new FocusEvent());
|
||||||
HorizontalZoom->SetToolTip(_("Horizontal zoom"));
|
HorizontalZoom->SetToolTip(_("Horizontal zoom"));
|
||||||
VerticalZoom = new wxSlider(this,Audio_Vertical_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_INVERSE);
|
VerticalZoom = new wxSlider(this,Audio_Vertical_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_INVERSE);
|
||||||
|
VerticalZoom->PushEventHandler(new FocusEvent());
|
||||||
VerticalZoom->SetToolTip(_("Vertical zoom"));
|
VerticalZoom->SetToolTip(_("Vertical zoom"));
|
||||||
VolumeBar = new wxSlider(this,Audio_Volume,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_INVERSE);
|
VolumeBar = new wxSlider(this,Audio_Volume,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_INVERSE);
|
||||||
|
VolumeBar->PushEventHandler(new FocusEvent());
|
||||||
VolumeBar->SetToolTip(_("Audio Volume"));
|
VolumeBar->SetToolTip(_("Audio Volume"));
|
||||||
VerticalLink = new ToggleBitmap(this,Audio_Vertical_Link,wxBITMAP(toggle_audio_link));
|
VerticalLink = new ToggleBitmap(this,Audio_Vertical_Link,wxBITMAP(toggle_audio_link));
|
||||||
VerticalLink->SetToolTip(_("Link vertical zoom and volxmlume sliders"));
|
VerticalLink->SetToolTip(_("Link vertical zoom and volxmlume sliders"));
|
||||||
|
@ -587,3 +591,16 @@ void AudioBox::OnLeadOut(wxCommandEvent &event) {
|
||||||
audioDisplay->SetFocus();
|
audioDisplay->SetFocus();
|
||||||
audioDisplay->AddLead(false,true);
|
audioDisplay->AddLead(false,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
// Focus event handling for the scrollbar
|
||||||
|
BEGIN_EVENT_TABLE(FocusEvent,wxEvtHandler)
|
||||||
|
EVT_SET_FOCUS(FocusEvent::OnSetFocus)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void FocusEvent::OnSetFocus(wxFocusEvent &event) {
|
||||||
|
wxWindow *previous = event.GetWindow();
|
||||||
|
if (previous) previous->SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,14 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class FocusEvent : public wxEvtHandler {
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnSetFocus(wxFocusEvent &event);
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
///////
|
///////
|
||||||
// IDs
|
// IDs
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -333,7 +333,7 @@ wxBitmap LAVCVideoProvider::GetFrame(int n) {
|
||||||
if (mkv_ReadFrame(mkv.file,0,&rt,&startTime,&endTime,&filePos,&frameSize,&frameFlags) == 0) {
|
if (mkv_ReadFrame(mkv.file,0,&rt,&startTime,&endTime,&filePos,&frameSize,&frameFlags) == 0) {
|
||||||
result = av_seek_frame(formatContext,vidStream,filePos,AVSEEK_FLAG_BYTE | AVSEEK_FLAG_BACKWARD);
|
result = av_seek_frame(formatContext,vidStream,filePos,AVSEEK_FLAG_BYTE | AVSEEK_FLAG_BACKWARD);
|
||||||
int curpos = 0;
|
int curpos = 0;
|
||||||
for (int i=0;i<mkv.rawFrames.size();i++) {
|
for (unsigned int i=0;i<mkv.rawFrames.size();i++) {
|
||||||
if (mkv.rawFrames[i].time == startTime / 1000000.0) curpos = i;
|
if (mkv.rawFrames[i].time == startTime / 1000000.0) curpos = i;
|
||||||
}
|
}
|
||||||
int seek = n - curpos;
|
int seek = n - curpos;
|
||||||
|
|
Loading…
Reference in New Issue