From: <pst...@us...> - 2008-03-18 04:25:06
|
Revision: 333 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=333&view=rev Author: pstieber Date: 2008-03-17 21:25:04 -0700 (Mon, 17 Mar 2008) Log Message: ----------- Added code to increment the default tempo 1 bpm with a left-click on the tempo header and decrement the default tempo 1 bpm with a right-click. Modified Paths: -------------- trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-18 04:09:09 UTC (rev 332) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-18 04:25:04 UTC (rev 333) @@ -43,6 +43,7 @@ EVT_SIZE(JZTrackWindow::OnSize) EVT_ERASE_BACKGROUND(JZTrackWindow::OnEraseBackground) EVT_LEFT_UP(JZTrackWindow::OnLeftButtonUp) + EVT_RIGHT_UP(JZTrackWindow::OnRightButtonUp) END_EVENT_TABLE() //----------------------------------------------------------------------------- @@ -302,6 +303,19 @@ } } else if ( + Point.x >= mTrackNameX && Point.x < mTrackNameX + mTrackNameWidth && + Point.y < mTopInfoHeight) + { + // Bump up the speed value one tick. + int SpeedBpm = gpProject->GetTrack(0)->GetDefaultSpeed(); + ++SpeedBpm; + if (SpeedBpm > 0 && SpeedBpm < 300) + { + gpProject->GetTrack(0)->SetDefaultSpeed(SpeedBpm); + } + Refresh(false); + } + else if ( Point.x >= mPatchX && Point.x < mPatchX + mPatchWidth && Point.y < mTopInfoHeight) { @@ -333,6 +347,27 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackWindow::OnRightButtonUp(wxMouseEvent& Event) +{ + wxPoint Point = Event.GetPosition(); + + if ( + Point.x >= mTrackNameX && Point.x < mTrackNameX + mTrackNameWidth && + Point.y < mTopInfoHeight) + { + // Knock down the speed value one tick. + int SpeedBpm = gpProject->GetTrack(0)->GetDefaultSpeed(); + --SpeedBpm; + if (SpeedBpm > 0 && SpeedBpm < 300) + { + gpProject->GetTrack(0)->SetDefaultSpeed(SpeedBpm); + } + Refresh(false); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackWindow::ZoomIn() { if (mClocksPerPixel >= 2) @@ -665,7 +700,14 @@ ostringstream Oss; Oss << "speed: " << setw(3) << Value; - LineText(Dc, mTrackNameX, -1, mTrackNameWidth, Oss.str().c_str(), mTopInfoHeight, Down); + LineText( + Dc, + mTrackNameX, + -1, + mTrackNameWidth, + Oss.str().c_str(), + mTopInfoHeight, + Down); } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-03-18 04:09:09 UTC (rev 332) +++ trunk/jazz/src/TrackWindow.h 2008-03-18 04:25:04 UTC (rev 333) @@ -97,6 +97,8 @@ void OnLeftButtonUp(wxMouseEvent& Event); + void OnRightButtonUp(wxMouseEvent& Event); + virtual void OnDraw(wxDC& Dc); void Draw(wxDC& Dc); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |