/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "ui/rp_widget.h" #include "editor/photo_editor_common.h" class QGraphicsItem; class QGraphicsView; namespace Editor { struct Controllers; class ItemBase; class Scene; // Paint control. class Paint final : public Ui::RpWidget { public: Paint( not_null parent, PhotoModifications &modifications, const QSize &imageSize, std::shared_ptr controllers); [[nodiscard]] std::shared_ptr saveScene() const; void applyTransform(QRect geometry, int angle, bool flipped); void applyBrush(const Brush &brush); void cancel(); void keepResult(); void updateUndoState(); private: struct SavedItem { std::shared_ptr item; bool undid = false; }; bool hasUndo() const; bool hasRedo() const; void clearRedoList(); bool isItemToRemove(const std::shared_ptr &item) const; bool isItemHidden(const std::shared_ptr &item) const; const std::shared_ptr _lastZ; const std::shared_ptr _scene; const base::unique_qptr _view; const QSize _imageSize; struct { int angle = 0; bool flipped = false; rpl::variable zoom = 0.; } _transform; std::vector _previousItems; std::vector> _itemsToRemove; rpl::variable _hasUndo = true; rpl::variable _hasRedo = true; }; } // namespace Editor