Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/space_file.c
| Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "WM_message.h" | |||||
| #include "ED_space_api.h" | #include "ED_space_api.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_fileselect.h" | #include "ED_fileselect.h" | ||||
| #include "IMB_imbuf_types.h" | #include "IMB_imbuf_types.h" | ||||
| #include "IMB_thumbs.h" | #include "IMB_thumbs.h" | ||||
| ▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | case NC_SPACE: | ||||
| ED_area_tag_redraw(sa); | ED_area_tag_redraw(sa); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| static void file_main_message_bus_init( | |||||
| const bContext *C, ARegion *ar, FileSelectParams *params) | |||||
| { | |||||
| struct wmMsgBus *mbus = CTX_wm_message_bus(C); | |||||
| bScreen *sc = CTX_wm_screen(C); | |||||
| ScrArea *sa = CTX_wm_area(C); | |||||
| /* This is a bit odd that a region owns the subscriber for an area, | |||||
| * keep for now since all subscribers for WM are regions. | |||||
| * May be worth re-visiting later. */ | |||||
| wmMsgSubscribeValue msg_sub_value_area_tag_refresh = { | |||||
| .owner = ar, | |||||
| .user_data = sa, | |||||
| .notify = ED_area_do_msg_notify_tag_refresh, | |||||
| }; | |||||
| /* FileSelectParams */ | |||||
| { | |||||
| PointerRNA ptr; | |||||
| RNA_pointer_create(&sc->id, &RNA_FileSelectParams, params, &ptr); | |||||
| /* All properties for this space type. */ | |||||
| WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_area_tag_refresh, __func__); | |||||
| } | |||||
| } | |||||
| /* add handlers, stuff you only do once or on area/region changes */ | /* add handlers, stuff you only do once or on area/region changes */ | ||||
| static void file_main_region_init(wmWindowManager *wm, ARegion *ar) | static void file_main_region_init(wmWindowManager *wm, ARegion *ar) | ||||
| { | { | ||||
| wmKeyMap *keymap; | wmKeyMap *keymap; | ||||
| UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); | UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); | ||||
| /* own keymaps */ | /* own keymaps */ | ||||
| Show All 32 Lines | static void file_main_region_draw(const bContext *C, ARegion *ar) | ||||
| View2D *v2d = &ar->v2d; | View2D *v2d = &ar->v2d; | ||||
| View2DScrollers *scrollers; | View2DScrollers *scrollers; | ||||
| float col[3]; | float col[3]; | ||||
| /* Needed, because filelist is not initialized on loading */ | /* Needed, because filelist is not initialized on loading */ | ||||
| if (!sfile->files || filelist_empty(sfile->files)) | if (!sfile->files || filelist_empty(sfile->files)) | ||||
| file_refresh(C, NULL); | file_refresh(C, NULL); | ||||
| file_main_message_bus_init(C, ar, params); | |||||
| /* clear and setup matrix */ | /* clear and setup matrix */ | ||||
| UI_GetThemeColor3fv(TH_BACK, col); | UI_GetThemeColor3fv(TH_BACK, col); | ||||
| glClearColor(col[0], col[1], col[2], 0.0); | glClearColor(col[0], col[1], col[2], 0.0); | ||||
| glClear(GL_COLOR_BUFFER_BIT); | glClear(GL_COLOR_BUFFER_BIT); | ||||
| /* Allow dynamically sliders to be set, saves notifiers etc. */ | /* Allow dynamically sliders to be set, saves notifiers etc. */ | ||||
| if (params->display == FILE_IMGDISPLAY) { | if (params->display == FILE_IMGDISPLAY) { | ||||
| ▲ Show 20 Lines • Show All 440 Lines • Show Last 20 Lines | |||||