On Thursday 12 Jun 2003 8:07 pm, Chris Cannam wrote:
> Anyway, I'm half way through this change, but what I'll do is send
> a patch to the list when I'm finished rather than committing
> anything. Then we can debate the pros and cons of that.

Attached.

I think this contains a fix to the quantize crash as well, and I will 
commit that separately once I've established that it actually does 
fix it on its own.  I'm still seeing a few peculiar artifacts in some 
notation (parts of notes displayed at the extreme left of the staff) 
that I'm pretty sure also weren't there until a few days ago, but 
they might not be related.


Chris
? autom4te.cache
? stamp-h1
? base/test/colour
? base/test/colour.output
? base/test/pitch
? base/test/test
? base/test/thread
? base/test/utf8
? docs/web/site/faq.html
? docs/web/site/i18n.html
? docs/web/site/rgd-HOWTO.html
? gui/autoload.xml
? gui/docs/de/Makefile
? gui/docs/de/Makefile.in
? gui/library/Alesis-QS6.xml
? gui/library/GM.xml
? gui/library/GS.xml
? gui/library/Kurzweil-ME1.xml
? gui/library/Roland-SC-33.xml
? gui/library/Yamaha-PSR550.xml
? gui/library/all-numbers.xml
? gui/library/raw-numbers.xml
? gui/testfiles/GID.rg
? gui/testfiles/GID.xml
? gui/testfiles/autoload.xml
? gui/testfiles/feta-din8.600pk
? gui/testfiles/feta11.600pk
? gui/testfiles/glazunov-broken.rg
? gui/testfiles/glazunov.dvi
? gui/testfiles/glazunov.ly
? gui/testfiles/glazunov.mup
? gui/testfiles/glazunov.ps
? gui/testfiles/glazunov.xml
? gui/testfiles/glazunov2.xml
? gui/testfiles/audio/8bit-cymbal.wav.pk
? gui/testfiles/audio/909-hats.wav.pk
? gui/testfiles/audio/909-kick.wav.pk
? gui/testfiles/audio/beep.wav.pk
? sound/test
Index: base/Segment.C
===================================================================
RCS file: /cvsroot/rosegarden/base/Segment.C,v
retrieving revision 1.176
diff -c -r1.176 Segment.C
*** base/Segment.C      3 Jun 2003 14:46:33 -0000       1.176
--- base/Segment.C      12 Jun 2003 21:22:56 -0000
***************
*** 863,869 ****
        m_clefKeyList->insert(e);
      }
  
!     for (ObserverSet::iterator i = m_observers.begin();
         i != m_observers.end(); ++i) {
        (*i)->eventAdded(this, e);
      }
--- 863,869 ----
        m_clefKeyList->insert(e);
      }
  
!     for (ObserverSet::const_iterator i = m_observers.begin();
         i != m_observers.end(); ++i) {
        (*i)->eventAdded(this, e);
      }
***************
*** 880,886 ****
        }
      }
      
!     for (ObserverSet::iterator i = m_observers.begin();
         i != m_observers.end(); ++i) {
        (*i)->eventRemoved(this, e);
      }
--- 880,886 ----
        }
      }
      
!     for (ObserverSet::const_iterator i = m_observers.begin();
         i != m_observers.end(); ++i) {
        (*i)->eventRemoved(this, e);
      }
***************
*** 890,896 ****
  void
  Segment::notifyEndMarkerChange(bool shorten) const
  {
!     for (ObserverSet::iterator i = m_observers.begin();
         i != m_observers.end(); ++i) {
        (*i)->endMarkerTimeChanged(this, shorten);
      }
--- 890,896 ----
  void
  Segment::notifyEndMarkerChange(bool shorten) const
  {
!     for (ObserverSet::const_iterator i = m_observers.begin();
         i != m_observers.end(); ++i) {
        (*i)->endMarkerTimeChanged(this, shorten);
      }
Index: base/Segment.h
===================================================================
RCS file: /cvsroot/rosegarden/base/Segment.h,v
retrieving revision 1.126
diff -c -r1.126 Segment.h
*** base/Segment.h      28 May 2003 21:22:13 -0000      1.126
--- base/Segment.h      12 Jun 2003 21:22:56 -0000
***************
*** 472,482 ****
      };
  
  
!     /// For use by SegmentObserver objects like Composition & ViewElementsManager
!     void    addObserver(SegmentObserver *obs) { m_observers.insert(obs); }
  
!     /// For use by SegmentObserver objects like Composition & ViewElementsManager
!     void removeObserver(SegmentObserver *obs) { m_observers.erase (obs); }
  
  
      //////
--- 472,482 ----
      };
  
  
!     /// For use by SegmentObserver objects like Composition & Staff
!     void    addObserver(SegmentObserver *obs) { m_observers.push_back(obs); }
  
!     /// For use by SegmentObserver objects like Composition & Staff
!     void removeObserver(SegmentObserver *obs) { m_observers.remove(obs); }
  
  
      //////
***************
*** 535,541 ****
  
  private: // stuff to support SegmentObservers
  
!     typedef std::set<SegmentObserver *> ObserverSet;
      ObserverSet m_observers;
  
      void notifyAdd(Event *) const;
--- 535,541 ----
  
  private: // stuff to support SegmentObservers
  
!     typedef std::list<SegmentObserver *> ObserverSet;
      ObserverSet m_observers;
  
      void notifyAdd(Event *) const;
Index: base/Staff.C
===================================================================
RCS file: /cvsroot/rosegarden/base/Staff.C,v
retrieving revision 1.1
diff -c -r1.1 Staff.C
*** base/Staff.C        1 Jun 2003 13:10:23 -0000       1.1
--- base/Staff.C        12 Jun 2003 21:22:56 -0000
***************
*** 77,87 ****
  ViewElementList::iterator
  Staff::findEvent(Event *e)
  {
!     ViewElement dummy(e);
  
      std::pair<ViewElementList::iterator,
              ViewElementList::iterator>
!         r = m_viewElementList->equal_range(&dummy);
  
      for (ViewElementList::iterator i = r.first; i != r.second; ++i) {
          if ((*i)->event() == e) {
--- 77,101 ----
  ViewElementList::iterator
  Staff::findEvent(Event *e)
  {
!     // Note that we have to create this using the virtual
!     // makeViewElement, because the result of equal_range depends on
!     // the value of the view absolute time for the element, which
!     // depends on the particular subclass of ViewElement in use.
! 
!     //!!! (This is also why this method has to be here and not in
!     // ViewElementList -- ViewElementList has no equivalent of
!     // makeViewElement.  Possibly things like NotationElementList
!     // should be subclasses of ViewElementList that implement
!     // makeViewElement instead of having makeViewElement in Staff, but
!     // that's for another day.)
! 
!     ViewElement *dummy = makeViewElement(e);
  
      std::pair<ViewElementList::iterator,
              ViewElementList::iterator>
!         r = m_viewElementList->equal_range(dummy);
! 
!     delete dummy;
  
      for (ViewElementList::iterator i = r.first; i != r.second; ++i) {
          if ((*i)->event() == e) {
Index: base/Staff.h
===================================================================
RCS file: /cvsroot/rosegarden/base/Staff.h,v
retrieving revision 1.29
diff -c -r1.29 Staff.h
*** base/Staff.h        1 Jun 2003 10:20:21 -0000       1.29
--- base/Staff.h        12 Jun 2003 21:22:56 -0000
***************
*** 70,75 ****
--- 70,82 ----
      const Segment &getSegment() const { return m_segment; }
  
      /**
+      * Return an iterator pointing to the element wrapped by the
+      * given event, or the ViewElementList's end() if absent.
+      * For implementation reasons this cannot be in ViewElementList.
+      */
+     ViewElementList::iterator findEvent(Rosegarden::Event *);
+ 
+     /**
       * SegmentObserver method - called after the event has been added to
       * the segment
       */
***************
*** 100,106 ****
  
      Segment &m_segment;
      ViewElementList *m_viewElementList;
-     ViewElementList::iterator findEvent(Rosegarden::Event *);
  
  private: // not provided
      Staff(const Staff &);
--- 107,112 ----
Index: base/ViewElement.C
===================================================================
RCS file: /cvsroot/rosegarden/base/ViewElement.C,v
retrieving revision 1.17
diff -c -r1.17 ViewElement.C
*** base/ViewElement.C  1 Jun 2003 10:20:21 -0000       1.17
--- base/ViewElement.C  12 Jun 2003 21:22:56 -0000
***************
*** 28,35 ****
  extern const int MIN_SUBORDERING;
  
  ViewElement::ViewElement(Event *e) :
-     m_layoutX(0.0),
-     m_layoutY(0.0),
      m_event(e)
  {
      // nothing
--- 28,33 ----
***************
*** 61,77 ****
  }
  
  void
- ViewElementList::insert(ViewElement* el)
- {
-     set_type::insert(el);
-     notifyAdd(el);
- }
- 
- void
  ViewElementList::erase(iterator pos)
  {
-     notifyRemove(*pos);
- 
      delete *pos;
      set_type::erase(pos);
  }
--- 59,66 ----
***************
*** 80,86 ****
  ViewElementList::erase(iterator from, iterator to)
  {
      for (iterator i = from; i != to; ++i) {
-         notifyRemove(*i);
          delete *i;
      }
  
--- 69,74 ----
***************
*** 152,178 ****
      }
      return i;
  }
- 
- void
- ViewElementList::notifyAdd(ViewElement *e) const
- {
-     for (ObserverSet::const_iterator i = m_observers.begin();
-        i != m_observers.end(); ++i) {
-       (*i)->elementAdded(e);
-     }
- }
- 
- void
- ViewElementList::notifyRemove(ViewElement *e) const
- {
-     for (ObserverSet::const_iterator i = m_observers.begin();
-        i != m_observers.end(); ++i) {
-       (*i)->elementRemoved(e);
-     }
- }
- 
- 
- 
   
  }
  
--- 140,145 ----
Index: base/ViewElement.h
===================================================================
RCS file: /cvsroot/rosegarden/base/ViewElement.h,v
retrieving revision 1.26
diff -c -r1.26 ViewElement.h
*** base/ViewElement.h  1 Jun 2003 10:20:21 -0000       1.26
--- base/ViewElement.h  12 Jun 2003 21:22:56 -0000
***************
*** 51,95 ****
      virtual timeT getViewAbsoluteTime() const  { return event()->getAbsoluteTime(); }
      virtual timeT getViewDuration() const      { return event()->getDuration();     }
  
-     /**
-      * Returns the X coordinate of the element, as computed by the
-      * layout. This is not the coordinate of the associated canvas
-      * item.
-      *
-      * @see getCanvasX()
-      */
-     virtual double getLayoutX() const   { return m_layoutX; }
- 
-     /**
-      * Returns the Y coordinate of the element, as computed by the
-      * layout. This is not the coordinate of the associated canvas
-      * item.
-      *
-      * @see getCanvasY()
-      */
-     virtual double getLayoutY() const   { return m_layoutY; }
- 
-     /**
-      * Sets the X coordinate which was computed by the layout engine
-      * @see getLayoutX()
-      */
-     virtual void   setLayoutX(double x) { m_layoutX = x; }
- 
-     /**
-      * Sets the Y coordinate which was computed by the layout engine
-      * @see getLayoutY()
-      */
-     virtual void   setLayoutY(double y) { m_layoutY = y; }
- 
      void dump(std::ostream&) const;
  
      friend bool operator<(const ViewElement&, const ViewElement&);
  
  protected:
      ViewElement(Event *);
- 
-     double m_layoutX;
-     double m_layoutY;
      
      Event *m_event;
  };
--- 51,62 ----
***************
*** 104,111 ****
      }
  };
  
- class ViewElementListObserver;
- 
  /**
   * This class owns the objects its items are pointing at.
   *
--- 71,76 ----
***************
*** 120,126 ****
      ViewElementList() : set_type() { }
      virtual ~ViewElementList();
  
-     void insert(ViewElement *);
      void erase(iterator i);
      void erase(iterator from, iterator to);
      void eraseSingle(ViewElement *);
--- 85,90 ----
***************
*** 145,171 ****
       * or before the given absolute time
       */
      iterator findNearestTime(timeT time) const;
- 
-     void addObserver   (ViewElementListObserver *obs) { m_observers.push_back(obs); }
-     void removeObserver(ViewElementListObserver *obs) { m_observers.remove(obs); }
- 
- protected:
-     void notifyAdd(ViewElement *) const;
-     void notifyRemove(ViewElement *) const;
- 
-     typedef std::list<ViewElementListObserver*> ObserverSet;
-     ObserverSet m_observers;
- 
  };
- 
- 
- class ViewElementListObserver
- {
- public:
-     virtual void elementAdded(ViewElement *) = 0;
-     virtual void elementRemoved(ViewElement *) = 0;
- };
- 
  
  }
  
--- 109,115 ----
Index: gui/controlruler.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/controlruler.cpp,v
retrieving revision 1.21
diff -c -r1.21 controlruler.cpp
*** gui/controlruler.cpp        9 Jun 2003 17:53:10 -0000       1.21
--- gui/controlruler.cpp        12 Jun 2003 21:22:56 -0000
***************
*** 34,40 ****
  #include "colours.h"
  #include "rosestrings.h"
  #include "rosedebug.h"
! #include "Segment.h"
  #include "RulerScale.h"
  #include "velocitycolour.h"
  
--- 34,40 ----
  #include "colours.h"
  #include "rosestrings.h"
  #include "rosedebug.h"
! #include "Staff.h"
  #include "RulerScale.h"
  #include "velocitycolour.h"
  
***************
*** 82,88 ****
  {
  public:
      ControlItem(ControlRuler* controlRuler,
!                 ViewElement* el, ViewElement* nextEl = 0);
  
      ViewElement* getViewElement() { return m_viewElement; }
  
--- 82,89 ----
  {
  public:
      ControlItem(ControlRuler* controlRuler,
!                 ViewElement* el,
!               int x, int width = DefaultWidth);
  
      ViewElement* getViewElement() { return m_viewElement; }
  
***************
*** 124,139 ****
  const unsigned int ControlItem::DefaultWidth    = 20;
  
  ControlItem::ControlItem(ControlRuler* ruler, ViewElement *el,
!                          ViewElement *nextEl)
      : QCanvasRectangle(ruler->canvas()),
        m_controlRuler(ruler),
        m_viewElement(el)
  {
!     setWidth(nextEl ? int(nextEl->getLayoutX() - el->getLayoutX()) : DefaultWidth);
      setPen(QPen(Qt::black, BorderThickness));
      setBrush(Qt::blue);
  
!     setX(el->getLayoutX());
      setY(canvas()->height());
      updateFromValue();
      RG_DEBUG << "ControlItem x = " << x() << " - y = " << y() << endl;
--- 125,140 ----
  const unsigned int ControlItem::DefaultWidth    = 20;
  
  ControlItem::ControlItem(ControlRuler* ruler, ViewElement *el,
!                        int xx, int width)
      : QCanvasRectangle(ruler->canvas()),
        m_controlRuler(ruler),
        m_viewElement(el)
  {
!     setWidth(width);
      setPen(QPen(Qt::black, BorderThickness));
      setBrush(Qt::blue);
  
!     setX(xx);
      setY(canvas()->height());
      updateFromValue();
      RG_DEBUG << "ControlItem x = " << x() << " - y = " << y() << endl;
***************
*** 279,291 ****
  const int ControlRuler::ItemHeightRange = 64;
  
  
! ControlRuler::ControlRuler(Rosegarden::ViewElementList* viewElementList,
                             Rosegarden::RulerScale* rulerScale,
                             QScrollBar* hsb,
                             QCanvas* c, QWidget* parent,
                             const char* name, WFlags f) :
      RosegardenCanvasView(hsb, c, parent, name, f),
!     m_viewElementList(viewElementList),
      m_rulerScale(rulerScale),
      m_currentItem(0),
      m_tool(0),
--- 280,292 ----
  const int ControlRuler::ItemHeightRange = 64;
  
  
! ControlRuler::ControlRuler(Rosegarden::Staff* staff,
                             Rosegarden::RulerScale* rulerScale,
                             QScrollBar* hsb,
                             QCanvas* c, QWidget* parent,
                             const char* name, WFlags f) :
      RosegardenCanvasView(hsb, c, parent, name, f),
!     m_staff(staff),
      m_rulerScale(rulerScale),
      m_currentItem(0),
      m_tool(0),
***************
*** 295,301 ****
      m_selector(new ControlSelector(this)),
      m_selectionRect(new QCanvasRectangle(canvas()))
  {
!     m_viewElementList->addObserver(this);
      setControlTool(new TestTool);
      m_selectionRect->setPen(Qt::red);
  
--- 296,302 ----
      m_selector(new ControlSelector(this)),
      m_selectionRect(new QCanvasRectangle(canvas()))
  {
!     m_staff->getSegment().addObserver(this);
      setControlTool(new TestTool);
      m_selectionRect->setPen(Qt::red);
  
***************
*** 304,337 ****
      init();
  }
  
- 
  ControlRuler::~ControlRuler()
  {
!     m_viewElementList->removeObserver(this);
  }
  
  void ControlRuler::init()
  {
      ViewElementList::iterator j;
  
!     for(ViewElementList::iterator i = m_viewElementList->begin();
!         i != m_viewElementList->end(); ++i) {
  
!         j = i; ++j;
!         // also pass next element if there's one
!         //
!         ControlItem* controlItem = new ControlItem(this,
!                                                    *i, j != m_viewElementList->end() 
? *j : 0);
      }
  }
  
! void ControlRuler::elementAdded(ViewElement *el)
  {
!     RG_DEBUG << "ControlRuler::elementAdded()\n";
!     new ControlItem(this, el);
  }
  
! void ControlRuler::elementRemoved(ViewElement *el)
  {
      RG_DEBUG << "ControlRuler::elementRemoved(\n";
  
--- 305,350 ----
      init();
  }
  
  ControlRuler::~ControlRuler()
  {
!     m_staff->getSegment().removeObserver(this);
  }
  
  void ControlRuler::init()
  {
      ViewElementList::iterator j;
  
!     for (ViewElementList::iterator i = m_staff->getViewElementList()->begin();
!          i != m_staff->getViewElementList()->end(); ++i) {
  
!       double x = m_rulerScale->getXForTime((*i)->getViewAbsoluteTime());
!       ControlItem *controlItem = new ControlItem
!           (this, *i, int(x),
!            int(m_rulerScale->getXForTime((*i)->getViewAbsoluteTime() +
!                                          (*i)->getViewDuration()) - x));
      }
  }
  
! void ControlRuler::eventAdded(const Rosegarden::Segment *, Rosegarden::Event *e)
  {
!     RG_DEBUG << "ControlRuler::eventAdded()" << endl;
! 
!     // OK, this is not so good.  It works, because the staff precedes
!     // us in the segment's list of observers and so by the time this
!     // is called the staff has already wrapped the event (if it's
!     // going to).  Not exactly ideal though.
! 
!     Rosegarden::ViewElementList::iterator i = m_staff->findEvent(e);
!     if (i != m_staff->getViewElementList()->end()) {
!       double x = m_rulerScale->getXForTime((*i)->getViewAbsoluteTime());
!       new ControlItem
!           (this, *i, int(x),
!            int(m_rulerScale->getXForTime((*i)->getViewAbsoluteTime() +
!                                          (*i)->getViewDuration()) - x));
!     }
  }
  
! void ControlRuler::eventRemoved(const Rosegarden::Segment *, Rosegarden::Event *e)
  {
      RG_DEBUG << "ControlRuler::elementRemoved(\n";
  
***************
*** 339,345 ****
  
      for (QCanvasItemList::Iterator it=allItems.begin(); it!=allItems.end(); ++it) {
          if (ControlItem *item = dynamic_cast<ControlItem*>(*it)) {
!             if (item->getViewElement() == el) {
                  delete item;
                  break;
              }
--- 352,358 ----
  
      for (QCanvasItemList::Iterator it=allItems.begin(); it!=allItems.end(); ++it) {
          if (ControlItem *item = dynamic_cast<ControlItem*>(*it)) {
!             if (item->getViewElement()->event() == e) {
                  delete item;
                  break;
              }
***************
*** 347,352 ****
--- 360,368 ----
      }
  }
  
+ void ControlRuler::endMarkerTimeChanged(const Rosegarden::Segment *, bool)
+ {
+ }
  
  void
  ControlRuler::slotUpdate()
Index: gui/controlruler.h
===================================================================
RCS file: /cvsroot/rosegarden/gui/controlruler.h,v
retrieving revision 1.10
diff -c -r1.10 controlruler.h
*** gui/controlruler.h  9 Jun 2003 17:53:11 -0000       1.10
--- gui/controlruler.h  12 Jun 2003 21:22:57 -0000
***************
*** 25,31 ****
  
  #include <qstring.h>
  
! #include "ViewElement.h"
  
  #include "PropertyName.h"
  
--- 25,31 ----
  
  #include <qstring.h>
  
! #include "Segment.h"
  
  #include "PropertyName.h"
  
***************
*** 35,41 ****
  namespace Rosegarden
  {
      class RulerScale;
!     class Segment;
  }
  
  class QFont;
--- 35,41 ----
  namespace Rosegarden
  {
      class RulerScale;
!     class Staff;
  }
  
  class QFont;
***************
*** 50,63 ****
  /**
   * Property Control Ruler : edit range of event properties
   */
! class ControlRuler : public RosegardenCanvasView, public 
Rosegarden::ViewElementListObserver
  {
      Q_OBJECT
  
      friend class ControlItem;
  
  public:
!     ControlRuler(Rosegarden::ViewElementList*,
                   Rosegarden::RulerScale*,
                   QScrollBar* hsb,
                   QCanvas*,
--- 50,63 ----
  /**
   * Property Control Ruler : edit range of event properties
   */
! class ControlRuler : public RosegardenCanvasView, public Rosegarden::SegmentObserver
  {
      Q_OBJECT
  
      friend class ControlItem;
  
  public:
!     ControlRuler(Rosegarden::Staff*,
                   Rosegarden::RulerScale*,
                   QScrollBar* hsb,
                   QCanvas*,
***************
*** 76,84 ****
      void setMaxPropertyValue(int val) { m_maxPropertyValue = val; }
      int getMaxPropertyValue()         { return m_maxPropertyValue; }
  
!     // ViewElementListObserver interface
!     virtual void elementAdded(Rosegarden::ViewElement*);
!     virtual void elementRemoved(Rosegarden::ViewElement*);
  
      static const int DefaultRulerHeight;
      static const int MinItemHeight;
--- 76,85 ----
      void setMaxPropertyValue(int val) { m_maxPropertyValue = val; }
      int getMaxPropertyValue()         { return m_maxPropertyValue; }
  
!     // SegmentObserver interface
!     virtual void eventAdded(const Rosegarden::Segment *, Rosegarden::Event*);
!     virtual void eventRemoved(const Rosegarden::Segment *, Rosegarden::Event*);
!     virtual void endMarkerTimeChanged(const Rosegarden::Segment *, bool);
  
      static const int DefaultRulerHeight;
      static const int MinItemHeight;
***************
*** 104,111 ****
      void updateSelection();
  
  private:
!     Rosegarden::ViewElementList* m_viewElementList;
!     Rosegarden::RulerScale*      m_rulerScale;
  
      ControlItem* m_currentItem;
      QCanvasItemList m_selectedItems;
--- 105,112 ----
      void updateSelection();
  
  private:
!     Rosegarden::Staff*         m_staff;
!     Rosegarden::RulerScale*    m_rulerScale;
  
      ControlItem* m_currentItem;
      QCanvasItemList m_selectedItems;
Index: gui/editview.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/editview.cpp,v
retrieving revision 1.90
diff -c -r1.90 editview.cpp
*** gui/editview.cpp    9 Jun 2003 17:53:11 -0000       1.90
--- gui/editview.cpp    12 Jun 2003 21:22:57 -0000
***************
*** 152,158 ****
      m_controlBox->addWidget(w);
  }
  
! ControlRuler* EditView::makeControlRuler(Rosegarden::ViewElementList* 
viewElementList,
                                           Rosegarden::RulerScale* rulerScale)
  {
      if (m_controlRuler) return m_controlRuler;
--- 152,158 ----
      m_controlBox->addWidget(w);
  }
  
! ControlRuler* EditView::makeControlRuler(Rosegarden::Staff* staff,
                                           Rosegarden::RulerScale* rulerScale)
  {
      if (m_controlRuler) return m_controlRuler;
***************
*** 160,166 ****
      QCanvas* controlRulerCanvas = new QCanvas(this);
      QSize viewSize = getViewSize();
      controlRulerCanvas->resize(viewSize.width(), ControlRuler::DefaultRulerHeight); 
// TODO - keep it in sync with main canvas size
!     m_controlRuler = new ControlRuler(viewElementList, rulerScale,
                                        m_horizontalScrollBar,
                                        controlRulerCanvas, getCentralFrame());
  
--- 160,166 ----
      QCanvas* controlRulerCanvas = new QCanvas(this);
      QSize viewSize = getViewSize();
      controlRulerCanvas->resize(viewSize.width(), ControlRuler::DefaultRulerHeight); 
// TODO - keep it in sync with main canvas size
!     m_controlRuler = new ControlRuler(staff, rulerScale,
                                        m_horizontalScrollBar,
                                        controlRulerCanvas, getCentralFrame());
  
Index: gui/editview.h
===================================================================
RCS file: /cvsroot/rosegarden/gui/editview.h,v
retrieving revision 1.62
diff -c -r1.62 editview.h
*** gui/editview.h      1 Jun 2003 10:20:22 -0000       1.62
--- gui/editview.h      12 Jun 2003 21:22:57 -0000
***************
*** 33,39 ****
  #include "Event.h"
  #include "Selection.h"
  
! namespace Rosegarden { class Segment; class ViewElementList; class RulerScale; }
  
  class QCanvasItem;
  class QScrollView;
--- 33,41 ----
  #include "Event.h"
  #include "Selection.h"
  
! namespace Rosegarden {
!     class Staff; class Segment; class ViewElementList; class RulerScale;
! }
  
  class QCanvasItem;
  class QScrollView;
***************
*** 193,199 ****
      /**
       * Add control ruler
       */
!     ControlRuler* makeControlRuler(Rosegarden::ViewElementList* viewElementList,
                                     Rosegarden::RulerScale* rulerScale);
  
      /**
--- 195,201 ----
      /**
       * Add control ruler
       */
!     ControlRuler* makeControlRuler(Rosegarden::Staff* staff,
                                     Rosegarden::RulerScale* rulerScale);
  
      /**
Index: gui/matrixelement.h
===================================================================
RCS file: /cvsroot/rosegarden/gui/matrixelement.h,v
retrieving revision 1.8
diff -c -r1.8 matrixelement.h
*** gui/matrixelement.h 1 Jun 2003 10:20:22 -0000       1.8
--- gui/matrixelement.h 12 Jun 2003 21:22:57 -0000
***************
*** 57,62 ****
--- 57,88 ----
      void setCanvas(QCanvas* c);
  
      /**
+      * Returns the layout x coordinate of the element (not the same
+      * as the canvas x coordinate, which is assigned by the staff
+      * depending on its own location)
+      */
+     double getLayoutX() const { return m_layoutX; }
+ 
+     /**
+      * Returns the layout y coordinate of the element (not the same
+      * as the canvas y coordinate, which is assigned by the staff
+      * depending on its own location)
+      */
+     double getLayoutY() const { return m_layoutY; }
+ 
+     /**
+      * Sets the layout x coordinate of the element (to be translated
+      * to canvas coordinate according to the staff's location)
+      */
+     void setLayoutX(double x) { m_layoutX = x; }
+ 
+     /**
+      * Sets the layout y coordinate of the element (to be translated
+      * to canvas coordinate according to the staff's location)
+      */
+     void setLayoutY(double y) { m_layoutY = y; }
+ 
+     /**
       * Returns the actual x coordinate of the element on the canvas
       */
      double getCanvasX() const { return m_canvasRect->x(); }
***************
*** 102,107 ****
--- 128,136 ----
      //--------------- Data members ---------------------------------
  
      QCanvasMatrixRectangle* m_canvasRect;
+ 
+     double m_layoutX;
+     double m_layoutY;
  };
  
  
Index: gui/matrixhlayout.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/matrixhlayout.cpp,v
retrieving revision 1.25
diff -c -r1.25 matrixhlayout.cpp
*** gui/matrixhlayout.cpp       1 Jun 2003 10:20:22 -0000       1.25
--- gui/matrixhlayout.cpp       12 Jun 2003 21:22:57 -0000
***************
*** 143,158 ****
  
      while (i != endItr) {
  
!       (*i)->setLayoutX(((*i)->getViewAbsoluteTime() - startPosition)
!                           * staff.getTimeScaleFactor());
  
        double width = (*i)->getViewDuration() * staff.getTimeScaleFactor();
!       static_cast<MatrixElement*>((*i))->setWidth((int)width + 2); // fiddle factor
        
        if (isFullScan) {
!           m_totalWidth = (*i)->getLayoutX() + width;
        } else {
!           m_totalWidth = std::max(m_totalWidth, (*i)->getLayoutX() + width);
        }
            
        ++i;
--- 143,160 ----
  
      while (i != endItr) {
  
!       MatrixElement *el = static_cast<MatrixElement *>(*i);
! 
!       el->setLayoutX((el->getViewAbsoluteTime() - startPosition)
!                      * staff.getTimeScaleFactor());
  
        double width = (*i)->getViewDuration() * staff.getTimeScaleFactor();
!       el->setWidth((int)width + 2); // fiddle factor
        
        if (isFullScan) {
!           m_totalWidth = el->getLayoutX() + width;
        } else {
!           m_totalWidth = std::max(m_totalWidth, el->getLayoutX() + width);
        }
            
        ++i;
Index: gui/matrixview.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/matrixview.cpp,v
retrieving revision 1.251
diff -c -r1.251 matrixview.cpp
*** gui/matrixview.cpp  4 Jun 2003 03:15:52 -0000       1.251
--- gui/matrixview.cpp  12 Jun 2003 21:22:57 -0000
***************
*** 316,322 ****
  
      // Same, but editable
      //
!     makeControlRuler(m_staffs[0]->getViewElementList(), &m_hlayout);
      slotShowControlRuler(true);
  
      // Scroll view to centre middle-C and warp to pointer position
--- 316,322 ----
  
      // Same, but editable
      //
!     makeControlRuler(m_staffs[0], &m_hlayout);
      slotShowControlRuler(true);
  
      // Scroll view to centre middle-C and warp to pointer position
***************
*** 359,364 ****
--- 359,366 ----
  
      delete m_currentEventSelection;
      m_currentEventSelection = 0;
+ 
+     delete m_controlRuler;
  
      for (unsigned int i = 0; i < m_staffs.size(); ++i) {
          delete m_staffs[i]; // this will erase all "notes" canvas items
Index: gui/notationelement.h
===================================================================
RCS file: /cvsroot/rosegarden/gui/notationelement.h,v
retrieving revision 1.68
diff -c -r1.68 notationelement.h
*** gui/notationelement.h       1 Jun 2003 10:20:24 -0000       1.68
--- gui/notationelement.h       12 Jun 2003 21:22:57 -0000
***************
*** 49,54 ****
--- 49,72 ----
      virtual Rosegarden::timeT getViewAbsoluteTime() const;
      virtual Rosegarden::timeT getViewDuration() const;
  
+     /**
+      * Returns the X coordinate of the element, as computed by the
+      * layout. This is not the coordinate of the associated canvas
+      * item.
+      *
+      * @see getCanvasX()
+      */
+     double getLayoutX() { return m_x; }
+ 
+     /**
+      * Returns the Y coordinate of the element, as computed by the
+      * layout. This is not the coordinate of the associated canvas
+      * item.
+      *
+      * @see getCanvasY()
+      */
+     double getLayoutY() { return m_y; }
+ 
      void getLayoutAirspace(double &x, double &width) {
        x = m_airX;
        width = m_airWidth;
***************
*** 61,66 ****
--- 79,96 ----
      double getCanvasY();
  
      /**
+      * Sets the X coordinate which was computed by the layout engine
+      * @see getLayoutX()
+      */
+     void setLayoutX(double x) { m_x = x; }
+ 
+     /**
+      * Sets the Y coordinate which was computed by the layout engine
+      * @see getLayoutY()
+      */
+     void setLayoutY(double y) { m_y = y; }
+ 
+     /**
       * Sets the X coordinate and width of the space "underneath"
       * this element, i.e. the extents within which a mouse click
       * or some such might be considered to be interested in this
***************
*** 119,124 ****
--- 149,156 ----
  protected:
      //--------------- Data members ---------------------------------
  
+     double m_x;
+     double m_y;
      double m_airX;
      double m_airWidth;
      bool m_recentlyRegenerated;
Index: gui/notationhlayout.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/notationhlayout.cpp,v
retrieving revision 1.263
diff -c -r1.263 notationhlayout.cpp
*** gui/notationhlayout.cpp     12 Jun 2003 16:38:27 -0000      1.263
--- gui/notationhlayout.cpp     12 Jun 2003 21:22:58 -0000
***************
*** 1205,1211 ****
              for (NotationElementList::iterator it = from;
                 it != notes->end() && it != to; ++it) {
                  NotationElement* nel = static_cast<NotationElement*>(*it);
!                 nel->setLayoutX((*it)->getLayoutX() + simpleOffset);
                double airX, airWidth;
                nel->getLayoutAirspace(airX, airWidth);
                nel->setLayoutAirspace(airX + simpleOffset, airWidth);
--- 1205,1211 ----
              for (NotationElementList::iterator it = from;
                 it != notes->end() && it != to; ++it) {
                  NotationElement* nel = static_cast<NotationElement*>(*it);
!                 nel->setLayoutX(nel->getLayoutX() + simpleOffset);
                double airX, airWidth;
                nel->getLayoutAirspace(airX, airWidth);
                nel->setLayoutAirspace(airX + simpleOffset, airWidth);
***************
*** 1459,1467 ****
                               TieMap &tieMap, 
                               NotationElementList::iterator &to)
  {
      NotationChord chord(*staff.getViewElementList(), itr, m_notationQuantizer,
                        m_properties, clef, key);
!     double baseX = (*itr)->getLayoutX();
  
      // To work out how much space to allot a note (or chord), start
      // with the amount alloted to the whole bar, subtract that
--- 1459,1468 ----
                               TieMap &tieMap, 
                               NotationElementList::iterator &to)
  {
+     NotationElement *nel = static_cast<NotationElement *>(*itr);
      NotationChord chord(*staff.getViewElementList(), itr, m_notationQuantizer,
                        m_properties, clef, key);
!     double baseX = nel->getLayoutX();
  
      // To work out how much space to allot a note (or chord), start
      // with the amount alloted to the whole bar, subtract that
***************
*** 1585,1591 ****
                    
                    (*otherItr)->event()->setMaybe<Int>
                        (m_properties.TIE_LENGTH,
!                        (int)(baseX - (*otherItr)->getLayoutX()));
                    
                } else {
                    NOTATION_DEBUG << "Second note in tie at " << 
note->getViewAbsoluteTime() << ": found first note but it ends at " << 
((*otherItr)->getViewAbsoluteTime() + (*otherItr)->getViewDuration()) << endl;
--- 1586,1593 ----
                    
                    (*otherItr)->event()->setMaybe<Int>
                        (m_properties.TIE_LENGTH,
!                        (int)(baseX -
!                              ((NotationElement *)*otherItr)->getLayoutX()));
                    
                } else {
                    NOTATION_DEBUG << "Second note in tie at " << 
note->getViewAbsoluteTime() << ": found first note but it ends at " << 
((*otherItr)->getViewAbsoluteTime() + (*otherItr)->getViewDuration()) << endl;
***************
*** 1612,1618 ****
      for (i = 0; i < chord.size(); ++i) {
        NotationElementList::iterator subItr = chord[i];
        if (subItr == to) barEndsInChord = true;
!       (*subItr)->setLayoutX(baseX);
        if (groupId < 0) (*chord[i])->event()->unset(m_properties.BEAMED);
        else (*chord[i])->event()->set<Int>(BEAMED_GROUP_ID, groupId);
      }
--- 1614,1620 ----
      for (i = 0; i < chord.size(); ++i) {
        NotationElementList::iterator subItr = chord[i];
        if (subItr == to) barEndsInChord = true;
!       ((NotationElement *)*subItr)->setLayoutX(baseX);
        if (groupId < 0) (*chord[i])->event()->unset(m_properties.BEAMED);
        else (*chord[i])->event()->set<Int>(BEAMED_GROUP_ID, groupId);
      }
Index: gui/notationsets.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/notationsets.cpp,v
retrieving revision 1.80
diff -c -r1.80 notationsets.cpp
*** gui/notationsets.cpp        12 Jun 2003 16:38:29 -0000      1.80
--- gui/notationsets.cpp        12 Jun 2003 21:22:58 -0000
***************
*** 458,466 ****
      //in the direction of the gradient, then we should flatten the
      //gradient.  There may be a better heuristic for this.
  
!     int  initialX = (int)(*initialNote)->getLayoutX();
!     int   finalDX = (int)  (*finalNote)->getLayoutX() - initialX;
!     int extremeDX = (int)(*extremeNote)->getLayoutX() - initialX;
  
      int   finalY  = staff.getLayoutYForHeight(finalHeight);
      int extremeY  = staff.getLayoutYForHeight(extremeHeight);
--- 458,466 ----
      //in the direction of the gradient, then we should flatten the
      //gradient.  There may be a better heuristic for this.
  
!     int  initialX = (int)((NotationElement *)*initialNote)->getLayoutX();
!     int   finalDX = (int)((NotationElement *)  *finalNote)->getLayoutX() - initialX;
!     int extremeDX = (int)((NotationElement *)*extremeNote)->getLayoutX() - initialX;
  
      int   finalY  = staff.getLayoutYForHeight(finalHeight);
      int extremeY  = staff.getLayoutYForHeight(extremeHeight);
***************
*** 548,554 ****
  
      NELIterator initialNote(getInitialNote()),
                  finalNote(  getFinalNote());
!     int initialX = (int)(*initialNote)->getLayoutX();
      timeT finalTime = (*finalNote)->getViewAbsoluteTime();
  
      // For each chord in the group, we nominate the note head furthest
--- 548,554 ----
  
      NELIterator initialNote(getInitialNote()),
                  finalNote(  getFinalNote());
!     int initialX = (int)((NotationElement *)*initialNote)->getLayoutX();
      timeT finalTime = (*finalNote)->getViewAbsoluteTime();
  
      // For each chord in the group, we nominate the note head furthest
***************
*** 745,752 ****
  
      NOTATION_DEBUG << "NotationGroup::applyTuplingLine: first element is " << 
(initialNoteOrRestEl->isNote() ? "Note" : "Non-Note") << ", last is " << 
(static_cast<NotationElement*>(*finalElement)->isNote() ? "Note" : "Non-Note") << endl;
  
!     int initialX = (int)(*initialNoteOrRest)->getLayoutX();
!     int   finalX = (int)(*finalElement)->getLayoutX();
  
      if (initialNote == staff.getViewElementList()->end() &&
          finalNote == staff.getViewElementList()->end()) {
--- 745,752 ----
  
      NOTATION_DEBUG << "NotationGroup::applyTuplingLine: first element is " << 
(initialNoteOrRestEl->isNote() ? "Note" : "Non-Note") << ", last is " << 
(static_cast<NotationElement*>(*finalElement)->isNote() ? "Note" : "Non-Note") << endl;
  
!     int initialX = (int)((NotationElement *)*initialNoteOrRest)->getLayoutX();
!     int   finalX = (int)((NotationElement *)*finalElement)->getLayoutX();
  
      if (initialNote == staff.getViewElementList()->end() &&
          finalNote == staff.getViewElementList()->end()) {
Index: gui/notationstaff.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/notationstaff.cpp,v
retrieving revision 1.179
diff -c -r1.179 notationstaff.cpp
*** gui/notationstaff.cpp       12 Jun 2003 16:38:29 -0000      1.179
--- gui/notationstaff.cpp       12 Jun 2003 21:22:58 -0000
***************
*** 222,228 ****
      for (it = notes->begin(); it != notes->end(); ++it) {
          NotationElement *el = static_cast<NotationElement*>(*it);
  
!       bool before = ((*it)->getLayoutX() < x);
        
        if (!el->isNote() && !el->isRest()) {
            if (before) {
--- 222,228 ----
      for (it = notes->begin(); it != notes->end(); ++it) {
          NotationElement *el = static_cast<NotationElement*>(*it);
  
!       bool before = (el->getLayoutX() < x);
        
        if (!el->isNote() && !el->isRest()) {
            if (before) {
***************
*** 235,241 ****
            if (notesAndRestsOnly) continue;
        }
  
!       double dx = x - (*it)->getLayoutX();
        if (dx < 0) dx = -dx;
  
        if (dx < minDist) {
--- 235,241 ----
            if (notesAndRestsOnly) continue;
        }
  
!       double dx = x - el->getLayoutX();
        if (dx < 0) dx = -dx;
  
        if (dx < minDist) {
***************
*** 254,260 ****
          return notes->end();
      }
          
!     NOTATION_DEBUG << "NotationStaff::getClosestElementToLayoutX: found element at 
layout " << (*result)->getLayoutX() << " - we're at layout " << x << endl;
  
      PRINT_ELAPSED("NotationStaff::getClosestElementToLayoutX");
  
--- 254,260 ----
          return notes->end();
      }
          
!     NOTATION_DEBUG << "NotationStaff::getClosestElementToLayoutX: found element at 
layout " << ((NotationElement *)*result)->getLayoutX() << " - we're at layout " << x 
<< endl;
  
      PRINT_ELAPSED("NotationStaff::getClosestElementToLayoutX");
  
***************
*** 284,290 ****
      for (it = notes->begin(); it != notes->end(); ++it) {
          NotationElement* el = static_cast<NotationElement*>(*it);
  
!       bool before = ((*it)->getLayoutX() <= x);
        
        if (!el->isNote() && !el->isRest()) {
            if (before) {
--- 284,290 ----
      for (it = notes->begin(); it != notes->end(); ++it) {
          NotationElement* el = static_cast<NotationElement*>(*it);
  
!       bool before = (el->getLayoutX() <= x);
        
        if (!el->isNote() && !el->isRest()) {
            if (before) {
***************
*** 402,408 ****
      NotationElementList::iterator endAt = findUnchangedBarEnd(to, nextBarTime);
      if (beginAt == getViewElementList()->end()) return;
  
!     truncateClefsAndKeysAt(static_cast<int>((*beginAt)->getLayoutX()));
  
      Clef currentClef; // used for rendering key sigs
      bool haveCurrentClef = false;
--- 402,408 ----
      NotationElementList::iterator endAt = findUnchangedBarEnd(to, nextBarTime);
      if (beginAt == getViewElementList()->end()) return;
  
!     truncateClefsAndKeysAt(int(((NotationElement *)*beginAt)->getLayoutX()));
  
      Clef currentClef; // used for rendering key sigs
      bool haveCurrentClef = false;
***************
*** 414,435 ****
  
        ++nextIt;
  
!       if ((*it)->event()->isa(Clef::EventType)) {
  
!           currentClef = Clef(*(*it)->event());
!           m_clefChanges.push_back(ClefChange(int((*it)->getLayoutX()),
                                               currentClef));
            haveCurrentClef = true;
  
!       } else if ((*it)->event()->isa(Rosegarden::Key::EventType)) {
  
            m_keyChanges.push_back
!               (KeyChange(int((*it)->getLayoutX()),
!                          Rosegarden::Key(*(*it)->event())));
  
            if (!haveCurrentClef) { // need this to know how to present the key
                currentClef = getSegment().getClefAtTime
!                   ((*it)->event()->getAbsoluteTime());
                haveCurrentClef = true;
            }
        }
--- 414,435 ----
  
        ++nextIt;
  
!       if (el->event()->isa(Clef::EventType)) {
  
!           currentClef = Clef(*el->event());
!           m_clefChanges.push_back(ClefChange(int(el->getLayoutX()),
                                               currentClef));
            haveCurrentClef = true;
  
!       } else if (el->event()->isa(Rosegarden::Key::EventType)) {
  
            m_keyChanges.push_back
!               (KeyChange(int(el->getLayoutX()),
!                          Rosegarden::Key(*el->event())));
  
            if (!haveCurrentClef) { // need this to know how to present the key
                currentClef = getSegment().getClefAtTime
!                   (el->event()->getAbsoluteTime());
                haveCurrentClef = true;
            }
        }
***************
*** 449,456 ****
            // user inserts a new clef; unfortunately this means
            // inserting clefs is rather slow.
            
!           needNewSprite = needNewSprite ||
!               !elementNotMovedInY(static_cast<NotationElement*>(*it));
            
            if (!needNewSprite) {
  
--- 449,455 ----
            // user inserts a new clef; unfortunately this means
            // inserting clefs is rather slow.
            
!           needNewSprite = needNewSprite || !elementNotMovedInY(el);
            
            if (!needNewSprite) {
  
***************
*** 460,479 ****
                // or tie is part of the note's sprite).
  
                bool spanning = false;
!               (void)((*it)->event()->get<Bool>
                       (properties.BEAMED, spanning));
                if (!spanning) {
!                   (void)((*it)->event()->get<Bool>(TIED_FORWARD, spanning));
                }
            
                if (spanning) {
                    needNewSprite =
!                       ((*it)->getViewAbsoluteTime() < nextBarTime ||
                         !elementShiftedOnly(it));
                }
            }
  
!       } else if ((*it)->event()->isa(Indication::EventType) &&
                   !el->isRecentlyRegenerated()) {
            needNewSprite = true;
        }
--- 459,478 ----
                // or tie is part of the note's sprite).
  
                bool spanning = false;
!               (void)(el->event()->get<Bool>
                       (properties.BEAMED, spanning));
                if (!spanning) {
!                   (void)(el->event()->get<Bool>(TIED_FORWARD, spanning));
                }
            
                if (spanning) {
                    needNewSprite =
!                       (el->getViewAbsoluteTime() < nextBarTime ||
                         !elementShiftedOnly(it));
                }
            }
  
!       } else if (el->event()->isa(Indication::EventType) &&
                   !el->isRecentlyRegenerated()) {
            needNewSprite = true;
        }
***************
*** 491,497 ****
  
        if ((to > from) &&
            (++elementsPositioned % 200 == 0)) {
!           timeT myTime = (*it)->getViewAbsoluteTime();
            emit setProgress((myTime - from) * 100 / (to - from));
            kapp->processEvents();
            throwIfCancelled();
--- 490,496 ----
  
        if ((to > from) &&
            (++elementsPositioned % 200 == 0)) {
!           timeT myTime = el->getViewAbsoluteTime();
            emit setProgress((myTime - from) * 100 / (to - from));
            kapp->processEvents();
            throwIfCancelled();
***************
*** 773,788 ****
            }
  
            if (indicationEnd != getViewElementList()->end()) {
!               length = (int)((*indicationEnd)->getLayoutX() -
                               elt->getLayoutX());
!               y1 = (int)(*indicationEnd)->getLayoutY();
            } else {
                //!!! imperfect
                --indicationEnd;
!               length = (int)((*indicationEnd)->getLayoutX() +
                               m_notePixmapFactory->getNoteBodyWidth() * 3 -
                               elt->getLayoutX());
!               y1 = (int)(*indicationEnd)->getLayoutY();
            }
  
            if (length < m_notePixmapFactory->getNoteBodyWidth()) {
--- 772,787 ----
            }
  
            if (indicationEnd != getViewElementList()->end()) {
!               length = (int)(((NotationElement *)*indicationEnd)->getLayoutX() -
                               elt->getLayoutX());
!               y1 = (int)((NotationElement *)*indicationEnd)->getLayoutY();
            } else {
                //!!! imperfect
                --indicationEnd;
!               length = (int)(((NotationElement *)*indicationEnd)->getLayoutX() +
                               m_notePixmapFactory->getNoteBodyWidth() * 3 -
                               elt->getLayoutX());
!               y1 = (int)((NotationElement *)*indicationEnd)->getLayoutY();
            }
  
            if (length < m_notePixmapFactory->getNoteBodyWidth()) {
Index: gui/notationtool.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/notationtool.cpp,v
retrieving revision 1.110
diff -c -r1.110 notationtool.cpp
*** gui/notationtool.cpp        12 Jun 2003 16:38:29 -0000      1.110
--- gui/notationtool.cpp        12 Jun 2003 21:22:59 -0000
***************
*** 384,395 ****
        return false;
      }
  
!     timeT time = (*itr)->event()->getAbsoluteTime(); // not getViewAbsoluteTime()
!     m_clickInsertX = (*itr)->getLayoutX();
      if (clefEvt) clef = Rosegarden::Clef(*clefEvt);
      if (keyEvt) key = Rosegarden::Key(*keyEvt);
  
-     NotationElement* el = static_cast<NotationElement*>(*itr);
      if (el->isRest() && el->getCanvasItem()) {
        time += getOffsetWithinRest(staffNo, itr, x);
        m_clickInsertX += (x - el->getCanvasX());
--- 384,396 ----
        return false;
      }
  
!     NotationElement* el = static_cast<NotationElement*>(*itr);
! 
!     timeT time = el->event()->getAbsoluteTime(); // not getViewAbsoluteTime()
!     m_clickInsertX = el->getLayoutX();
      if (clefEvt) clef = Rosegarden::Clef(*clefEvt);
      if (keyEvt) key = Rosegarden::Key(*keyEvt);
  
      if (el->isRest() && el->getCanvasItem()) {
        time += getOffsetWithinRest(staffNo, itr, x);
        m_clickInsertX += (x - el->getCanvasX());
***************
*** 455,461 ****
  
      double airX, airWidth;
      el->getLayoutAirspace(airX, airWidth);
!     double origin = ((*i)->getLayoutX() - airX) / 2;
      double width = airWidth - origin;
  
      timeT duration = (*i)->getViewDuration();
--- 456,462 ----
  
      double airX, airWidth;
      el->getLayoutAirspace(airX, airWidth);
!     double origin = (el->getLayoutX() - airX) / 2;
      double width = airWidth - origin;
  
      timeT duration = (*i)->getViewDuration();
***************
*** 474,480 ****
        double visibleWidth(airWidth);
        NotationElementList::iterator j(i);
        if (++j != staff->getViewElementList()->end()) {
!           visibleWidth = (*j)->getLayoutX() - (*i)->getLayoutX();
        }
        offset = (visibleWidth * result) / unitCount;
        canvasX = el->getCanvasX() + offset;
--- 475,482 ----
        double visibleWidth(airWidth);
        NotationElementList::iterator j(i);
        if (++j != staff->getViewElementList()->end()) {
!           visibleWidth = ((NotationElement *)*j)->getLayoutX() -
!               el->getLayoutX();
        }
        offset = (visibleWidth * result) / unitCount;
        canvasX = el->getCanvasX() + offset;
Index: gui/notationvlayout.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/notationvlayout.cpp,v
retrieving revision 1.90
diff -c -r1.90 notationvlayout.cpp
*** gui/notationvlayout.cpp     11 Jun 2003 19:17:25 -0000      1.90
--- gui/notationvlayout.cpp     12 Jun 2003 21:22:59 -0000
***************
*** 294,300 ****
      int startTopHeight = 4, endTopHeight = 4,
        startBottomHeight = 4, endBottomHeight = 4;
  
!     int startX = (int)(*i)->getLayoutX(), endX = startX + 10;
      bool startStemUp = false, endStemUp = false;
      bool beamAbove = false, beamBelow = false;
  
--- 294,300 ----
      int startTopHeight = 4, endTopHeight = 4,
        startBottomHeight = 4, endBottomHeight = 4;
  
!     int startX = (int)((NotationElement *)*i)->getLayoutX(), endX = startX + 10;
      bool startStemUp = false, endStemUp = false;
      bool beamAbove = false, beamBelow = false;
  
***************
*** 341,354 ****
                if (!haveStart) {
                    startBottomHeight = chord.getLowestNoteHeight();
                    startTopHeight = chord.getHighestNoteHeight();
!                   startX = (int)(*scooter)->getLayoutX();
                    startStemUp = stemUp;
                    haveStart = true;
                }
  
                endBottomHeight = chord.getLowestNoteHeight();
                endTopHeight = chord.getHighestNoteHeight();
!               endX = (int)(*scooter)->getLayoutX();
                endStemUp = stemUp;
            }
  
--- 341,354 ----
                if (!haveStart) {
                    startBottomHeight = chord.getLowestNoteHeight();
                    startTopHeight = chord.getHighestNoteHeight();
!                   startX = (int)((NotationElement *)*scooter)->getLayoutX();
                    startStemUp = stemUp;
                    haveStart = true;
                }
  
                endBottomHeight = chord.getLowestNoteHeight();
                endTopHeight = chord.getHighestNoteHeight();
!               endX = (int)((NotationElement *)*scooter)->getLayoutX();
                endStemUp = stemUp;
            }
  
***************
*** 425,431 ****
      (*i)->event()->setMaybe<Bool>(m_properties.SLUR_ABOVE, above);
      (*i)->event()->setMaybe<Int>(m_properties.SLUR_Y_DELTA, dy);
      (*i)->event()->setMaybe<Int>(m_properties.SLUR_LENGTH, length);
!     (*i)->setLayoutX(startX);
!     (*i)->setLayoutY(y0);
  }
  
--- 425,431 ----
      (*i)->event()->setMaybe<Bool>(m_properties.SLUR_ABOVE, above);
      (*i)->event()->setMaybe<Int>(m_properties.SLUR_Y_DELTA, dy);
      (*i)->event()->setMaybe<Int>(m_properties.SLUR_LENGTH, length);
!     ((NotationElement *)*i)->setLayoutX(startX);
!     ((NotationElement *)*i)->setLayoutY(y0);
  }
  

Reply via email to