~andywingo/guile-gnome/pango

« back to all changes in this revision

Viewing changes to gnome/gw/pango-support.c

  • Committer: Andy Wingo
  • Date: 2007-11-24 18:09:04 UTC
  • Revision ID: wingo@pobox.com-20071124180904-tsbj54hn6smpfxhf
2007-11-24  Andy Wingo  <wingo@pobox.com>

        * gnome/overrides/pango.defs: Ignore a few more functions.

        * gnome/gw/pango-spec.scm (initialize): Wrap PangoCoverage as a
        refcounted pointer. Wrap PangoRectangle as a structure,
        represented on the Scheme side by a vector of four integers, as
        with GdkRectangle (but without a GType).

        * gnome/gw/Makefile.am (libgw_guile_gnome_pango_la_SOURCES): 
        * gnome/gw/pango-support.h: 
        * gnome/gw/pango-support.c: New files, add support code to the
        wrapper. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* guile-gnome
 
2
 * Copyright (C) 2007 Andy Wingo <wingo at pobox dot com>
 
3
 *
 
4
 * pango-support.c: Support routines for the Pango wrapper
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or    
 
7
 * modify it under the terms of the GNU General Public License as   
 
8
 * published by the Free Software Foundation; either version 2 of   
 
9
 * the License, or (at your option) any later version.              
 
10
 *                                                                  
 
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.                     
 
15
 *                                                                  
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, contact:
 
18
 *
 
19
 * Free Software Foundation           Voice:  +1-617-542-5942
 
20
 * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
 
21
 * Boston, MA  02111-1307,  USA       gnu@gnu.org
 
22
 */
 
23
 
 
24
#include <libguile.h>
 
25
#include "guile-gnome-gobject.h"
 
26
 
 
27
#include "pango-support.h"
 
28
 
 
29
SCM
 
30
scm_pango_rectangle_to_scm (PangoRectangle *rect)
 
31
{
 
32
    SCM ret = scm_c_make_vector (4, SCM_BOOL_F);
 
33
 
 
34
    scm_vector_set_x (ret, SCM_MAKINUM(0), scm_int2num (rect->x));
 
35
    scm_vector_set_x (ret, SCM_MAKINUM(1), scm_int2num (rect->y));
 
36
    scm_vector_set_x (ret, SCM_MAKINUM(2), scm_int2num (rect->width));
 
37
    scm_vector_set_x (ret, SCM_MAKINUM(3), scm_int2num (rect->height));
 
38
 
 
39
    return ret;
 
40
}
 
41
 
 
42
void
 
43
scm_scm_to_pango_rectangle (SCM scm, PangoRectangle* rect)
 
44
#define FUNC_NAME "%scm->pango-rectangle"
 
45
{
 
46
#define GET_VINT(v,i) \
 
47
  scm_num2int (scm_vector_ref (v, SCM_MAKINUM(i)), 0, FUNC_NAME)
 
48
 
 
49
    rect->x = GET_VINT (scm, 0);
 
50
    rect->y = GET_VINT (scm, 1);
 
51
    rect->width = GET_VINT (scm, 2);
 
52
    rect->height = GET_VINT (scm, 3);
 
53
}
 
54
#undef FUNC_NAME