Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv24679
Modified Files:
Tag: Audacity_UmixIt
Branding.cpp Branding.h Menus.cpp MixerBoard.cpp MixerBoard.h
Project.cpp TrackPanel.cpp
Log Message:
Branding Panel: Added bevel and improved fits so Project Logo looks better.
Made Project Logo be MixerBoard background image.
Several bug fixes related to updates for changed/modified/popped states.
Index: Branding.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Attic/Branding.h,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- Branding.h 24 Apr 2007 22:43:53 -0000 1.1.2.7
+++ Branding.h 4 May 2007 22:33:02 -0000 1.1.2.8
@@ -25,6 +25,7 @@
#include "widgets/AButton.h"
class AudacityProject;
+ class Branding;
class BrandingPanel : public wxPanel {
public:
@@ -32,7 +33,9 @@
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);
const int GetMinHeight() { return mMinHeight; };
- void SetProjectLogo(wxFileName brandLogoFileName); // Updates mMinHeight.
+ #if (AUDACITY_BRANDING != BRAND_THINKLABS)
+ void SetProjectBranding(Branding* pBranding); // Updates mMinHeight.
+ #endif
#if (AUDACITY_BRANDING == BRAND_THINKLABS)
// Thinklabs custom buttons
@@ -70,14 +73,15 @@
private:
AudacityProject* mProject;
- AButton* mButton_ProjectLogo;
AButton* mButton_CompanyLogo;
AButton* mButton_AudacityLogo;
- #if (AUDACITY_BRANDING != BRAND_THINKLABS)
- int mProjectLogo_origWidth;
- #else
+ #if (AUDACITY_BRANDING == BRAND_THINKLABS)
int mMinLeftSectionWidth;
+ #else
+ AButton* mButton_ProjectLogo;
+ int mMinRightSectionWidth;
+ int mProjectLogo_origWidth;
#endif
int mMinHeight;
Index: MixerBoard.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Attic/MixerBoard.h,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -d -r1.1.2.9 -r1.1.2.10
--- MixerBoard.h 18 Apr 2007 01:34:52 -0000 1.1.2.9
+++ MixerBoard.h 4 May 2007 22:33:03 -0000 1.1.2.10
@@ -106,23 +106,27 @@
class MixerBoardScrolledWindow : public wxScrolledWindow {
public:
MixerBoardScrolledWindow(AudacityProject* project,
- MixerBoard* parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxHSCROLL | wxVSCROLL);
+ MixerBoard* parent, wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxHSCROLL | wxVSCROLL);
+ ~MixerBoardScrolledWindow();
private:
void OnMouseEvent(wxMouseEvent& event);
+ void OnPaint(wxPaintEvent& evt);
private:
MixerBoard* mMixerBoard;
AudacityProject* mProject;
+ wxImage* mImage;
public:
DECLARE_EVENT_TABLE()
};
+class Branding;
class TrackList;
// MixerBoard is a window that can either be in MixerBoardFrame or
AudacityProject frame.
@@ -142,19 +146,26 @@
const wxSize& size = wxDefaultSize);
~MixerBoard();
+ #if (AUDACITY_BRANDING != BRAND_THINKLABS)
+ Branding* GetProjectBranding() { return mBranding; };
+ void SetProjectBranding(Branding* pBranding);
+ #endif
+
// Add clusters for any tracks we're not yet showing.
// Update pointers for tracks we're aleady showing.
- void AddOrUpdateTrackClusters();
+ void UpdateTrackClusters();
int GetTrackClustersWidth();
- void RemoveTrackCluster(const WaveTrack* pLeftTrack);
void MoveTrackCluster(const WaveTrack* pLeftTrack, bool bUp); // Up in
TrackPanel is left in MixerBoard.
+ void RemoveTrackCluster(const WaveTrack* pLeftTrack);
+
wxBitmap* GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack);
bool HasSolo();
void IncrementSoloCount(int nIncrement = 1);
+ void RefreshTrackClusters();
void ResetMeters();
void UniquelyMuteOrSolo(const WaveTrack* pTargetLeftTrack, bool bSolo);
@@ -180,6 +191,8 @@
public:
+ Branding* mBranding;
+
// mute & solo button images: Create once and store on MixerBoard for use
in all MixerTrackClusters.
wxImage* mImageMuteUp;
wxImage* mImageMuteOver;
Index: Branding.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Attic/Branding.cpp,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -d -r1.1.2.8 -r1.1.2.9
--- Branding.cpp 24 Apr 2007 22:43:53 -0000 1.1.2.8
+++ Branding.cpp 4 May 2007 22:33:02 -0000 1.1.2.9
@@ -23,7 +23,6 @@
#include <wx/image.h>
-#include "AColor.h"
#include "Project.h"
#include "widgets/LinkingHtmlWindow.h"
@@ -34,13 +33,14 @@
// Thinklabs custom buttons (all 64x42)
#include "../images/Branding/Thinklabs_buttons.h"
+#else
+ #include "MixerBoard.h"
#endif
// Build in the brand-specific logo and mouse-over bitmaps.
// The data global vars in these MUST be named
// company_logo_xpm and company_logo_over_xpm,
// so the code works for any size.
-//
#if (AUDACITY_BRANDING == BRAND_UMIXIT)
#include "../images/Branding/UmixIt.xpm" // 162x64
#include "../images/Branding/UmixIt_over.xpm" // 162x64
@@ -53,12 +53,12 @@
// The data global vars in these MUST be named
// powered_by_Audacity_xpm and powered_by_Audacity_over_xpm,
// so the code works for any size.
-//
#if (AUDACITY_BRANDING == BRAND_UMIXIT)
// bigger ones for UmixIt
#include "../images/Branding/powered_by_Audacity_162x64.xpm"
#include "../images/Branding/powered_by_Audacity_over_162x64.xpm"
#else
+ // for Thinklabs, and default
#include "../images/Branding/powered_by_Audacity.xpm"
#include "../images/Branding/powered_by_Audacity_over.xpm"
#endif
@@ -108,17 +108,16 @@
{
mProject = pProject;
- //#if (AUDACITY_BRANDING != BRAND_THINKLABS)
- this->SetBackgroundColour(*wxWHITE);
- //#endif
+ this->SetBackgroundColour(*wxWHITE);
mMinHeight = 0;
#if (AUDACITY_BRANDING == BRAND_THINKLABS)
mMinLeftSectionWidth = 0;
this->AddCustomButtons();
#else
- mProjectLogo_origWidth = 0;
mButton_ProjectLogo = NULL; // Won't know this until loading project.
+ mMinRightSectionWidth = 0;
+ mProjectLogo_origWidth = 0;
#endif
wxImage buttonImageUp;
@@ -143,8 +142,8 @@
&buttonImageUp, &buttonImageOver,
&buttonImageUp, &buttonImageUp, //v other images?
false); // momentary button
- if (mMinHeight < buttonSize.GetHeight() + kDoubleInset)
- mMinHeight = buttonSize.GetHeight() + kDoubleInset;
+ if (mMinHeight < buttonSize.GetHeight() + kTripleInset)
+ mMinHeight = buttonSize.GetHeight() + kTripleInset;
pButtonBitmap = new wxBitmap(company_logo_xpm);
buttonImageUp = pButtonBitmap->ConvertToImage();
@@ -160,8 +159,8 @@
&buttonImageUp, &buttonImageOver,
&buttonImageUp, &buttonImageUp, //v other images?
false); // momentary button
- if (mMinHeight < buttonSize.GetHeight() + kDoubleInset)
- mMinHeight = buttonSize.GetHeight() + kDoubleInset;
+ if (mMinHeight < buttonSize.GetHeight() + kTripleInset)
+ mMinHeight = buttonSize.GetHeight() + kTripleInset;
#if wxUSE_TOOLTIPS
mButton_CompanyLogo->SetToolTip(AUDACITY_BRANDING_BRANDURL);
@@ -171,9 +170,39 @@
this->SetSizeHints(-1, mMinHeight);
}
+// utility to draw a 2-pixel bevel that shows up against white background
+static void Bevel2OnWhite(wxDC & dc, bool up, wxRect & r) {
+ if (up)
+ dc.SetPen(*wxLIGHT_GREY_PEN);
+ else
+ dc.SetPen(*wxMEDIUM_GREY_PEN);
+
+ // top
+ dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
+ dc.DrawLine(r.x + 1, r.y + 1, r.x + r.width - 1, r.y + 1);
+
+ // left
+ dc.DrawLine(r.x, r.y, r.x, r.y + r.height);
+ dc.DrawLine(r.x + 1, r.y + 1, r.x + 1, r.y + r.height - 2);
+
+ if (!up)
+ dc.SetPen(*wxLIGHT_GREY_PEN);
+ else
+ dc.SetPen(*wxMEDIUM_GREY_PEN);
+
+ // right
+ dc.DrawLine(r.x + r.width - 1, r.y, r.x + r.width - 1, r.y +
r.height - 1);
+ dc.DrawLine(r.x + r.width - 2, r.y + 1, r.x + r.width - 2, r.y +
r.height - 2);
+
+ // bottom
+ dc.DrawLine(r.x, r.y + r.height - 1, r.x + r.width - 1, r.y +
r.height - 1);
+ dc.DrawLine(r.x + 1, r.y + r.height - 2, r.x + r.width - 2, r.y +
r.height - 2);
+};
+
#if (AUDACITY_BRANDING != BRAND_THINKLABS)
- void BrandingPanel::SetProjectLogo(wxFileName brandLogoFileName)
+ void BrandingPanel::SetProjectBranding(Branding* pBranding)
{
+ wxFileName brandLogoFileName = pBranding->GetBrandLogoFileName();
if (brandLogoFileName.IsOk() && brandLogoFileName.FileExists())
{
if (mButton_ProjectLogo != NULL)
@@ -184,7 +213,7 @@
wxImage buttonImageUp(brandLogoFileName.GetFullPath());
mButton_ProjectLogo =
new AButton(this, ID_BUTTON_PROJECT_LOGO,
- wxPoint(1, 1), // inset for bevel
+ wxPoint(2, 2), // inset for bevel
wxSize(buttonImageUp.GetWidth(),
buttonImageUp.GetHeight()),
&buttonImageUp, &buttonImageUp,
&buttonImageUp, &buttonImageUp, //v other images?
@@ -193,14 +222,12 @@
if (mMinLeftSectionWidth < buttonImageUp.GetWidth() + kDoubleInset)
mMinLeftSectionWidth = buttonImageUp.GetWidth() + kDoubleInset;
#endif
- if (mMinHeight < buttonImageUp.GetHeight() + 2) // height plus bevel
- mMinHeight = buttonImageUp.GetHeight() + 2;
+ if (mMinHeight < buttonImageUp.GetHeight() + kInset) // height plus
bevel
+ mMinHeight = buttonImageUp.GetHeight() + kInset;
mProjectLogo_origWidth = buttonImageUp.GetWidth();
#if wxUSE_TOOLTIPS
- Branding* pBranding = mProject->GetBranding();
- if (pBranding)
- mButton_ProjectLogo->SetToolTip(pBranding->GetBrandURL());
+ mButton_ProjectLogo->SetToolTip(pBranding->GetBrandURL());
#endif // wxUSE_TOOLTIPS
mProject->HandleResize();
@@ -208,35 +235,6 @@
}
#else // (AUDACITY_BRANDING == BRAND_THINKLABS)
- // utility to draw a 2-pixel bevel that shows up against white background
- void Bevel2OnWhite(wxDC & dc, bool up, wxRect & r) {
- if (up)
- dc.SetPen(*wxLIGHT_GREY_PEN);
- else
- dc.SetPen(*wxMEDIUM_GREY_PEN);
-
- // top
- dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
- dc.DrawLine(r.x + 1, r.y + 1, r.x + r.width - 1, r.y + 1);
-
- // left
- dc.DrawLine(r.x, r.y, r.x, r.y + r.height);
- dc.DrawLine(r.x + 1, r.y + 1, r.x + 1, r.y + r.height - 2);
-
- if (!up)
- dc.SetPen(*wxLIGHT_GREY_PEN);
- else
- dc.SetPen(*wxMEDIUM_GREY_PEN);
-
- // right
- dc.DrawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
- dc.DrawLine(r.x + r.width - 1, r.y + 1, r.x + r.width - 1, r.y +
r.height - 1);
-
- // bottom
- dc.DrawLine(r.x, r.y + r.height, r.x + r.width + 1, r.y + r.height);
- dc.DrawLine(r.x + 1, r.y + r.height - 1, r.x + r.width, r.y + r.height -
1);
- };
-
void BrandingPanel::EnableDisableButtons()
{
bool bAudioIONotBusy = !gAudioIO->IsBusy();
@@ -557,11 +555,18 @@
dc.BeginDrawing();
wxSize mySize = this->GetSize();
- wxRect bev(0, 0, mySize.GetWidth() - 1, mySize.GetHeight() - 1);
- #if (AUDACITY_BRANDING == BRAND_THINKLABS)
- Bevel2OnWhite(dc, true, bev);
- #else
- AColor::Bevel(dc, true, bev);
+ wxRect bev(0, 0, mySize.GetWidth(), mySize.GetHeight());
+ Bevel2OnWhite(dc, true, bev);
+ #if (AUDACITY_BRANDING != BRAND_THINKLABS)
+ if (mButton_ProjectLogo)
+ {
+ // Also bevel the cluster at right, when Project Logo is showing.
+ // Whether stacked or side-by-side, mButton_AudacityLogo is always at
the leftmost edge.
+ bev =
+ wxRect(mySize.GetWidth() - mMinRightSectionWidth + 2, 0,
+ mMinRightSectionWidth, mySize.GetHeight() - 1);
+ Bevel2OnWhite(dc, true, bev);
+ }
#endif
dc.EndDrawing();
}
@@ -575,37 +580,38 @@
wxSize buttonSize_CompanyLogo = mButton_CompanyLogo->GetSize();
wxSize buttonSize_AudacityLogo = mButton_AudacityLogo->GetSize();
#if (AUDACITY_BRANDING != BRAND_THINKLABS)
- // mButton_ProjectLogo never moves from (1, 1).
+ // mButton_ProjectLogo never moves from (2, 2).
wxSize buttonSize_ProjectLogo =
mButton_ProjectLogo ? mButton_ProjectLogo->GetSize() : wxSize(0, 0);
int newProjectLogoWidth = 0;
- int nMinRightSectionWidth = buttonSize_AudacityLogo.GetWidth() +
kDoubleInset;
+ mMinRightSectionWidth = buttonSize_AudacityLogo.GetWidth() +
kDoubleInset;
#endif
- if (((buttonSize_CompanyLogo.GetHeight() +
- buttonSize_AudacityLogo.GetHeight())) < // Stack the logos
vertically with no gap.
+ if ((buttonSize_CompanyLogo.GetHeight() +
+ buttonSize_AudacityLogo.GetHeight() +
+ 4) <= // Stack the logos vertically with 2-pixel bevel.
evtSize.GetHeight())
{
// Can stack mButton_CompanyLogo and mButton_AudacityLogo at the right
side.
- yPos = (evtSize.GetHeight() / 2) - kHalfInset -
buttonSize_CompanyLogo.GetHeight();
- if (yPos < 0)
- yPos = 0;
+ yPos = (evtSize.GetHeight() / 2) - buttonSize_CompanyLogo.GetHeight();
+ if (yPos < 2) // 2-pixel bevel
+ yPos = 2;
buttonPos = wxPoint(evtSize.GetWidth() -
buttonSize_CompanyLogo.GetWidth() - kInset, yPos);
mButton_CompanyLogo->Move(buttonPos);
- yPos += buttonSize_CompanyLogo.GetHeight();
+ yPos += buttonSize_CompanyLogo.GetHeight() - 1; // no vertical gap
buttonPos = wxPoint(evtSize.GetWidth() -
buttonSize_AudacityLogo.GetWidth() - kInset, yPos);
mButton_AudacityLogo->Move(buttonPos);
#if (AUDACITY_BRANDING != BRAND_THINKLABS)
if (mButton_ProjectLogo)
{
- if (nMinRightSectionWidth < buttonSize_CompanyLogo.GetWidth() +
kDoubleInset)
- nMinRightSectionWidth = buttonSize_CompanyLogo.GetWidth() +
kDoubleInset;
- newProjectLogoWidth = evtSize.GetWidth() - nMinRightSectionWidth;
+ if (mMinRightSectionWidth < buttonSize_CompanyLogo.GetWidth() +
kDoubleInset)
+ mMinRightSectionWidth = buttonSize_CompanyLogo.GetWidth() +
kDoubleInset;
+ newProjectLogoWidth = evtSize.GetWidth() - mMinRightSectionWidth;
if (newProjectLogoWidth > mProjectLogo_origWidth)
newProjectLogoWidth = mProjectLogo_origWidth;
- mButton_ProjectLogo->SetSize(1, 1, newProjectLogoWidth, -1);
+ mButton_ProjectLogo->SetSize(2, 2, newProjectLogoWidth, -1);
}
#endif
}
@@ -636,11 +642,11 @@
#if (AUDACITY_BRANDING != BRAND_THINKLABS)
if (mButton_ProjectLogo)
{
- nMinRightSectionWidth += buttonSize_CompanyLogo.GetWidth() +
kInset;
- newProjectLogoWidth = evtSize.GetWidth() - nMinRightSectionWidth;
+ mMinRightSectionWidth += buttonSize_CompanyLogo.GetWidth() +
kInset;
+ newProjectLogoWidth = evtSize.GetWidth() - mMinRightSectionWidth;
if (newProjectLogoWidth > mProjectLogo_origWidth)
newProjectLogoWidth = mProjectLogo_origWidth;
- mButton_ProjectLogo->SetSize(1, 1, newProjectLogoWidth, -1);
+ mButton_ProjectLogo->SetSize(2, 2, newProjectLogoWidth, -1);
}
#endif
}
@@ -703,14 +709,16 @@
else if (!strcmp(attr, "logofilename"))
{
// Logo file is supposed to be stored in the project data directory.
- wxString strDirName =
GetActiveProject()->GetDirManager()->GetProjectDataDir();
+ AudacityProject* pProject = GetActiveProject();
+ wxString strDirName = pProject->GetDirManager()->GetProjectDataDir();
if (XMLValueChecker::IsGoodFileName(value, strDirName))
{
// Store full thing, not just file name, so don't need to add path
again.
m_BrandLogoFileName.Assign(strDirName, value);
m_BrandLogoFileName.Normalize(wxPATH_NORM_ABSOLUTE |
wxPATH_NORM_LONG);
#if (AUDACITY_BRANDING == BRAND_UMIXIT)
- mBrandingPanel->SetProjectLogo(m_BrandLogoFileName);
+ mBrandingPanel->SetProjectBranding(this);
+ pProject->GetMixerBoard()->SetProjectBranding(this);
#endif
}
else
Index: MixerBoard.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Attic/MixerBoard.cpp,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -d -r1.1.2.17 -r1.1.2.18
--- MixerBoard.cpp 18 Apr 2007 01:34:52 -0000 1.1.2.17
+++ MixerBoard.cpp 4 May 2007 22:33:02 -0000 1.1.2.18
@@ -401,7 +401,10 @@
}
// Exclusive select, so refresh all MixerTrackClusters.
- mMixerBoard->Refresh(false);
+ // 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();
}
}
}
@@ -564,6 +567,7 @@
BEGIN_EVENT_TABLE(MixerBoardScrolledWindow, wxScrolledWindow)
EVT_MOUSE_EVENTS(MixerBoardScrolledWindow::OnMouseEvent)
+ EVT_PAINT(MixerBoardScrolledWindow::OnPaint)
END_EVENT_TABLE()
MixerBoardScrolledWindow::MixerBoardScrolledWindow(AudacityProject* project,
@@ -575,6 +579,13 @@
{
mMixerBoard = parent;
mProject = project;
+ mImage = NULL;
+}
+
+MixerBoardScrolledWindow::~MixerBoardScrolledWindow()
+{
+ delete mImage;
+ mImage = NULL;
}
void MixerBoardScrolledWindow::OnMouseEvent(wxMouseEvent& event)
@@ -585,10 +596,34 @@
// here, MixerBoard::OnMouseEvent never gets called.
// So, added mProject to MixerBoardScrolledWindow and just directly do
what's needed here.
mProject->SelectNone();
- mMixerBoard->Refresh(false);
+ mMixerBoard->RefreshTrackClusters();
}
+ else
+ event.Skip();
}
+void MixerBoardScrolledWindow::OnPaint(wxPaintEvent &evt)
+{
+ wxScrolledWindow::OnPaint(evt);
+
+ if (mImage == NULL)
+ {
+ Branding* pBranding = mMixerBoard->GetProjectBranding();
+ if (pBranding == NULL)
+ return;
+ wxFileName brandLogoFileName = pBranding->GetBrandLogoFileName();
+ mImage = new wxImage(brandLogoFileName.GetFullPath());
+ }
+
+ wxPaintDC dc(this);
+ dc.BeginDrawing();
+
+ wxSize clientSize = this->GetClientSize();
+ wxBitmap bmp(mImage->Scale(clientSize.GetWidth(), clientSize.GetHeight()));
+ dc.DrawBitmap(bmp, 0, 0);
+
+ dc.EndDrawing();
+}
// class MixerBoard
@@ -612,6 +647,8 @@
wxWindow(parent, -1, pos, size)
{
// public data members
+ mBranding = NULL;
+
// mute & solo button images: Create once and store on MixerBoard for use
in all MixerTrackClusters.
mImageMuteUp = NULL;
mImageMuteOver = NULL;
@@ -672,11 +709,15 @@
mMusicalInstruments.Clear();
}
-void MixerBoard::AddOrUpdateTrackClusters()
-{
- if (mTracks->IsEmpty())
- return;
+#if (AUDACITY_BRANDING != BRAND_THINKLABS)
+ void MixerBoard::SetProjectBranding(Branding* pBranding)
+ {
+ mBranding = pBranding;
+ }
+#endif
+void MixerBoard::UpdateTrackClusters()
+{
if (mImageMuteUp == NULL)
this->CreateMuteSoloImages();
@@ -699,9 +740,10 @@
// Already showing it.
// Track clusters are maintained in the same order as the
WaveTracks.
// Track pointers can change for the "same" track for different
states
- // on the undo stack, so update the pointers.
+ // on the undo stack, so update the pointers and display name.
mMixerTrackClusters[nClusterIndex]->mLeftTrack =
(WaveTrack*)pLeftTrack;
mMixerTrackClusters[nClusterIndex]->mRightTrack =
(WaveTrack*)pRightTrack;
+ mMixerTrackClusters[nClusterIndex]->UpdateName();
}
else
{
@@ -722,17 +764,26 @@
this->IncrementSoloCount((int)(pLeftTrack->GetSolo()));
}
}
+ nClusterIndex++;
}
pLeftTrack = iterTracks.Next();
- nClusterIndex++;
}
if (pMixerTrackCluster)
{
// Added at least one MixerTrackCluster.
this->UpdateWidth();
- for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
- mMixerTrackClusters[i]->UpdateHeight();
+ for (nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.GetCount();
nClusterIndex++)
+ mMixerTrackClusters[nClusterIndex]->UpdateHeight();
+ }
+ else if (nClusterIndex < kClusterCount)
+ {
+ // We've got too many clusters.
+ // This can only on things like Undo New Audio Track or Undo Import
+ // that don't call RemoveTrackCluster explicitly.
+ // We've already updated the track pointers for the clusters to the
left, so just remove these.
+ for (; nClusterIndex < kClusterCount; nClusterIndex++)
+
this->RemoveTrackCluster(mMixerTrackClusters[nClusterIndex]->mLeftTrack);
}
}
@@ -744,33 +795,6 @@
kInset; // plus final right margin
}
-void MixerBoard::RemoveTrackCluster(const WaveTrack* pLeftTrack)
-{
- // Find and destroy.
- MixerTrackCluster* pMixerTrackCluster;
- int nIndex = this->FindMixerTrackCluster(pLeftTrack, &pMixerTrackCluster);
- if (pMixerTrackCluster == NULL)
- return; // Couldn't find it.
-
- mMixerTrackClusters.RemoveAt(nIndex);
- pMixerTrackCluster->Destroy(); // delete is unsafe on wxWindow.
-
- // Close the gap, if any.
- wxPoint pos;
- int targetX;
- for (unsigned int i = nIndex; i < mMixerTrackClusters.GetCount(); i++)
- {
- pos = mMixerTrackClusters[i]->GetPosition();
- targetX =
- (i * (kInset + MIXER_TRACK_CLUSTER_WIDTH)) + // left margin and width
for each
- kInset; // plus left margin for this cluster
- if (pos.x != targetX)
- mMixerTrackClusters[i]->Move(targetX, pos.y);
- }
-
- this->UpdateWidth();
-}
-
void MixerBoard::MoveTrackCluster(const WaveTrack* pLeftTrack,
bool bUp) // Up in TrackPanel is left in
MixerBoard.
{
@@ -804,6 +828,33 @@
}
}
+void MixerBoard::RemoveTrackCluster(const WaveTrack* pLeftTrack)
+{
+ // Find and destroy.
+ MixerTrackCluster* pMixerTrackCluster;
+ int nIndex = this->FindMixerTrackCluster(pLeftTrack, &pMixerTrackCluster);
+ if (pMixerTrackCluster == NULL)
+ return; // Couldn't find it.
+
+ mMixerTrackClusters.RemoveAt(nIndex);
+ pMixerTrackCluster->Destroy(); // delete is unsafe on wxWindow.
+
+ // Close the gap, if any.
+ wxPoint pos;
+ int targetX;
+ for (unsigned int i = nIndex; i < mMixerTrackClusters.GetCount(); i++)
+ {
+ pos = mMixerTrackClusters[i]->GetPosition();
+ targetX =
+ (i * (kInset + MIXER_TRACK_CLUSTER_WIDTH)) + // left margin and width
for each
+ kInset; // plus left margin for this cluster
+ if (pos.x != targetX)
+ mMixerTrackClusters[i]->Move(targetX, pos.y);
+ }
+
+ this->UpdateWidth();
+}
+
wxBitmap* MixerBoard::GetMusicalInstrumentBitmap(const WaveTrack* pLeftTrack)
{
@@ -859,8 +910,17 @@
mSoloCount += nIncrement;
}
+void MixerBoard::RefreshTrackClusters()
+{
+ for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
+ mMixerTrackClusters[i]->Refresh();
+}
+
void MixerBoard::ResetMeters()
{
+ if (!this->IsShown())
+ return;
+
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
mMixerTrackClusters[i]->ResetMeter();
}
@@ -950,7 +1010,7 @@
void MixerBoard::UpdateMeters(double t)
{
- if (t == mT)
+ if (!this->IsShown() || (t == mT))
return;
mT = t;
Index: Menus.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Menus.cpp,v
retrieving revision 1.151.2.26.2.8
retrieving revision 1.151.2.26.2.9
diff -u -d -r1.151.2.26.2.8 -r1.151.2.26.2.9
--- Menus.cpp 24 Apr 2007 22:43:54 -0000 1.151.2.26.2.8
+++ Menus.cpp 4 May 2007 22:33:02 -0000 1.151.2.26.2.9
@@ -3279,6 +3279,10 @@
while (t) {
if (t->GetSelected()) {
+ #if (AUDACITY_BRANDING != BRAND_THINKLABS)
+ if (t->GetKind() == Track::Wave)
+ mMixerBoard->RemoveTrackCluster((WaveTrack*)t);
+ #endif
delete t;
t = iter.RemoveCurrent();
}
@@ -3289,6 +3293,9 @@
PushState(_("Removed audio track(s)"), _("Remove Track"));
mTrackPanel->Refresh(false);
+ #if (AUDACITY_BRANDING != BRAND_THINKLABS)
+ mMixerBoard->Refresh(true);
+ #endif
}
//
Index: TrackPanel.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackPanel.cpp,v
retrieving revision 1.212.2.15.2.12
retrieving revision 1.212.2.15.2.13
diff -u -d -r1.212.2.15.2.12 -r1.212.2.15.2.13
--- TrackPanel.cpp 24 Apr 2007 22:43:55 -0000 1.212.2.15.2.12
+++ TrackPanel.cpp 4 May 2007 22:33:03 -0000 1.212.2.15.2.13
@@ -1266,7 +1266,6 @@
AudacityProject *p = (AudacityProject*)GetParent();
#if (AUDACITY_BRANDING != BRAND_THINKLABS)
MixerBoard* pMixerBoard = p->GetMixerBoard();
- bool bMixerBoardShowing = pMixerBoard && pMixerBoard->IsShown();
if (p->GetAudioIOToken()>0) {
// Update lyrics display
@@ -1276,7 +1275,7 @@
lyrics->Update(gAudioIO->GetStreamTime());
}
- if (bMixerBoardShowing)
+ if (pMixerBoard)
pMixerBoard->UpdateMeters(gAudioIO->GetStreamTime());
}
#endif
@@ -1287,7 +1286,7 @@
!gAudioIO->IsStreamActive(p->GetAudioIOToken())) {
p->GetControlToolBar()->OnStop(dummyEvent);
#if (AUDACITY_BRANDING != BRAND_THINKLABS)
- if (bMixerBoardShowing)
+ if (pMixerBoard)
pMixerBoard->ResetMeters();
#endif
}
Index: Project.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Project.cpp,v
retrieving revision 1.178.2.17.2.20
retrieving revision 1.178.2.17.2.21
diff -u -d -r1.178.2.17.2.20 -r1.178.2.17.2.21
--- Project.cpp 24 Apr 2007 22:43:54 -0000 1.178.2.17.2.20
+++ Project.cpp 4 May 2007 22:33:03 -0000 1.178.2.17.2.21
@@ -2626,9 +2626,6 @@
this->EnforceTrackConstraints();
#else // (AUDACITY_BRANDING != BRAND_THINKLABS)
UpdateLyrics();
-
- // All the different ways to add tracks funnel through here.
- mMixerBoard->AddOrUpdateTrackClusters();
UpdateMixerBoard();
#endif
}
@@ -2783,12 +2780,11 @@
void AudacityProject::UpdateMixerBoard()
{
- if (mTracks->IsEmpty() || !mMixerBoard)
+ if (!mMixerBoard)
return;
- mMixerBoard->AddOrUpdateTrackClusters();
- if (mMixerBoard->IsShown())
- mMixerBoard->UpdateMeters(gAudioIO->GetStreamTime());
+ mMixerBoard->UpdateTrackClusters();
+ mMixerBoard->UpdateMeters(gAudioIO->GetStreamTime());
}
#endif // (AUDACITY_BRANDING != BRAND_THINKLABS)
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs