Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_statusbar/space_statusbar.c
| Show All 15 Lines | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_space_api.h" | #include "ED_space_api.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "BLO_read_write.h" | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_message.h" | #include "WM_message.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| /* ******************** default callbacks for statusbar space ******************** */ | /* ******************** default callbacks for statusbar space ******************** */ | ||||
| static SpaceLink *statusbar_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) | static SpaceLink *statusbar_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | wmMsgSubscribeValue msg_sub_value_region_tag_redraw = { | ||||
| .user_data = region, | .user_data = region, | ||||
| .notify = ED_region_do_msg_notify_tag_redraw, | .notify = ED_region_do_msg_notify_tag_redraw, | ||||
| }; | }; | ||||
| WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw); | WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw); | ||||
| WM_msg_subscribe_rna_anon_prop(mbus, ViewLayer, name, &msg_sub_value_region_tag_redraw); | WM_msg_subscribe_rna_anon_prop(mbus, ViewLayer, name, &msg_sub_value_region_tag_redraw); | ||||
| } | } | ||||
| static void statusbar_blend_write(BlendWriter *writer, SpaceLink *sl) | |||||
| { | |||||
| BLO_write_struct(writer, SpaceStatusBar, sl); | |||||
| } | |||||
| void ED_spacetype_statusbar(void) | void ED_spacetype_statusbar(void) | ||||
| { | { | ||||
| SpaceType *st = MEM_callocN(sizeof(*st), "spacetype statusbar"); | SpaceType *st = MEM_callocN(sizeof(*st), "spacetype statusbar"); | ||||
| ARegionType *art; | ARegionType *art; | ||||
| st->spaceid = SPACE_STATUSBAR; | st->spaceid = SPACE_STATUSBAR; | ||||
| STRNCPY(st->name, "Status Bar"); | STRNCPY(st->name, "Status Bar"); | ||||
| st->create = statusbar_create; | st->create = statusbar_create; | ||||
| st->free = statusbar_free; | st->free = statusbar_free; | ||||
| st->init = statusbar_init; | st->init = statusbar_init; | ||||
| st->duplicate = statusbar_duplicate; | st->duplicate = statusbar_duplicate; | ||||
| st->operatortypes = statusbar_operatortypes; | st->operatortypes = statusbar_operatortypes; | ||||
| st->keymap = statusbar_keymap; | st->keymap = statusbar_keymap; | ||||
| st->blend_write = statusbar_blend_write; | |||||
| /* regions: header window */ | /* regions: header window */ | ||||
| art = MEM_callocN(sizeof(*art), "spacetype statusbar header region"); | art = MEM_callocN(sizeof(*art), "spacetype statusbar header region"); | ||||
| art->regionid = RGN_TYPE_HEADER; | art->regionid = RGN_TYPE_HEADER; | ||||
| art->prefsizey = 0.8f * HEADERY; | art->prefsizey = 0.8f * HEADERY; | ||||
| art->prefsizex = UI_UNIT_X * 5; /* Mainly to avoid glitches */ | art->prefsizex = UI_UNIT_X * 5; /* Mainly to avoid glitches */ | ||||
| art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; | art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; | ||||
| art->init = statusbar_header_region_init; | art->init = statusbar_header_region_init; | ||||
| art->layout = ED_region_header_layout; | art->layout = ED_region_header_layout; | ||||
| art->draw = ED_region_header_draw; | art->draw = ED_region_header_draw; | ||||
| art->listener = statusbar_header_region_listener; | art->listener = statusbar_header_region_listener; | ||||
| art->message_subscribe = statusbar_header_region_message_subscribe; | art->message_subscribe = statusbar_header_region_message_subscribe; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| BKE_spacetype_register(st); | BKE_spacetype_register(st); | ||||
| } | } | ||||