2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef TPALETTEHANDLE_H
|
|
|
|
#define TPALETTEHANDLE_H
|
|
|
|
|
|
|
|
// TnzCore includes
|
|
|
|
#include "tcommon.h"
|
|
|
|
#include "tpalette.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
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// TPaletteHandle
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI TPaletteHandle final : public QObject {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TPalette *m_palette;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int m_styleIndex;
|
|
|
|
int m_styleParamIndex;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TPaletteHandle();
|
|
|
|
~TPaletteHandle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TPalette *getPalette() const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int getStyleIndex() const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int getStyleParamIndex() const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TColorStyle *getStyle() const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setPalette(TPalette *palette, int styleIndex = 1);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setStyleIndex(int index);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setStyleParamIndex(int index);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
void notifyPaletteSwitched() { emit paletteSwitched(); }
|
|
|
|
void notifyPaletteChanged();
|
|
|
|
void notifyPaletteTitleChanged();
|
|
|
|
void notifyColorStyleSwitched();
|
|
|
|
// unchange the dirty flag when undo operation
|
|
|
|
void notifyColorStyleChanged(bool onDragging = true,
|
|
|
|
bool setDirtyFlag = true);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void notifyPaletteDirtyFlagChanged() { emit paletteDirtyFlagChanged(); }
|
|
|
|
void notifyPaletteLockChanged() { emit paletteLockChanged(); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
|
|
|
signals:
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void paletteSwitched();
|
|
|
|
void paletteChanged();
|
|
|
|
void paletteTitleChanged();
|
|
|
|
void colorStyleSwitched();
|
|
|
|
void colorStyleChanged();
|
|
|
|
void colorStyleChangedOnMouseRelease();
|
|
|
|
void paletteDirtyFlagChanged();
|
|
|
|
void paletteLockChanged();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
friend class PaletteController;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
bool connectBroadcasts(const QObject *receiver);
|
|
|
|
bool disconnectBroadcasts(const QObject *receiver);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
|
|
|
signals:
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Internal broadcaster signals to multiple palette handles.
|
|
|
|
// Do not connect to user code.
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void broadcastPaletteChanged();
|
|
|
|
void broadcastPaletteTitleChanged();
|
|
|
|
void broadcastColorStyleSwitched();
|
|
|
|
void broadcastColorStyleChanged();
|
|
|
|
void broadcastColorStyleChangedOnMouseRelease();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // TPALETTEHANDLE_H
|