diff options
author | Xan Lopez <xan@igalia.com> | 2012-10-08 23:58:48 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-10-08 23:58:48 +0800 |
commit | 3ee22bbfc7953fe5912f516a647244a56505a252 (patch) | |
tree | 6b7488de925b6bbe8114125f9a5f501e934970de | |
parent | e628032b0988ddb8cd3c922943c53e6ee65ec824 (diff) | |
download | gsoc2013-epiphany-3ee22bbfc7953fe5912f516a647244a56505a252.tar gsoc2013-epiphany-3ee22bbfc7953fe5912f516a647244a56505a252.tar.gz gsoc2013-epiphany-3ee22bbfc7953fe5912f516a647244a56505a252.tar.bz2 gsoc2013-epiphany-3ee22bbfc7953fe5912f516a647244a56505a252.tar.lz gsoc2013-epiphany-3ee22bbfc7953fe5912f516a647244a56505a252.tar.xz gsoc2013-epiphany-3ee22bbfc7953fe5912f516a647244a56505a252.tar.zst gsoc2013-epiphany-3ee22bbfc7953fe5912f516a647244a56505a252.zip |
ephy-zoom: use new coding style
-rw-r--r-- | lib/ephy-zoom.c | 31 | ||||
-rw-r--r-- | lib/ephy-zoom.h | 42 |
2 files changed, 36 insertions, 37 deletions
diff --git a/lib/ephy-zoom.c b/lib/ephy-zoom.c index 4cfe8c915..be44217d0 100644 --- a/lib/ephy-zoom.c +++ b/lib/ephy-zoom.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Copyright © 2003 Christian Persch * @@ -18,7 +19,6 @@ */ #include "config.h" - #include "ephy-zoom.h" #include <math.h> @@ -26,36 +26,35 @@ int ephy_zoom_get_zoom_level_index (float level) { - guint i; - float previous, current, mean; + guint i; + float previous, current, mean; - previous = zoom_levels[0].level; + previous = zoom_levels[0].level; - for (i = 1; i < n_zoom_levels; i++) - { - current = zoom_levels[i].level; - mean = sqrt (previous * current); + for (i = 1; i < n_zoom_levels; i++) { + current = zoom_levels[i].level; + mean = sqrt (previous * current); - if (level <= mean) return i - 1; + if (level <= mean) return i - 1; - previous = current; - } + previous = current; + } - return n_zoom_levels - 1; + return n_zoom_levels - 1; } float ephy_zoom_get_changed_zoom_level (float level, int steps) { - int index; + int index; - index = ephy_zoom_get_zoom_level_index (level); - return zoom_levels[CLAMP(index + steps, 0, (int) n_zoom_levels - 1)].level; + index = ephy_zoom_get_zoom_level_index (level); + return zoom_levels[CLAMP(index + steps, 0, (int) n_zoom_levels - 1)].level; } float ephy_zoom_get_nearest_zoom_level (float level) { - return ephy_zoom_get_changed_zoom_level (level, 0); + return ephy_zoom_get_changed_zoom_level (level, 0); } diff --git a/lib/ephy-zoom.h b/lib/ephy-zoom.h index 085dc5be7..0505d0398 100644 --- a/lib/ephy-zoom.h +++ b/lib/ephy-zoom.h @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Copyright © 2003 Christian Persch * @@ -36,34 +37,33 @@ G_BEGIN_DECLS static const struct { - gchar *name; - float level; + 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 } + { 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); +static const guint n_zoom_levels = G_N_ELEMENTS (zoom_levels); -float ephy_zoom_get_changed_zoom_level (float level, - int steps); +#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) -float ephy_zoom_get_nearest_zoom_level (float level); +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 |