From 2ac3c83099214b7f1cc09144d5bdea176bb28874 Mon Sep 17 00:00:00 2001 From: aiekick Date: Sun, 1 Dec 2024 01:11:34 +0100 Subject: [PATCH] - --- 3rdparty/BuildInc/BuildInc.c | 46 ++++++++++--------- CMakeLists.txt | 2 +- VERSION | 2 +- plugins/LuaScripting/CMakeLists.txt | 2 +- plugins/LuaScripting/src/LuaScripting.cpp | 2 +- .../src/modules/LuaDatasModel.cpp | 2 +- plugins/LuaScripting/src/modules/Module.h | 4 +- .../LuaScripting/src/settings/Settings.cpp | 2 +- src/headers/LogToGraphBuild.h | 6 +-- src/panes/LogPane.cpp | 11 ++--- 10 files changed, 39 insertions(+), 40 deletions(-) diff --git a/3rdparty/BuildInc/BuildInc.c b/3rdparty/BuildInc/BuildInc.c index 31f0b21..560df6d 100644 --- a/3rdparty/BuildInc/BuildInc.c +++ b/3rdparty/BuildInc/BuildInc.c @@ -1,7 +1,7 @@ /* MIT License -Copyright (c) 2022-2023 Stephane Cuillerdier (aka aiekick) +Copyright (c) 2022-2022 Stephane Cuillerdier (aka aiekick) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -27,16 +27,17 @@ SOFTWARE. #include #include -#define MAX_LENGTH 1024 +#define MAX_LENGTH 2048 #define BUILD_PREFIX "Prefix" #define BUILD_WORD "BuildNumber" #define MINOR_WORD "MinorNumber" #define MAJOR_WORD "MajorNumber" #define BUILD_ID_WORD "BuildId" -static int rule_maxBuildNumber = 1000; -static int rule_maxMinorNumber = 10; +static int rule_maxBuildNumber = 1000; +static int rule_maxMinorNumber = 10; static char prefix_buffer[MAX_LENGTH + 1] = ""; +static int rule_enabled = 0; // return 1 if a prefix was found int ParsePrefix(const char* vPrefix) { @@ -60,9 +61,9 @@ int ParseRule(const char* vRule) { if (vRule && strlen(vRule)) { int maxBuild, maxMinor; #ifdef _MSC_VER - int res = sscanf_s(vRule, "%i:%i", &maxBuild, &maxMinor); + int res = sscanf_s(vRule, "-rule=%i:%i", &maxBuild, &maxMinor); #else - int res = sscanf(vRule, "%i:%i", &maxBuild, &maxMinor); + int res = sscanf(vRule, "-rule=%i:%i", &maxBuild, &maxMinor); #endif if (res == 2) { rule_maxBuildNumber = maxBuild; @@ -72,10 +73,6 @@ int ParseRule(const char* vRule) { } } - printf("-- The rule is missing or wrong\n"); - printf("-- The rule must respect this format max_build_number:max_minor_number\n"); - printf("-- The default rule of 1000:10 will be applied\n"); - return 0; } @@ -100,8 +97,8 @@ void ParseFile(const char* vFile) { { // read while (!feof(fp) && idx < 3) { - fgets(bufLine, MAX_LENGTH, fp); - if (ferror(fp)) { + char* ptr = fgets(bufLine, MAX_LENGTH, fp); + if (!ptr || ferror(fp)) { fprintf(stderr, "-- Reading error with code %d\n", errno); break; } @@ -153,13 +150,15 @@ void ParseFile(const char* vFile) { fp == NULL) { // fichier non existant // treatment ++BuildNumber; - if (BuildNumber > rule_maxBuildNumber) { - BuildNumber = 0; - ++MinorNumber; - } - if (MinorNumber > rule_maxMinorNumber) { - MinorNumber = 0; - ++MajorNumber; + if (rule_enabled == 1) { + if (BuildNumber > rule_maxBuildNumber) { + BuildNumber = 0; + ++MinorNumber; + } + if (MinorNumber > rule_maxMinorNumber) { + MinorNumber = 0; + ++MajorNumber; + } } // print vars : @@ -233,7 +232,7 @@ int main(int argc, char* argv[]) { // Don't forget first integral argument 'arg if (argc == 1) { printf("-------------------- BuildInc --------------------\n"); printf("-- this func will increment in a c/c++ include file, 3 vars : MajorNumber, MinorNumber and BuildNumber, according to a rule\n"); - printf("-- the syntax is : BuildInc -prefix=\"prefix\" rule include_file\n"); + printf("-- the syntax is : BuildInc -prefix=<\"prefix\"> -rule= include_file\n"); printf("-- the rule is 'max_build_number:max_minor_number' \n"); printf("-- by ex with a rule of 1000:10 the corresponding pseudo code will be :\n"); printf("-- if (BuildNumber > 1000) ++MinorNumber;\n"); @@ -246,10 +245,13 @@ int main(int argc, char* argv[]) { // Don't forget first integral argument 'arg if (argc > 1) { ParsePrefix(argv[idx++]); int res = ParseRule(argv[idx]); - if (res) + if (res) { + rule_enabled = 1; ++idx; - if (argc > 2 || res == 0) + } + if (argc > 2 || res == 0) { ParseFile(argv[idx]); + } } return 0; diff --git a/CMakeLists.txt b/CMakeLists.txt index da6d95e..c913404 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,7 +229,7 @@ add_subdirectory(3rdparty/BuildInc) add_custom_command( TARGET ${PROJECT} PRE_BUILD - COMMAND BuildInc -prefix=${PROJECT} 1000000:10 $<$:${CMAKE_SOURCE_DIR}/src/headers/${PROJECT}Build.h> + COMMAND BuildInc -prefix=${PROJECT} $<$:${CMAKE_SOURCE_DIR}/src/headers/${PROJECT}Build.h> DEPENDS ${PROJECT}) ######################################################## diff --git a/VERSION b/VERSION index b5ab14c..980d801 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -LogToGraph_Windows_Debug_x64_v0.2.1026 +LogToGraph_Windows_Debug_x64_v0.3.3583 diff --git a/plugins/LuaScripting/CMakeLists.txt b/plugins/LuaScripting/CMakeLists.txt index 34b9f18..537f92a 100644 --- a/plugins/LuaScripting/CMakeLists.txt +++ b/plugins/LuaScripting/CMakeLists.txt @@ -132,7 +132,7 @@ set(LOADED_LOG_TO_GRAPH_PLUGINS ${LOADED_LOG_TO_GRAPH_PLUGINS} ${PROJECT} PARENT ## only for Debug add_custom_command( TARGET ${PROJECT} PRE_BUILD - COMMAND BuildInc -prefix=${PROJECT} 1000000:10 $<$:${CMAKE_CURRENT_SOURCE_DIR}/src/Headers/${PROJECT}Build.h> + COMMAND BuildInc -prefix=${PROJECT} $<$:${CMAKE_CURRENT_SOURCE_DIR}/src/Headers/${PROJECT}Build.h> DEPENDS ${PROJECT} ) diff --git a/plugins/LuaScripting/src/LuaScripting.cpp b/plugins/LuaScripting/src/LuaScripting.cpp index 49de86b..cd7f725 100644 --- a/plugins/LuaScripting/src/LuaScripting.cpp +++ b/plugins/LuaScripting/src/LuaScripting.cpp @@ -24,7 +24,7 @@ PLUGIN_PREFIX void deleter(LuaScripting* ptr) { } } -#include +#include LuaScripting::LuaScripting() = default; diff --git a/plugins/LuaScripting/src/modules/LuaDatasModel.cpp b/plugins/LuaScripting/src/modules/LuaDatasModel.cpp index 94f5c9a..92271f1 100644 --- a/plugins/LuaScripting/src/modules/LuaDatasModel.cpp +++ b/plugins/LuaScripting/src/modules/LuaDatasModel.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/plugins/LuaScripting/src/modules/Module.h b/plugins/LuaScripting/src/modules/Module.h index 104ac2f..5c018eb 100644 --- a/plugins/LuaScripting/src/modules/Module.h +++ b/plugins/LuaScripting/src/modules/Module.h @@ -1,8 +1,8 @@ #pragma once -#include +#include #include -#include +#include #include #include #include diff --git a/plugins/LuaScripting/src/settings/Settings.cpp b/plugins/LuaScripting/src/settings/Settings.cpp index 6b94dcf..2c3da93 100644 --- a/plugins/LuaScripting/src/settings/Settings.cpp +++ b/plugins/LuaScripting/src/settings/Settings.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/src/headers/LogToGraphBuild.h b/src/headers/LogToGraphBuild.h index 46747b5..e10b395 100644 --- a/src/headers/LogToGraphBuild.h +++ b/src/headers/LogToGraphBuild.h @@ -1,7 +1,7 @@ #pragma once #define LogToGraph_Prefix "LogToGraph" -#define LogToGraph_BuildNumber 1063 -#define LogToGraph_MinorNumber 2 +#define LogToGraph_BuildNumber 3583 +#define LogToGraph_MinorNumber 3 #define LogToGraph_MajorNumber 0 -#define LogToGraph_BuildId "0.2.1063" +#define LogToGraph_BuildId "0.3.3583" diff --git a/src/panes/LogPane.cpp b/src/panes/LogPane.cpp index 6bc7fb1..189a65b 100644 --- a/src/panes/LogPane.cpp +++ b/src/panes/LogPane.cpp @@ -150,8 +150,7 @@ void LogPane::DrawMenuBar() { } void LogPane::DrawTable() { - ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY | - ImGuiTableFlags_NoHostExtendY; + ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_NoHostExtendY; if (!ProjectFile::Instance()->m_AutoResizeLogColumns) { flags |= ImGuiTableFlags_Resizable; @@ -167,9 +166,8 @@ void LogPane::DrawTable() { m_need_re_preparation = false; auto listViewID = ImGui::GetID("##LogPane_DrawTable"); - if (ImGui::BeginTableEx("##LogPane_DrawTable", listViewID, 5, flags)) //-V112 - { - ImGui::TableSetupScrollFreeze(0, 1); // Make header always visible + if (ImGui::BeginTableEx("##LogPane_DrawTable", listViewID, 5, flags)) { //-V112 + ImGui::TableSetupScrollFreeze(0, 1); // Make header always visible ImGui::TableSetupColumn("Epoch", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_DefaultHide); ImGui::TableSetupColumn("Date", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Cat", ImGuiTableColumnFlags_WidthFixed); @@ -178,8 +176,7 @@ void LogPane::DrawTable() { ImGui::TableNextRow(ImGuiTableRowFlags_Headers); - for (int column = 0; column < 5; column++) //-V112 - { + for (int column = 0; column < 5; column++) { //-V112 ImGui::TableSetColumnIndex(column); const char* column_name = ImGui::TableGetColumnName(column); // Retrieve name passed to TableSetupColumn() ImGui::PushID(column);