Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef ADDFXCONTEXTMENU_H
Toshihiro Shimizu 890ddd
#define ADDFXCONTEXTMENU_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
#include <qobject></qobject>
Toshihiro Shimizu 890ddd
#include <qpointf></qpointf>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class QMenu;
Toshihiro Shimizu 890ddd
class QActionGroup;
Toshihiro Shimizu 890ddd
class TIStream;
Toshihiro Shimizu 890ddd
class QAction;
Toshihiro Shimizu 890ddd
class TXsheetHandle;
Toshihiro Shimizu 890ddd
class TFxHandle;
Toshihiro Shimizu 890ddd
class FxSelection;
Toshihiro Shimizu 890ddd
class TColumnHandle;
Toshihiro Shimizu 890ddd
class TFrameHandle;
Toshihiro Shimizu 890ddd
class TApplication;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class PluginInformation;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Create Insert - Add - Replace menus for the context menu of a
Shinya Kitaoka 120a6e
//! FxSchematicScene and its items!
Toshihiro Shimizu 890ddd
//! This method is used to create and keep updated the three menus.
Toshihiro Shimizu 890ddd
//! Each menus contains all toonz special effect and effect presets.
Shinya Kitaoka 120a6e
class AddFxContextMenu : public QObject {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QMenu *m_insertMenu, *m_addMenu, *m_replaceMenu;
Shinya Kitaoka 120a6e
  TFilePath m_fxListPath, m_presetPath;
Shinya Kitaoka 120a6e
  QActionGroup *m_insertActionGroup, *m_addActionGroup, *m_replaceActionGroup;
Shinya Kitaoka 120a6e
  TApplication *m_app;
Shinya Kitaoka 120a6e
  FxSelection *m_selection;
Shinya Kitaoka 120a6e
  // in order to add fx at the cursor position
Shinya Kitaoka 120a6e
  QPointF m_currentCursorScenePos;
Shinya Kitaoka 120a6e
  // for reproduce the last added fx
Shinya Kitaoka 120a6e
  QAction *m_againCommand;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  AddFxContextMenu();
Shinya Kitaoka 120a6e
  ~AddFxContextMenu();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QMenu *getInsertMenu() { return m_insertMenu; }
Shinya Kitaoka 120a6e
  QMenu *getAddMenu() { return m_addMenu; }
Shinya Kitaoka 120a6e
  QMenu *getReplaceMenu() { return m_replaceMenu; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setApplication(TApplication *app);
Shinya Kitaoka 120a6e
  void setSelection(FxSelection *selection) { m_selection = selection; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setCurrentCursorScenePos(const QPointF &scenePos) {
Shinya Kitaoka 120a6e
    m_currentCursorScenePos = scenePos;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  enum Commands { Insert = 0x1, Add = 0x2, Replace = 0x4 };
Shinya Kitaoka 120a6e
  QAction *getAgainCommand(int command);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  void fillMenus();
Shinya Kitaoka 120a6e
  void loadFxs();
Shinya Kitaoka 120a6e
  void loadFxGroup(TIStream *is);
Shinya Kitaoka 120a6e
  void loadFx(TIStream *is, QMenu *insertFxGroup, QMenu *addFxGroup,
Shinya Kitaoka 120a6e
              QMenu *replaceFxGroup);
Shinya Kitaoka 120a6e
  bool loadPreset(const std::string &name, QMenu *insertFxGroup,
Shinya Kitaoka 120a6e
                  QMenu *addFxGroup, QMenu *replaceFxGroup);
Shinya Kitaoka 120a6e
  void loadMacro();
Shinya Kitaoka 120a6e
  void loadFxPluginGroup();
Shinya Kitaoka 120a6e
  void loadFxPlugins(QMenu *insertFxGroup, QMenu *addFxGroup,
Shinya Kitaoka 120a6e
                     QMenu *replaceFxGroup);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private slots:
Shinya Kitaoka 120a6e
  void onInsertFx(QAction *);
Shinya Kitaoka 120a6e
  void onAddFx(QAction *);
Shinya Kitaoka 120a6e
  void onReplaceFx(QAction *);
Shinya Kitaoka 120a6e
  void onFxPresetHandled();
Shinya Kitaoka 120a6e
  void onAgainCommand();
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void result(PluginInformation *);
Shinya Kitaoka 120a6e
  void fixup();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // ADDFXCONTEXTMENU_H