2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef ADDFXCONTEXTMENU_H
|
|
|
|
#define ADDFXCONTEXTMENU_H
|
|
|
|
|
|
|
|
#include "tfilepath.h"
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPointF>
|
|
|
|
|
|
|
|
class QMenu;
|
|
|
|
class QActionGroup;
|
|
|
|
class TIStream;
|
|
|
|
class QAction;
|
|
|
|
class TXsheetHandle;
|
|
|
|
class TFxHandle;
|
|
|
|
class FxSelection;
|
|
|
|
class TColumnHandle;
|
|
|
|
class TFrameHandle;
|
|
|
|
class TApplication;
|
|
|
|
|
|
|
|
class PluginInformation;
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
//! Create Insert - Add - Replace menus for the context menu of a
|
|
|
|
//! FxSchematicScene and its items!
|
2016-03-19 06:57:51 +13:00
|
|
|
//! This method is used to create and keep updated the three menus.
|
|
|
|
//! Each menus contains all toonz special effect and effect presets.
|
2016-06-29 18:17:12 +12:00
|
|
|
class AddFxContextMenu 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
|
|
|
QMenu *m_insertMenu, *m_addMenu, *m_replaceMenu;
|
|
|
|
TFilePath m_fxListPath, m_presetPath;
|
|
|
|
QActionGroup *m_insertActionGroup, *m_addActionGroup, *m_replaceActionGroup;
|
|
|
|
TApplication *m_app;
|
|
|
|
FxSelection *m_selection;
|
|
|
|
// in order to add fx at the cursor position
|
|
|
|
QPointF m_currentCursorScenePos;
|
|
|
|
// for reproduce the last added fx
|
|
|
|
QAction *m_againCommand;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
AddFxContextMenu();
|
|
|
|
~AddFxContextMenu();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QMenu *getInsertMenu() { return m_insertMenu; }
|
|
|
|
QMenu *getAddMenu() { return m_addMenu; }
|
|
|
|
QMenu *getReplaceMenu() { return m_replaceMenu; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setApplication(TApplication *app);
|
|
|
|
void setSelection(FxSelection *selection) { m_selection = selection; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setCurrentCursorScenePos(const QPointF &scenePos) {
|
|
|
|
m_currentCursorScenePos = scenePos;
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
enum Commands { Insert = 0x1, Add = 0x2, Replace = 0x4 };
|
|
|
|
QAction *getAgainCommand(int command);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
void fillMenus();
|
|
|
|
void loadFxs();
|
|
|
|
void loadFxGroup(TIStream *is);
|
|
|
|
void loadFx(TIStream *is, QMenu *insertFxGroup, QMenu *addFxGroup,
|
|
|
|
QMenu *replaceFxGroup);
|
|
|
|
bool loadPreset(const std::string &name, QMenu *insertFxGroup,
|
|
|
|
QMenu *addFxGroup, QMenu *replaceFxGroup);
|
|
|
|
void loadMacro();
|
|
|
|
void loadFxPluginGroup();
|
|
|
|
void loadFxPlugins(QMenu *insertFxGroup, QMenu *addFxGroup,
|
|
|
|
QMenu *replaceFxGroup);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void onInsertFx(QAction *);
|
|
|
|
void onAddFx(QAction *);
|
|
|
|
void onReplaceFx(QAction *);
|
|
|
|
void onFxPresetHandled();
|
|
|
|
void onAgainCommand();
|
2016-03-19 06:57:51 +13:00
|
|
|
public slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
void result(PluginInformation *);
|
|
|
|
void fixup();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // ADDFXCONTEXTMENU_H
|