comparison view/View.h @ 834:9ad718fdc369

Add getInteractionLayer() and some docs
author Chris Cannam
date Tue, 02 Sep 2014 10:31:23 +0100
parents 40c6c9344ff6
children 7792b7667f74
comparison
equal deleted inserted replaced
833:57d943a61943 834:9ad718fdc369
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
155 /**
156 * Remove a layer from the view. Does not delete the
157 * layer. (Normally this should be handled through some command
158 * abstraction instead of using this function directly.)
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 */
150 virtual int getLayerCount() const { return m_layers.size(); } 166 virtual int getLayerCount() const { return m_layers.size(); }
151 167
152 /** 168 /**
153 * Return a layer, counted in stacking order. That is, layer 0 is 169 * Return the nth layer, counted in stacking order. That is,
154 * the bottom layer and layer "getLayerCount()-1" is the top one. 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_layers.size())) return m_layers[n]; else return 0;
158 } 176 }
159 177
160 /** 178 /**
161 * Return the top layer. This is the same as 179 * Return the "top" layer in the view, whether visible or dormant.
162 * getLayer(getLayerCount()-1) if there is at least one layer, and 180 * This is the same as getLayer(getLayerCount()-1) if there is at
163 * 0 otherwise. 181 * least one layer, and 0 otherwise.
164 */ 182 */
165 virtual Layer *getTopLayer() { 183 virtual Layer *getTopLayer() {
166 return m_layers.empty() ? 0 : m_layers[m_layers.size()-1]; 184 return m_layers.empty() ? 0 : m_layers[m_layers.size()-1];
167 } 185 }
168 186
169 /** 187 /**
170 * Return the layer last selected by the user. This is normally 188 * Return the layer currently active for tool interaction. This is
171 * the top layer, the same as getLayer(getLayerCount()-1). 189 * the topmost non-dormant (i.e. visible) layer in the view. If
172 * However, if the user has selected the pane itself more recently 190 * there are no visible layers in the view, return 0.
173 * than any of the layers on it, this function will return 0. It 191 */
174 * will also return 0 if there are no layers. 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.
175 */ 202 */
176 virtual Layer *getSelectedLayer(); 203 virtual Layer *getSelectedLayer();
204
177 virtual const Layer *getSelectedLayer() const; 205 virtual const Layer *getSelectedLayer() const;
178 206
179 virtual void setViewManager(ViewManager *m); 207 virtual void setViewManager(ViewManager *m);
180 virtual void setViewManager(ViewManager *m, int initialFrame); 208 virtual void setViewManager(ViewManager *m, int initialFrame);
181 virtual ViewManager *getViewManager() const { return m_manager; } 209 virtual ViewManager *getViewManager() const { return m_manager; }