File indexing completed on 2024-05-19 04:24:57
0001 /* This file is part of the KDE project 0002 0003 SPDX-FileCopyrightText: 2006-2008 Thorsten Zachmann <zachmann@kde.org> 0004 SPDX-FileCopyrightText: 2006-2010 Thomas Zander <zander@kde.org> 0005 SPDX-FileCopyrightText: 2009-2010 Jan Hambrecht <jaham@gmx.net> 0006 0007 SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 #ifndef KoShapeManager_p_h 0010 #define KoShapeManager_p_h 0011 0012 #include "KoSelection.h" 0013 #include "KoShape.h" 0014 #include "KoShape_p.h" 0015 #include "KoShapeContainer.h" 0016 #include "KoShapeManager.h" 0017 #include <KoRTree.h> 0018 #include <QMutex> 0019 #include "kis_thread_safe_signal_compressor.h" 0020 0021 class KoCanvasBase; 0022 class KoShapeGroup; 0023 class QPainter; 0024 0025 class Q_DECL_HIDDEN KoShapeManager::Private 0026 { 0027 public: 0028 Private(KoShapeManager *shapeManager, KoCanvasBase *c) 0029 : selection(new KoSelection(shapeManager)), 0030 canvas(c), 0031 tree(4, 2), 0032 q(shapeManager), 0033 shapeInterface(shapeManager) 0034 { 0035 } 0036 0037 ~Private() { 0038 delete selection; 0039 } 0040 0041 /** 0042 * Update the tree when there are shapes in m_aggregate4update. This is done so not all 0043 * updates to the tree are done when they are asked for but when they are needed. 0044 */ 0045 void updateTree(); 0046 0047 void forwardCompressedUpdate(); 0048 0049 0050 /** 0051 * Recursively detach the shapes from this shape manager 0052 */ 0053 void unlinkFromShapesRecursively(const QList<KoShape *> &shapes); 0054 0055 QList<KoShape *> shapes; 0056 KoSelection *selection; 0057 KoCanvasBase *canvas; 0058 KoRTree<KoShape *> tree; 0059 QSet<KoShape *> aggregate4update; 0060 QHash<KoShape*, int> shapeIndexesBeforeUpdate; 0061 KoShapeManager *q; 0062 KoShapeManager::ShapeInterface shapeInterface; 0063 QMutex shapesMutex; 0064 QMutex treeMutex; 0065 0066 QRectF compressedUpdate; 0067 QSet<const KoShape*> compressedUpdatedShapes; 0068 0069 bool updatesBlocked = false; 0070 }; 0071 0072 #endif