Mercurial > hg > svgui
comparison view/View.h @ 842:8432d2551fb2 tonioni
Update subrepos and merge from default branch
author | Chris Cannam |
---|---|
date | Tue, 02 Sep 2014 16:23:48 +0100 |
parents | 532302d04571 |
children | 99373ca20caf a1226b3b7925 |
comparison
equal
deleted
inserted
replaced
826:43256b925e15 | 842:8432d2551fb2 |
---|---|
143 /** | 143 /** |
144 * Scroll left or right by a smallish or largish amount. | 144 * Scroll left or right by a smallish or largish amount. |
145 */ | 145 */ |
146 virtual void scroll(bool right, bool lots, bool doEmit = true); | 146 virtual void scroll(bool right, bool lots, bool doEmit = true); |
147 | 147 |
148 /** | |
149 * Add a layer to the view. (Normally this should be handled | |
150 * through some command abstraction instead of using this function | |
151 * directly.) | |
152 */ | |
148 virtual void addLayer(Layer *v); | 153 virtual void addLayer(Layer *v); |
149 virtual void removeLayer(Layer *v); // does not delete the layer | 154 |
150 virtual int getLayerCount() const { return m_layers.size(); } | 155 /** |
151 | 156 * Remove a layer from the view. Does not delete the |
152 /** | 157 * layer. (Normally this should be handled through some command |
153 * Return a layer, counted in stacking order. That is, layer 0 is | 158 * abstraction instead of using this function directly.) |
154 * the bottom layer and layer "getLayerCount()-1" is the top one. | 159 */ |
160 virtual void removeLayer(Layer *v); | |
161 | |
162 /** | |
163 * Return the number of layers, regardless of whether visible or | |
164 * dormant, i.e. invisible, in this view. | |
165 */ | |
166 virtual int getLayerCount() const { return m_layerStack.size(); } | |
167 | |
168 /** | |
169 * Return the nth layer, counted in stacking order. That 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 | |
172 * dormant, i.e. invisible. | |
155 */ | 173 */ |
156 virtual Layer *getLayer(int n) { | 174 virtual Layer *getLayer(int n) { |
157 if (n < int(m_layers.size())) return m_layers[n]; else return 0; | 175 if (n < int(m_layerStack.size())) return m_layerStack[n]; |
158 } | 176 else return 0; |
159 | 177 } |
160 /** | 178 |
161 * Return the top layer. This is the same as | 179 /** |
162 * getLayer(getLayerCount()-1) if there is at least one layer, and | 180 * Return the nth layer, counted in the order they were |
163 * 0 otherwise. | 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 virtual const Layer *getInteractionLayer() const; | |
199 | |
200 /** | |
201 * Return the layer most recently selected by the user. This is | |
202 * the layer that any non-tool-driven commands should operate on, | |
203 * in the case where this view is the "current" one. | |
204 * | |
205 * If the user has selected the view itself more recently than any | |
206 * of the layers on it, this function will return 0, and any | |
207 * non-tool-driven layer commands should be deactivated while this | |
208 * view is current. It will also return 0 if there are no layers | |
209 * in the view. | |
210 * | |
211 * Note that, unlike getInteractionLayer(), this could return an | |
212 * invisible (dormant) layer. | |
213 */ | |
214 virtual Layer *getSelectedLayer(); | |
215 | |
216 virtual const Layer *getSelectedLayer() const; | |
217 | |
218 /** | |
219 * Return the "top" layer in the view, whether visible or dormant. | |
220 * This is the same as getLayer(getLayerCount()-1) if there is at | |
221 * least one layer, and 0 otherwise. | |
222 * | |
223 * For most purposes involving interaction or commands, you | |
224 * probably want either getInteractionLayer() or | |
225 * getSelectedLayer() instead. | |
164 */ | 226 */ |
165 virtual Layer *getTopLayer() { | 227 virtual Layer *getTopLayer() { |
166 return m_layers.empty() ? 0 : m_layers[m_layers.size()-1]; | 228 return m_layerStack.empty() ? 0 : m_layerStack[m_layerStack.size()-1]; |
167 } | 229 } |
168 | |
169 /** | |
170 * Return the layer last selected by the user. This is normally | |
171 * the top layer, the same as getLayer(getLayerCount()-1). | |
172 * However, if the user has selected the pane itself more recently | |
173 * than any of the layers on it, this function will return 0. It | |
174 * will also return 0 if there are no layers. | |
175 */ | |
176 virtual Layer *getSelectedLayer(); | |
177 virtual const Layer *getSelectedLayer() const; | |
178 | 230 |
179 virtual void setViewManager(ViewManager *m); | 231 virtual void setViewManager(ViewManager *m); |
180 virtual void setViewManager(ViewManager *m, int initialFrame); | 232 virtual void setViewManager(ViewManager *m, int initialFrame); |
181 virtual ViewManager *getViewManager() const { return m_manager; } | 233 virtual ViewManager *getViewManager() const { return m_manager; } |
182 | 234 |
234 } | 286 } |
235 virtual QString getPropertyContainerIconName() const = 0; | 287 virtual QString getPropertyContainerIconName() const = 0; |
236 | 288 |
237 virtual int getPropertyContainerCount() const; | 289 virtual int getPropertyContainerCount() const; |
238 | 290 |
291 // The 0th property container is the view's own; the rest are the | |
292 // layers in fixed-order series | |
239 virtual const PropertyContainer *getPropertyContainer(int i) const; | 293 virtual const PropertyContainer *getPropertyContainer(int i) const; |
240 virtual PropertyContainer *getPropertyContainer(int i); | 294 virtual PropertyContainer *getPropertyContainer(int i); |
241 | 295 |
242 // Render the contents on a wide canvas | 296 // Render the contents on a wide canvas |
243 virtual QImage *toNewImage(int f0, int f1); | 297 virtual QImage *toNewImage(int f0, int f1); |
366 int m_cacheZoomLevel; | 420 int m_cacheZoomLevel; |
367 bool m_selectionCached; | 421 bool m_selectionCached; |
368 | 422 |
369 bool m_deleting; | 423 bool m_deleting; |
370 | 424 |
371 LayerList m_layers; // I don't own these, but see dtor note above | 425 LayerList m_layerStack; // I don't own these, but see dtor note above |
426 LayerList m_fixedOrderLayers; | |
372 bool m_haveSelectedLayer; | 427 bool m_haveSelectedLayer; |
373 | 428 |
374 QString m_lastError; | 429 QString m_lastError; |
375 | 430 |
376 // caches for use in getScrollableBackLayers, getNonScrollableFrontLayers | 431 // caches for use in getScrollableBackLayers, getNonScrollableFrontLayers |