From 2f0f8c8bae8c6f55290966d9fb29c3d2a4c51793 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 7 Feb 2009 19:37:29 +0000 Subject: 2.5 - Screen browse button back - Several fixes in using screens in more windows. Still has loose ends, but things are definitely more stable! --- source/blender/editors/space_info/info_header.c | 67 +++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'source/blender/editors/space_info') diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c index 59e30d87407..096374a82c4 100644 --- a/source/blender/editors/space_info/info_header.c +++ b/source/blender/editors/space_info/info_header.c @@ -103,10 +103,66 @@ static void do_info_buttons(bContext *C, void *arg, int event) } } +static void screen_idpoin_handle(bContext *C, ID *id, int event) +{ + + switch(event) { + case UI_ID_BROWSE: + /* exception: can't set screens inside of area/region handers */ + WM_event_add_notifier(C, NC_SCREEN|ND_SCREENBROWSE, id); + break; + case UI_ID_DELETE: + ED_undo_push(C, ""); + break; + case UI_ID_RENAME: + break; + case UI_ID_ADD_NEW: + /* XXX not implemented */ + break; + case UI_ID_OPEN: + /* XXX not implemented */ + break; + case UI_ID_ALONE: + /* XXX not implemented */ + break; + case UI_ID_PIN: + break; + } +} + +static void scene_idpoin_handle(bContext *C, ID *id, int event) +{ + + switch(event) { + case UI_ID_BROWSE: + WM_event_add_notifier(C, NC_SCREEN|ND_SCENEBROWSE, CTX_wm_screen(C)); + break; + case UI_ID_DELETE: + ED_undo_push(C, ""); + break; + case UI_ID_RENAME: + break; + case UI_ID_ADD_NEW: + /* XXX not implemented */ + break; + case UI_ID_OPEN: + /* XXX not implemented */ + break; + case UI_ID_ALONE: + /* XXX not implemented */ + break; + case UI_ID_PIN: + break; + } +} + void info_header_buttons(const bContext *C, ARegion *ar) { + wmWindow *win= CTX_wm_window(C); + bScreen *screen= CTX_wm_screen(C); ScrArea *sa= CTX_wm_area(C); + SpaceInfo *si= sa->spacedata.first; uiBlock *block; int xco, yco= 3; @@ -147,6 +203,17 @@ void info_header_buttons(const bContext *C, ARegion *ar) } uiBlockSetEmboss(block, UI_EMBOSS); + + if(screen->full==NULL) { + si->screen= win->screen; + xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID**)&si->screen, ID_SCR, NULL, xco, yco, + screen_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_DELETE); + xco += 8; + si->scene= screen->scene; + xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID**)&si->scene, ID_SCE, NULL, xco, yco, + scene_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_DELETE); + xco += 8; + } if(WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) { uiDefIconTextBut(block, BUT, B_STOPRENDER, ICON_REC, "Render", xco+5,yco,75,19, NULL, 0.0f, 0.0f, 0, 0, "Stop rendering"); -- cgit v1.2.3