Changeset a35b458 in mainline for uspace/lib/gui/label.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gui/label.c

    r3061bc1 ra35b458  
    5050        if (!surface)
    5151                window_yield(lbl->widget.window);
    52        
     52
    5353        drawctx_t drawctx;
    5454        drawctx_init(&drawctx, surface);
    55        
     55
    5656        drawctx_set_source(&drawctx, &lbl->background);
    5757        drawctx_transfer(&drawctx, widget->hpos, widget->vpos, widget->width,
    5858            widget->height);
    59        
     59
    6060        sysarg_t cpt_width;
    6161        sysarg_t cpt_height;
    6262        font_get_box(lbl->font, lbl->caption, &cpt_width, &cpt_height);
    63        
     63
    6464        if ((widget->width >= cpt_width) && (widget->height >= cpt_height)) {
    6565                sysarg_t x = ((widget->width - cpt_width) / 2) + widget->hpos;
    6666                sysarg_t y = ((widget->height - cpt_height) / 2) + widget->vpos;
    67                
     67
    6868                drawctx_set_source(&drawctx, &lbl->text);
    6969                drawctx_set_font(&drawctx, lbl->font);
    70                
     70
    7171                if (lbl->caption)
    7272                        drawctx_print(&drawctx, lbl->caption, x, y);
    7373        }
    74        
     74
    7575        window_yield(lbl->widget.window);
    7676}
     
    8080        if (data != NULL) {
    8181                label_t *lbl = (label_t *) widget;
    82                
     82
    8383                const char *new_caption = (const char *) data;
    8484                lbl->caption = str_dup(new_caption);
    85                
     85
    8686                sysarg_t cpt_width;
    8787                sysarg_t cpt_height;
    8888                font_get_box(lbl->font, lbl->caption, &cpt_width, &cpt_height);
    89                
     89
    9090                lbl->widget.width_min = cpt_width + 4;
    9191                lbl->widget.height_min = cpt_height + 4;
    9292                lbl->widget.width_ideal = lbl->widget.width_min;
    9393                lbl->widget.height_ideal = lbl->widget.height_min;
    94                
     94
    9595                window_refresh(lbl->widget.window);
    9696        }
     
    107107{
    108108        label_t *lbl = (label_t *) widget;
    109        
     109
    110110        deinit_label(lbl);
    111111        free(lbl);
     
    144144{
    145145        widget_init(&lbl->widget, parent, data);
    146        
     146
    147147        lbl->widget.destroy = label_destroy;
    148148        lbl->widget.reconfigure = label_reconfigure;
     
    151151        lbl->widget.handle_keyboard_event = label_handle_keyboard_event;
    152152        lbl->widget.handle_position_event = label_handle_position_event;
    153        
     153
    154154        source_init(&lbl->background);
    155155        source_set_color(&lbl->background, background);
    156        
     156
    157157        source_init(&lbl->text);
    158158        source_set_color(&lbl->text, text);
    159        
     159
    160160        if (caption == NULL)
    161161                lbl->caption = NULL;
    162162        else
    163163                lbl->caption = str_dup(caption);
    164        
     164
    165165        errno_t rc = embedded_font_create(&lbl->font, points);
    166166        if (rc != EOK) {
     
    169169                return false;
    170170        }
    171        
     171
    172172        sysarg_t cpt_width;
    173173        sysarg_t cpt_height;
    174174        font_get_box(lbl->font, lbl->caption, &cpt_width, &cpt_height);
    175        
     175
    176176        lbl->widget.width_min = cpt_width + 4;
    177177        lbl->widget.height_min = cpt_height + 4;
    178178        lbl->widget.width_ideal = lbl->widget.width_min;
    179179        lbl->widget.height_ideal = lbl->widget.height_min;
    180        
     180
    181181        lbl->rewrite = on_rewrite;
    182        
     182
    183183        return true;
    184184}
     
    190190        if (!lbl)
    191191                return NULL;
    192        
     192
    193193        if (init_label(lbl, parent, data, caption, points, background, text))
    194194                return lbl;
    195        
     195
    196196        free(lbl);
    197197        return NULL;
Note: See TracChangeset for help on using the changeset viewer.