Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26486

Modified Files:
        MixerBoard.cpp MixerBoard.h 
Log Message:
*  Made bevel for selected track wider so selection state is more visible.
* Changed tooltip for track name to be the name rather than "Track Name".
* Made clicking on the instrument select the track, so it does something in the 
meantime, pending an image menu.



Index: MixerBoard.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/MixerBoard.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- MixerBoard.cpp      21 Aug 2009 19:16:23 -0000      1.19
+++ MixerBoard.cpp      21 Aug 2009 23:09:35 -0000      1.20
@@ -83,10 +83,10 @@
 #define kLeftSideStackWidth         MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH - 
kDoubleInset //vvvvv Change when numbers shown on slider scale.
 #define kRightSideStackWidth        MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH + 
kInset
 #define kRequiredHeightBelowMeter   (2 * (kDoubleInset + MUTE_SOLO_HEIGHT)) + 
kQuadrupleInset // mute/solo buttons stacked at bottom right
-#define kMixerTrackClusterWidth     kLeftSideStackWidth + kRightSideStackWidth 
+ kDoubleInset // kInset margin on both sides
+#define kMixerTrackClusterWidth     kLeftSideStackWidth + kRightSideStackWidth 
+ kQuadrupleInset // kInset margin on both sides
 
 enum {
-   ID_MUSICAL_INSTRUMENT_IMAGE = 13000, 
+   ID_BITMAPBUTTON_MUSICAL_INSTRUMENT = 13000, 
    ID_TOGGLEBUTTON_MUTE, 
    ID_TOGGLEBUTTON_SOLO,
    ID_SLIDER_PAN,
@@ -96,6 +96,8 @@
 BEGIN_EVENT_TABLE(MixerTrackCluster, wxPanel)
    EVT_CHAR(MixerTrackCluster::OnKeyEvent)
    EVT_MOUSE_EVENTS(MixerTrackCluster::OnMouseEvent)
+
+   EVT_BUTTON(ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, 
MixerTrackCluster::OnButton_MusicalInstrument) 
    EVT_COMMAND(ID_TOGGLEBUTTON_MUTE, wxEVT_COMMAND_BUTTON_CLICKED, 
MixerTrackCluster::OnButton_Mute)
    EVT_COMMAND(ID_TOGGLEBUTTON_SOLO, wxEVT_COMMAND_BUTTON_CLICKED, 
MixerTrackCluster::OnButton_Solo)
    EVT_PAINT(MixerTrackCluster::OnPaint)
@@ -126,8 +128,8 @@
    // (Still available in Audacity_UmixIt branch off 1.2.6.)
 
    // track name
-   wxPoint ctrlPos(kInset, kInset);
-   wxSize ctrlSize(size.GetWidth() - kDoubleInset, TRACK_NAME_HEIGHT);
+   wxPoint ctrlPos(kDoubleInset, kDoubleInset);
+   wxSize ctrlSize(size.GetWidth() - kQuadrupleInset, TRACK_NAME_HEIGHT);
    mStaticText_TrackName = 
       new wxStaticText(this, -1, mLeftTrack->GetName(), ctrlPos, ctrlSize, 
                         wxALIGN_CENTRE | wxST_NO_AUTORESIZE | wxSUNKEN_BORDER);
@@ -155,13 +157,13 @@
 
 
    // gain slider at left
-   ctrlPos.x = kInset;
+   ctrlPos.x = kDoubleInset;
    ctrlPos.y += PAN_HEIGHT + kDoubleInset;
 
    const int nGainSliderHeight = 
       size.GetHeight() - ctrlPos.y - kQuadrupleInset;
    ctrlSize = 
-      wxSize(kLeftSideStackWidth - kDoubleInset, nGainSliderHeight);
+      wxSize(kLeftSideStackWidth - kQuadrupleInset, nGainSliderHeight);
 
    mSlider_Gain = 
       new MixerTrackSlider(
@@ -189,8 +191,11 @@
    ctrlSize = wxSize(MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH, 
MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH);
    wxBitmap* bitmap = mMixerBoard->GetMusicalInstrumentBitmap(mLeftTrack);
    wxASSERT(bitmap);
-   mStaticBitmap_MusicalInstrument = 
-      new wxStaticBitmap(this, -1, *bitmap, ctrlPos, ctrlSize);
+   mBitmapButton_MusicalInstrument = 
+      new wxBitmapButton(this, ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, *bitmap, 
+                           ctrlPos, ctrlSize, 
+                           wxBU_AUTODRAW, wxDefaultValidator, 
+                           _("Musical Instrument"));
 
 
    // meter
@@ -230,7 +235,7 @@
    this->UpdateSolo();
 
    #if wxUSE_TOOLTIPS
-      mStaticText_TrackName->SetToolTip(_T("Track Name"));
+      mStaticText_TrackName->SetToolTip(mLeftTrack->GetName());
       mToggleButton_Mute->SetToolTip(_T("Mute"));
       mToggleButton_Solo->SetToolTip(_T("Solo"));
       mMeter->SetToolTip(_T("Signal Level Meter"));
@@ -326,8 +331,13 @@
 
 void MixerTrackCluster::UpdateName()
 {
-   mStaticText_TrackName->SetLabel(mLeftTrack->GetName()); 
-   
mStaticBitmap_MusicalInstrument->SetBitmap(*(mMixerBoard->GetMusicalInstrumentBitmap(mLeftTrack)));
+   const wxString newName = mLeftTrack->GetName();
+   mStaticText_TrackName->SetLabel(newName); 
+   #if wxUSE_TOOLTIPS
+      mStaticText_TrackName->SetToolTip(newName);
+   #endif
+   mBitmapButton_MusicalInstrument->SetBitmapLabel(
+      *(mMixerBoard->GetMusicalInstrumentBitmap(mLeftTrack)));
 }
 
 void MixerTrackCluster::UpdateMute()
@@ -447,6 +457,43 @@
 
 // event handlers
 
+void MixerTrackCluster::HandleSelect(const bool bShiftDown)
+{
+   if (bShiftDown) 
+   {
+      // ShiftDown => Just toggle selection on this track.
+      bool bSelect = !mLeftTrack->GetSelected();
+      mLeftTrack->SetSelected(bSelect);
+      if (mRightTrack)
+         mRightTrack->SetSelected(bSelect);
+
+      // Refresh only this MixerTrackCluster and WaveTrack in TrackPanel.
+      this->Refresh(true); 
+      mProject->RefreshTPTrack(mLeftTrack);
+   }
+   else
+   {
+      // exclusive select
+      mProject->SelectNone();
+      mLeftTrack->SetSelected(true);
+      if (mRightTrack)
+         mRightTrack->SetSelected(true);
+
+      if (mProject->GetSel0() >= mProject->GetSel1())
+      {
+         // No range previously selected, so use the range of this track. 
+         mProject->mViewInfo.sel0 = mLeftTrack->GetOffset();
+         mProject->mViewInfo.sel1 = mLeftTrack->GetEndTime();
+      }
+
+      // Exclusive select, so refresh all MixerTrackClusters.
+      //    This could just be a call to wxWindow::Refresh, but this is 
+      //    more efficient and when ProjectLogo is shown as background, 
+      //    it's necessary to prevent blinking.
+      mMixerBoard->RefreshTrackClusters(false);
+   }
+}
+
 void MixerTrackCluster::OnKeyEvent(wxKeyEvent & event)
 {
    mProject->HandleKeyDown(event);
@@ -455,41 +502,9 @@
 void MixerTrackCluster::OnMouseEvent(wxMouseEvent& event)
 {
    if (event.ButtonUp()) 
-   {
-      if (event.ShiftDown()) 
-      {
-         // ShiftDown => Just toggle selection on this track.
-         bool bSelect = !mLeftTrack->GetSelected();
-         mLeftTrack->SetSelected(bSelect);
-         if (mRightTrack)
-            mRightTrack->SetSelected(bSelect);
-
-         // Refresh only this MixerTrackCluster and WaveTrack in TrackPanel.
-         this->Refresh(true); 
-         mProject->RefreshTPTrack(mLeftTrack);
-      }
-      else
-      {
-         // exclusive select
-         mProject->SelectNone();
-         mLeftTrack->SetSelected(true);
-         if (mRightTrack)
-            mRightTrack->SetSelected(true);
-
-         if (mProject->GetSel0() >= mProject->GetSel1())
-         {
-            // No range previously selected, so use the range of this track. 
-            mProject->mViewInfo.sel0 = mLeftTrack->GetOffset();
-            mProject->mViewInfo.sel1 = mLeftTrack->GetEndTime();
-         }
-
-         // Exclusive select, so refresh all MixerTrackClusters.
-         //    This could just be a call to wxWindow::Refresh, but this is 
-         //    more efficient and when ProjectLogo is shown as background, 
-         //    it's necessary to prevent blinking.
-         mMixerBoard->RefreshTrackClusters(false);
-      }
-   }
+      this->HandleSelect(event.ShiftDown());
+   else
+      event.Skip();
 }
 
 void MixerTrackCluster::OnPaint(wxPaintEvent &evt)
@@ -506,7 +521,7 @@
    wxRect bev(0, 0, clusterSize.GetWidth() - 1, clusterSize.GetHeight() - 1);
    if (mLeftTrack->GetSelected())
    {
-      for (unsigned int i = 0; i < 2; i++) 
+      for (unsigned int i = 0; i < 4; i++) // 4 gives a big bevel, but there 
were complaints about visibility otherwise.
       {
          bev.Inflate(-1, -1);
          AColor::Bevel(dc, false, bev);
@@ -517,6 +532,12 @@
 }
 
 
+void MixerTrackCluster::OnButton_MusicalInstrument(wxCommandEvent& event)
+{
+   bool bShiftDown = ::wxGetMouseState().ShiftDown();
+   this->HandleSelect(bShiftDown);
+}
+
 void MixerTrackCluster::OnButton_Mute(wxCommandEvent& event)
 {
    mProject->HandleTrackMute(mLeftTrack, mToggleButton_Mute->WasShiftDown());
@@ -636,6 +657,8 @@
 // class MixerBoard
 
 #define MIXER_BOARD_MIN_HEIGHT      460
+
+// Min width is one cluster wide, plus margins.
 #define MIXER_BOARD_MIN_WIDTH       kDoubleInset + kMixerTrackClusterWidth + 
kDoubleInset
 
 
@@ -753,7 +776,7 @@
             wxPoint clusterPos(
                (kInset +                                       // extra inset 
to left for first one.
                   (nClusterIndex * 
-                     (kInset + kMixerTrackClusterWidth)) +   // left margin 
and width for each to its left
+                     (kInset + kMixerTrackClusterWidth)) +     // left margin 
and width for each to its left
                   kInset),                                     // plus left 
margin for new cluster
                kInset); 
             wxSize clusterSize(kMixerTrackClusterWidth, nClusterHeight);

Index: MixerBoard.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/MixerBoard.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- MixerBoard.h        21 Aug 2009 19:16:23 -0000      1.9
+++ MixerBoard.h        21 Aug 2009 23:09:35 -0000      1.10
@@ -91,10 +91,13 @@
    wxColour GetTrackColor();
 
    // event handlers
+   void HandleSelect(const bool bShiftDown);
+
    void OnKeyEvent(wxKeyEvent& event);
    void OnMouseEvent(wxMouseEvent& event);
    void OnPaint(wxPaintEvent& evt);
 
+   void OnButton_MusicalInstrument(wxCommandEvent& event);
    void OnButton_Mute(wxCommandEvent& event);
    void OnButton_Solo(wxCommandEvent& event);
    void OnSlider_Gain(wxCommandEvent& event);
@@ -111,7 +114,7 @@
 
    // controls
    wxStaticText* mStaticText_TrackName;
-   wxStaticBitmap* mStaticBitmap_MusicalInstrument;
+   wxBitmapButton* mBitmapButton_MusicalInstrument;
    AButton* mToggleButton_Mute;
    AButton* mToggleButton_Solo;
    MixerTrackSlider* mSlider_Pan;


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to