summaryrefslogtreecommitdiffhomepage
path: root/editor/inspectors.cpp
blob: d0f00131c71c3863790f0cab4bf7d90ae678226e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "app.hpp"
#include <Corrade/Containers/GrowableArray.h>

namespace floormat {

namespace {
constexpr inline size_t max_inspectors = 8;
} // namespace

void app::reserve_inspector_array()
{
    arrayReserve(inspectors, max_inspectors);
}

void app::add_inspector(popup_target p)
{
    if (inspectors.size() >= max_inspectors)
        arrayRemove(inspectors, 0, 1 + inspectors.size() - max_inspectors);
    arrayAppend(inspectors, p);
}

void app::erase_inspector(size_t index, ptrdiff_t count)
{
    fm_assert(count >= 0);
    fm_assert(index < inspectors.size());
    fm_assert(index + (size_t)count <= inspectors.size());
    arrayRemove(inspectors, index, (size_t)count);
}

void app::kill_inspectors()
{
    arrayResize(inspectors, 0);
}

} // namespace floormat