================ rvDebuggerWindow::ToggleBreakpoint Toggles the breakpoint on the current script line ================ */
| 2180 | ================ |
| 2181 | */ |
| 2182 | void rvDebuggerWindow::ToggleBreakpoint ( void ) |
| 2183 | { |
| 2184 | rvDebuggerBreakpoint* bp; |
| 2185 | DWORD sel; |
| 2186 | int line; |
| 2187 | |
| 2188 | // Find the currently selected line |
| 2189 | SendMessage ( mWndScript, EM_GETSEL, (WPARAM)&sel, 0 ); |
| 2190 | line = SendMessage ( mWndScript, EM_LINEFROMCHAR, sel, 0 ) + 1; |
| 2191 | |
| 2192 | // If there is already a breakpoint there then just remove it, otherwise |
| 2193 | // we need to create a new breakpoint |
| 2194 | bp = mClient->FindBreakpoint ( mScripts[mActiveScript]->GetFilename ( ), line ); |
| 2195 | if ( !bp ) |
| 2196 | { |
| 2197 | // Make sure the line is code before letting them add a breakpoint there |
| 2198 | if ( !mScripts[mActiveScript]->IsLineCode ( line ) ) |
| 2199 | { |
| 2200 | MessageBeep ( MB_ICONEXCLAMATION ); |
| 2201 | return; |
| 2202 | } |
| 2203 | |
| 2204 | mClient->AddBreakpoint ( mScripts[mActiveScript]->GetFilename(), line ); |
| 2205 | } |
| 2206 | else |
| 2207 | { |
| 2208 | mClient->RemoveBreakpoint ( bp->GetID ( ) ); |
| 2209 | } |
| 2210 | |
| 2211 | // Force a repaint of the script window |
| 2212 | InvalidateRect ( mWndScript, NULL, FALSE ); |
| 2213 | |
| 2214 | UpdateBreakpointList(); |
| 2215 | } |
| 2216 | |
| 2217 | /* |
| 2218 | ================ |
no test coverage detected