11#include <fmt/format.h>
51 stopbar = MEM_new<SpaceTopBar>(
"init topbar");
69 return reinterpret_cast<SpaceLink *
>(stopbar);
84 return reinterpret_cast<SpaceLink *
>(stopbarn);
186 msg_sub_value_region_tag_redraw.
owner = region;
187 msg_sub_value_region_tag_redraw.
user_data = region;
191 mbus, &workspace->
id, workspace,
WorkSpace, tools, &msg_sub_value_region_tag_redraw);
200 block,
ui::ButtonType::Label, text, 0, 0, 200,
UI_UNIT_Y,
nullptr, 0.0, 0.0,
"");
211 return std::string(
project->get_name());
214 return template_recent_files(&layout, rows);
226 fmt::format(fmt::runtime(
IFACE_(
"Project: {}")), *project_name));
233 found_project ?
IFACE_(
"Other Recent Files") :
IFACE_(
"Recent Files"));
236 return found_project + found_other;
243 const bool is_menu_search =
CTX_data_int_get(
C,
"is_menu_search").value_or(
false);
244 if (is_menu_search) {
245 template_recent_files(&layout,
U.recent_files);
248 const int limit = std::min<int>(
U.recent_files, 20);
252 "WM_OT_search_single_menu",
IFACE_(
"More..."), ICON_VIEWZOOM);
253 RNA_string_set(&search_props,
"menu_idname",
"TOPBAR_MT_file_open_recent");
254 layout.
op(
"WM_OT_clear_recent_files",
IFACE_(
"Clear Recent Files List..."), ICON_TRASH);
257 layout.
label(
IFACE_(
"No Recent Files"), ICON_NONE);
277 if (
wm->runtime->undo_stack ==
nullptr) {
281 int undo_step_count = 0;
282 int undo_step_count_all = 0;
283 for (
UndoStep &us :
wm->runtime->undo_stack->steps.items_reversed()) {
284 undo_step_count_all += 1;
288 undo_step_count += 1;
294 const int col_size = 20 + (undo_step_count / 12);
299 int i = undo_step_count_all - 1;
300 for (
UndoStep *us =
wm->runtime->undo_stack->steps.last(); us; us = us->prev, i--) {
304 if (!(undo_step_count % col_size)) {
305 column = &
split.column(
false);
307 const bool is_active = (us ==
wm->runtime->undo_stack->step_active);
312 is_active ? ICON_LAYER_ACTIVE : ICON_NONE);
314 undo_step_count += 1;
337 std::unique_ptr<SpaceType> st = std::make_unique<SpaceType>();
#define STRNCPY_UTF8(dst, src)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
#define RGN_ALIGN_ENUM_FROM_MASK(align)
Read Blender memory allocation and freeing.
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
void view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
void button_drawflag_enable(Button *but, int flag)
Button * uiDefBut(Block *block, ButtonTypeWithPointerType but_and_ptr_type, StringRef str, int x, int y, short width, short height, void *poin, float min, float max, std::optional< StringRef > tip)
void block_layout_set_current(Block *block, Layout *layout)
static void topbar_init(wmWindowManager *, ScrArea *)
static void topbar_space_blend_write(BlendWriter *writer, SpaceLink *sl)
static void topbar_header_listener(const wmRegionListenerParams *params)
static void undo_history_draw_menu(const bContext *C, Menu *menu)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
static void topbar_header_region_init(wmWindowManager *, ARegion *region)
auto BKE_blender_project_read_callback(const Main *bmain, Fn lambda)
void ED_region_header_draw(const bContext *C, ARegion *region)
static void undo_history_menu_register()
void ED_region_tag_redraw(ARegion *region)
static int recent_files_menu_list(const bContext *C, ui::Layout &layout, const int rows)
static void topbar_main_region_listener(const wmRegionListenerParams *params)
static SpaceLink * topbar_duplicate(SpaceLink *sl)
void ED_spacetype_topbar()
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
wmWindowManager * CTX_wm_manager(const bContext *C)
static void topbar_operatortypes()
static void topbar_free(SpaceLink *)
static void topbar_keymap(wmKeyConfig *)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBaseT< wmEventHandler > *handlers, wmKeyMap *keymap)
ARegion * BKE_area_region_new()
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
bool WM_menutype_add(MenuType *mt)
void BKE_spacetype_register(std::unique_ptr< SpaceType > st)
void ED_region_header_init(ARegion *region)
static SpaceLink * topbar_create(const ScrArea *, const Scene *)
std::optional< int64_t > CTX_data_int_get(const bContext *C, const char *member)
void ED_region_header_layout(const bContext *C, ARegion *region)
void ED_region_do_msg_notify_tag_redraw(bContext *C, wmMsgSubscribeKey *msg_key, wmMsgSubscribeValue *msg_val)
static void recent_files_menu_label(ui::Layout &layout, const StringRef text)
static void topbar_header_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
static void recent_files_menu_register()
static void topbar_main_region_init(wmWindowManager *wm, ARegion *region)
static void recent_files_menu_draw(const bContext *C, Menu *menu)
void(*) message_subscribe(const wmRegionMessageSubscribeParams *params)
void(*) draw(const bContext *C, ARegion *region)
void(*) listener(const wmRegionListenerParams *params)
void(*) layout(const bContext *C, ARegion *region)
void(*) init(wmWindowManager *wm, ARegion *region)
bke::ARegionRuntime * runtime
eRegion_Alignment alignment
void write_struct_cast(const void *data, BlendStructWriterTypedFn< T > fn=nullptr)
ListBaseT< ARegion > regionbase
ListBaseT< wmEventHandler > handlers
void enabled_set(bool enabled)
void operator_context_set(wm::OpCallContext opcontext)
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
Layout & split(float percentage, bool align)
Layout & column(bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
const wmNotifier * notifier
#define WM_msg_subscribe_rna_prop(mbus, id_, data_, type_, prop_, value)