perf stuff
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <ctime>
|
||||
|
||||
#define MAX_FONT_PATH_LENGTH 2048
|
||||
#define SETTINGS_POPUP_NAME "settings_popup"
|
||||
|
||||
// Globals for use in callbacks
|
||||
DrawData* gDrawData;
|
||||
@@ -175,8 +176,6 @@ ImVec2 menuBar(DrawData& drawData, ApplicationData& appData)
|
||||
updateDocked(drawData, appData);
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Show Disabled Devices", &appData.settings.showDisabledDevices);
|
||||
|
||||
if (ImGui::Checkbox("Autostart", &appData.settings.autostart))
|
||||
{
|
||||
setAutostart(appData.settings.autostart);
|
||||
@@ -191,6 +190,10 @@ ImVec2 menuBar(DrawData& drawData, ApplicationData& appData)
|
||||
{
|
||||
reloadDeviceLists(*appData.audioData);
|
||||
}
|
||||
ImGui::Text("setup: %.1f ms", drawData.frameTimeSetup);
|
||||
ImGui::Text("draw: %.1f ms", drawData.frameTimeDraw);
|
||||
ImGui::Text("render: %.1f ms", drawData.frameTimeRender);
|
||||
ImGui::Text("display: %.1f ms", drawData.frameTimeDisplay);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@@ -242,6 +245,22 @@ bool customButton(const char* id_start, const char* id_end, const char* title, b
|
||||
return result;
|
||||
}
|
||||
|
||||
bool windowHeaderButton(const char* id)
|
||||
{
|
||||
ImRect tempRect = ImGui::GetCurrentWindow()->ClipRect;
|
||||
ImVec2 tempPos = ImGui::GetCursorPos();
|
||||
ImVec2 windowMax = ImGui::GetWindowContentRegionMax();
|
||||
ImGui::PopClipRect();
|
||||
|
||||
ImGui::SetCursorPos({ windowMax.x - 20.f, tempPos.y - 28.f });
|
||||
bool result = ImGui::SmallButton(id);
|
||||
|
||||
ImGui::PushClipRect(tempRect.Min, tempRect.Max, false);
|
||||
ImGui::SetCursorPos(tempPos);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void drawChecklistDayLines(ApplicationData& appData, ImDrawList* drawList, float lineHeight, time_t day)
|
||||
{
|
||||
auto& tasks = appData.settings.tasks;
|
||||
@@ -291,6 +310,11 @@ ImVec2 checklistWindow(ApplicationData& appData, const char* title)
|
||||
{
|
||||
if (ImGui::Begin(title, 0, ImGuiWindowFlags_NoResize))
|
||||
{
|
||||
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
||||
{
|
||||
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
||||
}
|
||||
|
||||
time_t today = getDayStartOf(std::time(nullptr));
|
||||
ImDrawList* drawList = ImGui::GetWindowDrawList();
|
||||
float lineHeight = ImGui::GetFontSize() + ImGui::GetStyle().FramePadding.y * 2;
|
||||
@@ -355,13 +379,11 @@ ImVec2 checklistWindow(ApplicationData& appData, const char* title)
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
if (ImGui::SmallButton(ICON_SETTINGS_FILL))
|
||||
{
|
||||
ImGui::OpenPopup("checklist settings");
|
||||
}
|
||||
if (ImGui::BeginPopup("checklist settings"))
|
||||
if (ImGui::BeginPopup(SETTINGS_POPUP_NAME))
|
||||
{
|
||||
ImGui::PushItemWidth(75.f);
|
||||
ImGui::DragInt("Task highlight duration", &appData.checklistHighlightDurationDays, .05f, 1, 7, "%d days");
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
@@ -375,6 +397,11 @@ ImVec2 audioDeviceWindow(ApplicationData& appData, std::vector<AudioDevice>& dev
|
||||
{
|
||||
if (ImGui::Begin(title, 0, ImGuiWindowFlags_NoResize))
|
||||
{
|
||||
if (windowHeaderButton(ICON_SETTINGS_FILL))
|
||||
{
|
||||
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("DeviceTable", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_Borders | ImGuiTableFlags_NoSavedSettings))
|
||||
{
|
||||
ImGui::TableSetupColumn("Devices", ImGuiTableColumnFlags_WidthStretch, 3.);
|
||||
@@ -497,6 +524,12 @@ ImVec2 audioDeviceWindow(ApplicationData& appData, std::vector<AudioDevice>& dev
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::BeginPopup(SETTINGS_POPUP_NAME))
|
||||
{
|
||||
ImGui::Checkbox("Show Disabled Devices", &appData.settings.showDisabledDevices);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImVec2 size = ImGui::GetWindowSize();
|
||||
|
||||
ImGui::End();
|
||||
|
||||
Reference in New Issue
Block a user