diff --git a/.gitmodules b/.gitmodules index a37fc3e62..ee02026d2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,3 +12,9 @@ [submodule "submodules/ZitaConvolver"] path = submodules/ZitaConvolver url = https://github.com/GrandOrgue/ZitaConvolver.git +[submodule "wxMaterialDesignArtProvider"] + path = wxMaterialDesignArtProvider + url = https://github.com/perazz/wxMaterialDesignArtProvider +[submodule "submodules/wxMaterialDesignArtProvider"] + path = submodules/wxMaterialDesignArtProvider + url = https://github.com/perazz/wxMaterialDesignArtProvider diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e8692e17..d68316629 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright 2006 Milan Digital Audio LLC -# Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) +# Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) # License GPL-2.0 or later # (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). diff --git a/src/grandorgue/CMakeLists.txt b/src/grandorgue/CMakeLists.txt index e33374ebe..79bb9eed0 100644 --- a/src/grandorgue/CMakeLists.txt +++ b/src/grandorgue/CMakeLists.txt @@ -37,6 +37,7 @@ include_directories(${wxWidgets_INCLUDE_DIRS}) include_directories(${JACK_INCLUDE_DIRS}) include_directories(${YAML_CPP_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${WX_MATERIAL_DESIGN_SRC_DIR}) set(grandorgue_src combinations/control/GOCombinationButtonSet.cpp @@ -136,6 +137,7 @@ gui/wxcontrols/GORightVisiblePicker.cpp gui/wxcontrols/go_gui_utils.cpp help/GOHelpController.cpp help/GOHelpRequestor.cpp +icons/GOIconManager.cpp loader/GOFileStore.cpp loader/GOLoaderFilename.cpp loader/GOLoadThread.cpp @@ -252,7 +254,7 @@ if (USE_INTERNAL_ZITACONVOLVER) endif() add_library(golib STATIC ${grandorgue_src}) -set(go_libs ${wxWidgets_LIBRARIES} ${YAML_CPP_LIBRARIES} ${RT_LIBRARIES} ${PORTAUDIO_LIBRARIES} ${FFTW_LIBRARIES} ${ZITACONVOLVER_LIBRARIES} CURL::libcurl) +set(go_libs ${wxWidgets_LIBRARIES} ${WX_MATERIAL_DESIGN_SRC_DIR} ${YAML_CPP_LIBRARIES} ${RT_LIBRARIES} ${PORTAUDIO_LIBRARIES} ${FFTW_LIBRARIES} ${ZITACONVOLVER_LIBRARIES} CURL::libcurl) set(go_libdir ${wxWidgets_LIBRARY_DIRS} ${RT_LIBDIR} ${PORTAUDIO_LIBDIR} ${FFTW_LIBDIR}) target_include_directories(golib PUBLIC ${YAML_CPP_INCLUDE_DIRS}) target_link_libraries(golib GrandOrgueImages GrandOrgueCore ${go_libs}) diff --git a/src/grandorgue/gui/frames/GOFrame.cpp b/src/grandorgue/gui/frames/GOFrame.cpp index 418652a35..e295ecdef 100644 --- a/src/grandorgue/gui/frames/GOFrame.cpp +++ b/src/grandorgue/gui/frames/GOFrame.cpp @@ -47,6 +47,8 @@ #include "temperaments/GOTemperament.h" #include "threading/GOMutexLocker.h" +#include "icons/GOIconManager.h" + #include "GOApp.h" #include "GODocument.h" #include "GOEvent.h" @@ -274,16 +276,19 @@ GOFrame::GOFrame( m_ToolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT); m_ToolBar->SetToolBitmapSize(wxSize(16, 16)); + GOIconManager *m_icon = new GOIconManager(); + std::string set = "set"; m_ToolBar->AddTool( ID_AUDIO_MEMSET, _("&Memory Set\tShift"), - GetImage_set(), + m_icon->GetIcon(set), _("Memory Set"), wxITEM_CHECK); + std::string level = "level"; m_ToolBar->AddTool( ID_MEMORY, _("&Memory Level"), - GetImage_memory(), + m_icon->GetIcon(level), _("Memory Level"), wxITEM_NORMAL); m_SetterPosition = new wxSpinCtrl( @@ -297,9 +302,13 @@ GOFrame::GOFrame( 999); m_ToolBar->AddControl(m_SetterPosition); m_SetterPosition->SetValue(0); - + std::string volume = "volume"; m_ToolBar->AddTool( - ID_VOLUME, _("&Volume"), GetImage_volume(), _("Volume"), wxITEM_NORMAL); + ID_VOLUME, + _("&Volume"), + m_icon->GetIcon(volume), + _("Volume"), + wxITEM_NORMAL); m_Volume = new wxSpinCtrl( m_ToolBar, ID_METER_AUDIO_SPIN, @@ -314,11 +323,11 @@ GOFrame::GOFrame( m_VolumeControlTool = m_ToolBar->AddControl(m_VolumeControl); AdjustVolumeControlWithSettings(); m_Volume->SetValue(m_config.Volume()); - + std::string reverb = "reverb"; m_ToolBar->AddTool( ID_RELEASELENGTH, _("&Release tail length"), - GetImage_reverb(), + m_icon->GetIcon(reverb), _("Release tail length"), wxITEM_NORMAL); choices.clear(); @@ -333,11 +342,11 @@ GOFrame::GOFrame( choices); m_ToolBar->AddControl(m_ReleaseLength); UpdateReleaseLength(0); - + std::string transpose = "transpose"; m_ToolBar->AddTool( ID_TRANSPOSE, _("&Transpose"), - GetImage_transpose(), + m_icon->GetIcon(transpose), _("Transpose"), wxITEM_NORMAL); m_Transpose = new wxSpinCtrl( @@ -351,11 +360,11 @@ GOFrame::GOFrame( 11); m_ToolBar->AddControl(m_Transpose); m_Transpose->SetValue(m_config.Transpose()); - + std::string polyphony = "polyphony"; m_ToolBar->AddTool( ID_POLYPHONY, _("&Polyphony"), - GetImage_polyphony(), + m_icon->GetIcon(polyphony), _("Polyphony"), wxITEM_NORMAL); m_Polyphony = new wxSpinCtrl( @@ -372,11 +381,11 @@ GOFrame::GOFrame( m_SamplerUsage = new GOAudioGauge(m_ToolBar, wxID_ANY, wxDefaultPosition); m_ToolBar->AddControl(m_SamplerUsage); m_Polyphony->SetValue(m_config.PolyphonyLimit()); - + std::string panic = "panic"; m_ToolBar->AddTool( ID_AUDIO_PANIC, _("&Panic\tEscape"), - GetImage_panic(), + m_icon->GetIcon(panic), _("Panic"), wxITEM_NORMAL); diff --git a/src/grandorgue/icons/GOIconManager.cpp b/src/grandorgue/icons/GOIconManager.cpp new file mode 100644 index 000000000..7b7e6dbb0 --- /dev/null +++ b/src/grandorgue/icons/GOIconManager.cpp @@ -0,0 +1,11 @@ +/* + * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#include "GOIconManager.h" + +GOIconManager::GOIconManager(){}; + +GOIconManager::~GOIconManager(){}; diff --git a/src/grandorgue/icons/GOIconManager.h b/src/grandorgue/icons/GOIconManager.h new file mode 100644 index 000000000..65c428f91 --- /dev/null +++ b/src/grandorgue/icons/GOIconManager.h @@ -0,0 +1,112 @@ +/* + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#ifndef GOICONMANAGER_H +#define GOICONMANAGER_H + +#include +// #include "wxMaterialDesignArtProvider.hpp" +// #include "wxMaterialTwoToneArt.hpp" +#include +#include +#include +#include + +#ifndef wxART_DATA_SAVER_ON +#define wxART_DATA_SAVER_ON wxART_MAKE_ART_ID(wxART_DATA_SAVER_ON) +#endif +static constexpr const char *SVG_MATERIAL_SHARP_DATA_SAVER_ON + = R"rawsvg()rawsvg"; + +#ifndef wxART_SETTINGS_ETHERNET +#define wxART_SETTINGS_ETHERNET wxART_MAKE_ART_ID(wxART_SETTINGS_ETHERNET) +#endif +static constexpr const char *SVG_MATERIAL_SHARP_SETTINGS_ETHERNET + = R"rawsvg()rawsvg"; + +#ifndef wxART_VOLUME_UP +#define wxART_VOLUME_UP wxART_MAKE_ART_ID(wxART_VOLUME_UP) +#endif +static constexpr const char *SVG_MATERIAL_SHARP_VOLUME_UP + = R"rawsvg()rawsvg"; + +#ifndef wxART_COMPARE_ARROWS +#define wxART_COMPARE_ARROWS wxART_MAKE_ART_ID(wxART_COMPARE_ARROWS) +#endif +static constexpr const char *SVG_MATERIAL_SHARP_COMPARE_ARROWS + = R"rawsvg()rawsvg"; + +#ifndef wxART_LEAK_ADD +#define wxART_LEAK_ADD wxART_MAKE_ART_ID(wxART_LEAK_ADD) +#endif +static constexpr const char *SVG_MATERIAL_SHARP_LEAK_ADD + = R"rawsvg()rawsvg"; + +#ifndef wxART_WARNING_AMBER +#define wxART_WARNING_AMBER wxART_MAKE_ART_ID(wxART_WARNING_AMBER) +#endif +static constexpr const char *SVG_MATERIAL_SHARP_WARNING_AMBER + = R"rawsvg()rawsvg"; + +#ifndef wxART_PIANO +#define wxART_PIANO wxART_MAKE_ART_ID(wxART_PIANO) +#endif +static constexpr const char *SVG_MATERIAL_SHARP_PIANO + = R"rawsvg()rawsvg"; + +/* + * This is a class to manage icons through the application + * It is agnostic from any particular library + */ +class GOIconManager { + +public: + GOIconManager(); + ~GOIconManager(); + + /* + * This returns the icon in char + */ + wxBitmap GetIcon(std::string icon_name) { + wxString svg; + if (icon_name == "set") { + svg = SVG_MATERIAL_SHARP_DATA_SAVER_ON; + } + if (icon_name == "level") { + svg = SVG_MATERIAL_SHARP_SETTINGS_ETHERNET; + } + if (icon_name == "volume") { + svg = SVG_MATERIAL_SHARP_VOLUME_UP; + } + if (icon_name == "transpose") { + svg = SVG_MATERIAL_SHARP_COMPARE_ARROWS; + } + if (icon_name == "reverb") { + svg = SVG_MATERIAL_SHARP_LEAK_ADD; + } + if (icon_name == "polyphony") { + svg = SVG_MATERIAL_SHARP_PIANO; + } + if (icon_name == "panic") { + svg = SVG_MATERIAL_SHARP_WARNING_AMBER; + } + const wxSize &size = wxSize(24, 24); + if (svg.IsEmpty()) + return wxNullBitmap; + + // Create bundle and get bitmap from it + wxSize useSize = size == wxDefaultSize ? wxSize(24, 24) : size; + wxBitmapBundle bundle = wxBitmapBundle::FromSVG(svg.mb_str(), useSize); + if (!bundle.IsOk()) + return wxNullBitmap; + wxBitmap bmp = bundle.GetBitmap(useSize); + if (!bmp.IsOk()) + return wxNullBitmap; + return bmp; + }; +}; + +#endif /* GOMIDI_H */ \ No newline at end of file diff --git a/submodules/wxMaterialDesignArtProvider b/submodules/wxMaterialDesignArtProvider new file mode 160000 index 000000000..204363ed6 --- /dev/null +++ b/submodules/wxMaterialDesignArtProvider @@ -0,0 +1 @@ +Subproject commit 204363ed675fedc2b0a7e6cf335d5f5fa27758ea