Blender  V3.3
Functions
screen_edit.c File Reference
#include <math.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "DNA_workspace_types.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_image.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_sound.h"
#include "BKE_workspace.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_clip.h"
#include "ED_node.h"
#include "ED_screen.h"
#include "ED_screen_types.h"
#include "UI_interface.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "DEG_depsgraph_query.h"
#include "screen_intern.h"

Go to the source code of this file.

Functions

static ScrAreascreen_addarea_ex (ScrAreaMap *area_map, ScrVert *bottom_left, ScrVert *top_left, ScrVert *top_right, ScrVert *bottom_right, const eSpace_Type space_type)
 
static ScrAreascreen_addarea (bScreen *screen, ScrVert *left_bottom, ScrVert *left_top, ScrVert *right_top, ScrVert *right_bottom, const eSpace_Type space_type)
 
static void screen_delarea (bContext *C, bScreen *screen, ScrArea *area)
 
ScrAreaarea_split (const wmWindow *win, bScreen *screen, ScrArea *area, const eScreenAxis dir_axis, const float fac, const bool merge)
 
bScreenscreen_add (Main *bmain, const char *name, const rcti *rect)
 
void screen_data_copy (bScreen *to, bScreen *from)
 
void screen_new_activate_prepare (const wmWindow *win, bScreen *screen_new)
 
eScreenDir area_getorientation (ScrArea *sa_a, ScrArea *sa_b)
 
void area_getoffsets (ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2)
 
static void screen_verts_halign (const wmWindow *win, const bScreen *screen, const short from_x, const short to_x)
 
static void screen_verts_valign (const wmWindow *win, const bScreen *screen, const short from_y, const short to_y)
 
static void screen_areas_align (bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2, const eScreenDir dir)
 
static bool screen_area_join_aligned (bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2)
 
static ScrAreascreen_area_trim (bContext *C, bScreen *screen, ScrArea **area, int size, eScreenDir dir, bool reverse)
 
static bool screen_area_join_ex (bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2, bool close_all_remainders)
 
int screen_area_join (bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2)
 
bool screen_area_close (struct bContext *C, bScreen *screen, ScrArea *area)
 
void screen_area_spacelink_add (Scene *scene, ScrArea *area, eSpace_Type space_type)
 
static void region_cursor_set_ex (wmWindow *win, ScrArea *area, ARegion *region, bool swin_changed)
 
static void region_cursor_set (wmWindow *win, bool swin_changed)
 
void ED_screen_do_listen (bContext *C, wmNotifier *note)
 
void ED_screen_refresh (wmWindowManager *wm, wmWindow *win)
 
void ED_screens_init (Main *bmain, wmWindowManager *wm)
 
void ED_screen_ensure_updated (wmWindowManager *wm, wmWindow *win, bScreen *screen)
 
void ED_region_remove (bContext *C, ScrArea *area, ARegion *region)
 
void ED_region_exit (bContext *C, ARegion *region)
 
void ED_area_exit (bContext *C, ScrArea *area)
 
void ED_screen_exit (bContext *C, wmWindow *window, bScreen *screen)
 
static void screen_cursor_set (wmWindow *win, const int xy[2])
 
void ED_screen_set_active_region (bContext *C, wmWindow *win, const int xy[2])
 
int ED_screen_area_active (const bContext *C)
 
static ScrAreascreen_area_create_with_geometry (ScrAreaMap *area_map, const rcti *rect, eSpace_Type space_type)
 
static void screen_area_set_geometry_rect (ScrArea *area, const rcti *rect)
 
static void screen_global_area_refresh (wmWindow *win, bScreen *screen, const eSpace_Type space_type, GlobalAreaAlign align, const rcti *rect, const short height_cur, const short height_min, const short height_max)
 
static int screen_global_header_size (void)
 
static void screen_global_topbar_area_refresh (wmWindow *win, bScreen *screen)
 
static void screen_global_statusbar_area_refresh (wmWindow *win, bScreen *screen)
 
void ED_screen_global_areas_sync (wmWindow *win)
 
void ED_screen_global_areas_refresh (wmWindow *win)
 
void screen_change_prepare (bScreen *screen_old, bScreen *screen_new, Main *bmain, bContext *C, wmWindow *win)
 
void screen_change_update (bContext *C, wmWindow *win, bScreen *screen)
 
bool ED_screen_change (bContext *C, bScreen *screen)
 Change the active screen. More...
 
static void screen_set_3dview_camera (Scene *scene, ViewLayer *view_layer, ScrArea *area, View3D *v3d)
 
void ED_screen_scene_change (bContext *C, wmWindow *win, Scene *scene, const bool refresh_toolsystem)
 
ScrAreaED_screen_full_newspace (bContext *C, ScrArea *area, int type)
 
void ED_screen_full_prevspace (bContext *C, ScrArea *area)
 
void ED_screen_restore_temp_type (bContext *C, ScrArea *area)
 
void ED_screen_full_restore (bContext *C, ScrArea *area)
 
static bScreenscreen_state_to_nonnormal (bContext *C, wmWindow *win, ScrArea *toggle_area, int state)
 
bScreenED_screen_state_maximized_create (bContext *C)
 
ScrAreaED_screen_state_toggle (bContext *C, wmWindow *win, ScrArea *area, const short state)
 
ScrAreaED_screen_temp_space_open (bContext *C, const char *title, int x, int y, int sizex, int sizey, eSpace_Type space_type, int display_type, bool dialog)
 
void ED_refresh_viewport_fps (bContext *C)
 
void ED_screen_animation_timer (bContext *C, int redraws, int sync, int enable)
 
static ARegiontime_top_left_3dwindow (bScreen *screen)
 
void ED_screen_animation_timer_update (bScreen *screen, int redraws)
 
void ED_update_for_newframe (Main *bmain, Depsgraph *depsgraph)
 
bool ED_screen_stereo3d_required (const bScreen *screen, const Scene *scene)
 
SceneED_screen_scene_find_with_window (const bScreen *screen, const wmWindowManager *wm, struct wmWindow **r_window)
 
ScrAreaED_screen_area_find_with_spacedata (const bScreen *screen, const SpaceLink *sl, const bool only_visible)
 
SceneED_screen_scene_find (const bScreen *screen, const wmWindowManager *wm)
 
wmWindowED_screen_window_find (const bScreen *screen, const wmWindowManager *wm)
 

Function Documentation

◆ area_getoffsets()

void area_getoffsets ( ScrArea sa_a,
ScrArea sa_b,
eScreenDir  dir,
int *  r_offset1,
int *  r_offset2 
)

◆ area_getorientation()

eScreenDir area_getorientation ( ScrArea sa_a,
ScrArea sa_b 
)

◆ area_split()

ScrArea* area_split ( const wmWindow win,
bScreen screen,
ScrArea area,
const eScreenAxis  dir_axis,
const float  fac,
const bool  merge 
)

◆ ED_area_exit()

void ED_area_exit ( bContext C,
ScrArea area 
)

◆ ED_refresh_viewport_fps()

void ED_refresh_viewport_fps ( struct bContext C)

◆ ED_region_exit()

void ED_region_exit ( bContext C,
ARegion region 
)

◆ ED_region_remove()

void ED_region_remove ( struct bContext C,
struct ScrArea area,
struct ARegion region 
)

Utility to exit and free an area-region. Screen level regions (menus/popups) need to be treated slightly differently, see ui_region_temp_remove().

Definition at line 677 of file screen_edit.c.

References blender::compositor::area(), BKE_area_region_free(), BLI_freelinkN(), C, and ED_region_exit().

Referenced by file_ensure_valid_region_state(), and region_quadview_exec().

◆ ED_screen_animation_timer()

void ED_screen_animation_timer ( struct bContext C,
int  redraws,
int  sync,
int  enable 
)

◆ ED_screen_animation_timer_update()

void ED_screen_animation_timer_update ( bScreen screen,
int  redraws 
)

◆ ED_screen_area_active()

int ED_screen_area_active ( const bContext C)

◆ ED_screen_area_find_with_spacedata()

ScrArea* ED_screen_area_find_with_spacedata ( const bScreen screen,
const SpaceLink sl,
const bool  only_visible 
)

◆ ED_screen_change()

bool ED_screen_change ( struct bContext C,
struct bScreen screen 
)

◆ ED_screen_do_listen()

void ED_screen_do_listen ( bContext C,
wmNotifier note 
)

◆ ED_screen_ensure_updated()

void ED_screen_ensure_updated ( wmWindowManager wm,
wmWindow win,
bScreen screen 
)

Definition at line 670 of file screen_edit.c.

References bScreen::do_refresh, and ED_screen_refresh().

Referenced by wm_draw_update().

◆ ED_screen_exit()

void ED_screen_exit ( bContext C,
wmWindow window,
bScreen screen 
)

◆ ED_screen_full_newspace()

ScrArea* ED_screen_full_newspace ( bContext C,
ScrArea area,
int  type 
)

◆ ED_screen_full_prevspace()

void ED_screen_full_prevspace ( struct bContext C,
ScrArea area 
)

◆ ED_screen_full_restore()

void ED_screen_full_restore ( struct bContext C,
ScrArea area 
)

Restore a screen / area back to default operation, after temp full-screen modes.

Definition at line 1304 of file screen_edit.c.

References blender::compositor::area(), C, CTX_wm_screen(), CTX_wm_window(), ED_screen_full_prevspace(), ED_screen_state_toggle(), SpaceLink::link_flag, SpaceLink::next, SCREENMAXIMIZED, SPACE_FLAG_TYPE_TEMPORARY, state, and bScreen::state.

Referenced by ED_workspace_layout_cycle().

◆ ED_screen_global_areas_refresh()

void ED_screen_global_areas_refresh ( wmWindow win)

◆ ED_screen_global_areas_sync()

void ED_screen_global_areas_sync ( wmWindow win)

◆ ED_screen_refresh()

void ED_screen_refresh ( struct wmWindowManager wm,
struct wmWindow win 
)

◆ ED_screen_restore_temp_type()

void ED_screen_restore_temp_type ( bContext C,
ScrArea area 
)

◆ ED_screen_scene_change()

void ED_screen_scene_change ( bContext C,
wmWindow win,
Scene scene,
const bool  refresh_toolsystem 
)

◆ ED_screen_scene_find()

Scene* ED_screen_scene_find ( const bScreen screen,
const wmWindowManager wm 
)

Definition at line 1831 of file screen_edit.c.

References ED_screen_scene_find_with_window(), and NULL.

◆ ED_screen_scene_find_with_window()

Scene* ED_screen_scene_find_with_window ( const bScreen screen,
const wmWindowManager wm,
struct wmWindow **  r_window 
)

◆ ED_screen_set_active_region()

void ED_screen_set_active_region ( struct bContext C,
struct wmWindow win,
const int  xy[2] 
)

◆ ED_screen_state_maximized_create()

bScreen* ED_screen_state_maximized_create ( struct bContext C)

Create a new temporary screen with a maximized, empty area. This can be closed with ED_screen_state_toggle().

Use this to just create a new maximized screen/area, rather than maximizing an existing one. Otherwise, maximize with ED_screen_state_toggle().

Definition at line 1410 of file screen_edit.c.

References C, CTX_wm_window(), NULL, screen_state_to_nonnormal(), and SCREENMAXIMIZED.

Referenced by ED_screen_full_newspace().

◆ ED_screen_state_toggle()

ScrArea* ED_screen_state_toggle ( struct bContext C,
struct wmWindow win,
struct ScrArea area,
short  state 
)

◆ ED_screen_stereo3d_required()

bool ED_screen_stereo3d_required ( const bScreen screen,
const Scene scene 
)

◆ ED_screen_temp_space_open()

ScrArea* ED_screen_temp_space_open ( struct bContext C,
const char *  title,
int  x,
int  y,
int  sizex,
int  sizey,
eSpace_Type  space_type,
int  display_type,
bool  dialog 
)

Wrapper to open a temporary space either as fullscreen space, or as separate window, as defined by display_type.

Parameters
titleTitle to set for the window, if a window is spawned.
x,yPosition of the window, if a window is spawned.
sizex,sizeyDimensions of the window, if a window is spawned.

Definition at line 1522 of file screen_edit.c.

References blender::compositor::area(), AREA_FLAG_STACKED_FULLSCREEN, C, CTX_wm_area(), ED_area_newspace(), ED_screen_full_newspace(), ScrArea::full, NULL, SPACE_FLAG_TYPE_TEMPORARY, USER_TEMP_SPACE_DISPLAY_FULLSCREEN, USER_TEMP_SPACE_DISPLAY_WINDOW, WIN_ALIGN_LOCATION_CENTER, WM_window_open(), x, and y.

Referenced by wm_handler_fileselect_do().

◆ ED_screen_window_find()

wmWindow* ED_screen_window_find ( const bScreen screen,
const wmWindowManager wm 
)

◆ ED_screens_init()

void ED_screens_init ( struct Main bmain,
struct wmWindowManager wm 
)

◆ ED_update_for_newframe()

void ED_update_for_newframe ( struct Main bmain,
struct Depsgraph depsgraph 
)

◆ region_cursor_set()

static void region_cursor_set ( wmWindow win,
bool  swin_changed 
)
static

◆ region_cursor_set_ex()

static void region_cursor_set_ex ( wmWindow win,
ScrArea area,
ARegion region,
bool  swin_changed 
)
static

◆ screen_add()

bScreen* screen_add ( struct Main bmain,
const char *  name,
const rcti rect 
)

◆ screen_addarea()

static ScrArea* screen_addarea ( bScreen screen,
ScrVert left_bottom,
ScrVert left_top,
ScrVert right_top,
ScrVert right_bottom,
const eSpace_Type  space_type 
)
static

Definition at line 70 of file screen_edit.c.

References AREAMAP_FROM_SCREEN, and screen_addarea_ex().

Referenced by area_split(), and screen_add().

◆ screen_addarea_ex()

static ScrArea* screen_addarea_ex ( ScrAreaMap area_map,
ScrVert bottom_left,
ScrVert top_left,
ScrVert top_right,
ScrVert bottom_right,
const eSpace_Type  space_type 
)
static

◆ screen_area_close()

bool screen_area_close ( struct bContext C,
bScreen screen,
ScrArea area 
)

Close a screen area, allowing most-aligned neighbor to take its place.

Definition at line 514 of file screen_edit.c.

References blender::compositor::area(), area_getorientation(), bScreen::areabase, C, float(), LISTBASE_FOREACH, MAX2, MIN2, NULL, screen_area_join_ex(), SCREEN_DIR_IS_VERTICAL, and SCREEN_DIR_NONE.

Referenced by area_close_exec(), and screen_area_join_ex().

◆ screen_area_create_with_geometry()

static ScrArea* screen_area_create_with_geometry ( ScrAreaMap area_map,
const rcti rect,
eSpace_Type  space_type 
)
static

Add an area and geometry (screen-edges and -vertices) for it to area_map, with coordinates/dimensions matching rect.

Definition at line 950 of file screen_edit.c.

References screen_addarea_ex(), screen_geom_edge_add_ex(), screen_geom_vertex_add_ex(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.

Referenced by screen_global_area_refresh().

◆ screen_area_join()

int screen_area_join ( struct bContext C,
bScreen screen,
ScrArea sa1,
ScrArea sa2 
)

Join any two neighboring areas. Might involve complex changes.

Definition at line 509 of file screen_edit.c.

References C, and screen_area_join_ex().

Referenced by area_join_apply(), and area_split_cancel().

◆ screen_area_join_aligned()

static bool screen_area_join_aligned ( bContext C,
bScreen screen,
ScrArea sa1,
ScrArea sa2 
)
static

◆ screen_area_join_ex()

static bool screen_area_join_ex ( bContext C,
bScreen screen,
ScrArea sa1,
ScrArea sa2,
bool  close_all_remainders 
)
static

◆ screen_area_set_geometry_rect()

static void screen_area_set_geometry_rect ( ScrArea area,
const rcti rect 
)
static

◆ screen_area_spacelink_add()

void screen_area_spacelink_add ( Scene scene,
ScrArea area,
eSpace_Type  space_type 
)

◆ screen_area_trim()

static ScrArea* screen_area_trim ( bContext C,
bScreen screen,
ScrArea **  area,
int  size,
eScreenDir  dir,
bool  reverse 
)
static

◆ screen_areas_align()

static void screen_areas_align ( bContext C,
bScreen screen,
ScrArea sa1,
ScrArea sa2,
const eScreenDir  dir 
)
static

◆ screen_change_prepare()

void screen_change_prepare ( bScreen screen_old,
bScreen screen_new,
struct Main bmain,
struct bContext C,
wmWindow win 
)

◆ screen_change_update()

void screen_change_update ( bContext C,
wmWindow win,
bScreen screen 
)

◆ screen_cursor_set()

static void screen_cursor_set ( wmWindow win,
const int  xy[2] 
)
static

◆ screen_data_copy()

void screen_data_copy ( bScreen to,
bScreen from 
)

◆ screen_delarea()

static void screen_delarea ( bContext C,
bScreen screen,
ScrArea area 
)
static

◆ screen_global_area_refresh()

static void screen_global_area_refresh ( wmWindow win,
bScreen screen,
const eSpace_Type  space_type,
GlobalAreaAlign  align,
const rcti rect,
const short  height_cur,
const short  height_min,
const short  height_max 
)
static

◆ screen_global_header_size()

static int screen_global_header_size ( void  )
static

◆ screen_global_statusbar_area_refresh()

static void screen_global_statusbar_area_refresh ( wmWindow win,
bScreen screen 
)
static

◆ screen_global_topbar_area_refresh()

static void screen_global_topbar_area_refresh ( wmWindow win,
bScreen screen 
)
static

◆ screen_new_activate_prepare()

void screen_new_activate_prepare ( const wmWindow win,
bScreen screen_new 
)

Prepare a newly created screen for initializing it as active screen.

Definition at line 258 of file screen_edit.c.

References bScreen::do_draw, bScreen::do_refresh, bScreen::winid, and wmWindow::winid.

◆ screen_set_3dview_camera()

static void screen_set_3dview_camera ( Scene scene,
ViewLayer view_layer,
ScrArea area,
View3D v3d 
)
static

◆ screen_state_to_nonnormal()

static bScreen* screen_state_to_nonnormal ( bContext C,
wmWindow win,
ScrArea toggle_area,
int  state 
)
static
Parameters
toggle_areaIf this is set, its space data will be swapped with the one of the new empty area, when toggling back it can be swapped back again.
Returns
The newly created screen with the non-normal area.
Note
The caller must run ED_screen_change this is not done in this function as it would attempt to initialize areas that don't yet have a space-type assigned (converting them to 3D view without creating the space-data).

Definition at line 1338 of file screen_edit.c.

References bScreen::animtimer, bScreen::areabase, ScrAreaMap::areabase, BKE_workspace_layout_screen_get(), BLI_assert, BLI_snprintf(), C, CTX_data_main(), ED_area_data_swap(), ED_area_tag_refresh(), ED_workspace_layout_add(), ELEM, ListBase::first, bScreen::flag, ScrArea::flag, ScrArea::full, GLOBAL_AREA_IS_HIDDEN, wmWindow::global_areas, bScreen::id, if(), LISTBASE_FOREACH, MAX_ID_NAME, ID::name, NULL, bScreen::redraws_flag, ScrArea::regionbase, RGN_FLAG_HIDDEN, RGN_TYPE_EXECUTE, RGN_TYPE_FOOTER, RGN_TYPE_HEADER, RGN_TYPE_NAV_BAR, RGN_TYPE_TOOL_HEADER, RGN_TYPE_TOOLS, RGN_TYPE_UI, SCREENFULL, SCREENMAXIMIZED, state, bScreen::state, bScreen::temp, WM_window_get_active_screen(), and WM_window_get_active_workspace().

Referenced by ED_screen_state_maximized_create(), and ED_screen_state_toggle().

◆ screen_verts_halign()

static void screen_verts_halign ( const wmWindow win,
const bScreen screen,
const short  from_x,
const short  to_x 
)
static

Definition at line 336 of file screen_edit.c.

References ED_screen_verts_iter, and v1.

Referenced by screen_areas_align().

◆ screen_verts_valign()

static void screen_verts_valign ( const wmWindow win,
const bScreen screen,
const short  from_y,
const short  to_y 
)
static

Definition at line 350 of file screen_edit.c.

References ED_screen_verts_iter, and v1.

Referenced by screen_areas_align().

◆ time_top_left_3dwindow()

static ARegion* time_top_left_3dwindow ( bScreen screen)
static