diff options
Diffstat (limited to 'src/editor/editor_menubar.cpp')
| -rw-r--r-- | src/editor/editor_menubar.cpp | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/src/editor/editor_menubar.cpp b/src/editor/editor_menubar.cpp index b89d1c6..cef2650 100644 --- a/src/editor/editor_menubar.cpp +++ b/src/editor/editor_menubar.cpp @@ -66,56 +66,38 @@ void editor_raise_header_toolbar( GAME_EDITOR* e ) { parent->children.push( bar ); } -static void editor_contextmenu_set_item( - EDITOR_CONTEXTMENU_ITEM* item, - const char* text, - EDITOR_CONTEXTMENU_CALLBACK cb = 0, - void* data = 0, - EDITOR_CONTEXTMENU_ENABLED_CALLBACK enabled_cb = 0 -) { - if( !item ) - return; - - item->items.clear(); - snprintf( item->text, sizeof( item->text ), "%s", text ? text : "" ); - item->cb = cb; - item->data = data; - item->enabled = 1; - 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( 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( 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 +128,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 +137,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 +154,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 +172,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 +211,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 ); |
