From ed31e3a83808cd9a2d4009f06fed616a00c09397 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Sun, 24 Nov 2024 08:55:59 -0500 Subject: [PATCH] format --- examples/component-demo/ListViewDemo.h | 10 ++++++---- include/sst/jucegui/components/ListView.h | 6 ++---- src/sst/jucegui/components/ListView.cpp | 7 ++----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/examples/component-demo/ListViewDemo.h b/examples/component-demo/ListViewDemo.h index df13b8c..df6020c 100644 --- a/examples/component-demo/ListViewDemo.h +++ b/examples/component-demo/ListViewDemo.h @@ -55,7 +55,8 @@ struct ListViewDemo : public sst::jucegui::components::WindowPanel } void mouseDown(const juce::MouseEvent &e) override { - parent->listView->rowSelected(row, !selected, + parent->listView->rowSelected( + row, !selected, sst::jucegui::components::ListView::selectionAddActionForModifier(e.mods)); } }; @@ -98,9 +99,10 @@ struct ListViewDemo : public sst::jucegui::components::WindowPanel for (int i = 5; i < 7; ++i) { auto tb = std::make_unique(); - auto amt = (i == 5 ? sst::jucegui::components::ListView::SelectionMode::SINGLE_SELECTION : - sst::jucegui::components::ListView::SelectionMode::MULTI_SELECTION); - tb->setLabel(i== 5 ? "SingSel" : "MultSel"); + auto amt = + (i == 5 ? sst::jucegui::components::ListView::SelectionMode::SINGLE_SELECTION + : sst::jucegui::components::ListView::SelectionMode::MULTI_SELECTION); + tb->setLabel(i == 5 ? "SingSel" : "MultSel"); tb->setOnCallback([amt, w = juce::Component::SafePointer(this)]() { if (!w) return; diff --git a/include/sst/jucegui/components/ListView.h b/include/sst/jucegui/components/ListView.h index 8d5557b..7de56d3 100644 --- a/include/sst/jucegui/components/ListView.h +++ b/include/sst/jucegui/components/ListView.h @@ -76,8 +76,7 @@ struct ListView : public juce::Component, ADD_NON_CONTIGUOUS, ADD_CONTIGUOUS }; - void rowSelected(uint32_t r, bool select, - SelectionAddAction addMode = SINGLE); + void rowSelected(uint32_t r, bool select, SelectionAddAction addMode = SINGLE); static SelectionAddAction selectionAddActionForModifier(const juce::ModifierKeys &); std::function getRowCount{nullptr}; @@ -85,8 +84,7 @@ struct ListView : public juce::Component, std::function()> makeRowComponent{nullptr}; std::function &, uint32_t)> assignComponentToRow{ nullptr}; - std::function &, bool)> setRowSelection{ - nullptr}; + std::function &, bool)> setRowSelection{nullptr}; std::unique_ptr viewPort; diff --git a/src/sst/jucegui/components/ListView.cpp b/src/sst/jucegui/components/ListView.cpp index 41386aa..201882b 100644 --- a/src/sst/jucegui/components/ListView.cpp +++ b/src/sst/jucegui/components/ListView.cpp @@ -96,8 +96,7 @@ void ListView::refresh() repaint(); } -void ListView::rowSelected(uint32_t r, bool b, - SelectionAddAction addMode) +void ListView::rowSelected(uint32_t r, bool b, SelectionAddAction addMode) { if (selectionMode == SINGLE_SELECTION || (selectionMode == MULTI_SELECTION && addMode == SINGLE)) @@ -156,7 +155,7 @@ void ListView::rowSelected(uint32_t r, bool b, it++; } } - for (int i=start; i <= end; ++i) + for (int i = start; i <= end; ++i) { if (innards->selectedRows.find(i) == innards->selectedRows.end()) { @@ -178,7 +177,6 @@ void ListView::rowSelected(uint32_t r, bool b, innards->selectedRows.erase(r); } } - } void ListView::setSelectionMode(SelectionMode s) @@ -201,5 +199,4 @@ ListView::SelectionAddAction ListView::selectionAddActionForModifier(const juce: return SINGLE; } - } // namespace sst::jucegui::components \ No newline at end of file