summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-05 19:16:25 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-05 19:16:25 +0100
commitf3401ce1532938fec63d22095ca8b14affcfdce3 (patch)
tree5c9416ce12d12b90ed5a7d467b84ee279c04d791 /src
parent6b492daddd682de986e3f983ecfc1d29ed70b0a0 (diff)
exit button working
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp10
-rw-r--r--src/main_windows.cpp8
-rw-r--r--src/platform.h2
-rw-r--r--src/search.h2
4 files changed, 13 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp
index e5b4fd3..eb9cee4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -39,7 +39,7 @@ static void _ts_create_popups() {
// Settings window
if (ImGui::BeginPopupModal("Text-Search settings", NULL, ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove)) {
ImGui::SetWindowSize({300, 0});
- ImGui::DragInt("Threads", &ts_thread_count, 1.0f, 1, 4);
+ ImGui::DragInt("Threads", &ts_thread_count, 0.1f, 1, 8);
ImGui::SetItemTooltip("Number of threads used to search for text matches");
ImGui::DragInt("File Size", &max_file_size, 50.0f, 1, 10000, "%dMB");
@@ -96,10 +96,12 @@ static int _ts_create_menu() {
{
if (ImGui::BeginMenu("File"))
{
- ImGui::MenuItem("Open", "CTRL+O");
- ImGui::MenuItem("Save", "CTRL+S");
+ //ImGui::MenuItem("Open", "CTRL+O");
+ //ImGui::MenuItem("Save", "CTRL+S");
ImGui::Separator();
- ImGui::MenuItem("Exit", "CTRL+Q");
+ if (ImGui::MenuItem("Exit")) {
+ program_running = false;
+ }
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Program"))
diff --git a/src/main_windows.cpp b/src/main_windows.cpp
index f657042..1f64642 100644
--- a/src/main_windows.cpp
+++ b/src/main_windows.cpp
@@ -34,6 +34,7 @@ static WGL_WindowData g_MainWindow;
static int g_Width;
static int g_Height;
LARGE_INTEGER Frequency;
+bool program_running = true;
bool CreateDeviceWGL(HWND hWnd, WGL_WindowData* data);
void CleanupDeviceWGL(HWND hWnd, WGL_WindowData* data);
@@ -44,7 +45,6 @@ static const char* _ts_platform_get_config_file_path(char* buffer) {
if(SUCCEEDED(SHGetFolderPathA(0, CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, buffer)))
{
strcat_s(buffer, MAX_INPUT_LENGTH, "\\text-search\\config.ini");
- printf("%s\n", buffer);
return buffer;
}
@@ -110,7 +110,7 @@ int main(int, char**)
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
bool done = false;
- while (!done)
+ while (program_running)
{
MSG msg;
while (::PeekMessage(&msg, nullptr, 0U, 0U, PM_REMOVE))
@@ -118,9 +118,9 @@ int main(int, char**)
::TranslateMessage(&msg);
::DispatchMessage(&msg);
if (msg.message == WM_QUIT)
- done = true;
+ program_running = false;
}
- if (done)
+ if (!program_running)
break;
ImGui_ImplOpenGL3_NewFrame();
diff --git a/src/platform.h b/src/platform.h
index 1fb032d..e9d7ba5 100644
--- a/src/platform.h
+++ b/src/platform.h
@@ -29,6 +29,8 @@ typedef enum t_ts_file_open_error
FILE_ERROR_TOO_BIG = 11,
} ts_file_open_error;
+extern bool program_running;
+
ts_file_content ts_platform_read_file(char *path, const char *mode);
void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir = nullptr);
void ts_platform_list_files(ts_search_result* result);
diff --git a/src/search.h b/src/search.h
index 3bae1a3..9b8863b 100644
--- a/src/search.h
+++ b/src/search.h
@@ -42,7 +42,7 @@ typedef struct t_ts_search_result
utf8_int8_t *file_filter;
utf8_int8_t *search_text;
int max_ts_thread_count;
- int max_file_size;
+ uint64_t max_file_size;
} ts_search_result;
typedef struct t_ts_file_match