MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / selection_action_menu

Method selection_action_menu

src/DrawingProgram/DrawingProgram.cpp:466–503  ·  view source on GitHub ↗

Should only be used in selection allowing tools

Source from the content-addressed store, hash-verified

464
465// Should only be used in selection allowing tools
466void 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
505void DrawingProgram::right_click_action_menu(Vector2f popupPos, const std::function<void()>& innerContent) {
506 using namespace GUIStuff;

Callers 5

right_click_popup_guiMethod · 0.80
right_click_popup_guiMethod · 0.80
right_click_popup_guiMethod · 0.80
right_click_popup_guiMethod · 0.80
right_click_popup_guiMethod · 0.80

Calls 10

text_label_lightFunction · 0.85
paste_clipboardMethod · 0.80
final_gui_scaleMethod · 0.80
call_pasteMethod · 0.80
is_something_selectedMethod · 0.80
delete_allMethod · 0.80
deselect_allMethod · 0.45

Tested by

no test coverage detected