1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-29 06:38:38 +02:00

Theme the spectrogram.

This commit is contained in:
James Crook 2017-04-27 21:12:38 +01:00
parent ff3ed65d83
commit 47c6ac3233
2 changed files with 27 additions and 8 deletions

View File

@ -421,10 +421,14 @@ void AColor::Solo(wxDC * dc, bool on, bool selected)
}
}
bool AColor::gradient_inited = 0;
void AColor::ReInit()
{
inited=false;
Init();
gradient_inited=0;
PreComputeGradient();
}
void AColor::Init()
@ -626,7 +630,7 @@ void AColor::DarkMIDIChannel(wxDC * dc, int channel /* 1 - 16 */ )
}
bool AColor::gradient_inited = 0;
unsigned char AColor::gradient_pre[ColorGradientTotal][2][gradientSteps][3];
@ -647,13 +651,17 @@ void AColor::PreComputeGradient() {
r = g = b = 0.84 - 0.84 * value;
} else {
const int gsteps = 4;
float gradient[gsteps + 1][3] = {
{float(0.75), float(0.75), float(0.75)}, // lt gray
{float(0.30), float(0.60), float(1.00)}, // lt blue
{float(0.90), float(0.10), float(0.90)}, // violet
{float(1.00), float(0.00), float(0.00)}, // red
{float(1.00), float(1.00), float(1.00)} // white
};
float gradient[gsteps + 1][3];
theTheme.Colour( clrSpectro1 ) = theTheme.Colour( clrUnselected );
theTheme.Colour( clrSpectro1Sel ) = theTheme.Colour( clrSelected );
int clrFirst = (selected == ColorGradientUnselected ) ? clrSpectro1 : clrSpectro1Sel;
for(int j=0;j<(gsteps+1);j++){
wxColour c = theTheme.Colour( clrFirst+j );
gradient[ j] [0] = c.Red()/255.0;
gradient[ j] [1] = c.Green()/255.0;
gradient[ j] [2] = c.Blue()/255.0;
}
int left = (int)(value * gsteps);
int right = (left == gsteps ? gsteps : left + 1);

View File

@ -377,4 +377,15 @@ from there. Audacity will look for a file called "Pause.png".
DEFINE_COLOUR( clrMidiZebra, wxColour( 255, 255, 20), wxT("MidiZebra") );
DEFINE_COLOUR( clrMidiLines, wxColour( 255, 255, 20), wxT("MidiLines") );
DEFINE_COLOUR( clrSpectro1, wxColour( 191, 191, 191), wxT("Spectro1") );
DEFINE_COLOUR( clrSpectro2, wxColour( 76, 153, 255), wxT("Spectro2") );
DEFINE_COLOUR( clrSpectro3, wxColour( 229, 25, 229), wxT("Spectro3") );
DEFINE_COLOUR( clrSpectro4, wxColour( 255, 0, 0), wxT("Spectro4") );
DEFINE_COLOUR( clrSpectro5, wxColour( 255, 255, 255), wxT("Spectro5") );
DEFINE_COLOUR( clrSpectro1Sel, wxColour( 143, 143, 143), wxT("Spectro1Sel") );
DEFINE_COLOUR( clrSpectro2Sel, wxColour( 57, 116, 191), wxT("Spectro2Sel") );
DEFINE_COLOUR( clrSpectro3Sel, wxColour( 172, 19, 172), wxT("Spectro3Sel") );
DEFINE_COLOUR( clrSpectro4Sel, wxColour( 191, 0, 0), wxT("Spectro4Sel") );
DEFINE_COLOUR( clrSpectro5Sel, wxColour( 191, 191, 191), wxT("Spectro5Sel") );