comparison layer/RegionLayer.h @ 551:c2ba2796cbee sv-v1.7

* Big improvements to editing behaviour in note and region models
author Chris Cannam
date Fri, 02 Oct 2009 13:56:10 +0000
parents d666f5f8b154
children 2e8194a30f40
comparison
equal deleted inserted replaced
550:d666f5f8b154 551:c2ba2796cbee
118 void recalcSpacing(); 118 void recalcSpacing();
119 119
120 protected: 120 protected:
121 void getScaleExtents(View *, float &min, float &max, bool &log) const; 121 void getScaleExtents(View *, float &min, float &max, bool &log) const;
122 int getYForValue(View *v, float value) const; 122 int getYForValue(View *v, float value) const;
123 float getValueForY(View *v, int y) const; 123 float getValueForY(View *v, int y, int avoid = -1) const;
124 QColor getColourForValue(View *v, float value) const; 124 QColor getColourForValue(View *v, float value) const;
125 125
126 virtual int getDefaultColourHint(bool dark, bool &impose); 126 virtual int getDefaultColourHint(bool dark, bool &impose);
127 127
128 RegionModel::PointList getLocalPoints(View *v, int x) const; 128 RegionModel::PointList getLocalPoints(View *v, int x) const;
129 129
130 bool getPointToDrag(View *v, int x, int y, RegionModel::Point &) const; 130 bool getPointToDrag(View *v, int x, int y, RegionModel::Point &) const;
131 131
132 RegionModel *m_model; 132 RegionModel *m_model;
133 bool m_editing; 133 bool m_editing;
134 int m_dragYOrigin; 134 int m_dragPointX;
135 int m_dragYRebase; 135 int m_dragPointY;
136 int m_dragStartX;
137 int m_dragStartY;
136 RegionModel::Point m_originalPoint; 138 RegionModel::Point m_originalPoint;
137 RegionModel::Point m_editingPoint; 139 RegionModel::Point m_editingPoint;
138 RegionModel::EditCommand *m_editingCommand; 140 RegionModel::EditCommand *m_editingCommand;
139 VerticalScale m_verticalScale; 141 VerticalScale m_verticalScale;
140 int m_colourMap; 142 int m_colourMap;
141 PlotStyle m_plotStyle; 143 PlotStyle m_plotStyle;
142 144
143 typedef std::map<float, int> SpacingMap; 145 typedef std::map<float, int> SpacingMap;
146
144 // region value -> ordering 147 // region value -> ordering
145 SpacingMap m_spacingMap; 148 SpacingMap m_spacingMap;
149
150 // region value -> number of regions with this value
151 SpacingMap m_distributionMap;
146 152
147 int spacingIndexToY(View *v, int i) const; 153 int spacingIndexToY(View *v, int i) const;
148 float yToSpacingIndex(View *v, int y) const; 154 float yToSpacingIndex(View *v, int y) const;
149 155
150 void finish(RegionModel::EditCommand *command) { 156 void finish(RegionModel::EditCommand *command) {