mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-11-04 08:04:06 +01:00 
			
		
		
		
	Few new track art routines
This commit is contained in:
		
				
					committed by
					
						
						Panagiotis Vasilopoulos
					
				
			
			
				
	
			
			
			
						parent
						
							cd1efdc0ff
						
					
				
				
					commit
					d199f59a7d
				
			@@ -371,3 +371,7 @@ from there.  Audacity will look for a file called "Pause.png".
 | 
				
			|||||||
   DEFINE_COLOUR( clrSpectro4Sel,         wxColour(  191,    0,    0),  wxT("Spectro4Sel") );
 | 
					   DEFINE_COLOUR( clrSpectro4Sel,         wxColour(  191,    0,    0),  wxT("Spectro4Sel") );
 | 
				
			||||||
   DEFINE_COLOUR( clrSpectro5Sel,         wxColour(  191,  191,  191),  wxT("Spectro5Sel") );
 | 
					   DEFINE_COLOUR( clrSpectro5Sel,         wxColour(  191,  191,  191),  wxT("Spectro5Sel") );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   DEFINE_COLOUR( clrClipAffordanceOutlinePen,    wxColour(    0,    0,    0),  wxT("ClipAffordanceOutlinePen") );
 | 
				
			||||||
 | 
					   DEFINE_COLOUR( clrClipAffordanceInactiveBrush, wxColour(  202,  202,  202),  wxT("ClipAffordanceUnselectedBrush") );
 | 
				
			||||||
 | 
					   DEFINE_COLOUR( clrClipAffordanceActiveBrush,   wxColour(  219,  219,  219),  wxT("ClipAffordanceSelectedBrush") );
 | 
				
			||||||
 | 
					   DEFINE_COLOUR( clrClipAffordanceStroke,        wxColour(  255,  255,  255),  wxT("ClipAffordanceStroke") );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,6 +56,9 @@ audio tracks.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <wx/dc.h>
 | 
					#include <wx/dc.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Thickness of the clip frame outline, shown when clip is dragged
 | 
				
			||||||
 | 
					static constexpr int ClipSelectionStrokeSize{ 1 };//px
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TrackArtist::TrackArtist( TrackPanel *parent_ )
 | 
					TrackArtist::TrackArtist( TrackPanel *parent_ )
 | 
				
			||||||
   : parent( parent_ )
 | 
					   : parent( parent_ )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -260,6 +263,60 @@ void TrackArtist::UpdatePrefs()
 | 
				
			|||||||
   SetColours(0);
 | 
					   SetColours(0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TrackArt::DrawClipAffordance(wxDC& dc, const wxRect& rect, bool highlight, bool selected)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   if (selected)
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					      wxRect strokeRect{
 | 
				
			||||||
 | 
					         rect.x - ClipSelectionStrokeSize,
 | 
				
			||||||
 | 
					         rect.y,
 | 
				
			||||||
 | 
					         rect.width + ClipSelectionStrokeSize * 2,
 | 
				
			||||||
 | 
					         rect.height + ClipFrameRadius };
 | 
				
			||||||
 | 
					      dc.SetBrush(*wxTRANSPARENT_BRUSH);
 | 
				
			||||||
 | 
					      AColor::UseThemeColour(&dc, clrClipAffordanceStroke, clrClipAffordanceStroke);
 | 
				
			||||||
 | 
					      dc.DrawRoundedRectangle(strokeRect, ClipFrameRadius);
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					   AColor::UseThemeColour(&dc, highlight ? clrClipAffordanceActiveBrush : clrClipAffordanceInactiveBrush, clrClipAffordanceOutlinePen);
 | 
				
			||||||
 | 
					   dc.DrawRoundedRectangle(wxRect(rect.x, rect.y + ClipSelectionStrokeSize, rect.width, rect.height + ClipFrameRadius), ClipFrameRadius);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TrackArt::DrawClipEdges(wxDC& dc, const wxRect& clipRect, bool selected)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   dc.SetBrush(*wxTRANSPARENT_BRUSH);
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					      AColor::UseThemeColour(&dc, -1, clrClipAffordanceOutlinePen);
 | 
				
			||||||
 | 
					      AColor::Line(dc,
 | 
				
			||||||
 | 
					         clipRect.GetLeft(), clipRect.GetTop(),
 | 
				
			||||||
 | 
					         clipRect.GetLeft(), clipRect.GetBottom());
 | 
				
			||||||
 | 
					      AColor::Line(dc,
 | 
				
			||||||
 | 
					         clipRect.GetRight(), clipRect.GetTop(),
 | 
				
			||||||
 | 
					         clipRect.GetRight(), clipRect.GetBottom());
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					   if(selected)
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					      if constexpr (ClipSelectionStrokeSize == 1)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					         AColor::UseThemeColour(&dc, -1, clrClipAffordanceStroke);
 | 
				
			||||||
 | 
					         AColor::Line(dc,
 | 
				
			||||||
 | 
					            clipRect.GetLeft() - ClipSelectionStrokeSize, clipRect.GetTop(),
 | 
				
			||||||
 | 
					            clipRect.GetLeft() - ClipSelectionStrokeSize, clipRect.GetBottom());
 | 
				
			||||||
 | 
					         AColor::Line(dc,
 | 
				
			||||||
 | 
					            clipRect.GetRight() + ClipSelectionStrokeSize, clipRect.GetTop(),
 | 
				
			||||||
 | 
					            clipRect.GetRight() + ClipSelectionStrokeSize, clipRect.GetBottom());
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      else if constexpr (ClipSelectionStrokeSize > 1)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					         AColor::UseThemeColour(&dc, clrClipAffordanceStroke, clrClipAffordanceStroke);
 | 
				
			||||||
 | 
					         dc.DrawRectangle(wxRect(
 | 
				
			||||||
 | 
					            clipRect.GetLeft() - ClipSelectionStrokeSize, clipRect.GetTop(),
 | 
				
			||||||
 | 
					            ClipSelectionStrokeSize, clipRect.GetHeight()));
 | 
				
			||||||
 | 
					         dc.DrawRectangle(wxRect(
 | 
				
			||||||
 | 
					            clipRect.GetRight() + 1, clipRect.GetTop(),
 | 
				
			||||||
 | 
					            ClipSelectionStrokeSize, clipRect.GetHeight()));
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Draws the sync-lock bitmap, tiled; always draws stationary relative to the DC
 | 
					// Draws the sync-lock bitmap, tiled; always draws stationary relative to the DC
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// AWD: now that the tiles don't link together, we're drawing a tilted grid, at
 | 
					// AWD: now that the tiles don't link together, we're drawing a tilted grid, at
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,6 +38,14 @@ class ZoomInfo;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace TrackArt {
 | 
					namespace TrackArt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   static constexpr int ClipFrameRadius{ 6 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   AUDACITY_DLL_API
 | 
				
			||||||
 | 
					   void DrawClipAffordance(wxDC& dc, const wxRect& affordanceRect, bool highlight = false, bool selected = false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   AUDACITY_DLL_API
 | 
				
			||||||
 | 
					   void DrawClipEdges(wxDC& dc, const wxRect& clipRect, bool selected = false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // Helper: draws the "sync-locked" watermark tiled to a rectangle
 | 
					   // Helper: draws the "sync-locked" watermark tiled to a rectangle
 | 
				
			||||||
   AUDACITY_DLL_API
 | 
					   AUDACITY_DLL_API
 | 
				
			||||||
   void DrawSyncLockTiles(
 | 
					   void DrawSyncLockTiles(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,6 +101,7 @@ private:
 | 
				
			|||||||
// See big pictorial comment in TrackPanel.cpp for explanation of these numbers
 | 
					// See big pictorial comment in TrackPanel.cpp for explanation of these numbers
 | 
				
			||||||
enum : int {
 | 
					enum : int {
 | 
				
			||||||
   // constants related to y coordinates in the track panel
 | 
					   // constants related to y coordinates in the track panel
 | 
				
			||||||
 | 
					   kAffordancesAreaHeight = 20,
 | 
				
			||||||
   kTopInset = 4,
 | 
					   kTopInset = 4,
 | 
				
			||||||
   kTopMargin = kTopInset + kBorderThickness,
 | 
					   kTopMargin = kTopInset + kBorderThickness,
 | 
				
			||||||
   kBottomMargin = kShadowThickness + kBorderThickness,
 | 
					   kBottomMargin = kShadowThickness + kBorderThickness,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user