Timeline is now drawn below audio display.
Originally committed to SVN as r212.
This commit is contained in:
parent
a00a45125e
commit
201360fd0a
2 changed files with 67 additions and 7 deletions
|
@ -86,7 +86,8 @@ AudioDisplay::AudioDisplay(wxWindow *parent,VideoDisplay *display)
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
UpdateTimer.SetOwner(this,Audio_Update_Timer);
|
UpdateTimer.SetOwner(this,Audio_Update_Timer);
|
||||||
GetVirtualSize(&w,&h);
|
GetClientSize(&w,&h);
|
||||||
|
h -= 20;
|
||||||
SetSamplesPercent(50,false);
|
SetSamplesPercent(50,false);
|
||||||
|
|
||||||
// Set cursor
|
// Set cursor
|
||||||
|
@ -128,8 +129,9 @@ void AudioDisplay::Reset() {
|
||||||
// Update image
|
// Update image
|
||||||
void AudioDisplay::UpdateImage(bool weak) {
|
void AudioDisplay::UpdateImage(bool weak) {
|
||||||
// Prepare bitmap
|
// Prepare bitmap
|
||||||
|
int displayH = h+20;
|
||||||
if (origImage) {
|
if (origImage) {
|
||||||
if (origImage->GetWidth() != w || origImage->GetHeight() != h) {
|
if (origImage->GetWidth() != w || origImage->GetHeight() != displayH) {
|
||||||
delete origImage;
|
delete origImage;
|
||||||
origImage = NULL;
|
origImage = NULL;
|
||||||
}
|
}
|
||||||
|
@ -139,10 +141,10 @@ void AudioDisplay::UpdateImage(bool weak) {
|
||||||
bool draw_selection_background = Options.AsBool(_T("Audio Draw Selection Background"));
|
bool draw_selection_background = Options.AsBool(_T("Audio Draw Selection Background"));
|
||||||
|
|
||||||
// Invalid dimensions
|
// Invalid dimensions
|
||||||
if (w == 0 || h == 0) return;
|
if (w == 0 || displayH == 0) return;
|
||||||
|
|
||||||
// New bitmap
|
// New bitmap
|
||||||
if (!origImage) origImage = new wxBitmap(w,h,-1);
|
if (!origImage) origImage = new wxBitmap(w,displayH,-1);
|
||||||
|
|
||||||
// Is spectrum?
|
// Is spectrum?
|
||||||
bool spectrum = false;
|
bool spectrum = false;
|
||||||
|
@ -365,6 +367,63 @@ void AudioDisplay::UpdateImage(bool weak) {
|
||||||
dc.DrawRectangle(0,0,w,h);
|
dc.DrawRectangle(0,0,w,h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw timescale
|
||||||
|
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||||
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
|
dc.DrawRectangle(0,h,w,20);
|
||||||
|
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT));
|
||||||
|
dc.DrawLine(0,h,w,h);
|
||||||
|
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT));
|
||||||
|
dc.DrawLine(0,h+1,w,h+1);
|
||||||
|
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
|
||||||
|
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
|
||||||
|
wxFont scaleFont;
|
||||||
|
scaleFont.SetFaceName(_T("Tahoma"));
|
||||||
|
scaleFont.SetPointSize(8);
|
||||||
|
dc.SetFont(scaleFont);
|
||||||
|
|
||||||
|
// Timescale ticks
|
||||||
|
__int64 start = Position*samples;
|
||||||
|
int rate = provider->GetSampleRate();
|
||||||
|
for (int i=1;i<32;i*=2) {
|
||||||
|
int pixBounds = rate / (samples * 4 / i);
|
||||||
|
if (pixBounds >= 8) {
|
||||||
|
for (int x=0;x<w;x++) {
|
||||||
|
__int64 pos = (x*samples)+start;
|
||||||
|
// Second boundary
|
||||||
|
if (pos % rate < samples) {
|
||||||
|
dc.DrawLine(x,h+2,x,h+8);
|
||||||
|
|
||||||
|
// Draw text
|
||||||
|
wxCoord textW,textH;
|
||||||
|
int hr = 0;
|
||||||
|
int m = 0;
|
||||||
|
int s = pos/rate;
|
||||||
|
while (s >= 3600) {
|
||||||
|
s -= 3600;
|
||||||
|
hr++;
|
||||||
|
}
|
||||||
|
while (s >= 60) {
|
||||||
|
s -= 60;
|
||||||
|
m++;
|
||||||
|
}
|
||||||
|
wxString text;
|
||||||
|
if (hr) text = wxString::Format(_T("%i:%02i:%02i"),hr,m,s);
|
||||||
|
else if (m) text = wxString::Format(_T("%i:%02i"),m,s);
|
||||||
|
else text = wxString::Format(_T("%i"),s);
|
||||||
|
dc.GetTextExtent(text,&textW,&textH,NULL,NULL,&scaleFont);
|
||||||
|
dc.DrawText(text,MAX(0,x-textW/2)+1,h+8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other
|
||||||
|
else if (pos % (rate / 4 * i) < samples) {
|
||||||
|
dc.DrawLine(x,h+2,x,h+5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
dc.EndDrawing();
|
dc.EndDrawing();
|
||||||
|
|
||||||
|
@ -1183,6 +1242,8 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
dc.EndDrawing();
|
dc.EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!inside) return;
|
||||||
|
|
||||||
// Left/middle click
|
// Left/middle click
|
||||||
if (event.ButtonDown(wxMOUSE_BTN_LEFT) || event.Button(wxMOUSE_BTN_MIDDLE)) {
|
if (event.ButtonDown(wxMOUSE_BTN_LEFT) || event.Button(wxMOUSE_BTN_MIDDLE)) {
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
@ -1443,10 +1504,8 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
// Size event
|
// Size event
|
||||||
void AudioDisplay::OnSize(wxSizeEvent &event) {
|
void AudioDisplay::OnSize(wxSizeEvent &event) {
|
||||||
// Set size
|
// Set size
|
||||||
//GetVirtualSize(&w,&h);
|
|
||||||
GetClientSize(&w,&h);
|
GetClientSize(&w,&h);
|
||||||
//w = event.GetSize().GetWidth();
|
h -= 20;
|
||||||
//h = event.GetSize().GetHeight();
|
|
||||||
|
|
||||||
// Update image
|
// Update image
|
||||||
UpdateImage();
|
UpdateImage();
|
||||||
|
|
|
@ -64,6 +64,7 @@ Please visit http://aegisub.net to download latest version
|
||||||
- Last folder for all the file selection dialogs are now remembered in config.dat. (Pomyk)
|
- Last folder for all the file selection dialogs are now remembered in config.dat. (Pomyk)
|
||||||
- Audio current play position cursor will now always be visible. (AMZ)
|
- Audio current play position cursor will now always be visible. (AMZ)
|
||||||
- Removed video frame/subtitles time sync controls from the grid context menu. (AMZ)
|
- Removed video frame/subtitles time sync controls from the grid context menu. (AMZ)
|
||||||
|
- Timeline is now drawn below audio display. (AMZ)
|
||||||
|
|
||||||
|
|
||||||
= 1.09 beta - 2006.01.16 ===========================
|
= 1.09 beta - 2006.01.16 ===========================
|
||||||
|
|
Loading…
Reference in a new issue