📄 panel_util.c
字号:
/* value rect */ ip->value_rect.r_left += deltas->r_left; ip->value_rect.r_top += deltas->r_top; /* item */ (*ip->ops->layout)(ip, deltas);} /* panel_layout *//*****************************************************************************//* panel_paint_image *//* paints image in pw in rect. *//*****************************************************************************/panel_paint_image(panel, image, rect, op)panel_handle panel;panel_image_handle image;Rect *rect;int op;{ int top; switch (image->im_type) { case IM_STRING: /* baseline offset */ top = rect->r_top + panel_fonthome(image_font(image)); (void)panel_pw_text(panel, rect->r_left, top, PIX_SRC|op, image_font(image), image_string(image)); if (image_bold(image)) (void)panel_pw_text(panel, rect->r_left+1, top, PIX_SRC|PIX_DST|op, image_font(image), image_string(image)); break; case IM_PIXRECT: (void)panel_pw_write(panel, rect->r_left, rect->r_top, image_pixrect(image)->pr_width, image_pixrect(image)->pr_height, PIX_SRC|op, image_pixrect(image), 0, 0); break; } if (image_shaded(image)) (void)panel_shade(panel, rect);}/*****************************************************************************//* panel_paint_pixrect *//*****************************************************************************/panel_paint_pixrect(panel, pr, rect, op)panel_handle panel;Pixrect *pr;Rect *rect;int op;{ (void)panel_pw_write(panel, rect->r_left, rect->r_top, pr->pr_width, pr->pr_height, PIX_SRC|op, pr, 0, 0);}/*****************************************************************************//* panel versions of writing and locking routines, with scrolling offsets *//*****************************************************************************/static scroll_adjust_rect(panel, rect, adjusted_rect)panel_handle panel;Rect *rect, *adjusted_rect;{ *adjusted_rect = *rect; adjusted_rect->r_top -= panel->v_offset; adjusted_rect->r_left -= panel->h_offset;}panel_pw_lock(panel, rect)panel_handle panel;Rect *rect;{ Rect adjusted_rect; scroll_adjust_rect(panel, rect, &adjusted_rect); (void)pw_lock(panel->view_pixwin, &adjusted_rect);}panel_draw_box(panel, op, r, x, y)panel_handle panel;int op;Rect *r;int x, y;{ Rect adjusted_rect; scroll_adjust_rect(panel, r, &adjusted_rect); (void)_tool_draw_box(panel->view_pixwin, op, &adjusted_rect, x, y);}panel_pw_write(panel, xd, yd, width, height, op, pr, xs, ys)register panel_handle panel;int xd, yd, width, height, op;Pixrect *pr;int xs, ys;{ (void)pw_write(panel->view_pixwin, xd - panel->h_offset, yd - panel->v_offset, width, height, op, pr, xs, ys);}panel_pw_writebackground(panel, xd, yd, width, height, op)register panel_handle panel;int xd, yd, width, height, op;{ (void)pw_writebackground(panel->view_pixwin, xd - panel->h_offset, yd - panel->v_offset, width, height, op);}panel_pw_replrop(panel, xd, yd, width, height, op, pr, xs, ys)panel_handle panel;int xd, yd, width, height, op;Pixrect *pr;int xs, ys;{ (void)pw_replrop(panel->view_pixwin, xd - panel->h_offset, yd - panel->v_offset, width, height, op, pr, xs, ys);}panel_pw_vector(panel, x0, y0, x1, y1, op, value)register panel_handle panel;int x0, y0, x1, y1, op, value;{ (void)pw_vector(panel->view_pixwin, x0 - panel->h_offset, y0 - panel->v_offset, x1 - panel->h_offset, y1 - panel->v_offset, op, value);}panel_pw_text(panel, x, y, op, font, s)panel_handle panel;int x, y, op;Pixfont *font;char *s;{ (void)pw_text(panel->view_pixwin, x - panel->h_offset, y - panel->v_offset, op, font, s);}panel_pw_ttext(panel, x, y, op, font, s)panel_handle panel;int x, y, op;Pixfont *font;char *s;{ (void)pw_ttext(panel->view_pixwin, x - panel->h_offset, y - panel->v_offset, op, font, s);}/*****************************************************************************//* panel_invert *//* inverts the rect r using panel's pixwin. *//*****************************************************************************/panel_invert(panel, r)panel_handle panel;register Rect *r;{ (void)panel_pw_writebackground(panel, r->r_left, r->r_top, r->r_width, r->r_height, PIX_NOT(PIX_DST));}panel_shade(panel, r)panel_handle panel;register Rect *r;{ (void)panel_pw_replrop(panel, r->r_left, r->r_top, r->r_width, r->r_height, PIX_SRC | PIX_DST, &panel_shade_pr, 0, 0);}panel_gray(panel, r)panel_handle panel;register Rect *r;{ (void)panel_pw_replrop(panel, r->r_left, r->r_top, r->r_width, r->r_height, PIX_SRC | PIX_DST, &panel_gray17_pr, 0, 0); (void)panel_pw_writebackground(panel, r->r_left, r->r_top, r->r_width, r->r_height, PIX_NOT(PIX_DST));}panel_clear(panel, r)panel_handle panel;register Rect *r;{ (void)panel_pw_writebackground(panel, r->r_left, r->r_top, r->r_width, r->r_height, PIX_CLR);}/*****************************************************************************//* panel_strsave *//*****************************************************************************/char *panel_strsave(source)char *source;{ char *dest; extern char *strcpy(); dest = (char *) malloc((u_int) (strlen(source) + 1)); if (!dest) return NULL; (void) strcpy(dest, source); return dest;}/*****************************************************************************//* miscellaneous utilities *//*****************************************************************************/panel_fonthome(font) Pixfont *font; { return -(font->pf_char['n'].pc_home.y);}panel_nullproc() { return 0; }voidpanel_caret_on(panel, on)panel_handle panel;int on;{ (*panel_caret_on_proc)(panel, on);}voidpanel_caret_invert(panel)panel_handle panel;{ (*panel_caret_invert_proc)(panel);}voidpanel_seln_inform(panel, event)panel_handle panel;Event *event;{ (*panel_seln_inform_proc)(panel, event);}voidpanel_seln_destroy(panel)panel_handle panel;{ (*panel_seln_destroy_proc)(panel);}panel_free_choices(choices, first, last)panel_image_handle choices;int first, last;{ register int i; /* counter */ if (!choices || last < 0) return; for (i = first; i <= last; i++) /* free the choice strings */ if (is_string(&choices[i])) free(image_string(&choices[i])); free((char *) choices);} /* panel_free_choices */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -