#ifndef _frame_h_ #define _frame_h_ #include "obj.h" #include "tag.h" #include "style.h" #include "block.h" #include "stylesheet.h" #include "text.h" #include "timer.h" #define NO_PIXEL 0xffffffff #define BR_NORMAL 0x00 #define BR_LEFT 0x01 #define BR_RIGHT 0x02 #define BR_ALL 0x03 typedef enum FormatType { FORMAT_NONE, FORMAT_BLOCK, FORMAT_INLINE, FORMAT_FLOAT, } FormatType; typedef struct BlockFormatInfo { int after_lf; /* 改行直後フラグ */ int paragraph; /* 段落開始フラグ */ int pre; /* preformatted flag */ int li_cnt; /* リスト用カウンタ */ int li_level; /* リスト用インデントレベル */ int linkmode; /* link mode */ int off_x; /* 表示オフセット */ int off_y; int cur_x; int cur_y; int width; int formatted_width; HTMLObjList left; HTMLObjList right; int left_image_margin; int left_image_height; int right_image_margin; int right_image_height; /* 行情報 */ int max_ascent; int max_descent; int prev_ascent; int prev_descent; int next_linesep; /* パース完了済みリスト */ HTMLObjList obj; /* そのブロック構造中の全オブジェクト */ HTMLObjList line_p; /* パース中の行の先頭のさらに前 */ HTMLObjList line; /* パース中の行の先頭 */ } BlockFormatInfo; typedef struct ParseInfo { struct ParseInfo *next; /* stack */ TagInfo *taginfo; /* この構造を構成してるタグのデータ */ FormatType type; DTDCur *dtdcur; /* 現在のパース状況 */ BlockFormatInfo *bfinfo; /* ブロック構造のパラメータ */ StyleSheetSet *styleset; /* このタグに適応されるスタイルシート */ InlineStyleInfo *istyle; /* テキストのスタイル */ BlockStyleInfo *bstyle; /* for style sheet */ SSID sel; SSID id; SSID class; int pseudoclass; } ParseInfo, *ParseInfoList; typedef struct ColorList { struct ColorList *next; XrmQuark name; u_long pixel; } ColorList; #define WIDTH (bfi->width - bfi->left_image_margin - bfi->right_image_margin) #define CUR_X (bfi->left_image_margin + bfi->cur_x) #define CUR_Y (bfi->cur_y) typedef struct Frame { char *name; char *path; int fd; Display *dpy; Window win; Colormap colormap; GC gc; Pixmap backup; int r_w; /* ウィンドウの実際の大きさ */ int r_h; int width; /* 基本表示はば */ int height; int formatted_width; int formatted_height; int off_x; /* 表示 offset */ int off_y; int scr_x; /* スクロール量指定 */ int scr_y; InlineStyleInfo *link_style; /* リンク用のスタイル */ int basefont; /* 基本フォントサイズ */ OC *font[FONTTYPE_ALL][7]; /* フォント形状スタイル情報 */ u_long foreground; u_long background; /* 背景色 */ ImageData *bg_image; /* 背景 pixmap */ ParseInfoList pinfo; TagWork *tagwork; /* タグパース情報 */ int eof; /* パース完了フラグ */ StyleSheet *stylesheet; /* このフレームに適応される stylesheet */ /* ---------- object infos ---------- */ HTMLObjList body; /* 表示用 */ HTMLObjList disp_start; /* 現表示領域開始点 */ HTMLObjList disp_end; /* 現表示領域終了点 */ TimerDatList images; /* 動画情報 */ ColorList *pixels; /* 使用中の色 */ HTMLHrefInfoList links; /* リンク情報 */ HTMLNameInfoList names; /* 参照中名前情報(簡易キャッシュ) */ } Frame; BlockFormatInfo *frame_get_blockformatinfo(Frame *f); BlockStyleInfo *frame_get_blockstyleinfo(Frame *f); BlockFormatInfo *frame_get_parent_blockformatinfo(Frame *f); /* frame.c */ Frame *frame_new(Display *dpy, Window win, FontFaceTableList fitl, FontNameList fnl, FontNameList fnt_fixed, u_int width, u_int height, int off_x, int off_y); void frame_resize(Frame *f, int width, int height, int off_x, int off_y); int frame_open(Frame *f, int fd, char *path); void frame_delete(Frame *f); void frame_expose(Frame *f, int x, int y, int w, int h); void frame_expose_region(Frame *f, Region reg); void frame_alloc_color(Frame *f, char *name, u_long *ret); void frame_push_parseinfo(Frame *f, Tag *tag); void frame_pop_parseinfo(Frame *f); int frame_find_parseinfo(Frame *f, TAGS tag); /* frame_dtd.c */ int frame_check_dtd(Frame *f, TagInfo *ti, TagInfo **ommit); /* frame_add.c */ void frame_add_link(Frame *f, HTMLHrefInfo *p); void frame_add_obj(Frame *f, HTMLObj *obj); void frame_add_obj_before_line(Frame *f, HTMLObj *obj); void frame_add_left(Frame *f, HTMLObj *obj); void frame_add_right(Frame *f, HTMLObj *obj); void frame_add_vspace(Frame *f, int linesep); void frame_add_lf(Frame *f, int mode); void frame_add_body(Frame *f); void frame_add_bullet(Frame *f, int type); void frame_add_string(Frame *f, wchar_t *str, size_t len, int mode); void frame_add_image(Frame *f, Animate *a, int w, int h, int b, int align); void frame_add_hr(Frame *f, int align, int width, int size); void frame_add_blockobj(Frame *f, ParseInfo *p); /* disp.c */ void frame_check_area(Frame *f); void frame_disp_all(Frame *f); void frame_disp_area(Frame *f, int x, int y, int w, int h); void frame_set_pos(Frame *f, int scr_x, int scr_y); void frame_scroll(Frame *f, int dx, int dy); void frame_disp_obj(Frame *f, HTMLObj *p); FILE *frame_file_open(Frame *f, char *name); HTMLHrefInfo* frame_get_url(Frame *f, int x, int y); /* style.c */ InlineStyleInfo *inlinestyleinfo_new(Frame *f); void inlinestyleinfo_delete(InlineStyleInfo *p); void inlinestyleinfo_setcolor(Frame *f, InlineStyleInfo *p, char *name); void inlinestyleinfo_setsize(Frame *f, InlineStyleInfo *s, int size); void inlinestyleinfo_setfonttype(Frame *f, InlineStyleInfo *s, int type); void blockstyleinfo_get_stylesheet(StyleSheetSetList l, BlockStyleInfo *bs); /* frame_style.c */ void frame_init_default_stylesheet(FILE *fp); void frame_init_user_stylesheet(FILE *fp); void frame_init_dtd(FILE *fp); void stylesheetsetlist_show(StyleSheetSetList l); StyleSheetSetList frame_get_stylesheetsetlist(Frame *frame, ParseInfo *pi); BlockStyleInfo *frame_blockstyleinfo_new(Frame *f, StyleSheetSetList sssl); /* style_term.c */ int term_pixel(Frame *f, SSTerm *t, int d); int term_text_align(SSTerm *t, AlignMode def); SSTerm term_line_height(Frame *f, SSTerm *t, SSTerm def); #endif