MCPcopy Create free account
hub / github.com/DFHack/dfhack / feed

Method feed

plugins/manipulator.cpp:886–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

884 }
885 }
886 void feed(set<df::interface_key> *events)
887 {
888 if (cur_page == MENU)
889 {
890 if (events->count(interface_key::LEAVESCREEN))
891 {
892 Screen::dismiss(this);
893 return;
894 }
895 if (selection_empty)
896 return;
897 if (menu_options.feed(events))
898 {
899 // Allow left mouse button to trigger menu options
900 if (menu_options.feed_mouse_set_highlight)
901 events->insert(interface_key::SELECT);
902 else
903 return;
904 }
905 if (events->count(interface_key::SELECT))
906 select_page(menu_options.getFirstSelectedElem());
907 }
908 else if (cur_page == NICKNAME || cur_page == PROFNAME)
909 {
910 if (events->count(interface_key::LEAVESCREEN))
911 select_page(MENU);
912 else if (events->count(interface_key::SELECT))
913 {
914 apply((cur_page == NICKNAME) ? unit_ops::set_nickname : unit_ops::set_profname, entry, &formatter);
915 select_page(MENU);
916 }
917 else
918 {
919 for (auto it = events->begin(); it != events->end(); ++it)
920 {
921 int ch = Screen::keyToChar(*it);
922 if (ch == 0 && entry.size())
923 entry.resize(entry.size() - 1);
924 else if (ch > 0)
925 entry.push_back(char(ch));
926 }
927 }
928 }
929 }
930 void render()
931 {
932 dfhack_viewscreen::render();

Callers

nothing calls this directly

Calls 8

getFirstSelectedElemMethod · 0.80
countMethod · 0.45
feedMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected