X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=de%2Fbrush.c;h=c2b5a4f46b3570e064b251dc6b2bcaff9400f475;hp=3101324f378849dbf4c524c2674f686844522349;hb=e3aec18706513a87eaa7839dfdaf7e0fcd0d8d2a;hpb=de22e45179cb3bafa490294d31d47f361047a30a diff --git a/de/brush.c b/de/brush.c index 3101324..c2b5a4f 100644 --- a/de/brush.c +++ b/de/brush.c @@ -1,12 +1,9 @@ /* * ion/de/brush.c * - * Copyright (c) Tuomo Valkonen 1999-2007. + * Copyright (c) Tuomo Valkonen 1999-2009. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -29,6 +26,13 @@ /*{{{ Brush creation and releasing */ +#define MATCHES(S, A) (gr_stylespec_score(&(S), A)>0) +#define MATCHES2(S, A1, A2) (gr_stylespec_score2(&(S), A1, A2)>0) + +#define ENSURE_INITSPEC(S, NM) \ + if((S).attrs==NULL) gr_stylespec_load(&(S), NM); + + static GrStyleSpec tabframe_spec=GR_STYLESPEC_INIT; static GrStyleSpec tabinfo_spec=GR_STYLESPEC_INIT; static GrStyleSpec tabmenuentry_spec=GR_STYLESPEC_INIT; @@ -185,6 +189,7 @@ void debrush_get_border_widths(DEBrush *brush, GrBorderWidths *bdw) uint tmp=0; uint tbf=1, lrf=1; uint pad=bd->pad; + uint spc=style->spacing; switch(bd->sides){ case DEBORDER_TB: @@ -195,16 +200,22 @@ void debrush_get_border_widths(DEBrush *brush, GrBorderWidths *bdw) break; } + /* Ridge/groove styles use 'padding' for the spacing between the + * 'highlight' and 'shadow' portions of the border, and 'spacing' + * between the border and contents. Inlaid style also uses 'spacing' + * between the contents and the border, and padding as its outer + * component. Elevated style does not use spacing. + */ switch(bd->style){ case DEBORDER_RIDGE: case DEBORDER_GROOVE: - tmp=bd->sh+bd->hl; - bdw->top=tbf*tmp+pad; bdw->bottom=tbf*tmp+pad; - bdw->left=lrf*tmp+pad; bdw->right=lrf*tmp+pad; + tmp=bd->sh+bd->hl+pad; + bdw->top=tbf*tmp+spc; bdw->bottom=tbf*tmp+spc; + bdw->left=lrf*tmp+spc; bdw->right=lrf*tmp+spc; break; case DEBORDER_INLAID: - tmp=bd->sh; bdw->top=tbf*tmp+pad; bdw->left=lrf*tmp+pad; - tmp=bd->hl; bdw->bottom=tbf*tmp+pad; bdw->right=lrf*tmp+pad; + tmp=bd->sh+pad; bdw->top=tbf*tmp+spc; bdw->left=lrf*tmp+spc; + tmp=bd->hl+pad; bdw->bottom=tbf*tmp+spc; bdw->right=lrf*tmp+spc; break; case DEBORDER_ELEVATED: default: @@ -225,7 +236,7 @@ bool debrush_get_extra(DEBrush *brush, const char *key, char type, void *data) { DEStyle *style=brush->d; while(style!=NULL){ - if(extl_table_get(style->data_table, 's', type, key, data)) + if(extl_table_get(style->extras_table, 's', type, key, data)) return TRUE; style=style->based_on; }