Skip to content

Commit

Permalink
Visuals no working first move fix. Audio timescale mess fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjakja committed Jan 26, 2018
1 parent 3cf02b7 commit f9ca0c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
21 changes: 12 additions & 9 deletions Kaiplayer/AudioDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ void AudioDisplay::DrawTimescale() {
// Timescale ticks
int64_t start = Position*samples;
int rate = provider->GetSampleRate();
int lastTextPos = -1000;
for (int i=1;i<32;i*=2) {
int pixBounds = rate / (samples * 4 / i);
if (pixBounds >= 8) {
Expand All @@ -821,7 +822,7 @@ void AudioDisplay::DrawTimescale() {
d3dLine->Draw(v2,2,timescaleText);

// Draw text
wxCoord textW,textH;
wxCoord textW;
int hr = 0;
int m = 0;
int s = pos/rate;
Expand All @@ -837,14 +838,16 @@ void AudioDisplay::DrawTimescale() {
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);
GetTextExtent(text,&textW,&textH,NULL,NULL,&scaleFont);
RECT rect;
rect.left = x-50;//MAX(0,x-textW/2)+1;
rect.top = h+8;
rect.right = rect.left + 100;
rect.bottom = rect.top + 40;
d3dFont8->DrawTextW(NULL, text.wchar_str(), -1, &rect, DT_CENTER, timescaleText );
//dc.DrawText(text,MAX(0,x-textW/2)+1,h+8);
GetTextExtent(text, &textW, NULL, NULL, NULL, &scaleFont);
if (x > lastTextPos + textW){
RECT rect;
rect.left = x - 50;//MAX(0,x-textW/2)+1;
rect.top = h + 8;
rect.right = rect.left + 100;
rect.bottom = rect.top + 40;
d3dFont8->DrawTextW(NULL, text.wchar_str(), -1, &rect, DT_CENTER, timescaleText);
lastTextPos = x;
}
}

// Other
Expand Down
7 changes: 2 additions & 5 deletions Kaiplayer/Visuals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,9 @@ void Visuals::SetVisual(bool dummy, int type)
bool vis=false;
dummytext= grid->GetVisible(&vis, &dumplaced);
if(!vis){SAFE_DELETE(dummytext); return;}
}else{
Editor->SetTextS(txt,false,false);
//Editor->Refresh(false);
Editor->SetSelection(edit->Placed.x, edit->Placed.x, true);
}

Editor->SetTextS(txt,false,false);
Editor->SetSelection(edit->Placed.x, edit->Placed.x, true);
dummytext->replace(dumplaced.x,dumplaced.y,txt);
dumplaced.y=txt.Len();
wxString *dtxt=new wxString(*dummytext);
Expand Down

0 comments on commit f9ca0c4

Please sign in to comment.