aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-zoom.h
blob: 085dc5be711da63e691ff0acb6c38c1d0e9a691d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 *  Copyright © 2003 Christian Persch
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
#error "Only <epiphany/epiphany.h> can be included directly."
#endif

#ifndef EPHY_ZOOM_H
#define EPHY_ZOOM_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <glib.h>
#include <glib/gi18n.h>

G_BEGIN_DECLS

static const
struct
{
    gchar *name;
    float level;
}
zoom_levels[] =
{
    { N_("50%"), 0.7071067811 },
    { N_("75%"), 0.8408964152 },
    { N_("100%"), 1.0 },
    { N_("125%"), 1.1892071149 },
    { N_("150%"), 1.4142135623 },
    { N_("175%"), 1.6817928304 },
    { N_("200%"), 2.0 },
    { N_("300%"), 2.8284271247 },
    { N_("400%"), 4.0 }
};
static const guint n_zoom_levels = G_N_ELEMENTS (zoom_levels);

#define ZOOM_MINIMAL    (zoom_levels[0].level)
#define ZOOM_MAXIMAL    (zoom_levels[n_zoom_levels - 1].level)
#define ZOOM_IN     (-1.0)
#define ZOOM_OUT    (-2.0)

int ephy_zoom_get_zoom_level_index   (float level);

float   ephy_zoom_get_changed_zoom_level (float level,
                      int steps);

float   ephy_zoom_get_nearest_zoom_level (float level);

G_END_DECLS

#endif