|
Blender V5.0
|
#include "DNA_screen_types.h"#include "DNA_userdef_types.h"#include "BLI_listbase.h"#include "BLI_math_vector.h"#include "BLI_math_vector_types.hh"#include "BLI_rect.h"#include "BLI_vector.hh"#include "interface_intern.hh"#include "MEM_guardedalloc.h"Go to the source code of this file.
Classes | |
| struct | ButAlign |
Macros | |
| #define | SIDE_TO_UI_BUT_ALIGN {UI_BUT_ALIGN_LEFT, UI_BUT_ALIGN_TOP, UI_BUT_ALIGN_RIGHT, UI_BUT_ALIGN_DOWN} |
| #define | SIDE1(_s) |
| #define | OPPOSITE(_s) |
| #define | SIDE2(_s) |
| #define | IS_COLUMN(_s) |
| #define | STITCH(_s) |
| #define | MAX_DELTA 0.45f * max_ii(UI_UNIT_Y, UI_UNIT_X) |
Enumerations | |
| enum | { LEFT = 0 , TOP = 1 , RIGHT = 2 , DOWN = 3 , TOTSIDES = 4 , STITCH_LEFT = 1 << LEFT , STITCH_TOP = 1 << TOP , STITCH_RIGHT = 1 << RIGHT , STITCH_DOWN = 1 << DOWN } |
Functions | |
| bool | ui_but_can_align (const uiBut *but) |
| static void | block_align_proximity_compute (ButAlign *butal, ButAlign *butal_other) |
| static void | block_align_stitch_neighbors (ButAlign *butal, const int side, const int side_opp, const int side_s1, const int side_s2, const int align, const int align_opp, const float co) |
| static bool | ui_block_align_butal_cmp (const ButAlign &butal, const ButAlign &butal_other) |
| static void | ui_block_align_but_to_region (uiBut *but, const ARegion *region) |
| void | ui_block_align_calc (uiBlock *block, const ARegion *region) |
| int | ui_but_align_opposite_to_area_align_get (const ARegion *region) |
| #define IS_COLUMN | ( | _s | ) |
Definition at line 87 of file interface_align.cc.
Referenced by block_align_proximity_compute().
Definition at line 93 of file interface_align.cc.
Referenced by block_align_proximity_compute(), and ui_block_align_calc().
| #define OPPOSITE | ( | _s | ) |
Definition at line 83 of file interface_align.cc.
Referenced by block_align_proximity_compute(), and ui_block_align_calc().
| #define SIDE1 | ( | _s | ) |
Definition at line 82 of file interface_align.cc.
Referenced by block_align_proximity_compute(), and ui_block_align_calc().
| #define SIDE2 | ( | _s | ) |
Definition at line 84 of file interface_align.cc.
Referenced by block_align_proximity_compute(), and ui_block_align_calc().
| #define SIDE_TO_UI_BUT_ALIGN {UI_BUT_ALIGN_LEFT, UI_BUT_ALIGN_TOP, UI_BUT_ALIGN_RIGHT, UI_BUT_ALIGN_DOWN} |
Definition at line 78 of file interface_align.cc.
Referenced by ui_block_align_calc().
| #define STITCH | ( | _s | ) |
Definition at line 90 of file interface_align.cc.
Referenced by block_align_proximity_compute(), and block_align_stitch_neighbors().
| anonymous enum |
| Enumerator | |
|---|---|
| LEFT | |
| TOP | |
| RIGHT | |
| DOWN | |
| TOTSIDES | |
| STITCH_LEFT | |
| STITCH_TOP | |
| STITCH_RIGHT | |
| STITCH_DOWN | |
Definition at line 61 of file interface_align.cc.
This function checks a pair of buttons (assumed in a same align group), and if they are neighbors, set needed data accordingly.
Definition at line 115 of file interface_align.cc.
References ButAlign::borders, ButAlign::but, ButAlign::dists, DOWN, fabsf, ButAlign::flags, IS_COLUMN, LEFT, MAX_DELTA, max_ff(), ButAlign::neighbors, OPPOSITE, RIGHT, SIDE1, SIDE2, STITCH, TOP, and ui_but_can_align().
Referenced by ui_block_align_calc().
|
static |
This function takes care of case described in this schema:
+-----------+-----------+ | BUT_1 | BUT_2 | |-----------------------+ | BUT_3 | +-----------+
Here, BUT_3 RIGHT side would not get 'dragged' to align with BUT_1 RIGHT side, since BUT_3 has not RIGHT neighbor. So, this function, when called with BUT_1, will 'walk' the whole column in side_s1 direction (TOP or DOWN when called for RIGHT side), and force buttons like BUT_3 to align as needed, if BUT_1 and BUT_3 were detected as needing top-right corner stitching in block_align_proximity_compute() step.
Definition at line 249 of file interface_align.cc.
References ButAlign::borders, ButAlign::but, ButAlign::dists, uiBut::drawflag, ButAlign::flags, LEFT, ButAlign::neighbors, STITCH, TOP, UI_BUT_ALIGN_STITCH_LEFT, and UI_BUT_ALIGN_STITCH_TOP.
Referenced by ui_block_align_calc().
Definition at line 324 of file interface_align.cc.
References BLI_rctf_size_x(), BLI_rctf_size_y(), uiBut::drawflag, uiBut::rect, U, UI_BUT_ALIGN, UI_BUT_ALIGN_DOWN, UI_BUT_ALIGN_LEFT, UI_BUT_ALIGN_RIGHT, UI_BUT_ALIGN_TOP, UI_SCALE_FAC, ARegion::winx, ARegion::winy, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by ui_block_align_calc().
Helper to sort ButAlign items by:
Definition at line 302 of file interface_align.cc.
References uiBut::alignnr, ButAlign::borders, ButAlign::but, LEFT, and TOP.
Referenced by ui_block_align_calc().
Compute the alignment of all 'align groups' of buttons in given block.
This is using an order-independent algorithm, i.e. alignment of buttons should be OK regardless of order in which they are added to the block.
Definition at line 356 of file interface_align.cc.
References uiBut::alignnr, blender::Vector< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::Vector< T, InlineBufferCapacity, Allocator >::begin(), BLI_assert, block_align_proximity_compute(), block_align_stitch_neighbors(), ButAlign::borders, ButAlign::but, uiBlock::buttons, ButAlign::dists, DOWN, uiBut::drawflag, blender::Vector< T, InlineBufferCapacity, Allocator >::end(), fabsf, FLT_MAX, i, blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), IS_EQF, LEFT, MAX_DELTA, ButAlign::neighbors, OPPOSITE, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), RIGHT, SIDE1, SIDE2, SIDE_TO_UI_BUT_ALIGN, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), Vector< T, InlineBufferCapacity, Allocator >::size(), Tab, TOP, TOTSIDES, ui_block_align_but_to_region(), ui_block_align_butal_cmp(), and UI_BUT_ALIGN_ALL.
Referenced by UI_block_end_ex().
| int ui_but_align_opposite_to_area_align_get | ( | const ARegion * | region | ) |
Definition at line 488 of file interface_align.cc.
References ARegion::alignment, ARegion::prev, RGN_ALIGN_BOTTOM, RGN_ALIGN_ENUM_FROM_MASK, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_ALIGN_TOP, RGN_SPLIT_PREV, UI_BUT_ALIGN_DOWN, UI_BUT_ALIGN_LEFT, UI_BUT_ALIGN_RIGHT, and UI_BUT_ALIGN_TOP.
Referenced by template_ID_tabs(), and ui_item_enum_expand_tabs().
| bool ui_but_can_align | ( | const uiBut * | but | ) |
Definition at line 95 of file interface_align.cc.
References BLI_rctf_is_empty(), Checkbox, CheckboxN, ELEM, Label, uiBut::rect, Sepr, SeprLine, SeprSpacer, Tab, and uiBut::type.
Referenced by block_align_proximity_compute(), and ui_def_but().