Changeset b433f68 in mainline for uspace/lib/ui/src


Ignore:
Timestamp:
2021-02-26T16:23:36Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77ffa01
Parents:
fe40b67
Message:

Puttext needs to know the color of the text being printed

So far we were using the GC's current drawing color. But unless there
was a way to read it, we could not render text-mode text in the correct
color.

Location:
uspace/lib/ui/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/checkbox.c

    rfe40b67 rb433f68  
    192192
    193193                gfx_text_fmt_init(&fmt);
     194                fmt.color = checkbox->res->entry_fg_color;
    194195                fmt.halign = gfx_halign_center;
    195196                fmt.valign = gfx_valign_center;
    196 
    197                 rc = gfx_set_color(checkbox->res->gc,
    198                     checkbox->res->entry_fg_color);
    199                 if (rc != EOK)
    200                         goto error;
    201197
    202198                rc = gfx_puttext(checkbox->res->font, &box_center, &fmt, "X");
     
    207203        /* Paint checkbox label */
    208204
    209         rc = gfx_set_color(checkbox->res->gc, checkbox->res->wnd_text_color);
    210         if (rc != EOK)
    211                 goto error;
    212 
    213         /* Label position */
    214205        pos.x = box_rect.p1.x + checkbox_label_margin;
    215206        pos.y = (box_rect.p0.y + box_rect.p1.y) / 2;
    216207
    217208        gfx_text_fmt_init(&fmt);
     209        fmt.color = checkbox->res->wnd_text_color;
    218210        fmt.halign = gfx_halign_left;
    219211        fmt.valign = gfx_valign_center;
  • uspace/lib/ui/src/entry.c

    rfe40b67 rb433f68  
    208208
    209209        gfx_text_fmt_init(&fmt);
     210        fmt.color = entry->res->entry_fg_color;
    210211        fmt.halign = entry->halign;
    211212        fmt.valign = gfx_valign_top;
    212 
    213         rc = gfx_set_color(entry->res->gc, entry->res->entry_fg_color);
    214         if (rc != EOK)
    215                 goto error;
    216213
    217214        rc = gfx_puttext(entry->res->font, &pos, &fmt, entry->text);
  • uspace/lib/ui/src/label.c

    rfe40b67 rb433f68  
    193193
    194194        gfx_text_fmt_init(&fmt);
     195        fmt.color = label->res->wnd_text_color;
    195196        fmt.halign = label->halign;
    196197        fmt.valign = gfx_valign_top;
    197 
    198         rc = gfx_set_color(label->res->gc, label->res->wnd_text_color);
    199         if (rc != EOK)
    200                 goto error;
    201198
    202199        rc = gfx_puttext(label->res->font, &pos, &fmt, label->text);
  • uspace/lib/ui/src/pbutton.c

    rfe40b67 rb433f68  
    269269                goto error;
    270270
    271         rc = gfx_set_color(pbutton->res->gc, pbutton->res->btn_text_color);
    272         if (rc != EOK)
    273                 goto error;
    274 
    275271        /* Center of button rectangle */
    276272        pos.x = (rect.p0.x + rect.p1.x) / 2;
     
    283279
    284280        gfx_text_fmt_init(&fmt);
     281        fmt.color = pbutton->res->btn_text_color;
    285282        fmt.halign = gfx_halign_center;
    286283        fmt.valign = gfx_valign_center;
  • uspace/lib/ui/src/rbutton.c

    rfe40b67 rb433f68  
    274274        /* Paint rbutton label */
    275275
    276         rc = gfx_set_color(rbutton->group->res->gc,
    277             rbutton->group->res->wnd_text_color);
    278         if (rc != EOK)
    279                 goto error;
    280 
    281         /* Label position */
    282276        pos.x = center.x + rbutton_oframe_r + rbutton_label_margin;
    283277        pos.y = center.y;
    284278
    285279        gfx_text_fmt_init(&fmt);
     280        fmt.color = rbutton->group->res->wnd_text_color;
    286281        fmt.halign = gfx_halign_left;
    287282        fmt.valign = gfx_valign_center;
  • uspace/lib/ui/src/wdecor.c

    rfe40b67 rb433f68  
    213213
    214214                gfx_text_fmt_init(&fmt);
     215                fmt.color = wdecor->active ?
     216                    wdecor->res->tbar_act_text_color :
     217                    wdecor->res->tbar_inact_text_color;
    215218                fmt.halign = gfx_halign_center;
    216219                fmt.valign = gfx_valign_center;
     
    218221                pos.x = (trect.p0.x + trect.p1.x) / 2;
    219222                pos.y = (trect.p0.y + trect.p1.y) / 2;
    220 
    221                 rc = gfx_set_color(wdecor->res->gc, wdecor->active ?
    222                     wdecor->res->tbar_act_text_color :
    223                     wdecor->res->tbar_inact_text_color);
    224                 if (rc != EOK)
    225                         return rc;
    226223
    227224                rc = gfx_puttext(wdecor->res->font, &pos, &fmt, wdecor->caption);
Note: See TracChangeset for help on using the changeset viewer.