Jazz2/Editor/Shell/ShellCommon.h file

Namespaces

namespace Jazz2
Root namespace of Jazz² Resurrection.
namespace Jazz2::UI
User interface and menus.
namespace Jazz2::UI::Windows
Toolkit of windows, panels and controls, compiled only if WITH_UI_WINDOWS.
namespace Jazz2::Editor

Classes

class Jazz2::Editor::UpdateWatcher
Takes no room, only calls a function every frame.
class Jazz2::Editor::AnnotationCache
Bookmarks and notes of a level, read again only when they change.

Functions

auto MakeMenuEntry(EditorAction& action) -> MenuEntry
Makes an item of a menu running an action, with its label, icon and shortcut.
auto FormatInteger(std::int32_t value) -> String
Formats a whole number.
auto GetUnitSuffix(ParamUnit unit) -> StringView
Returns the short name of a unit of a parameter of an event shown after its name, empty for none.
auto AddLabeledRow(Element* parent, StringView label, StringView tooltip = {}, float labelWidth = 62.0f) -> Stack*
Adds a row with a label.
auto MatchesSearch(StringView text, StringView search) -> bool
Returns true if all words of a search are in a text, whatever the case of the letters.
auto FindEventField(const EventDescriptor* descriptor, ParamType type) -> const EventParamField*
Returns the first parameter of an event of a type, or nullptr.
auto GetDifficultyFlag(std::int32_t difficulty) -> std::uint8_t
Returns the flag of an event of a difficulty of the game, see Formats::EventRecord::Easy, 0 for none.
auto GetPrimaryEvent(IEditorContext& session, Formats::EventRecord& event) -> bool
Returns the event the event properties show.
auto IsLayerLocked(const LevelDocument& document, std::int32_t layer) -> bool
Returns true if a layer is locked in the editor, see DocumentLayer::EditorLocked.
auto CheckLayerUnlocked(IEditorContext& session, std::int32_t layer) -> bool
Returns true if a layer can be changed, shows why not otherwise.
void ShowOpenImageDialog(IEditorContext& session, StringView title, Function<void(StringView)>&& onChosen)
Shows a dialog to choose a PNG image to open, from the places images are read from, see EditorSession::GetImageRoots().
auto ShowSingleDialog(IEditorContext& session, const char* id, std::unique_ptr<Element> dialog, OverlayOptions&& options, Function<void()>&& onShownAgain = {}) -> Element*
Shows a dialog that isn't modal, only one of each.
auto ReuseSingleDialog(IEditorContext& session, const char* id, bool close = false) -> bool
Returns true if a dialog of id is shown already.

Function documentation

Stack* AddLabeledRow(Element* parent, StringView label, StringView tooltip = {}, float labelWidth = 62.0f)

Adds a row with a label.

A form puts the labels in a column as wide as the longest of them, any other element gets a row with a label of labelWidth units.

bool GetPrimaryEvent(IEditorContext& session, Formats::EventRecord& event)

Returns the event the event properties show.

The selected one off the grid, the first selected one, or the first one to place. Returns false if there's none.

Element* ShowSingleDialog(IEditorContext& session, const char* id, std::unique_ptr<Element> dialog, OverlayOptions&& options, Function<void()>&& onShownAgain = {})

Shows a dialog that isn't modal, only one of each.

The editor remembers the dialog under id until it's closed. Returns the dialog.

bool ReuseSingleDialog(IEditorContext& session, const char* id, bool close = false)

Returns true if a dialog of id is shown already.

With close it's closed, otherwise the function it was shown with is called, see ShowSingleDialog().