Update of /cvsroot/audacity/audacity-src/src/widgets
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv18974/widgets

Modified Files:
      Tag: Audacity_UmixIt
        ASlider.cpp Meter.cpp Meter.h Ruler.cpp 
Log Message:
Lots of Mac fixes

Index: ASlider.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/ASlider.cpp,v
retrieving revision 1.29.2.6.2.2
retrieving revision 1.29.2.6.2.3
diff -u -d -r1.29.2.6.2.2 -r1.29.2.6.2.3
--- ASlider.cpp 26 Feb 2007 11:23:26 -0000      1.29.2.6.2.2
+++ ASlider.cpp 27 Feb 2007 10:32:43 -0000      1.29.2.6.2.3
@@ -254,7 +254,7 @@
    mCanUseShift = canUseShift;
    mCurrentValue = 0.0f;
 
-   if (!(mWidth & 0))
+   if (!(mWidth & 1))
       mWidth--;
 
    mCenterY = mHeight - 9;

Index: Meter.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Meter.h,v
retrieving revision 1.1.2.6.2.3
retrieving revision 1.1.2.6.2.4
diff -u -d -r1.1.2.6.2.3 -r1.1.2.6.2.4
--- Meter.h     21 Feb 2007 03:26:11 -0000      1.1.2.6.2.3
+++ Meter.h     27 Feb 2007 10:32:43 -0000      1.1.2.6.2.4
@@ -89,7 +89,8 @@
          const wxPoint& pos = wxDefaultPosition,
          const wxSize& size = wxDefaultSize,
          const wxColour& rmsColor = wxNullColour, // Darker shades are 
automatically determined.
-         const float decayRate = 60.0f); // dB/sec
+         const float decayRate = 60.0f,
+         const bool aquaOk = true); // dB/sec
 
    ~Meter();
 
@@ -190,6 +191,7 @@
    wxBrush   mBkgndBrush;
    wxRect    mAllBarsRect;
    Ruler     mRuler;
+   bool      mAquaOk;
 
    DECLARE_EVENT_TABLE()
 };

Index: Ruler.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Ruler.cpp,v
retrieving revision 1.17.2.10
retrieving revision 1.17.2.10.2.1
diff -u -d -r1.17.2.10 -r1.17.2.10.2.1
--- Ruler.cpp   13 Nov 2006 05:24:49 -0000      1.17.2.10
+++ Ruler.cpp   27 Feb 2007 10:32:43 -0000      1.17.2.10.2.1
@@ -631,25 +631,32 @@
 
      if (mOrientation == wxHORIZONTAL)
        desiredPixelHeight = (mBottom-mTop-3);
-     else
+     else {
        desiredPixelHeight = (mRight-mLeft)/2;
+     }
 
-     if (desiredPixelHeight < 8)
-       desiredPixelHeight = 8;
+     if (desiredPixelHeight < 9)
+       desiredPixelHeight = 9;
      if (desiredPixelHeight > 16)
        desiredPixelHeight = 16;
 
      #ifdef __WXMAC__
      desiredPixelHeight -= 3;
+     if (desiredPixelHeight < 12)
+       desiredPixelHeight = 12;
      #endif
-
+     
+     wxMemoryDC memDC;
+     wxBitmap dummy(100, 100);
+     memDC.SelectObject(dummy);
      // Keep making the font bigger until it's too big, then subtract one.
-     mDC->SetFont(wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL));
-     mDC->GetTextExtent(exampleText, &strW, &strH);
+     memDC.SetFont(wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL));
+     memDC.GetTextExtent(exampleText, &strW, &strH);
+
      while(strH <= desiredPixelHeight && fontSize < 40) {
        fontSize++;
-       mDC->SetFont(wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL));
-       mDC->GetTextExtent(exampleText, &strW, &strH);
+       memDC.SetFont(wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL));
+       memDC.GetTextExtent(exampleText, &strW, &strH);
      }
      fontSize--;
 

Index: Meter.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Meter.cpp,v
retrieving revision 1.1.2.12.2.3
retrieving revision 1.1.2.12.2.4
diff -u -d -r1.1.2.12.2.3 -r1.1.2.12.2.4
--- Meter.cpp   21 Feb 2007 03:26:11 -0000      1.1.2.12.2.3
+++ Meter.cpp   27 Feb 2007 10:32:43 -0000      1.1.2.12.2.4
@@ -139,7 +139,8 @@
              const wxPoint& pos /*= wxDefaultPosition*/,
              const wxSize& size /*= wxDefaultSize*/,
              const wxColour& rmsColor /*= wxNullColour*/, // Darker shades are 
automatically determined.
-             const float decayRate /*= 60.0f*/) : // dB/sec
+             const float decayRate /*= 60.0f*/,
+             const bool aquaOk = true) : // dB/sec
    wxPanel(parent, id, pos, size),
    mQueue(256),
    mWidth(size.x), mHeight(size.y),
@@ -158,7 +159,8 @@
    mLayoutValid(false),
    mBitmap(NULL),
    mBackgroundBitmap(NULL),
-   mIcon(NULL)
+   mIcon(NULL),
+   mAquaOk(aquaOk)
 {
    int i;
    
@@ -169,8 +171,12 @@
    /* i18n-hint: One-letter abbreviation for Right, in VU Meter */
    mRightText = _("R");
 
-   mLeftSize = wxSize(0, 0);
-   mRightSize = wxSize(0, 0);
+   wxMemoryDC memDC;
+   wxBitmap dummy(100, 100);
+   memDC.SetFont(GetFont());
+   memDC.SelectObject(dummy);
+   memDC.GetTextExtent(mLeftText, &mLeftSize.x, &mLeftSize.y);
+   memDC.GetTextExtent(mRightText, &mRightSize.x, &mRightSize.y);
 
    if (rmsColor != wxNullColour)
    {
@@ -233,8 +239,15 @@
       alpha = new wxImage(wxBitmap(SpeakerAlpha).ConvertToImage());
    }
 
-   wxImage *bkgnd = CreateSysBackground(25, 25, aquaOffset,
-                                       backgroundColour);
+   wxImage *bkgnd;
+
+   if (mAquaOk) {
+      bkgnd = CreateSysBackground(25, 25, aquaOffset,
+                                  backgroundColour);
+   }
+   else {
+      bkgnd = CreateBackground(25, 25, backgroundColour);
+   }
    wxImage *final = OverlayImage(bkgnd, image, alpha, 0, 0);
    mIcon = new wxBitmap(final);
 
@@ -337,9 +350,9 @@
 
 void Meter::SetStyle(Meter::Style newStyle)
 {
-   if (mStyle == MixerTrackCluster) // MixerTrackCluster disallows style 
change.
-      return;
-   mStyle = newStyle;
+   // MixerTrackCluster disallows style change.
+   if (mStyle != MixerTrackCluster)
+      mStyle = newStyle;
    mLayoutValid = false;
    Refresh(true);
 }
@@ -586,7 +599,7 @@
    int iconHeight = 0;
    int menuWidth = 0;
    int menuHeight = 0;
-   if (mStyle != MixerTrackCluster) // MixerTrackCluster style has no menu or 
icon.
+   if (mStyle != MixerTrackCluster)
    {
       iconWidth = mIcon->GetWidth();
       iconHeight = mIcon->GetHeight();
@@ -627,7 +640,10 @@
       else
          mIconPos = wxPoint(mWidth - iconWidth - 1, 1);
       width = intmin(mWidth-(iconWidth+2), mWidth-(menuWidth+3));
-   case MixerTrackCluster: // Doesn't show menu, icon, or L/R labels, but 
otherwise like VerticalStereo.
+   case MixerTrackCluster:
+      // Doesn't show menu, icon, or L/R labels,
+      // but otherwise like VerticalStereo.
+
       if (width >= mLeftSize.x + mRightSize.x + 24) {
          if (mStyle != MixerTrackCluster)
          {
@@ -636,6 +652,10 @@
          }
          mRightTextPos = wxPoint(width-mLeftSize.x, height-2-mLeftSize.y);
          width -= mLeftSize.x + mRightSize.x + 8;
+
+         #ifdef __WXMAC__
+         width -= 8;
+         #endif
       }
       barw = (width-2)/2;
       barh = height - 4;
@@ -785,7 +805,13 @@
       HandleLayout();
 
 #ifdef __WXMAC__
-   dc.DrawBitmap(*mBackgroundBitmap, 0, 0);
+   if (mAquaOk) {
+      dc.DrawBitmap(*mBackgroundBitmap, 0, 0);
+   } else {
+      dc.SetPen(*wxTRANSPARENT_PEN);
+      dc.SetBrush(mBkgndBrush);
+      dc.DrawRectangle(0, 0, mWidth, mHeight);
+   }
 #else
    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.SetBrush(mBkgndBrush);


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to