diff --git a/application/editorgestures.h b/application/editorgestures.h index 59c73aa63..c2d3710f6 100644 --- a/application/editorgestures.h +++ b/application/editorgestures.h @@ -99,7 +99,7 @@ struct gesture_word // "Ctrl+wheel", "Shift+click x4", "Drag a point", "Q W E": the keys and the parts of the mouse it names, the rest as text inline std::vector gesture_words(std::string const &Keys) { - static char const *const keys[]{"Ctrl", "Shift", "Alt", "Esc", "Del", "Enter", "Backspace", "Tab", "Space", "Home", "End", "PrtScr"}; + static char const *const keys[]{"Ctrl", "Shift", "Alt", "Esc", "Del", "Enter", "Backspace", "Tab", "Space", "Home", "End", "PrtScr", "~"}; auto const mouse = [](std::string const &Word) -> std::string { if (Word == "LMB" || Word == "click" || Word == "Click" || Word == "Press") return "LMB"; diff --git a/application/editormode.cpp b/application/editormode.cpp index acca8d0d2..0dfe67d8a 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -6798,7 +6798,9 @@ void editor_mode::render_shortcuts_window() {"RMB held, W S A D", "Fly forwards, back, left, right (arrows in the legacy scheme)"}, {"RMB held, E / Q", "Fly up / down (Page Up / Page Down in the legacy scheme)"}, {"F", "Fly to the selected"}, - {"O", "Top view, orthographic"}}}, + {"O", "Top view, orthographic"}, + {"~", "The aerial photo shown or hidden, kept with the scenery"}, + {"Ctrl+~", "The photos of what the camera sees downloaded before the rest"}}}, {"Ride along the track", {{"Y", "Ride along the track under the cursor, the tools working on; Y again leaves"}, {"RMB held, W / S", "Drive; Shift faster, Ctrl+W / Ctrl+Down much faster"}, @@ -7994,7 +7996,8 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in } if (false == anyModifier) { - m_orthophoto.enabled(false == m_orthophoto.enabled()); + // as the button of the toolbar: the scenery's, and the terrain model doesn't turn it on again behind the user + choose_orthophoto(false == m_orthophoto.enabled()); ui()->set_status(m_orthophoto.enabled() ? STR("Orthophoto on (~)") : STR("Orthophoto off (~)")); } break; @@ -8692,7 +8695,7 @@ void editor_mode::render_camera_settings(bool const Window) void editor_mode::orthophoto_hurry() { if (false == m_orthophoto.enabled()) - m_orthophoto.enabled(true); + choose_orthophoto(true); // what the camera sees of the ground: rays through a grid over the screen to the level of the ground under the camera, or as far // as the reach of the orthophoto along it where they don't come down to it (the sky) ImGuiIO const &io = ImGui::GetIO(); diff --git a/application/editormodeviewport.cpp b/application/editormodeviewport.cpp index b9d44ad4d..a5c805b26 100644 --- a/application/editormodeviewport.cpp +++ b/application/editormodeviewport.cpp @@ -39,6 +39,10 @@ struct editor_tool_button bool group{false}; // a gap before it, it starts another group bool enabled{true}; ImU32 accent{0}; // the colour of the family of the tool, 0 if it has none + // a slider of the value 0..1 in its place, its label and the value in per cent in it: the action applies the value as it's + // dragged, Done once it's let go + float *value{nullptr}; + std::function done; }; namespace @@ -174,6 +178,22 @@ void editor_mode::work_area_tools(std::vector &Buttons) add(track_tab::signals, true); add(track_tab::kilometrage, false); add(track_tab::lineside, false); + // the photo the tracks are laid over: shown or hidden for the scenery (~), and how much it covers, at hand + auto const photo{m_orthophoto.enabled()}; + Buttons.push_back({icon::orthophoto, STR_C("Photo"), "~", STR_C("The aerial photo of geoportal.gov.pl under the scenery, shown or hidden in this scenery"), photo, + [this, photo]() { choose_orthophoto(false == photo); }, true}); + if (photo && false == m_orthophoto.settings().in_scene) + { + static float opacity{0.6f}; + opacity = m_orthophoto.settings().opacity; + Buttons.push_back({icon::count, STR_C("Opacity"), nullptr, STR_C("How much the photo covers the scenery under it"), false, [this]() { + auto config{m_orthophoto.settings()}; + config.opacity = opacity; + m_orthophoto.settings(config); + }}); + Buttons.back().value = &opacity; + Buttons.back().done = [this]() { save_orthophoto_settings(); }; + } auto const advanced{m_track_tab == track_tab::turntable || srk_tab() || vehicle || m_track_tab == track_tab::profile || m_track_tab == track_tab::speed || m_track_tab == track_tab::joints || m_track_tab == track_tab::norms || m_gauge.is_open()}; auto const more{EditorSettings.track_tools_more()}; Buttons.push_back({icon::more, more ? STR_C("Less") : STR_C("More"), nullptr, STR_C("Turntable, stations and their signals, line block, trainset, profile, speed, joints, gauge"), more, [more]() { @@ -416,6 +436,9 @@ void editor_mode::render_toolbar_tools() return Button.picture == icon::count || Names == names::all || (Names == names::chosen && Button.chosen); }; auto const width = [&](tool_button const &Button, names const Names) { + // a slider keeps its width, its label in it + if (Button.value != nullptr) + return std::round(std::max(96.0f * s, ImGui::CalcTextSize(Button.label).x + ImGui::CalcTextSize(" 100%").x + 2.0f * pad)); if (false == named(Button, Names)) return std::max(buttonheight, iconside + pad); auto result{2.0f * pad + ImGui::CalcTextSize(Button.label).x}; @@ -451,6 +474,27 @@ void editor_mode::render_toolbar_tools() } auto const size{ImVec2(width(button, shown), buttonheight)}; ImVec2 const position{x, top}; + if (button.value != nullptr) + { + // in the middle of the row, as high as a field + ImGui::SetCursorScreenPos(ImVec2(position.x, std::round(top + (buttonheight - ImGui::GetFrameHeight()) * 0.5f))); + ImGui::PushID(static_cast(index)); + ImGui::SetNextItemWidth(size.x); + int percent{static_cast(std::lround(*button.value * 100.0f))}; + if (ImGui::SliderInt("##value", &percent, 0, 100, (std::string{button.label} + " %d%%").c_str())) + { + *button.value = static_cast(percent) / 100.0f; + if (button.action) + button.action(); + } + if (ImGui::IsItemDeactivatedAfterEdit() && button.done) + button.done(); + if (ImGui::IsItemHovered() && false == ImGui::IsItemActive()) + button_tooltip(button); + ImGui::PopID(); + x = position.x + size.x; + continue; + } ImGui::SetCursorScreenPos(position); ImGui::PushID(static_cast(index)); auto const clicked{ImGui::InvisibleButton("##tool", size)}; diff --git a/lang/editor_pl.po b/lang/editor_pl.po index 351325561..97b608e94 100644 --- a/lang/editor_pl.po +++ b/lang/editor_pl.po @@ -15420,12 +15420,27 @@ msgstr "pobieranie się nie udało" msgid "Retry##photos" msgstr "Ponów##photos" +msgid "The aerial photo shown or hidden, kept with the scenery" +msgstr "Zdjęcie lotnicze pokazane albo ukryte, zapamiętane dla scenerii" + +msgid "The photos of what the camera sees downloaded before the rest" +msgstr "Zdjęcia tego, co widzi kamera, pobierane przed resztą" + msgid "The terrain loaded by itself as the first track of a new scenery is laid" msgstr "Teren wczytywany sam przy układaniu pierwszego toru nowej scenerii" msgid "In the background, where the scenery lies on the map; the panel of the laying tells it, with the button to go without it" msgstr "W tle, tam gdzie sceneria leży na mapie; mówi o tym panel układania, z przyciskiem, by obejść się bez terenu" +msgid "Photo" +msgstr "Zdjęcie" + +msgid "The aerial photo of geoportal.gov.pl under the scenery, shown or hidden in this scenery" +msgstr "Zdjęcie lotnicze z geoportal.gov.pl pod scenerią, pokazane albo ukryte w tej scenerii" + +msgid "How much the photo covers the scenery under it" +msgstr "Jak mocno zdjęcie przykrywa scenerię pod nim" + msgid "Without terrain: the tracks lie on the flat plane; the terrain can be loaded later in Terrain (F5)" msgstr "Bez terenu: tory leżą na płaszczyźnie; teren możesz wczytać później w dziale Teren (F5)"