1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup DNA 22 */ 23 24 #pragma once 25 26 #include "DNA_defs.h" 27 #include "DNA_listBase.h" 28 #include "DNA_vec_types.h" 29 #include "DNA_view2d_types.h" 30 31 #include "DNA_ID.h" 32 33 struct ARegion; 34 struct ARegionType; 35 struct PanelType; 36 struct PointerRNA; 37 struct Scene; 38 struct SpaceLink; 39 struct SpaceType; 40 struct uiLayout; 41 struct uiBlock; 42 struct wmDrawBuffer; 43 struct wmTimer; 44 struct wmTooltipState; 45 46 /* TODO Doing this is quite ugly :) 47 * Once the top-bar is merged bScreen should be refactored to use ScrAreaMap. */ 48 #define AREAMAP_FROM_SCREEN(screen) ((ScrAreaMap *)&(screen)->vertbase) 49 50 typedef struct bScreen { 51 ID id; 52 53 /* TODO Should become ScrAreaMap now. 54 * ** NOTE: KEEP ORDER IN SYNC WITH ScrAreaMap! (see AREAMAP_FROM_SCREEN macro above) ** */ 55 /** Screens have vertices/edges to define areas. */ 56 ListBase vertbase; 57 ListBase edgebase; 58 ListBase areabase; 59 60 /** Screen level regions (menus), runtime only. */ 61 ListBase regionbase; 62 63 struct Scene *scene DNA_DEPRECATED; 64 65 /** General flags. */ 66 short flag; 67 /** Winid from WM, starts with 1. */ 68 short winid; 69 /** User-setting for which editors get redrawn during anim playback. */ 70 short redraws_flag; 71 72 /** Temp screen in a temp window, don't save (like user prefs). */ 73 char temp; 74 /** Temp screen for image render display or fileselect. */ 75 char state; 76 /** Notifier for drawing edges. */ 77 char do_draw; 78 /** Notifier for scale screen, changed screen, etc. */ 79 char do_refresh; 80 /** Notifier for gesture draw. */ 81 char do_draw_gesture; 82 /** Notifier for paint cursor draw. */ 83 char do_draw_paintcursor; 84 /** Notifier for dragging draw. */ 85 char do_draw_drag; 86 /** Set to delay screen handling after switching back from maximized area. */ 87 char skip_handling; 88 /** Set when scrubbing to avoid some costly updates. */ 89 char scrubbing; 90 char _pad[1]; 91 92 /** Active region that has mouse focus. */ 93 struct ARegion *active_region; 94 95 /** If set, screen has timer handler added in window. */ 96 struct wmTimer *animtimer; 97 /** Context callback. */ 98 void /*bContextDataCallback*/ *context; 99 100 /** Runtime. */ 101 struct wmTooltipState *tool_tip; 102 103 PreviewImage *preview; 104 } bScreen; 105 106 typedef struct ScrVert { 107 struct ScrVert *next, *prev, *newv; 108 vec2s vec; 109 /* first one used internally, second one for tools */ 110 short flag, editflag; 111 } ScrVert; 112 113 typedef struct ScrEdge { 114 struct ScrEdge *next, *prev; 115 ScrVert *v1, *v2; 116 /** 1 when at edge of screen. */ 117 short border; 118 short flag; 119 char _pad[4]; 120 } ScrEdge; 121 122 typedef struct ScrAreaMap { 123 /* ** NOTE: KEEP ORDER IN SYNC WITH LISTBASES IN bScreen! ** */ 124 125 /** ScrVert - screens have vertices/edges to define areas. */ 126 ListBase vertbase; 127 /** ScrEdge. */ 128 ListBase edgebase; 129 /** ScrArea. */ 130 ListBase areabase; 131 } ScrAreaMap; 132 133 typedef struct Panel_Runtime { 134 /* Applied to Panel.ofsx, but saved separately so we can track changes between redraws. */ 135 int region_ofsx; 136 137 char _pad[4]; 138 139 /** 140 * Pointer for storing which data the panel corresponds to. 141 * Useful when there can be multiple instances of the same panel type. 142 * 143 * \note A panel and its sub-panels share the same custom data pointer. 144 * This avoids freeing the same pointer twice when panels are removed. 145 */ 146 struct PointerRNA *custom_data_ptr; 147 148 /* Pointer to the panel's block. Useful when changes to panel #uiBlocks 149 * need some context from traversal of the panel "tree". */ 150 struct uiBlock *block; 151 } Panel_Runtime; 152 153 /** The part from uiBlock that needs saved in file. */ 154 typedef struct Panel { 155 struct Panel *next, *prev; 156 157 /** Runtime. */ 158 struct PanelType *type; 159 /** Runtime for drawing. */ 160 struct uiLayout *layout; 161 162 /** Defined as UI_MAX_NAME_STR. */ 163 char panelname[64]; 164 /** Panel name is identifier for restoring location. */ 165 char drawname[64]; 166 /** Offset within the region. */ 167 int ofsx, ofsy; 168 /** Panel size including children. */ 169 int sizex, sizey; 170 /** Panel size excluding children. */ 171 int blocksizex, blocksizey; 172 short labelofs; 173 char _pad[4]; 174 short flag, runtime_flag; 175 short snap; 176 /** Panels are aligned according to increasing sort-order. */ 177 int sortorder; 178 /** Runtime for panel manipulation. */ 179 void *activedata; 180 /** Sub panels. */ 181 ListBase children; 182 183 Panel_Runtime runtime; 184 } Panel; 185 186 /** 187 * Notes on Panel Categories: 188 * 189 * - #ARegion.panels_category (#PanelCategoryDyn) 190 * is a runtime only list of categories collected during draw. 191 * 192 * - #ARegion.panels_category_active (#PanelCategoryStack) 193 * is basically a list of strings (category id's). 194 * 195 * Clicking on a tab moves it to the front of region->panels_category_active, 196 * If the context changes so this tab is no longer displayed, 197 * then the first-most tab in #ARegion.panels_category_active is used. 198 * 199 * This way you can change modes and always have the tab you last clicked on. 200 */ 201 202 /* region level tabs */ 203 # 204 # 205 typedef struct PanelCategoryDyn { 206 struct PanelCategoryDyn *next, *prev; 207 char idname[64]; 208 rcti rect; 209 } PanelCategoryDyn; 210 211 /* region stack of active tabs */ 212 typedef struct PanelCategoryStack { 213 struct PanelCategoryStack *next, *prev; 214 char idname[64]; 215 } PanelCategoryStack; 216 217 /* uiList dynamic data... */ 218 /* These two Lines with # tell makesdna this struct can be excluded. */ 219 # 220 # 221 typedef struct uiListDyn { 222 /** Number of rows needed to draw all elements. */ 223 int height; 224 /** Actual visual height of the list (in rows). */ 225 int visual_height; 226 /** Minimal visual height of the list (in rows). */ 227 int visual_height_min; 228 229 /** Number of items in collection. */ 230 int items_len; 231 /** Number of items actually visible after filtering. */ 232 int items_shown; 233 234 /* Those are temp data used during drag-resize with GRIP button 235 * (they are in pixels, the meaningful data is the 236 * difference between resize_prev and resize)... 237 */ 238 int resize; 239 int resize_prev; 240 241 /* Filtering data. */ 242 /** Items_len length. */ 243 int *items_filter_flags; 244 /** Org_idx -> new_idx, items_len length. */ 245 int *items_filter_neworder; 246 } uiListDyn; 247 248 typedef struct uiList { /* some list UI data need to be saved in file */ 249 struct uiList *next, *prev; 250 251 /** Runtime. */ 252 struct uiListType *type; 253 254 /** Defined as UI_MAX_NAME_STR. */ 255 char list_id[64]; 256 257 /** How items are layedout in the list. */ 258 int layout_type; 259 int flag; 260 261 int list_scroll; 262 int list_grip; 263 int list_last_len; 264 int list_last_activei; 265 266 /* Filtering data. */ 267 /** Defined as UI_MAX_NAME_STR. */ 268 char filter_byname[64]; 269 int filter_flag; 270 int filter_sort_flag; 271 272 /* Custom sub-classes properties. */ 273 IDProperty *properties; 274 275 /* Dynamic data (runtime). */ 276 uiListDyn *dyn_data; 277 } uiList; 278 279 typedef struct TransformOrientation { 280 struct TransformOrientation *next, *prev; 281 /** MAX_NAME. */ 282 char name[64]; 283 float mat[3][3]; 284 char _pad[4]; 285 } TransformOrientation; 286 287 /** Some preview UI data need to be saved in file. */ 288 typedef struct uiPreview { 289 struct uiPreview *next, *prev; 290 291 /** Defined as UI_MAX_NAME_STR. */ 292 char preview_id[64]; 293 short height; 294 char _pad1[6]; 295 } uiPreview; 296 297 /* These two lines with # tell makesdna this struct can be excluded. 298 * Should be: #ifndef WITH_GLOBAL_AREA_WRITING */ 299 # 300 # 301 typedef struct ScrGlobalAreaData { 302 /* Global areas have a non-dynamic size. That means, changing the window 303 * size doesn't affect their size at all. However, they can still be 304 * 'collapsed', by changing this value. Ignores DPI (ED_area_global_size_y 305 * and winx/winy don't) */ 306 short cur_fixed_height; 307 /* For global areas, this is the min and max size they can use depending on 308 * if they are 'collapsed' or not. */ 309 short size_min, size_max; 310 /** GlobalAreaAlign. */ 311 short align; 312 313 /** GlobalAreaFlag. */ 314 short flag; 315 char _pad[2]; 316 } ScrGlobalAreaData; 317 318 enum GlobalAreaFlag { 319 GLOBAL_AREA_IS_HIDDEN = (1 << 0), 320 }; 321 322 typedef enum GlobalAreaAlign { 323 GLOBAL_AREA_ALIGN_TOP = 0, 324 GLOBAL_AREA_ALIGN_BOTTOM = 1, 325 } GlobalAreaAlign; 326 327 typedef struct ScrArea_Runtime { 328 struct bToolRef *tool; 329 char is_tool_set; 330 char _pad0[7]; 331 } ScrArea_Runtime; 332 333 typedef struct ScrArea { 334 struct ScrArea *next, *prev; 335 336 /** Ordered (bl, tl, tr, br). */ 337 ScrVert *v1, *v2, *v3, *v4; 338 /** If area==full, this is the parent. */ 339 bScreen *full; 340 341 /** Rect bound by v1 v2 v3 v4. */ 342 rcti totrct; 343 344 /** 345 * eSpace_Type (SPACE_FOO). 346 * 347 * Temporarily used while switching area type, otherwise this should be SPACE_EMPTY. 348 * Also, versioning uses it to nicely replace deprecated * editors. 349 * It's been there for ages, name doesn't fit any more. 350 */ 351 char spacetype; 352 /** #eSpace_Type (SPACE_FOO). */ 353 char butspacetype; 354 short butspacetype_subtype; 355 356 /** Size. */ 357 short winx, winy; 358 359 /** OLD! 0=no header, 1= down, 2= up. */ 360 char headertype DNA_DEPRECATED; 361 /** Private, for spacetype refresh callback. */ 362 char do_refresh; 363 short flag; 364 /** 365 * Index of last used region of 'RGN_TYPE_WINDOW' 366 * runtime variable, updated by executing operators. 367 */ 368 short region_active_win; 369 char _pad[2]; 370 371 /** Callbacks for this space type. */ 372 struct SpaceType *type; 373 374 /* Non-NULL if this area is global. */ 375 ScrGlobalAreaData *global; 376 377 /* A list of space links (editors) that were open in this area before. When 378 * changing the editor type, we try to reuse old editor data from this list. 379 * The first item is the active/visible one. 380 */ 381 /** #SpaceLink. */ 382 ListBase spacedata; 383 /* NOTE: This region list is the one from the active/visible editor (first item in 384 * spacedata list). Use SpaceLink.regionbase if it's inactive (but only then)! 385 */ 386 /** #ARegion. */ 387 ListBase regionbase; 388 /** #wmEventHandler. */ 389 ListBase handlers; 390 391 /** #AZone. */ 392 ListBase actionzones; 393 394 ScrArea_Runtime runtime; 395 } ScrArea; 396 397 typedef struct ARegion_Runtime { 398 /* Panel category to use between 'layout' and 'draw'. */ 399 const char *category; 400 401 /** 402 * The visible part of the region, use with region overlap not to draw 403 * on top of the overlapping regions. 404 * 405 * Lazy initialize, zero'd when unset, relative to #ARegion.winrct x/y min. */ 406 rcti visible_rect; 407 408 /* The offset needed to not overlap with window scrollbars. Only used by HUD regions for now. */ 409 int offset_x, offset_y; 410 } ARegion_Runtime; 411 412 typedef struct ARegion { 413 struct ARegion *next, *prev; 414 415 /** 2D-View scrolling/zoom info (most regions are 2d anyways). */ 416 View2D v2d; 417 /** Coordinates of region. */ 418 rcti winrct; 419 /** Runtime for partial redraw, same or smaller than winrct. */ 420 rcti drawrct; 421 /** Size. */ 422 short winx, winy; 423 424 /** Region is currently visible on screen. */ 425 short visible; 426 /** Window, header, etc. identifier for drawing. */ 427 short regiontype; 428 /** How it should split. */ 429 short alignment; 430 /** Hide, .... */ 431 short flag; 432 433 /** Current split size in unscaled pixels (if zero it uses regiontype). 434 * To convert to pixels use: `UI_DPI_FAC * region->sizex + 0.5f`. 435 * However to get the current region size, you should usually use winx/winy from above, not this! 436 */ 437 short sizex, sizey; 438 439 /** Private, cached notifier events. */ 440 short do_draw; 441 /** Private, cached notifier events. */ 442 short do_draw_paintcursor; 443 /** Private, set for indicate drawing overlapped. */ 444 short overlap; 445 /** Temporary copy of flag settings for clean fullscreen. */ 446 short flagfullscreen; 447 448 /** Callbacks for this region type. */ 449 struct ARegionType *type; 450 451 /** #uiBlock. */ 452 ListBase uiblocks; 453 /** Panel. */ 454 ListBase panels; 455 /** Stack of panel categories. */ 456 ListBase panels_category_active; 457 /** #uiList. */ 458 ListBase ui_lists; 459 /** #uiPreview. */ 460 ListBase ui_previews; 461 /** #wmEventHandler. */ 462 ListBase handlers; 463 /** Panel categories runtime. */ 464 ListBase panels_category; 465 466 /** Gizmo-map of this region. */ 467 struct wmGizmoMap *gizmo_map; 468 /** Blend in/out. */ 469 struct wmTimer *regiontimer; 470 struct wmDrawBuffer *draw_buffer; 471 472 /** Use this string to draw info. */ 473 char *headerstr; 474 /** XXX 2.50, need spacedata equivalent?. */ 475 void *regiondata; 476 477 ARegion_Runtime runtime; 478 } ARegion; 479 480 /** #ScrArea.flag */ 481 enum { 482 HEADER_NO_PULLDOWN = (1 << 0), 483 // AREA_FLAG_UNUSED_1 = (1 << 1), 484 // AREA_FLAG_UNUSED_2 = (1 << 2), 485 #ifdef DNA_DEPRECATED_ALLOW 486 AREA_TEMP_INFO = (1 << 3), /* versioned to make slot reusable */ 487 #endif 488 /** Update size of regions within the area. */ 489 AREA_FLAG_REGION_SIZE_UPDATE = (1 << 3), 490 AREA_FLAG_ACTIVE_TOOL_UPDATE = (1 << 4), 491 // AREA_FLAG_UNUSED_5 = (1 << 5), 492 493 AREA_FLAG_UNUSED_6 = (1 << 6), /* cleared */ 494 495 /** 496 * For temporary full-screens (file browser, image editor render) 497 * that are opened above user set full-screens. 498 */ 499 AREA_FLAG_STACKED_FULLSCREEN = (1 << 7), 500 /** Update action zones (even if the mouse is not intersecting them). */ 501 AREA_FLAG_ACTIONZONES_UPDATE = (1 << 8), 502 }; 503 504 #define AREAGRID 4 505 #define AREAMINX 32 506 #define HEADER_PADDING_Y 6 507 #define HEADERY (20 + HEADER_PADDING_Y) 508 509 /** #bScreen.flag */ 510 enum { 511 SCREEN_DEPRECATED = 1, 512 SCREEN_COLLAPSE_STATUSBAR = 2, 513 }; 514 515 /** #bScreen.state */ 516 enum { 517 SCREENNORMAL = 0, 518 SCREENMAXIMIZED = 1, /* one editor taking over the screen */ 519 SCREENFULL = 2, /* one editor taking over the screen with no bare-minimum UI elements */ 520 }; 521 522 /** #bScreen.redraws_flag */ 523 typedef enum eScreen_Redraws_Flag { 524 TIME_REGION = (1 << 0), 525 TIME_ALL_3D_WIN = (1 << 1), 526 TIME_ALL_ANIM_WIN = (1 << 2), 527 TIME_ALL_BUTS_WIN = (1 << 3), 528 // TIME_WITH_SEQ_AUDIO = (1 << 4), /* DEPRECATED */ 529 TIME_SEQ = (1 << 5), 530 TIME_ALL_IMAGE_WIN = (1 << 6), 531 // TIME_CONTINUE_PHYSICS = (1 << 7), /* UNUSED */ 532 TIME_NODES = (1 << 8), 533 TIME_CLIPS = (1 << 9), 534 535 TIME_FOLLOW = (1 << 15), 536 } eScreen_Redraws_Flag; 537 538 /** #Panel.flag */ 539 enum { 540 PNL_SELECT = (1 << 0), 541 PNL_UNUSED_1 = (1 << 1), /* Cleared */ 542 PNL_CLOSED = (1 << 2), 543 /* PNL_TABBED = (1 << 3), */ /*UNUSED*/ 544 /* PNL_OVERLAP = (1 << 4), */ /*UNUSED*/ 545 PNL_PIN = (1 << 5), 546 PNL_POPOVER = (1 << 6), 547 /** The panel has been drag-drop reordered and the instanced panel list needs to be rebuilt. */ 548 PNL_INSTANCED_LIST_ORDER_CHANGED = (1 << 7), 549 }; 550 551 /** #Panel.snap - for snapping to screen edges */ 552 #define PNL_SNAP_NONE 0 553 /* #define PNL_SNAP_TOP 1 */ 554 /* #define PNL_SNAP_RIGHT 2 */ 555 #define PNL_SNAP_BOTTOM 4 556 /* #define PNL_SNAP_LEFT 8 */ 557 558 /* #define PNL_SNAP_DIST 9.0 */ 559 560 /* paneltype flag */ 561 enum { 562 PNL_DEFAULT_CLOSED = (1 << 0), 563 PNL_NO_HEADER = (1 << 1), 564 /** Makes buttons in the header shrink/stretch to fill full layout width. */ 565 PNL_LAYOUT_HEADER_EXPAND = (1 << 2), 566 PNL_LAYOUT_VERT_BAR = (1 << 3), 567 /** This panel type represents data external to the UI. */ 568 PNL_INSTANCED = (1 << 4), 569 /** Draw panel like a box widget. */ 570 PNL_DRAW_BOX = (1 << 6), 571 /** Don't search this panel for property search. */ 572 PNL_NO_SEARCH = (1 << 7), 573 }; 574 575 /* Fallback panel category (only for old scripts which need updating) */ 576 #define PNL_CATEGORY_FALLBACK "Misc" 577 578 /** #uiList.layout_type */ 579 enum { 580 UILST_LAYOUT_DEFAULT = 0, 581 UILST_LAYOUT_COMPACT = 1, 582 UILST_LAYOUT_GRID = 2, 583 }; 584 585 /** #uiList.flag */ 586 enum { 587 /* Scroll list to make active item visible. */ 588 UILST_SCROLL_TO_ACTIVE_ITEM = 1 << 0, 589 }; 590 591 /* Value (in number of items) we have to go below minimum shown items to enable auto size. */ 592 #define UI_LIST_AUTO_SIZE_THRESHOLD 1 593 594 /* uiList filter flags (dyn_data) */ 595 /* WARNING! Those values are used by integer RNA too, which does not handle well values > INT_MAX. 596 * So please do not use 32nd bit here. */ 597 enum { 598 UILST_FLT_ITEM = 1 << 30, /* This item has passed the filter process successfully. */ 599 }; 600 601 /** #uiList.filter_flag */ 602 enum { 603 UILST_FLT_SHOW = 1 << 0, /* Show filtering UI. */ 604 UILST_FLT_EXCLUDE = UILST_FLT_ITEM, /* Exclude filtered items, *must* use this same value. */ 605 }; 606 607 /** #uiList.filter_sort_flag */ 608 enum { 609 /* Plain values (only one is valid at a time, once masked with UILST_FLT_SORT_MASK. */ 610 /** Just for sake of consistency. */ 611 /* UILST_FLT_SORT_INDEX = 0, */ /* UNUSED */ 612 UILST_FLT_SORT_ALPHA = 1, 613 614 /* Bitflags affecting behavior of any kind of sorting. */ 615 /** Special flag to indicate that order is locked (not user-changeable). */ 616 UILST_FLT_SORT_LOCK = 1u << 30, 617 /** Special value, bitflag used to reverse order! */ 618 UILST_FLT_SORT_REVERSE = 1u << 31, 619 }; 620 621 #define UILST_FLT_SORT_MASK (((unsigned int)(UILST_FLT_SORT_REVERSE | UILST_FLT_SORT_LOCK)) - 1) 622 623 /* regiontype, first two are the default set */ 624 /* Do NOT change order, append on end. Types are hardcoded needed */ 625 typedef enum eRegionType { 626 RGN_TYPE_WINDOW = 0, 627 RGN_TYPE_HEADER = 1, 628 RGN_TYPE_CHANNELS = 2, 629 RGN_TYPE_TEMPORARY = 3, 630 RGN_TYPE_UI = 4, 631 RGN_TYPE_TOOLS = 5, 632 RGN_TYPE_TOOL_PROPS = 6, 633 RGN_TYPE_PREVIEW = 7, 634 RGN_TYPE_HUD = 8, 635 /* Region to navigate the main region from (RGN_TYPE_WINDOW). */ 636 RGN_TYPE_NAV_BAR = 9, 637 /* A place for buttons to trigger execution of something that was set up in other regions. */ 638 RGN_TYPE_EXECUTE = 10, 639 RGN_TYPE_FOOTER = 11, 640 RGN_TYPE_TOOL_HEADER = 12, 641 642 #define RGN_TYPE_LEN (RGN_TYPE_TOOL_HEADER + 1) 643 } eRegionType; 644 645 /* use for function args */ 646 #define RGN_TYPE_ANY -1 647 648 /* Region supports panel tabs (categories). */ 649 #define RGN_TYPE_HAS_CATEGORY_MASK (1 << RGN_TYPE_UI) 650 651 /* Check for any kind of header region. */ 652 #define RGN_TYPE_IS_HEADER_ANY(regiontype) \ 653 (((1 << (regiontype)) & \ 654 ((1 << RGN_TYPE_HEADER) | 1 << (RGN_TYPE_TOOL_HEADER) | (1 << RGN_TYPE_FOOTER))) != 0) 655 656 /** #ARegion.alignment */ 657 enum { 658 RGN_ALIGN_NONE = 0, 659 RGN_ALIGN_TOP = 1, 660 RGN_ALIGN_BOTTOM = 2, 661 RGN_ALIGN_LEFT = 3, 662 RGN_ALIGN_RIGHT = 4, 663 RGN_ALIGN_HSPLIT = 5, 664 RGN_ALIGN_VSPLIT = 6, 665 RGN_ALIGN_FLOAT = 7, 666 RGN_ALIGN_QSPLIT = 8, 667 /* Maximum 15. */ 668 669 /* Flags start here. */ 670 RGN_SPLIT_PREV = 32, 671 }; 672 673 /** Mask out flags so we can check the alignment. */ 674 #define RGN_ALIGN_ENUM_FROM_MASK(align) ((align) & ((1 << 4) - 1)) 675 #define RGN_ALIGN_FLAG_FROM_MASK(align) ((align) & ~((1 << 4) - 1)) 676 677 /** #ARegion.flag */ 678 enum { 679 RGN_FLAG_HIDDEN = (1 << 0), 680 RGN_FLAG_TOO_SMALL = (1 << 1), 681 /** 682 * Force delayed reinit of region size data, so that region size is calculated 683 * just big enough to show all its content (if enough space is available). 684 * Note that only ED_region_header supports this right now. 685 */ 686 RGN_FLAG_DYNAMIC_SIZE = (1 << 2), 687 /** Region data is NULL'd on read, never written. */ 688 RGN_FLAG_TEMP_REGIONDATA = (1 << 3), 689 /** The region must either use its prefsizex/y or be hidden. */ 690 RGN_FLAG_PREFSIZE_OR_HIDDEN = (1 << 4), 691 /** Size has been clamped (floating regions only). */ 692 RGN_FLAG_SIZE_CLAMP_X = (1 << 5), 693 RGN_FLAG_SIZE_CLAMP_Y = (1 << 6), 694 /** When the user sets the region is hidden, 695 * needed for floating regions that may be hidden for other reasons. */ 696 RGN_FLAG_HIDDEN_BY_USER = (1 << 7), 697 /** Property search filter is active. */ 698 RGN_FLAG_SEARCH_FILTER_ACTIVE = (1 << 8), 699 /** 700 * Update the expansion of the region's panels and switch contexts. Only Set 701 * temporarily when the search filter is updated and cleared at the end of the 702 * region's layout pass. so that expansion is still interactive, 703 */ 704 RGN_FLAG_SEARCH_FILTER_UPDATE = (1 << 9), 705 }; 706 707 /** #ARegion.do_draw */ 708 enum { 709 /* Region must be fully redrawn. */ 710 RGN_DRAW = 1, 711 /* Redraw only part of region, for sculpting and painting to get smoother 712 * stroke painting on heavy meshes. */ 713 RGN_DRAW_PARTIAL = 2, 714 /* For outliner, to do faster redraw without rebuilding outliner tree. 715 * For 3D viewport, to display a new progressive render sample without 716 * while other buffers and overlays remain unchanged. */ 717 RGN_DRAW_NO_REBUILD = 4, 718 719 /* Set while region is being drawn. */ 720 RGN_DRAWING = 8, 721 /* For popups, to refresh UI layout along with drawing. */ 722 RGN_REFRESH_UI = 16, 723 724 /* Only editor overlays (currently gizmos only!) should be redrawn. */ 725 RGN_DRAW_EDITOR_OVERLAYS = 32, 726 }; 727