Skip to content

Commit 5239032

Browse files
committed
[IMP] Add wxMaterialDesign library
1 parent 65fe552 commit 5239032

File tree

8 files changed

+102
-4
lines changed

8 files changed

+102
-4
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515
[submodule "wxMaterialDesignArtProvider"]
1616
path = wxMaterialDesignArtProvider
1717
url = https://github.com/perazz/wxMaterialDesignArtProvider
18+
[submodule "submodules/wxMaterialDesignArtProvider"]
19+
path = submodules/wxMaterialDesignArtProvider
20+
url = https://github.com/perazz/wxMaterialDesignArtProvider

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,25 @@ if (GO_BUILD_TESTING)
224224
message(STATUS " Coverage enabled")
225225
message(STATUS "============================================================================")
226226
endif()
227+
# include wxMaterialWidgets
228+
if(NOT WX_MATERIAL_PROVIDER_SRC_DIR)
229+
set(WX_MATERIAL_PROVIDER_SRC_DIR "${CMAKE_SOURCE_DIR}/submodules/wxMaterialDesignArtProvider")
230+
if(NOT EXISTS "${WX_MATERIAL_PROVIDER_SRC_DIR}/wxMaterialDesignIconsMain.h")
231+
message(
232+
FATAL_ERROR
233+
"${WX_MATERIAL_PROVIDER_SRC_DIR}/wxMaterialDesignIconsMain.h file does not exist."
234+
"Possible the wxMaterialDesign submodule has not been updated."
235+
"Try to execute 'git submodule update --init --recursive' in the source directory"
236+
)
237+
endif()
238+
endif()
239+
240+
set(WX_MATERIAL_DESIGN_SRC_DIR "${WX_MATERIAL_PROVIDER_SRC_DIR}/MaterialDesign")
241+
242+
include_directories(WX_MATERIAL_PROVIDER_SRC_DIR)
243+
include_directories(WX_MATERIAL_DESIGN_SRC_DIR)
244+
245+
add_subdirectory(src/wxMaterial)
227246

228247
add_subdirectory(src/build)
229248
add_subdirectory(src/images)

src/grandorgue/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ gui/wxcontrols/GORightVisiblePicker.cpp
136136
gui/wxcontrols/go_gui_utils.cpp
137137
help/GOHelpController.cpp
138138
help/GOHelpRequestor.cpp
139+
icons/GOIconManager.cpp
139140
loader/GOFileStore.cpp
140141
loader/GOLoaderFilename.cpp
141142
loader/GOLoadThread.cpp
@@ -252,10 +253,10 @@ if (USE_INTERNAL_ZITACONVOLVER)
252253
endif()
253254

254255
add_library(golib STATIC ${grandorgue_src})
255-
set(go_libs ${wxWidgets_LIBRARIES} ${YAML_CPP_LIBRARIES} ${RT_LIBRARIES} ${PORTAUDIO_LIBRARIES} ${FFTW_LIBRARIES} ${ZITACONVOLVER_LIBRARIES} CURL::libcurl)
256+
set(go_libs ${wxWidgets_LIBRARIES} ${WX_MATERIAL_DESIGN_SRC_DIR} ${YAML_CPP_LIBRARIES} ${RT_LIBRARIES} ${PORTAUDIO_LIBRARIES} ${FFTW_LIBRARIES} ${ZITACONVOLVER_LIBRARIES} CURL::libcurl)
256257
set(go_libdir ${wxWidgets_LIBRARY_DIRS} ${RT_LIBDIR} ${PORTAUDIO_LIBDIR} ${FFTW_LIBDIR})
257258
target_include_directories(golib PUBLIC ${YAML_CPP_INCLUDE_DIRS})
258-
target_link_libraries(golib GrandOrgueImages GrandOrgueCore ${go_libs})
259+
target_link_libraries(golib wxMaterial GrandOrgueImages GrandOrgueCore ${go_libs})
259260
link_directories(${go_libdir})
260261

261262
if (WIN32)

src/grandorgue/gui/frames/GOFrame.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
#include "temperaments/GOTemperament.h"
4848
#include "threading/GOMutexLocker.h"
4949

50+
#include "icons/GOIconManager.h"
51+
5052
#include "GOApp.h"
5153
#include "GODocument.h"
5254
#include "GOEvent.h"
@@ -297,9 +299,16 @@ GOFrame::GOFrame(
297299
999);
298300
m_ToolBar->AddControl(m_SetterPosition);
299301
m_SetterPosition->SetValue(0);
300-
302+
GOIconManager *m_icon = new GOIconManager();
303+
std::string volume = "volume";
304+
// wxBitmap volume;
305+
// volume = m_icon->GetIcon("volume");
301306
m_ToolBar->AddTool(
302-
ID_VOLUME, _("&Volume"), GetImage_volume(), _("Volume"), wxITEM_NORMAL);
307+
ID_VOLUME,
308+
_("&Volume"),
309+
m_icon->GetIcon(volume),
310+
_("Volume"),
311+
wxITEM_NORMAL);
303312
m_Volume = new wxSpinCtrl(
304313
m_ToolBar,
305314
ID_METER_AUDIO_SPIN,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
3+
* License GPL-2.0 or later
4+
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
5+
*/
6+
7+
#include "GOIconManager.h"
8+
9+
GOIconManager::GOIconManager(){};
10+
11+
GOIconManager::~GOIconManager(){};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
3+
* License GPL-2.0 or later
4+
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
5+
*/
6+
7+
#ifndef GOICONMANAGER_H
8+
#define GOICONMANAGER_H
9+
10+
#include "wx/artprov.h"
11+
#include <string>
12+
#include <wx/bitmap.h>
13+
#include <wxMaterialFilledArt.hpp>
14+
/*
15+
* This is a class to manage icons through the application
16+
* It is agnostic from any particular library
17+
*/
18+
class GOIconManager {
19+
20+
public:
21+
GOIconManager();
22+
~GOIconManager();
23+
24+
/*
25+
* This returns the icon in char
26+
*/
27+
wxBitmap GetIcon(std::string icon_name) {
28+
wxArtProvider::Push(new wxMaterialDesignArtProvider);
29+
wxBitmap image = wxArtProvider::GetBitmap(
30+
wxART_CLIENT_MATERIAL_TWOTONE, wxART_VOLUME_UP, wxSize(10, 10));
31+
return image;
32+
};
33+
};
34+
35+
#endif /* GOMIDI_H */

src/wxMaterial/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
2+
# License GPL-2.0 or later (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
3+
4+
message(STATUS "wxMaterialDesign Art Provider configuration")
5+
6+
include(UsewxWidgets)
7+
INCLUDE (CheckIncludeFileCXX)
8+
9+
10+
set(wxMaterial_Source "${WX_MATERIAL_DESIGN_SRC_DIR}/wxMaterialDesignArtProvider.cpp")
11+
12+
include_directories(WX_MATERIAL_DESIGN_SRC_DIR)
13+
14+
add_library(wxMaterial STATIC ${wxMaterial_Source})
15+
target_link_libraries(wxMaterial ${wxWidgets_LIBRARIES})
16+
17+
18+
# find_package(wxWidgets REQUIRED wxMaterial)
19+
20+
message(STATUS "============================================================================")

0 commit comments

Comments
 (0)