//////////////////////////////////////////////////////////////// TEditorClient ------------- Left mouse button (DOWN) is used for - Selection of objects - Drag mode - Stretch selection box. How this function work ? 1. If there is a valid CurObject: If SHIFT key is pressed, selected or unselect CurObject else If CurObject is not currently selected, Unselected everything and select CurObject (else
| 1347 | // stop when Left mouse button is released. |
| 1348 | // |
| 1349 | void TEditorClient::EvLButtonDown (UINT modKeys, const TPoint& point) |
| 1350 | { |
| 1351 | PointerX = point.x; |
| 1352 | PointerY = point.y; |
| 1353 | |
| 1354 | // Start space+drag panning |
| 1355 | if (GetKeyState(VK_SPACE) & 0x8000) |
| 1356 | { |
| 1357 | SpacePanning = TRUE; |
| 1358 | SpaceDragging = TRUE; |
| 1359 | PanLastX = point.x; |
| 1360 | PanLastY = point.y; |
| 1361 | SetCapture(); |
| 1362 | return; |
| 1363 | } |
| 1364 | |
| 1365 | // Ignore if "insert object" mode |
| 1366 | if ( InsertingObject ) |
| 1367 | return; |
| 1368 | |
| 1369 | // (Un)select current object if this object is valid |
| 1370 | if (CurObject >= 0) |
| 1371 | { |
| 1372 | TMapDC dc (this); |
| 1373 | if ( modKeys & MK_SHIFT ) |
| 1374 | { |
| 1375 | // mark or unmark one object of the selection |
| 1376 | if (IsSelected (Selected, CurObject) ) |
| 1377 | UnSelectObject (&Selected, CurObject); |
| 1378 | else |
| 1379 | SelectObject (&Selected, CurObject); |
| 1380 | |
| 1381 | // (Un)HightLight (un)selected object |
| 1382 | HighlightObject(dc, EditMode, CurObject, GREEN); |
| 1383 | } |
| 1384 | else |
| 1385 | { |
| 1386 | if ( !IsSelected (Selected, CurObject) ) |
| 1387 | { |
| 1388 | // Unselect all object and select the current |
| 1389 | HighlightSelection (dc, EditMode, Selected); |
| 1390 | ForgetSelection (&Selected); |
| 1391 | |
| 1392 | SelectObject (&Selected, CurObject); |
| 1393 | HighlightSelection (dc, EditMode, Selected); |
| 1394 | } |
| 1395 | } |
| 1396 | |
| 1397 | if (Selected) |
| 1398 | PlaySound (440, 10); |
| 1399 | } |
| 1400 | |
| 1401 | // Check if click on a selected object |
| 1402 | SHORT PointerObject; |
| 1403 | PointerObject = GetCurObject (EditMode, |
| 1404 | MAPX(PointerX - 4), MAPY(PointerY - 4), |
| 1405 | MAPX(PointerX + 4), MAPY(PointerY + 4)); |
| 1406 |
nothing calls this directly
no test coverage detected