Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2019-09-18 15:21:32 +0300
committerJulian Eisel <eiseljulian@gmail.com>2019-09-18 15:22:50 +0300
commit95373e274908615df2e5dbf6243b055ff2c39518 (patch)
tree0721772da52667ab5cbefa8e9f7dea55ca4710ef /source/blender/editors/screen
parente2cbf8b1174d512170f490f701c43213c874a717 (diff)
Refactor temp-space opening for optional fullscreen mode
Will be put to use in followup commits.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/screen_edit.c33
-rw-r--r--source/blender/editors/screen/screen_ops.c14
2 files changed, 44 insertions, 3 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index b37aa47aba6..20920dc6f84 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1346,6 +1346,39 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
return sc->areabase.first;
}
+/**
+ * Wrapper to open a temporary space either as fullscreen space, or as separate window, as defined
+ * by \a display_type.
+ *
+ * \param title: Title to set for the window, if a window is spawned.
+ * \param x, y: Position of the window, if a window is spawned.
+ * \param sizex, sizey: Dimensions of the window, if a window is spawned.
+ */
+ScrArea *ED_screen_temp_space_open(bContext *C,
+ const char *title,
+ int x,
+ int y,
+ int sizex,
+ int sizey,
+ eSpace_Type space_type,
+ int display_type)
+{
+ ScrArea *sa = NULL;
+
+ switch (display_type) {
+ case USER_TEMP_SPACE_DISPLAY_WINDOW:
+ if (WM_window_open_temp(C, title, x, y, sizex, sizey, (int)space_type)) {
+ sa = CTX_wm_area(C);
+ }
+ break;
+ case USER_TEMP_SPACE_DISPLAY_FULLSCREEN:
+ sa = ED_screen_full_newspace(C, CTX_wm_area(C), (int)space_type);
+ break;
+ }
+
+ return sa;
+}
+
/* update frame rate info for viewport drawing */
void ED_refresh_viewport_fps(bContext *C)
{
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index f29535a7f0b..53b30373ec3 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -4833,7 +4833,9 @@ static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *even
int sizey = 520 * UI_DPI_FAC;
/* changes context! */
- if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_USERPREFS) != NULL) {
+ if (WM_window_open_temp(
+ C, IFACE_("Blender Preferences"), event->x, event->y, sizex, sizey, SPACE_USERPREF) !=
+ NULL) {
/* The header only contains the editor switcher and looks empty.
* So hiding in the temp window makes sense. */
ScrArea *area = CTX_wm_area(C);
@@ -4882,7 +4884,11 @@ static int drivers_editor_show_invoke(bContext *C, wmOperator *op, const wmEvent
but = UI_context_active_but_prop_get(C, &ptr, &prop, &index);
/* changes context! */
- if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_DRIVERS) != NULL) {
+ if (WM_window_open_temp(
+ C, IFACE_("Blender Drivers Editor"), event->x, event->y, sizex, sizey, SPACE_GRAPH) !=
+ NULL) {
+ ED_drivers_editor_init(C, CTX_wm_area(C));
+
/* activate driver F-Curve for the property under the cursor */
if (but) {
FCurve *fcu;
@@ -4938,7 +4944,9 @@ static int info_log_show_invoke(bContext *C, wmOperator *op, const wmEvent *even
int shift_y = 480;
/* changes context! */
- if (WM_window_open_temp(C, event->x, event->y + shift_y, sizex, sizey, WM_WINDOW_INFO) != NULL) {
+ if (WM_window_open_temp(
+ C, IFACE_("Blender Info Log"), event->x, event->y + shift_y, sizex, sizey, SPACE_INFO) !=
+ NULL) {
return OPERATOR_FINISHED;
}
else {