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

Modified Files:
        ToolBar.cpp 
Log Message:
-Improvements to backgrounds when theming

Index: ToolBar.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolBar.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ToolBar.cpp 15 May 2007 03:53:53 -0000      1.9
+++ ToolBar.cpp 4 Jul 2007 10:16:42 -0000       1.10
@@ -41,6 +41,7 @@
 #endif  /*  */
 
 #include "ToolBar.h"
+#include "../Experimental.h"
 
 #include "../AllThemeResources.h"
 #include "../AColor.h"
@@ -502,8 +503,47 @@
    dc.Clear();
 #endif
 
-   // Go repaint the rest
+// EXPERIMENTAL_THEMING is set to not apply the gradient
+// on wxMAC builds.  on wxMAC we have the AQUA_THEME.
+#ifdef USE_AQUA_THEME
    Repaint( &dc );
+#else
+
+#ifdef EXPERIMENTAL_THEMING
+   wxImage * mpBackGradient =   &theTheme.Image( bmpRecoloredUpLarge  );
+
+   if( mpBackGradient != NULL )
+   {
+      wxSize imSz( mpBackGradient->GetWidth(), mpBackGradient->GetHeight() );
+      wxSize sz = GetSize();
+      int y;
+      for(y=0;y<sz.y;y++)
+      {
+         int yPix = ((float)y * imSz.y - 0.0001f)/(sz.y-1);
+         wxColour col( 
+            mpBackGradient->GetRed( 0, yPix),
+            mpBackGradient->GetGreen( 0, yPix),
+            mpBackGradient->GetBlue( 0, yPix));
+
+         // Set background colour so that controls placed on this
+         // toolbar such as radio buttons will draw reasonably.
+         // It's a little tacky setting the background colour 
+         // here, but we can't do it in the constructor as the gradient
+         // may not be available yet.
+         // Better than this would be to set the colour when the image 
+         // is loaded.
+         // We use the colour at the half way point as a suitable 'average'.
+         if( y==(sz.y/2) )
+         {
+            SetBackgroundColour( col );
+         }
+         wxPen Pen( col );
+         dc.SetPen(Pen );
+         dc.DrawLine( 0, y, sz.x, y );
+      }
+   }
+#endif
+#endif
 
    if( IsResizable() && IsDocked() )
    {


-------------------------------------------------------------------------
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

Reply via email to