MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / HandleActivate

Method HandleActivate

neo/tools/debugger/DebuggerWindow.cpp:2342–2390  ·  view source on GitHub ↗

================ rvDebuggerWindow::HandleActivate When the main window is activated, check all the loaded scripts and see if any of them have been modified since the last time they were loaded. If they have then reload them and adjust all breakpoints that now fall on invalid lines. ================ */

Source from the content-addressed store, hash-verified

2340================
2341*/
2342int rvDebuggerWindow::HandleActivate ( WPARAM wparam, LPARAM lparam )
2343{
2344 int i;
2345
2346 // We are only interested in the activation, not deactivation
2347 if ( !LOWORD(wparam) )
2348 {
2349 return 0;
2350 }
2351
2352 // Run through all of the loaded scripts and see if any of them have been modified
2353 for ( i = 0; i < mScripts.Num(); i ++ )
2354 {
2355 if ( mScripts[i]->IsFileModified ( true ) )
2356 {
2357 if ( IDYES == MessageBox ( mWnd, va("%s\n\nThis file has been modified outside of the debugger.\nDo you want to reload it?", mScripts[i]->GetFilename() ), "Quake 4 Script Debugger", MB_YESNO|MB_ICONQUESTION ) )
2358 {
2359 mScripts[i]->Reload ( );
2360
2361 // Update the script if it was the active one
2362 if ( mActiveScript == i )
2363 {
2364 mLastActiveScript = -1;
2365 UpdateScript ( );
2366 }
2367
2368 // Loop through the breakpoints and see if any of them have
2369 // moved to invalid lines within the script. If so then just remove
2370 // them.
2371 for ( int b = mClient->GetBreakpointCount() - 1; b >= 0 ; b-- )
2372 {
2373 rvDebuggerBreakpoint* bp = mClient->GetBreakpoint(b);
2374 assert ( bp );
2375
2376 if ( !idStr::Icmp ( bp->GetFilename(), mScripts[i]->GetFilename() ) )
2377 {
2378 if ( !mScripts[i]->IsLineCode ( bp->GetLineNumber ( ) ) )
2379 {
2380 mClient->RemoveBreakpoint ( bp->GetID ( ) );
2381 }
2382 }
2383 }
2384 }
2385 }
2386 }
2387 UpdateBreakpointList();
2388
2389 return 1;
2390}
2391
2392/*
2393================

Callers 1

WndProcMethod · 0.80

Calls 11

vaFunction · 0.85
GetBreakpointCountMethod · 0.80
GetBreakpointMethod · 0.80
GetLineNumberMethod · 0.80
RemoveBreakpointMethod · 0.80
NumMethod · 0.45
IsFileModifiedMethod · 0.45
GetFilenameMethod · 0.45
ReloadMethod · 0.45
IsLineCodeMethod · 0.45
GetIDMethod · 0.45

Tested by

no test coverage detected