vectorscope.cpp
colorplaneexport.cpp
colortools.cpp
+ rebuildgroupcommand.cpp
)
add_definitions( ${KDE4_DEFINITIONS} )
#include "configtrackscommand.h"
#include "customtrackview.h"
-#include <KLocale>
ConfigTracksCommand::ConfigTracksCommand(CustomTrackView* view, QList< TrackInfo > oldInfos, QList< TrackInfo > newInfos, QUndoCommand* parent) :
QUndoCommand(parent),
#include <QGraphicsView>
#include <QPointF>
-#include <KDebug>
#include "definitions.h"
class CustomTrackView;
#include "trackdialog.h"
#include "tracksconfigdialog.h"
#include "configtrackscommand.h"
+#include "rebuildgroupcommand.h"
#include <KDebug>
#include <KLocale>
QGraphicsView::mousePressEvent(event);
}
-void CustomTrackView::rebuildGroup(AbstractGroupItem* group)
+void CustomTrackView::rebuildGroup(int childTrack, GenTime childPos)
{
+ const QPointF p((int)childPos.frames(m_document->fps()), childTrack * m_tracksHeight + m_tracksHeight / 2);
+ QList<QGraphicsItem *> list = scene()->items(p);
+ AbstractGroupItem *group = NULL;
+ for (int i = 0; i < list.size(); i++) {
+ if (!list.at(i)->isEnabled()) continue;
+ if (list.at(i)->type() == GROUPWIDGET) {
+ group = static_cast <AbstractGroupItem *>(list.at(i));
+ break;
+ }
+ }
if (group) {
QList <QGraphicsItem *> children = group->childItems();
m_document->clipManager()->removeGroup(group);
}
if (item->parentItem() && item->parentItem() != m_selectionGroup)
- rebuildGroup(static_cast <AbstractGroupItem *>(item->parentItem()));
+ new RebuildGroupCommand(this, item->info().track, item->info().startPos, command);
}
void CustomTrackView::prepareResizeClipEnd(AbstractClipItem* item, ItemInfo oldInfo, int pos, bool check, QUndoCommand *command)
}
}
if (item->parentItem() && item->parentItem() != m_selectionGroup)
- rebuildGroup(static_cast <AbstractGroupItem *>(item->parentItem()));
+ new RebuildGroupCommand(this, item->info().track, item->info().startPos, command);
}
void CustomTrackView::updatePositionEffects(ClipItem * item, ItemInfo info)
void slotSelectTrack(int ix);
void insertZoneOverwrite(QStringList data, int in);
+ /** @brief Rebuilds a group to fit changes to it's childen.
+ * @param childTrack the track of one of the groups children
+ * @param childPos The position of the same child */
+ void rebuildGroup(int childTrack, GenTime childPos);
+
protected:
virtual void drawBackground(QPainter * painter, const QRectF & rect);
//virtual void drawForeground ( QPainter * painter, const QRectF & rect );
bool canBeMoved(QList<AbstractClipItem *> items, GenTime offset, int trackOffset) const;
ClipItem *getClipUnderCursor() const;
AbstractClipItem *getMainActiveClip() const;
- /** @brief Rebuilds @param group to fit changes to it's childen. */
- void rebuildGroup(AbstractGroupItem *group);
void resetSelectionGroup(bool selectItems = true);
void groupSelectedItems(bool force = false, bool createNewGroup = false);
/** Get available space for clip move (min and max free positions) */
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#include "rebuildgroupcommand.h"
+#include "customtrackview.h"
+
+RebuildGroupCommand::RebuildGroupCommand(CustomTrackView* view, int childTrack, GenTime childPos, QUndoCommand* parent) :
+ QUndoCommand(parent),
+ m_view(view),
+ m_childTrack(childTrack),
+ m_childPos(childPos)
+{
+ setText(i18n("Rebuild Group"));
+}
+
+// virtual
+void RebuildGroupCommand::undo()
+{
+ m_view->rebuildGroup(m_childTrack, m_childPos);
+}
+
+// virtual
+void RebuildGroupCommand::redo()
+{
+ m_view->rebuildGroup(m_childTrack, m_childPos);
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef REBUILDGROUPCOMMAND_H
+#define REBUILDGROUPCOMMAND_H
+
+#include <QUndoCommand>
+
+#include "abstractgroupitem.h"
+
+class CustomTrackView;
+
+class RebuildGroupCommand : public QUndoCommand
+{
+public:
+ RebuildGroupCommand(CustomTrackView *view, int childTrack, GenTime childPos, QUndoCommand* parent = 0);
+ virtual void undo();
+ virtual void redo();
+
+private:
+ CustomTrackView *m_view;
+ int m_childTrack;
+ GenTime m_childPos;
+};
+
+#endif