diff options
Diffstat (limited to 'src/editor/editor_window.cpp')
| -rw-r--r-- | src/editor/editor_window.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/editor/editor_window.cpp b/src/editor/editor_window.cpp index bd70418..f81b1a8 100644 --- a/src/editor/editor_window.cpp +++ b/src/editor/editor_window.cpp @@ -6,9 +6,8 @@ void gui_editorwindow_draw_fn( void* ptr ) { GUI_EDITORWINDOW* wnd = (GUI_EDITORWINDOW*)ptr; editor_raise_header_toolbar( editor ); - GUI_BASE* toolbar = ( editor && editor->map ) ? editor->gui.header_toolbar : 0; - GUI_EDITOR_TOOLBAR* tbar = (GUI_EDITOR_TOOLBAR*)toolbar; - U8 menu_open = editor_toolbar_menu_open( tbar ); + GUI_BASE* contextmenu = ( editor && editor->map ) ? (GUI_BASE*)editor->gui.contextmenu : 0; + U8 menu_open = editor_contextmenu_open(); F32 saved_mx = input.mouse.pos.x; F32 saved_my = input.mouse.pos.y; @@ -28,11 +27,16 @@ void gui_editorwindow_draw_fn( void* ptr ) { wnd->children.each( fn( GUI_BASE** ptr ) { GUI_BASE* it = *ptr; + if( it == contextmenu ) + return; if( !it->enabled ) return; if( it->draw_fn ) it->draw_fn( it ); else dlog( "gui_editorwindow_draw_fn(): child %p has no draw_fn", it ); } ); + if( contextmenu && contextmenu->enabled && contextmenu->draw_fn ) + contextmenu->draw_fn( contextmenu ); + input.mouse.pos.x = saved_mx; input.mouse.pos.y = saved_my; editor_menu_hover_mask_active = 0; @@ -43,16 +47,20 @@ static void gui_editorwindow_input_fn( void* ptr ) { editor_raise_header_toolbar( editor ); GUI_BASE* toolbar = ( editor && editor->map ) ? editor->gui.header_toolbar : 0; + GUI_BASE* contextmenu = ( editor && editor->map ) ? (GUI_BASE*)editor->gui.contextmenu : 0; + U8 menu_was_open = editor_contextmenu_open(); if( toolbar && toolbar->enabled && toolbar->input_fn ) toolbar->input_fn( toolbar ); - GUI_EDITOR_TOOLBAR* tbar = (GUI_EDITOR_TOOLBAR*)toolbar; - if( editor_toolbar_menu_open( tbar ) ) + if( menu_was_open && editor && editor->gui.contextmenu && editor->gui.contextmenu->input_fn ) + editor->gui.contextmenu->input_fn( editor->gui.contextmenu ); + + if( menu_was_open || editor_contextmenu_open() ) return; wnd->children.each( fn( GUI_BASE** childptr ) { GUI_BASE* child = *childptr; - if( !child || child == toolbar || !child->enabled || !child->input_fn ) + if( !child || child == toolbar || child == contextmenu || !child->enabled || !child->input_fn ) return; child->input_fn( child ); } ); @@ -125,8 +133,7 @@ const char* editor_tool_name() { case EDITOR_TOOL_SELECT: return "select"; case EDITOR_TOOL_WALL: return "wall"; case EDITOR_TOOL_POLY: return "poly"; - case EDITOR_TOOL_SPRITE: return "sprite"; - case EDITOR_TOOL_ENT: return "ent"; + case EDITOR_TOOL_OBJECT: return "object"; default: return "none"; } } @@ -136,8 +143,7 @@ static U8 EDITOR_TOOL_BUTTON_TYPES[] = { EDITOR_TOOL_SELECT, EDITOR_TOOL_WALL, EDITOR_TOOL_POLY, - EDITOR_TOOL_SPRITE, - EDITOR_TOOL_ENT + EDITOR_TOOL_OBJECT }; static void settool_btn_cb( void* ptr ) { @@ -154,7 +160,7 @@ void editor_create_toolview_column( GAME_EDITOR* e ) { I32 x = 320; I32 y = EDITOR_LAYOUT_CONTENT_Y + EDITOR_LAYOUT_VIEW_DEFAULT_H + EDITOR_LAYOUT_VIEW_TOOL_GAP + EDITOR_LAYOUT_TOOL_BTN_TOP_GAP; I32 off = 23; - const char* labels[] = { "none", "select", "wall", "poly", "sprite", "ent" }; + const char* labels[] = { "none", "select", "wall", "poly", "object" }; for( U32 i = 0; i < sizeof( labels ) / sizeof( labels[0] ); ++i ) { GUI_BUTTON* btn = gui_button( x, y, 45, 20, labels[i], settool_btn_cb ); |
