\chapter{Design Documents}\ChapterLabel{DesignDocuments} \index{activity diagram} \section{Scope and Evidence} Additional reviewed, planned sidebar ownership/MVC, catalogue data, creation activity and UI sketches are linked from Section~\ref{Section:SidebarDesign}. They do not replace the current implementation activities below. This appendix retains activity diagrams for opening, whole-element dragging, saving, and closing. A separately labelled planned new-edit activity and two-panel interaction sequence record the agreed transaction/history contract, reconciled on November 24. MVC, ownership, and class views appear in \ChapterRef{SoftwareArchitecture}, adapting the course distinction between architecture chapters and supporting design artifacts. The activities follow source inspection and agreed design. The first-build check (Section~\ref{Section:NativeScaffoldCheck}) did not exercise save or close-guard branches. Bounded drag/save evidence now appears in Section~\ref{Section:WholeElementDragCheck}. Endpoint editing and compiler/PDF integration remain unfinished. \begingroup\small \begin{tabularx}{\linewidth}{@{}L{3.0cm}Y Y@{}} \caption{Design Diagram Evidence and Requirement Links\label{Table:DesignDiagramEvidence}}\\ \toprule\textbf{Diagram} & \textbf{Basis and boundary} & \textbf{Related requirements}\\ \midrule\endfirsthead \toprule\textbf{Diagram} & \textbf{Basis and boundary} & \textbf{Related requirements}\\ \midrule\endhead\bottomrule\endfoot Open source & Existing file-read and subset-display paths; unsupported source yields diagnostics and an empty scene. & \RequirementRef{REQ-F-001}, \RequirementRef{REQ-F-005}, \RequirementRef{REQ-D-001}\\ Drag and source update & Whole-element preview, guarded commit and cancellation; endpoint editing remains planned. & \RequirementRef{REQ-F-004}, \RequirementRef{REQ-F-009}--\RequirementRef{REQ-F-011}, \RequirementRef{REQ-D-001}, \RequirementRef{REQ-A-007}, \RequirementRef{REQ-P-001}\\ Save source & Guarded save after graphical edits; save/reopen and observed external-change refusal checked in the bounded prototype. & \RequirementRef{REQ-F-006}, \RequirementRef{REQ-D-001}\\ Close window & Existing unsaved-change guard and stack/QObject lifetimes; future child processes need a separate shutdown design. & \RequirementRef{REQ-F-006}, \RequirementRef{REQ-D-001}\\ \end{tabularx} \endgroup \noindent\textbf{Notation.} Component names follow \ChapterRef{SoftwareArchitecture}. Filled/ringed circles mark start/end; rounded boxes are actions; diamonds are decisions or merges. Brackets show conditions. No concurrency fork or join is implied. \input{../assets/design-diagrams/styles.tex} \clearpage \section{Open Source Activity}\label{Section:OpenActivity} This follows the current subset-display and unsupported-source paths. A successful file read is reported as an open success even when graphical interpretation is unavailable. Supported elements are displayed; unsupported source clears records and items and returns a diagnostic. The offscreen Open check is recorded in Section~\ref{Section:RectangleDisplayCheck}; startup-file checks follow in Section~\ref{Section:SegmentDisplayCheck}. \begin{figure}[ht] \centering \resizebox{!}{15.0cm}{\input{../assets/design-diagrams/open-activity.tex}} \caption[Current Open activity]{Current open-file control flow, including cancellation and read failure. Source remains authoritative; supported elements permit whole-body movement. \label{Figure:OpenActivity}} \end{figure} \clearpage \section{Move/Resize and Source-Update Activity}\label{Section:DragActivity} Precondition: the parser and scene have produced supported editable records. Move and rectangle-corner gestures use scene events, service-prepared constraints, candidate checks and guarded source edits. Whole-element moves translate both defining points; corner resizing keeps the opposite corner fixed. Endpoint editing remains deferred. Escape, focus loss, and cancelling an active interaction restore the unchanged document geometry. Source changes occur once on release. A future saved-revision compilation request after successful Save is governed by \RequirementRef{REQ-P-001}; compiler/display integration remains pending. \begin{figure}[ht] \centering \resizebox{!}{14.5cm}{\input{../assets/design-diagrams/drag-activity.tex}} \caption[Current move and resize activity]{Current move/resize feedback with one source-update batch on release. Cancelling or rejecting an edit preserves source. No LaTeX run occurs inside the movement loop.\label{Figure:DragActivity}} \end{figure} \clearpage \section{Prototype Move/Resize Sequence}\label{Section:DragSequence} This sequence follows the current scene and controller for \UseCaseRef{UC-002}. The drag preview clamps the displayed item to the fixed paper when present (\RequirementRef{REQ-I-013}). Release reuses the same constrained geometry. A changed, accepted move or resize publishes candidate source, parsed records and history atomically, then updates the source pane. Unchanged/cancelled gestures preserve revision and redo. Boundary contact is a valid edit; stale or unsupported requests preserve the prior source. \begin{figure}[ht] \centering \resizebox{\linewidth}{!}{\input{../assets/design-diagrams/drag-sequence.tex}} \caption[Current move and resize sequence]{Implemented ordering for movement and rectangle resizing. The candidate source is checked before the authoritative document changes.\label{Figure:DragSequence}} \end{figure} \clearpage \section{Current Undo/Redo Sequence}\label{Section:HistorySequence} The bounded implementation of \UseCaseRef{UC-004} copies the live document, restores a target in the candidate, validates interpretation/display, and then accepts the entire prepared state. The candidate owns its own history value; no live cursor is advanced before acceptance. This differs from the proposed generic method names in Figure~\ref{Figure:TransactionSequence}. \begin{figure}[ht] \centering \resizebox{\linewidth}{!}{\input{../assets/design-diagrams/history-sequence.tex}} \caption[Current Undo and Redo sequence]{Current snapshot restoration and atomic publication. Save retains history; successful Open clears it. No new history entry or disk write occurs during restoration.\label{Figure:HistorySequence}} \end{figure} \clearpage \section{Save Source Activity}\label{Section:SaveActivity} This models the existing \texttt{saveDocument()} logic. The changed-document path is reachable after a whole-element move. Active previews are cancelled before saving. The baseline comparison detects observed external changes; it does not eliminate a concurrent-write race after that comparison. \begin{figure}[ht] \centering \resizebox{!}{15.0cm}{\input{../assets/design-diagrams/save-activity.tex}} \caption[Current Save activity]{Current guarded save: failures retain dirty state, and only a successful commit updates the saved baseline; all paths retain session history. Opening, writing, and committing stop immediately on the first failure.\label{Figure:SaveActivity}} \end{figure} \clearpage \section{Close and Lifetime Activity}\label{Section:CloseActivity} This models the single stack-owned window in \path{code/src/main.cpp}. An active drag preview is cancelled before the unsaved-change guard runs. Cancelling or failing a requested save prevents closing. An accepted final close exits the event loop, after which the stack window is destroyed. \begin{figure}[ht] \centering \resizebox{!}{15.0cm}{\input{../assets/design-diagrams/close-activity.tex}} \caption[Current close and lifetime activity]{Current close guard and component lifetime. Discard allows closing; it does not write source to disk. See Figure~\ref{Figure:SaveActivity} for the save subactivity.\label{Figure:CloseActivity}} \end{figure} \clearpage \section{Planned Common Transaction Activity} This activity illustrates acceptance of a new edit under the registered requirements, not current runtime behavior. Undo/Redo restores an existing target through panel (b) of Figure~\ref{Figure:TransactionSequence}; it creates no new entry. Requirements \RequirementRef{REQ-D-002} and \RequirementRef{REQ-A-011} define atomic publication and validation. \RequirementRef{REQ-I-003} defines notification. Validation and history preparation complete before source/history publication. The planned collaborators are shown in Figure~\ref{Figure:PlannedTransactionClasses}. The bounded coordinate-edit implementation follows the same acceptance rule; its source-based activity is Figure~\ref{Figure:DragActivity}. Generic transaction signatures and the file-store extraction remain planned. \begin{figure}[htbp] \centering \resizebox{!}{15.2cm}{\input{../assets/design-diagrams/transaction-activity.tex}} \caption[Planned generic edit acceptance]{Reviewed planned new-edit acceptance. Unchanged/cancelled actions preserve redo without an error; rejection preserves source/history with a reason. Future compilation belongs to successful Save and cannot roll back acceptance. \label{Figure:TransactionActivity}} \end{figure} \clearpage \section{Planned Transaction Interaction Sequence}\label{Section:TransactionSequence} Use cases \UseCaseRef{UC-002}, \UseCaseRef{UC-004} and \UseCaseRef{UC-005} share this core. Preparation precedes the atomic publication boundary; history retrieval does not advance the position prematurely. Save/Open are separate I/O workflows and do not write disk during undo/redo. Panel (a) prepares a new edit; provider geometry and host/syntax rewrites remain distinct. Panel (b) cancels any active gesture preview before Undo/Redo, retrieves the existing target without advancing history prematurely, and prepares restoration before atomic publication. Availability/failure paths preserve state. Neither restoration nor failed preparation appends a new history entry. \begin{figure}[ht] \centering \resizebox{0.92\linewidth}{!}{\begin{minipage}{18.5cm}\centering\input{../assets/design-diagrams/transaction-sequence.tex}\end{minipage}} \caption[Planned generic transaction interactions]{Reviewed planned interactions: (a) new-edit acceptance and (b) Undo/Redo restoration. Ordering follows \RequirementRef{REQ-D-002}, \RequirementRef{REQ-A-012} and \RequirementRef{REQ-I-006}; no runtime execution is claimed.\label{Figure:TransactionSequence}} \end{figure} \clearpage \section{Planned Label and Selection Activity} This supplements the existing source-based drag activity; it does not imply that label parsing or the selection menus are implemented. Unchanged proposals exit without publication or an error, as \RequirementRef{REQ-I-006} requires. Candidate selection follows \UseCaseRef{UC-006}; label adjustment follows \UseCaseRef{UC-005}. Detachment is a separate later action. \begin{figure}[ht] \centering \resizebox{!}{14cm}{\input{../assets/design-diagrams/label-selection-activity.tex}} \caption[Planned label selection and movement]{Planned label movement and failure/cancellation boundaries for \RequirementRef{REQ-F-021}--\RequirementRef{REQ-F-024}, \RequirementRef{REQ-I-007}--\RequirementRef{REQ-I-009}. \label{Figure:LabelSelectionActivity}} \end{figure}