1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-14 15:48:21 +02:00

Make html respond to colour changes.

Html now uses theming, the dark and text colours and uses waveform colour for hyperlinks.
Previously hard coded white text now uses the theme colour too.
This commit is contained in:
James Crook 2016-09-26 10:06:03 +01:00
parent d498fcc7c1
commit 9241c2b916
3 changed files with 15 additions and 9 deletions

View File

@ -18,15 +18,21 @@
#include "Audacity.h" #include "Audacity.h"
#include "HelpText.h" #include "HelpText.h"
#include "FileNames.h" #include "FileNames.h"
#include "AllThemeResources.h"
wxString HtmlColourOfIndex( int i ){
wxColour c = theTheme.Colour(i);
return wxString::Format("\"#%02X%02X%02X\"",
c.Red(), c.Green(), c.Blue() );
}
static wxString WrapText( const wxString & Text ) static wxString WrapText( const wxString & Text )
{ {
return wxString(wxT(""))+ return wxString(wxT(""))+
wxT("<html><head></head>") + wxT("<html><head></head>") +
wxT("<body bgcolor=\"#404040\">") + wxT("<body bgcolor=") + HtmlColourOfIndex(clrDark) + wxT(">") +
wxT("<font color=\"#fedfb2\">")+ wxT("<font color=") + HtmlColourOfIndex(clrTrackPanelText) + wxT(">") +
wxT("<p>") + Text + wxT("<p>") + Text +
wxT("</font>")+ wxT("</font>")+
wxT("</body></html>"); wxT("</body></html>");
@ -91,7 +97,7 @@ static wxString LinkExpand( const wxString & Text )
Key = Key.Mid( 0, j ); Key = Key.Mid( 0, j );
LinkText = LinkText.Mid( 0, k ); LinkText = LinkText.Mid( 0, k );
LinkText="<font color=\"#ffffff\">"+LinkText+"</font>"; LinkText=wxString("<font color=") + HtmlColourOfIndex(clrSample) + wxT(">") +LinkText+"</font>";
wxString Replacement; wxString Replacement;
if( Key.StartsWith( wxT("wiki:") )) if( Key.StartsWith( wxT("wiki:") ))
{ {

View File

@ -52,6 +52,7 @@ with changes in the SelectionBar.
#include "../Project.h" #include "../Project.h"
#include "../Snap.h" #include "../Snap.h"
#include "../widgets/NumericTextCtrl.h" #include "../widgets/NumericTextCtrl.h"
#include "../AllThemeResources.h"
IMPLEMENT_CLASS(SelectionBar, ToolBar); IMPLEMENT_CLASS(SelectionBar, ToolBar);
@ -136,7 +137,7 @@ void SelectionBar::Populate()
// Top row (mostly labels) // Top row (mostly labels)
// //
wxColour clrText = *wxWHITE; wxColour clrText = theTheme.Colour( clrTrackPanelText );
wxColour clrText2 = *wxBLUE; wxColour clrText2 = *wxBLUE;
wxStaticText * pProjRate = safenew wxStaticText(this, -1, _("Project Rate (Hz):"), wxStaticText * pProjRate = safenew wxStaticText(this, -1, _("Project Rate (Hz):"),
// LLL: On my Ubuntu 7.04 install, the label wraps to two lines // LLL: On my Ubuntu 7.04 install, the label wraps to two lines

View File

@ -430,6 +430,8 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
std::unique_ptr<wxDC> paintDC{ wxAutoBufferedPaintDCFactory(this) }; std::unique_ptr<wxDC> paintDC{ wxAutoBufferedPaintDCFactory(this) };
#endif #endif
wxDC & destDC = *paintDC; wxDC & destDC = *paintDC;
wxColour clrText = theTheme.Colour( clrTrackPanelText );
wxColour clrBoxFill = theTheme.Colour( clrMedium );
if (mLayoutValid == false) if (mLayoutValid == false)
{ {
@ -471,7 +473,6 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
} }
dc.DrawBitmap(*mIcon, mIconRect.GetPosition(), true); dc.DrawBitmap(*mIcon, mIconRect.GetPosition(), true);
dc.SetFont(GetFont()); dc.SetFont(GetFont());
wxColour clrText = *wxWHITE;
dc.SetTextForeground( clrText ); dc.SetTextForeground( clrText );
dc.DrawText(mLeftText, mLeftTextPos.x, mLeftTextPos.y); dc.DrawText(mLeftText, mLeftTextPos.x, mLeftTextPos.y);
dc.DrawText(mRightText, mRightTextPos.x, mRightTextPos.y); dc.DrawText(mRightText, mRightTextPos.x, mRightTextPos.y);
@ -573,7 +574,6 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
#endif #endif
} }
} }
wxColour clrText = *wxWHITE;
mRuler.SetTickColour( clrText ); mRuler.SetTickColour( clrText );
dc.SetTextForeground( clrText ); dc.SetTextForeground( clrText );
// Draw the ruler // Draw the ruler
@ -592,7 +592,6 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
DrawMeterBar(destDC, &mBar[i]); DrawMeterBar(destDC, &mBar[i]);
} }
wxColour clrText = *wxWHITE;
destDC.SetTextForeground( clrText ); destDC.SetTextForeground( clrText );
#if 0 #if 0
@ -631,7 +630,7 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
Siz.GetHeight(), Siz.GetHeight(),
Siz.GetWidth() ); Siz.GetWidth() );
destDC.SetBrush( *wxGREY_BRUSH ); destDC.SetBrush( wxBrush( clrBoxFill ) );
destDC.SetPen( *wxWHITE_PEN ); destDC.SetPen( *wxWHITE_PEN );
destDC.DrawRectangle( r ); destDC.DrawRectangle( r );
destDC.SetBackgroundMode( wxTRANSPARENT ); destDC.SetBackgroundMode( wxTRANSPARENT );
@ -650,7 +649,7 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
Siz.GetWidth(), Siz.GetWidth(),
Siz.GetHeight() ); Siz.GetHeight() );
destDC.SetBrush( *wxGREY_BRUSH ); destDC.SetBrush( wxBrush( clrBoxFill ) );
destDC.SetPen( *wxWHITE_PEN ); destDC.SetPen( *wxWHITE_PEN );
destDC.DrawRectangle( r ); destDC.DrawRectangle( r );
destDC.SetBackgroundMode( wxTRANSPARENT ); destDC.SetBackgroundMode( wxTRANSPARENT );