Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
4 changes: 3 additions & 1 deletion src/grandorgue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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})
Expand Down
33 changes: 21 additions & 12 deletions src/grandorgue/gui/frames/GOFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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();
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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);

Expand Down
11 changes: 11 additions & 0 deletions src/grandorgue/icons/GOIconManager.cpp
Original file line number Diff line number Diff line change
@@ -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(){};
Comment on lines +9 to +11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove these lines?

112 changes: 112 additions & 0 deletions src/grandorgue/icons/GOIconManager.h
Original file line number Diff line number Diff line change
@@ -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 <wx/artprov.h>
// #include "wxMaterialDesignArtProvider.hpp"
// #include "wxMaterialTwoToneArt.hpp"
#include <string>
#include <wx/bitmap.h>
#include <wx/regex.h>
#include <wx/string.h>

#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(<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M11 8v3H8v2h3v3h2v-3h3v-2h-3V8h-2zm2-5.95v3.03c3.39.49 6 3.39 6 6.92 0 .9-.18 1.75-.48 2.54l2.6 1.53c.56-1.24.88-2.62.88-4.07 0-5.18-3.95-9.45-9-9.95zM12 19c-3.87 0-7-3.13-7-7 0-3.53 2.61-6.43 6-6.92V2.05c-5.06.5-9 4.76-9 9.95 0 5.52 4.47 10 9.99 10 3.31 0 6.24-1.61 8.06-4.09l-2.6-1.53A6.95 6.95 0 0 1 12 19z"/></svg>)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(<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.77 6.76 6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z"/></svg>)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(<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>)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(<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9.01 14H2v2h7.01v3L13 15l-3.99-4v3zm5.98-1v-3H22V8h-7.01V5L11 9l3.99 4z"/></svg>)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(<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M6 3H3v3c1.66 0 3-1.34 3-3zm8 0h-2a9 9 0 0 1-9 9v2c6.08 0 11-4.93 11-11zm-4 0H8c0 2.76-2.24 5-5 5v2c3.87 0 7-3.13 7-7zm0 18h2a9 9 0 0 1 9-9v-2c-6.07 0-11 4.93-11 11zm8 0h3v-3c-1.66 0-3 1.34-3 3zm-4 0h2c0-2.76 2.24-5 5-5v-2c-3.87 0-7 3.13-7 7z"/></svg>)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(<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"/></svg>)rawsvg";

#ifndef wxART_PIANO
#define wxART_PIANO wxART_MAKE_ART_ID(wxART_PIANO)
#endif
static constexpr const char *SVG_MATERIAL_SHARP_PIANO
= R"rawsvg(<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M21 3H3v18h18V3zm-8 11.5h1.25V19h-4.5v-4.5H11V5h2v9.5zM5 5h2v9.5h1.25V19H5V5zm14 14h-3.25v-4.5H17V5h2v14z"/></svg>)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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is too long to be in the .h file. So could you move it to the .cpp file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this function static

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 */
1 change: 1 addition & 0 deletions submodules/wxMaterialDesignArtProvider
Loading