mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-02-03 13:24:46 +01:00
More DPI fixes
This commit is contained in:
parent
8a603c5420
commit
763807565c
@ -30,15 +30,22 @@ namespace module_manager_menu {
|
|||||||
|
|
||||||
void draw(void* ctx) {
|
void draw(void* ctx) {
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
|
// Calculate delete button size and cell size
|
||||||
|
ImVec2 cellpad = ImGui::GetStyle().CellPadding;
|
||||||
|
float lheight = ImGui::GetTextLineHeight();
|
||||||
|
float cellWidth = lheight - (2.0f * cellpad.y);
|
||||||
|
float hdiff = cellpad.x - cellpad.y;
|
||||||
|
ImVec2 btnSize = ImVec2(lheight + 1, lheight - 1);
|
||||||
|
ImVec2 textOff = ImVec2(3.0f * style::uiScale, -5.0f * style::uiScale);
|
||||||
|
|
||||||
if (ImGui::BeginTable("Module Manager Table", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200))) {
|
if (ImGui::BeginTable("Module Manager Table", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY, ImVec2(0, 200))) {
|
||||||
ImGui::TableSetupColumn("Name");
|
ImGui::TableSetupColumn("Name");
|
||||||
ImGui::TableSetupColumn("Type");
|
ImGui::TableSetupColumn("Type");
|
||||||
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 10);
|
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, cellWidth);
|
||||||
ImGui::TableSetupScrollFreeze(3, 1);
|
ImGui::TableSetupScrollFreeze(3, 1);
|
||||||
ImGui::TableHeadersRow();
|
ImGui::TableHeadersRow();
|
||||||
|
|
||||||
float height = ImGui::CalcTextSize("-").y;
|
|
||||||
|
|
||||||
for (auto& [name, inst] : core::moduleManager.instances) {
|
for (auto& [name, inst] : core::moduleManager.instances) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
@ -49,13 +56,13 @@ namespace module_manager_menu {
|
|||||||
ImGui::TextUnformatted(inst.module.info->name);
|
ImGui::TextUnformatted(inst.module.info->name);
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(2);
|
ImGui::TableSetColumnIndex(2);
|
||||||
ImVec2 origPos = ImGui::GetCursorPos();
|
ImVec2 cpos = ImGui::GetCursorPos();
|
||||||
ImGui::SetCursorPos(ImVec2(origPos.x - 3, origPos.y));
|
ImGui::SetCursorPos(ImVec2(cpos.x - hdiff, cpos.y + 1));
|
||||||
if (ImGui::Button(("##module_mgr_" + name).c_str(), ImVec2(height, height))) {
|
if (ImGui::Button(("##module_mgr_" + name).c_str(), btnSize)) {
|
||||||
toBeRemoved = name;
|
toBeRemoved = name;
|
||||||
confirmOpened = true;
|
confirmOpened = true;
|
||||||
}
|
}
|
||||||
ImGui::SetCursorPos(ImVec2(origPos.x + 2, origPos.y - 5));
|
ImGui::SetCursorPos(ImVec2(cpos.x + textOff.x, cpos.y + textOff.y));
|
||||||
ImGui::TextUnformatted("_");
|
ImGui::TextUnformatted("_");
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
@ -73,23 +80,26 @@ namespace module_manager_menu {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add module row with slightly different settings
|
// Add module row with slightly different settings
|
||||||
ImGui::BeginTable("Module Manager Add Table", 3);
|
if (ImGui::BeginTable("Module Manager Add Table", 3)) {
|
||||||
ImGui::TableSetupColumn("Name");
|
ImGui::TableSetupColumn("Name");
|
||||||
ImGui::TableSetupColumn("Type");
|
ImGui::TableSetupColumn("Type");
|
||||||
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 16);
|
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, cellWidth);
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x + cellpad.x);
|
||||||
ImGui::InputText("##module_mod_name", modName, 1000);
|
ImGui::InputText("##module_mod_name", modName, 1000);
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(1);
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x + cellpad.x);
|
||||||
ImGui::Combo("##module_mgr_type", &modTypeId, modTypesTxt.c_str());
|
ImGui::Combo("##module_mgr_type", &modTypeId, modTypesTxt.c_str());
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(2);
|
ImGui::TableSetColumnIndex(2);
|
||||||
if (strlen(modName) == 0) { style::beginDisabled(); }
|
if (strlen(modName) == 0) { style::beginDisabled(); }
|
||||||
if (ImGui::Button("+##module_mgr_add_btn", ImVec2(16, 0))) {
|
ImVec2 cpos = ImGui::GetCursorPos();
|
||||||
|
ImGui::SetCursorPos(ImVec2(cpos.x - hdiff, cpos.y));
|
||||||
|
if (ImGui::Button("+##module_mgr_add_btn", ImVec2(btnSize.x, 0))) {
|
||||||
if (!core::moduleManager.createInstance(modName, modTypes[modTypeId])) {
|
if (!core::moduleManager.createInstance(modName, modTypes[modTypeId])) {
|
||||||
core::moduleManager.postInit(modName);
|
core::moduleManager.postInit(modName);
|
||||||
modified = true;
|
modified = true;
|
||||||
@ -101,6 +111,7 @@ namespace module_manager_menu {
|
|||||||
}
|
}
|
||||||
if (strlen(modName) == 0) { style::endDisabled(); }
|
if (strlen(modName) == 0) { style::endDisabled(); }
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
if (modified) {
|
if (modified) {
|
||||||
// Update enabled and disabled modules
|
// Update enabled and disabled modules
|
||||||
|
Loading…
x
Reference in New Issue
Block a user