mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
move vehicle param window to vehicle list, add radiostop button
This commit is contained in:
@@ -2,12 +2,19 @@
|
||||
#include "widgets/vehiclelist.h"
|
||||
#include "simulation.h"
|
||||
#include "Driver.h"
|
||||
#include "widgets/vehicleparams.h"
|
||||
|
||||
ui::vehiclelist_panel::vehiclelist_panel(ui_layer &parent)
|
||||
: ui_panel(LOC_STR(vehiclelist_window), false), m_parent(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ui::vehiclelist_panel::render_contents()
|
||||
{
|
||||
for (TDynamicObject *vehicle : simulation::Vehicles.sequence())
|
||||
{
|
||||
if (vehicle->Prev())
|
||||
if (!vehicle->Mechanik)
|
||||
continue;
|
||||
|
||||
std::string name = vehicle->name();
|
||||
@@ -16,20 +23,13 @@ void ui::vehiclelist_panel::render_contents()
|
||||
if (vehicle->Mechanik)
|
||||
timetable = vehicle->Mechanik->TrainName() + ", ";
|
||||
|
||||
std::string label = std::string(name + ", " + timetable + std::to_string(speed) + " km/h");
|
||||
if (!vehicle->Next())
|
||||
ImGui::TextUnformatted(label.c_str());
|
||||
else if (ImGui::TreeNode(vehicle, label.c_str()))
|
||||
{
|
||||
vehicle = vehicle->Next();
|
||||
while (vehicle)
|
||||
{
|
||||
ImGui::TextUnformatted(vehicle->name().c_str());
|
||||
vehicle = vehicle->Next();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
std::string label = std::string(name + ", " + timetable + std::to_string(speed) + " km/h###");
|
||||
|
||||
// ImGui::ShowDemoWindow();
|
||||
ImGui::PushID(vehicle);
|
||||
if (ImGui::Button(label.c_str())) {
|
||||
ui_panel *panel = new vehicleparams_panel(vehicle->name());
|
||||
m_parent.add_owned_panel(panel);
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user