17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 07:29:20 +02:00
Files
maszyna/application/editoruilayer.h
maj00r d4791f6a29 feat(editor): a model or an include standing by a track bent along it (B, or the Bend along the track section of the toolset): it stays where it stood and follows the track, through the joined tracks as far as it reaches; reference point at its start, origin, middle, end or a point picked on the model, across at its origin, the side facing the track, the far side or its middle, up at its origin, bottom, top or the top of its edge by the track; the blue cross of a bent model dragged for its offset, with Shift for its height and with Ctrl along the track, the values shown at the cursor; a bent model clicked to edit; one step of the undo history; scale of the model kept, parts lit only at night left out; edges of platforms told by the name of the model and by the overhang of their edge over the foot: put 1.725 m from the axis at the height the name gives, turned with the edge to the track when they stood the other way; platforms stand on the plane of the rail heads carried on to their edge (PKP PLK ST-T2), the gauge widening led in from the tracks beyond the ends and from the other path of a switch; gaps between the pieces of a sweep filled with the paths which join them; Platforms and models tab left out of the track editor; laid track eased into the curvature of the one it joins with a transition curve; File > Open scenery... starts the editor again with the scenery picked from a list; the camera saved with the scenery; T and Shift+T turn each turntable to its next and previous position by event launchers written on each save; a turntable track deleted with its template; a scenery with no trainset gets a WMB10 on its first track; vehicle placed where the track is clicked; gauge check takes in the bent models; Polish translation of the editor
2026-10-08 00:51:40 +02:00

116 lines
3.9 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "application/uilayer.h"
#include "application/editoruipanels.h"
namespace scene
{
class basic_node;
}
class editor_ui : public ui_layer
{
public:
// constructors
editor_ui();
// methods
// updates state of UI elements
void update() override;
void set_node(scene::basic_node *Node);
// include of a scenery template to show in the node properties in place of a node; nullptr if there's none
void set_include(include_selection *Include);
void add_node_template(const std::string &desc);
float rot_val();
bool rot_from_last();
functions_panel::rotation_mode rot_mode();
const std::string *get_active_node_template(bool bypassRandom = false);
nodebank_panel::edit_mode mode();
void set_mode(nodebank_panel::edit_mode const Mode);
float getSpacing();
// node bank and model set access (set selection widgets, set contents)
nodebank_panel &nodebank()
{
return m_nodebankpanel;
}
// rotation settings widgets, for tools drawn by the editor mode
void render_rotation_controls();
// draws the area fill settings in its node bank tab (the fill state lives in the editor mode)
void set_fill_options(std::function<void()> Renderer)
{
m_filloptions = std::move(Renderer);
}
// the open track window takes the mouse over, whichever toolset tab is chosen
void set_track(bool const Track)
{
m_track = Track;
}
// draws menus of the editor mode in the menu bar, past the ones of the user interface
void set_menu_options(std::function<void()> Renderer)
{
m_menuoptions = std::move(Renderer);
}
// draws the gizmo settings in the toolset window (the gizmo state lives in the editor mode)
void set_gizmo_options(std::function<void()> Renderer)
{
m_gizmooptions = std::move(Renderer);
}
// draws the array settings in the toolset window (the array state lives in the editor mode)
void set_array_options(std::function<void()> Renderer)
{
m_arrayoptions = std::move(Renderer);
}
void set_bend_options(std::function<void()> Renderer)
{
m_bendoptions = std::move(Renderer);
}
void expand_bend()
{
m_bendexpand = true;
}
// actions of the file menu, performed by the editor mode
void set_file_actions(std::function<void()> Save, std::function<void()> Export);
void set_new_scenery(std::function<void()> New) { m_newscenery = std::move(New); }
void set_open_scenery(std::function<void()> Open) { m_openscenery = std::move(Open); }
// shows outcome of an operation in the layers window
void set_status(std::string const &Status, bool const Error = false);
private:
// methods
void render_mode_options(nodebank_panel::edit_mode const Mode);
void render_header_sections();
void render_menu_contents() override;
// members
itemproperties_panel m_itempropertiespanel{"Node Properties", true}; // not a window of its own, drawn in the toolset window
functions_panel m_functionspanel{"Functions", true}; // not a window of its own, its settings are drawn in the toolset tabs
nodebank_panel m_nodebankpanel{"Toolset", true}; // main editor window: gizmo, node properties, edit modes and the node bank
layers_panel m_layerspanel{"Layers", true};
includes_panel m_includespanel{"Include database", false};
std::function<void()> m_save;
std::function<void()> m_export;
std::function<void()> m_newscenery;
std::function<void()> m_openscenery;
brush_object_list m_brushobjects;
bool m_insertrandom{false}; // insert mode picks a random template from m_insertset
model_set_ref m_insertset;
std::function<void()> m_filloptions;
std::function<void()> m_menuoptions;
std::function<void()> m_gizmooptions;
std::function<void()> m_arrayoptions;
std::function<void()> m_bendoptions;
bool m_bendexpand{false};
scene::basic_node *m_node{nullptr}; // currently bound scene node, if any
bool m_track{false};
};