2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef TOOLEHANDLE_H
|
|
|
|
#define TOOLEHANDLE_H
|
|
|
|
|
|
|
|
#include "tcommon.h"
|
|
|
|
#include "timage.h"
|
|
|
|
#include <QObject>
|
|
|
|
#include <QMap>
|
|
|
|
#include <QTime>
|
|
|
|
|
|
|
|
// forward declaration
|
|
|
|
class TTool;
|
|
|
|
class QAction;
|
|
|
|
class QString;
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TNZTOOLS_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// ToolHandle
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI ToolHandle final : public QObject {
|
2016-06-15 18:43:10 +12:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
TTool *m_tool;
|
|
|
|
QString m_toolName;
|
|
|
|
int m_toolTargetType;
|
|
|
|
QString m_storedToolName;
|
|
|
|
QTime m_storedToolTime;
|
|
|
|
QString m_oldToolName;
|
|
|
|
bool m_toolIsBusy;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ToolHandle();
|
|
|
|
~ToolHandle();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TTool *getTool() const;
|
|
|
|
void setTool(TTool *tool);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setTool(QString name);
|
|
|
|
void setTargetType(int targetType);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// used to change tool for a short while (e.g. while keeping pressed a
|
|
|
|
// short-key)
|
|
|
|
void storeTool();
|
|
|
|
void restoreTool();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// used to set a tool that is not listed in the toolbar (e.g. the
|
|
|
|
// ShiftTraceTool).
|
|
|
|
void setPseudoTool(QString name);
|
|
|
|
void unsetPseudoTool();
|
|
|
|
void setToolBusy(bool value);
|
|
|
|
bool isToolBusy() { return m_toolIsBusy; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
/*! Notify tool parameters change (out of toolOption bar).*/
|
|
|
|
void notifyToolChanged() { emit toolChanged(); }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void notifyToolCursorTypeChanged() { emit toolCursorTypeChanged(); }
|
2018-08-06 18:46:52 +12:00
|
|
|
|
|
|
|
void notifyToolComboBoxListChanged(std::string id) {
|
|
|
|
emit toolComboBoxListChanged(id);
|
|
|
|
}
|
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
signals:
|
2018-08-06 18:46:52 +12:00
|
|
|
void toolComboBoxListChanged(std::string);
|
2016-06-15 18:43:10 +12:00
|
|
|
void toolSwitched();
|
|
|
|
void toolChanged();
|
|
|
|
void toolEditingFinished();
|
|
|
|
// used for changing the tool cursor when the options changed with short cut
|
|
|
|
// keys assigned for tool options.
|
|
|
|
void toolCursorTypeChanged();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public slots:
|
2016-06-15 18:43:10 +12:00
|
|
|
// void changeTool(QAction* action);
|
|
|
|
void onImageChanged(TImage::Type type);
|
|
|
|
void updateMatrix();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // TOOLEHANDLE_H
|