MCPcopy Create free account
hub / github.com/Kitware/CMake / InitializeUI

Method InitializeUI

Source/CursesDialog/cmCursesMainForm.cxx:72–145  ·  view source on GitHub ↗

Create new cmCursesCacheEntryComposite entries from the cache

Source from the content-addressed store, hash-verified

70
71// Create new cmCursesCacheEntryComposite entries from the cache
72void cmCursesMainForm::InitializeUI()
73{
74 // Hide the cursor by default
75 curs_set(0);
76
77 // Create a vector of cmCursesCacheEntryComposite's
78 // which contain labels, entries and new entry markers
79 std::vector<cmCursesCacheEntryComposite> newEntries;
80 std::vector<std::string> cacheKeys =
81 this->CMakeInstance->GetState()->GetCacheEntryKeys();
82 newEntries.reserve(cacheKeys.size());
83
84 // Count non-internal and non-static entries
85 int count = 0;
86
87 for (std::string const& key : cacheKeys) {
88 cmStateEnums::CacheEntryType t =
89 this->CMakeInstance->GetState()->GetCacheEntryType(key);
90 if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC &&
91 t != cmStateEnums::UNINITIALIZED) {
92 ++count;
93 }
94 }
95
96 int entrywidth = this->InitialWidth - 35;
97
98 // Add a label to display when cache is empty
99 // dummy entry widget (does not respond to input)
100 this->EmptyCacheEntry =
101 cm::make_unique<cmCursesCacheEntryComposite>("EMPTY CACHE", 30, 30);
102 this->EmptyCacheEntry->Entry =
103 cm::make_unique<cmCursesDummyWidget>(1, 1, 1, 1);
104
105 if (count > 0) {
106 // Create the composites.
107
108 // First add entries which are new
109 for (std::string const& key : cacheKeys) {
110 cmStateEnums::CacheEntryType t =
111 this->CMakeInstance->GetState()->GetCacheEntryType(key);
112 if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
113 t == cmStateEnums::UNINITIALIZED) {
114 continue;
115 }
116
117 if (!this->LookForCacheEntry(key)) {
118 newEntries.emplace_back(key, this->CMakeInstance->GetState(), true, 30,
119 entrywidth);
120 this->OkToGenerate = false;
121 }
122 }
123
124 // then add entries which are old
125 for (std::string const& key : cacheKeys) {
126 cmStateEnums::CacheEntryType t =
127 this->CMakeInstance->GetState()->GetCacheEntryType(key);
128 if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC ||
129 t == cmStateEnums::UNINITIALIZED) {

Callers 3

ConfigureMethod · 0.95
GenerateMethod · 0.95
mainFunction · 0.80

Calls 10

LookForCacheEntryMethod · 0.95
RePostMethod · 0.95
curs_setFunction · 0.85
moveFunction · 0.85
reserveMethod · 0.80
emplace_backMethod · 0.80
GetCacheEntryKeysMethod · 0.45
GetStateMethod · 0.45
sizeMethod · 0.45
GetCacheEntryTypeMethod · 0.45

Tested by

no test coverage detected