From d79d3c3f7ae0246dac1830924affe635078f4ec5 Mon Sep 17 00:00:00 2001 From: Ingo Date: Wed, 2 Apr 2014 19:12:42 +0200 Subject: [PATCH] Added 'no wait' option (-w) for command line (Windows only), Issue 2314 --- rtgui/main.cc | 77 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/rtgui/main.cc b/rtgui/main.cc index f63672987..d133c93be 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -158,36 +158,46 @@ int main(int argc, char **argv) bool stdoutRedirectedtoFile = (GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)) == 0x0001); bool stderrRedirectedtoFile = (GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == 0x0001); // no console, if stdout and stderr both are redirected to file - if( !(stdoutRedirectedtoFile && stderrRedirectedtoFile)) { - AllocConsole(); - AttachConsole( GetCurrentProcessId() ) ; - // Don't allow CTRL-C in console to terminate RT - SetConsoleCtrlHandler( NULL, true ); - // Set title of console - char consoletitle[128]; - sprintf(consoletitle, "RawTherapee %s Console",VERSION); - SetConsoleTitle(consoletitle); - // increase size of screen buffer - COORD c; - c.X = 200; - c.Y = 1000; - SetConsoleScreenBufferSize( GetStdHandle( STD_OUTPUT_HANDLE ), c ); - // Disable console-Cursor - CONSOLE_CURSOR_INFO cursorInfo; - cursorInfo.dwSize = 100; - cursorInfo.bVisible = false; - SetConsoleCursorInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &cursorInfo ); - if(!stdoutRedirectedtoFile) - freopen( "CON", "w", stdout ) ; - if(!stderrRedirectedtoFile) - freopen( "CON", "w", stderr ) ; - freopen( "CON", "r", stdin ) ; + if( !(stdoutRedirectedtoFile && stderrRedirectedtoFile)) { + // check if parameter -w was passed. + // We have to do that in this step, because it controls whether to open a console to show the output of following steps + bool Console = true; + for(int i=1;i] Start File Browser inside directory." << std::endl; std::cout << " " << Glib::path_get_basename(argv[0]) << " Start Image Editor with file." << std::endl; - std::cout << " " << Glib::path_get_basename(argv[0]) << " -c | Convert files in batch with default parameters." << std::endl << std::endl; + std::cout << " " << Glib::path_get_basename(argv[0]) << " -c | Convert files in batch with default parameters." << std::endl << std::endl; +#ifdef WIN32 + std::cout << " -w Do not open the Windows console" << std::endl; +#endif std::cout << "Other options used with -c (-c must be the last option):" << std::endl; std::cout << Glib::path_get_basename(argv[0]) << " [-o |-O ] [-s|-S] [-p ] [-d] [-j[1-100]|-t|-t1|-n] -Y -c " << std::endl; std::cout << " -o | Select output file or directory." << std::endl;