Changes to text will no longer be discarded when you commit timing in the audio display and vice-versa, fixed glitches related to the Duration time edit box, and fixed snapping.

Originally committed to SVN as r742.
This commit is contained in:
Rodrigo Braz Monteiro 2007-01-08 03:05:26 +00:00
parent 0fbfd67864
commit 0ad1815eed
6 changed files with 28 additions and 4 deletions

View File

@ -55,6 +55,7 @@
#include "colorspace.h"
#include "hotkeys.h"
#include "utils.h"
#include "timeedit_ctrl.h"
///////////////
@ -1021,9 +1022,15 @@ void AudioDisplay::CommitChanges (bool nextLine) {
curDiag->Start.SetMS(curStartMS);
curDiag->End.SetMS(curEndMS);
curDiag->Text = grid->editBox->TextEdit->GetText();
curDiag->UpdateData();
}
// Update edit box
grid->editBox->StartTime->Update();
grid->editBox->EndTime->Update();
grid->editBox->Duration->Update();
// Update grid
grid->editBox->Update(!karaoke->enabled);
grid->ass->FlagAsModified();
@ -1321,7 +1328,8 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
// Dragging nothing, time from scratch
if (!gotGrab) {
if (buttonIsDown) {
hold = 3;
if (leftIsDown) hold = 3;
else hold = 2;
lastX = x;
gotGrab = true;
}
@ -1427,7 +1435,13 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
if (diagUpdated) {
diagUpdated = false;
NeedCommit = true;
if (Options.AsBool(_T("Audio Autocommit")) && curStartMS <= curEndMS) CommitChanges();
if (curStartMS <= curEndMS) {
grid->editBox->StartTime->SetTime(curStartMS,true);
grid->editBox->EndTime->SetTime(curEndMS,true);
grid->editBox->Duration->SetTime(curEndMS-curStartMS,true);
if (Options.AsBool(_T("Audio Autocommit"))) CommitChanges();
}
else UpdateImage(true);
}
@ -1451,6 +1465,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
// Update stuff
if (updated) {
if (diagUpdated) NeedCommit = true;
player->SetEndPosition(GetSampleAtX(selEnd));
wxCursor cursor(wxCURSOR_SIZEWE);
SetCursor(cursor);

View File

@ -81,6 +81,8 @@ Please visit http://aegisub.net to download latest version
- Moved karaoke syllable text in audio display to the top instead of bottom, since it often covers important information in spectrum mode (jfs)
- Implemented a version checker that can automatically or manually check if there are any updates to Aegisub. (AMZ)
- Added support for reading v4.00++ (ASS2) files. (AMZ)
- Changes to text will no longer be discarded when you commit timing in the audio display and vice-versa. (AMZ)
- Fixed glitches related to the Duration time edit box. (AMZ)
= 1.10 beta - 2006.08.07 ===========================

View File

@ -321,6 +321,7 @@ void SubsEditBox::SetToLine(int n) {
linen = n;
StartTime->Update();
EndTime->Update();
Duration->Update();
}
}
@ -449,6 +450,7 @@ void SubsEditBox::OnFrameRadio(wxCommandEvent &event) {
if (ByFrame->GetValue()) {
StartTime->SetByFrame(true);
EndTime->SetByFrame(true);
Duration->SetByFrame(true);
grid->SetByFrame(true);
}
event.Skip();
@ -461,6 +463,7 @@ void SubsEditBox::OnTimeRadio(wxCommandEvent &event) {
if (ByTime->GetValue()) {
StartTime->SetByFrame(false);
EndTime->SetByFrame(false);
Duration->SetByFrame(false);
grid->SetByFrame(false);
}
event.Skip();
@ -509,6 +512,7 @@ void SubsEditBox::SetControlsState (bool state) {
TextEdit->SetTextTo(_T(""));
StartTime->SetTime(0);
EndTime->SetTime(0);
Duration->SetTime(0);
Layer->SetValue(_T(""));
MarginL->SetValue(_T(""));
MarginR->SetValue(_T(""));

View File

@ -59,6 +59,7 @@ class wxScintilla;
class SubsEditBox : public wxPanel {
friend class SubsTextEditHandler;
friend class SubsTextEditCtrl;
friend class AudioDisplay;
private:
bool splitLineMode;

View File

@ -102,9 +102,11 @@ void TimeEdit::Modified() {
/////////////////////////////
// Set time and update stuff
void TimeEdit::SetTime(int ms) {
void TimeEdit::SetTime(int ms,bool setModified) {
int oldMs = time.GetMS();
time.SetMS(ms);
UpdateText();
if (setModified && oldMs != ms) Modified();
}

View File

@ -69,7 +69,7 @@ public:
TimeEdit(wxWindow* parent, wxWindowID id, const wxString& value = _T(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr);
void SetByFrame(bool enable);
void SetTime(int ms);
void SetTime(int ms,bool setModified=false);
void Update();
bool HasBeenModified() { return modified; }