[epiphany] ephy-zoom: use new coding style
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-zoom: use new coding style
- Date: Mon, 8 Oct 2012 15:59:47 +0000 (UTC)
commit 3ee22bbfc7953fe5912f516a647244a56505a252
Author: Xan Lopez <xan igalia com>
Date: Mon Oct 8 11:58:48 2012 -0400
ephy-zoom: use new coding style
lib/ephy-zoom.c | 31 +++++++++++++++----------------
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 4cfe8c9..be44217 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 085dc5b..0505d03 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]