Mercurial > hg > svcore
changeset 12:f67ddc287bc3
* Add ability to create empty layers for editing
* Add first basic editing capability (adding points to a time instant layer)
* Add various keyboard and mouse shortcuts for navigation &c
* Add ability to resize a selection by dragging its edges
* Add maximum zoom level
author | Chris Cannam |
---|---|
date | Thu, 26 Jan 2006 16:15:40 +0000 |
parents | cb05ba39664a |
children | 1fa7cc0d008b |
files | base/Layer.cpp base/Layer.h base/View.cpp base/View.h base/ZoomConstraint.h |
diffstat | 5 files changed, 47 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/base/Layer.cpp Thu Jan 26 11:56:09 2006 +0000 +++ b/base/Layer.cpp Thu Jan 26 16:15:40 2006 +0000 @@ -27,6 +27,13 @@ m_view->removeLayer(this); } +QString +Layer::getPropertyContainerIconName() const +{ + return LayerFactory::instance()->getLayerIconName + (LayerFactory::instance()->getLayerType(this)); +} + void Layer::setObjectName(const QString &name) {
--- a/base/Layer.h Thu Jan 26 11:56:09 2006 +0000 +++ b/base/Layer.h Thu Jan 26 16:15:40 2006 +0000 @@ -22,6 +22,7 @@ class Model; class QPainter; class View; +class QMouseEvent; /** * The base class for visual representations of the data found in a @@ -53,6 +54,8 @@ return PositionBottom; } + virtual QString getPropertyContainerIconName() const; + virtual QString getPropertyContainerName() const { return objectName(); } @@ -92,11 +95,15 @@ return frame; } - // Paint and edit modes: + // Draw and edit modes: // - // Layer needs to get actual mouse events, I guess. Paint mode is + // Layer needs to get actual mouse events, I guess. Draw mode is // probably the easier. + virtual void drawStart(QMouseEvent *e) { } + virtual void drawDrag(QMouseEvent *e) { } + virtual void drawEnd(QMouseEvent *e) { } + // Text mode: // // Label nearest feature. We need to get the feature coordinates
--- a/base/View.cpp Thu Jan 26 11:56:09 2006 +0000 +++ b/base/View.cpp Thu Jan 26 16:15:40 2006 +0000 @@ -755,6 +755,26 @@ } void +View::scroll(bool right, bool lots) +{ + long delta; + if (lots) { + delta = ((width() / 2) * m_zoomLevel); + } else { + delta = ((width() / 20) * m_zoomLevel); + } + if (right) delta = -delta; + + if (int(m_centreFrame) < delta) { + setCentreFrame(0); + } else if (int(m_centreFrame) - delta >= int(getModelsEndFrame())) { + setCentreFrame(getModelsEndFrame()); + } else { + setCentreFrame(m_centreFrame - delta); + } +} + +void View::checkProgress(void *object) { // std::cerr << "View::checkProgress(" << object << ")" << std::endl;
--- a/base/View.h Thu Jan 26 11:56:09 2006 +0000 +++ b/base/View.h Thu Jan 26 16:15:40 2006 +0000 @@ -101,6 +101,11 @@ */ virtual void zoom(bool in); + /** + * Scroll left or right by a smallish or largish amount. + */ + virtual void scroll(bool right, bool lots); + virtual void addLayer(Layer *v); virtual void removeLayer(Layer *v); // does not delete the layer virtual int getLayerCount() const { return m_layers.size(); }
--- a/base/ZoomConstraint.h Thu Jan 26 11:56:09 2006 +0000 +++ b/base/ZoomConstraint.h Thu Jan 26 16:15:40 2006 +0000 @@ -17,7 +17,8 @@ * the available zoom sizes for a view, for example based on cache * strategy or a (processing) window-size limitation. * - * The default ZoomConstraint imposes no actual constraint. + * The default ZoomConstraint imposes no actual constraint except for + * a nominal maximum. */ class ZoomConstraint @@ -43,8 +44,11 @@ RoundingDirection = RoundNearest) const { - return requestedBlockSize; + if (requestedBlockSize > getMaxZoomLevel()) return getMaxZoomLevel(); + else return requestedBlockSize; } + + virtual size_t getMaxZoomLevel() const { return 262144; } }; #endif