Commit 9eeec7d6 authored by Paul Mendez's avatar Paul Mendez

Animation Tool: Shape Animations Docker

Add a docker to animation tool, intended to alow edition of shape animations. It includes:
- List to display current animations, change order, duration and type of animation
  - Time line view for advanced edition of start time and duration
  - Live preview of animations
- Widget to add new animations
  - Automatic preview of animations (Can be disabled and Stage remembers your preference)
  - Alternative animation preview using hover buttons.
  - Automatic drawing of motion path icons using shape stored on xml description
  - Automatic loading of predefined animations from a xml file (I have added some predefined animations).
- Basic edition of motion path animations (Some predefined motion path animations have been added on the xml file).
- Refactor of KPrAnimateMotion class (class that loads and saves motion paths)
- Data model to store and edit animations of a document.
- Unit test for the animations data model.

My thanks to Thorsten Z. for the review and valuable suggestions

REVIEW: 106093
GUI: animation tool docker for edition of shape animations
parent f996e4fe
......@@ -96,9 +96,9 @@ struct KoPathTool::PathSegment {
KoPathTool::KoPathTool(KoCanvasBase *canvas)
: KoToolBase(canvas)
, m_pointSelection(this)
, m_activeHandle(0)
, m_handleRadius(3)
, m_pointSelection(this)
, m_activeSegment(0)
, m_currentStrategy(0)
{
......
......@@ -109,12 +109,15 @@ private slots:
void pointToCurve();
void activate();
protected:
KoPathToolSelection m_pointSelection; ///< the point selection
QCursor m_selectCursor;
private:
KoPathToolHandle * m_activeHandle; ///< the currently active handle
int m_handleRadius; ///< the radius of the control point handles
uint m_grabSensitivity; ///< the grab sensitivity
KoPathToolSelection m_pointSelection; ///< the point selection
QPointF m_lastPoint; ///< needed for interaction strategy
PathSegment *m_activeSegment;
......@@ -139,7 +142,6 @@ private:
KAction *m_actionJoinSegment;
KAction *m_actionMergePoints;
KAction *m_actionConvertToPath;
QCursor m_selectCursor;
QCursor m_moveCursor;
Q_DECLARE_PRIVATE(KoToolBase)
......
......@@ -38,12 +38,14 @@
/** Space between the item outer rect and the context bar */
const int CONTEXTBAR_MARGIN = 4;
const int MIN_BUTTON_WIDTH = 24;
KoViewItemContextBar::KoViewItemContextBar(QAbstractItemView *parent)
: QObject(parent)
, m_view(parent)
, m_enabled(true)
, m_appliedPointingHandCursor(false)
, m_showToggleButton(true)
{
connect(parent, SIGNAL(entered(const QModelIndex&)),
this, SLOT(slotEntered(const QModelIndex&)));
......@@ -150,12 +152,17 @@ void KoViewItemContextBar::showContextBar(const QRect &rect)
// Center bar in FullContextBar mode, left align in
// SelectionOnlyContextBar mode
const int posX = 0;
const int posY = CONTEXTBAR_MARGIN;
const int posY = CONTEXTBAR_MARGIN / 4;
int numButtons = 0;
m_ContextBar->move(rect.topLeft() + QPoint(posX, posY));
//Hide buttons if item is too small
int width = m_ToggleSelectionButton->width();
if (!m_showToggleButton) {
m_ToggleSelectionButton->setVisible(false);
width = qMin(m_contextBarButtons.at(0)->width(), MIN_BUTTON_WIDTH);
}
for (int i=m_contextBarButtons.size()-1; i>=0; --i) {
if ((rect.width() - 2*CONTEXTBAR_MARGIN) > ((i+1)*m_ToggleSelectionButton->width())) {
if ((rect.width() - 2 * CONTEXTBAR_MARGIN) > ((i + 1) * width)) {
m_contextBarButtons.at(i)->setVisible(true);
numButtons++;
continue;
......@@ -259,6 +266,11 @@ int KoViewItemContextBar::preferredWidth()
return ((m_contextBarButtons.count()+1)*m_ToggleSelectionButton->sizeHint().width() + 2*CONTEXTBAR_MARGIN);
}
void KoViewItemContextBar::setShowSelectionToggleButton(bool enabled)
{
m_showToggleButton = enabled;
}
void KoViewItemContextBar::reset()
{
if (m_ContextBar) {
......
......@@ -59,6 +59,7 @@ public:
QModelIndex currentIndex();
int preferredWidth();
void setShowSelectionToggleButton(bool enabled);
signals:
/** Is emitted if the selection has been changed by the toggle button. */
......@@ -95,6 +96,7 @@ private:
QToolButton *m_ToggleSelectionButton;
QHBoxLayout *m_Layout;
QList <QToolButton*> m_contextBarButtons;
bool m_showToggleButton;
};
#endif // KOVIEWITEMCONTEXTBAR_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment