Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface.c
| Show First 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (uiBut *, bt, &block->buttons) { | ||||
| if (!ELEM(bt->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_SEPR_SPACER)) { | if (!ELEM(bt->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_SEPR_SPACER)) { | ||||
| j = BLF_width(style->widget.uifont_id, bt->drawstr, sizeof(bt->drawstr)); | j = BLF_width(style->widget.uifont_id, bt->drawstr, sizeof(bt->drawstr)); | ||||
| if (j > i) { | if (j > i) { | ||||
| i = j; | i = j; | ||||
| } | } | ||||
| } | } | ||||
| /* Keep aligned buttons in the same column. */ | |||||
| if (bt->alignnr && bt->next) { | |||||
| int width = 0; | |||||
| for (col_bt = bt; col_bt->rect.xmin < col_bt->next->rect.xmin; col_bt = col_bt->next) { | |||||
| width += BLI_rctf_size_x(&col_bt->rect); | |||||
| } | |||||
| if (width > i) { | |||||
| i = width; | |||||
| } | |||||
| bt = col_bt; | |||||
| } | |||||
| if (bt->next && bt->rect.xmin < bt->next->rect.xmin) { | if (bt->next && bt->rect.xmin < bt->next->rect.xmin) { | ||||
| /* End of this column, and it's not the last one. */ | /* End of this column, and it's not the last one. */ | ||||
| for (col_bt = init_col_bt; col_bt->prev != bt; col_bt = col_bt->next) { | for (col_bt = init_col_bt; col_bt->prev != bt; col_bt = col_bt->next) { | ||||
| if (!col_bt->alignnr) { | |||||
| col_bt->rect.xmin = x1addval; | col_bt->rect.xmin = x1addval; | ||||
| col_bt->rect.xmax = x1addval + i + block->bounds; | col_bt->rect.xmax = x1addval + i + block->bounds; | ||||
| ui_but_update(col_bt); /* clips text again */ | ui_but_update(col_bt); /* clips text again */ | ||||
| } | } | ||||
| } | |||||
| /* And we prepare next column. */ | /* And we prepare next column. */ | ||||
| x1addval += i + block->bounds; | x1addval += i + block->bounds; | ||||
| i = 0; | i = 0; | ||||
| init_col_bt = col_bt; | init_col_bt = col_bt; | ||||
| } | } | ||||
| } | } | ||||
| /* Last column. */ | /* Last column. */ | ||||
| for (col_bt = init_col_bt; col_bt; col_bt = col_bt->next) { | for (col_bt = init_col_bt; col_bt; col_bt = col_bt->next) { | ||||
| if (!col_bt->alignnr) { | |||||
| col_bt->rect.xmin = x1addval; | col_bt->rect.xmin = x1addval; | ||||
| col_bt->rect.xmax = max_ff(x1addval + i + block->bounds, offset + block->minbounds); | col_bt->rect.xmax = max_ff(x1addval + i + block->bounds, offset + block->minbounds); | ||||
| } | |||||
| ui_but_update(col_bt); /* clips text again */ | ui_but_update(col_bt); /* clips text again */ | ||||
| } | } | ||||
| } | } | ||||
| void ui_block_bounds_calc(uiBlock *block) | void ui_block_bounds_calc(uiBlock *block) | ||||
| { | { | ||||
| int xof; | int xof; | ||||
| ▲ Show 20 Lines • Show All 6,570 Lines • Show Last 20 Lines | |||||