| 928 | } |
| 929 | } |
| 930 | void render() |
| 931 | { |
| 932 | dfhack_viewscreen::render(); |
| 933 | Screen::clear(); |
| 934 | int x = 2, y = 2; |
| 935 | if (cur_page == MENU) |
| 936 | { |
| 937 | Screen::drawBorder(" Dwarf Manipulator - Batch Operations "); |
| 938 | if (selection_empty) |
| 939 | { |
| 940 | OutputString(COLOR_LIGHTRED, x, y, "No dwarves selected!"); |
| 941 | return; |
| 942 | } |
| 943 | menu_options.display(true); |
| 944 | } |
| 945 | OutputString(COLOR_LIGHTGREEN, x, y, itos(units.size())); |
| 946 | OutputString(COLOR_GREY, x, y, string(" ") + (units.size() > 1 ? "dwarves" : "dwarf") + " selected: "); |
| 947 | size_t max_x = gps->dimx - 2; |
| 948 | size_t i = 0; |
| 949 | for ( ; i < units.size(); i++) |
| 950 | { |
| 951 | string name = unit_ops::get_nickname(units[i]); |
| 952 | if (name.size() + x + 12 >= max_x) // 12 = "and xxx more" |
| 953 | break; |
| 954 | OutputString(COLOR_WHITE, x, y, name + ", "); |
| 955 | } |
| 956 | if (i == units.size()) |
| 957 | { |
| 958 | x -= 2; |
| 959 | OutputString(COLOR_WHITE, x, y, " "); |
| 960 | } |
| 961 | else |
| 962 | { |
| 963 | OutputString(COLOR_GREY, x, y, "and " + itos(units.size() - i) + " more"); |
| 964 | } |
| 965 | x = 2; y += 2; |
| 966 | if (cur_page == NICKNAME || cur_page == PROFNAME) |
| 967 | { |
| 968 | std::string name_type = (cur_page == page::NICKNAME) ? "Nickname" : "Profession name"; |
| 969 | OutputString(COLOR_GREY, x, y, "Custom " + name_type + ":"); |
| 970 | x = 2; y += 1; |
| 971 | OutputString(COLOR_WHITE, x, y, entry); |
| 972 | OutputString(COLOR_LIGHTGREEN, x, y, "_"); |
| 973 | x = 2; y += 2; |
| 974 | OutputString(COLOR_DARKGREY, x, y, "(Leave blank to use original name)"); |
| 975 | x = 2; y += 2; |
| 976 | OutputString(COLOR_WHITE, x, y, "Format options:"); |
| 977 | StringFormatter<UnitInfo*>::T_optlist *format_options = formatter.get_options(); |
| 978 | for (auto it = format_options->begin(); it != format_options->end(); ++it) |
| 979 | { |
| 980 | x = 2; y++; |
| 981 | auto opt = *it; |
| 982 | OutputString(COLOR_LIGHTCYAN, x, y, "%" + string(std::get<0>(opt))); |
| 983 | OutputString(COLOR_WHITE, x, y, ": " + string(std::get<1>(opt))); |
| 984 | } |
| 985 | } |
| 986 | } |
| 987 | protected: |
nothing calls this directly
no test coverage detected