2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef FRAMENVIGATOR_H
|
|
|
|
#define FRAMENVIGATOR_H
|
|
|
|
|
|
|
|
// TnzCore includes
|
|
|
|
#include "tcommon.h"
|
|
|
|
|
|
|
|
// TnzQt includes
|
|
|
|
#include "toonzqt/intfield.h"
|
|
|
|
|
|
|
|
// Qt includes
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QToolBar>
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TOONZQT_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 TFrameHandle;
|
|
|
|
|
|
|
|
//======================================================
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// KeyframeNavigator declaration
|
|
|
|
//*****************************************************************************
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief The FrameNavigator is a simple toolbar widget showing a numerical
|
|
|
|
representation of an integer timeline.
|
|
|
|
|
|
|
|
\details A FrameNavigator is a TFrameHandle viewer composed of a line edit
|
|
|
|
widget showing the current frame number, and a pair of directional
|
|
|
|
arrow buttons that move to adjacent frames.
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
\remark The text field actually visualizes the internal integer \p m_frame
|
|
|
|
\a +1
|
2016-03-19 06:57:51 +13:00
|
|
|
(e.g. when \p m_frame is 0 then 1 is visualized).
|
|
|
|
*/
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI FrameNavigator final : public QToolBar {
|
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
|
|
|
TFrameHandle *m_frameHandle;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int m_frame;
|
|
|
|
DVGui::IntLineEdit *m_lineEdit;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
FrameNavigator(QWidget *parent = 0);
|
|
|
|
~FrameNavigator() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int getFrame() const { return m_frame; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setFrameHandle(TFrameHandle *); //!< Attaches the navigator to the
|
2016-06-20 14:23:05 +12:00
|
|
|
//! specified frameHandle.
|
2016-06-15 18:43:10 +12:00
|
|
|
//! \remark Detaches from any previously attached frame handle.
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
bool anyWidgetHasFocus();
|
2016-03-19 06:57:51 +13:00
|
|
|
signals:
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void frameSwitched();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setFrame(
|
|
|
|
int frame,
|
|
|
|
bool notifyFrameHandler); //!< Sets the navigator's current frame.
|
|
|
|
//! \deprecated Remove the bool.
|
|
|
|
void prevFrame() {
|
|
|
|
setFrame(m_frame - 1, true);
|
|
|
|
} //!< Move to previous frame.
|
|
|
|
void nextFrame() { setFrame(m_frame + 1, true); } //!< Move to next frame.
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-19 20:06:29 +12:00
|
|
|
void showEvent(QShowEvent *) override;
|
|
|
|
void hideEvent(QHideEvent *) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void updateFrame(int frame); //!< Changes frame without emitting any signal
|
2016-06-20 14:23:05 +12:00
|
|
|
//! and notifying the frameHandle.
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
/*!
|
|
|
|
\details Copies the value in the frame's line edit widget to the internal
|
|
|
|
current frame value.
|
|
|
|
*/
|
|
|
|
void onEditingFinished(); //!< Slot invoked whenever current frame's text
|
2016-06-20 14:23:05 +12:00
|
|
|
//! editing is finished.
|
2016-06-15 18:43:10 +12:00
|
|
|
void onFrameSwitched();
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // FRAMENVIGATORTOOLBAR_H
|