yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
water_fill_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_PANELS_WATER_FILL_PANEL_H
2#define YAZE_APP_EDITOR_DUNGEON_PANELS_WATER_FILL_PANEL_H
3
4#include <string>
5#include <vector>
6
11#include "app/gui/core/icons.h"
13
14namespace yaze::editor {
15
17 public:
19 DungeonObjectInteraction* interaction)
20 : viewer_(viewer), interaction_(interaction) {}
21
22 std::string GetId() const override { return "dungeon.water_fill"; }
23 std::string GetWorkflowGroup() const override { return "Editors"; }
24 std::string GetDisplayName() const override { return "Water Fill"; }
25 std::string GetIcon() const override { return ICON_MD_WATER_DROP; }
26 std::string GetEditorCategory() const override { return "Dungeon"; }
27
28 void SetCanvasViewer(DungeonCanvasViewer* viewer) { viewer_ = viewer; }
30 interaction_ = interaction;
31 }
32
33 void Draw(bool* p_open) override;
34
35 static std::vector<zelda3::WaterFillZoneEntry> CollectZones(
36 const DungeonRoomStore& rooms);
38 zelda3::Room* room);
39
40 private:
41 const InteractionContext* RoomEditContext(int room_id) const {
42 if (!viewer_ || !interaction_ || !viewer_->rooms())
43 return nullptr;
44 const auto* context =
46 if (!context || context->rooms != viewer_->rooms() ||
47 context->rom != viewer_->rom() || context->current_room_id != room_id ||
48 !context->on_mutation || !context->on_invalidate_cache) {
49 return nullptr;
50 }
51 return context;
52 }
53
54 template <typename Edit>
55 void EditRoomWaterFill(int room_id, Edit edit) {
56 const auto* context = RoomEditContext(room_id);
57 if (!context)
58 return;
59 // A panel command is separate from any pending canvas paint stroke.
61 context->NotifyMutation(MutationDomain::kWaterFill);
62 edit((*viewer_->rooms())[room_id]);
63 context->NotifyInvalidateCache(MutationDomain::kWaterFill);
64 }
65
66 std::string last_io_status_;
67 std::string last_io_error_;
68
71};
72
73} // namespace yaze::editor
74
75#endif // YAZE_APP_EDITOR_DUNGEON_PANELS_WATER_FILL_PANEL_H
InteractionContext * context() const
Get the interaction context.
Handles object selection, placement, and interaction within the dungeon canvas.
InteractionCoordinator & entity_coordinator()
Get the interaction coordinator for entity handling.
void SetCanvasViewer(DungeonCanvasViewer *viewer)
std::string GetIcon() const override
Material Design icon for this panel.
std::string GetId() const override
Unique identifier for this panel.
static std::vector< zelda3::WaterFillZoneEntry > CollectZones(const DungeonRoomStore &rooms)
DungeonObjectInteraction * interaction_
DungeonCanvasViewer * viewer_
const InteractionContext * RoomEditContext(int room_id) const
void SetInteraction(DungeonObjectInteraction *interaction)
void EditRoomWaterFill(int room_id, Edit edit)
std::string GetWorkflowGroup() const override
Optional workflow group for hack-centric actions.
static void ApplyZoneToRoom(const zelda3::WaterFillZoneEntry &z, zelda3::Room *room)
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
void Draw(bool *p_open) override
Draw the panel content.
WaterFillPanel(DungeonCanvasViewer *viewer, DungeonObjectInteraction *interaction)
std::string GetEditorCategory() const override
Editor category this panel belongs to.
Base interface for all logical window content components.
#define ICON_MD_WATER_DROP
Definition icons.h:2131
Editors are the view controllers for the application.
Shared context for all interaction handlers.