Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface.c
| Show First 20 Lines • Show All 850 Lines • ▼ Show 20 Lines | static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but) | ||||
| } | } | ||||
| /* copy hardmin for list rows to prevent 'sticking' highlight to mouse position | /* copy hardmin for list rows to prevent 'sticking' highlight to mouse position | ||||
| * when scrolling without moving mouse (see T28432) */ | * when scrolling without moving mouse (see T28432) */ | ||||
| if (ELEM(oldbut->type, UI_BTYPE_ROW, UI_BTYPE_LISTROW)) { | if (ELEM(oldbut->type, UI_BTYPE_ROW, UI_BTYPE_LISTROW)) { | ||||
| oldbut->hardmax = but->hardmax; | oldbut->hardmax = but->hardmax; | ||||
| } | } | ||||
| if (oldbut->type == UI_BTYPE_PROGRESS_BAR) { | switch (oldbut->type) { | ||||
| case UI_BTYPE_PROGRESS_BAR: { | |||||
| uiButProgressbar *progress_oldbut = (uiButProgressbar *)oldbut; | uiButProgressbar *progress_oldbut = (uiButProgressbar *)oldbut; | ||||
| uiButProgressbar *progress_but = (uiButProgressbar *)but; | uiButProgressbar *progress_but = (uiButProgressbar *)but; | ||||
| progress_oldbut->progress = progress_but->progress; | progress_oldbut->progress = progress_but->progress; | ||||
| break; | |||||
| } | |||||
| case UI_BTYPE_TREEROW: { | |||||
| uiButTreeRow *treerow_oldbut = (uiButTreeRow *)oldbut; | |||||
| uiButTreeRow *treerow_newbut = (uiButTreeRow *)but; | |||||
| SWAP(uiTreeViewItemHandle *, treerow_newbut->tree_item, treerow_oldbut->tree_item); | |||||
| break; | |||||
| } | |||||
| default: | |||||
| break; | |||||
| } | } | ||||
| /* move/copy string from the new button to the old */ | /* move/copy string from the new button to the old */ | ||||
| /* needed for alt+mouse wheel over enums */ | /* needed for alt+mouse wheel over enums */ | ||||
| if (but->str != but->strdata) { | if (but->str != but->strdata) { | ||||
| if (oldbut->str != oldbut->strdata) { | if (oldbut->str != oldbut->strdata) { | ||||
| SWAP(char *, but->str, oldbut->str); | SWAP(char *, but->str, oldbut->str); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,327 Lines • ▼ Show 20 Lines | switch (but->type) { | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (*value == (double)but->hardmax) { | if (*value == (double)but->hardmax) { | ||||
| is_push = true; | is_push = true; | ||||
| } | } | ||||
| } | } | ||||
| break; | break; | ||||
| case UI_BTYPE_TREEROW: { | |||||
| uiButTreeRow *tree_row_but = (uiButTreeRow *)but; | |||||
| is_push = -1; | |||||
| if (tree_row_but->tree_item) { | |||||
| is_push = UI_tree_view_item_is_active(tree_row_but->tree_item); | |||||
| } | |||||
| break; | |||||
| } | |||||
| default: | default: | ||||
| is_push = -1; | is_push = -1; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if ((but->drawflag & UI_BUT_CHECKBOX_INVERT) && (is_push != -1)) { | if ((but->drawflag & UI_BUT_CHECKBOX_INVERT) && (is_push != -1)) { | ||||
| is_push = !((bool)is_push); | is_push = !((bool)is_push); | ||||
| ▲ Show 20 Lines • Show All 1,228 Lines • ▼ Show 20 Lines | void UI_block_free(const bContext *C, uiBlock *block) | ||||
| } | } | ||||
| CTX_store_free_list(&block->contexts); | CTX_store_free_list(&block->contexts); | ||||
| BLI_freelistN(&block->saferct); | BLI_freelistN(&block->saferct); | ||||
| BLI_freelistN(&block->color_pickers.list); | BLI_freelistN(&block->color_pickers.list); | ||||
| ui_block_free_button_groups(block); | ui_block_free_button_groups(block); | ||||
| ui_block_free_views(block); | |||||
| MEM_freeN(block); | MEM_freeN(block); | ||||
| } | } | ||||
| void UI_blocklist_update_window_matrix(const bContext *C, const ListBase *lb) | void UI_blocklist_update_window_matrix(const bContext *C, const ListBase *lb) | ||||
| { | { | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| wmWindow *window = CTX_wm_window(C); | wmWindow *window = CTX_wm_window(C); | ||||
| ▲ Show 20 Lines • Show All 479 Lines • ▼ Show 20 Lines | switch (type) { | ||||
| case UI_BTYPE_CURVEPROFILE: | case UI_BTYPE_CURVEPROFILE: | ||||
| alloc_size = sizeof(uiButCurveProfile); | alloc_size = sizeof(uiButCurveProfile); | ||||
| alloc_str = "uiButCurveProfile"; | alloc_str = "uiButCurveProfile"; | ||||
| break; | break; | ||||
| case UI_BTYPE_DATASETROW: | case UI_BTYPE_DATASETROW: | ||||
| alloc_size = sizeof(uiButDatasetRow); | alloc_size = sizeof(uiButDatasetRow); | ||||
| alloc_str = "uiButDatasetRow"; | alloc_str = "uiButDatasetRow"; | ||||
| break; | break; | ||||
| case UI_BTYPE_TREEROW: | |||||
| alloc_size = sizeof(uiButTreeRow); | |||||
| alloc_str = "uiButTreeRow"; | |||||
| break; | |||||
| default: | default: | ||||
| alloc_size = sizeof(uiBut); | alloc_size = sizeof(uiBut); | ||||
| alloc_str = "uiBut"; | alloc_str = "uiBut"; | ||||
| has_custom_type = false; | has_custom_type = false; | ||||
| break; | break; | ||||
| } | } | ||||
| if (r_alloc_size) { | if (r_alloc_size) { | ||||
| ▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | else if (((block->flag & UI_BLOCK_LOOP) && !ui_block_is_popover(block) && | ||||
| ELEM(but->type, | ELEM(but->type, | ||||
| UI_BTYPE_MENU, | UI_BTYPE_MENU, | ||||
| UI_BTYPE_TEXT, | UI_BTYPE_TEXT, | ||||
| UI_BTYPE_LABEL, | UI_BTYPE_LABEL, | ||||
| UI_BTYPE_BLOCK, | UI_BTYPE_BLOCK, | ||||
| UI_BTYPE_BUT_MENU, | UI_BTYPE_BUT_MENU, | ||||
| UI_BTYPE_SEARCH_MENU, | UI_BTYPE_SEARCH_MENU, | ||||
| UI_BTYPE_DATASETROW, | UI_BTYPE_DATASETROW, | ||||
| UI_BTYPE_TREEROW, | |||||
| UI_BTYPE_POPOVER)) { | UI_BTYPE_POPOVER)) { | ||||
| but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT); | but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT); | ||||
| } | } | ||||
| #ifdef USE_NUMBUTS_LR_ALIGN | #ifdef USE_NUMBUTS_LR_ALIGN | ||||
| else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { | else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { | ||||
| if (slen != 0) { | if (slen != 0) { | ||||
| but->drawflag |= UI_BUT_TEXT_LEFT; | but->drawflag |= UI_BUT_TEXT_LEFT; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,721 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| uiButDatasetRow *but_dataset = (uiButDatasetRow *)but; | uiButDatasetRow *but_dataset = (uiButDatasetRow *)but; | ||||
| BLI_assert(but->type == UI_BTYPE_DATASETROW); | BLI_assert(but->type == UI_BTYPE_DATASETROW); | ||||
| but_dataset->indentation = indentation; | but_dataset->indentation = indentation; | ||||
| BLI_assert(indentation >= 0); | BLI_assert(indentation >= 0); | ||||
| } | } | ||||
| void UI_but_treerow_indentation_set(uiBut *but, int indentation) | |||||
| { | |||||
| uiButTreeRow *but_row = (uiButTreeRow *)but; | |||||
| BLI_assert(but->type == UI_BTYPE_TREEROW); | |||||
| but_row->indentation = indentation; | |||||
| BLI_assert(indentation >= 0); | |||||
| } | |||||
| /** | /** | ||||
| * Adds a hint to the button which draws right aligned, grayed out and never clipped. | * Adds a hint to the button which draws right aligned, grayed out and never clipped. | ||||
| */ | */ | ||||
| void UI_but_hint_drawstr_set(uiBut *but, const char *string) | void UI_but_hint_drawstr_set(uiBut *but, const char *string) | ||||
| { | { | ||||
| ui_but_add_shortcut(but, string, false); | ui_but_add_shortcut(but, string, false); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 350 Lines • Show Last 20 Lines | |||||