diff options
| author | aura <nw@moneybot.cc> | 2026-03-16 10:15:01 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-16 10:15:01 +0100 |
| commit | fdc5e8760fb7ac0af8e7ebb98a2076db15e31082 (patch) | |
| tree | c94991e1e594c7703295aa413caf40786f343c1f /src/editor/editor_menubar.cpp | |
| parent | e2829336cfedb39d23263f75b61ed969c8193534 (diff) | |
giga refactor, fix ALL the leaks
Diffstat (limited to 'src/editor/editor_menubar.cpp')
| -rw-r--r-- | src/editor/editor_menubar.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/editor/editor_menubar.cpp b/src/editor/editor_menubar.cpp index b89d1c6..cfb12a3 100644 --- a/src/editor/editor_menubar.cpp +++ b/src/editor/editor_menubar.cpp @@ -66,7 +66,7 @@ void editor_raise_header_toolbar( GAME_EDITOR* e ) { parent->children.push( bar ); } -static void editor_contextmenu_set_item( +void editor_contextmenu_set_item( EDITOR_CONTEXTMENU_ITEM* item, const char* text, EDITOR_CONTEXTMENU_CALLBACK cb = 0, @@ -84,38 +84,38 @@ static void editor_contextmenu_set_item( item->enabled_cb = enabled_cb; } -static void editor_contextmenu_save_cb( void* ) { +void editor_contextmenu_save_cb( void* ) { if( editor ) editor_save_map( editor ); } -static void editor_contextmenu_undo_cb( void* ) { +void editor_contextmenu_undo_cb( void* ) { if( editor ) editor_undo( editor ); } -static void editor_contextmenu_redo_cb( void* ) { +void editor_contextmenu_redo_cb( void* ) { if( editor ) editor_redo( editor ); } -static void editor_contextmenu_set_view_mode_cb( void* data ) { +void editor_contextmenu_set_view_mode_cb( void* data ) { editor_set_view_mode( (I32)(I64)data ); } -static void editor_contextmenu_set_tool_cb( void* data ) { +void editor_contextmenu_set_tool_cb( void* data ) { editor_settool( (U8)(I64)data ); } -static U8 editor_contextmenu_undo_enabled( const EDITOR_CONTEXTMENU_ITEM* ) { +U8 editor_contextmenu_undo_enabled( const EDITOR_CONTEXTMENU_ITEM* ) { return editor && editor->undo_actions.size > 0; } -static U8 editor_contextmenu_redo_enabled( const EDITOR_CONTEXTMENU_ITEM* ) { +U8 editor_contextmenu_redo_enabled( const EDITOR_CONTEXTMENU_ITEM* ) { return editor && editor->redo_actions.size > 0; } -static void editor_toolbar_init_entries( GUI_EDITOR_TOOLBAR* bar ) { +void editor_toolbar_init_entries( GUI_EDITOR_TOOLBAR* bar ) { if( !bar ) return; @@ -146,7 +146,7 @@ static void editor_toolbar_init_entries( GUI_EDITOR_TOOLBAR* bar ) { editor_contextmenu_set_item( &bar->entries[3].items[4], "object", editor_contextmenu_set_tool_cb, (void*)(I64)EDITOR_TOOL_OBJECT ); } -static I32 editor_toolbar_root_width( const EDITOR_CONTEXTMENU_ITEM* entry ) { +I32 editor_toolbar_root_width( const EDITOR_CONTEXTMENU_ITEM* entry ) { if( !entry ) return 44; @@ -155,7 +155,7 @@ static I32 editor_toolbar_root_width( const EDITOR_CONTEXTMENU_ITEM* entry ) { return max( 44, text_w + 16 ); } -static void editor_toolbar_root_rect( GUI_EDITOR_TOOLBAR* bar, I32 idx, I32* rx, I32* ry, I32* rw, I32* rh ) { +void editor_toolbar_root_rect( GUI_EDITOR_TOOLBAR* bar, I32 idx, I32* rx, I32* ry, I32* rw, I32* rh ) { I32 x = gui_relx( bar ); I32 y = gui_rely( bar ); I32 cx = x + 8; @@ -172,11 +172,11 @@ struct EDITOR_TOOLBAR_HIT { I32 root{-1}; }; -static U8 editor_toolbar_pt_in_rect( I32 mx, I32 my, I32 x, I32 y, I32 w, I32 h ) { +U8 editor_toolbar_pt_in_rect( I32 mx, I32 my, I32 x, I32 y, I32 w, I32 h ) { return mx >= x && mx < x + w && my >= y && my < y + h; } -static EDITOR_TOOLBAR_HIT editor_toolbar_hit_test( GUI_EDITOR_TOOLBAR* bar, I32 mx, I32 my ) { +EDITOR_TOOLBAR_HIT editor_toolbar_hit_test( GUI_EDITOR_TOOLBAR* bar, I32 mx, I32 my ) { EDITOR_TOOLBAR_HIT hit{}; for( I32 i = 0; i < (I32)bar->entries.size; ++i ) { I32 x = 0, y = 0, w = 0, h = 0; @@ -190,7 +190,7 @@ static EDITOR_TOOLBAR_HIT editor_toolbar_hit_test( GUI_EDITOR_TOOLBAR* bar, I32 return hit; } -static void gui_editor_toolbar_draw_fn( void* ptr ) { +void gui_editor_toolbar_draw_fn( void* ptr ) { GUI_EDITOR_TOOLBAR* bar = (GUI_EDITOR_TOOLBAR*)ptr; I32 x = gui_relx( bar ); I32 y = gui_rely( bar ); @@ -229,7 +229,7 @@ static void gui_editor_toolbar_draw_fn( void* ptr ) { } } -static void gui_editor_toolbar_input_fn( void* ptr ) { +void gui_editor_toolbar_input_fn( void* ptr ) { GUI_EDITOR_TOOLBAR* bar = (GUI_EDITOR_TOOLBAR*)ptr; I32 mx = 0, my = 0; gui_cursor_pos( &mx, &my ); |
