Update the VST appearance
This commit is contained in:
parent
32393a3c6a
commit
c353769c2c
4 changed files with 274 additions and 88 deletions
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
using namespace VSTGUI;
|
using namespace VSTGUI;
|
||||||
|
|
||||||
static ViewRect sfizzUiViewRect {0, 0, 684, 684};
|
static ViewRect sfizzUiViewRect {0, 0, 482, 225};
|
||||||
|
|
||||||
SfizzVstEditor::SfizzVstEditor(void *controller)
|
SfizzVstEditor::SfizzVstEditor(void *controller)
|
||||||
: VSTGUIEditor(controller, &sfizzUiViewRect),
|
: VSTGUIEditor(controller, &sfizzUiViewRect),
|
||||||
|
|
@ -203,8 +203,7 @@ void SfizzVstEditor::loadSfzFile(const std::string& filePath)
|
||||||
ctl->sendMessage(msg);
|
ctl->sendMessage(msg);
|
||||||
msg->release();
|
msg->release();
|
||||||
|
|
||||||
if (_fileLabel)
|
updateFileLabel(filePath);
|
||||||
_fileLabel->setText(("File: " + filePath).c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SfizzVstEditor::createFrameContents()
|
void SfizzVstEditor::createFrameContents()
|
||||||
|
|
@ -259,8 +258,8 @@ void SfizzVstEditor::createFrameContents()
|
||||||
panel->addView(topLeftLabel);
|
panel->addView(topLeftLabel);
|
||||||
|
|
||||||
CRect row = topRow;
|
CRect row = topRow;
|
||||||
row.top += 200.0;
|
row.top += 45.0;
|
||||||
row.bottom += 200.0;
|
row.bottom += 45.0;
|
||||||
row.left += 100.0;
|
row.left += 100.0;
|
||||||
row.right -= 100.0;
|
row.right -= 100.0;
|
||||||
|
|
||||||
|
|
@ -363,13 +362,13 @@ void SfizzVstEditor::createFrameContents()
|
||||||
|
|
||||||
for (unsigned i = 0; i < kNumPanels; ++i) {
|
for (unsigned i = 0; i < kNumPanels; ++i) {
|
||||||
CRect btnRect = topRow;
|
CRect btnRect = topRow;
|
||||||
btnRect.left = topRow.right - (kNumPanels - i) * 20;
|
btnRect.left = topRow.right - (kNumPanels - i) * 50;
|
||||||
btnRect.right = btnRect.left + 20;
|
btnRect.right = btnRect.left + 50;
|
||||||
|
|
||||||
const char *text;
|
const char *text;
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case kPanelGeneral: text = "G"; break;
|
case kPanelGeneral: text = "File"; break;
|
||||||
case kPanelSettings: text = "S"; break;
|
case kPanelSettings: text = "Setup"; break;
|
||||||
default: text = "?"; break;
|
default: text = "?"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -392,8 +391,7 @@ void SfizzVstEditor::updateStateDisplay()
|
||||||
const SfizzVstState& state = controller->getSfizzState();
|
const SfizzVstState& state = controller->getSfizzState();
|
||||||
const SfizzUiState& uiState = controller->getSfizzUiState();
|
const SfizzUiState& uiState = controller->getSfizzUiState();
|
||||||
|
|
||||||
if (_fileLabel)
|
updateFileLabel(state.sfzFile);
|
||||||
_fileLabel->setText(("File: " + state.sfzFile).c_str());
|
|
||||||
if (_volumeSlider)
|
if (_volumeSlider)
|
||||||
_volumeSlider->setValue(state.volume);
|
_volumeSlider->setValue(state.volume);
|
||||||
if (_numVoicesSlider)
|
if (_numVoicesSlider)
|
||||||
|
|
@ -406,6 +404,25 @@ void SfizzVstEditor::updateStateDisplay()
|
||||||
setActivePanel(uiState.activePanel);
|
setActivePanel(uiState.activePanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SfizzVstEditor::updateFileLabel(const std::string& filePath)
|
||||||
|
{
|
||||||
|
if (_fileLabel) {
|
||||||
|
std::string fileName;
|
||||||
|
if (filePath.empty())
|
||||||
|
fileName = "<No file>";
|
||||||
|
else {
|
||||||
|
#if defined (_WIN32)
|
||||||
|
size_t pos = filePath.find_last_of("/\\");
|
||||||
|
#else
|
||||||
|
size_t pos = filePath.rfind('/');
|
||||||
|
#endif
|
||||||
|
fileName = (pos != filePath.npos) ?
|
||||||
|
filePath.substr(pos + 1) : filePath;
|
||||||
|
}
|
||||||
|
_fileLabel->setText(fileName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SfizzVstEditor::setActivePanel(unsigned panelId)
|
void SfizzVstEditor::setActivePanel(unsigned panelId)
|
||||||
{
|
{
|
||||||
panelId = std::max(0, std::min(kNumPanels - 1, static_cast<int>(panelId)));
|
panelId = std::max(0, std::min(kNumPanels - 1, static_cast<int>(panelId)));
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ private:
|
||||||
|
|
||||||
void createFrameContents();
|
void createFrameContents();
|
||||||
void updateStateDisplay();
|
void updateStateDisplay();
|
||||||
|
void updateFileLabel(const std::string& filePath);
|
||||||
void setActivePanel(unsigned panelId);
|
void setActivePanel(unsigned panelId);
|
||||||
|
|
||||||
template <class Control>
|
template <class Control>
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 16 KiB |
Loading…
Add table
Reference in a new issue