/* 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. */ #ifndef __DEFS_H__ #define __DEFS_H__ #include "../config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_WCTYPE_H #include #endif #include #include #include #include #include #include #include #include #include "intl.h" #ifdef DEBUG #define D_P0(a) g_print(a) #define D_P1(a, b) g_print(a, b) #define D_P2(a, b, c) g_print(a, b, c) #define D_P3(a, b, c, d) g_print(a, b, c, d) #define D_P4(a, b, c, d, e) g_print(a, b, c, d, e) #define D_P5(a, b, c, d, e, f) g_print(a, b, c, d, e, f) #define D_P6(a, b, c, d, e, f, g) g_print(a, b, c, d, e, f, g) #define D_P7(a, b, c, d, e, f, g, h) g_print(a, b, c, d, e, f, g, h) #define D_P8(a, b, c, d, e, f, g, h, i) g_print(a, b, c, d, e, f, g, h, i) #else #define D_P0(a) #define D_P1(a, b) #define D_P2(a, b, c) #define D_P3(a, b, c, d) #define D_P4(a, b, c, d, e) #define D_P5(a, b, c, d, e, f) #define D_P6(a, b, c, d, e, f, g) #define D_P7(a, b, c, d, e, f, g, h) #define D_P8(a, b, c, d, e, f, g, h, i) #endif #define eb_uint1(p) (*(const unsigned char *)(p)) #define eb_uint2(p) ((*(const unsigned char *)(p) << 8) \ + (*(const unsigned char *)((p) + 1))) #define eb_uint3(p) ((*(const unsigned char *)(p) << 16) \ + (*(const unsigned char *)((p) + 1) << 8) \ + (*(const unsigned char *)((p) + 2))) #define eb_uint4(p) ((*(const unsigned char *)(p) << 24) \ + (*(const unsigned char *)((p) + 1) << 16) \ + (*(const unsigned char *)((p) + 2) << 8) \ + (*(const unsigned char *)((p) + 3))) #define eb_uint4_le(p) ((*(const unsigned char *)(p)) \ + (*(const unsigned char *)((p) + 1) << 8) \ + (*(const unsigned char *)((p) + 2) << 16) \ + (*(const unsigned char *)((p) + 3) << 24)) #define MAX_BUFF 512 #define MAX_BOOKS 128 #define MAX_MULTI_SEARCH 10 #define SEARCH_METHOD_AUTOMATIC 50 #define SEARCH_METHOD_WORD 0 #define SEARCH_METHOD_ENDWORD 1 #define SEARCH_METHOD_EXACTWORD 2 #define SEARCH_METHOD_KEYWORD 3 #define SEARCH_METHOD_MULTI 4 #define SEARCH_METHOD_MENU 10 #define SEARCH_METHOD_COPYRIGHT 11 #define SEARCH_METHOD_FULL_TEXT 12 #define SEARCH_METHOD_FULL_HEADING 13 #define SEARCH_METHOD_INTERNET 14 #define SEARCH_METHOD_UNKNOWN 99 #define SEARCH_METHOD_MIN 0 #define SEARCH_METHOD_MAX 4 #define CURSOR_LINK GDK_HAND2 #define CURSOR_NORMAL GDK_LEFT_PTR #define CURSOR_BUSY GDK_CLOCK #define CURSOR_SOUND GDK_CLOCK #define LINK_TYPE_NONE 0 #define LINK_TYPE_JUMP 1 << 1 #define LINK_TYPE_WAVE 1 << 2 #define LINK_TYPE_MPEG 1 << 3 #define LINK_TYPE_EMPHASIS 1 << 4 #define LINK_TYPE_SUBSCRIPT 1 << 5 #define LINK_TYPE_SUPERSCRIPT 1 << 6 #define LINK_TYPE_KEYWORD 1 << 7 #define LINK_TYPE_ITALIC 1 << 8 #define LINK_TYPE_CENTER 1 << 9 #define DATA_TEXT 0 #define DATA_NOENDTAG 1 #define DATA_SPECIAL 2 #define DATA_BRANCH 3 #define COLOR_WHITE 0 #define COLOR_BLACK 1 #define COLOR_BLUE 2 #define COLOR_RED 3 #define COLOR_GREEN 4 #define COLOR_BROWN 5 #define COLOR_YELLOW 6 #define NUM_COLORS 7 #define HEADING_WIDTH 1024 #define HEADING_HEIGHT 18 #define HEADING_PIXMAP_WIDTH 2048 #define HEADING_PIXMAP_HEIGHT 18 #define LINE_HEIGHT 18 #define DICT_WIDTH 500 #define DICT_HEIGHT 1024*10 #define PIXMAP_BUFFER_WIDTH 1280 #define PIXMAP_BUFFER_HEIGHT 1024*10 #define GAIJI_ADJUSTMENT 2 #define MODE_PLAIN 0 #define MODE_REDRAW 1 #define MODE_LINK 2 #define DIRECTION_FORWARD 0 #define DIRECTION_BACKWARD 1 #define MAX_DICT_GROUP 255 #define MAX_GROUP_MEMBER 255 #define MAX_KEYWORD_LENGTH 255 struct _gaiji_cache { gint code; guchar *data; gint width; gint height; }; typedef struct _gaiji_cache GAIJI_CACHE; struct _book_info { gboolean available; EB_Book *book; EB_Appendix *appendix; char *book_path; char *appendix_path; EB_Subbook_Code subbook_no; EB_Subbook_Code appendix_subbook_no; char *subbook_dir; char *subbook_title; GList *gaiji_narrow16; GList *gaiji_narrow24; GList *gaiji_narrow30; GList *gaiji_narrow48; GList *gaiji_wide16; GList *gaiji_wide24; GList *gaiji_wide30; GList *gaiji_wide48; gboolean search_method[20]; // struct _book_info *next; // struct _book_info *previous; }; typedef struct _book_info BOOK_INFO; typedef struct _{ gchar *title; void (*callback)(); } DialogButtons; struct _search_method { int code; char *name; }; struct _dict_member { char *name; BOOK_INFO *binfo; gboolean active; }; typedef struct _dict_member DICT_MEMBER; struct _dict_group { char *name; gboolean active; GList *member; }; typedef struct _dict_group DICT_GROUP; struct _link { gint type; gint start_x; gint start_y; gint end_x; gint end_y; gint page; gint offset; gint size; gchar filename[256]; }; typedef struct _link LINK; struct _search_result { BOOK_INFO *book_info; gint search_method; gchar *heading; EB_Position pos_heading; EB_Position pos_text; }; typedef struct _search_result SEARCH_RESULT; struct _multi_search { BOOK_INFO *book_info; gint code; gchar *text; }; typedef struct _multi_search MULTI_SEARCH; struct _item_data { gint type; GdkPixmap *pixbuff; SEARCH_RESULT *result; }; typedef struct _item_data ITEM_DATA; struct _subtree_data{ gint book_no; EB_Position pos_text; }; typedef struct _subtree_data SUBTREE_DATA; struct _history { // gchar *word; BOOK_INFO *book_info; gint page; gint offset; }; typedef struct _history HISTORY; struct _ending { char *pattern; char *normal; struct _ending *next; }; typedef struct _ending ENDING ; struct _web_member { gchar *name; gchar *home; gchar *pre; gchar *post; gchar *glue; gchar *charcode; }; typedef struct _web_member WEB_MEMBER; struct _web_group { gchar *name; GList *member; }; typedef struct _web_group WEB_GROUP; #define LOCATION_CHAR 1 #define LOCATION_GAIJI 2 struct _location { gint type; gint x; gint y; gint width; gint height; GdkWChar wc; char gaiji_no[6]; GdkFont *font; gint link_type; gboolean reverse; }; typedef struct _location LOCATION; typedef struct _canvas CANVAS; typedef struct _content_area CONTENT_AREA; struct _canvas { GtkWidget *window; GdkPixmap *pixmap; CONTENT_AREA *content_area; gint x; gint y; gint width; gint height; gint max_width; GdkGC *gc; GdkFont *font; gint indent; gint line_height; // gboolean (*clear)(CANVAS *canvas); // gboolean (*destroy)(CANVAS *canvas); // gboolean (*create_pixmap)(CANVAS *canvas, gint width, gint height); }; struct _content_area { GtkWidget *area; CANVAS *canvas; GList *link; GList *location; GList *history; GList *current_in_history; /* for selection computation */ GList *selection_start; GList *selection_end; gint button_x; gint button_y; gint direction; gboolean bbutton_down; /* for redraw */ gint old_width; gint old_height; /* custom function */ gint (*click_func)(GtkWidget *widget, GdkEventButton *event); void (*show_func)(BOOK_INFO *binfo, gchar *text); void (*redraw_func)(BOOK_INFO *binfo, gchar *text); // gint (*expose_func)(GtkWidget *widget, GdkEventExpose *event); }; struct _draw_text{ gchar *text; gint length; }; typedef struct _draw_text DRAW_TEXT; typedef enum { SEL_TYPE_NONE, APPLE_PICT, ATOM, ATOM_PAIR, BITMAP, C_STRING, COLORMAP, COMPOUND_TEXT, DRAWABLE, INTEGER, PIXEL, PIXMAP, SPAN, STRING, TEXT, WINDOW, LAST_SEL_TYPE } SelType; struct _shortcut_command { gchar *description; void (* func)(); }; struct _shortcut { guint state; guint keyval; struct _shortcut_command *command; }; struct _shortcuts { gint count; struct _shortcut shortcut[256]; }; #define ENABLE_WEBSEARCH #endif /* __DEFS_H__ */