/* Copyright (C) 2001-2002 Kenichi Suto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" #ifdef HAVE_WCHAR_H #include #endif #include "global.h" void add_location_char(CONTENT_AREA *content_area, GdkWChar wc, gint x, gint y, gint width, gint height, GdkFont *font, LINK *link) { LOCATION *l; char *p; char buff[16]; p = (char *)&wc; memcpy(buff, &wc, sizeof(GdkWChar)); buff[sizeof(GdkWChar)] = '\0'; // p = gdk_wcstombs((GdkWChar *)buff); // g_print("CHAR : %s %d %d %d %d\n", p, x, y, width, height); l = (LOCATION *)calloc(sizeof(LOCATION), 1); if(l == NULL){ fprintf(stderr, "No memory\n"); exit(1); } l->type = LOCATION_CHAR; l->x = x; l->y = y; l->width = width; l->height = height; l->wc = wc; l->font = font; l->reverse = FALSE;; if(link != NULL) l->link_type = link->type; else l->link_type = LINK_TYPE_NONE; // g_print("l->ch.wc = %08x\n", l->ch.wc); content_area->location = g_list_append(content_area->location, l); } void add_location_gaiji(CONTENT_AREA *content_area, gchar *char_no, gint x, gint y, gint width, gint height, LINK *link) { LOCATION *l; // g_print("GAIJI : %s %d %d %d %d %08x\n", char_no, x, y, width, height, link); g_assert(strlen(char_no) <= 5); l = (LOCATION *)calloc(sizeof(LOCATION), 1); if(l == NULL){ fprintf(stderr, "No memory\n"); exit(1); } l->type = LOCATION_GAIJI; l->x = x; l->y = y; l->width = width; l->height = height; l->reverse = FALSE;; if(link != NULL) l->link_type = link->type; else l->link_type = LINK_TYPE_NONE; sprintf(l->gaiji_no, "%s", char_no); content_area->location = g_list_append(content_area->location, l); } void clear_location(CONTENT_AREA *content_area) { GList *item; item = g_list_first(content_area->location); while(item){ free(item->data); item = g_list_next(item); } g_list_free(content_area->location); content_area->location = NULL; }