| 1319 | } |
| 1320 | |
| 1321 | void PySubLayout::apply_state() { |
| 1322 | const auto eff = effective_state(); |
| 1323 | if (!eff.enabled) { |
| 1324 | ImGui::BeginDisabled(true); |
| 1325 | disabled_pushed_ = true; |
| 1326 | } |
| 1327 | if (eff.alert) { |
| 1328 | const auto theme = get_current_theme(); |
| 1329 | const auto err = tuple_to_imvec4(theme.palette.error); |
| 1330 | ImGui::PushStyleColor(ImGuiCol_Text, err); |
| 1331 | ImGui::PushStyleColor(ImGuiCol_FrameBg, |
| 1332 | ImVec4(err.x, err.y, err.z, ALERT_BG_ALPHA)); |
| 1333 | color_push_count_ += 2; |
| 1334 | } |
| 1335 | const float scale = std::max(eff.scale_x, eff.scale_y); |
| 1336 | if (scale != 1.0f) { |
| 1337 | ImGui::SetWindowFontScale(scale); |
| 1338 | font_scale_pushed_ = true; |
| 1339 | } |
| 1340 | } |
| 1341 | |
| 1342 | void PySubLayout::pop_per_item_state() { |
| 1343 | if (font_scale_pushed_) { |
no test coverage detected