Revision: 77990
          http://sourceforge.net/p/brlcad/code/77990
Author:   starseeker
Date:     2020-12-17 20:20:32 +0000 (Thu, 17 Dec 2020)
Log Message:
-----------
Update the MGED quit command to not quit by default if there are active GED 
subprocesses.  Support a '-f' option to force quitting anyway, and print out 
information on how to identify running processes if not quitting.

Modified Paths:
--------------
    brlcad/trunk/NEWS
    brlcad/trunk/TODO
    brlcad/trunk/doc/docbook/system/mann/quit.xml
    brlcad/trunk/src/mged/cmd.c
    brlcad/trunk/src/tclscripts/mged/mview.tcl

Modified: brlcad/trunk/NEWS
===================================================================
--- brlcad/trunk/NEWS   2020-12-17 19:44:17 UTC (rev 77989)
+++ brlcad/trunk/NEWS   2020-12-17 20:20:32 UTC (rev 77990)
@@ -13,6 +13,8 @@
 --- 2020-xx-xx  Release 7.32.2                                     ---
 ----------------------------------------------------------------------
 
+* added a '-f' forcing option to MGED's quit command - Cliff Yapp
+* changed MGED's quit command to wait for subprocesses - Cliff Yapp
 * removed obscure MGED menu entries for unused features - Cliff Yapp
 * fixed crash when trying to shade invalid breps - Cliff Yapp
 * changed 'mvall' to rename all refs even w/ no object - Sean Morrison

Modified: brlcad/trunk/TODO
===================================================================
--- brlcad/trunk/TODO   2020-12-17 19:44:17 UTC (rev 77989)
+++ brlcad/trunk/TODO   2020-12-17 20:20:32 UTC (rev 77990)
@@ -24,17 +24,6 @@
   both mged -c and gui mode on Mac.  MGED is blocking when running
   "rt" command until after the framebuffer window is closed.
 
-* Implement new behavior for quit command in MGED - if bu_subprocess
-  commands are running, by default refuse to quit and print out a
-  list of currently running processes and instructions on how to abort
-  them.  Implement a -f option to forcibly quite even if there are
-  subprocesses running, and (perhaps) a --wait option to quite after
-  all subprocesses complete.
-
-  Also of interest in this context (but not critical for the basic
-  functionality) is designing a general mechanism or protocol for
-  applications to communicate progress back to bu_subprocess.
-
 * implement uv-mapping callback so we can texture-map BoT, NMG, and
   NURBS geometry
 

Modified: brlcad/trunk/doc/docbook/system/mann/quit.xml
===================================================================
--- brlcad/trunk/doc/docbook/system/mann/quit.xml       2020-12-17 19:44:17 UTC 
(rev 77989)
+++ brlcad/trunk/doc/docbook/system/mann/quit.xml       2020-12-17 20:20:32 UTC 
(rev 77990)
@@ -22,12 +22,22 @@
 
 <refsection xml:id="description"><title>DESCRIPTION</title>
 
-  <para>Ends the MGED process. Note that there is no write database
-       command in MGED. All changes are made to the database as the user 
performs
-       them. Therefore, a <command>quit</command> command will not restore the 
database to its pre-edited state.
-       This is a synonym for the <command>q</command> command.
+<para>
+  Ends the MGED process. Note that there is no write database
+  command in MGED. All changes are made to the database as the
+  user performs        them. Therefore, a <command>quit</command>
+  command will not restore the database to its pre-edited
+  state. This is a synonym for the <command>q</command>
+  command.
+</para>
 
-    </para>
+<para>
+  By default, the quit command will not exit if there are
+  active subprocess commands running.  To exit regardless
+  of those commands, add the <option>f</option> option to
+  force quitting.
+</para>
+
 </refsection>
 
 <refsection xml:id="examples"><title>EXAMPLES</title>

Modified: brlcad/trunk/src/mged/cmd.c
===================================================================
--- brlcad/trunk/src/mged/cmd.c 2020-12-17 19:44:17 UTC (rev 77989)
+++ brlcad/trunk/src/mged/cmd.c 2020-12-17 20:20:32 UTC (rev 77990)
@@ -1259,7 +1259,9 @@
 int
 f_quit(ClientData UNUSED(clientData), Tcl_Interp *interpreter, int argc, const 
char *argv[])
 {
-    if (argc < 1 || 1 < argc) {
+    int force_quit = 0;
+
+    if (argc < 1 || argc > 2) {
        struct bu_vls vls = BU_VLS_INIT_ZERO;
 
        bu_vls_printf(&vls, "help %s", argv[0]);
@@ -1268,6 +1270,21 @@
        return TCL_ERROR;
     }
 
+    if (argc > 1) {
+       if (BU_STR_EQUAL(argv[1], "-f"))
+           force_quit = 1;
+    }
+
+    /* Check if we have any ged subprocesses running.  If we do, unless we're 
forcing, don't
+     * quite yet. */
+    if (GEDP && BU_PTBL_LEN(&GEDP->ged_subp) && !force_quit) {
+       struct bu_vls vls = BU_VLS_INIT_ZERO;
+       bu_vls_sprintf(&vls, " attempting to quit while GED subprocesses are 
running.\n\nTo list running processes, use the 'process list' command.\n\nTo 
exit despite the running subprocesses, add the '-f' option to the quit 
command.");
+       Tcl_AppendResult(interpreter, bu_vls_cstr(&vls), (char *)NULL);
+       bu_vls_free(&vls);
+       return TCL_ERROR;
+    }
+
     if (STATE != ST_VIEW)
        button(BE_REJECT);
 

Modified: brlcad/trunk/src/tclscripts/mged/mview.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/mview.tcl  2020-12-17 19:44:17 UTC (rev 
77989)
+++ brlcad/trunk/src/tclscripts/mged/mview.tcl  2020-12-17 20:20:32 UTC (rev 
77990)
@@ -249,7 +249,7 @@
 
     # If all the windows are gone, we're closing the application
     if { !$mged_gui($id,show_cmd) && !$mged_gui($id,show_dm)} {
-       exit
+       quit -f
     }
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to