krita/ui

kis_canvas_resource_provider.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (c) 2006 Boudewijn Rempt  <boud@valdyas.org>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef KIS_CANVAS_RESOURCE_PROVIDER_H_
00020 #define KIS_CANVAS_RESOURCE_PROVIDER_H_
00021 
00022 #include <QObject>
00023 
00024 #include <KoColor.h>
00025 #include <KoID.h>
00026 #include <KoCanvasResourceProvider.h>
00027 
00028 #include "kis_types.h"
00029 #include "krita_export.h"
00030 
00031 class KisView2;
00032 class KoAbstractGradient;
00033 class KisPattern;
00034 class KoResource;
00035 class KoCanvasBase;
00036 class KisFilterConfiguration;
00037 
00042 class KRITAUI_EXPORT KisCanvasResourceProvider : public QObject
00043 {
00044 
00045     Q_OBJECT
00046 
00047 public:
00048 
00049     enum Resources {
00050         HdrExposure = KoCanvasResource::KritaStart + 1,
00051         CurrentPattern,
00052         CurrentGradient,
00053         CurrentDisplayProfile,
00054         CurrentImage,
00055         CurrentKritaNode,
00056         CurrentPaintOpPreset,
00057         CurrentGeneratorConfiguration
00058     };
00059 
00060 
00061     KisCanvasResourceProvider(KisView2 * view);
00062     ~KisCanvasResourceProvider();
00063 
00064     void setCanvasResourceProvider(KoCanvasResourceProvider * resourceProvider);
00065 
00066     KoCanvasBase * canvas() const;
00067 
00068     KoColor bgColor() const;
00069     void setBGColor(const KoColor& c);
00070 
00071     KoColor fgColor() const;
00072     void setFGColor(const KoColor& c);
00073 
00074     float HDRExposure() const;
00075     void setHDRExposure(float exposure);
00076 
00077     KisPattern *currentPattern() const;
00078 
00079     KoAbstractGradient *currentGradient() const;
00080 
00081     void resetDisplayProfile();
00082     const KoColorProfile * currentDisplayProfile() const;
00083 
00084     KisImageWSP currentImage() const;
00085 
00086     KisNodeSP currentNode() const;
00087 
00088     KisPaintOpPresetSP currentPreset() const;
00089 
00090     KisFilterConfiguration * currentGeneratorConfiguration() const;
00091 
00092 public slots:
00093 
00094     void slotSetFGColor(const KoColor& c);
00095     void slotSetBGColor(const KoColor& c);
00096     void slotPatternActivated(KoResource *pattern);
00097     void slotGradientActivated(KoResource *gradient);
00098     void slotPaintOpPresetActivated(const KisPaintOpPresetSP preset);
00099     void slotNodeActivated(const KisNodeSP node);
00100     void slotGeneratorConfigurationActivated(KisFilterConfiguration * generatorConfiguration);
00101 
00106     void slotImageSizeChanged();
00107     void slotSetDisplayProfile(const KoColorProfile * profile);
00108 
00109 private slots:
00110 
00111     void slotResourceChanged(int key, const QVariant & res);
00112 
00113 signals:
00114 
00115     void sigFGColorChanged(const KoColor &);
00116     void sigBGColorChanged(const KoColor &);
00117     void sigGradientChanged(KoAbstractGradient *);
00118     void sigPatternChanged(KisPattern *);
00119     void sigPaintOpPresetChanged(KisPaintOpPresetSP preset);
00120     void sigNodeChanged(const KisNodeSP);
00121     void sigDisplayProfileChanged(const KoColorProfile *);
00122     void sigGeneratorConfigurationChanged(KisFilterConfiguration * generatorConfiguration);
00123 
00124 private:
00125 
00126     KisView2 * m_view;
00127     KoCanvasResourceProvider * m_resourceProvider;
00128     const KoColorProfile * m_displayProfile;
00129 
00130 };
00131 
00132 #endif