put sliders next to table
This commit is contained in:
parent
a7d375a2bb
commit
1d7fdc6860
|
@ -83,15 +83,19 @@ void JuicySFAudioProcessorEditor::resized()
|
||||||
const int pianoHeight{70};
|
const int pianoHeight{70};
|
||||||
const int filePickerHeight{25};
|
const int filePickerHeight{25};
|
||||||
const int slidersHeight{150};
|
const int slidersHeight{150};
|
||||||
Rectangle<int> r (getLocalBounds());
|
Rectangle<int> r{getLocalBounds()};
|
||||||
filePicker.setBounds(r.removeFromTop(filePickerHeight + padding).reduced(padding, 0).withTrimmedTop(padding));
|
filePicker.setBounds(r.removeFromTop(filePickerHeight + padding).reduced(padding, 0).withTrimmedTop(padding));
|
||||||
slidersComponent.setBounds(r.removeFromTop(slidersHeight + padding).reduced(padding, 0).withTrimmedTop(padding));
|
|
||||||
|
|
||||||
// Rectangle<int> r2 (getLocalBounds());
|
// Rectangle<int> r2 (getLocalBounds());
|
||||||
// slidersComponent.setBounds(r2.removeFromLeft(filePickerWidth + padding).reduced(padding, 0).withTrimmedLeft(padding));
|
// slidersComponent.setBounds(r2.removeFromLeft(filePickerWidth + padding).reduced(padding, 0).withTrimmedLeft(padding));
|
||||||
|
|
||||||
midiKeyboard.setBounds (r.removeFromBottom (pianoHeight).reduced(padding, 0));
|
midiKeyboard.setBounds (r.removeFromBottom (pianoHeight).reduced(padding, 0));
|
||||||
tablesComponent.setBounds(r.reduced(0, padding));
|
|
||||||
|
Rectangle<int> rContent{r.reduced(0, padding)};
|
||||||
|
slidersComponent.setBounds(rContent.removeFromRight(slidersComponent.getDesiredWidth() + padding).withTrimmedRight(padding));
|
||||||
|
|
||||||
|
tablesComponent.setBounds(rContent);
|
||||||
|
|
||||||
|
|
||||||
processor.lastUIWidth = getWidth();
|
processor.lastUIWidth = getWidth();
|
||||||
processor.lastUIHeight = getHeight();
|
processor.lastUIHeight = getHeight();
|
||||||
|
|
|
@ -18,6 +18,18 @@ SlidersComponent::~SlidersComponent()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int SlidersComponent::getDesiredWidth() {
|
||||||
|
const int envelopeSliders{4};
|
||||||
|
const int filterSliders{2};
|
||||||
|
const int groupXMargin{8};
|
||||||
|
const int groupXPadding{8};
|
||||||
|
const int sliderXMargin{3};
|
||||||
|
const int sliderWidth{30};
|
||||||
|
|
||||||
|
return envelopeSliders * sliderWidth + (envelopeSliders-1) * sliderXMargin + 2 * groupXPadding
|
||||||
|
+ filterSliders * sliderWidth + (filterSliders-1) * sliderXMargin + 2 * groupXPadding + groupXMargin;
|
||||||
|
}
|
||||||
|
|
||||||
void SlidersComponent::resized() {
|
void SlidersComponent::resized() {
|
||||||
const int envelopeSliders{4};
|
const int envelopeSliders{4};
|
||||||
const int filterSliders{2};
|
const int filterSliders{2};
|
||||||
|
|
|
@ -12,6 +12,8 @@ public:
|
||||||
|
|
||||||
void resized() override;
|
void resized() override;
|
||||||
|
|
||||||
|
const int getDesiredWidth();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::function<void()> makeSliderListener(Slider& slider);
|
std::function<void()> makeSliderListener(Slider& slider);
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,12 @@ TableComponent::TableComponent(
|
||||||
// Add some columns to the table header, based on the column list in our database..
|
// Add some columns to the table header, based on the column list in our database..
|
||||||
for (auto &column : columns) // access by reference to avoid copying
|
for (auto &column : columns) // access by reference to avoid copying
|
||||||
{
|
{
|
||||||
|
const int colWidth{ columnIx == 1 ? 30 : 100 };
|
||||||
table.getHeader().addColumn (
|
table.getHeader().addColumn (
|
||||||
String(column),
|
String(column),
|
||||||
columnIx++,
|
columnIx++,
|
||||||
100, // column width
|
colWidth, // column width
|
||||||
50, // min width
|
30, // min width
|
||||||
400, // max width
|
400, // max width
|
||||||
TableHeaderComponent::defaultFlags
|
TableHeaderComponent::defaultFlags
|
||||||
);
|
);
|
||||||
|
@ -147,9 +148,12 @@ void TableComponent::sortOrderChanged (
|
||||||
// This is overloaded from TableListBoxModel, and should choose the best width for the specified
|
// This is overloaded from TableListBoxModel, and should choose the best width for the specified
|
||||||
// column.
|
// column.
|
||||||
int TableComponent::getColumnAutoSizeWidth (int columnId) {
|
int TableComponent::getColumnAutoSizeWidth (int columnId) {
|
||||||
if (columnId == 5)
|
// if (columnId == 5)
|
||||||
return 100; // (this is the ratings column, containing a custom combobox component)
|
// return 100; // (this is the ratings column, containing a custom combobox component)
|
||||||
|
if (columnId == 1)
|
||||||
|
return 30; // (this is the ratings column, containing a custom combobox component)
|
||||||
|
|
||||||
|
|
||||||
int widest = 32;
|
int widest = 32;
|
||||||
|
|
||||||
// find the widest bit of text in this column..
|
// find the widest bit of text in this column..
|
||||||
|
@ -202,4 +206,4 @@ void TableComponent::selectedRowsChanged (int row) {
|
||||||
|
|
||||||
bool TableComponent::keyPressed(const KeyPress &key) {
|
bool TableComponent::keyPressed(const KeyPress &key) {
|
||||||
return table.keyPressed(key);
|
return table.keyPressed(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ TablesComponent::TablesComponent(
|
||||||
};
|
};
|
||||||
|
|
||||||
presetTable = new TableComponent(
|
presetTable = new TableComponent(
|
||||||
{"Preset", "Name"},
|
{"#", "Name"},
|
||||||
mapPresets(
|
mapPresets(
|
||||||
banksToPresets,
|
banksToPresets,
|
||||||
selectedBank
|
selectedBank
|
||||||
|
@ -184,4 +184,4 @@ void TablesComponent::fontChanged(FluidSynthModel *, const String &) {
|
||||||
mapBanks(banksToPresets),
|
mapBanks(banksToPresets),
|
||||||
selectedBank
|
selectedBank
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user