#pragma once #include "Document/EditorSession.h" #include #include #include #include #include #include #include #include // New Canvas sizes in pixels, upright as held. struct CanvasPreset { QString title; int width; int height; // Resolutions, Apple screens, then social formats; the menu divides them. static const std::vector> groups; static const std::vector all; }; // The welcome: a new canvas, a project or an image. class NewCanvasSheet : public QWidget { Q_OBJECT public: NewCanvasSheet(EditorSession &session, std::function onCreate, std::function onOpen, QWidget *parent = nullptr); // A copied picture's size, read from its header alone. static std::optional clipboardDimensions(const QMimeData *clipboard); protected: void showEvent(QShowEvent *event) override; private: void synchronize(); void validate(); void create(); // Checks the preset the fields match, else Custom. void checkPreset(); EditorSession &m_session; const std::function m_onCreate; QLineEdit *const m_width; QLineEdit *const m_height; QLabel *const m_note; QPushButton *const m_create; QToolButton *const m_presets; bool m_suggestedClipboardSize = false; };