rigProject 0.1.1
RigKit pack API - rigProject
Loading...
Searching...
No Matches
pages.h File Reference

Page board helpers - make CPage entities and pan / zoom the board. More...

#include <algorithm>
#include <cmath>
#include <entt/entt.hpp>
#include <string>
#include <vector>
#include "ecs/MEcs.h"
#include "CAnchor.h"
#include "CDrawStyle.h"
#include "CGroup.h"
#include "CLayer.h"
#include "CPage.h"
#include "CProject.h"
#include "CRectangle.h"
#include "CRelationship.h"
#include "CTransform.h"
Include dependency graph for pages.h:

Classes

struct  rig::PageNavInput
 Pointer + view for pollPageNav - same space as CTransform (design). More...

Enumerations

enum class  rig::PageLayout { Stack , Single , Spread }
 Stacked CPage board - include this header and call; no extra system. More...

Functions

entt::entity rig::pageBoard ()
 Board group pages parent to.
entt::entity rig::currentPage ()
 Page later placeOnPage / sketch shapes parent to, or entt::null.
void rig::setPage (int index)
 Point later placeOnPage / sketch shapes at page index.
void rig::placeOnPage (entt::entity child)
 Parent child to currentPage when one exists.
void rig::pollPageScroll (float wheel, bool uiWantsMouse)
 Wheel over the canvas - pans Y.
void rig::pollPageNav (const PageNavInput &in)
 Pan / zoom / first-fit.
void rig::clearPages ()
 Destroy board / pages / plates this helper created.
void rig::resetPages ()
 Forget board state after the app already destroyed the entities.
void rig::ensureProject (rigkit::MEcs &ecs)
 Find or create the document CProject and bind it to the page board.
void rig::adoptPages (rigkit::MEcs &ecs, const std::vector< entt::entity > &sortedPages)
 Adopt existing document pages onto the page board.
void rig::pages_detail::armSketchPlacement ()
 First call installs sketch placeOnPage; later calls leave a custom hook.

Detailed Description

Page board helpers - make CPage entities and pan / zoom the board.

Header-only over rigComponent POD, so an app includes it and calls; there is no page system to register. PDF emit is rigPdfWrite.

Enumeration Type Documentation

◆ PageLayout

enum class rig::PageLayout
strong

Stacked CPage board - include this header and call; no extra system.

First makePage writes a CProject (or reuses one) and a board group. Later pages sit under the last, centered on the board X. Shapes stay page-local; sketch primitives parent to currentPage(). Call placeOnPage after make*. Board CTransform is the view (pan + zoom). PDF emit is rigPdfWrite.

#include "rig/pages.h"
#include "rig/sketch.h"
rig::makePage(520.f, 380.f);
rig::setFill(0.2f, 0.7f, 1.f);
rig::circle(260.f, 190.f, 40.f);
// update: rig::pollPageNav(nav); // or rig::fitPages();
// view: rig::setPageLayout(rig::PageLayout::Single);
// view: rig::focusPage(0); // pans; also moves currentPage
Page board helpers - make CPage entities and pan / zoom the board.
void setPage(int index)
Point later placeOnPage / sketch shapes at page index.
Definition pages.h:528
Enumerator
Stack 

Pages sit under each other; pan the board to scroll.

Single 

Only the active page is visible.

Spread 

Facing pairs side by side (recto-first: page 0 alone on the right).

Function Documentation

◆ adoptPages()

void rig::adoptPages ( rigkit::MEcs & ecs,
const std::vector< entt::entity > & sortedPages )
inline

Adopt existing document pages onto the page board.

Resets board state, parents sortedPages to the board, and records them as the current sequence. Does not change PageLayout.

◆ clearPages()

void rig::clearPages ( )
inline

Destroy board / pages / plates this helper created.

Keeps a found CProject.

◆ pageBoard()

entt::entity rig::pageBoard ( )
inline

Board group pages parent to.

Created on first makePage.

◆ pollPageNav()

void rig::pollPageNav ( const PageNavInput & in)
inline

Pan / zoom / first-fit.

No-op when in.blocked except for storing the view.

◆ pollPageScroll()

void rig::pollPageScroll ( float wheel,
bool uiWantsMouse )
inline

Wheel over the canvas - pans Y.

Prefer pollPageNav for zoom + pan.

◆ setPage()

void rig::setPage ( int index)
inline

Point later placeOnPage / sketch shapes at page index.

Leaves the board view and activePageIndex alone. Out-of-range index is a no-op. focusPage still pans onto a page and updates this too.