From 6a7f636fddf22ce6ffb54721150fd165c52eabf0 Mon Sep 17 00:00:00 2001 From: firleju Date: Mon, 9 Jan 2017 21:12:09 +0100 Subject: [PATCH] =?UTF-8?q?Wy=C5=82=C4=85czenie=20okienek=20pop-up.=20W=20?= =?UTF-8?q?zamian=20zapis=20do=20log=C3=B3w.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wyłączenie okienek pop-up. W zamian zapis do logów. --- Logs.cpp | 75 ++++++++++++++++++++++++++++---------------------------- Logs.h | 6 ++--- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/Logs.cpp b/Logs.cpp index 173ad5d1..b8a46063 100644 --- a/Logs.cpp +++ b/Logs.cpp @@ -7,16 +7,16 @@ obtain one at http://mozilla.org/MPL/2.0/. */ -#include "system.hpp" #include "classes.hpp" +#include "system.hpp" #pragma hdrstop -#include "Logs.h" #include "Globals.h" +#include "Logs.h" -#include -#include #include +#include +#include std::ofstream output; // standardowy "log.txt", mo¿na go wy³¹czyæ std::ofstream errors; // lista b³êdów "errors.txt", zawsze dzia³a @@ -41,8 +41,8 @@ void WriteConsoleOnly(const char *str, bool newline) FOREGROUND_GREEN | FOREGROUND_INTENSITY); DWORD wr = 0; WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), str, strlen(str), &wr, NULL); - if (newline) - WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), endstring, strlen(endstring), &wr, NULL); + if (newline) + WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), endstring, strlen(endstring), &wr, NULL); } void WriteLog(const char *str, double value) @@ -65,9 +65,9 @@ void WriteLog(const char *str, bool newline) { if (!output.is_open()) output.open("log.txt", std::ios::trunc); - output << str; - if (newline) - output << "\n"; + output << str; + if (newline) + output << "\n"; output.flush(); } // hunter-271211: pisanie do konsoli tylko, gdy nie jest ukrywana @@ -91,29 +91,30 @@ void ErrorLog(const char *str) void Error(const AnsiString &asMessage, bool box) { - if (box) - MessageBox(NULL, asMessage.c_str(), string("EU07 " + Global::asRelease).c_str(), MB_OK); - WriteLog(asMessage.c_str()); + // if (box) + // MessageBox(NULL, asMessage.c_str(), string("EU07 " + Global::asRelease).c_str(), MB_OK); + ErrorLog(asMessage.c_str()); } void Error(const std::string &asMessage, bool box) { - if (box) - MessageBox(NULL, asMessage.c_str(), string("EU07 " + Global::asRelease).c_str(), MB_OK); - WriteLog(asMessage.c_str()); + // if (box) + // MessageBox(NULL, asMessage.c_str(), string("EU07 " + Global::asRelease).c_str(), MB_OK); + ErrorLog(asMessage.c_str()); } -void Error(const char* &asMessage, bool box) +void Error(const char *&asMessage, bool box) { - if (box) - MessageBox(NULL, asMessage, string("EU07 " + Global::asRelease).c_str(), MB_OK); - WriteLog(asMessage); + // if (box) + // MessageBox(NULL, asMessage, string("EU07 " + Global::asRelease).c_str(), MB_OK); + ErrorLog(asMessage); + WriteLog(asMessage); } void ErrorLog(const std::string &str, bool newline) { - ErrorLog(str.c_str()); - WriteLog(str.c_str(), newline); + ErrorLog(str.c_str()); + WriteLog(str.c_str(), newline); } void ErrorLog(const AnsiString &asMessage) @@ -129,34 +130,34 @@ void WriteLog(const AnsiString &str, bool newline) void WriteLog(const std::string &str, bool newline) { // Ra: wersja z AnsiString jest zamienna z Error() - WriteLog(str.c_str(), newline); + WriteLog(str.c_str(), newline); }; void CommLog(const char *str) { // Ra: warunkowa rejestracja komunikatów - WriteLog(str); - /* if (Global::iWriteLogEnabled & 4) - { - if (!comms.is_open()) - { - comms.open("comms.txt", std::ios::trunc); - comms << AnsiString("EU07.EXE " + Global::asRelease).c_str() << "\n"; - } - if (str) - comms << str; - comms << "\n"; - comms.flush(); - }*/ + WriteLog(str); + /* if (Global::iWriteLogEnabled & 4) + { + if (!comms.is_open()) + { + comms.open("comms.txt", std::ios::trunc); + comms << AnsiString("EU07.EXE " + Global::asRelease).c_str() << "\n"; + } + if (str) + comms << str; + comms << "\n"; + comms.flush(); + }*/ }; void CommLog(const std::string &str) { // Ra: wersja z AnsiString jest zamienna z Error() - WriteLog(str); + WriteLog(str); }; void CommLog(const AnsiString &str) { // Ra: wersja z AnsiString jest zamienna z Error() - CommLog(str.c_str()); + CommLog(str.c_str()); }; //--------------------------------------------------------------------------- diff --git a/Logs.h b/Logs.h index 7080b950..30e80b3c 100644 --- a/Logs.h +++ b/Logs.h @@ -16,9 +16,9 @@ void WriteConsoleOnly(const char *str, double value); void WriteConsoleOnly(const char *str, bool newline = true); void WriteLog(const char *str, double value); void WriteLog(const char *str, bool newline = true); -void Error(const AnsiString &asMessage, bool box = true); -void Error(const std::string &asMessage, bool box = true); -void Error(const char* &asMessage, bool box = true); +void Error(const AnsiString &asMessage, bool box = false); +void Error(const std::string &asMessage, bool box = false); +void Error(const char* &asMessage, bool box = false); void ErrorLog(const std::string &str, bool newline = true); //void ErrorLog(const AnsiString &asMessage); void WriteLog(const AnsiString &str, bool newline = true);