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
30
class
ZoomConstraint
31
{
32
public
:
33
virtual
~ZoomConstraint
() { }
34
35
enum
RoundingDirection
{
36
RoundDown
,
37
RoundUp
,
38
RoundNearest
39
};
40
51
virtual
int
getNearestBlockSize
(
int
requestedBlockSize,
52
RoundingDirection
=
RoundNearest
)
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
ZoomConstraint::getNearestBlockSize
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...
Definition:
ZoomConstraint.h:51
ZoomConstraint::~ZoomConstraint
virtual ~ZoomConstraint()
Definition:
ZoomConstraint.h:33
ZoomConstraint::RoundNearest
Definition:
ZoomConstraint.h:38
ZoomConstraint::getMaxZoomLevel
virtual int getMaxZoomLevel() const
Return the maximum zoom level within range for this constraint.
Definition:
ZoomConstraint.h:62
ZoomConstraint::RoundingDirection
RoundingDirection
Definition:
ZoomConstraint.h:35
ZoomConstraint::RoundDown
Definition:
ZoomConstraint.h:36
ZoomConstraint::RoundUp
Definition:
ZoomConstraint.h:37
ZoomConstraint
ZoomConstraint is a simple interface that describes a limitation on the available zoom sizes for a vi...
Definition:
ZoomConstraint.h:30
base
ZoomConstraint.h
Generated by
1.8.15