1 /* gEDA - GPL Electronic Design Automation
2 * libgeda - gEDA's library
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <sys/types.h>
31 #include "libgeda_priv.h"
33 #ifdef HAVE_LIBDMALLOC
38 struct st_papersizes_names
{
44 static int papersizes_index
=0;
47 #define MAX_PAGESIZES 60
50 * and eventually make this unlimited
53 static struct st_papersizes_names papersizes
[MAX_PAGESIZES
];
55 /*! \todo Finish function documentation!!!
57 * \par Function Description
58 * width and height in portrait mode
60 int s_papersizes_add_entry(char *new_papersize
, int width
, int height
)
62 if (new_papersize
== NULL
) {
66 if (papersizes_index
>= MAX_PAGESIZES
) {
70 papersizes
[papersizes_index
].papersize_name
= g_strdup (new_papersize
);
72 papersizes
[papersizes_index
].width
= width
;
73 papersizes
[papersizes_index
].height
= height
;
76 return(papersizes_index
);
79 /*! \todo Finish function documentation!!!
81 * \par Function Description
84 void s_papersizes_print()
88 for (i
= 0; i
< papersizes_index
; i
++) {
89 printf("%s\n", papersizes
[i
].papersize_name
);
93 /*! \todo Finish function documentation!!!
95 * \par Function Description
96 * true for uniqueness, zero for duplication
98 int s_papersizes_uniq(char *name
)
102 for (i
= 0; i
< papersizes_index
; i
++) {
103 if (strcmp(papersizes
[i
].papersize_name
, name
) == 0) {
111 /*! \todo Finish function documentation!!!
113 * \par Function Description
116 void s_papersizes_free()
120 for (i
= 0; i
< papersizes_index
; i
++) {
121 g_free(papersizes
[i
].papersize_name
);
127 /*! \todo Finish function documentation!!!
129 * \par Function Description
132 void s_papersizes_init()
135 for (i
= 0; i
< MAX_PAGESIZES
; i
++) {
136 papersizes
[i
].papersize_name
= NULL
;
140 /*! \todo Finish function documentation!!!
142 * \par Function Description
145 char *s_papersizes_get(int counter
)
147 if (counter
< papersizes_index
) {
148 return(papersizes
[counter
].papersize_name
);
154 /*! \todo Finish function documentation!!!
156 * \par Function Description
159 void s_papersizes_get_size(char *string
, int *width
, int *height
)
163 for (i
= 0; i
< papersizes_index
; i
++) {
164 if (strcmp(papersizes
[i
].papersize_name
, string
) == 0) {
165 *width
= papersizes
[i
].width
;
166 *height
= papersizes
[i
].height
;