static int do_info_line(int x, int y, char *label, char *text) { char buf[512]; snprintf(buf, sizeof buf, "%s: %s", label, text); ui_draw_string(ctx, x, y, buf); return y + ui.lineheight; }
static void ui_label_draw(int x0, int y0, int x1, int y1, const char *text) { glColor4f(1, 1, 1, 1); glRectf(x0, y0, x1, y1); glColor4f(0, 0, 0, 1); ui_draw_string(ctx, x0 + 2, y0 + 2 + ui.baseline, text); }
static int lua_ui_draw_string(lua_State *L) { const char *text; int x, y, flags; text = lua_tostring(L, 2); x = lua_tonumber(L, 3); y = lua_tonumber(L, 4); flags = lua_tonumber(L, 5); ui_draw_string(text, x, y, flags); return 0; }
static void ui_draw_tag_value(const char* tag, const char* value, XftFont* font, int x, int y, int maxwidth, int* width) { int accx = x; int tagwidth = 0; ui_draw_string(tag, font, &ui_infocolortag, accx, y, maxwidth, &tagwidth); accx += tagwidth; XGlyphInfo extents; XftTextExtents8(ui_display, font, (XftChar8*) "x", 1, &extents); accx += extents.width; int valuewidth = 0; ui_draw_string(value, font, &ui_infocolor, accx, y, maxwidth - (accx - x), &valuewidth); accx += valuewidth; if (NULL != width) { *width = accx - x; } }
static int do_outline_imp(fz_outline *node, int end, int x0, int x1, int x, int y) { int h = 0; int p = currentpage; int n = end; while (node) { if (node->dest.kind == FZ_LINK_GOTO) { p = node->dest.ld.gotor.page; if (ui.x >= x0 && ui.x < x1 && ui.y >= y + h && ui.y < y + h + ui.lineheight) { ui.hot = node; if (!ui.active && ui.down) { ui.active = node; jump_to_page(p); ui_needs_update = 1; /* we changed the current page, so force a redraw */ } } n = end; if (node->next && node->next->dest.kind == FZ_LINK_GOTO) { n = node->next->dest.ld.gotor.page; } if (currentpage == p || (currentpage > p && currentpage < n)) { glColor4f(0.9f, 0.9f, 0.9f, 1.0f); glRectf(x0, y + h, x1, y + h + ui.lineheight); } } glColor4f(0, 0, 0, 1); ui_draw_string(ctx, x, y + h + ui.baseline, node->title); h += ui.lineheight; if (node->down) h += do_outline_imp(node->down, n, x0, x1, x + ui.lineheight, y + h); node = node->next; } return h; }
static void ui_draw_name_string(const char* str, int x, int y, int maxwidth, int* width) { ui_draw_string( str, ui_namefont, &ui_infocolor, x, y, maxwidth, width); }
static void ui_draw_info_string_tag(const char* str, int x, int y, int maxwidth, int* width) { ui_draw_string( str, ui_infofont, &ui_infocolortag, x, y, maxwidth, width); }