From: <pst...@us...> - 2008-03-18 03:56:09
|
Revision: 331 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=331&view=rev Author: pstieber Date: 2008-03-17 20:56:06 -0700 (Mon, 17 Mar 2008) Log Message: ----------- 1. Clicking the mouse on the number mode header toggles the mode between track number and MIDI channel. 2. Changed the way text is horizontally aligned in LineText. 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-17 23:05:36 UTC (rev 330) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-18 03:56:06 UTC (rev 331) @@ -42,6 +42,7 @@ BEGIN_EVENT_TABLE(JZTrackWindow, wxScrolledWindow) EVT_SIZE(JZTrackWindow::OnSize) EVT_ERASE_BACKGROUND(JZTrackWindow::OnEraseBackground) + EVT_LEFT_UP(JZTrackWindow::OnLeftButtonUp) END_EVENT_TABLE() //----------------------------------------------------------------------------- @@ -94,8 +95,7 @@ mPatchWidth(0), mBarCount(0), mCounterMode(eCmProgram), -// mNumberMode(eNmMidiChannel), - mNumberMode(eNmTrackNr), + mNumberMode(eNmMidiChannel), mpFixedFont(0), mFixedFontHeight(0), mFontSize(12), @@ -282,6 +282,29 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackWindow::OnLeftButtonUp(wxMouseEvent& Event) +{ + wxPoint Point = Event.GetPosition(); + + // Check to see if the mouse was clicked inside of the number mode + // indicator. + if (Point.x < mNumberWidth && Point.y < mTopInfoHeight) + { + if (mNumberMode == eNmTrackNr) + { + mNumberMode = eNmMidiChannel; + Refresh(false); + } + else + { + mNumberMode = eNmTrackNr; + Refresh(false); + } + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackWindow::ZoomIn() { if (mClocksPerPixel >= 2) @@ -694,7 +717,14 @@ } wxColor bg = Dc.GetTextBackground(); Dc.SetTextBackground(*mpGreyColor); - Dc.DrawText(pString, x + mLittleBit, y + mLittleBit); + int TextWidth, TextHeight; + Dc.GetTextExtent(pString, &TextWidth, &TextHeight); + int Margin = (Width - TextWidth) / 2; + if (Margin < mLittleBit) + { + Margin = mLittleBit; + } + Dc.DrawText(pString, x + Margin, y + mLittleBit); Dc.SetTextBackground(*wxWHITE); } Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-03-17 23:05:36 UTC (rev 330) +++ trunk/jazz/src/TrackWindow.h 2008-03-18 03:56:06 UTC (rev 331) @@ -95,6 +95,8 @@ void OnEraseBackground(wxEraseEvent& Event); + void OnLeftButtonUp(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. |