Revision: 9833
http://rosegarden.svn.sourceforge.net/rosegarden/?rev=9833&view=rev
Author: cannam
Date: 2009-01-30 12:54:49 +0000 (Fri, 30 Jan 2009)
Log Message:
-----------
* First part of updating the matrix to use graphics view classes as
well. Now the matrix and notation are both just as broken! Hooray.
Modified Paths:
--------------
branches/qt4-graphicsview/src/base/ViewSegment.cpp
branches/qt4-graphicsview/src/gui/application/RosegardenGUIView.cpp
branches/qt4-graphicsview/src/gui/application/RosegardenGUIView.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixCanvasView.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixCanvasView.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixElement.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixElement.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixEraser.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixEraser.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMover.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMover.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixPainter.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixPainter.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixResizer.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixResizer.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixSelector.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixSelector.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixStaff.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixStaff.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixTool.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixTool.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixToolBox.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixToolBox.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixView.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixView.h
branches/qt4-graphicsview/src/gui/editors/matrix/PianoKeyboard.cpp
branches/qt4-graphicsview/src/gui/editors/notation/NotationScene.h
branches/qt4-graphicsview/src/gui/editors/notation/NotationStaff.h
branches/qt4-graphicsview/src/gui/editors/notation/NotationTool.cpp
branches/qt4-graphicsview/src/gui/editors/notation/NotationWidget.cpp
branches/qt4-graphicsview/src/gui/rulers/PercussionPitchRuler.cpp
Added Paths:
-----------
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMouseEvent.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixScene.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixScene.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixViewSegment.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixViewSegment.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixWidget.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixWidget.h
branches/qt4-graphicsview/src/gui/editors/matrix/NewMatrixView.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/NewMatrixView.h
Removed Paths:
-------------
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixHLayout.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixHLayout.h
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixVLayout.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/MatrixVLayout.h
branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixDiamond.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixDiamond.h
branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixRectangle.cpp
branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixRectangle.h
Modified: branches/qt4-graphicsview/src/base/ViewSegment.cpp
===================================================================
--- branches/qt4-graphicsview/src/base/ViewSegment.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/base/ViewSegment.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -40,7 +40,7 @@
ViewElementList *
ViewSegment::getViewElementList(Segment::iterator from,
- Segment::iterator to)
+ Segment::iterator to)
{
if (!m_viewElementList) {
Modified: branches/qt4-graphicsview/src/gui/application/RosegardenGUIView.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/application/RosegardenGUIView.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/application/RosegardenGUIView.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -52,6 +52,7 @@
#include "gui/dialogs/TempoDialog.h"
#include "gui/editors/eventlist/EventView.h"
#include "gui/editors/matrix/MatrixView.h"
+#include "gui/editors/matrix/NewMatrixView.h"
#include "gui/editors/notation/NotationView.h"
#include "gui/editors/notation/NewNotationView.h"
#include "gui/editors/parameters/InstrumentParameterBox.h"
@@ -635,7 +636,7 @@
i != segmentsToEdit.end(); ++i) {
std::vector<Segment *> tmpvec;
tmpvec.push_back(*i);
- MatrixView *view = createMatrixView(tmpvec, false);
+ NewMatrixView *view = createMatrixView(tmpvec, false);
if (view) {
view->show();
if (++count == maxEditorsToOpen)
@@ -651,7 +652,7 @@
i != segmentsToEdit.end(); ++i) {
std::vector<Segment *> tmpvec;
tmpvec.push_back(*i);
- MatrixView *view = createMatrixView(tmpvec, true);
+ NewMatrixView *view = createMatrixView(tmpvec, true);
if (view) {
view->show();
if (++count == maxEditorsToOpen)
@@ -660,13 +661,13 @@
}
}
-MatrixView *
+NewMatrixView *
RosegardenGUIView::createMatrixView(std::vector<Segment *> segmentsToEdit, bool drumMode)
{
- MatrixView *matrixView = new MatrixView(getDocument(),
- segmentsToEdit,
- this,
- drumMode);
+ NewMatrixView *matrixView = new NewMatrixView(getDocument(),
+ segmentsToEdit,
+ drumMode,
+ this);
// For tempo changes (ugh -- it'd be nicer to make a tempo change
// command that could interpret all this stuff from the dialog)
@@ -749,8 +750,8 @@
// + m_trackEditor->getCompositionView()->visibleWidth() / 2);
timeT centerSegmentView = m_trackEditor->getRulerScale()->getTimeForX(centerX);
// then scroll the notation view to that time, "localized" for the current segment
- matrixView->scrollToTime(centerSegmentView);
- matrixView->updateView();
+//!!! matrixView->scrollToTime(centerSegmentView);
+//!!! matrixView->updateView();
}
return matrixView;
Modified: branches/qt4-graphicsview/src/gui/application/RosegardenGUIView.h
===================================================================
--- branches/qt4-graphicsview/src/gui/application/RosegardenGUIView.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/application/RosegardenGUIView.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,4 +1,3 @@
-
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
@@ -48,7 +47,7 @@
class RosegardenGUIDoc;
class RealTime;
class NotationView;
-class MatrixView;
+class NewMatrixView;
class MappedEvent;
class InstrumentParameterBox;
class EventView;
@@ -316,7 +315,7 @@
protected:
NotationView *createNotationView(std::vector<Segment *>);
- MatrixView *createMatrixView (std::vector<Segment *>, bool drumMode);
+ NewMatrixView *createMatrixView (std::vector<Segment *>, bool drumMode);
EventView *createEventView (std::vector<Segment *>);
virtual void windowActivationChange(bool);
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixCanvasView.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixCanvasView.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixCanvasView.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -15,6 +15,7 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
#include <Q3Canvas>
#include <Q3CanvasItem>
@@ -299,3 +300,4 @@
}
#include "MatrixCanvasView.moc"
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixCanvasView.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixCanvasView.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixCanvasView.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,4 +1,3 @@
-
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
@@ -15,6 +14,7 @@
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
#ifndef _RG_MATRIXCANVASVIEW_H_
#define _RG_MATRIXCANVASVIEW_H_
@@ -155,3 +155,4 @@
}
#endif
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixElement.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixElement.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixElement.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -16,140 +16,100 @@
*/
-#include <Q3Canvas>
-#include <Q3CanvasItemList>
-#include <Q3CanvasRectangle>
#include "MatrixElement.h"
+#include "MatrixScene.h"
#include "misc/Debug.h"
+#include <QGraphicsRectItem>
+#include <QGraphicsPolygonItem>
+#include <QBrush>
+#include <QColor>
+
#include "base/Event.h"
#include "base/NotationTypes.h"
-#include "base/ViewElement.h"
+#include "base/BaseProperties.h"
#include "gui/general/GUIPalette.h"
-#include "QCanvasMatrixDiamond.h"
-#include "QCanvasMatrixRectangle.h"
-#include <QBrush>
-#include <Q3Canvas>
-#include <QColor>
+#include "gui/rulers/DefaultVelocityColour.h"
namespace Rosegarden
{
-MatrixElement::MatrixElement(Event *event, bool drum) :
- ViewElement(event),
- m_canvasRect(drum ?
- new QCanvasMatrixDiamond(*this, 0) :
- new QCanvasMatrixRectangle(*this, 0)),
- m_overlapRectangles(NULL)
-{
- // MATRIX_DEBUG << "new MatrixElement "
- // << this << " wrapping " << event << endl;
-}
+static const int MatrixElementData = 2;
-MatrixElement::~MatrixElement()
+MatrixElement::MatrixElement(MatrixScene *scene, Event *event,
+ bool drum, int resolution) :
+ ViewElement(event),
+ m_item(0)
{
- // MATRIX_DEBUG << "MatrixElement " << this << "::~MatrixElement() wrapping "
- // << event() << endl;
+ timeT time = event->getAbsoluteTime();
+ timeT duration = event->getDuration();
- m_canvasRect->hide();
- delete m_canvasRect;
+ long pitch = 60;
+ event->get<Int>(BaseProperties::PITCH, pitch);
- removeOverlapRectangles();
-}
+ long velocity = 100;
+ event->get<Int>(BaseProperties::VELOCITY, velocity);
-void MatrixElement::setCanvas(Q3Canvas* c)
-{
- if (!m_canvasRect->canvas()) {
+ float scaleFactor(2.0 / Note(Note::Shortest).getDuration()); //!!!
- m_canvasRect->setCanvas(c);
+ QColor colour;
+ if (event->has(BaseProperties::TRIGGER_SEGMENT_ID)) {
+ colour = Qt::gray;
+ } else {
+ //!!! handle selection
+ colour = DefaultVelocityColour::getInstance()->getColour(velocity);
+ }
+ colour.setAlpha(160);
- // We set this by velocity now (matrixstaff.cpp)
- //
- //m_canvasRect->setBrush(RosegardenGUIColours::MatrixElementBlock);
-
- m_canvasRect->setPen(GUIPalette::getColour(GUIPalette::MatrixElementBorder));
- m_canvasRect->show();
+ if (drum) {
+ QGraphicsPolygonItem *item = new QGraphicsPolygonItem;
+ QPolygonF polygon;
+ polygon << QPointF(0, 0)
+ << QPointF(resolution/2, resolution/2)
+ << QPointF(0, resolution)
+ << QPointF(-resolution/2, resolution/2)
+ << QPointF(0, 0);
+ item->setPolygon(polygon);
+ item->setPen(QPen(Qt::black, 1));
+ item->setBrush(colour);
+ m_item = item;
+ } else {
+ QGraphicsRectItem *item = new QGraphicsRectItem;
+ float width = duration / scaleFactor;
+ if (width < 1) width = 1;
+ QRectF rect(0, 0, width, resolution);
+ item->setRect(rect);
+ item->setPen(QPen(Qt::black, 1));
+ item->setBrush(colour);
+ m_item = item;
}
-}
-bool MatrixElement::isNote() const
-{
- return event()->isa(Note::EventType);
-}
+ m_item->setData(MatrixElementData, QVariant::fromValue((void *)this));
+ m_item->setPos(time / scaleFactor, (127 - pitch) * (resolution + 1));
-void MatrixElement::drawOverlapRectangles()
-{
- if (m_overlapRectangles) removeOverlapRectangles();
+ MATRIX_DEBUG << "MatrixElement::MatrixElement: Adding element at " << m_item->pos() << " to scene" << endl;
- QRect elRect = m_canvasRect->rect();
- Q3CanvasItemList
- itemList = m_canvasRect->canvas()->collisions(elRect);
- Q3CanvasItemList::Iterator it;
- MatrixElement* mel = 0;
-
-
- for (it = itemList.begin(); it != itemList.end(); ++it) {
-
- QCanvasMatrixRectangle *mRect = 0;
- if ((mRect = dynamic_cast<QCanvasMatrixRectangle*>(*it))) {
-
- // Element does'nt collide with itself
- if (mRect == m_canvasRect) continue;
-
- QRect rect = mRect->rect() & elRect;
- if (!rect.isEmpty()) {
- if (!m_overlapRectangles) {
- m_overlapRectangles = new OverlapRectangles();
- }
-
- Q3CanvasRectangle *
- overlap = new Q3CanvasRectangle(rect, m_canvasRect->canvas());
- overlap->setBrush(GUIPalette::getColour(GUIPalette::MatrixOverlapBlock));
- overlap->setZ(getCanvasZ() + 1);
- overlap->show();
- m_overlapRectangles->push_back(overlap);
- }
- }
- }
+ scene->addItem(m_item);
}
-void MatrixElement::redrawOverlaps(QRect rect)
+MatrixElement::~MatrixElement()
{
- Q3CanvasItemList
- itemList = m_canvasRect->canvas()->collisions(rect);
- Q3CanvasItemList::Iterator it;
- MatrixElement* mel = 0;
-
- for (it = itemList.begin(); it != itemList.end(); ++it) {
- QCanvasMatrixRectangle *mRect = 0;
- if ((mRect = dynamic_cast<QCanvasMatrixRectangle*>(*it))) {
- mRect->getMatrixElement().drawOverlapRectangles();
- }
- }
+ delete m_item;
}
-void MatrixElement::removeOverlapRectangles()
+bool
+MatrixElement::isNote() const
{
- if (!m_overlapRectangles) return;
-
- OverlapRectangles::iterator it;
- for (it = m_overlapRectangles->begin(); it != m_overlapRectangles->end(); ++it) {
- (*it)->hide();
- delete *it;
- }
-
- delete m_overlapRectangles;
- m_overlapRectangles = NULL;
+ return event()->isa(Note::EventType);
}
-bool MatrixElement::getVisibleRectangle(QRect &rectangle)
+MatrixElement *
+MatrixElement::getMatrixElement(QGraphicsItem *item)
{
- if (m_canvasRect && m_canvasRect->isVisible()) {
- rectangle = m_canvasRect->rect();
- return true;
- }
- return false;
+ QVariant v = item->data(MatrixElementData);
+ if (v.isNull()) return 0;
+ return (MatrixElement *)v.value<void *>();
}
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixElement.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixElement.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixElement.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,4 +1,3 @@
-
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
@@ -19,109 +18,33 @@
#ifndef _RG_MATRIXELEMENT_H_
#define _RG_MATRIXELEMENT_H_
-#include <Q3Canvas>
-#include <Q3CanvasRectangle>
#include "base/ViewElement.h"
-#include <QBrush>
-#include <Q3Canvas>
-#include "QCanvasMatrixRectangle.h"
class QColor;
+class QGraphicsItem;
-
namespace Rosegarden
{
+class MatrixScene;
class Event;
class MatrixElement : public ViewElement
{
-
- typedef std::vector <Q3CanvasRectangle *> OverlapRectangles;
-
-
public:
- MatrixElement(Event *event, bool drum);
-
+ MatrixElement(MatrixScene *scene,
+ Event *event,
+ bool drum,
+ int resolution);
virtual ~MatrixElement();
- void setCanvas(Q3Canvas* c);
-
- /**
- * Returns the actual x coordinate of the element on the canvas
- */
- double getCanvasX() const { return m_canvasRect->x(); }
-
- /**
- * Returns the actual y coordinate of the element on the canvas
- */
- double getCanvasY() const { return m_canvasRect->y(); }
-
- double getCanvasZ() const { return m_canvasRect->z(); }
-
- /**
- * Sets the x coordinate of the element on the canvas
- */
- void setCanvasX(double x) { m_canvasRect->setX(x); }
-
- /**
- * Sets the y coordinate of the element on the canvas
- */
- void setCanvasY(double y) { m_canvasRect->setY(y); }
-
- void setCanvasZ(double z) { m_canvasRect->setZ(z); }
-
- /**
- * Sets the width of the rectangle on the canvas
- */
- void setWidth(int w) { m_canvasRect->setSize(w, m_canvasRect->height()); }
- int getWidth() { return m_canvasRect->width(); }
-
- /**
- * Sets the height of the rectangle on the canvas
- */
- void setHeight(int h) { m_canvasRect->setSize(m_canvasRect->width(), h); }
- int getHeight() { return m_canvasRect->height(); }
-
/// Returns true if the wrapped event is a note
bool isNote() const;
- /*
- * Set the colour of the element
- */
- void setColour(const QColor &colour)
- { m_canvasRect->setBrush(QBrush(colour)); }
+ static MatrixElement *getMatrixElement(QGraphicsItem *);
- /**
- * Draws overlap rectangles (if any)
- * (should not be called in drum mode)
- */
- void drawOverlapRectangles();
-
- /**
- * Removes overlap rectangles if any
- */
- void removeOverlapRectangles();
-
- /**
- * If element rectangle is currently visible gets its size and returns true.
- * Returns false if element rectangle is undefined or not visible.
- */
- bool getVisibleRectangle(QRect &rectangle);
-
- /**
- * Redraw overlap rectangles of all matrix elements colliding with rect
- */
- void redrawOverlaps(QRect rect);
-
protected:
-
- //--------------- Data members ---------------------------------
-
- QCanvasMatrixRectangle *m_canvasRect;
-
- OverlapRectangles *m_overlapRectangles;
-
+ QGraphicsItem *m_item;
};
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixEraser.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixEraser.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixEraser.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -15,6 +15,7 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW
#include <Q3CanvasPixmap>
#include "MatrixEraser.h"
@@ -84,3 +85,5 @@
const QString MatrixEraser::ToolName = "eraser";
}
+
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixEraser.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixEraser.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixEraser.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -16,6 +16,8 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
+
#ifndef _RG_MATRIXERASER_H_
#define _RG_MATRIXERASER_H_
@@ -60,3 +62,4 @@
}
#endif
+#endif
Deleted: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixHLayout.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixHLayout.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixHLayout.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,213 +0,0 @@
-/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
-
-/*
- Rosegarden
- A MIDI and audio sequencer and musical notation editor.
- Copyright 2000-2009 the Rosegarden development team.
-
- Other copyrights also apply to some parts of this work. Please
- see the AUTHORS file and individual file headers for details.
-
- 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. See the file
- COPYING included with this distribution for more information.
-*/
-
-
-#include "MatrixHLayout.h"
-#include "MatrixElement.h"
-#include "misc/Debug.h"
-
-#include "base/Composition.h"
-#include "base/LayoutEngine.h"
-#include "base/NotationTypes.h"
-#include "base/Profiler.h"
-#include "base/Segment.h"
-#include "base/Staff.h"
-#include "MatrixStaff.h"
-
-#include <cmath>
-
-
-namespace Rosegarden
-{
-
-MatrixHLayout::MatrixHLayout(Composition *c) :
- HorizontalLayoutEngine(c),
- m_totalWidth(0.0),
- m_firstBar(0)
-{}
-
-MatrixHLayout::~MatrixHLayout()
-{}
-
-void MatrixHLayout::reset()
-{}
-
-void MatrixHLayout::resetStaff(Staff&, timeT, timeT)
-{}
-
-void MatrixHLayout::scanStaff(Staff &staffBase,
- timeT startTime, timeT endTime)
-{
- Profiler profiler("MatrixHLayout::scanStaff", true);
-
- // The Matrix layout is not currently designed to be able to lay
- // out more than one staff, because we have no requirement to show
- // more than one at once in the Matrix view. To make it work for
- // multiple staffs should be straightforward; we just need to bear
- // in mind that they might start and end at different times (hence
- // the total width and bar list can't just be calculated from the
- // last staff scanned as they are now).
-
- MatrixStaff &staff = static_cast<MatrixStaff &>(staffBase);
- bool isFullScan = (startTime == endTime);
-
- MatrixElementList *notes = staff.getViewElementList();
- MatrixElementList::iterator startItr = notes->begin();
- MatrixElementList::iterator endItr = notes->end();
-
- if (!isFullScan) {
- startItr = notes->findNearestTime(startTime);
- if (startItr == notes->end())
- startItr = notes->begin();
- endItr = notes->findTime(endTime);
- }
-
- if (endItr == notes->end() && startItr == notes->begin()) {
- isFullScan = true;
- }
-
- // Do this in two parts: bar lines separately from elements.
- // (We don't need to do all that stuff notationhlayout has to do,
- // scanning the notes bar-by-bar; we can just place the bar lines
- // in the theoretically-correct places and do the same with the
- // notes quite independently.)
-
- Segment &segment = staff.getSegment();
- Composition *composition = segment.getComposition();
- m_firstBar = composition->getBarNumber(segment.getStartTime());
- timeT from = composition->getBarStart(m_firstBar),
- to = composition->getBarEndForTime(segment.getEndMarkerTime());
-
- double startPosition = from;
-
- // 1. Bar lines and time signatures. We only re-make these on
- // full scans.
-
- if (isFullScan || m_barData.size() == 0) {
-
- m_barData.clear();
- int barNo = m_firstBar;
-
- MATRIX_DEBUG << "MatrixHLayout::scanStaff() : start time = " << startTime << ", first bar = " << m_firstBar << ", end time = " << endTime << ", end marker time = " << segment.getEndMarkerTime() << ", from = " << from << ", to = " << to << endl;
-
- // hack for partial bars
- //
- timeT adjTo = to;
-
- if (composition->getBarStartForTime(segment.getEndMarkerTime())
- != segment.getEndMarkerTime())
- adjTo++;
-
- while (from < adjTo) {
-
- bool isNew = false;
- TimeSignature timeSig =
- composition->getTimeSignatureInBar(barNo, isNew);
-
- if (isNew || barNo == m_firstBar) {
- m_barData.push_back(BarData((from - startPosition) *
- staff.getTimeScaleFactor(),
- TimeSigData(true, timeSig)));
- } else {
- m_barData.push_back(BarData((from - startPosition) *
- staff.getTimeScaleFactor(),
- TimeSigData(false, timeSig)));
- }
-
- from = composition->getBarEndForTime(from);
- ++barNo;
- }
-
- m_barData.push_back(BarData(to * staff.getTimeScaleFactor(),
- TimeSigData(false, TimeSignature())));
- }
-
- // 2. Elements
-
- m_totalWidth = 0.0;
- MatrixElementList::iterator i = startItr;
-
- while (i != endItr) {
-
- (*i)->setLayoutX(((*i)->getViewAbsoluteTime() - startPosition)
- * staff.getTimeScaleFactor());
-
- double width = (*i)->getViewDuration() * staff.getTimeScaleFactor();
-
- // Make sure that very small elements can still be seen
- //
- if (width < 3) width = 3;
- else width += 1; // fiddle factor
-
- static_cast<MatrixElement*>((*i))->setWidth(lrint(width));
-
- if (isFullScan) {
- m_totalWidth = (*i)->getLayoutX() + width;
- } else {
- m_totalWidth = std::max(m_totalWidth, (*i)->getLayoutX() + width);
- }
-
- ++i;
- }
-}
-
-double MatrixHLayout::getTotalWidth() const
-{
- return m_totalWidth;
-}
-
-int MatrixHLayout::getFirstVisibleBar() const
-{
- return m_firstBar;
-}
-
-int MatrixHLayout::getLastVisibleBar() const
-{
- int barNo = m_firstBar + m_barData.size() - 2;
- if (barNo < m_firstBar + 1)
- barNo = m_firstBar + 1;
-
- return barNo;
-}
-
-double MatrixHLayout::getBarPosition(int barNo) const
-{
- if (barNo < getFirstVisibleBar()) {
- return getBarPosition(getFirstVisibleBar());
- }
-
- if (barNo > getLastVisibleBar()) {
- return getBarPosition(getLastVisibleBar());
- }
-
- return m_barData[barNo - m_firstBar].first;
-}
-
-bool MatrixHLayout::getTimeSignaturePosition(Staff &,
- int barNo,
- TimeSignature &timeSig,
- double &timeSigX)
-{
- timeSig = m_barData[barNo - m_firstBar].second.second;
- timeSigX = m_barData[barNo - m_firstBar].first;
- return m_barData[barNo - m_firstBar].second.first;
-}
-
-void MatrixHLayout::finishLayout(timeT, timeT)
-{}
-
-}
Deleted: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixHLayout.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixHLayout.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixHLayout.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,143 +0,0 @@
-
-/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
-
-/*
- Rosegarden
- A MIDI and audio sequencer and musical notation editor.
- Copyright 2000-2009 the Rosegarden development team.
-
- Other copyrights also apply to some parts of this work. Please
- see the AUTHORS file and individual file headers for details.
-
- 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. See the file
- COPYING included with this distribution for more information.
-*/
-
-#ifndef _RG_MATRIXHLAYOUT_H_
-#define _RG_MATRIXHLAYOUT_H_
-
-#include "base/FastVector.h"
-#include "base/LayoutEngine.h"
-#include <utility>
-#include "base/Event.h"
-
-#include "gui/general/HZoomable.h"
-
-
-
-namespace Rosegarden
-{
-
-class TimeSignature;
-class Staff;
-class Composition;
-
-
-class MatrixHLayout : public HorizontalLayoutEngine
-{
-public:
- MatrixHLayout(Composition *c);
- virtual ~MatrixHLayout();
-
- /**
- * Resets internal data stores for all staffs
- */
- virtual void reset();
-
- /**
- * Resets internal data stores for a specific staff
- */
- virtual void resetStaff(Staff &staff,
- timeT = 0,
- timeT = 0);
-
- /**
- * Returns the total length of all elements once layout is done.
- * This is the x-coord of the end of the last element on the
- * longest staff
- */
- virtual double getTotalWidth() const;
-
- /**
- * Returns the number of the first visible bar line
- */
- virtual int getFirstVisibleBar() const;
-
- /**
- * Returns the number of the first visible bar line
- */
- virtual int getLastVisibleBar() const;
-
- /**
- * Returns the x-coordinate of the given bar number
- */
- virtual double getBarPosition(int barNo) const;
-
- /**
- * Precomputes layout data for a single staff, updating any
- * internal data stores associated with that staff and updating
- * any layout-related properties in the events on the staff's
- * segment.
- */
- virtual void scanStaff(Staff&,
- timeT = 0,
- timeT = 0);
-
- /**
- * Computes any layout data that may depend on the results of
- * scanning more than one staff. This may mean doing most of
- * the layout (likely for horizontal layout) or nothing at all
- * (likely for vertical layout).
- */
- virtual void finishLayout(timeT = 0,
- timeT = 0);
-
- /**
- * Returns true if there is a new time signature in the given bar,
- * setting timeSignature appropriately and setting timeSigX to its
- * x-coord
- */
- virtual bool getTimeSignaturePosition(Staff &staff,
- int barNo,
- TimeSignature &timeSig,
- double &timeSigX);
-
-protected:
-
- //--------------- Data members ---------------------------------
-
- // pair of has-time-sig and time-sig
- typedef std::pair<bool, TimeSignature> TimeSigData;
- // pair of layout-x and time-signature if there is one
- typedef std::pair<double, TimeSigData> BarData;
- typedef FastVector<BarData> BarDataList;
- BarDataList m_barData;
- double m_totalWidth;
- int m_firstBar;
-};
-
-/**
- * "zoomable" version of the above, used in the MatrixView
- * to properly scale Tempo and Chord rulers.
- *
- */
-class ZoomableMatrixHLayoutRulerScale : public RulerScale, public HZoomable {
-public:
- ZoomableMatrixHLayoutRulerScale(MatrixHLayout& layout) : RulerScale(layout.getComposition()), m_referenceHLayout(layout) {};
-
- virtual double getBarPosition(int n) const { return m_referenceHLayout.getBarPosition(n) * getHScaleFactor(); }
- virtual double getXForTime(timeT time) const { return m_referenceHLayout.getXForTime(time) * getHScaleFactor(); }
- virtual timeT getTimeForX(double x) const { return m_referenceHLayout.getTimeForX(x / getHScaleFactor()); }
- virtual double getBarWidth(int n) const { return m_referenceHLayout.getBarWidth(n) * getHScaleFactor(); }
- virtual int getLastVisibleBar() const { return m_referenceHLayout.getLastVisibleBar(); }
-
-protected:
- MatrixHLayout& m_referenceHLayout;
-};
-
-}
-
-#endif
Added: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMouseEvent.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMouseEvent.h (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMouseEvent.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,52 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#ifndef _MATRIX_MOUSE_EVENT_H_
+#define _MATRIX_MOUSE_EVENT_H_
+
+#include <QString>
+
+namespace Rosegarden
+{
+
+class MatrixViewSegment;
+class MatrixElement;
+
+class MatrixMouseEvent
+{
+public:
+ MatrixViewSegment *viewSegment;
+ MatrixElement *element; // under event, if any
+
+ timeT time;
+ int pitch;
+ double sceneX;
+ int sceneY;
+
+ Qt::KeyboardModifiers modifiers;
+ Qt::MouseButtons buttons;
+
+ MatrixMouseEvent() :
+ viewSegment(0), element(0),
+ time(0), pitch(0),
+ sceneX(0), sceneY(0),
+ modifiers(0), buttons(0) { }
+};
+
+}
+
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMover.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMover.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMover.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -15,6 +15,7 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
#include <Q3CanvasPixmap>
#include "MatrixMover.h"
@@ -456,3 +457,4 @@
}
#include "MatrixMover.moc"
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMover.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMover.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixMover.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -16,6 +16,7 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
#ifndef _RG_MATRIXMOVER_H_
#define _RG_MATRIXMOVER_H_
@@ -103,3 +104,5 @@
}
#endif
+
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixPainter.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixPainter.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixPainter.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -14,8 +14,8 @@
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW
-
#include <Q3CanvasPixmap>
#include "MatrixPainter.h"
@@ -344,3 +344,4 @@
}
#include "MatrixPainter.moc"
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixPainter.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixPainter.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixPainter.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -16,6 +16,8 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW
+
#ifndef _RG_MATRIXPAINTER_H_
#define _RG_MATRIXPAINTER_H_
@@ -96,3 +98,4 @@
}
#endif
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixResizer.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixResizer.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixResizer.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -16,6 +16,8 @@
*/
+#ifdef NOT_JUST_NOW //!!!
+
#include <Q3CanvasPixmap>
#include "MatrixResizer.h"
@@ -309,3 +311,4 @@
}
#include "MatrixResizer.moc"
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixResizer.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixResizer.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixResizer.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -19,6 +19,8 @@
#ifndef _RG_MATRIXRESIZER_H_
#define _RG_MATRIXRESIZER_H_
+#ifdef NOT_JUST_NOW //!!!
+
#include "MatrixTool.h"
#include <QString>
#include "base/Event.h"
@@ -93,3 +95,4 @@
}
#endif
+#endif
Added: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixScene.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixScene.cpp (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixScene.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,202 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#include "MatrixScene.h"
+
+#include "MatrixMouseEvent.h"
+#include "MatrixViewSegment.h"
+#include "MatrixWidget.h"
+
+#include "document/RosegardenGUIDoc.h"
+#include "document/CommandHistory.h"
+
+#include "misc/Debug.h"
+
+#include <QGraphicsSceneMouseEvent>
+
+namespace Rosegarden
+{
+
+MatrixScene::MatrixScene() :
+ m_widget(0),
+ m_document(0)
+{
+ connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
+ this, SLOT(slotCommandExecuted()));
+}
+
+MatrixScene::~MatrixScene()
+{
+ if (m_document) {
+ if (!isCompositionDeleted()) { // implemented in CompositionObserver
+ m_document->getComposition().removeObserver(this);
+ }
+ }
+ for (unsigned int i = 0; i < m_viewSegments.size(); ++i) {
+ delete m_viewSegments[i];
+ }
+}
+
+void
+MatrixScene::setMatrixWidget(MatrixWidget *w)
+{
+ m_widget = w;
+}
+
+void
+MatrixScene::setSegments(RosegardenGUIDoc *document,
+ std::vector<Segment *> segments)
+{
+ if (m_document && document != m_document) {
+ m_document->getComposition().removeObserver(this);
+ }
+
+ m_document = document;
+ m_segments = segments;
+
+ m_document->getComposition().addObserver(this);
+
+ for (unsigned int i = 0; i < m_viewSegments.size(); ++i) {
+ delete m_viewSegments[i];
+ }
+ m_viewSegments.clear();
+
+ bool havePercussion = false;
+
+ if (m_widget && m_widget->isDrumMode()) {
+ for (unsigned int i = 0; i < m_segments.size(); ++i) {
+ Instrument *instrument =
+ m_document->getStudio().getInstrumentFor(m_segments[i]);
+ if (instrument && instrument->getKeyMapping()) {
+ havePercussion = true;
+ }
+ }
+ }
+
+ int resolution = 8;
+ if (havePercussion) resolution = 11;
+
+ for (unsigned int i = 0; i < m_segments.size(); ++i) {
+
+ bool isPercussion = false;
+
+ if (havePercussion) {
+ Instrument *instrument =
+ m_document->getStudio().getInstrumentFor(m_segments[i]);
+ if (instrument && instrument->getKeyMapping()) {
+ isPercussion = true;
+ }
+ }
+
+ MatrixViewSegment *vs = new MatrixViewSegment(this,
+ m_segments[i],
+ resolution,
+ isPercussion);
+ (void)vs->getViewElementList(); // make sure it has been created
+ m_viewSegments.push_back(vs);
+ }
+}
+
+void
+MatrixScene::setupMouseEvent(QGraphicsSceneMouseEvent *e,
+ MatrixMouseEvent &nme) const
+{
+ double sx = e->scenePos().x();
+ int sy = lrint(e->scenePos().y());
+
+ nme.sceneX = sx;
+ nme.sceneY = sy;
+
+ nme.modifiers = e->modifiers();
+ nme.buttons = e->buttons();
+
+ nme.element = 0;//!!!
+ nme.viewSegment = 0;//!!!
+
+ nme.time = 0;//!!!
+ nme.pitch = 0;//!!!
+}
+
+void
+MatrixScene::mousePressEvent(QGraphicsSceneMouseEvent *e)
+{
+ MatrixMouseEvent nme;
+ setupMouseEvent(e, nme);
+ emit mousePressed(&nme);
+}
+
+void
+MatrixScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
+{
+ MatrixMouseEvent nme;
+ setupMouseEvent(e, nme);
+ emit mouseMoved(&nme);
+}
+
+void
+MatrixScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
+{
+ MatrixMouseEvent nme;
+ setupMouseEvent(e, nme);
+ emit mouseReleased(&nme);
+}
+
+void
+MatrixScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e)
+{
+ MatrixMouseEvent nme;
+ setupMouseEvent(e, nme);
+ emit mouseDoubleClicked(&nme);
+}
+
+void
+MatrixScene::slotCommandExecuted()
+{
+}
+
+void
+MatrixScene::timeSignatureChanged(const Composition *c)
+{
+ if (!m_document || !c || (c != &m_document->getComposition())) return;
+}
+
+void
+MatrixScene::segmentRemoved(const Composition *c, Segment *s)
+{
+ MATRIX_DEBUG << "MatrixScene::segmentRemoved(" << c << "," << s << ")" << endl;
+
+ if (!m_document || !c || (c != &m_document->getComposition())) return;
+
+ for (std::vector<MatrixViewSegment *>::iterator i = m_viewSegments.begin();
+ i != m_viewSegments.end(); ++i) {
+ if (s == &(*i)->getSegment()) {
+ delete *i;
+ m_viewSegments.erase(i);
+ break;
+ }
+ }
+
+ if (m_viewSegments.empty()) {
+ MATRIX_DEBUG << "(Scene is now empty)" << endl;
+ emit sceneDeleted();
+ }
+}
+
+}
+
+#include "MatrixScene.moc"
+
Added: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixScene.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixScene.h (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixScene.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,81 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#ifndef _RG_MATRIXSCENE_H_
+#define _RG_MATRIXSCENE_H_
+
+#include <QGraphicsScene>
+
+#include "base/Composition.h"
+
+namespace Rosegarden
+{
+
+class MatrixWidget;
+class Segment;
+class RosegardenGUIDoc;
+class Event;
+class MatrixMouseEvent;
+class MatrixViewSegment;
+
+class MatrixScene : public QGraphicsScene, public CompositionObserver
+{
+ Q_OBJECT
+
+public:
+ MatrixScene();
+ ~MatrixScene();
+
+ void setMatrixWidget(MatrixWidget *w);
+ void setSegments(RosegardenGUIDoc *doc, std::vector<Segment *> segments);
+
+ void handleEventRemoved(Event *) { }//!!! tell tools, in case they have m_someEvent stored
+
+signals:
+ void mousePressed(const MatrixMouseEvent *e);
+ void mouseMoved(const MatrixMouseEvent *e);
+ void mouseReleased(const MatrixMouseEvent *e);
+ void mouseDoubleClicked(const MatrixMouseEvent *e);
+
+ void sceneDeleted(); // all segments have been removed
+
+protected slots:
+ void slotCommandExecuted();
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
+
+ void segmentRemoved(const Composition *, Segment *); // CompositionObserver
+ void timeSignatureChanged(const Composition *); // CompositionObserver
+
+private:
+ MatrixWidget *m_widget; // I do not own this
+
+ RosegardenGUIDoc *m_document; // I do not own this
+
+ std::vector<Segment *> m_segments; // I do not own these
+ std::vector<MatrixViewSegment *> m_viewSegments; // I own these
+
+ void setupMouseEvent(QGraphicsSceneMouseEvent *, MatrixMouseEvent &) const;
+};
+
+}
+
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixSelector.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixSelector.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixSelector.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -15,6 +15,7 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
#include <Q3CanvasItem>
#include <Q3CanvasItemList>
@@ -615,3 +616,4 @@
}
#include "MatrixSelector.moc"
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixSelector.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixSelector.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixSelector.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,4 +1,3 @@
-
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
@@ -15,6 +14,7 @@
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
#ifndef _RG_MATRIXSELECTOR_H_
#define _RG_MATRIXSELECTOR_H_
@@ -169,3 +169,5 @@
}
#endif
+
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixStaff.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixStaff.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixStaff.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -15,6 +15,7 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_DEFINED
#include <Q3Canvas>
#include "MatrixStaff.h"
@@ -224,3 +225,4 @@
}
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixStaff.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixStaff.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixStaff.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -19,6 +19,8 @@
#ifndef _RG_MATRIXSTAFF_H_
#define _RG_MATRIXSTAFF_H_
+#ifdef NOT_DEFINED
+
#include <Q3Canvas>
#include "base/Staff.h"
#include "gui/general/LinedStaff.h"
@@ -103,3 +105,4 @@
}
#endif
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixTool.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixTool.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixTool.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -17,22 +17,59 @@
#include "MatrixTool.h"
+#include "misc/Debug.h"
+#include "misc/Strings.h"
-#include "gui/general/EditTool.h"
-#include "MatrixView.h"
+#include "MatrixWidget.h"
+#include "MatrixScene.h"
+
#include <QAction>
#include <QString>
+#include <QMenu>
namespace Rosegarden
{
-MatrixTool::MatrixTool(const QString& menuName, MatrixView* parent)
- : EditTool(menuName, parent),
- m_mParentView(parent)
-{}
+MatrixTool::MatrixTool(QString rcFileName, QString menuName,
+ MatrixWidget *widget) :
+ BaseTool(menuName, widget),
+ m_widget(widget),
+ m_rcFileName(rcFileName)
+{
+}
+MatrixTool::~MatrixTool()
+{
+ MATRIX_DEBUG << "MatrixTool::~MatrixTool()" << endl;
+ delete m_menu;
+}
+
void
+MatrixTool::handleLeftButtonPress(const MatrixMouseEvent *) { }
+
+void
+MatrixTool::handleMidButtonPress(const MatrixMouseEvent *) { }
+
+void
+MatrixTool::handleRightButtonPress(const MatrixMouseEvent *)
+{
+ showMenu();
+}
+
+void
+MatrixTool::handleMouseRelease(const MatrixMouseEvent *) { }
+
+void
+MatrixTool::handleMouseDoubleClick(const MatrixMouseEvent *) { }
+
+MatrixTool::FollowMode
+MatrixTool::handleMouseMove(const MatrixMouseEvent *)
+{
+ return NoFollow;
+}
+
+void
MatrixTool::slotSelectSelected()
{
invokeInParentView("select");
@@ -62,11 +99,62 @@
invokeInParentView("draw");
}
-const SnapGrid &
+const SnapGrid *
MatrixTool::getSnapGrid() const
{
- return m_mParentView->getSnapGrid();
+ return m_widget->getSnapGrid();
}
+void
+MatrixTool::invokeInParentView(QString actionName)
+{
+ QAction *a = findActionInParentView(actionName);
+ if (!a) {
+ std::cerr << "MatrixTool::invokeInParentView: No action \"" << actionName
+ << "\" found in parent view" << std::endl;
+ } else {
+ a->trigger();
+ }
}
+
+QAction *
+MatrixTool::findActionInParentView(QString actionName)
+{
+ if (!m_widget) return 0;
+ QWidget *w = m_widget;
+ ActionFileClient *c = 0;
+ while (w->parentWidget() && !(c = dynamic_cast<ActionFileClient *>(w))) {
+ w = w->parentWidget();
+ }
+ if (!c) {
+ std::cerr << "MatrixTool::findActionInParentView: Can't find ActionFileClient in parent widget hierarchy" << std::endl;
+ return 0;
+ }
+ QAction *a = c->findAction(actionName);
+ return a;
+}
+
+void
+MatrixTool::createMenu()
+{
+ MATRIX_DEBUG << "MatrixTool::createMenu() " << m_rcFileName << " - " << m_menuName << endl;
+
+ if (!createGUI(m_rcFileName)) {
+ std::cerr << "MatrixTool::createMenu(" << m_rcFileName << "): menu creation failed" << std::endl;
+ m_menu = 0;
+ return;
+ }
+
+ QMenu *menu = findMenu(m_menuName);
+ if (!menu) {
+ std::cerr << "MatrixTool::createMenu(" << m_rcFileName
+ << "): menu name "
+ << m_menuName << " not created by RC file\n";
+ return;
+ }
+
+ m_menu = menu;
+}
+
+}
#include "MatrixTool.moc"
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixTool.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixTool.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixTool.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,4 +1,3 @@
-
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
@@ -19,30 +18,47 @@
#ifndef _RG_MATRIXTOOL_H_
#define _RG_MATRIXTOOL_H_
-#include "gui/general/EditTool.h"
+#include "gui/general/BaseTool.h"
+#include "gui/general/ActionFileClient.h"
-class QString;
+class QAction;
-
namespace Rosegarden
{
class MatrixView;
class SnapGrid;
+class MatrixMouseEvent;
+class MatrixWidget;
+class MatrixScene;
-
-//////////////////////////////////////////////////////////////////////
-
-class MatrixTool : public EditTool
+class MatrixTool : public BaseTool, public ActionFileClient
{
Q_OBJECT
+ friend class MatrixToolBox;
+
public:
-// virtual void ready();
+ ~MatrixTool();
+ //!!! todo: hoist common bits of this & NotationTool into a new
+ // version of EditTool? (only if there is enough to be worth it)
+
+ enum FollowMode {
+ NoFollow = 0x0,
+ FollowHorizontal = 0x1,
+ FollowVertical = 0x2
+ };
+
+ virtual void handleLeftButtonPress(const MatrixMouseEvent *);
+ virtual void handleMidButtonPress(const MatrixMouseEvent *);
+ virtual void handleRightButtonPress(const MatrixMouseEvent *);
+ virtual void handleMouseRelease(const MatrixMouseEvent *);
+ virtual void handleMouseDoubleClick(const MatrixMouseEvent *);
+ virtual FollowMode handleMouseMove(const MatrixMouseEvent *);
+
protected slots:
-
// For switching between tools on RMB
//
void slotSelectSelected();
@@ -51,14 +67,22 @@
void slotResizeSelected();
void slotDrawSelected();
- const SnapGrid &getSnapGrid() const;
-
protected:
- MatrixTool(const QString& menuName, MatrixView*);
+ MatrixTool(QString rcFileName, QString menuName, MatrixWidget *);
- //--------------- Data members ---------------------------------
+ const SnapGrid *getSnapGrid() const;
- MatrixView* m_mParentView;
+ virtual void createMenu();
+ virtual bool hasMenu() { return m_menuName != ""; }
+
+ void setScene(MatrixScene *scene) { m_scene = scene; }
+
+ virtual void invokeInParentView(QString actionName);
+ virtual QAction *findActionInParentView(QString actionName);
+
+ MatrixWidget *m_widget;
+ MatrixScene *m_scene;
+ QString m_rcFileName;
};
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixToolBox.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixToolBox.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixToolBox.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -17,10 +17,8 @@
#include "MatrixToolBox.h"
-
-#include "gui/general/EditToolBox.h"
-#include "gui/general/EditTool.h"
-#include "MatrixView.h"
+#include "MatrixTool.h"
+#include "MatrixWidget.h"
#include "MatrixPainter.h"
#include "MatrixEraser.h"
#include "MatrixSelector.h"
@@ -33,49 +31,59 @@
namespace Rosegarden
{
-MatrixToolBox::MatrixToolBox(MatrixView* parent)
- : EditToolBox(parent),
- m_mParentView(parent)
-{}
+MatrixToolBox::MatrixToolBox(MatrixWidget *parent) :
+ BaseToolBox(parent),
+ m_widget(parent)
+{
+}
-EditTool* MatrixToolBox::createTool(QString toolName)
+BaseTool *
+MatrixToolBox::createTool(QString toolName)
{
- MatrixTool* tool = 0;
+ MatrixTool *tool = 0;
QString toolNamelc = toolName.toLower();
-
+/*!!!
if (toolNamelc == MatrixPainter::ToolName)
- tool = new MatrixPainter(m_mParentView);
+ tool = new MatrixPainter(m_widget);
else if (toolNamelc == MatrixEraser::ToolName)
- tool = new MatrixEraser(m_mParentView);
+ tool = new MatrixEraser(m_widget);
else if (toolNamelc == MatrixSelector::ToolName)
- tool = new MatrixSelector(m_mParentView);
+ tool = new MatrixSelector(m_widget);
else if (toolNamelc == MatrixMover::ToolName)
- tool = new MatrixMover(m_mParentView);
+ tool = new MatrixMover(m_widget);
else if (toolNamelc == MatrixResizer::ToolName)
- tool = new MatrixResizer(m_mParentView);
+ tool = new MatrixResizer(m_widget);
else {
QMessageBox::critical(0, "", QString("MatrixToolBox::createTool : unrecognised toolname %1 (%2)")
.arg(toolName).arg(toolNamelc));
return 0;
}
+*/
+ m_tools.insert(toolName, tool);
-// m_tools.insert(toolName, tool);
- m_tools[toolName] = dynamic_cast<BaseTool*>( tool );
-
return tool;
-
}
+void
+MatrixToolBox::setScene(MatrixScene *scene)
+{
+ for (QHash<QString, BaseTool *>::iterator i = m_tools.begin();
+ i != m_tools.end(); ++i) {
+ MatrixTool *nt = dynamic_cast<MatrixTool *>(*i);
+ if (nt) nt->setScene(scene);
+ }
}
+
+}
#include "MatrixToolBox.moc"
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixToolBox.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixToolBox.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixToolBox.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -19,7 +19,7 @@
#ifndef _RG_MATRIXTOOLBOX_H_
#define _RG_MATRIXTOOLBOX_H_
-#include "gui/general/EditToolBox.h"
+#include "gui/general/BaseToolBox.h"
class QString;
@@ -27,27 +27,29 @@
namespace Rosegarden
{
-class EditTool;
-class MatrixView;
-class MatrixElement;
-class MatrixStaff;
+class MatrixWidget;
+class MatrixScene;
-class MatrixToolBox : public EditToolBox
+
+/**
+ * MatrixToolBox : maintains a single instance of each registered tool
+ *
+ * Tools are fetched by name
+ */
+class MatrixToolBox : public BaseToolBox
{
Q_OBJECT
+
public:
- MatrixToolBox(MatrixView* parent);
+ MatrixToolBox(MatrixWidget *parent);
+ void setScene(MatrixScene *scene);
+
protected:
-
- virtual EditTool* createTool(QString toolName);
-
- //--------------- Data members ---------------------------------
-
- MatrixView* m_mParentView;
+ virtual BaseTool *createTool(QString toolName);
+ MatrixWidget *m_widget;
};
-
}
#endif
Deleted: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixVLayout.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixVLayout.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixVLayout.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,93 +0,0 @@
-/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
-
-/*
- Rosegarden
- A MIDI and audio sequencer and musical notation editor.
- Copyright 2000-2009 the Rosegarden development team.
-
- Other copyrights also apply to some parts of this work. Please
- see the AUTHORS file and individual file headers for details.
-
- 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. See the file
- COPYING included with this distribution for more information.
-*/
-
-
-#include "MatrixVLayout.h"
-#include "misc/Debug.h"
-
-#include "base/BaseProperties.h"
-#include "base/LayoutEngine.h"
-#include "base/Staff.h"
-#include "MatrixElement.h"
-#include "MatrixStaff.h"
-
-
-namespace Rosegarden
-{
-
-MatrixVLayout::MatrixVLayout()
-{}
-
-MatrixVLayout::~MatrixVLayout()
-{}
-
-void MatrixVLayout::reset()
-{}
-
-void MatrixVLayout::resetStaff(Staff&, timeT, timeT)
-{}
-
-void MatrixVLayout::scanStaff(Staff& staffBase,
- timeT startTime, timeT endTime)
-{
- MatrixStaff& staff = dynamic_cast<MatrixStaff&>(staffBase);
-
- using BaseProperties::PITCH;
-
- MatrixElementList *notes = staff.getViewElementList();
-
- MatrixElementList::iterator from = notes->begin();
- MatrixElementList::iterator to = notes->end();
- MatrixElementList::iterator i;
-
- if (startTime != endTime) {
- from = notes->findNearestTime(startTime);
- if (from == notes->end())
- from = notes->begin();
- to = notes->findTime(endTime);
- }
-
- MATRIX_DEBUG << "MatrixVLayout::scanStaff : id = "
- << staff.getId() << endl;
-
-
- for (i = from; i != to; ++i) {
-
- MatrixElement *el = dynamic_cast<MatrixElement*>((*i));
-
- if (!el->isNote())
- continue; // notes only
-
- long pitch = 60;
- el->event()->get
- <Int>(PITCH, pitch);
-
- int y = staff.getLayoutYForHeight(pitch) - staff.getElementHeight() / 2;
-
- el->setLayoutY(y);
- el->setHeight(staff.getElementHeight());
- }
-
-}
-
-void MatrixVLayout::finishLayout(timeT, timeT)
-{}
-
-const int MatrixVLayout::minMIDIPitch = 0;
-const int MatrixVLayout::maxMIDIPitch = 127;
-
-}
Deleted: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixVLayout.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixVLayout.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixVLayout.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,84 +0,0 @@
-
-/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
-
-/*
- Rosegarden
- A MIDI and audio sequencer and musical notation editor.
- Copyright 2000-2009 the Rosegarden development team.
-
- Other copyrights also apply to some parts of this work. Please
- see the AUTHORS file and individual file headers for details.
-
- 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. See the file
- COPYING included with this distribution for more information.
-*/
-
-#ifndef _RG_MATRIXVLAYOUT_H_
-#define _RG_MATRIXVLAYOUT_H_
-
-#include "base/LayoutEngine.h"
-#include "base/Event.h"
-
-
-
-
-namespace Rosegarden
-{
-
-class Staff;
-
-
-class MatrixVLayout : public VerticalLayoutEngine
-{
-public:
- MatrixVLayout();
-
- virtual ~MatrixVLayout();
-
- /**
- * Resets internal data stores for all staffs
- */
- virtual void reset();
-
- /**
- * Resets internal data stores for a specific staff
- */
- virtual void resetStaff(Staff &staff,
- timeT = 0,
- timeT = 0);
-
- /**
- * Precomputes layout data for a single staff, updating any
- * internal data stores associated with that staff and updating
- * any layout-related properties in the events on the staff's
- * segment.
- */
- virtual void scanStaff(Staff &staff,
- timeT = 0,
- timeT = 0);
-
- /**
- * Computes any layout data that may depend on the results of
- * scanning more than one staff. This may mean doing most of
- * the layout (likely for horizontal layout) or nothing at all
- * (likely for vertical layout).
- */
- virtual void finishLayout(timeT = 0,
- timeT = 0);
-
- static const int minMIDIPitch;
- static const int maxMIDIPitch;
-
-protected:
- //--------------- Data members ---------------------------------
-
-
-};
-
-
-}
-
-#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixView.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixView.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixView.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -14,8 +14,8 @@
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
-
#include <Q3Canvas>
#include <Q3CanvasItem>
#include <Q3CanvasPixmap>
@@ -3011,3 +3011,4 @@
}
#include "MatrixView.moc"
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixView.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixView.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixView.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -15,6 +15,8 @@
COPYING included with this distribution for more information.
*/
+#ifdef NOT_JUST_NOW //!!!
+
#ifndef _RG_MATRIXVIEW_H_
#define _RG_MATRIXVIEW_H_
@@ -691,3 +693,4 @@
}
#endif
+#endif
Added: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixViewSegment.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixViewSegment.cpp (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixViewSegment.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,73 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#include "MatrixViewSegment.h"
+
+#include "MatrixScene.h"
+#include "MatrixElement.h"
+
+#include "base/NotationTypes.h"
+#include "base/SnapGrid.h"
+#include "base/MidiProgram.h"
+#include "base/SnapGrid.h"
+#include "base/SnapGrid.h"
+
+#include "misc/Debug.h"
+
+namespace Rosegarden
+{
+
+MatrixViewSegment::MatrixViewSegment(MatrixScene *scene,
+ Segment *segment,
+ int vResolution,
+ bool drum) :
+ ViewSegment(*segment),
+ m_scaleFactor(2.0 / Note(Note::Shortest).getDuration()),
+ m_scene(scene),
+ m_resolution(vResolution),
+ m_drum(drum)
+{
+}
+
+MatrixViewSegment::~MatrixViewSegment()
+{
+}
+
+bool
+MatrixViewSegment::wrapEvent(Event* e)
+{
+ return e->isa(Note::EventType) && ViewSegment::wrapEvent(e);
+}
+
+void
+MatrixViewSegment::eventRemoved(const Segment *segment,
+ Event *event)
+{
+ ViewSegment::eventRemoved(segment, event);
+ m_scene->handleEventRemoved(event);
+}
+
+ViewElement *
+MatrixViewSegment::makeViewElement(Event* e)
+{
+ MATRIX_DEBUG << "MatrixViewSegment::makeViewElement: event at "
+ << e->getAbsoluteTime() << endl;
+ return new MatrixElement(m_scene, e, m_drum, m_resolution);
+}
+
+}
+
Added: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixViewSegment.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixViewSegment.h (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixViewSegment.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,67 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#ifndef _RG_MATRIXVIEWSEGMENT_H_
+#define _RG_MATRIXVIEWSEGMENT_H_
+
+#include "base/ViewSegment.h"
+
+namespace Rosegarden
+{
+
+class MatrixScene;
+class Segment;
+class MatrixElement;
+class MidiKeyMapping;
+
+class MatrixViewSegment : public ViewSegment
+{
+public:
+ MatrixViewSegment(MatrixScene *,
+ Segment *,
+ int vResolution,
+ bool drumMode);
+ virtual ~MatrixViewSegment();
+
+ int getElementHeight() const { return m_resolution; }
+
+protected:
+//!!! const MidiKeyMapping *getKeyMapping() const;
+
+ /**
+ * Override from ViewSegment
+ * Wrap only notes
+ */
+ virtual bool wrapEvent(Event*);
+
+ /**
+ * Override from ViewSegment
+ * Let tools know if their current element has gone
+ */
+ virtual void eventRemoved(const Segment *, Event *);
+
+ virtual ViewElement* makeViewElement(Event *);
+
+ double m_scaleFactor;
+ MatrixScene *m_scene;
+ int m_resolution;
+ bool m_drum;
+};
+
+}
+
+#endif
Added: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixWidget.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixWidget.cpp (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixWidget.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,150 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#include "MatrixWidget.h"
+
+#include "MatrixScene.h"
+#include "MatrixToolBox.h"
+#include "MatrixTool.h"
+#include "MatrixMouseEvent.h"
+
+#include <QGraphicsView>
+#include <QGridLayout>
+#include <QScrollBar>
+
+#include "document/RosegardenGUIDoc.h"
+
+#include "base/SnapGrid.h"
+
+#include "misc/Debug.h"
+#include "misc/Strings.h"
+
+namespace Rosegarden
+{
+
+MatrixWidget::MatrixWidget(bool drumMode) :
+ m_document(0),
+ m_view(0),
+ m_scene(0),
+ m_drumMode(drumMode),
+ m_rulerScale(0),
+ m_snapGrid(0)
+{
+ QGridLayout *layout = new QGridLayout;
+ setLayout(layout);
+
+ m_view = new QGraphicsView;
+ layout->addWidget(m_view, 0, 0);
+
+ m_hpanner = new QGraphicsView;
+ m_hpanner->setMaximumHeight(80);
+ m_hpanner->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_hpanner->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_hpanner->setInteractive(false);
+// m_hpanner->setRenderHints(QPainter::TextAntialiasing |
+// QPainter::SmoothPixmapTransform);
+ layout->addWidget(m_hpanner, 1, 0);
+
+ m_toolBox = new MatrixToolBox(this);
+}
+
+MatrixWidget::~MatrixWidget()
+{
+ delete m_scene;
+}
+
+void
+MatrixWidget::setSegments(RosegardenGUIDoc *document,
+ std::vector<Segment *> segments)
+{
+ m_document = document;
+
+ delete m_rulerScale;
+ delete m_snapGrid;
+ timeT start = (*segments.begin())->getStartTime(); //!!!
+ //!!! this is all over the place at the moment -- probably scene should own these
+ float scaleFactor = (2.0 / Note(Note::Shortest).getDuration());
+ m_rulerScale = new SimpleRulerScale(&document->getComposition(),
+ 0, scaleFactor);
+ m_snapGrid = new SnapGrid(m_rulerScale, 0);//!!! scene y resolution
+
+ delete m_scene;
+ m_scene = new MatrixScene();
+ m_scene->setMatrixWidget(this);
+ m_scene->setSegments(document, segments);
+
+ connect(m_scene, SIGNAL(mousePressed(const MatrixMouseEvent *)),
+ this, SLOT(slotDispatchMousePress(const MatrixMouseEvent *)));
+
+ connect(m_scene, SIGNAL(mouseMoved(const MatrixMouseEvent *)),
+ this, SLOT(slotDispatchMouseMove(const MatrixMouseEvent *)));
+
+ connect(m_scene, SIGNAL(mouseReleased(const MatrixMouseEvent *)),
+ this, SLOT(slotDispatchMouseRelease(const MatrixMouseEvent *)));
+
+ connect(m_scene, SIGNAL(mouseDoubleClicked(const MatrixMouseEvent *)),
+ this, SLOT(slotDispatchMouseDoubleClick(const MatrixMouseEvent *)));
+
+ m_view->setScene(m_scene);
+
+ m_toolBox->setScene(m_scene);
+
+ m_hpanner->setScene(m_scene);
+ m_hpanner->fitInView(m_scene->sceneRect(), Qt::KeepAspectRatio);
+}
+
+void
+MatrixWidget::slotDispatchMousePress(const MatrixMouseEvent *e)
+{
+ if (!m_currentTool) return;
+
+ if (e->buttons & Qt::LeftButton) {
+ m_currentTool->handleLeftButtonPress(e);
+ } else if (e->buttons & Qt::MidButton) {
+ m_currentTool->handleMidButtonPress(e);
+ } else if (e->buttons & Qt::RightButton) {
+ m_currentTool->handleRightButtonPress(e);
+ }
+}
+
+void
+MatrixWidget::slotDispatchMouseMove(const MatrixMouseEvent *e)
+{
+ if (!m_currentTool) return;
+ MatrixTool::FollowMode mode = m_currentTool->handleMouseMove(e);
+
+ //!!! smooth scroll etc
+}
+
+void
+MatrixWidget::slotDispatchMouseRelease(const MatrixMouseEvent *e)
+{
+ if (!m_currentTool) return;
+ m_currentTool->handleMouseRelease(e);
+}
+
+void
+MatrixWidget::slotDispatchMouseDoubleClick(const MatrixMouseEvent *e)
+{
+ if (!m_currentTool) return;
+ m_currentTool->handleMouseDoubleClick(e);
+}
+
+}
+
+#include "MatrixWidget.moc"
+
Added: branches/qt4-graphicsview/src/gui/editors/matrix/MatrixWidget.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/MatrixWidget.h (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/MatrixWidget.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,77 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#ifndef _RG_MATRIX_WIDGET_H_
+#define _RG_MATRIX_WIDGET_H_
+
+#include <QWidget>
+
+#include <vector>
+
+class QGraphicsView;
+
+
+namespace Rosegarden
+{
+
+class RosegardenGUIDoc;
+class Segment;
+class MatrixScene;
+class MatrixToolBox;
+class MatrixTool;
+class MatrixMouseEvent;
+class SnapGrid;
+class RulerScale;
+
+class MatrixWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ MatrixWidget(bool drumMode);
+ virtual ~MatrixWidget();
+
+ void setSegments(RosegardenGUIDoc *document,
+ std::vector<Segment *> segments);
+
+ MatrixScene *getScene() { return m_scene; }
+
+ SnapGrid *getSnapGrid() { return m_snapGrid; }
+
+ bool isDrumMode() const { return m_drumMode; }
+
+protected slots:
+ void slotDispatchMousePress(const MatrixMouseEvent *);
+ void slotDispatchMouseRelease(const MatrixMouseEvent *);
+ void slotDispatchMouseMove(const MatrixMouseEvent *);
+ void slotDispatchMouseDoubleClick(const MatrixMouseEvent *);
+
+private:
+ RosegardenGUIDoc *m_document; // I do not own this
+ QGraphicsView *m_view; // I own this
+ QGraphicsView *m_hpanner; // I own this
+ MatrixScene *m_scene; // I own this
+ MatrixToolBox *m_toolBox;
+ MatrixTool *m_currentTool;
+ bool m_drumMode;
+ RulerScale *m_rulerScale;
+ SnapGrid *m_snapGrid;
+};
+
+}
+
+#endif
Added: branches/qt4-graphicsview/src/gui/editors/matrix/NewMatrixView.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/NewMatrixView.cpp (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/NewMatrixView.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,156 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#include "NewMatrixView.h"
+
+#include "document/RosegardenGUIDoc.h"
+#include "MatrixWidget.h"
+#include "base/SnapGrid.h"
+
+#include <QWidget>
+#include <QAction>
+#include <QActionGroup>
+#include <QMenu>
+
+namespace Rosegarden
+{
+
+NewMatrixView::NewMatrixView(RosegardenGUIDoc *doc,
+ std::vector<Segment *> segments,
+ bool drumMode,
+ QWidget *parent) :
+ QMainWindow(parent)
+{
+ m_matrixWidget = new MatrixWidget(drumMode);
+ setCentralWidget(m_matrixWidget);
+ m_matrixWidget->setSegments(doc, segments);
+
+ setupActions();
+
+ createGUI("matrix.rc");
+
+/*!!!
+ if (getSegmentsOnlyRestsAndClefs()) {
+ findAction("draw")->trigger();
+ } else {
+ findAction("select")->trigger();
+ }
+*/
+}
+
+NewMatrixView::~NewMatrixView()
+{
+}
+
+void
+NewMatrixView::setupActions()
+{
+
+ //!!! base class actions (not currently using EditView/EditViewBase)
+
+ createAction("select", SLOT(slotSelectSelected()));
+ createAction("draw", SLOT(slotPaintSelected()));
+ createAction("erase", SLOT(slotEraseSelected()));
+ createAction("move", SLOT(slotMoveSelected()));
+ createAction("resize", SLOT(slotResizeSelected()));
+ createAction("chord_mode", SLOT(slotUpdateInsertModeStatus()));
+ createAction("toggle_step_by_step", SLOT(slotToggleStepByStep()));
+ createAction("quantize", SLOT(slotTransformsQuantize()));
+ createAction("repeat_quantize", SLOT(slotTransformsRepeatQuantize()));
+ createAction("collapse_notes", SLOT(slotTransformsCollapseNotes()));
+ createAction("legatoize", SLOT(slotTransformsLegato()));
+ createAction("velocity_up", SLOT(slotVelocityUp()));
+ createAction("velocity_down", SLOT(slotVelocityDown()));
+ createAction("set_to_current_velocity", SLOT(slotSetVelocitiesToCurrent()));
+ createAction("set_velocities", SLOT(slotSetVelocities()));
+ createAction("trigger_segment", SLOT(slotTriggerSegment()));
+ createAction("remove_trigger", SLOT(slotRemoveTriggers()));
+ createAction("select_all", SLOT(slotSelectAll()));
+ createAction("delete", SLOT(slotEditDelete()));
+ createAction("cursor_back", SLOT(slotStepBackward()));
+ createAction("cursor_forward", SLOT(slotStepForward()));
+ createAction("cursor_back_bar", SLOT(slotJumpBackward()));
+ createAction("cursor_forward_bar", SLOT(slotJumpForward()));
+ createAction("extend_selection_backward", SLOT(slotExtendSelectionBackward()));
+ createAction("extend_selection_forward", SLOT(slotExtendSelectionForward()));
+ createAction("extend_selection_backward_bar", SLOT(slotExtendSelectionBackwardBar()));
+ createAction("extend_selection_forward_bar", SLOT(slotExtendSelectionForwardBar()));
+ createAction("cursor_start", SLOT(slotJumpToStart()));
+ createAction("cursor_end", SLOT(slotJumpToEnd()));
+ createAction("cursor_to_playback_pointer", SLOT(slotJumpCursorToPlayback()));
+ //&&& NB Play has two shortcuts (Enter and Ctrl+Return) -- need to
+ // ensure both get carried across somehow
+ createAction("play", SIGNAL(play()));
+ createAction("stop", SIGNAL(stop()));
+ createAction("playback_pointer_back_bar", SIGNAL(rewindPlayback()));
+ createAction("playback_pointer_forward_bar", SIGNAL(fastForwardPlayback()));
+ createAction("playback_pointer_start", SIGNAL(rewindPlaybackToBeginning()));
+ createAction("playback_pointer_end", SIGNAL(fastForwardPlaybackToEnd()));
+ createAction("playback_pointer_to_cursor", SLOT(slotJumpPlaybackToCursor()));
+ createAction("toggle_solo", SLOT(slotToggleSolo()));
+ createAction("toggle_tracking", SLOT(slotToggleTracking()));
+ createAction("panic", SIGNAL(panic()));
+ createAction("preview_selection", SLOT(slotPreviewSelection()));
+ createAction("clear_loop", SLOT(slotClearLoop()));
+ createAction("clear_selection", SLOT(slotClearSelection()));
+ createAction("filter_selection", SLOT(slotFilterSelection()));
+
+ timeT crotchetDuration = Note(Note::Crotchet).getDuration();
+ m_snapValues.clear();
+ m_snapValues.push_back(SnapGrid::NoSnap);
+ m_snapValues.push_back(SnapGrid::SnapToUnit);
+ m_snapValues.push_back(crotchetDuration / 16);
+ m_snapValues.push_back(crotchetDuration / 12);
+ m_snapValues.push_back(crotchetDuration / 8);
+ m_snapValues.push_back(crotchetDuration / 6);
+ m_snapValues.push_back(crotchetDuration / 4);
+ m_snapValues.push_back(crotchetDuration / 3);
+ m_snapValues.push_back(crotchetDuration / 2);
+ m_snapValues.push_back((crotchetDuration * 3) / 4);
+ m_snapValues.push_back(crotchetDuration);
+ m_snapValues.push_back((crotchetDuration * 3) / 2);
+ m_snapValues.push_back(crotchetDuration * 2);
+ m_snapValues.push_back(SnapGrid::SnapToBeat);
+ m_snapValues.push_back(SnapGrid::SnapToBar);
+
+ for (unsigned int i = 0; i < m_snapValues.size(); i++) {
+
+ timeT d = m_snapValues[i];
+
+ if (d == SnapGrid::NoSnap) {
+ createAction("snap_none", SLOT(slotSetSnapFromAction()));
+ } else if (d == SnapGrid::SnapToUnit) {
+ } else if (d == SnapGrid::SnapToBeat) {
+ createAction("snap_beat", SLOT(slotSetSnapFromAction()));
+ } else if (d == SnapGrid::SnapToBar) {
+ createAction("snap_bar", SLOT(slotSetSnapFromAction()));
+ } else {
+ QString actionName = QString("snap_%1").arg(int((crotchetDuration * 4) / d));
+ if (d == (crotchetDuration * 3) / 4) actionName = "snap_dotted_8";
+ if (d == (crotchetDuration * 3) / 2) actionName = "snap_dotted_4";
+ createAction(actionName, SLOT(slotSetSnapFromAction()));
+ }
+ }
+
+ createAction("show_inst_parameters", SLOT(slotDockParametersBack()));
+ createAction("show_chords_ruler", SLOT(slotToggleChordsRuler()));
+ createAction("show_tempo_ruler", SLOT(slotToggleTempoRuler()));
+}
+
+}
+
+#include "NewMatrixView.moc"
Added: branches/qt4-graphicsview/src/gui/editors/matrix/NewMatrixView.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/NewMatrixView.h (rev 0)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/NewMatrixView.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -0,0 +1,61 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
+
+/*
+ Rosegarden
+ A MIDI and audio sequencer and musical notation editor.
+ Copyright 2000-2009 the Rosegarden development team.
+
+ Other copyrights also apply to some parts of this work. Please
+ see the AUTHORS file and individual file headers for details.
+
+ 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. See the file
+ COPYING included with this distribution for more information.
+*/
+
+#ifndef _RG_NEW_MATRIX_VIEW_H_
+#define _RG_NEW_MATRIX_VIEW_H_
+
+#include <vector>
+#include <QMainWindow>
+
+#include "base/Event.h"
+
+#include "gui/general/ActionFileClient.h"
+
+class QWidget;
+
+namespace Rosegarden
+{
+
+class RosegardenGUIDoc;
+class MatrixWidget;
+class Segment;
+class CommandRegistry;
+
+class NewMatrixView : public QMainWindow, public ActionFileClient
+{
+ Q_OBJECT
+
+public:
+ NewMatrixView(RosegardenGUIDoc *doc,
+ std::vector<Segment *> segments,
+ bool drumMode,
+ QWidget *parent = 0);
+
+ virtual ~NewMatrixView();
+
+private:
+ MatrixWidget *m_matrixWidget;
+ CommandRegistry *m_commandRegistry;
+
+ void setupActions();
+
+ std::vector<timeT> m_snapValues;
+};
+
+}
+
+#endif
Modified: branches/qt4-graphicsview/src/gui/editors/matrix/PianoKeyboard.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/PianoKeyboard.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/PianoKeyboard.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -23,7 +23,7 @@
#include "gui/general/MidiPitchLabel.h"
#include "gui/rulers/PitchRuler.h"
#include "MatrixStaff.h"
-#include "MatrixView.h"
+//!!!#include "MatrixView.h"
#include <QColor>
#include <QCursor>
@@ -244,6 +244,7 @@
//
// RWB (20040220)
//
+/*!!!
MatrixView *matrixView = dynamic_cast<MatrixView*>(topLevelWidget());
if (matrixView) {
MatrixStaff *staff = matrixView->getStaff(0);
@@ -252,7 +253,7 @@
drawHoverNote(staff->getHeightAtCanvasCoords(e->x(), e->y()));
}
}
-
+*/
if (e->state() & Qt::LeftButton) {
if (m_selecting)
emit keySelected(e->y(), true);
Deleted: branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixDiamond.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixDiamond.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixDiamond.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,79 +0,0 @@
-/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
-
-/*
- Rosegarden
- A MIDI and audio sequencer and musical notation editor.
- Copyright 2000-2009 the Rosegarden development team.
-
- Other copyrights also apply to some parts of this work. Please
- see the AUTHORS file and individual file headers for details.
-
- 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. See the file
- COPYING included with this distribution for more information.
-*/
-
-
-#include "MatrixElement.h"
-
-#include <Q3Canvas>
-
-#include "QCanvasMatrixDiamond.h"
-#include "QCanvasMatrixRectangle.h"
-
-#include <QPainter>
-#include <QPoint>
-#include <QPolygon>
-#include <Q3PointArray>
-//#include <qpointarray.h>
-
-
-namespace Rosegarden
-{
-
-QCanvasMatrixDiamond::QCanvasMatrixDiamond(MatrixElement &n,
- Q3Canvas* canvas) :
- QCanvasMatrixRectangle(n, canvas)
-{}
-
-QCanvasMatrixDiamond::~QCanvasMatrixDiamond()
-{
- hide();
-}
-
-Q3PointArray QCanvasMatrixDiamond::areaPoints() const
-{
- Q3PointArray pa(4);
- int pw = (pen().width() + 1) / 2;
- if ( pw < 1 )
- pw = 1;
- if ( pen() == Qt::NoPen) //@@@ check: was NoPen
- pw = 0;
- pa[0] = QPoint((int)x() - height() / 2 - pw, (int)y() - pw);
- pa[1] = pa[0] + QPoint(height() + pw * 2, 0);
- pa[2] = pa[1] + QPoint(0, height() + pw * 2);
- pa[3] = pa[0] + QPoint(0, height() + pw * 2);
- return pa;
-}
-
-void QCanvasMatrixDiamond::drawShape(QPainter & p)
-{
- p.save();
- p.setWorldXForm(false);
-
- Q3PointArray pa(4);
- int q = height() / 2 + 2;
- QPoint mapPos = p.worldMatrix().map(QPoint(int(x()), int(y())));
-
- pa[0] = QPoint(mapPos.x(), mapPos.y() - 3);
- pa[1] = QPoint(mapPos.x() + q, mapPos.y() - 3 + q);
- pa[2] = pa[0] + QPoint(0, q * 2);
- pa[3] = pa[1] - QPoint(q * 2, 0);
- p.drawConvexPolygon(pa);
-
- p.restore();
-}
-
-}
Deleted: branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixDiamond.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixDiamond.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixDiamond.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,59 +0,0 @@
-
-/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
-
-/*
- Rosegarden
- A MIDI and audio sequencer and musical notation editor.
- Copyright 2000-2009 the Rosegarden development team.
-
- Other copyrights also apply to some parts of this work. Please
- see the AUTHORS file and individual file headers for details.
-
- 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. See the file
- COPYING included with this distribution for more information.
-*/
-
-#ifndef _RG_QCANVASMATRIXDIAMOND_H_
-#define _RG_QCANVASMATRIXDIAMOND_H_
-
-#include "QCanvasMatrixRectangle.h"
-
-#include <Q3Canvas>
-#include <QPolygon>
-#include <Q3PointArray>
-//#include <qpointarray.h>
-
-
-class QPainter;
-class Q3Canvas;
-
-
-namespace Rosegarden
-{
-
-class MatrixElement;
-
-
-/**
- * A Q3Canvas diamond shape referencing a MatrixElement
- */
-class QCanvasMatrixDiamond : public QCanvasMatrixRectangle
-{
-public:
- QCanvasMatrixDiamond(MatrixElement&, Q3Canvas *);
- ~QCanvasMatrixDiamond();
-
- Q3PointArray areaPoints() const;
-// QPolygon areaPoints() const;
-
-protected:
- void drawShape(QPainter &);
-};
-
-
-}
-
-#endif
Deleted: branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixRectangle.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixRectangle.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixRectangle.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,39 +0,0 @@
-/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
-
-/*
- Rosegarden
- A MIDI and audio sequencer and musical notation editor.
- Copyright 2000-2009 the Rosegarden development team.
-
- Other copyrights also apply to some parts of this work. Please
- see the AUTHORS file and individual file headers for details.
-
- 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. See the file
- COPYING included with this distribution for more information.
-*/
-
-
-#include <Q3Canvas>
-#include <Q3CanvasRectangle>
-#include "QCanvasMatrixRectangle.h"
-
-#include "MatrixElement.h"
-#include <Q3Canvas>
-
-
-namespace Rosegarden
-{
-
-QCanvasMatrixRectangle::QCanvasMatrixRectangle(MatrixElement& n,
- Q3Canvas* canvas)
- : Q3CanvasRectangle(canvas),
- m_matrixElement(n)
-{}
-
-QCanvasMatrixRectangle::~QCanvasMatrixRectangle()
-{}
-
-}
Deleted: branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixRectangle.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixRectangle.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/matrix/QCanvasMatrixRectangle.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -1,55 +0,0 @@
-
-/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
-
-/*
- Rosegarden
- A MIDI and audio sequencer and musical notation editor.
- Copyright 2000-2009 the Rosegarden development team.
-
- Other copyrights also apply to some parts of this work. Please
- see the AUTHORS file and individual file headers for details.
-
- 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. See the file
- COPYING included with this distribution for more information.
-*/
-
-#ifndef _RG_QCANVASMATRIXRECTANGLE_H_
-#define _RG_QCANVASMATRIXRECTANGLE_H_
-
-#include <Q3Canvas>
-#include <Q3CanvasRectangle>
-#include <Q3Canvas>
-
-
-namespace Rosegarden
-{
-
-class MatrixElement;
-
-
-/**
- * A Q3CanvasRectangle referencing a MatrixElement
- */
-class QCanvasMatrixRectangle : public Q3CanvasRectangle
-{
-public:
- QCanvasMatrixRectangle(MatrixElement&, Q3Canvas*);
-
- virtual ~QCanvasMatrixRectangle();
-
- MatrixElement& getMatrixElement() { return m_matrixElement; }
-
-protected:
- //--------------- Data members ---------------------------------
-
- MatrixElement& m_matrixElement;
-
-};
-
-
-}
-
-#endif
Modified: branches/qt4-graphicsview/src/gui/editors/notation/NotationScene.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/notation/NotationScene.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/notation/NotationScene.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -84,7 +84,7 @@
// more dubious:
- void handleEventRemoved(Event *) { }
+ void handleEventRemoved(Event *) { }//!!! tell tools, in case they have m_someEvent stored
bool areAnnotationsVisible() { return true; }
bool areLilyPondDirectivesVisible() { return true; }
Modified: branches/qt4-graphicsview/src/gui/editors/notation/NotationStaff.h
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/notation/NotationStaff.h 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/notation/NotationStaff.h 2009-01-30 12:54:49 UTC (rev 9833)
@@ -54,7 +54,7 @@
class NotationStaff : public ViewSegment,
public StaffLayout,
- public ProgressReporter
+ public ProgressReporter //!!! maybe remove if we can make this fast enough
{
public:
NotationStaff(NotationScene *, Segment *, SnapGrid *,
Modified: branches/qt4-graphicsview/src/gui/editors/notation/NotationTool.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/notation/NotationTool.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/notation/NotationTool.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -18,7 +18,6 @@
#include "NotationTool.h"
#include "misc/Debug.h"
-#include "gui/general/EditTool.h"
#include "NotationWidget.h"
#include "misc/Strings.h"
Modified: branches/qt4-graphicsview/src/gui/editors/notation/NotationWidget.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/editors/notation/NotationWidget.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/editors/notation/NotationWidget.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -50,8 +50,8 @@
m_hpanner->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_hpanner->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_hpanner->setInteractive(false);
- m_hpanner->setRenderHints(QPainter::TextAntialiasing |
- QPainter::SmoothPixmapTransform);
+// m_hpanner->setRenderHints(QPainter::TextAntialiasing |
+// QPainter::SmoothPixmapTransform);
layout->addWidget(m_hpanner, 1, 0);
m_toolBox = new NotationToolBox(this);
Modified: branches/qt4-graphicsview/src/gui/rulers/PercussionPitchRuler.cpp
===================================================================
--- branches/qt4-graphicsview/src/gui/rulers/PercussionPitchRuler.cpp 2009-01-30 05:49:15 UTC (rev 9832)
+++ branches/qt4-graphicsview/src/gui/rulers/PercussionPitchRuler.cpp 2009-01-30 12:54:49 UTC (rev 9833)
@@ -152,7 +152,7 @@
void PercussionPitchRuler::mouseMoveEvent(QMouseEvent* e)
{
// ugh
-
+/*!!!
MatrixView *matrixView = dynamic_cast<MatrixView*>(topLevelWidget());
if (matrixView) {
MatrixStaff *staff = matrixView->getStaff(0);
@@ -160,7 +160,7 @@
drawHoverNote(staff->getHeightAtCanvasCoords(e->x(), e->y()));
}
}
-
+*/
if (m_mouseDown)
if (m_selecting)
emit keySelected(e->y(), true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|