Fixes to the UI

This commit is contained in:
Ryzerth 2021-07-29 02:50:51 +02:00
parent e744520d50
commit 7079ddb74e
3 changed files with 15 additions and 9 deletions

View File

@ -24,9 +24,10 @@ namespace sdrpp_credits {
const char* libraries[] = {
"Dear ImGui (ocornut)",
"fftw3 (fftw.org)",
"glew (Nigel Stewart)",
"glfw (Camilla Löwy)",
"json (nlohmann)",
"RtAudio",
"SoapySDR (PothosWare)",
"spdlog (gabime)",
"Portable File Dialogs"
};

View File

@ -15,6 +15,10 @@ namespace credits {
void show() {
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 20.0f));
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0,0,0,0));
ImVec2 dispSize = ImGui::GetIO().DisplaySize;
ImVec2 center = ImVec2(dispSize.x/2.0f, dispSize.y/2.0f);
ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
ImGui::OpenPopup("Credits");
ImGui::BeginPopupModal("Credits", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove);
@ -55,11 +59,8 @@ namespace credits {
ImGui::Spacing();
ImGui::Text("SDR++ v" VERSION_STR " (Built at " __TIME__ ", " __DATE__ ")");
ImVec2 dispSize = ImGui::GetIO().DisplaySize;
ImVec2 winSize = ImGui::GetWindowSize();
ImGui::SetWindowPos(ImVec2(std::round((dispSize.x/2) - (winSize.x/2)), std::round((dispSize.y/2) - (winSize.y/2))));
ImGui::EndPopup();
ImGui::PopStyleVar(1);
ImGui::PopStyleColor();
ImGui::PopStyleVar();
}
}

View File

@ -680,7 +680,9 @@ private:
std::string hoveredBookmarkName;
if (_this->bookmarkDisplayMode == BOOKMARK_DISP_MODE_TOP) {
for (auto const bm : _this->waterfallBookmarks) {
int count = _this->waterfallBookmarks.size();
for (int i = count-1; i >= 0; i--) {
auto& bm = _this->waterfallBookmarks[i];
double centerXpos = args.fftRectMin.x + std::round((bm.bookmark.frequency - args.lowFreq) * args.freqToPixelRatio);
ImVec2 nameSize = ImGui::CalcTextSize(bm.bookmarkName.c_str());
ImVec2 rectMin = ImVec2(centerXpos-(nameSize.x/2)-5, args.fftRectMin.y);
@ -697,7 +699,9 @@ private:
}
}
else if (_this->bookmarkDisplayMode == BOOKMARK_DISP_MODE_BOTTOM) {
for (auto const bm : _this->waterfallBookmarks) {
int count = _this->waterfallBookmarks.size();
for (int i = count-1; i >= 0; i--) {
auto& bm = _this->waterfallBookmarks[i];
double centerXpos = args.fftRectMin.x + std::round((bm.bookmark.frequency - args.lowFreq) * args.freqToPixelRatio);
ImVec2 nameSize = ImGui::CalcTextSize(bm.bookmarkName.c_str());
ImVec2 rectMin = ImVec2(centerXpos-(nameSize.x/2)-5, args.fftRectMax.y-nameSize.y);