static void ModMenuItem( a_window *wnd, unsigned id, int row, int piece ) { address addr; mod_handle handle; mod_window *mod = WndMod( wnd ); piece=piece; handle = NO_MOD; addr = NilAddr; if( ModListNumRows( ModList( mod ) ) != 0 && row >= 0 ) { handle = ModListMod( ModList( mod ), row ); if( handle != NO_MOD ) { addr = ModFirstAddr( handle ); } } switch( id ) { case MENU_INITIALIZE: WndMenuGrayAll( wnd ); if( handle != NO_MOD ) { WndMenuEnable( wnd, MENU_MODULES_BREAK_SET_ALL, TRUE ); WndMenuEnable( wnd, MENU_MODULES_BREAK_CLEAR_ALL, TRUE ); WndMenuEnable( wnd, MENU_MODULES_ASSEMBLY, !IS_NIL_ADDR( addr ) ); WndMenuEnable( wnd, MENU_MODULES_FUNCTIONS, TRUE ); if( ModHasSourceInfo( handle ) ) { WndMenuEnable( wnd, MENU_MODULES_SOURCE, TRUE ); } } WndMenuEnable( wnd, MENU_MODULES_SHOW_ALL, TRUE ); WndMenuCheck( wnd, MENU_MODULES_SHOW_ALL, mod->all_modules ); break; case MENU_MODULES_BREAK_SET_ALL: BreakAllModEntries( handle ); break; case MENU_MODULES_BREAK_CLEAR_ALL: ClearAllModBreaks( handle ); break; case MENU_MODULES_SOURCE: if( IS_NIL_ADDR( addr ) ) { ModName( handle, TxtBuff, TXT_LEN ); WndFileInspect( TxtBuff, FALSE ); } else { WndSrcInspect( addr ); } break; case MENU_MODULES_ASSEMBLY: WndAsmInspect( addr ); break; case MENU_MODULES_FUNCTIONS: WndFuncInspect( handle ); break; case MENU_MODULES_SHOW_ALL: mod->all_modules = !mod->all_modules; ModInit( wnd ); break; } }
extern a_window *WndModInspect( mod_handle mod ) { a_window *wnd; DIPHDL( cue, ch ); wnd = WndFindExisting( WND_SOURCE ); if( wnd == NULL && LineCue( mod, 0, 0, 0, ch ) != SR_NONE ) { wnd = DoWndSrcOpen( ch, true ); } if( wnd != NULL ) { SrcMoveDot( wnd, ModFirstAddr( mod ) ); } return( wnd ); }