Port native season calendar and harden menu input QA (by Codex)
This commit is contained in:
1 parent
79bf38aa78
commit
de8b53fce2
19 files changed
+582
-14
No files matched your search
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
add_library(bmh_modern_ui_core STATIC catalog.cpp model.cpp gui_assets.cpp desktop.cpp demo_sports.cpp)
|
||||
add_library(bmh_modern_ui_core STATIC catalog.cpp model.cpp gui_assets.cpp desktop.cpp demo_sports.cpp demo_calendar.cpp)
|
||||
target_include_directories(bmh_modern_ui_core PUBLIC ../..)
|
||||
target_link_libraries(bmh_modern_ui_core PUBLIC bmh_asset_io)
|
||||
add_library(bmh_modern_ui STATIC view.cpp ticket_popover.cpp)
|
||||
@@ -14,7 +14,7 @@ endif()
|
||||
set(modern_assets "${CMAKE_BINARY_DIR}/assets/modern")
|
||||
FetchContent_GetProperties(rmlui)
|
||||
file(MAKE_DIRECTORY "${modern_assets}")
|
||||
foreach(asset modern.rml theme.rcss ticket.rcss sports.rcss)
|
||||
foreach(asset modern.rml theme.rcss ticket.rcss sports.rcss calendar.rcss)
|
||||
configure_file("${CMAKE_SOURCE_DIR}/assets/modern/${asset}" "${modern_assets}/${asset}" COPYONLY)
|
||||
endforeach()
|
||||
file(GLOB modern_icons CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/assets/modern/icons/*.svg")
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
std::string App::render_calendar() {
|
||||
const auto snapshot = snap();
|
||||
const auto &calendar = snapshot.state.at("calendar");
|
||||
const auto days = calendar_days(calendar.at("start").get<std::string>());
|
||||
const auto fixtures = calendar_fixtures(calendar, *world_,
|
||||
manager(snapshot).value("club", ""));
|
||||
const int selected = calendar.at("selected").get<int>();
|
||||
const auto league_id = calendar.at("league").get<std::string>();
|
||||
const auto *league = world_->find("competitions", league_id);
|
||||
const auto nation = league ? league->value("nation", "") : "";
|
||||
const std::array<const char *, 12> months = {
|
||||
"Januar", "Februar", "März", "April", "Mai", "Juni",
|
||||
"Juli", "August", "September", "Oktober", "November", "Dezember"};
|
||||
const std::array<const char *, 7> weekdays = {"MO", "DI", "MI", "DO",
|
||||
"FR", "SA", "SO"};
|
||||
std::string body;
|
||||
int first = 0;
|
||||
for (int panel = 0; panel < 12; ++panel) {
|
||||
const int month = days[size_t(first)].month;
|
||||
const int offset = days[size_t(first)].weekday;
|
||||
body += "<section class=\"calendar-month\" style=\"" +
|
||||
rect((panel % 4) * 660, (panel / 4) * 556, 632, 528) +
|
||||
"\"><h2>" + months[size_t(month - 1)] + "</h2>";
|
||||
constexpr double cell_width = (604.0 - 65) / 6, cell_height = 438.0 / 7;
|
||||
for (int row = 0; row < 7; ++row) {
|
||||
body += "<span class=\"calendar-weekday " +
|
||||
std::string(row == 6 ? "sunday" : "") + "\" style=\"" +
|
||||
rect(12, 66 + row * cell_height, 65, cell_height) + "\">" +
|
||||
"<span>" + weekdays[size_t(row)] + "</span></span>";
|
||||
for (int col = 0; col < 6; ++col) {
|
||||
const int number = col * 7 + row - offset + 1;
|
||||
const int index = first + number - 1;
|
||||
if (number < 1 || index >= int(days.size()) ||
|
||||
days[size_t(index)].month != month)
|
||||
continue;
|
||||
const bool match = std::any_of(fixtures.begin(), fixtures.end(),
|
||||
[&](const auto &f) {
|
||||
return f.day == index;
|
||||
});
|
||||
const bool chosen = selected == index;
|
||||
const auto &iso = days[size_t(index)].iso;
|
||||
const auto date = iso.substr(8, 2) + "." + iso.substr(5, 2) + "." +
|
||||
iso.substr(0, 4);
|
||||
body += btn(
|
||||
"calendar-select",
|
||||
(chosen ? "<span class=\"calendar-outline\" style=\"" +
|
||||
rect(3, 3, cell_width - 6, cell_height - 6) +
|
||||
"\"></span>"
|
||||
: "") +
|
||||
std::string("<span class=\"control-label\">") +
|
||||
std::to_string(number) + "</span>",
|
||||
std::string("calendar-day ") + (match ? "has-match " : "") +
|
||||
(chosen ? "selected-day" : ""),
|
||||
"id=\"calendar-day-" + std::to_string(index) + "\" data-id=\"" +
|
||||
std::to_string(index) + "\" aria-pressed=\"" +
|
||||
(chosen ? "true" : "false") + "\" aria-label=\"" + date +
|
||||
(match ? ", belegt" : ", frei") + "\" style=\"" +
|
||||
rect(77 + col * cell_width, 66 + row * cell_height,
|
||||
cell_width, cell_height) + "\"");
|
||||
}
|
||||
}
|
||||
body += "</section>";
|
||||
while (first < int(days.size()) && days[size_t(first)].month == month)
|
||||
++first;
|
||||
}
|
||||
const auto &iso = days[size_t(selected)].iso;
|
||||
std::string info = iso.substr(8, 2) + "." + iso.substr(5, 2) + "." +
|
||||
iso.substr(0, 4) + " · spielfrei";
|
||||
for (const auto &f : fixtures)
|
||||
if (f.day == selected) {
|
||||
const auto *home = world_->find("clubs", f.home),
|
||||
*away = world_->find("clubs", f.away);
|
||||
info = iso.substr(8, 2) + "." + iso.substr(5, 2) + "." + iso.substr(0, 4) +
|
||||
" · " + std::to_string(f.round + 1) + ". Spieltag · " +
|
||||
(home ? world_->name(*home) : "") + " – " +
|
||||
(away ? world_->name(*away) : "");
|
||||
}
|
||||
body += "<p id=\"calendar-info\" class=\"calendar-info\">" + esc(info) +
|
||||
"</p><nav class=\"bottom-controls\">";
|
||||
std::vector<std::pair<std::string, std::string>> countries, leagues;
|
||||
std::set<std::string> seen;
|
||||
for (auto *l : world_->leagues()) {
|
||||
const auto id = l->value("nation", "");
|
||||
if (seen.insert(id).second)
|
||||
countries.emplace_back(id, world_->nation_name(id));
|
||||
if (id == nation)
|
||||
leagues.emplace_back(l->value("id", ""), world_->name(*l));
|
||||
}
|
||||
return body + select("calendar-country", countries, nation, "calendar-country") +
|
||||
select("calendar-league", leagues, league_id, "calendar-league") +
|
||||
"</nav>";
|
||||
}
|
||||
@@ -135,12 +135,25 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
keyboard_navigation_ = true;
|
||||
else if (type == "mousedown")
|
||||
keyboard_navigation_ = false;
|
||||
if (type == "blur") {
|
||||
if (auto *select = dynamic_cast<Rml::ElementFormControlSelect *>(
|
||||
event.GetTargetElement());
|
||||
select && select->IsSelectBoxVisible()) {
|
||||
select->CancelSelectBox();
|
||||
dirty_ = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (auto *n = event.GetTargetElement(); n && n != doc_;
|
||||
n = n->GetParentNode())
|
||||
if (n->GetId() == "native-ticket-layer")
|
||||
return;
|
||||
if (type == "mouseup" && event.GetParameter<int>("button", 0) == 1) {
|
||||
if (scene_ == "desktop" && menu_.empty() && popup_.empty()) {
|
||||
if (scene_ == "desktop" && !menu_.empty() && popup_.empty()) {
|
||||
menu_.clear();
|
||||
draft_preferences_ = nullptr;
|
||||
refresh();
|
||||
} else if (scene_ == "desktop" && menu_.empty() && popup_.empty()) {
|
||||
std::string id;
|
||||
for (auto *n = event.GetTargetElement(); n && n != doc_;
|
||||
n = n->GetParentNode())
|
||||
@@ -190,6 +203,38 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
if (type == "keydown") {
|
||||
const auto key =
|
||||
Rml::Input::KeyIdentifier(event.GetParameter<int>("key_identifier", 0));
|
||||
Rml::ElementFormControlSelect *select = nullptr;
|
||||
for (auto *n = target; n && n != doc_; n = n->GetParentNode())
|
||||
if ((select = dynamic_cast<Rml::ElementFormControlSelect *>(n)))
|
||||
break;
|
||||
if (select && !select->HasAttribute("disabled")) {
|
||||
const bool open = select->IsSelectBoxVisible();
|
||||
if (open && key == Rml::Input::KI_TAB) {
|
||||
select->CancelSelectBox();
|
||||
dirty_ = true;
|
||||
}
|
||||
if ((!open && (key == Rml::Input::KI_DOWN || key == Rml::Input::KI_UP)) ||
|
||||
key == Rml::Input::KI_RETURN || key == Rml::Input::KI_SPACE) {
|
||||
if (open)
|
||||
select->HideSelectBox();
|
||||
else {
|
||||
select->ShowSelectBox();
|
||||
if (key == Rml::Input::KI_UP)
|
||||
select->SetSelection(select->GetNumOptions() - 1);
|
||||
}
|
||||
event.StopImmediatePropagation();
|
||||
dirty_ = true;
|
||||
return;
|
||||
}
|
||||
if (open && (key == Rml::Input::KI_HOME || key == Rml::Input::KI_END)) {
|
||||
select->SetSelection(key == Rml::Input::KI_HOME
|
||||
? 0
|
||||
: select->GetNumOptions() - 1);
|
||||
event.StopImmediatePropagation();
|
||||
dirty_ = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (key == Rml::Input::KI_RETURN || key == Rml::Input::KI_SPACE) {
|
||||
for (auto *n = target; n && n != doc_; n = n->GetParentNode())
|
||||
if (n->GetTagName() == "button") {
|
||||
@@ -887,7 +932,7 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
|
||||
}
|
||||
static const std::set<std::string> available = {
|
||||
"tables", "strengths", "camp", "settings",
|
||||
"save", "load", "training", "tactics"};
|
||||
"save", "load", "training", "tactics", "calendar"};
|
||||
if (!available.contains(route)) {
|
||||
message("Diese native Ansicht wird im nächsten Menüpaket übertragen.");
|
||||
return;
|
||||
@@ -922,6 +967,13 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (action == "calendar-select") {
|
||||
if (apply("calendar", {{"kind", "select"}, {"value", std::stoi(id)}})) {
|
||||
focus_after_render_ = target->GetId();
|
||||
refresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (action == "tactic-cycle") {
|
||||
const int i = std::stoi(id);
|
||||
if (i < 0 || i > 6)
|
||||
@@ -1102,6 +1154,26 @@ void App::change(Rml::Element *target) {
|
||||
pending_selects_.insert(target->GetId());
|
||||
return;
|
||||
}
|
||||
if (kind == "calendar-country" || kind == "calendar-league") {
|
||||
std::string league = value;
|
||||
if (kind == "calendar-country") {
|
||||
const auto current = snap().state.at("calendar").at("league").get<std::string>();
|
||||
const auto *competition = world_->find("competitions", current);
|
||||
if (competition && competition->value("nation", "") == value)
|
||||
return;
|
||||
const auto leagues = world_->leagues(value);
|
||||
if (leagues.empty())
|
||||
return;
|
||||
league = leagues.front()->value("id", "");
|
||||
}
|
||||
if (snap().state.at("calendar").at("league") == league)
|
||||
return;
|
||||
if (apply("calendar", {{"kind", "league"}, {"value", league}})) {
|
||||
focus_after_render_ = target->GetId();
|
||||
refresh();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (kind == "training-focus") {
|
||||
const auto player = target->GetAttribute<Rml::String>("data-player", "");
|
||||
const int focus = std::stoi(value);
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "modern/ui/demo_calendar.hpp"
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
|
||||
namespace bmh::modern_ui {
|
||||
std::vector<CalendarDay> calendar_days(const std::string &start) {
|
||||
using namespace std::chrono;
|
||||
if (start.size() != 10 || start.substr(4) != "-07-01" ||
|
||||
!std::all_of(start.begin(), start.begin() + 4,
|
||||
[](char c) { return c >= '0' && c <= '9'; }))
|
||||
return {};
|
||||
const int y = std::stoi(start.substr(0, 4));
|
||||
if (y < 1 || y > 9998)
|
||||
return {};
|
||||
const sys_days first = year{y} / July / 1, last = year{y + 1} / July / 1;
|
||||
std::vector<CalendarDay> result;
|
||||
for (auto date = first; date < last; date += days{1}) {
|
||||
const year_month_day parts{date};
|
||||
const int month = unsigned(parts.month()), day = unsigned(parts.day());
|
||||
std::ostringstream iso;
|
||||
iso.imbue(std::locale::classic());
|
||||
iso << std::setfill('0') << std::setw(4) << int(parts.year()) << '-'
|
||||
<< std::setw(2) << month << '-' << std::setw(2) << day;
|
||||
result.push_back({iso.str(), int(parts.year()), month, day,
|
||||
int((weekday{date}.c_encoding() + 6) % 7)});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Json demo_calendar(const Catalog &world, const std::string &date) {
|
||||
auto year = std::stoi(date.substr(0, 4));
|
||||
if (date.substr(5, 2) < "07")
|
||||
--year;
|
||||
const auto leagues = world.leagues("nation:de");
|
||||
std::ostringstream start;
|
||||
start.imbue(std::locale::classic());
|
||||
start << std::setfill('0') << std::setw(4) << year << "-07-01";
|
||||
if (calendar_days(start.str()).empty())
|
||||
throw editor::Error("invalid_demo_calendar");
|
||||
return {{"start", start.str()},
|
||||
{"selected", 6},
|
||||
{"league", leagues.empty() ? "" : leagues.front()->value("id", "")},
|
||||
{"friendlies", Json::array()},
|
||||
{"moves", Json::array()}};
|
||||
}
|
||||
bool valid_demo_calendar(const Json &v, const Catalog &world) {
|
||||
try {
|
||||
const auto days = calendar_days(v.at("start").get<std::string>());
|
||||
if (days.empty() || !v.at("selected").is_number_integer() ||
|
||||
v["selected"] < 0 || v["selected"] >= days.size())
|
||||
return false;
|
||||
const auto league = v.at("league").get<std::string>();
|
||||
const auto leagues = world.leagues();
|
||||
if (std::none_of(leagues.begin(), leagues.end(), [&](auto *r) {
|
||||
return r->value("id", "") == league;
|
||||
}))
|
||||
return false;
|
||||
// Reserved projections for later native planning menus; no unimplemented
|
||||
// booking or rescheduling action is silently accepted by this preview.
|
||||
return v.at("friendlies").is_array() && v["friendlies"].empty() &&
|
||||
v.at("moves").is_array() && v["moves"].empty();
|
||||
} catch (const Json::exception &) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
std::string edit_demo_calendar(Json &state, const Json &action,
|
||||
const Catalog &world) {
|
||||
const auto kind = action.at("kind").get<std::string>();
|
||||
auto next = state;
|
||||
if (kind == "select")
|
||||
next["selected"] = action.at("value");
|
||||
else if (kind == "league")
|
||||
next["league"] = action.at("value");
|
||||
else
|
||||
return "unknown_calendar_action";
|
||||
if (!valid_demo_calendar(next, world))
|
||||
return "invalid_calendar_selection";
|
||||
state = std::move(next);
|
||||
return {};
|
||||
}
|
||||
std::vector<CalendarFixture> calendar_fixtures(const Json &state,
|
||||
const Catalog &world,
|
||||
const std::string &managed_club) {
|
||||
const auto clubs = world.clubs(state.at("league").get<std::string>());
|
||||
if (clubs.size() < 2)
|
||||
return {};
|
||||
const auto found = std::find_if(clubs.begin(), clubs.end(), [&](auto *c) {
|
||||
return c->value("id", "") == managed_club;
|
||||
});
|
||||
const int followed = found == clubs.end() ? 0 : int(found - clubs.begin());
|
||||
const int count = int(clubs.size()) + int(clubs.size() % 2);
|
||||
std::vector<int> ring(size_t(count), 0);
|
||||
std::iota(ring.begin(), ring.end(), 0);
|
||||
std::vector<CalendarFixture> first, result;
|
||||
for (int round = 0; round < count - 1; ++round) {
|
||||
for (int pair = 0; pair < count / 2; ++pair) {
|
||||
auto home = ring[size_t(pair)], away = ring[size_t(count - 1 - pair)];
|
||||
if ((pair == 0 ? round : pair) % 2)
|
||||
std::swap(home, away);
|
||||
if ((home != followed && away != followed) ||
|
||||
home >= int(clubs.size()) || away >= int(clubs.size()))
|
||||
continue;
|
||||
first.push_back({30 + round * 7, round,
|
||||
clubs[size_t(home)]->value("id", ""),
|
||||
clubs[size_t(away)]->value("id", "")});
|
||||
}
|
||||
std::rotate(ring.begin() + 1, ring.end() - 1, ring.end());
|
||||
}
|
||||
result = first;
|
||||
for (const auto &fixture : first)
|
||||
result.push_back({fixture.day + (count - 1) * 7,
|
||||
fixture.round + count - 1, fixture.away, fixture.home});
|
||||
const auto days = calendar_days(state.at("start").get<std::string>()).size();
|
||||
std::erase_if(result, [&](const auto &f) { return size_t(f.day) >= days; });
|
||||
return result;
|
||||
}
|
||||
} // namespace bmh::modern_ui
|
||||
@@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
#include "modern/ui/catalog.hpp"
|
||||
|
||||
namespace bmh::modern_ui {
|
||||
struct CalendarDay {
|
||||
std::string iso;
|
||||
int year, month, day, weekday;
|
||||
};
|
||||
struct CalendarFixture {
|
||||
int day, round;
|
||||
std::string home, away;
|
||||
};
|
||||
// Presentation fixtures only. No scheduler, RNG, session or match is called.
|
||||
std::vector<CalendarDay> calendar_days(const std::string &start);
|
||||
Json demo_calendar(const Catalog &, const std::string &date);
|
||||
bool valid_demo_calendar(const Json &, const Catalog &);
|
||||
std::string edit_demo_calendar(Json &, const Json &, const Catalog &);
|
||||
std::vector<CalendarFixture> calendar_fixtures(const Json &, const Catalog &,
|
||||
const std::string &managed_club);
|
||||
} // namespace bmh::modern_ui
|
||||
+12
-1
@@ -1,5 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "modern/ui/model.hpp"
|
||||
#include "modern/ui/demo_calendar.hpp"
|
||||
#include "modern/ui/demo_sports.hpp"
|
||||
#include "modern/ui/desktop.hpp"
|
||||
#include <algorithm>
|
||||
@@ -76,9 +77,10 @@ DemoSource::DemoSource(std::shared_ptr<const Catalog> catalog)
|
||||
{"edits", Json::object()}};
|
||||
state_["training"] = demo_training(*catalog_, club);
|
||||
state_["tactics"] = demo_tactics();
|
||||
saved_ = state_;
|
||||
if (!valid_date(state_.at("date")))
|
||||
throw editor::Error("invalid_demo_date");
|
||||
state_["calendar"] = demo_calendar(*catalog_, state_.at("date"));
|
||||
saved_ = state_;
|
||||
}
|
||||
Snapshot DemoSource::snapshot() const { return {revision_, catalog_, state_}; }
|
||||
ActionResult DemoSource::apply(const Action &action) {
|
||||
@@ -122,6 +124,11 @@ ActionResult DemoSource::apply(const Action &action) {
|
||||
const auto error = edit_demo_tactics(next["tactics"], action.value);
|
||||
if (!error.empty())
|
||||
return {false, revision_, error};
|
||||
} else if (action.kind == "calendar") {
|
||||
const auto error = edit_demo_calendar(next["calendar"], action.value,
|
||||
*catalog_);
|
||||
if (!error.empty())
|
||||
return {false, revision_, error};
|
||||
} else if (action.kind == "camp.select") {
|
||||
if (!camp_id(action.value))
|
||||
return {false, revision_, "camp_unknown"};
|
||||
@@ -189,6 +196,10 @@ Json DemoSource::load(const fs::path &file) {
|
||||
!data.at("edits").is_object() || !data.at("opening").is_string() ||
|
||||
!camp_id(data.at("camp").at("selected")))
|
||||
throw editor::Error("invalid_demo_state");
|
||||
if (!data.contains("calendar"))
|
||||
data["calendar"] = demo_calendar(*catalog_, data.at("date"));
|
||||
if (!valid_demo_calendar(data.at("calendar"), *catalog_))
|
||||
throw editor::Error("invalid_demo_calendar");
|
||||
const auto &focus = data.at("camp").at("focus");
|
||||
if (!focus.is_array() || focus.size() != 3)
|
||||
throw editor::Error("invalid_focus");
|
||||
|
||||
@@ -967,6 +967,8 @@ std::string App::render_menu(const std::string &key) {
|
||||
body = render_training();
|
||||
else if (key == "tactics")
|
||||
body = render_tactics();
|
||||
else if (key == "calendar")
|
||||
body = render_calendar();
|
||||
else if (key == "camp")
|
||||
body = render_camp();
|
||||
else if (key == "settings")
|
||||
|
||||
+17
-2
@@ -5,6 +5,7 @@
|
||||
#include "launch/rml_path.hpp"
|
||||
#include "launch/rml_video.hpp"
|
||||
#include "modern/ui/controls.hpp"
|
||||
#include "modern/ui/demo_calendar.hpp"
|
||||
#include "modern/ui/demo_sports.hpp"
|
||||
#include "modern/ui/desktop.hpp"
|
||||
#include "modern/ui/gui_assets.hpp"
|
||||
@@ -598,6 +599,7 @@ class App final : public Rml::EventListener {
|
||||
std::string render_camp();
|
||||
std::string render_training();
|
||||
std::string render_tactics();
|
||||
std::string render_calendar();
|
||||
std::string training_balls(const std::string &, int, int, bool,
|
||||
const std::string &player = {}, int size = 56,
|
||||
int gap = 10, bool overtraining = false);
|
||||
@@ -627,6 +629,15 @@ class App final : public Rml::EventListener {
|
||||
}
|
||||
}
|
||||
void input(Rml::Element *);
|
||||
void scale_chalk_shadow() {
|
||||
// Pinned RmlUI font effects read integer pixels even for dp properties.
|
||||
// Match the HTML's two logical pixels at the current stage density.
|
||||
if (auto *label = doc_->QuerySelector(".tactic-effort-label")) {
|
||||
const auto offset = std::to_string(int(std::round(2 * scale_)));
|
||||
label->SetProperty("font-effect",
|
||||
"shadow(" + offset + "px " + offset + "px #386824)");
|
||||
}
|
||||
}
|
||||
void resize() {
|
||||
int w, h, pw, ph;
|
||||
SDL_GetWindowSize(video_.window, &w, &h);
|
||||
@@ -644,6 +655,7 @@ class App final : public Rml::EventListener {
|
||||
element("canvas")->SetProperty("top", scalar(canvas_top_) + "px");
|
||||
if (ticket_)
|
||||
ticket_->resize(device_ratio_);
|
||||
scale_chalk_shadow();
|
||||
dirty_ = true;
|
||||
}
|
||||
void render() {
|
||||
@@ -685,6 +697,7 @@ class App final : public Rml::EventListener {
|
||||
: "saturate(0.34) brightness(0.70)");
|
||||
needs_render_ = false;
|
||||
last_rendered_menu_ = menu_;
|
||||
scale_chalk_shadow();
|
||||
dirty_ = true;
|
||||
if (focus_ticket_) {
|
||||
if (auto *n = element("desktop-ticket"))
|
||||
@@ -856,9 +869,10 @@ public:
|
||||
if (!doc_)
|
||||
throw std::runtime_error("Modern UI layout missing");
|
||||
for (const char *event :
|
||||
{"click", "dblclick", "change", "input", "keydown", "mousedown",
|
||||
{"click", "dblclick", "change", "input", "keydown", "blur", "mousedown",
|
||||
"mouseup", "mousemove", "contextmenu"})
|
||||
doc_->AddEventListener(event, this);
|
||||
doc_->AddEventListener(event, this, Rml::String(event) == "keydown" ||
|
||||
Rml::String(event) == "blur");
|
||||
if (!config_.theme.empty())
|
||||
theme_ = config_.theme;
|
||||
if (theme_ != "midnight" && theme_ != "silver" && theme_ != "matchday")
|
||||
@@ -980,6 +994,7 @@ public:
|
||||
#include "modern/ui/desktop_screens.inc"
|
||||
#include "modern/ui/screens.inc"
|
||||
#include "modern/ui/sports_screens.inc"
|
||||
#include "modern/ui/calendar_screen.inc"
|
||||
} // namespace
|
||||
bool is_modern_world(const fs::path &file) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user