diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-18 15:21:32 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-18 15:22:50 +0300 |
commit | 95373e274908615df2e5dbf6243b055ff2c39518 (patch) | |
tree | 0721772da52667ab5cbefa8e9f7dea55ca4710ef /source/blender/windowmanager/intern | |
parent | e2cbf8b1174d512170f490f701c43213c874a717 (diff) |
Refactor temp-space opening for optional fullscreen mode
Will be put to use in followup commits.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 51 |
2 files changed, 8 insertions, 48 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 77672e04030..347e26e0ba5 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -58,6 +58,8 @@ #include "BKE_sound.h" +#include "BLT_translation.h" + #include "ED_fileselect.h" #include "ED_info.h" #include "ED_screen.h" @@ -2346,11 +2348,12 @@ static int wm_handler_fileselect_do(bContext *C, const int sizey = 600 * UI_DPI_FAC; if (WM_window_open_temp(C, + IFACE_("Blender File View"), WM_window_pixels_x(win) / 2, WM_window_pixels_y(win) / 2, sizex, sizey, - WM_WINDOW_FILESEL) != NULL) { + SPACE_FILE) != NULL) { ScrArea *area = CTX_wm_area(C); ARegion *region_header = BKE_area_find_region_type(area, RGN_TYPE_HEADER); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 7437001cdfc..081797542f2 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -792,10 +792,11 @@ wmWindow *WM_window_open(bContext *C, const rcti *rect) * Uses `screen->temp` tag to define what to do, currently it limits * to only one "temp" window for render out, preferences, filewindow, etc... * - * \param type: WM_WINDOW_RENDER, WM_WINDOW_USERPREFS... - * \return the window or NULL. + * \param space_type: SPACE_VIEW3D, SPACE_INFO, ... (eSpace_Type) + * \return the window or NULL in case of failure. */ -wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, int type) +wmWindow *WM_window_open_temp( + bContext *C, const char *title, int x, int y, int sizex, int sizey, int space_type) { Main *bmain = CTX_data_main(C); wmWindow *win_prev = CTX_wm_window(C); @@ -804,8 +805,6 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i ScrArea *sa; Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - eSpace_Type space_type = SPACE_EMPTY; - const char *title; /* convert to native OS window coordinates */ const float native_pixel_size = GHOST_GetNativePixelSize(win_prev->ghostwin); @@ -885,53 +884,11 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i sa = screen->areabase.first; CTX_wm_area_set(C, sa); - if (type == WM_WINDOW_RENDER) { - space_type = SPACE_IMAGE; - } - else if (type == WM_WINDOW_DRIVERS) { - space_type = SPACE_GRAPH; - } - else if (type == WM_WINDOW_USERPREFS) { - space_type = SPACE_USERPREF; - } - else if (type == WM_WINDOW_FILESEL) { - space_type = SPACE_FILE; - } - else if (type == WM_WINDOW_INFO) { - space_type = SPACE_INFO; - } - else { - BLI_assert(false); - } ED_area_newspace(C, sa, space_type, false); ED_screen_change(C, screen); ED_screen_refresh(CTX_wm_manager(C), win); /* test scale */ - /* do additional setup for specific editor type */ - if (type == WM_WINDOW_DRIVERS) { - ED_drivers_editor_init(C, sa); - } - - if (sa->spacetype == SPACE_IMAGE) { - title = IFACE_("Blender Render"); - } - else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF)) { - title = IFACE_("Blender Preferences"); - } - else if (sa->spacetype == SPACE_FILE) { - title = IFACE_("Blender File View"); - } - else if (sa->spacetype == SPACE_GRAPH) { - title = IFACE_("Blender Drivers Editor"); - } - else if (sa->spacetype == SPACE_INFO) { - title = IFACE_("Blender Info Log"); - } - else { - title = "Blender"; - } - if (win->ghostwin) { GHOST_SetTitle(win->ghostwin, title); return win; |