Fixed audio follow cursor bug.

Originally committed to SVN as r234.
This commit is contained in:
Rodrigo Braz Monteiro 2006-03-20 21:48:01 +00:00
parent 054350a17d
commit 87cfe62e0c
4 changed files with 28 additions and 25 deletions

View file

@ -1561,7 +1561,8 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
// Scroll if needed
int posX = GetXAtSample(curPos);
bool fullDraw = false;
bool centerLock = Options.AsBool(_T("Audio lock scroll on cursor"));
bool centerLock = false;
bool scrollToCursor = Options.AsBool(_T("Audio lock scroll on cursor"));
if (centerLock) {
int goTo = MAX(0,curPos - w*samples/2);
if (goTo >= 0) {
@ -1571,12 +1572,14 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
}
}
else {
if (posX < 80 || posX > w-80) {
int goTo = MAX(0,curPos - 80*samples);
if (goTo >= 0) {
UpdatePosition(goTo,true);
UpdateImage();
fullDraw = true;
if (scrollToCursor) {
if (posX < 80 || posX > w-80) {
int goTo = MAX(0,curPos - 80*samples);
if (goTo >= 0) {
UpdatePosition(goTo,true);
UpdateImage();
fullDraw = true;
}
}
}
}

View file

@ -68,7 +68,7 @@ Please visit http://aegisub.net to download latest version
- Fixed bug which caused extra newlines to be added at the end of file. (AMZ)
- Added a horizontal scrollbar to shift times history. (AMZ)
- Removed the "Help" button from Find/Replace dialog. (AMZ)
- Added a bias slider to the "make times continuous" function in timing post-processor, to set the point between the subs where they will meet. (AMZ)
- Added a bias slider to the "make times continuous" function in timing post-processor, which sets the point between the subs where the two lines will meet. (AMZ)
= 1.09 beta - 2006.01.16 ===========================

View file

@ -77,37 +77,37 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
styles.Add(_T(""));
CommentBox = new wxCheckBox(this,COMMENT_CHECKBOX,_("Comment"));
CommentBox->SetToolTip(_("Comment this line out. Commented lines don't show up on screen."));
StyleBox = new wxComboBox(this,STYLE_COMBOBOX,_T(""),wxDefaultPosition,wxSize(90,25),styles,wxCB_READONLY);
StyleBox = new wxComboBox(this,STYLE_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_READONLY);
StyleBox->SetToolTip(_("Style for this line."));
ActorBox = new wxComboBox(this,ACTOR_COMBOBOX,_T(""),wxDefaultPosition,wxSize(90,25),styles,wxCB_DROPDOWN);
ActorBox = new wxComboBox(this,ACTOR_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_DROPDOWN);
ActorBox->SetToolTip(_("Actor name for this speech. This is only for reference, and is mainly useless."));
MarginL = new HiliModTextCtrl(this,MARGINL_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_PROCESS_ENTER,NumValidator());
MarginL = new HiliModTextCtrl(this,MARGINL_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator());
MarginL->SetToolTip(_("Left Margin (0000 = default)"));
MarginR = new HiliModTextCtrl(this,MARGINR_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_PROCESS_ENTER,NumValidator());
MarginR = new HiliModTextCtrl(this,MARGINR_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator());
MarginR->SetToolTip(_("Right Margin (0000 = default)"));
MarginV = new HiliModTextCtrl(this,MARGINV_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_PROCESS_ENTER,NumValidator());
MarginV = new HiliModTextCtrl(this,MARGINV_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator());
MarginV->SetToolTip(_("Vertical Margin (0000 = default)"));
// Middle controls
Layer = new HiliModTextCtrl(this,LAYER_BOX,_T(""),wxDefaultPosition,wxSize(30,20),0,NumValidator());
Layer = new HiliModTextCtrl(this,LAYER_BOX,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator());
Layer->SetToolTip(_("Layer number"));
StartTime = new TimeEdit(this,STARTTIME_BOX,_T(""),wxDefaultPosition,wxSize(70,20));
StartTime = new TimeEdit(this,STARTTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20));
StartTime->SetToolTip(_("Start time"));
StartTime->showModified = true;
EndTime = new TimeEdit(this,ENDTIME_BOX,_T(""),wxDefaultPosition,wxSize(70,20),0,NumValidator());
EndTime = new TimeEdit(this,ENDTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20),0,NumValidator());
EndTime->SetToolTip(_("End time"));
EndTime->isEnd = true;
EndTime->showModified = true;
Duration = new TimeEdit(this,DURATION_BOX,_T(""),wxDefaultPosition,wxSize(70,20),0,NumValidator());
Duration = new TimeEdit(this,DURATION_BOX,_T(""),wxDefaultPosition,wxSize(75,20),0,NumValidator());
Duration->SetToolTip(_("Line duration"));
Duration->showModified = true;
ByTime = new wxRadioButton(this,RADIO_TIME_BY_TIME,_("Time"),wxDefaultPosition,wxDefaultSize,wxRB_GROUP);
ByTime->SetToolTip(_("Time by h:mm:ss.cs"));
ByFrame = new wxRadioButton(this,RADIO_TIME_BY_FRAME,_("Frame"));
ByFrame->SetToolTip(_("Time by frame number"));
SyntaxHighlight = new wxCheckBox(this,SYNTAX_BOX,_("Syntax"));
SyntaxHighlight->SetToolTip(_("Enable syntax highlighting"));
SyntaxHighlight->SetValue(Options.AsBool(_T("Syntax Highlight Enabled")));
//SyntaxHighlight = new wxCheckBox(this,SYNTAX_BOX,_("Syntax"));
//SyntaxHighlight->SetToolTip(_("Enable syntax highlighting"));
//SyntaxHighlight->SetValue(Options.AsBool(_T("Syntax Highlight Enabled")));
// Top sizer
wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL);
@ -122,11 +122,11 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren
wxSizer *MiddleSizer = new wxBoxSizer(wxHORIZONTAL);
MiddleSizer->Add(Layer,0,wxRIGHT,5);
MiddleSizer->Add(StartTime,0,wxRIGHT,0);
MiddleSizer->Add(EndTime,0,wxRIGHT,0);
MiddleSizer->Add(EndTime,0,wxRIGHT,5);
MiddleSizer->Add(Duration,0,wxRIGHT,5);
MiddleSizer->Add(ByTime,0,wxRIGHT | wxALIGN_CENTER,5);
MiddleSizer->Add(ByFrame,0,wxRIGHT | wxALIGN_CENTER,5);
MiddleSizer->Add(SyntaxHighlight,0,wxRIGHT | wxALIGN_CENTER,5);
//MiddleSizer->Add(SyntaxHighlight,0,wxRIGHT | wxALIGN_CENTER,5);
// Middle-bottom controls
Bold = new wxBitmapButton(this,BUTTON_BOLD,wxBITMAP(button_bold),wxDefaultPosition,wxSize(20,20));
@ -304,7 +304,7 @@ void SubsEditBox::SetText(const wxString _text) {
// Mode
int mode = 0;
if (SyntaxHighlight->IsChecked()) mode = 1;
if (Options.AsBool(_T("Syntax Highlight Enabled"))) mode = 1;
// Syntax highlighted
if (mode == 1) {
@ -530,7 +530,7 @@ void SubsEditBox::SetControlsState (bool state) {
StyleBox->Enable(state);
ActorBox->Enable(state);
ByTime->Enable(state);
SyntaxHighlight->Enable(state);
//SyntaxHighlight->Enable(state);
Bold->Enable(state);
Italics->Enable(state);
Underline->Enable(state);

View file

@ -45,7 +45,7 @@
///////////////
// Constructor
TimeEdit::TimeEdit(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) :
wxTextCtrl(parent,id,value,pos,size,style,validator,name)
wxTextCtrl(parent,id,value,pos,size,wxTE_CENTRE | style,validator,name)
{
SetValue(time.GetASSFormated());
ready = true;