From fc6956ac0c776d9a75e0f1bd4846222a6aacc1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 6 Jul 2006 20:03:44 +0000 Subject: [PATCH] fix some little bugs git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18051 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/soundrecorder/RecorderWindow.cpp | 2 +- src/apps/soundrecorder/ScopeView.cpp | 25 +++++++++++++++++------ src/apps/soundrecorder/VUView.cpp | 9 ++++---- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/apps/soundrecorder/RecorderWindow.cpp b/src/apps/soundrecorder/RecorderWindow.cpp index ebdcab692e..7d6b19323d 100644 --- a/src/apps/soundrecorder/RecorderWindow.cpp +++ b/src/apps/soundrecorder/RecorderWindow.cpp @@ -246,7 +246,7 @@ RecorderWindow::InitWindow() r = background->Bounds(); r.left = 2; - r.right = r.left + 39; + r.right = r.left + 37; r.bottom = r.top + 104; fVUView = new VUView(r, B_FOLLOW_LEFT|B_FOLLOW_TOP); background->AddChild(fVUView); diff --git a/src/apps/soundrecorder/ScopeView.cpp b/src/apps/soundrecorder/ScopeView.cpp index fc22607ffa..34d3907476 100644 --- a/src/apps/soundrecorder/ScopeView.cpp +++ b/src/apps/soundrecorder/ScopeView.cpp @@ -14,9 +14,9 @@ //#define TRACE 1 #ifdef TRACE -#define TRACE(x) printf(x) +#define TRACE(x...) printf(x) #else -#define TRACE(x) +#define TRACE(x...) #endif ScopeView::ScopeView(BRect rect, uint32 resizeFlags) @@ -63,9 +63,14 @@ void ScopeView::Draw(BRect updateRect) { BRect bounds = Bounds(); - if (!fIsRendering) + SetHighColor(0,0,0); + + if (!fIsRendering) { + FillRect(BRect(0,0,2,bounds.bottom)); DrawBitmapAsync(fBitmap, BPoint(2,0)); - + } else + FillRect(bounds); + float x = 2; if (fTotalTime !=0) x = 2 + (fMainTime - fLeftTime) * (bounds.right - 2) / (fRightTime - fLeftTime); @@ -152,17 +157,20 @@ ScopeView::RenderLoop() } - TRACE("finished computing\n"); + TRACE("finished computing, rendering\n"); /* rendering */ RenderBitmap(); - + + TRACE("rendering done\n"); + /* ask drawing */ fIsRendering = false; if (Window()->LockWithTimeout(5000) == B_OK) { Invalidate(); + TRACE("invalidate done\n"); Window()->Unlock(); } } @@ -174,6 +182,7 @@ ScopeView::SetMainTime(bigtime_t timestamp) { fMainTime = timestamp; Invalidate(); + TRACE("invalidate done\n"); } @@ -182,6 +191,7 @@ ScopeView::SetTotalTime(bigtime_t timestamp) { fTotalTime = timestamp; Invalidate(); + TRACE("invalidate done\n"); } void @@ -190,6 +200,7 @@ ScopeView::SetLeftTime(bigtime_t timestamp) fLeftTime = timestamp; RenderBitmap(); Invalidate(); + TRACE("invalidate done\n"); } void @@ -198,6 +209,7 @@ ScopeView::SetRightTime(bigtime_t timestamp) fRightTime = timestamp; RenderBitmap(); Invalidate(); + TRACE("invalidate done\n"); } @@ -216,6 +228,7 @@ ScopeView::FrameResized(float width, float height) InitBitmap(); RenderBitmap(); Invalidate(); + TRACE("invalidate done\n"); } diff --git a/src/apps/soundrecorder/VUView.cpp b/src/apps/soundrecorder/VUView.cpp index b7446a5a03..549acbe482 100644 --- a/src/apps/soundrecorder/VUView.cpp +++ b/src/apps/soundrecorder/VUView.cpp @@ -22,6 +22,7 @@ VUView::VUView(BRect rect, uint32 resizeFlags) fBitmap(NULL), fQuitting(false) { + rect.OffsetTo(B_ORIGIN); fLevelCount = int(rect.Height()) / 2; fChannels = 2; fCurrentLevels = new int32[fChannels]; @@ -142,10 +143,10 @@ VUView::RenderLoop() fBitmap->Lock(); fBitmapView->BeginLineArray(fLevelCount * 2); BPoint start1, end1, start2, end2; - start1.x = 1; - start2.x = 20; - end1.x = 14; - end2.x = 33; + start1.x = 3; + start2.x = 22; + end1.x = 16; + end2.x = 35; start1.y = end1.y = start2.y = end2.y = 2; for (int32 i=fLevelCount-1; i>=0; i--) { fBitmapView->AddLine(start1, end1, levels[i][0]);