diff -r 4fde8fdf258a -r 7eb7a43a511b main.cpp --- a/main.cpp Wed Apr 17 14:09:38 2013 +0300 +++ b/main.cpp Fri Apr 19 15:21:46 2013 +0300 @@ -34,6 +34,9 @@ const vertex g_Origin (0.0f, 0.0f, 0.0f); const matrix g_mIdentity (1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f); +// ============================================================================= +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// ============================================================================= int main (int dArgc, char* saArgv[]) { // Load or create the configuration if (!config::load()) { @@ -45,6 +48,7 @@ } initColors (); + initPartList (); QApplication app (dArgc, saArgv); ForgeWindow* win = new ForgeWindow; @@ -58,65 +62,59 @@ } // ============================================================================= -// void logVA (logtype_e, const char*, va_list) [static] -// -// Common code for the two logfs +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= +// Common code for the two logfs static void logVA (logtype_e eType, const char* fmt, va_list va) { - // Log it to standard output - vprintf (fmt, va); - return; - str zText; - char* sBuffer; + char* sBuffer = vdynformat (fmt, va, 128); + printf ("buffer: %s\n", sBuffer); + str zText (sBuffer); + delete[] sBuffer; - sBuffer = vdynformat (fmt, va, 128); - zText = sBuffer; - delete[] sBuffer; + // Log it to standard output + printf ("%s", zText.chars ()); // Replace some things out with HTML entities zText.replace ("<", "<"); zText.replace (">", ">"); zText.replace ("\n", "
"); - str* zpHTML = &g_ForgeWindow->zMessageLogHTML; + str& zLog = g_ForgeWindow->zMessageLogHTML; switch (eType) { case LOG_Normal: - zpHTML->append (zText); + printf ("appending \"%s\"\n", zText.chars ()); + zLog.append (zText); break; case LOG_Error: - zpHTML->appendformat ("[ERROR] %s", + zLog.appendformat ("[ERROR] %s", zText.chars()); break; case LOG_Info: - zpHTML->appendformat ("[INFO] %s", + zLog.appendformat ("[INFO] %s", zText.chars()); break; case LOG_Success: - zpHTML->appendformat ("[SUCCESS] %s", + zLog.appendformat ("[SUCCESS] %s", zText.chars()); break; case LOG_Warning: - zpHTML->appendformat ("[WARNING] %s", + zLog.appendformat ("[WARNING] %s", zText.chars()); break; } - g_ForgeWindow->qMessageLog->setHtml (*zpHTML); + g_ForgeWindow->qMessageLog->setHtml (zLog); } - // ============================================================================= -// logf (const char*, ...) -// logf (logtype_e eType, const char*, ...) -// -// Outputs a message into the message log +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void logf (const char* fmt, ...) { va_list va; @@ -132,4 +130,4 @@ va_start (va, fmt); logVA (eType, fmt, va); va_end (va); -} \ No newline at end of file +}