mirror of https://github.com/odrling/Aegisub
Added options to toggle the display of the audio timeline and of the time over the mouse cursor.
Originally committed to SVN as r724.
This commit is contained in:
parent
d58fba3839
commit
7843e2e89c
|
@ -94,7 +94,7 @@ AudioDisplay::AudioDisplay(wxWindow *parent,VideoDisplay *display)
|
|||
// Init
|
||||
UpdateTimer.SetOwner(this,Audio_Update_Timer);
|
||||
GetClientSize(&w,&h);
|
||||
h -= 20;
|
||||
h -= Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
||||
SetSamplesPercent(50,false);
|
||||
|
||||
// Set cursor
|
||||
|
@ -139,7 +139,8 @@ void AudioDisplay::UpdateImage(bool weak) {
|
|||
if (!loaded || !provider) return;
|
||||
|
||||
// Prepare bitmap
|
||||
int displayH = h+20;
|
||||
int timelineHeight = Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
||||
int displayH = h+timelineHeight;
|
||||
if (origImage) {
|
||||
if (origImage->GetWidth() != w || origImage->GetHeight() != displayH) {
|
||||
delete origImage;
|
||||
|
@ -391,9 +392,10 @@ void AudioDisplay::UpdateImage(bool weak) {
|
|||
}
|
||||
|
||||
// Draw timescale
|
||||
if (timelineHeight) {
|
||||
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.DrawRectangle(0,h,w,20);
|
||||
dc.DrawRectangle(0,h,w,timelineHeight);
|
||||
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT));
|
||||
dc.DrawLine(0,h,w,h);
|
||||
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT));
|
||||
|
@ -446,6 +448,7 @@ void AudioDisplay::UpdateImage(bool weak) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Done
|
||||
Refresh(false);
|
||||
|
@ -803,6 +806,17 @@ void AudioDisplay::Update() {
|
|||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
// Recreate the image
|
||||
void AudioDisplay::RecreateImage() {
|
||||
GetClientSize(&w,&h);
|
||||
h -= Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
||||
delete origImage;
|
||||
origImage = NULL;
|
||||
UpdateImage(false);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////
|
||||
// Make dialogue visible
|
||||
void AudioDisplay::MakeDialogueVisible(bool force) {
|
||||
|
@ -1287,6 +1301,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
|||
bool karMode = karaoke->enabled;
|
||||
bool shiftDown = event.m_shiftDown;
|
||||
bool ctrlDown = event.m_controlDown;
|
||||
int timelineHeight = Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
||||
|
||||
// Leaving event
|
||||
if (event.Leaving()) {
|
||||
|
@ -1304,7 +1319,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
|||
// Get focus
|
||||
if (wxWindow::FindFocus() != this && Options.AsBool(_T("Audio Autofocus"))) SetFocus();
|
||||
}
|
||||
else if (y < h+20) onScale = true;
|
||||
else if (y < h+timelineHeight) onScale = true;
|
||||
}
|
||||
|
||||
// Click type
|
||||
|
@ -1350,6 +1365,8 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
|||
dc.SetLogicalFunction(wxINVERT);
|
||||
dc.DrawLine(x,0,x,h);
|
||||
|
||||
// Time
|
||||
if (Options.AsBool(_T("Audio Draw Cursor Time"))) {
|
||||
// Time string
|
||||
AssTime time;
|
||||
time.SetMS(GetMSAtX(x));
|
||||
|
@ -1383,6 +1400,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
|||
dc.DrawText(text,dx,dy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scale dragging
|
||||
if ((hold == 0 && onScale) || draggingScale) {
|
||||
|
@ -1815,7 +1833,7 @@ int AudioDisplay::GetBoundarySnap(int x,int range) {
|
|||
void AudioDisplay::OnSize(wxSizeEvent &event) {
|
||||
// Set size
|
||||
GetClientSize(&w,&h);
|
||||
h -= 20;
|
||||
h -= Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
||||
|
||||
// Update image
|
||||
UpdateImage();
|
||||
|
|
|
@ -143,6 +143,7 @@ public:
|
|||
void AddLead(bool in,bool out);
|
||||
void UpdateImage(bool weak=false);
|
||||
void Update();
|
||||
void RecreateImage();
|
||||
void SetPosition(int pos);
|
||||
void SetSamplesPercent(int percent,bool update=true,float pivot=0.5);
|
||||
void SetScale(float scale);
|
||||
|
|
|
@ -74,6 +74,7 @@ Please visit http://aegisub.net to download latest version
|
|||
o The "Play" shortcut will always play, regardless of whether it was already playing or not. There is a new shortcut for "Stop".
|
||||
o Styles for line start/end markers have changed.
|
||||
- Fixed loading of SRT and TXT files, which were causing an empty line to appear at the start of the file. (AMZ)
|
||||
- Added options to toggle the display of the audio timeline and of the time over the mouse cursor. (AMZ)
|
||||
|
||||
|
||||
= 1.10 beta - 2006.08.07 ===========================
|
||||
|
|
|
@ -469,11 +469,11 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
|||
wxFlexGridSizer *displaySizer4 = new wxFlexGridSizer(14,2,2,2);
|
||||
|
||||
// First sizer
|
||||
wxString labels1[3] = { _("Spectrum Invert Selection"), _("Draw Secondary Lines"), _("Draw Selection Background") };
|
||||
wxString options1[3] = { _T("Audio Spectrum invert selection"), _T("Audio Draw Secondary Lines"), _T("Audio Draw Selection Background") };
|
||||
for (int i=0;i<3;i++) {
|
||||
wxString labels1[5] = { _("Spectrum Invert Selection"), _("Draw Secondary Lines"), _("Draw Selection Background"), _("Draw Timeline"), _("Draw Cursor Time") };
|
||||
wxString options1[5] = { _T("Spectrum invert selection"), _T("Draw Secondary Lines"), _T("Draw Selection Background") , _T("Draw Timeline"), _T("Draw Cursor Time")};
|
||||
for (int i=0;i<5;i++) {
|
||||
wxCheckBox *control = new wxCheckBox(displayPage,-1,labels1[i]);
|
||||
Bind(control,options1[i]);
|
||||
Bind(control,_T("Audio ") + options1[i]);
|
||||
displaySizer3->Add(control,1,wxEXPAND | wxALL,5);
|
||||
}
|
||||
|
||||
|
@ -755,7 +755,7 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
|||
// Audio
|
||||
if (audio) {
|
||||
FrameMain *frame = (FrameMain*) GetParent();
|
||||
frame->audioBox->audioDisplay->UpdateImage();
|
||||
frame->audioBox->audioDisplay->RecreateImage();
|
||||
frame->audioBox->audioDisplay->Refresh();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,6 +217,8 @@ void OptionsManager::LoadDefaults() {
|
|||
SetBool(_T("Audio Spectrum invert selection"), true);
|
||||
SetBool(_T("Audio Draw Secondary Lines"), true);
|
||||
SetBool(_T("Audio Draw Selection Background"), true);
|
||||
SetBool(_T("Audio Draw Timeline"),true);
|
||||
SetBool(_T("Audio Draw Cursor Time"),true);
|
||||
SetColour(_T("Audio Selection Background Modified"),wxColour(92,0,0));
|
||||
SetColour(_T("Audio Selection Background"),wxColour(64,64,64));
|
||||
SetColour(_T("Audio Seconds Boundaries"),wxColour(0,100,255));
|
||||
|
|
Loading…
Reference in New Issue