mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 04:47:06 +01:00
feat(editor): the track tool panels keep their fields, results and buttons within the panel
- The card of the tool: after a long gesture the action goes under it, at its indent, when what is left of the row is narrower than 8 font sizes or the longest word of the action. It was squeezed into a sliver and broken in the middle of its words. - A click on the title row of the card folds it to that row (icon, name, family, key, and a small triangle marker) and opens it again. One flag for all the tools, kept with the editor settings (`track_card_folded` in eu07_editor.ini), open by default: the card took 250-300 px at the top of every tool and repeats the hint bar of the view. - The grade labels of the vertical profile, on the graph and in the view, write the per mille as the panel does (the translated "per mille", the per mille sign in Polish), not "o/oo". - The track analysis window: the thresholds of the speed check and of the joints keep to their widest name and a field of 10 font sizes where the window is wider than that, as docked across the bottom (`begin_fields_fitted`). The results are tables with each column as wide as what is in it: the speed check with its column names kept at the top as the list scrolls, the joints with the kind, the value and the two tracks next to each other. A click on a row shows it as before. - `same_line_if_fits` puts the next button beside the one before only when it fits in what is left of the line, at the start of the next line otherwise. Used where the route design puts buttons side by side, for "Forget the design" in the profile panel, which was cut off at the edge, and for the buttons of a switch in the inspector. - The laying options: the speed, the curve radius and the longest path are fields with the name on the left in two columns (`begin_fields`/`field_row`), as in the inspector, the route and the profile, the chips of the quick values under them. The segmented choices give the short names less of the room when a long one doesn't fit in its even share, and go on in a second bar when they don't fit side by side: "Through the clicked points" overflowed its third of the bar.
This commit is contained in:
@@ -611,7 +611,7 @@ void joints_tool::render_options()
|
||||
}
|
||||
if (ImGui::TreeNode(STR_C("Thresholds")))
|
||||
{
|
||||
if (begin_fields("##jointlimits", 0.55f))
|
||||
if (begin_fields_fitted("##jointlimits", 0.55f, {"Around the camera (m)", "Gap up to (m)", "Step (m)", "Kink (deg)", "Cant jump (mm)", "Grade break (per mille)", "Off the terrain model (m)"}))
|
||||
{
|
||||
auto const limit = [](char const *Label, char const *Id, double &Value, char const *Format) {
|
||||
field_row(Label);
|
||||
@@ -675,36 +675,41 @@ void joints_tool::render_options()
|
||||
"Kinks and grade breaks: the end is turned in line with the other path. Cant: the cant of the other path.\n"
|
||||
"The plain path moves, a switch stays as it is. One Ctrl+Z takes it all back"));
|
||||
}
|
||||
auto const namewidth{std::max(110.0f, ImGui::GetContentRegionAvail().x * 0.32f)};
|
||||
bool const chosen{state.selected >= 0 && state.selected < static_cast<int>(state.issues.size())};
|
||||
auto const details{chosen ? ImGui::GetFrameHeightWithSpacing() + ImGui::GetTextLineHeightWithSpacing() * 2.0f : 0.0f};
|
||||
ImGui::BeginChild("jointresults", ImVec2(0.0f, -details), true);
|
||||
ImGui::Columns(4, "jointrows", false);
|
||||
ImGui::SetColumnWidth(0, 90.0f);
|
||||
ImGui::SetColumnWidth(1, 80.0f);
|
||||
ImGui::SetColumnWidth(2, namewidth);
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(static_cast<int>(listed.size()));
|
||||
while (clipper.Step())
|
||||
for (int row = clipper.DisplayStart; row < clipper.DisplayEnd; ++row)
|
||||
{
|
||||
auto const index{listed[row]};
|
||||
auto const &issue{state.issues[index]};
|
||||
auto const colour{ImGui::ColorConvertU32ToFloat4(kind_colour(issue.type))};
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, issue.fixed ? ImVec4(0.5f, 0.8f, 0.5f, 1.0f) : colour);
|
||||
if (ImGui::Selectable(format("%s##joint%d", STR_C(kind_name(issue.type)), index).c_str(), state.selected == index, ImGuiSelectableFlags_SpanAllColumns))
|
||||
joints_focus(index);
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::NextColumn();
|
||||
ImGui::TextUnformatted(issue.fixed ? STR_C("fixed") : value_text(issue).c_str());
|
||||
ImGui::NextColumn();
|
||||
ImGui::TextUnformatted(label_of(issue.track).c_str());
|
||||
ImGui::NextColumn();
|
||||
ImGui::TextUnformatted(label_of(issue.other).c_str());
|
||||
ImGui::NextColumn();
|
||||
}
|
||||
ImGui::Columns(1);
|
||||
ImGui::EndChild();
|
||||
// the kind, the value, the track and the other one, each column as wide as what's in it and a little apart: in a window
|
||||
// docked across the bottom the tracks stay next to each other
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(std::round(ImGui::GetFontSize() * 0.6f), ImGui::GetStyle().CellPadding.y));
|
||||
if (ImGui::BeginTable("jointresults", 4, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersOuter, ImVec2(0.0f, -details)))
|
||||
{
|
||||
ImGui::TableSetupColumn("##kind");
|
||||
ImGui::TableSetupColumn("##value");
|
||||
ImGui::TableSetupColumn("##track");
|
||||
ImGui::TableSetupColumn("##other", ImGuiTableColumnFlags_WidthStretch);
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(static_cast<int>(listed.size()));
|
||||
while (clipper.Step())
|
||||
for (int row = clipper.DisplayStart; row < clipper.DisplayEnd; ++row)
|
||||
{
|
||||
auto const index{listed[row]};
|
||||
auto const &issue{state.issues[index]};
|
||||
auto const colour{ImGui::ColorConvertU32ToFloat4(kind_colour(issue.type))};
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, issue.fixed ? ImVec4(0.5f, 0.8f, 0.5f, 1.0f) : colour);
|
||||
if (ImGui::Selectable(format("%s##joint%d", STR_C(kind_name(issue.type)), index).c_str(), state.selected == index, ImGuiSelectableFlags_SpanAllColumns))
|
||||
joints_focus(index);
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(issue.fixed ? STR_C("fixed") : value_text(issue).c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(label_of(issue.track).c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(label_of(issue.other).c_str());
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
if (chosen)
|
||||
{
|
||||
auto &issue{state.issues[state.selected]};
|
||||
|
||||
Reference in New Issue
Block a user