| 1470 | extern bool StripLeadingTrailingSpaces(char *s); |
| 1471 | |
| 1472 | BOOL CTextureGrWnd::OnCommand(WPARAM wParam, LPARAM lParam) { |
| 1473 | // TODO: Add your specialized code here and/or call the base class |
| 1474 | if (HIWORD(wParam) == 0) { |
| 1475 | switch (LOWORD(wParam)) { |
| 1476 | case POPUP_EDITSCRIPT: { |
| 1477 | mprintf(0, "Edit script for object %d\n", Cur_object_index); |
| 1478 | // Nate: Add code here to edit/view an object's scripts |
| 1479 | |
| 1480 | // Make sure Dallas is open |
| 1481 | if (theApp.m_DallasModelessDlgPtr == NULL) { |
| 1482 | theApp.m_DallasModelessDlgPtr = new CDallasMainDlg; |
| 1483 | theApp.m_DallasModelessDlgPtr->Create(IDD_DALLAS_MAIN_DIALOG, this); |
| 1484 | theApp.m_DallasModelessDlgPtr->ShowWindow(SW_SHOW); |
| 1485 | } else |
| 1486 | theApp.m_DallasModelessDlgPtr->ShowWindow(SW_RESTORE); |
| 1487 | |
| 1488 | object *curobj = &Objects[Cur_object_index]; |
| 1489 | if (curobj->name == NULL) |
| 1490 | break; |
| 1491 | |
| 1492 | // Tell Dallas to add a new script with this object as the owner |
| 1493 | theApp.m_DallasModelessDlgPtr->m_ScriptOwnerType = OBJECT_TYPE; |
| 1494 | theApp.m_DallasModelessDlgPtr->m_ScriptOwnerHandle = curobj->handle; |
| 1495 | theApp.m_DallasModelessDlgPtr->PostMessage(WM_HIGHLIGHT_SCRIPTS); |
| 1496 | } break; |
| 1497 | |
| 1498 | case POPUP_NEWSCRIPT: { |
| 1499 | mprintf(0, "Add new script for object %d\n", Cur_object_index); |
| 1500 | // Nate: Add code here to create a new script for an object |
| 1501 | |
| 1502 | // Make sure Dallas is open |
| 1503 | if (theApp.m_DallasModelessDlgPtr == NULL) { |
| 1504 | theApp.m_DallasModelessDlgPtr = new CDallasMainDlg; |
| 1505 | theApp.m_DallasModelessDlgPtr->Create(IDD_DALLAS_MAIN_DIALOG, this); |
| 1506 | theApp.m_DallasModelessDlgPtr->ShowWindow(SW_SHOW); |
| 1507 | } else |
| 1508 | theApp.m_DallasModelessDlgPtr->ShowWindow(SW_RESTORE); |
| 1509 | |
| 1510 | object *curobj = &Objects[Cur_object_index]; |
| 1511 | if (curobj->name == NULL) |
| 1512 | break; |
| 1513 | |
| 1514 | // Tell Dallas to highlight all scripts that have this object as the owner |
| 1515 | theApp.m_DallasModelessDlgPtr->m_ScriptOwnerType = OBJECT_TYPE; |
| 1516 | theApp.m_DallasModelessDlgPtr->m_ScriptOwnerHandle = curobj->handle; |
| 1517 | theApp.m_DallasModelessDlgPtr->PostMessage(WM_ADD_SCRIPT); |
| 1518 | } break; |
| 1519 | |
| 1520 | case POPUP_EDITNAME: { |
| 1521 | if (Objects[Cur_object_index].type == OBJ_PLAYER) { |
| 1522 | EditorMessageBox("You cannot name a player object."); |
| 1523 | break; |
| 1524 | } |
| 1525 | |
| 1526 | char tempname[OBJ_NAME_LEN + 1] = ""; |
| 1527 | object *curobj = &Objects[Cur_object_index]; |
| 1528 | if (curobj->name) { |
| 1529 | ASSERT(strlen(curobj->name) <= OBJ_NAME_LEN); |
nothing calls this directly
no test coverage detected