From 99885791e99df4cc1cb5214271ed06bea4cd318d Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 7 Jun 2007 16:57:59 +0000 Subject: [PATCH] Remove the GUI popup from the screen capture C++ code (a request via IRC wanted this to be scritable) and add it back (as a tip popup) via a little nasal in the keyboard handler. Also put the synthesis of property nodes back into fgcommand(), because I got cold feet. --- src/GUI/gui_funcs.cxx | 18 +++++------------- src/Scripting/NasalSys.cxx | 6 +++++- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index d8bb9b280..de6aded6a 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -506,7 +506,6 @@ void fgHiResDumpWrapper ( puObject *obj ) { void fgDumpSnapShot () { bool show_pu_cursor = false; char *filename = new char [24]; - string message; static int count = 1; static const SGPropertyNode *master_freeze @@ -543,20 +542,13 @@ void fgDumpSnapShot () { fclose(fp); } - if ( sg_glDumpWindow( filename, - fgGetInt("/sim/startup/xsize"), - fgGetInt("/sim/startup/ysize")) ) { - message = "Snapshot saved to \""; - message += filename; - message += "\"."; - } else { - message = "Failed to save to \""; - message += filename; - message += "\"."; - } + int result = sg_glDumpWindow(filename, + fgGetInt("/sim/startup/xsize"), + fgGetInt("/sim/startup/ysize")); + fgSetString("/sim/last-screenshot", result ? filename : ""); fgSetBool("/sim/signals/screenshot", false); - mkDialog (message.c_str()); + //mkDialog (message.c_str()); delete [] filename; diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 7fb471b49..1e832d45f 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -256,9 +256,13 @@ static naRef f_fgcommand(naContext c, naRef me, int argc, naRef* args) naRef props = argc > 1 ? args[1] : naNil(); if(!naIsString(cmd) || (!naIsNil(props) && !naIsGhost(props))) naRuntimeError(c, "bad arguments to fgcommand()"); - SGPropertyNode_ptr* node = NULL; + SGPropertyNode_ptr tmp, *node; if(!naIsNil(props)) node = (SGPropertyNode_ptr*)naGhost_ptr(props); + else { + tmp = new SGPropertyNode(); + node = &tmp; + } return naNum(globals->get_commands()->execute(naStr_data(cmd), *node)); } -- 2.39.5