Mercurial > hg > svgui
comparison view/View.h @ 835:7792b7667f74
Introduce (but don't yet populate) the fixed layers vector; rename m_layers to m_layerStack to reflect its ordering by stacking
author | Chris Cannam |
---|---|
date | Tue, 02 Sep 2014 14:47:04 +0100 |
parents | 9ad718fdc369 |
children | 6c4cab21e387 |
comparison
equal
deleted
inserted
replaced
834:9ad718fdc369 | 835:7792b7667f74 |
---|---|
161 | 161 |
162 /** | 162 /** |
163 * Return the number of layers, regardless of whether visible or | 163 * Return the number of layers, regardless of whether visible or |
164 * dormant, i.e. invisible, in this view. | 164 * dormant, i.e. invisible, in this view. |
165 */ | 165 */ |
166 virtual int getLayerCount() const { return m_layers.size(); } | 166 virtual int getLayerCount() const { return m_layerStack.size(); } |
167 | 167 |
168 /** | 168 /** |
169 * Return the nth layer, counted in stacking order. That is, | 169 * Return the nth layer, counted in stacking order. That is, |
170 * layer 0 is the bottom layer and layer "getLayerCount()-1" is | 170 * layer 0 is the bottom layer and layer "getLayerCount()-1" is |
171 * the top one. The returned layer may be visible or it may be | 171 * the top one. The returned layer may be visible or it may be |
172 * dormant, i.e. invisible. | 172 * dormant, i.e. invisible. |
173 */ | 173 */ |
174 virtual Layer *getLayer(int n) { | 174 virtual Layer *getLayer(int n) { |
175 if (n < int(m_layers.size())) return m_layers[n]; else return 0; | 175 if (n < int(m_layerStack.size())) return m_layerStack[n]; |
176 } | 176 else return 0; |
177 } | |
178 | |
179 /** | |
180 * Return the nth layer, counted in the order they were | |
181 * added. Unlike the stacking order used in getLayer(), which | |
182 * changes each time a layer is selected, this ordering remains | |
183 * fixed. The returned layer may be visible or it may be dormant, | |
184 * i.e. invisible. | |
185 */ | |
186 virtual Layer *getFixedOrderLayer(int n) { | |
187 if (n < int(m_fixedOrderLayers.size())) return m_fixedOrderLayers[n]; | |
188 else return 0; | |
189 } | |
190 | |
191 /** | |
192 * Return the layer currently active for tool interaction. This is | |
193 * the topmost non-dormant (i.e. visible) layer in the view. If | |
194 * there are no visible layers in the view, return 0. | |
195 */ | |
196 virtual Layer *getInteractionLayer(); | |
197 | |
198 /** | |
199 * Return the layer most recently selected by the user. This is | |
200 * the layer that any non-tool-driven commands should operate on, | |
201 * in the case where this view is the "current" one. | |
202 * | |
203 * If the user has selected the view itself more recently than any | |
204 * of the layers on it, this function will return 0, and any | |
205 * non-tool-driven layer commands should be deactivated while this | |
206 * view is current. It will also return 0 if there are no layers | |
207 * in the view. | |
208 * | |
209 * Note that, unlike getInteractionLayer(), this could return an | |
210 * invisible (dormant) layer. | |
211 */ | |
212 virtual Layer *getSelectedLayer(); | |
213 | |
214 virtual const Layer *getSelectedLayer() const; | |
177 | 215 |
178 /** | 216 /** |
179 * Return the "top" layer in the view, whether visible or dormant. | 217 * Return the "top" layer in the view, whether visible or dormant. |
180 * This is the same as getLayer(getLayerCount()-1) if there is at | 218 * This is the same as getLayer(getLayerCount()-1) if there is at |
181 * least one layer, and 0 otherwise. | 219 * least one layer, and 0 otherwise. |
220 * | |
221 * For most purposes involving interaction or commands, you | |
222 * probably want either getInteractionLayer() or | |
223 * getSelectedLayer() instead. | |
182 */ | 224 */ |
183 virtual Layer *getTopLayer() { | 225 virtual Layer *getTopLayer() { |
184 return m_layers.empty() ? 0 : m_layers[m_layers.size()-1]; | 226 return m_layerStack.empty() ? 0 : m_layerStack[m_layerStack.size()-1]; |
185 } | 227 } |
186 | |
187 /** | |
188 * Return the layer currently active for tool interaction. This is | |
189 * the topmost non-dormant (i.e. visible) layer in the view. If | |
190 * there are no visible layers in the view, return 0. | |
191 */ | |
192 virtual Layer *getInteractionLayer(); | |
193 | |
194 /** | |
195 * Return the layer most recently selected by the user. If the | |
196 * user has selected the pane itself more recently than any of the | |
197 * layers on it, this function will return 0. It will also return | |
198 * 0 if there are no layers in the view. | |
199 * | |
200 * Note that, unlike getInteractionLayer(), this could return an | |
201 * invisible (dormant) layer. | |
202 */ | |
203 virtual Layer *getSelectedLayer(); | |
204 | |
205 virtual const Layer *getSelectedLayer() const; | |
206 | 228 |
207 virtual void setViewManager(ViewManager *m); | 229 virtual void setViewManager(ViewManager *m); |
208 virtual void setViewManager(ViewManager *m, int initialFrame); | 230 virtual void setViewManager(ViewManager *m, int initialFrame); |
209 virtual ViewManager *getViewManager() const { return m_manager; } | 231 virtual ViewManager *getViewManager() const { return m_manager; } |
210 | 232 |
394 int m_cacheZoomLevel; | 416 int m_cacheZoomLevel; |
395 bool m_selectionCached; | 417 bool m_selectionCached; |
396 | 418 |
397 bool m_deleting; | 419 bool m_deleting; |
398 | 420 |
399 LayerList m_layers; // I don't own these, but see dtor note above | 421 LayerList m_layerStack; // I don't own these, but see dtor note above |
422 LayerList m_fixedOrderLayers; | |
400 bool m_haveSelectedLayer; | 423 bool m_haveSelectedLayer; |
401 | 424 |
402 QString m_lastError; | 425 QString m_lastError; |
403 | 426 |
404 // caches for use in getScrollableBackLayers, getNonScrollableFrontLayers | 427 // caches for use in getScrollableBackLayers, getNonScrollableFrontLayers |