#include <scratch_workspace.h>

Public Member Functions | |
| const ScratchWorkspaceState & | state () const |
| void | Restore (const ScratchWorkspaceState &state) |
| ScratchPage & | current () |
| const ScratchPage & | current () const |
| bool | Select (uint64_t id) |
| absl::Status | AddPage (bool duplicate=false) |
| absl::Status | DeletePage () |
| absl::Status | Rename (absl::string_view name) |
| absl::Status | Resize (int width, int height) |
| absl::Status | Stamp (const TileBrush &brush, int x, int y) |
| absl::Status | Capture (const TileBrush &brush, int source_map) |
| void | Clear () |
| absl::Status | Parse (absl::string_view contents) |
| std::string | Serialize () const |
| absl::Status | Load (const std::filesystem::path &path) |
| absl::Status | Save (const std::filesystem::path &path) |
Static Public Attributes | |
| static constexpr size_t | kMaxPages = 32 |
Private Attributes | |
| ScratchWorkspaceState | state_ |
| std::optional< std::string > | saved_contents_ |
| bool | file_loaded_ = false |
Definition at line 40 of file scratch_workspace.h.
|
inline |
Definition at line 44 of file scratch_workspace.h.
References state_.
Referenced by yaze::editor::OverworldEditor::BeginScratchEdit(), yaze::editor::OverworldEditor::DrawEditorMenu(), yaze::editor::OverworldEditor::DrawScratchSpace(), yaze::editor::OverworldEditor::FinishScratchEdit(), and Restore().
| void yaze::editor::ScratchWorkspace::Restore | ( | const ScratchWorkspaceState & | state | ) |
Definition at line 138 of file scratch_workspace.cc.
References yaze::editor::ScratchWorkspaceState::next_id, state(), and state_.
Referenced by yaze::editor::OverworldEditor::RestoreScratchState().

| ScratchPage & yaze::editor::ScratchWorkspace::current | ( | ) |
Definition at line 145 of file scratch_workspace.cc.
References current().
Referenced by AddPage(), Capture(), Clear(), current(), yaze::editor::OverworldEditor::DrawEditorMenu(), yaze::editor::OverworldEditor::DrawScratchSpace(), yaze::editor::OverworldEditor::DrawScratchSpaceEdits(), yaze::editor::OverworldEditor::RebuildScratchBitmapFromTileData(), Rename(), Resize(), and Stamp().

| const ScratchPage & yaze::editor::ScratchWorkspace::current | ( | ) | const |
Definition at line 150 of file scratch_workspace.cc.
References yaze::editor::ScratchWorkspaceState::pages, and state_.
| bool yaze::editor::ScratchWorkspace::Select | ( | uint64_t | id | ) |
Definition at line 157 of file scratch_workspace.cc.
References yaze::editor::ScratchWorkspaceState::pages, yaze::editor::ScratchWorkspaceState::selected_id, and state_.
Referenced by yaze::editor::OverworldEditor::DrawEditorMenu(), and yaze::editor::OverworldEditor::DrawScratchSpace().
| absl::Status yaze::editor::ScratchWorkspace::AddPage | ( | bool | duplicate = false | ) |
Definition at line 167 of file scratch_workspace.cc.
References current(), yaze::editor::ScratchPage::id, kMaxPages, yaze::editor::ScratchPage::name, yaze::editor::ScratchWorkspaceState::next_id, yaze::editor::ScratchWorkspaceState::pages, yaze::editor::ScratchWorkspaceState::selected_id, and state_.
Referenced by Capture(), yaze::editor::OverworldEditor::DrawEditorMenu(), and yaze::editor::OverworldEditor::DrawScratchSpace().

| absl::Status yaze::editor::ScratchWorkspace::DeletePage | ( | ) |
Definition at line 188 of file scratch_workspace.cc.
References yaze::editor::ScratchWorkspaceState::pages, yaze::editor::ScratchWorkspaceState::selected_id, and state_.
Referenced by yaze::editor::OverworldEditor::DrawEditorMenu(), and yaze::editor::OverworldEditor::DrawScratchSpace().
| absl::Status yaze::editor::ScratchWorkspace::Rename | ( | absl::string_view | name | ) |
Definition at line 180 of file scratch_workspace.cc.
References current(), and yaze::editor::ScratchPage::name.
Referenced by yaze::editor::OverworldEditor::DrawScratchSpace().

| absl::Status yaze::editor::ScratchWorkspace::Resize | ( | int | width, |
| int | height ) |
Definition at line 201 of file scratch_workspace.cc.
References current(), yaze::editor::ScratchPage::height, and yaze::editor::ScratchPage::width.
Referenced by yaze::editor::OverworldEditor::DrawScratchSpace().

| absl::Status yaze::editor::ScratchWorkspace::Stamp | ( | const TileBrush & | brush, |
| int | x, | ||
| int | y ) |
Definition at line 210 of file scratch_workspace.cc.
References yaze::editor::TileBrush::at(), current(), yaze::editor::TileBrush::height, yaze::editor::TileBrush::valid(), and yaze::editor::TileBrush::width.
Referenced by Capture(), yaze::editor::OverworldEditor::DrawScratchSpace(), and yaze::editor::OverworldEditor::DrawScratchSpaceEdits().

| absl::Status yaze::editor::ScratchWorkspace::Capture | ( | const TileBrush & | brush, |
| int | source_map ) |
Definition at line 223 of file scratch_workspace.cc.
References AddPage(), current(), yaze::editor::TileBrush::height, Stamp(), yaze::editor::TileBrush::valid(), and yaze::editor::TileBrush::width.

| void yaze::editor::ScratchWorkspace::Clear | ( | ) |
Definition at line 240 of file scratch_workspace.cc.
References current().

| absl::Status yaze::editor::ScratchWorkspace::Parse | ( | absl::string_view | contents | ) |
Definition at line 247 of file scratch_workspace.cc.
References kMaxPages, yaze::editor::ScratchWorkspaceState::next_id, yaze::editor::ScratchWorkspaceState::pages, yaze::Json::parse(), yaze::editor::ScratchWorkspaceState::selected_id, and state_.
Referenced by Load().

| std::string yaze::editor::ScratchWorkspace::Serialize | ( | ) | const |
Definition at line 286 of file scratch_workspace.cc.
References yaze::Json::array(), yaze::Json::dump(), yaze::editor::ScratchWorkspaceState::next_id, yaze::editor::ScratchWorkspaceState::pages, yaze::editor::ScratchWorkspaceState::selected_id, and state_.
Referenced by Save().

| absl::Status yaze::editor::ScratchWorkspace::Load | ( | const std::filesystem::path & | path | ) |
Definition at line 308 of file scratch_workspace.cc.
References file_loaded_, Parse(), saved_contents_, and state_.
Referenced by yaze::editor::OverworldEditor::LoadScratchPad().

| absl::Status yaze::editor::ScratchWorkspace::Save | ( | const std::filesystem::path & | path | ) |
Definition at line 325 of file scratch_workspace.cc.
References yaze::core::AcquireSourceArtifactPublicationLock(), file_loaded_, saved_contents_, Serialize(), and yaze::project::WriteProjectFileAtomically().
Referenced by yaze::editor::OverworldEditor::SaveScratchPad().

|
staticconstexpr |
Definition at line 42 of file scratch_workspace.h.
Referenced by AddPage(), yaze::editor::OverworldEditor::DrawEditorMenu(), yaze::editor::OverworldEditor::DrawScratchSpace(), and Parse().
|
private |
Definition at line 65 of file scratch_workspace.h.
Referenced by AddPage(), current(), DeletePage(), Load(), Parse(), Restore(), Select(), Serialize(), and state().
|
private |
Definition at line 66 of file scratch_workspace.h.
|
private |
Definition at line 67 of file scratch_workspace.h.