1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 22:12:58 +02:00

Move drawing code for background of track control panel

This commit is contained in:
Paul Licameli
2019-06-18 12:00:27 -04:00
parent 1ca079b503
commit e7c1f7424d
5 changed files with 51 additions and 43 deletions

View File

@@ -564,43 +564,6 @@ void TrackInfo::DrawBordersWithin
//#define USE_BEVELS
// Paint the whole given rectangle some fill color
void TrackInfo::DrawBackground(
wxDC * dc, const wxRect & rect, bool bSelected, const int vrul)
{
// fill in label
wxRect fill = rect;
fill.width = vrul - kLeftMargin;
AColor::MediumTrackInfo(dc, bSelected);
dc->DrawRectangle(fill);
#ifdef USE_BEVELS
// This branch is not now used
// PRL: todo: banish magic numbers.
// PRL: vrul was the x coordinate of left edge of the vertical ruler.
// PRL: bHasMuteSolo was true iff the track was WaveTrack.
if( bHasMuteSolo )
{
int ylast = rect.height-20;
int ybutton = wxMin(32,ylast-17);
int ybuttonEnd = 67;
fill=wxRect( rect.x+1, rect.y+17, vrul-6, ybutton);
AColor::BevelTrackInfo( *dc, true, fill );
if( ybuttonEnd < ylast ){
fill=wxRect( rect.x+1, rect.y+ybuttonEnd, fill.width, ylast - ybuttonEnd);
AColor::BevelTrackInfo( *dc, true, fill );
}
}
else
{
fill=wxRect( rect.x+1, rect.y+17, vrul-6, rect.height-37);
AColor::BevelTrackInfo( *dc, true, fill );
}
#endif
}
unsigned TrackInfo::DefaultTrackHeight( const TCPLines &topLines )
{
int needed =

View File

@@ -92,8 +92,6 @@ namespace TrackInfo
void SetTrackInfoFont(wxDC *dc);
void DrawBackground(
wxDC * dc, const wxRect & rect, bool bSelected, const int vrul );
// void DrawBordersWithin(
// wxDC * dc, const wxRect & rect, const Track &track ) const;

View File

@@ -1036,10 +1036,6 @@ void TrackPanel::DrawOutside
// Now exclude the resizer below
rect.height -= kSeparatorThickness;
int vrul = mViewInfo->GetVRulerOffset();
TrackInfo::DrawBackground( dc, rect, t->GetSelected(), vrul );
// Vaughan, 2010-08-24: No longer doing this.
// Draw sync-lock tiles in ruler area.
//if (t->IsSyncLockSelected()) {

View File

@@ -12,10 +12,13 @@ Paul Licameli split from TrackControls.cpp
#include "TrackButtonHandles.h"
#include "TrackSelectHandle.h"
#include "../../AColor.h"
#include "../../RefreshCode.h"
#include "../../Project.h"
#include "../../ProjectHistory.h"
#include "../../TrackArtist.h"
#include "../../TrackInfo.h"
#include "../../TrackPanelDrawingContext.h"
#include "../../TrackPanelMouseEvent.h"
#include "../../TrackUtilities.h"
#include <wx/textdlg.h>
@@ -25,6 +28,7 @@ Paul Licameli split from TrackControls.cpp
#include "../../Track.h"
#include "../../widgets/PopupMenuTable.h"
#include <wx/dc.h>
#include <wx/frame.h>
std::vector<UIHandlePtr> CommonTrackControls::HitTest
@@ -265,3 +269,45 @@ unsigned CommonTrackControls::DoContextMenu
return data.result;
}
void CommonTrackControls::Draw(
TrackPanelDrawingContext &context,
const wxRect &rect, unsigned iPass )
{
if ( iPass == TrackArtist::PassMargins ) {
// fill in label
auto dc = &context.dc;
const auto pTrack = FindTrack();
AColor::MediumTrackInfo( dc, pTrack && pTrack->GetSelected() );
dc->DrawRectangle( rect );
}
// Some old cut-and-paste legacy from TrackPanel.cpp here:
#undef USE_BEVELS
#ifdef USE_BEVELS
// This branch is not now used
// PRL: todo: banish magic numbers.
// PRL: vrul was the x coordinate of left edge of the vertical ruler.
// PRL: bHasMuteSolo was true iff the track was WaveTrack.
if( bHasMuteSolo )
{
int ylast = rect.height-20;
int ybutton = wxMin(32,ylast-17);
int ybuttonEnd = 67;
fill=wxRect( rect.x+1, rect.y+17, vrul-6, ybutton);
AColor::BevelTrackInfo( *dc, true, fill );
if( ybuttonEnd < ylast ){
fill=wxRect( rect.x+1, rect.y+ybuttonEnd, fill.width, ylast - ybuttonEnd);
AColor::BevelTrackInfo( *dc, true, fill );
}
}
else
{
fill=wxRect( rect.x+1, rect.y+17, vrul-6, rect.height-37);
AColor::BevelTrackInfo( *dc, true, fill );
}
#endif
}

View File

@@ -56,6 +56,11 @@ protected:
(const wxRect &rect, wxWindow *pParent, wxPoint *pPosition) override;
virtual PopupMenuTable *GetMenuExtension(Track *pTrack) = 0;
// TrackPanelDrawable implementation
void Draw(
TrackPanelDrawingContext &context,
const wxRect &rect, unsigned iPass ) override;
std::weak_ptr<CloseButtonHandle> mCloseHandle;
std::weak_ptr<MenuButtonHandle> mMenuHandle;
std::weak_ptr<MinimizeButtonHandle> mMinimizeHandle;