Move app open routing into document helper
This commit is contained in:
@@ -84,11 +84,11 @@ Current hotspot files:
|
||||
- `src/canvas_modes.cpp`: 176 lines
|
||||
- `src/node.cpp`: 222 lines
|
||||
- `src/main.cpp`: 130 lines
|
||||
- `src/node_panel_brush.cpp`: 189 lines
|
||||
- `src/node_panel_brush.cpp`: 186 lines
|
||||
- `src/node_stroke_preview.cpp`: 192 lines
|
||||
- `src/node_canvas.cpp`: 69 lines
|
||||
- `src/app.cpp`: 113 lines
|
||||
- `src/app_dialogs.cpp`: 168 lines
|
||||
- `src/app.cpp`: 105 lines
|
||||
- `src/app_dialogs.cpp`: 106 lines
|
||||
|
||||
Latest slice:
|
||||
|
||||
@@ -96,10 +96,21 @@ Latest slice:
|
||||
`handle_legacy_node_canvas_event(...)` in
|
||||
`src/legacy_canvas_tool_services.*`, leaving `src/node_canvas.cpp` as a much
|
||||
thinner controller shell.
|
||||
- `App::open_document()` now routes through
|
||||
`src/legacy_document_open_services.cpp`, which moved the document route
|
||||
classification and unsaved-project gating out of `src/app.cpp` and into the
|
||||
retained document-open helper.
|
||||
- `App::dialog_layer_rename()` now routes through
|
||||
`open_legacy_document_layer_rename_dialog(...)` in
|
||||
`src/legacy_document_layer_services.*`, which moved the remaining
|
||||
overlay-open/wire/close workflow out of `src/app_dialogs.cpp`.
|
||||
- The remaining low-level `NodeStrokePreview` viewport/query and texture-slot
|
||||
plumbing now lives in
|
||||
`src/legacy_node_stroke_preview_runtime_services.*` instead of staying
|
||||
inline in `src/node_stroke_preview.cpp`.
|
||||
- `NodePanelBrushPreset` global panel registration now lives in
|
||||
`src/legacy_brush_preset_list_services.*` instead of staying on the live
|
||||
node type as a static registry field.
|
||||
- The remaining generic `Node` geometry/state pocket for `SetSize(...)`,
|
||||
`SetMinSize(...)`, `SetMaxSize(...)`, and `SetPosition(const glm::vec2)` now
|
||||
lives in `src/legacy_ui_node_style.*` instead of staying inline in
|
||||
@@ -185,8 +196,9 @@ Current architecture mismatches that must be treated as real blockers:
|
||||
lives in
|
||||
`src/app_dialogs_export.cpp` and those `App::dialog_*` entrypoints are
|
||||
thinner too, while new/open/save/browse/resize workflow entrypoints now also
|
||||
live in `src/app_dialogs_workflow.cpp` and `src/app_dialogs.cpp` is now
|
||||
mostly a thin dialog dispatch surface.
|
||||
live in `src/app_dialogs_workflow.cpp`, while the layer-rename dialog open /
|
||||
wire / close pocket now lives in `src/legacy_document_layer_services.*`, and
|
||||
`src/app_dialogs.cpp` is now a thinner dialog dispatch surface.
|
||||
- `App`, `Canvas`, `Node`, retained workers, and platform entrypoints still use
|
||||
global singleton reach, raw observer pointers, retained static worker
|
||||
ownership in several app families, and ad hoc mutex/condition-variable
|
||||
@@ -355,7 +367,11 @@ Current architecture mismatches that must be treated as real blockers:
|
||||
`src/legacy_brush_preset_panel_ui.*`
|
||||
instead of staying inline in `src/node_panel_brush.cpp`, which removes the
|
||||
last inline brush-panel popup close handler from the live node. The
|
||||
broader preset workflow pocket still remains, while `NodeCanvas::handle_event()`
|
||||
`NodePanelBrushPreset` registration/lifecycle pocket now also routes through
|
||||
the preset-list helper registry instead of a node-local static vector,
|
||||
which removes the remaining live preset-panel ownership glue from
|
||||
`src/node_panel_brush.cpp`. The broader preset workflow pocket still remains,
|
||||
while `NodeCanvas::handle_event()`
|
||||
now also routes
|
||||
through `execute_node_canvas_handle_event(...)`, which trims another coherent
|
||||
input-routing block from `src/node_canvas.cpp` even though the file is still
|
||||
|
||||
@@ -341,6 +341,15 @@ Current slice:
|
||||
`handle_legacy_node_canvas_event(...)` in
|
||||
`src/legacy_canvas_tool_services.*`, which moves the live input/controller
|
||||
pocket out of `src/node_canvas.cpp` and keeps the node on a thinner shell.
|
||||
- `App::dialog_layer_rename()` now routes through
|
||||
`open_legacy_document_layer_rename_dialog(...)` in
|
||||
`src/legacy_document_layer_services.*`, which moves the remaining dialog
|
||||
overlay-open/wire/close workflow out of `src/app_dialogs.cpp` and leaves
|
||||
the app dialog shell thinner.
|
||||
- `App::open_document(...)` now routes through
|
||||
`execute_legacy_document_open(...)` in `src/legacy_document_open_services.*`,
|
||||
which moves route classification and unsaved-project gating out of
|
||||
`src/app.cpp` and into the retained document-open helper.
|
||||
- `NodeCanvas` restore/clear context, resize handling, camera reset, buffer
|
||||
creation, cursor visibility/update, tick, and destroy ownership now also
|
||||
live in `src/legacy_node_canvas_state_services.*` instead of staying inline
|
||||
@@ -385,6 +394,10 @@ Current slice:
|
||||
now also lives in `src/legacy_ui_node_style.*` instead of staying inline in
|
||||
`src/node.cpp`, which trims another coherent base scene-graph shell pocket
|
||||
without changing the public surface.
|
||||
- `NodePanelBrushPreset` global panel registration now also lives in
|
||||
`src/legacy_brush_preset_list_services.*` instead of staying on the live
|
||||
node type as a static registry field, which trims another retained
|
||||
controller-state pocket from `src/node_panel_brush.cpp`.
|
||||
|
||||
Write scope:
|
||||
- `src/node_stroke_preview.cpp`
|
||||
@@ -533,7 +546,7 @@ Status: In Progress
|
||||
|
||||
Why now:
|
||||
`src/app_dialogs.cpp` still mixes document workflow decisions, export routing,
|
||||
dialog construction, and overlay ownership in one 168-line shell.
|
||||
dialog construction, and overlay ownership in one 106-line shell.
|
||||
|
||||
Current slice:
|
||||
- Informational overlay opener paths for user manual, changelog, about,
|
||||
@@ -546,8 +559,15 @@ Current slice:
|
||||
entrypoints are now thin call-throughs, but new/open/save/browse/resize and
|
||||
retained dialog execution are still inline in `src/app_dialogs.cpp`.
|
||||
- New/open/save/browse/resize workflow entrypoints now also live in
|
||||
`src/app_dialogs_workflow.cpp`, and `src/app_dialogs.cpp` is down to the
|
||||
remaining thin entrypoints plus layer-rename retained dialog glue.
|
||||
`src/app_dialogs_workflow.cpp`, and the layer-rename dialog open / wire /
|
||||
close pocket now lives in `src/legacy_document_layer_services.*`, leaving
|
||||
`src/app_dialogs.cpp` down to the remaining thin entrypoints plus other
|
||||
retained dialog glue.
|
||||
- `App::open_document()` now routes document classification and unsaved-
|
||||
project gating through `src/legacy_document_open_services.cpp` instead of
|
||||
keeping that shell pocket inline in `src/app.cpp`, which trims the live app
|
||||
entry file a little further while preserving the retained open-action
|
||||
behavior.
|
||||
|
||||
Write scope:
|
||||
- `src/app_dialogs.cpp`
|
||||
|
||||
11
src/app.cpp
11
src/app.cpp
@@ -35,16 +35,7 @@ void App::create()
|
||||
|
||||
void App::open_document(std::string path)
|
||||
{
|
||||
const auto route = pp::app::classify_document_open_path(path);
|
||||
if (!route)
|
||||
return;
|
||||
|
||||
const bool has_unsaved_project =
|
||||
route.value().kind == pp::app::DocumentOpenKind::open_project && Canvas::I->m_unsaved;
|
||||
const auto open_plan = pp::app::plan_document_open(route.value().kind, has_unsaved_project);
|
||||
const auto status = pp::panopainter::execute_legacy_document_open_plan(*this, open_plan, route.value());
|
||||
if (!status.ok())
|
||||
LOG("Document open action failed: %s", status.message);
|
||||
pp::panopainter::execute_legacy_document_open(*this, std::move(path));
|
||||
}
|
||||
|
||||
bool App::request_close()
|
||||
|
||||
@@ -163,6 +163,22 @@ pp::foundation::Status execute_legacy_document_open_plan(
|
||||
return pp::app::execute_document_open_plan(action, route, services);
|
||||
}
|
||||
|
||||
pp::foundation::Status execute_legacy_document_open(App& app, std::string path)
|
||||
{
|
||||
const auto route = pp::app::classify_document_open_path(path);
|
||||
if (!route)
|
||||
return route.status();
|
||||
|
||||
const bool has_unsaved_project =
|
||||
route.value().kind == pp::app::DocumentOpenKind::open_project && Canvas::I->m_unsaved;
|
||||
const auto open_plan = pp::app::plan_document_open(route.value().kind, has_unsaved_project);
|
||||
const auto status = execute_legacy_document_open_plan(app, open_plan, route.value());
|
||||
if (!status.ok())
|
||||
LOG("Document open action failed: %s", status.message);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void execute_legacy_downloaded_project_open(
|
||||
App& app,
|
||||
std::string_view path,
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
#include "app_core/document_session.h"
|
||||
#include "foundation/result.h"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
class App;
|
||||
|
||||
namespace pp::panopainter {
|
||||
|
||||
[[nodiscard]] pp::foundation::Status execute_legacy_document_open(
|
||||
App& app,
|
||||
std::string path);
|
||||
|
||||
[[nodiscard]] pp::foundation::Status execute_legacy_document_open_plan(
|
||||
App& app,
|
||||
pp::app::DocumentOpenPlanAction action,
|
||||
|
||||
Reference in New Issue
Block a user