Inserts a logical operator node as parent of current node
| 13542 | |
| 13543 | // Inserts a logical operator node as parent of current node |
| 13544 | void CDallasMainDlg::InsertLogicalOperatorNode(int type) { |
| 13545 | HTREEITEM selected_node, new_logop_node; |
| 13546 | tTreeNodeData *data; |
| 13547 | |
| 13548 | // Check the ID validity |
| 13549 | if (type < 0 || type >= MAX_LOGICAL_OPERATORS) |
| 13550 | return; |
| 13551 | |
| 13552 | // Obtain the currently selected node |
| 13553 | selected_node = m_ScriptTree.GetSelectedItem(); |
| 13554 | if (selected_node == NULL) |
| 13555 | return; |
| 13556 | |
| 13557 | // Get the node's data |
| 13558 | data = (tTreeNodeData *)m_ScriptTree.GetItemData(selected_node); |
| 13559 | if (data == NULL) |
| 13560 | return; |
| 13561 | |
| 13562 | // Make sure this node is valid for inserting a logical operator |
| 13563 | if (data->type == LOGICAL_OPERATOR_NODE || data->type == CONDITIONAL_STATEMENT_NODE) { |
| 13564 | tTreeNodeData node_data; |
| 13565 | |
| 13566 | // Fill in the data appropriately for the new condition node |
| 13567 | node_data.type = LOGICAL_OPERATOR_NODE; |
| 13568 | node_data.ID = type; |
| 13569 | |
| 13570 | // Add node appropriately with respect to selected node |
| 13571 | new_logop_node = AddNodeToTree(m_ScriptTree.GetParentItem(selected_node), selected_node, &node_data, TRUE); |
| 13572 | |
| 13573 | // Now copy the selected item tree over to the new logop |
| 13574 | CopyTree(new_logop_node, TVI_LAST, selected_node); |
| 13575 | m_ScriptTree.Expand(new_logop_node, TVE_EXPAND); |
| 13576 | |
| 13577 | // Add a default ALWAYS so that the logical operator has TWO children |
| 13578 | CreateDefaultConditionalStatementNode(new_logop_node); |
| 13579 | |
| 13580 | // Now delete the selected item tree |
| 13581 | m_ScriptTree.SelectItem(new_logop_node); |
| 13582 | FreeTreeItem(selected_node); |
| 13583 | |
| 13584 | SetModified(TRUE); |
| 13585 | } |
| 13586 | } |
| 13587 | |
| 13588 | // Adds a logical operator subtree to the end of selected node's children |
| 13589 | void CDallasMainDlg::AddLogicalOperatorNode(int type) { |
nothing calls this directly
no test coverage detected