Add support of background image
This commit is contained in:
parent
bbac05281d
commit
06ae5d2f52
4 changed files with 19 additions and 4 deletions
|
|
@ -44,6 +44,8 @@ enum class EditId : int {
|
||||||
UINumActiveVoices,
|
UINumActiveVoices,
|
||||||
UIActivePanel,
|
UIActivePanel,
|
||||||
//
|
//
|
||||||
|
BackgroundImage,
|
||||||
|
//
|
||||||
#undef KEY_RANGE
|
#undef KEY_RANGE
|
||||||
#undef CC_RANGE
|
#undef CC_RANGE
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -443,6 +443,12 @@ void Editor::Impl::uiReceiveValue(EditId id, const EditValue& v)
|
||||||
setActivePanel(value);
|
setActivePanel(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case EditId::BackgroundImage:
|
||||||
|
{
|
||||||
|
const std::string& value = v.to_string();
|
||||||
|
updateBackgroundImage(value.c_str());
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (editIdIsKey(id)) {
|
if (editIdIsKey(id)) {
|
||||||
const int key = keyForEditId(id);
|
const int key = keyForEditId(id);
|
||||||
|
|
@ -1541,10 +1547,7 @@ void Editor::Impl::updateSWLastLabel(unsigned sw, const char* label)
|
||||||
|
|
||||||
void Editor::Impl::updateBackgroundImage(const char* filepath)
|
void Editor::Impl::updateBackgroundImage(const char* filepath)
|
||||||
{
|
{
|
||||||
const fs::path sfzFilePath = fs::u8path(currentSfzFile_);
|
SharedPointer<CBitmap> bitmap = loadAnyFormatImage(filepath);
|
||||||
const fs::path sfzDirPath = sfzFilePath.parent_path();
|
|
||||||
const fs::path imagePath = sfzDirPath / fs::u8path(filepath);
|
|
||||||
SharedPointer<CBitmap> bitmap = loadAnyFormatImage(imagePath);
|
|
||||||
|
|
||||||
if (!bitmap)
|
if (!bitmap)
|
||||||
bitmap = owned(new CBitmap("background.png"));
|
bitmap = owned(new CBitmap("background.png"));
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
#include <lv2/patch/patch.h>
|
#include <lv2/patch/patch.h>
|
||||||
#include <lv2/urid/urid.h>
|
#include <lv2/urid/urid.h>
|
||||||
#include <lv2/instance-access/instance-access.h>
|
#include <lv2/instance-access/instance-access.h>
|
||||||
|
#include <ghc/fs_std.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
@ -379,6 +380,10 @@ sfizz_ui_update_description(sfizz_ui_t *self, const InstrumentDescription& desc)
|
||||||
self->uiReceiveValue(EditId::UINumRegions, desc.numRegions);
|
self->uiReceiveValue(EditId::UINumRegions, desc.numRegions);
|
||||||
self->uiReceiveValue(EditId::UINumPreloadedSamples, desc.numSamples);
|
self->uiReceiveValue(EditId::UINumPreloadedSamples, desc.numSamples);
|
||||||
|
|
||||||
|
const fs::path rootPath = fs::u8path(desc.rootPath);
|
||||||
|
const fs::path imagePath = rootPath / fs::u8path(desc.image);
|
||||||
|
self->uiReceiveValue(EditId::BackgroundImage, imagePath.u8string());
|
||||||
|
|
||||||
for (unsigned key = 0; key < 128; ++key) {
|
for (unsigned key = 0; key < 128; ++key) {
|
||||||
bool keyUsed = desc.keyUsed.test(key);
|
bool keyUsed = desc.keyUsed.test(key);
|
||||||
bool keyswitchUsed = desc.keyswitchUsed.test(key);
|
bool keyswitchUsed = desc.keyswitchUsed.test(key);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
#if !defined(__APPLE__) && !defined(_WIN32)
|
#if !defined(__APPLE__) && !defined(_WIN32)
|
||||||
#include "X11RunLoop.h"
|
#include "X11RunLoop.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include <ghc/fs_std.hpp>
|
||||||
|
|
||||||
using namespace VSTGUI;
|
using namespace VSTGUI;
|
||||||
|
|
||||||
|
|
@ -203,6 +204,10 @@ void PLUGIN_API SfizzVstEditor::update(FUnknown* changedUnknown, int32 message)
|
||||||
uiReceiveValue(EditId::UINumRegions, desc.numRegions);
|
uiReceiveValue(EditId::UINumRegions, desc.numRegions);
|
||||||
uiReceiveValue(EditId::UINumPreloadedSamples, desc.numSamples);
|
uiReceiveValue(EditId::UINumPreloadedSamples, desc.numSamples);
|
||||||
|
|
||||||
|
const fs::path rootPath = fs::u8path(desc.rootPath);
|
||||||
|
const fs::path imagePath = rootPath / fs::u8path(desc.image);
|
||||||
|
uiReceiveValue(EditId::BackgroundImage, imagePath.u8string());
|
||||||
|
|
||||||
for (unsigned key = 0; key < 128; ++key) {
|
for (unsigned key = 0; key < 128; ++key) {
|
||||||
bool keyUsed = desc.keyUsed.test(key);
|
bool keyUsed = desc.keyUsed.test(key);
|
||||||
bool keyswitchUsed = desc.keyswitchUsed.test(key);
|
bool keyswitchUsed = desc.keyswitchUsed.test(key);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue