put sliders next to table

This commit is contained in:
Alex Birch 2019-06-30 11:39:39 +01:00
parent a7d375a2bb
commit 1d7fdc6860
No known key found for this signature in database
GPG Key ID: 305EB1F98D44ACBA
5 changed files with 32 additions and 10 deletions

View File

@ -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();

View File

@ -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};

View File

@ -12,6 +12,8 @@ public:
void resized() override;
const int getDesiredWidth();
private:
std::function<void()> makeSliderListener(Slider& slider);

View File

@ -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,8 +148,11 @@ 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;

View File

@ -30,7 +30,7 @@ TablesComponent::TablesComponent(
};
presetTable = new TableComponent(
{"Preset", "Name"},
{"#", "Name"},
mapPresets(
banksToPresets,
selectedBank