1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-17 11:46:35 +01:00

Appearance on OSX is now back to normal or better

Some additional wx3 cleanup as well.
This commit is contained in:
Leland Lucius
2015-08-23 20:25:01 -05:00
parent 1878a0ddd0
commit 6a9dae20f5
35 changed files with 876 additions and 924 deletions

View File

@@ -54,8 +54,6 @@ KeyView::KeyView(wxWindow *parent,
const wxPoint & pos,
const wxSize & size)
: wxVListBox(parent, id, pos, size, wxBORDER_THEME),
mOpen(NULL),
mClosed(NULL),
mScrollX(0),
mWidth(0)
{
@@ -65,36 +63,6 @@ KeyView::KeyView(wxWindow *parent,
SetAccessible(mAx);
#endif
// Create the device context
wxMemoryDC dc;
// Create the open/expanded bitmap
mOpen = new wxBitmap(16, 16);
dc.SelectObject(*mOpen);
dc.SetBrush(*wxWHITE_BRUSH);
dc.SetPen(*wxWHITE_PEN);
dc.DrawRectangle(0, 0, 16, 16);
dc.SetPen(*wxBLACK_PEN);
dc.DrawRectangle(3, 4, 9, 9);
dc.DrawLine(5, 8, 10, 8);
dc.SelectObject(wxNullBitmap);
// Create the closed/collapsed bitmap
mClosed = new wxBitmap(16, 16);
dc.SelectObject(*mClosed);
dc.SetBrush(*wxWHITE_BRUSH);
dc.SetPen(*wxWHITE_PEN);
dc.DrawRectangle(0, 0, 16, 16);
dc.SetPen(*wxBLACK_PEN);
dc.DrawRectangle(3, 4, 9, 9);
dc.DrawLine(7, 6, 7, 11);
dc.DrawLine(5, 8, 10, 8);
dc.SelectObject(wxNullBitmap);
// The default view
mViewType = ViewByTree;
@@ -104,16 +72,6 @@ KeyView::KeyView(wxWindow *parent,
KeyView::~KeyView()
{
// Cleanup
if (mOpen)
{
delete mOpen;
}
if (mClosed)
{
delete mClosed;
}
}
//
@@ -1098,7 +1056,7 @@ KeyView::OnDrawBackground(wxDC & dc, const wxRect & rect, size_t line) const
}
else
{
// Non ocused lines get a light background
// Non focused lines get a light background
dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)));
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(r);
@@ -1142,15 +1100,28 @@ KeyView::OnDrawItem(wxDC & dc, const wxRect & rect, size_t line) const
// Adjust left edge to account for scrolling
wxCoord x = rect.x - mScrollX;
if (node->iscat)
if (node->iscat || node->ispfx)
{
// Draw categories bitmap at left edge
dc.DrawBitmap(node->isopen ? *mOpen : *mClosed, x, rect.y);
}
else if (node->ispfx)
{
// Draw prefix bitmap to the right of the category bitmap
dc.DrawBitmap(node->isopen ? *mOpen : *mClosed, x + KV_BITMAP_SIZE, rect.y);
wxCoord bx = x;
wxCoord by = rect.y;
if (node->ispfx)
{
bx += KV_BITMAP_SIZE;
}
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(*wxBLACK_PEN);
dc.DrawRectangle(bx + 3, by + 4, 9, 9);
if (node->isopen)
{
AColor::Line(dc, bx + 5, by + 8, bx + 9, by + 8);
}
else
{
AColor::Line(dc, bx + 7, by + 6, bx + 7, by + 10);
AColor::Line(dc, bx + 5, by + 8, bx + 9, by + 8);
}
}
// Indent text