Pomyk's no focus on scrollbars patch

Originally committed to SVN as r208.
This commit is contained in:
Rodrigo Braz Monteiro 2006-03-05 20:31:04 +00:00
parent 77543d7c45
commit 564e270e54
3 changed files with 26 additions and 1 deletions

View file

@ -61,6 +61,7 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE
// Controls
audioScroll = new wxScrollBar(this,Audio_Scrollbar);
audioScroll->PushEventHandler(new FocusEvent());
audioScroll->SetToolTip(_("Seek bar"));
Sash = new wxSashWindow(this,Audio_Sash,wxDefaultPosition,wxDefaultSize,wxCLIP_CHILDREN | wxSW_3DBORDER);
sashSizer = new wxBoxSizer(wxVERTICAL);
@ -73,10 +74,13 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE
audioDisplay->ScrollBar = audioScroll;
audioDisplay->box = this;
HorizontalZoom = new wxSlider(this,Audio_Horizontal_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL);
HorizontalZoom->PushEventHandler(new FocusEvent());
HorizontalZoom->SetToolTip(_("Horizontal zoom"));
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"));
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"));
VerticalLink = new ToggleBitmap(this,Audio_Vertical_Link,wxBITMAP(toggle_audio_link));
VerticalLink->SetToolTip(_("Link vertical zoom and volxmlume sliders"));
@ -587,3 +591,16 @@ void AudioBox::OnLeadOut(wxCommandEvent &event) {
audioDisplay->SetFocus();
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();
}

View file

@ -127,6 +127,14 @@ public:
};
class FocusEvent : public wxEvtHandler {
private:
void OnSetFocus(wxFocusEvent &event);
DECLARE_EVENT_TABLE()
};
///////
// IDs
enum {

View file

@ -333,7 +333,7 @@ wxBitmap LAVCVideoProvider::GetFrame(int n) {
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);
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;
}
int seek = n - curpos;