MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / updateOpenRecentMenu

Method updateOpenRecentMenu

src/csvmenu.cpp:164–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162
163
164void CsvMenu::updateOpenRecentMenu(std::vector<std::string> files) {
165 std::string menuItemStr = "&File/" TCRUNCHER_MENUTEXT_OPEN_RECENT;
166 int menuIndex = find_index("&File/" TCRUNCHER_MENUTEXT_OPEN_RECENT);
167 if( menuIndex != -1 ) {
168 clear_submenu(menuIndex);
169 if( files.size() > 0 ) {
170 std::string item_tpl = "&File/" TCRUNCHER_MENUTEXT_OPEN_RECENT "/&";
171 int i = 0;
172 for( auto filepath : files ) {
173 std::string filename_only = std::filesystem::path(filepath).filename().u8string();
174 std::string item = item_tpl + filename_only; // + " (" + std::to_string(i+1) + ")";
175 add(item.c_str(), FL_COMMAND + ('1' + i), MyMenuCallback, (void *) &(INTEGERS[i]), 0);
176 ++i;
177 }
178 } else {
179 // no entries available
180 add("&File/" TCRUNCHER_MENUTEXT_OPEN_RECENT "/&(empty)", 0, 0, 0, FL_MENU_INACTIVE);
181 }
182 }
183}
184
185
186

Callers 2

CsvApplicationMethod · 0.80
updateMenuMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected