feat: add A4 page option to Word Processor

This commit is contained in:
2026-04-12 18:48:06 +02:00
parent 01546806f0
commit a7499c57c9
4 changed files with 190 additions and 18 deletions
@@ -28,6 +28,17 @@ static constexpr int WP_PATHBAR_H = 32;
static constexpr int WP_STATUS_H = 24;
static constexpr int WP_SCROLLBAR_W = 12;
static constexpr int WP_MARGIN = 16;
// A4 page dimensions at 96 DPI screen resolution (210mm x 297mm = 8.27" x 11.69")
static constexpr int WP_A4_PAGE_W = 794; // 8.27" * 96 DPI
static constexpr int WP_A4_PAGE_H = 1122; // 11.69" * 96 DPI
static constexpr int WP_A4_MARGIN_X = 96; // 1 inch = 96px margins (same as print)
static constexpr int WP_A4_MARGIN_Y = 96;
// Content width inside A4 page (794 - 96*2 - 16*2 = 570... but we use WP_A4 margins internally)
// A4 text area = WP_A4_PAGE_W - WP_A4_MARGIN_X * 2 = 794 - 192 = 602
static constexpr int WP_A4_CONTENT_W = 602;
// Vertical page offset from top of edit area (page top at edit_y + WP_PAGE_TOP_MARGIN)
static constexpr int WP_PAGE_TOP_MARGIN = 20;
static constexpr int WP_PAGE_SHADOW_OFFSET = 6;
static constexpr int WP_MAX_RUNS = 1024;
static constexpr int WP_MAX_TEXT = 262144;
static constexpr int WP_MAX_WRAP_LINES = 4096;
@@ -64,6 +75,7 @@ static constexpr int WP_LINE_DD_X = 586;
static constexpr int WP_LINE_DD_W = 48;
static constexpr int WP_BTN_DIVIDER_X = 642;
static constexpr int WP_BTN_SECTION_X = 674;
static constexpr int WP_BTN_PAGEVIEW_X = 712;
static constexpr int WP_DIVIDER_ROW_H = 24;
static constexpr int WP_DIVIDER_FLYOUT_W = 216;
static constexpr int WP_SPECIAL_CHAR_ROW_H = 24;
@@ -358,6 +370,8 @@ struct WordProcessorState {
bool line_spacing_dropdown_open;
bool divider_flyout_open;
bool special_char_flyout_open;
bool page_view_mode;
bool pending_page_view_toggle;
UndoSnapshot undo[WP_UNDO_MAX];
int undo_count;