X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fframe-draw.c;h=0b3411a85b1e4e44407f89efe0a74faf909e667b;hb=refs%2Ftags%2F20070506;hp=5be2e6ba63567c673749939fe18bd7faf8015450;hpb=de22e45179cb3bafa490294d31d47f361047a30a;p=ion3.git diff --git a/ioncore/frame-draw.c b/ioncore/frame-draw.c index 5be2e6b..0b3411a 100644 --- a/ioncore/frame-draw.c +++ b/ioncore/frame-draw.c @@ -3,10 +3,7 @@ * * Copyright (c) Tuomo Valkonen 1999-2007. * - * 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 @@ -321,18 +318,7 @@ void frame_recalc_bar(WFrame *frame) FRAME_MX_FOR_ALL(sub, frame, tmp){ textw=init_title(frame, i); if(textw>0){ - if(frame->flags&FRAME_SHOW_NUMBERS){ - char *s=NULL; - libtu_asprintf(&s, "[%d]", i+1); - if(s!=NULL){ - title=grbrush_make_label(frame->bar_brush, s, textw); - free(s); - }else{ - title=NULL; - } - }else{ - title=region_make_label(sub, textw, frame->bar_brush); - } + title=region_make_label(sub, textw, frame->bar_brush); frame->titles[i].text=title; } i++; @@ -340,19 +326,6 @@ void frame_recalc_bar(WFrame *frame) } -static void set_common_attrs(const WFrame *frame, GrBrush *brush) -{ - ensure_create_attrs(); - - grbrush_set_attr(brush, REGION_IS_ACTIVE(frame) - ? GR_ATTR(active) - : GR_ATTR(inactive)); - grbrush_set_attr(brush, frame->quasiactive_count>0 - ? GR_ATTR(quasiactive) - : GR_ATTR(not_quasiactive)); -} - - void frame_draw_bar(const WFrame *frame, bool complete) { WRectangle geom; @@ -367,7 +340,7 @@ void frame_draw_bar(const WFrame *frame, bool complete) grbrush_begin(frame->bar_brush, &geom, GRBRUSH_AMEND); - set_common_attrs(frame, frame->bar_brush); + grbrush_init_attr(frame->bar_brush, &frame->baseattr); grbrush_draw_textboxes(frame->bar_brush, &geom, frame->titles_n, frame->titles, complete); @@ -386,7 +359,7 @@ void frame_draw(const WFrame *frame, bool complete) grbrush_begin(frame->brush, &geom, (complete ? 0 : GRBRUSH_NO_CLEAR_OK)); - set_common_attrs(frame, frame->brush); + grbrush_init_attr(frame->brush, &frame->baseattr); grbrush_draw_border(frame->brush, &geom); @@ -564,14 +537,52 @@ bool frame_set_background(WFrame *frame, bool set_always) void frame_setup_dragwin_style(WFrame *frame, GrStyleSpec *spec, int tab) { + gr_stylespec_append(spec, &frame->baseattr); gr_stylespec_append(spec, &frame->titles[tab].attr); +} + + +/*}}}*/ + + +/*{{{ Activated/inactivated */ + + +void frame_inactivated(WFrame *frame) +{ + ensure_create_attrs(); + + gr_stylespec_set(&frame->baseattr, GR_ATTR(inactive)); + gr_stylespec_unset(&frame->baseattr, GR_ATTR(active)); + + window_draw((WWindow*)frame, FALSE); +} + + +void frame_activated(WFrame *frame) +{ + ensure_create_attrs(); + + gr_stylespec_set(&frame->baseattr, GR_ATTR(active)); + gr_stylespec_unset(&frame->baseattr, GR_ATTR(inactive)); + + window_draw((WWindow*)frame, FALSE); +} + + +void frame_quasiactivity_change(WFrame *frame) +{ + bool is=(frame->quasiact_source!=NULL); - gr_stylespec_set(spec, REGION_IS_ACTIVE(frame) - ? GR_ATTR(active) - : GR_ATTR(inactive)); - gr_stylespec_set(spec, frame->quasiactive_count>0 - ? GR_ATTR(quasiactive) - : GR_ATTR(not_quasiactive)); + ensure_create_attrs(); + + if(is){ + gr_stylespec_set(&frame->baseattr, GR_ATTR(quasiactive)); + gr_stylespec_unset(&frame->baseattr, GR_ATTR(not_quasiactive)); + }else{ + gr_stylespec_set(&frame->baseattr, GR_ATTR(not_quasiactive)); + gr_stylespec_unset(&frame->baseattr, GR_ATTR(quasiactive)); + } }