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 filePickerHeight{25};
|
||||
const int slidersHeight{150};
|
||||
Rectangle<int> r (getLocalBounds());
|
||||
Rectangle<int> r{getLocalBounds()};
|
||||
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());
|
||||
// slidersComponent.setBounds(r2.removeFromLeft(filePickerWidth + padding).reduced(padding, 0).withTrimmedLeft(padding));
|
||||
|
||||
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.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() {
|
||||
const int envelopeSliders{4};
|
||||
const int filterSliders{2};
|
||||
|
|
|
@ -12,6 +12,8 @@ public:
|
|||
|
||||
void resized() override;
|
||||
|
||||
const int getDesiredWidth();
|
||||
|
||||
private:
|
||||
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..
|
||||
for (auto &column : columns) // access by reference to avoid copying
|
||||
{
|
||||
const int colWidth{ columnIx == 1 ? 30 : 100 };
|
||||
table.getHeader().addColumn (
|
||||
String(column),
|
||||
columnIx++,
|
||||
100, // column width
|
||||
50, // min width
|
||||
colWidth, // column width
|
||||
30, // min width
|
||||
400, // max width
|
||||
TableHeaderComponent::defaultFlags
|
||||
);
|
||||
|
@ -147,9 +148,12 @@ void TableComponent::sortOrderChanged (
|
|||
// This is overloaded from TableListBoxModel, and should choose the best width for the specified
|
||||
// column.
|
||||
int TableComponent::getColumnAutoSizeWidth (int columnId) {
|
||||
if (columnId == 5)
|
||||
return 100; // (this is the ratings column, containing a custom combobox component)
|
||||
// if (columnId == 5)
|
||||
// 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;
|
||||
|
||||
// find the widest bit of text in this column..
|
||||
|
@ -202,4 +206,4 @@ void TableComponent::selectedRowsChanged (int row) {
|
|||
|
||||
bool TableComponent::keyPressed(const KeyPress &key) {
|
||||
return table.keyPressed(key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ TablesComponent::TablesComponent(
|
|||
};
|
||||
|
||||
presetTable = new TableComponent(
|
||||
{"Preset", "Name"},
|
||||
{"#", "Name"},
|
||||
mapPresets(
|
||||
banksToPresets,
|
||||
selectedBank
|
||||
|
@ -184,4 +184,4 @@ void TablesComponent::fontChanged(FluidSynthModel *, const String &) {
|
|||
mapBanks(banksToPresets),
|
||||
selectedBank
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user