Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_edit.c
| Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_screen_types.h" | #include "ED_screen_types.h" | ||||
| #include "ED_clip.h" | #include "ED_clip.h" | ||||
| #include "ED_node.h" | #include "ED_node.h" | ||||
| #include "ED_render.h" | #include "ED_render.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "WM_message.h" | |||||
| /* XXX actually should be not here... solve later */ | /* XXX actually should be not here... solve later */ | ||||
| #include "wm_subwindow.h" | #include "wm_subwindow.h" | ||||
| #include "screen_intern.h" /* own module include */ | #include "screen_intern.h" /* own module include */ | ||||
| /* ******************* screen vert, edge, area managing *********************** */ | /* ******************* screen vert, edge, area managing *********************** */ | ||||
| ▲ Show 20 Lines • Show All 825 Lines • ▼ Show 20 Lines | static void screen_refresh_headersizes(void) | ||||
| SpaceType *st; | SpaceType *st; | ||||
| for (st = lb->first; st; st = st->next) { | for (st = lb->first; st; st = st->next) { | ||||
| ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_HEADER); | ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_HEADER); | ||||
| if (art) art->prefsizey = ED_area_headersize(); | if (art) art->prefsizey = ED_area_headersize(); | ||||
| } | } | ||||
| } | } | ||||
| #if 0 | |||||
| /* Follow wmMsgNotifyFn spec */ | |||||
| static void ED_screen_do_msg_notify_tag_redraw( | |||||
| bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) | |||||
| { | |||||
| bScreen *screen = msg_val->user_data; | |||||
| screen->do_draw = true; | |||||
| /* each region could have its own subscription, for simple redraw this isn't needed */ | |||||
| for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { | |||||
| ED_area_tag_redraw(sa); | |||||
| } | |||||
| } | |||||
| static void ED_screen_do_msg_notify_tag_refresh( | |||||
| bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) | |||||
| { | |||||
| bScreen *screen = msg_val->user_data; | |||||
| screen->do_draw = screen->do_refresh = true; | |||||
| } | |||||
| #endif | |||||
| /* make this screen usable */ | /* make this screen usable */ | ||||
| /* for file read and first use, for scaling window, area moves */ | /* for file read and first use, for scaling window, area moves */ | ||||
| void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) | void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) | ||||
| { | { | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| /* exception for bg mode, we only need the screen context */ | /* exception for bg mode, we only need the screen context */ | ||||
| if (!G.background) { | if (!G.background) { | ||||
| Show All 24 Lines | for (sa = screen->areabase.first; sa; sa = sa->next) { | ||||
| /* set spacetype and region callbacks, calls init() */ | /* set spacetype and region callbacks, calls init() */ | ||||
| /* sets subwindows for regions, adds handlers */ | /* sets subwindows for regions, adds handlers */ | ||||
| ED_area_initialize(wm, win, sa); | ED_area_initialize(wm, win, sa); | ||||
| } | } | ||||
| /* wake up animtimer */ | /* wake up animtimer */ | ||||
| if (screen->animtimer) | if (screen->animtimer) | ||||
| WM_event_timer_sleep(wm, win, screen->animtimer, false); | WM_event_timer_sleep(wm, win, screen->animtimer, false); | ||||
| /* disable for now. use regular notifiers */ | |||||
| #if 0 | |||||
| /* message bus */ | |||||
| WM_msg_subscribe_static( | |||||
| wm->message_bus, WM_MSG_STATICTYPE_WINDOW_DRAW, | |||||
| &(const wmMsgSubscribeValue){ | |||||
| .owner = wm, | |||||
| .user_data = screen, | |||||
| .notify = ED_screen_do_msg_notify_tag_redraw, | |||||
| }); | |||||
| WM_msg_subscribe_static( | |||||
| wm->message_bus, WM_MSG_STATICTYPE_SCREEN_EDIT, | |||||
| &(const wmMsgSubscribeValue){ | |||||
| .owner = wm, | |||||
| .user_data = screen, | |||||
| .notify = ED_screen_do_msg_notify_tag_refresh, | |||||
| }); | |||||
| WM_msg_subscribe_static( | |||||
| wm->message_bus, WM_MSG_STATICTYPE_FILE_READ, | |||||
| &(const wmMsgSubscribeValue){ | |||||
| .owner = wm, | |||||
| .user_data = screen, | |||||
| .notify = ED_screen_do_msg_notify_tag_refresh, | |||||
| }); | |||||
| #endif | |||||
| } | } | ||||
| if (G.debug & G_DEBUG_EVENTS) { | if (G.debug & G_DEBUG_EVENTS) { | ||||
| printf("%s: set screen\n", __func__); | printf("%s: set screen\n", __func__); | ||||
| } | } | ||||
| screen->do_refresh = false; | screen->do_refresh = false; | ||||
| /* prevent multiwin errors */ | /* prevent multiwin errors */ | ||||
| screen->winid = win->winid; | screen->winid = win->winid; | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | if (ar->headerstr) { | ||||
| ar->headerstr = NULL; | ar->headerstr = NULL; | ||||
| } | } | ||||
| if (ar->regiontimer) { | if (ar->regiontimer) { | ||||
| WM_event_remove_timer(wm, win, ar->regiontimer); | WM_event_remove_timer(wm, win, ar->regiontimer); | ||||
| ar->regiontimer = NULL; | ar->regiontimer = NULL; | ||||
| } | } | ||||
| WM_msgbus_clear_by_owner(wm->message_bus, ar); | |||||
| CTX_wm_region_set(C, prevar); | CTX_wm_region_set(C, prevar); | ||||
| } | } | ||||
| void ED_area_exit(bContext *C, ScrArea *sa) | void ED_area_exit(bContext *C, ScrArea *sa) | ||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| ScrArea *prevsa = CTX_wm_area(C); | ScrArea *prevsa = CTX_wm_area(C); | ||||
| ▲ Show 20 Lines • Show All 847 Lines • Show Last 20 Lines | |||||