1 /* Dia -- an diagram creation/manipulation program
2  * Copyright (C) 2007 Lars Clausen
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18 
19 #ifdef HAVE_CONFIG_H
20 #include <config.h>
21 #endif
22 #include <string.h>
23 
24 #include "prefs.h"
25 #include "widgets.h"
26 
27 DiaUnit length_unit = DIA_UNIT_CENTIMETER;
28 DiaUnit fontsize_unit = DIA_UNIT_POINT;
29 
30 void
prefs_set_length_unit(gchar * unit)31 prefs_set_length_unit(gchar* unit) {
32   GList *name_list = get_units_name_list();
33   int i;
34 
35   for (i = 0; name_list != NULL; name_list = g_list_next(name_list), i++) {
36     if (!strcmp(unit, (gchar*) name_list->data)) {
37       length_unit = i;
38       return;
39     }
40   }
41   length_unit = DIA_UNIT_CENTIMETER;
42 }
43 
44 void
prefs_set_fontsize_unit(gchar * unit)45 prefs_set_fontsize_unit(gchar* unit) {
46   GList *name_list = get_units_name_list();
47   int i;
48 
49   for (i = 0; name_list != NULL; name_list = g_list_next(name_list), i++) {
50     if (!strcmp(unit, (gchar*) name_list->data)) {
51       fontsize_unit = i;
52       return;
53     }
54   }
55   fontsize_unit = DIA_UNIT_POINT;
56 }
57 
58 DiaUnit
prefs_get_length_unit(void)59 prefs_get_length_unit(void)
60 {
61   return length_unit;
62 }
63 
64 DiaUnit
prefs_get_fontsize_unit(void)65 prefs_get_fontsize_unit(void)
66 {
67   return fontsize_unit;
68 }
69 
70