summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-10 19:55:59 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-10 19:55:59 +0100
commit41b63da40242db1364cf0d5f7d4811d5abe014eb (patch)
treee3ccfebc80e65ab1ef1ae461d4d091f8e9258255
parent7cfc230e596a04faedc67dcfb1296fd4cd337ef7 (diff)
fix menubar color
-rw-r--r--imgui/imgui_spectrum.cpp4
-rw-r--r--src/config.h3
-rw-r--r--src/main.cpp23
3 files changed, 19 insertions, 11 deletions
diff --git a/imgui/imgui_spectrum.cpp b/imgui/imgui_spectrum.cpp
index 44d52c6..fabca64 100644
--- a/imgui/imgui_spectrum.cpp
+++ b/imgui/imgui_spectrum.cpp
@@ -103,8 +103,8 @@ namespace ImGui {
colors[ImGuiCol_Border] = ColorConvertU32ToFloat4(Color(0xCCCCCC));
colors[ImGuiCol_MenuBarBg] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
colors[ImGuiCol_Header] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
- colors[ImGuiCol_HeaderHovered] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
- colors[ImGuiCol_HeaderActive] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
+ colors[ImGuiCol_HeaderHovered] = ColorConvertU32ToFloat4(Spectrum::GRAY200);
+ colors[ImGuiCol_HeaderActive] = ColorConvertU32ToFloat4(Spectrum::GRAY200);
colors[ImGuiCol_TableBorderStrong] = ColorConvertU32ToFloat4(Color(0xE7E7E7));
colors[ImGuiCol_TableBorderLight] = ColorConvertU32ToFloat4(Color(0xE7E7E7));
colors[ImGuiCol_TableHeaderBg] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
diff --git a/src/config.h b/src/config.h
index 2d58c10..d57c7c7 100644
--- a/src/config.h
+++ b/src/config.h
@@ -8,6 +8,9 @@
#define MAX_INPUT_LENGTH 1024
#endif
+#define AUTHOR "created by Aldrik Ramaekers"
+#define CONTACT "<aldrik.ramaekers@gmail.com>"
+
#define MAX_ERROR_MESSAGE_LENGTH (MAX_INPUT_LENGTH)
#define FILE_RESERVE_COUNT 1000
diff --git a/src/main.cpp b/src/main.cpp
index fbb0484..ac515e5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -63,7 +63,7 @@ static void _ts_create_popups() {
ImGui::SetWindowSize({600, 420});
const char* name = "Text-Search";
- const char* link = "created by Aldrik Ramaekers <aldrik.ramaekers@gmail.com>";
+ const char* link = AUTHOR " " CONTACT;
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - 64) / 2.0f);
ImGui::Image((void*)(intptr_t)img_logo.id, {64, 64});
@@ -72,7 +72,9 @@ static void _ts_create_popups() {
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize(name).x)/2.0f);
ImGui::Text("%s", name);
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize(link).x)/2.0f);
- ImGui::Text("%s", link);
+ ImGui::Text("%s", AUTHOR);
+ ImGui::SameLine();
+ ImGui::TextColored({0,0,0,0.4f}, "%s", CONTACT);
ImGui::Dummy({0, 20});
if (ImGui::CollapsingHeader("License")) {
@@ -250,12 +252,6 @@ void _ts_create_text_match_rows() {
ImGui::SetCursorPosX(5);
ImGui::PushStyleColor(ImGuiCol_Text, {0,0,0,0.1f});
ImGui::TableHeader(file->file->collapsed ? "▶" : "▼");
-
- ImGui::SameLine();
- ImGui::Selectable("##nolabel", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap);
- if (ImGui::IsItemClicked(ImGuiPopupFlags_MouseButtonLeft)) {
- file->file->collapsed = !file->file->collapsed;
- }
ImGui::PopStyleColor();
ImGui::TableNextColumn();
@@ -264,6 +260,12 @@ void _ts_create_text_match_rows() {
ImGui::TableNextColumn();
snprintf(match_info_txt, 20, "%d match(es)", file->file->match_count);
ImGui::TableHeader(match_info_txt);
+
+ ImGui::SameLine();
+ ImGui::Selectable("##nolabel", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap);
+ if (ImGui::IsItemClicked(ImGuiPopupFlags_MouseButtonLeft)) {
+ file->file->collapsed = !file->file->collapsed;
+ }
}
if (file->file->collapsed) continue;
@@ -431,6 +433,7 @@ void ts_create_gui(int window_w, int window_h) {
{ // Results
ImGui::SetNextWindowPos({5, pos_y});
+ ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImGui::ColorConvertU32ToFloat4(0xEAEAEA));
if (ImGui::BeginTable("results-table", 3, ImGuiTableFlags_BordersH|ImGuiTableFlags_ScrollY|ImGuiTableFlags_RowBg|ImGuiTableFlags_SizingFixedFit,
{(float)window_w-7.0f, (float)result_area_height}))
{
@@ -442,13 +445,14 @@ void ts_create_gui(int window_w, int window_h) {
ImGui::TableSetupColumn("Match", 0, line_w);
ImGui::TableHeadersRow();
+
if (current_search_result->search_text == nullptr) _ts_create_file_match_rows();
else _ts_create_text_match_rows();
if (current_search_result->search_completed && (current_search_result->files.length == 0 || current_search_result->match_count == 0)) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
- ImGui::Text("%s", "");
+ ImGui::Text("%s", "");
ImGui::TableNextColumn();
const char* msg = "No matches found.";
@@ -458,6 +462,7 @@ void ts_create_gui(int window_w, int window_h) {
ImGui::EndTable();
}
+ ImGui::PopStyleColor();
}
else { // Help text
ImGui::Separator();