tahoma2d/toonz/sources/include/toonz/palettecontroller.h

109 lines
3.3 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef PALETTECONTROLLER_INCLUDED
#define PALETTECONTROLLER_INCLUDED
// TnzCore includes
#include "tcommon.h"
#include "tpixel.h"
// Qt includes
#include <QObject>
#undef DVAPI
#undef DVVAR
#ifdef TOONZLIB_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//=====================================================
// Forward declarations
class TPaletteHandle;
//=====================================================
//************************************************************************
// PaletteController declaration
//************************************************************************
2016-06-15 18:43:10 +12:00
class DVAPI PaletteController : public QObject {
Q_OBJECT
TPaletteHandle *m_currentLevelPalette; //!< (\p owned) Handle to the palette
//!of current level.
TPaletteHandle *m_currentCleanupPalette; //!< (\p owned) Handle to the
//!palette of current cleanup
//!settings.
TPaletteHandle *m_currentPalette; //!< (\p owned) Handle to the palette of
//!currently selected object.
TPaletteHandle *m_originalCurrentPalette; //!< Pointer to the \a original
//!current palette handle specified
//!on
//! the last setCurrentPalette() invocation.
TPixel32 m_colorSample;
bool m_colorAutoApplyEnabled;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
PaletteController();
~PaletteController();
TPaletteHandle *getCurrentLevelPalette() const {
return m_currentLevelPalette;
}
TPaletteHandle *getCurrentCleanupPalette() const {
return m_currentCleanupPalette;
}
TPaletteHandle *getCurrentPalette() const { return m_currentPalette; }
void setCurrentPalette(TPaletteHandle *paletteHandle);
// centralized handling of color auto-apply. see StyleEditor.
// when ColorAutoApply is disabled then changes should made on the ColorSample
// instead than on the current style. (see rgb color picker)
void enableColorAutoApply(bool enabled);
bool isColorAutoApplyEnabled() const { return m_colorAutoApplyEnabled; }
void setColorSample(const TPixel32 &color);
TPixel32 getColorSample() const { return m_colorSample; }
// used for "passive pick" feature in the tool options bar of the rgb picker
// tool
void notifyColorPassivePicked(const QColor &col) {
emit colorPassivePicked(col);
}
// used for "passive pick" feature in the tool options bar of the style picker
// tool
void notifyStylePassivePicked(const int ink, const int paint,
const int tone) {
emit stylePassivePicked(ink, paint, tone);
}
2016-03-19 06:57:51 +13:00
public slots:
2016-06-15 18:43:10 +12:00
void editLevelPalette();
void editCleanupPalette();
// void setColorCheckIndex();// sets the index to be used to perform the
// inkCheck and paintcheck;
2016-03-19 06:57:51 +13:00
signals:
2016-06-15 18:43:10 +12:00
void colorAutoApplyEnabled(bool enabled);
void colorSampleChanged(const TPixel32 &);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// used for "passive pick" feature in the tool options bar of the rgb picker
// tool
void colorPassivePicked(const QColor &);
// used for "passive pick" feature in the tool options bar of the style picker
// tool
void stylePassivePicked(const int, const int, const int);
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
#endif // PALETTECONTROLLER_INCLUDED