Should only be used in selection allowing tools
| 464 | |
| 465 | // Should only be used in selection allowing tools |
| 466 | void DrawingProgram::selection_action_menu(Vector2f popupPos) { |
| 467 | using namespace GUIStuff; |
| 468 | using namespace ElementHelpers; |
| 469 | |
| 470 | GUIStuff::GUIManager& gui = world.main.g.gui; |
| 471 | |
| 472 | right_click_action_menu(popupPos, [&] { |
| 473 | text_label_light(gui, "Selection menu"); |
| 474 | popup_menu_action_button("Paste", "Paste", [&, popupPos] { |
| 475 | selection.deselect_all(); |
| 476 | selection.paste_clipboard(popupPos * world.main.g.final_gui_scale()); |
| 477 | }); |
| 478 | popup_menu_action_button("Paste Image", "Paste Image", [&, popupPos] { |
| 479 | selection.deselect_all(); |
| 480 | world.main.input.call_paste(CustomEvents::PasteEvent::DataType::IMAGE, { |
| 481 | .pastePosition = popupPos * world.main.g.final_gui_scale() |
| 482 | }); |
| 483 | }); |
| 484 | if(selection.is_something_selected()) { |
| 485 | popup_menu_action_button("Copy", "Copy", [&] { |
| 486 | selection.selection_to_clipboard(); |
| 487 | }); |
| 488 | popup_menu_action_button("Cut", "Cut", [&] { |
| 489 | selection.selection_to_clipboard(); |
| 490 | selection.delete_all(); |
| 491 | }); |
| 492 | popup_menu_action_button("Delete", "Delete", [&] { |
| 493 | selection.delete_all(); |
| 494 | }); |
| 495 | popup_menu_action_button("Bring to front of layer", "Bring to front of layer", [&] { |
| 496 | selection.push_selection_to_front(); |
| 497 | }); |
| 498 | popup_menu_action_button("Send to back of layer", "Send to back of layer", [&] { |
| 499 | selection.push_selection_to_back(); |
| 500 | }); |
| 501 | } |
| 502 | }); |
| 503 | } |
| 504 | |
| 505 | void DrawingProgram::right_click_action_menu(Vector2f popupPos, const std::function<void()>& innerContent) { |
| 506 | using namespace GUIStuff; |
no test coverage detected