Skip to content

Commit

Permalink
Some more cleanup for new spectrogram color scheme
Browse files Browse the repository at this point in the history
- Add some assertion
- Define spectrogram color scheme name using the two-argument constructor. (i18n)
  • Loading branch information
dofuuz authored and Paul-Licameli committed Jun 15, 2021
1 parent 474f05d commit e135bcf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/AColorResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
Audacity: A Digital Audio Editor
AColorResources.h
@file AColorResources.h
@brief RGB data of 'Color (New)' spectrogram color scheme
Colormap generated by using gen_wheel.py at
https://github.com/dofuuz/audacity-colormap
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ list( APPEND SOURCES
PRIVATE
AColor.cpp
AColor.h
AColorResources.h
ActiveProjects.cpp
ActiveProjects.h
AboutDialog.cpp
Expand Down
13 changes: 9 additions & 4 deletions src/prefs/SpectrogramSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Paul Licameli

#include "SpectrogramSettings.h"

#include "../AColor.h"
#include "../NumberScale.h"

#include <algorithm>
Expand Down Expand Up @@ -160,14 +161,18 @@ const EnumValueSymbols &SpectrogramSettings::GetColorSchemeNames()
static const EnumValueSymbols result{
// Keep in correspondence with enum SpectrogramSettings::ColorScheme:
/* i18n-hint: New color scheme for spectrograms */
XO("Color (New)") ,
{ wxT("SpecColorNew"), XO("Color (New)") },
/* i18n-hint: color scheme from theme for spectrograms */
XO("Color (from Theme)") ,
{ wxT("SpecColorTheme"), XO("Color (from Theme)") },
/* i18n-hint: grayscale color scheme for spectrograms */
XO("Grayscale") ,
{ wxT("SpecGrayscale"), XO("Grayscale") },
/* i18n-hint: inverse grayscale color scheme for spectrograms */
XO("Inv. Grayscale") ,
{ wxT("SpecInvGrayscale"), XO("Inv. Grayscale") },
};

wxASSERT(csNumColorScheme == result.size());
static_assert(csNumColorScheme == AColor::colorSchemes, "Broken correspondence");

return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/prefs/SpectrogramSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class AUDACITY_DLL_API SpectrogramSettings : public PrefsListener

typedef int ColorScheme;
enum ColorSchemeValues : int {
// Keep in correspondence with AColor::gradient_pre
// Keep in correspondence with AColor::colorSchemes, AColor::gradient_pre
csColorNew = 0,
csColorTheme,
csGrayscale,
Expand Down

0 comments on commit e135bcf

Please sign in to comment.