svcore  1.9
ZoomConstraint.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef _ZOOM_CONSTRAINT_H_
17 #define _ZOOM_CONSTRAINT_H_
18 
19 #include <stdlib.h>
20 
31 {
32 public:
33  virtual ~ZoomConstraint() { }
34 
39  };
40 
51  virtual int getNearestBlockSize(int requestedBlockSize,
53  const
54  {
55  if (requestedBlockSize > getMaxZoomLevel()) return getMaxZoomLevel();
56  else return requestedBlockSize;
57  }
58 
62  virtual int getMaxZoomLevel() const { return 262144; }
63 };
64 
65 #endif
66 
virtual int getNearestBlockSize(int requestedBlockSize, RoundingDirection=RoundNearest) const
Given the "ideal" block size (frames per pixel) for a given zoom level, return the nearest viable blo...
virtual ~ZoomConstraint()
virtual int getMaxZoomLevel() const
Return the maximum zoom level within range for this constraint.
ZoomConstraint is a simple interface that describes a limitation on the available zoom sizes for a vi...