kis_layer_box.h 3.77 KB
Newer Older
1 2 3 4 5
/*
 *  kis_layer_box.h - part of Krita aka Krayon aka KimageShop
 *
 *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
 *  Copyright (C) 2006 Gábor Lehel <illissius@gmail.com>
6 7
 *  Copyright (C) 2007 Thomas Zander <zander@kde.org>
 *  Copyright (C) 2007 Boudewijn Rempt <boud@valdyas.org>
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef KIS_LAYERBOX_H
#define KIS_LAYERBOX_H

#include <QFrame>
#include <QList>
#include <QDockWidget>

31
#include <kis_debug.h>
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

#include <KoColorSpace.h>
#include <KoDockFactory.h>

#include <kis_types.h>

#include "kis_view2.h"

class QModelIndex;

typedef QList<QModelIndex> QModelIndexList;

class KMenu;
class KoCompositeOp;
class KisNodeModel;
class KisLayerManager;
48
class Ui_WdgLayerBox;
49 50 51

/**
 * A widget that visualized the layer structure.
52
 *
53
 */
54
class KisLayerBox : public QDockWidget {
55 56 57 58 59 60 61 62

    Q_OBJECT

public:
    KisLayerBox();
    virtual ~KisLayerBox();

    void setUpdatesAndSignalsEnabled(bool enable);
63
    void setImage(KisNodeManager * nodeManager, KisImageSP image, KisNodeModel * nodeModel);
64 65 66 67

    virtual bool eventFilter(QObject *object, QEvent *event);

public slots:
68

69 70
    void slotSetCompositeOp(const KoCompositeOp* compositeOp);
    void slotSetOpacity(double opacity);
71
    void slotFillCompositeOps(const KoColorSpace * colorSpace);
72
    void updateUI();
73
    void setCurrentNode( KisNodeSP node );
Halla Rempt's avatar
Halla Rempt committed
74

75 76
signals:

77 78
    // XXX: create a node factory and a node factory registry in for now just
    //      use strings
79
    void sigRequestNewNode( const QString & nodetype);
80
    void sigRequestNodeProperties(KisNodeSP node);
81
    void sigOpacityChanged(qreal opacity, bool final);
82 83 84
    void sigItemComposite(const KoCompositeOp*);

private slots:
85

86 87 88 89 90 91 92 93 94 95
    void slotContextMenuRequested( const QPoint &pos, const QModelIndex &index );

    void slotMinimalView();
    void slotDetailedView();
    void slotThumbnailView();

    void slotRmClicked();
    void slotRaiseClicked();
    void slotLowerClicked();
    void slotPropertiesClicked();
96 97
    void slotDuplicateClicked();
    
98
    void slotNewPaintLayer();
99 100
    void slotNewGroupLayer();
    void slotNewAdjustmentLayer();
Halla Rempt's avatar
Halla Rempt committed
101
    void slotNewGeneratorLayer();
102 103
    void slotNewCloneLayer();
    void slotNewShapeLayer();
104 105 106
    void slotNewTransparencyMask();
    void slotNewEffectMask();
    void slotNewTransformationMask();
107
    void slotNewSelectionMask();
108

109
    void slotNodeActivated( const QModelIndex & );
110 111

private:
112
    QModelIndexList selectedNodes() const;
113 114 115 116 117

    KMenu *m_viewModeMenu;
    KMenu *m_newLayerMenu;
    KisImageSP m_image;
    KisNodeModel * m_nodeModel;
118
    KisNodeManager * m_nodeManager;
119
    Ui_WdgLayerBox* m_wdgLayerBox;
120

121 122 123 124 125 126 127 128 129 130
};

class KisLayerBoxFactory : public KoDockFactory
{

public:
    KisLayerBoxFactory() { }

    virtual QString id() const
        {
131
            return QString( "KisLayerBox" );
132 133 134 135 136 137 138 139 140 141
        }

    virtual QDockWidget* createDockWidget()
        {
            KisLayerBox * dockWidget = new KisLayerBox();

            dockWidget->setObjectName(id());

            return dockWidget;
        }
142 143 144 145 146
        
    DockPosition defaultDockPosition() const
    {
        return DockRight;
    }        
147 148 149 150 151 152
};



#endif // KIS_LAYERBOX_H