| 133 | } |
| 134 | |
| 135 | void StateMachineView::showMenuAndAddItem(bool fromAddButton, Point<int> position) |
| 136 | { |
| 137 | PopupMenu p; |
| 138 | p.addItem(1, "Add State"); |
| 139 | p.addItem(2, "Add Comment"); |
| 140 | p.addItem(3, "Create Transition", manager->items.size() >= 2); |
| 141 | p.addItem(4, "Snapping",true, enableSnapping); |
| 142 | p.addItem(5, showTools ? "Hide Tools" : "Show Tools"); |
| 143 | |
| 144 | p.showMenuAsync(PopupMenu::Options(), [this, fromAddButton, position](int result) |
| 145 | { |
| 146 | if (result == 1) BaseManagerViewUI::addItemFromMenu(fromAddButton, position); |
| 147 | else if (result == 2) commentManagerUI->addItemFromMenu(fromAddButton, position); |
| 148 | else if (result == 3) startCreateTransition(nullptr); |
| 149 | else if (result == 4) enableSnapping = !enableSnapping; |
| 150 | else if (result == 5) setShowTools(!showTools); |
| 151 | } |
| 152 | ); |
| 153 | } |
| 154 | |
| 155 | |
| 156 | void StateMachineView::startCreateTransition(StateViewUI * sourceUI) |
nothing calls this directly
no test coverage detected