MCPcopy Create free account
hub / github.com/Cpasjuste/pplay / Filer

Method Filer

src/filer/filer.cpp:14–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace c2d;
13
14Filer::Filer(Main *m, const std::string &path, const c2d::FloatRect &rect) :
15 Rectangle(m->getScaled(rect)) {
16
17 main = m;
18
19 mutex = new C2DMutex();
20
21 // force scrap view width to scrapped backdrop width
22 scrapView = new ScrapView(main, {rect.width - (780 * m->getScaling().x), 0,
23 780 * m->getScaling().x, rect.height});
24 Filer::add(scrapView);
25
26 /// scaling this too much is not pretty, so no scaling for filer
27 Vector2f size = {rect.width - (670 * m->getScaling().x), rect.height - (64 * m->getScaling().y)};
28
29 // highlight
30 highlight = new Highlight({size.x, (float) ITEM_HEIGHT * m->getScaling().y}, Highlight::CursorPosition::Left);
31 Filer::add(highlight);
32
33 // files items
34 item_height = highlight->getSize().y;
35 item_max = (int) (size.y / item_height);
36 if (((float) item_max * item_height) < size.y) {
37 item_height = size.y / (float) item_max;
38 }
39
40 for (unsigned int i = 0; i < (unsigned int) item_max; i++) {
41 FloatRect r = {0, item_height * (float) i, size.x, item_height};
42 items.emplace_back(new FilerItem(main, r));
43 Filer::add(items[i]);
44 }
45
46 // tween
47 Filer::add(new TweenAlpha(0, 255, 0.5f));
48}
49
50void Filer::setMediaInfo(const MediaFile &target, const MediaInfo &mediaInfo) {
51 mutex->lock();

Callers

nothing calls this directly

Calls 2

getScaledMethod · 0.80
getScalingMethod · 0.80

Tested by

no test coverage detected