~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to devel-docs/tools/units.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "config.h"
 
3
 
 
4
#include <glib-object.h>
 
5
 
 
6
#include "libgimpbase/gimpbase.h"
 
7
#include "libgimpbase/gimpbase-private.h"
 
8
 
 
9
#include "units.h"
 
10
 
 
11
 
 
12
typedef struct
 
13
{
 
14
  gdouble      factor;
 
15
  gint         digits;
 
16
  const gchar *identifier;
 
17
  const gchar *symbol;
 
18
  const gchar *abbreviation;
 
19
  const gchar *singular;
 
20
  const gchar *plural;
 
21
} GimpUnitDef;
 
22
 
 
23
static const GimpUnitDef unit_defs[] =
 
24
{
 
25
  {  0.0, 0, "pixels",      "px", "px", "pixel",      "pixels"      },
 
26
  {  1.0, 2, "inches",      "''", "in", "inch",       "inches"      },
 
27
  { 25.4, 1, "millimeters", "mm", "mm", "millimeter", "millimeters" }
 
28
};
 
29
 
 
30
 
 
31
static gint
 
32
units_get_number_of_units (void)
 
33
{
 
34
  return G_N_ELEMENTS (unit_defs);
 
35
}
 
36
 
 
37
static gint
 
38
units_get_number_of_built_in_units (void)
 
39
{
 
40
  return G_N_ELEMENTS (unit_defs);
 
41
}
 
42
 
 
43
static gdouble
 
44
units_unit_get_factor (GimpUnit unit)
 
45
{
 
46
  return unit_defs[unit].factor;
 
47
}
 
48
 
 
49
static gint
 
50
units_unit_get_digits (GimpUnit unit)
 
51
{
 
52
  return unit_defs[unit].digits;
 
53
}
 
54
 
 
55
static const gchar *
 
56
units_unit_get_identifier (GimpUnit unit)
 
57
{
 
58
  return unit_defs[unit].identifier;
 
59
}
 
60
 
 
61
static const gchar *
 
62
units_unit_get_symbol (GimpUnit unit)
 
63
{
 
64
  return unit_defs[unit].symbol;
 
65
}
 
66
 
 
67
static const gchar *
 
68
units_unit_get_abbreviation (GimpUnit unit)
 
69
{
 
70
  return unit_defs[unit].abbreviation;
 
71
}
 
72
 
 
73
static const gchar *
 
74
units_unit_get_singular (GimpUnit unit)
 
75
{
 
76
  return unit_defs[unit].singular;
 
77
}
 
78
 
 
79
static const gchar *
 
80
units_unit_get_plural (GimpUnit unit)
 
81
{
 
82
  return unit_defs[unit].plural;
 
83
}
 
84
 
 
85
void
 
86
units_init (void)
 
87
{
 
88
  GimpUnitVtable vtable;
 
89
 
 
90
  vtable.unit_get_number_of_units          = units_get_number_of_units;
 
91
  vtable.unit_get_number_of_built_in_units = units_get_number_of_built_in_units;
 
92
  vtable.unit_new                          = NULL;
 
93
  vtable.unit_get_factor                   = units_unit_get_factor;
 
94
  vtable.unit_get_digits                   = units_unit_get_digits;
 
95
  vtable.unit_get_identifier               = units_unit_get_identifier;
 
96
  vtable.unit_get_symbol                   = units_unit_get_symbol;
 
97
  vtable.unit_get_abbreviation             = units_unit_get_abbreviation;
 
98
  vtable.unit_get_singular                 = units_unit_get_singular;
 
99
  vtable.unit_get_plural                   = units_unit_get_plural;
 
100
 
 
101
  gimp_base_init (&vtable);
 
102
}