Revision: 55899
          http://sourceforge.net/p/brlcad/code/55899
Author:   vladbogo
Date:     2013-06-30 21:09:38 +0000 (Sun, 30 Jun 2013)
Log Message:
-----------
Tested the dm_top value and created the corresponding window: toplevel or 
embedded.

Modified Paths:
--------------
    brlcad/trunk/src/libdm/dm-qt.cpp

Modified: brlcad/trunk/src/libdm/dm-qt.cpp
===================================================================
--- brlcad/trunk/src/libdm/dm-qt.cpp    2013-06-30 20:39:29 UTC (rev 55898)
+++ brlcad/trunk/src/libdm/dm-qt.cpp    2013-06-30 21:09:38 UTC (rev 55899)
@@ -33,6 +33,7 @@
 #include "bu.h"
 #include "vmath.h"
 #include "dm.h"
+#include "dm_xvars.h"
 
 __BEGIN_DECLS
 
@@ -44,6 +45,8 @@
     struct bu_vls init_proc_vls = BU_VLS_INIT_ZERO;
     Tk_Window tkwin;
 
+    struct dm_xvars *pubvars = NULL;
+
     if (argc < 0 || !argv)
        return DM_NULL;
 
@@ -56,6 +59,9 @@
     *dmp = dm_qt; /* struct copy */
     dmp->dm_interp = interp;
 
+    BU_ALLOC(dmp->dm_vars.pub_vars, struct dm_xvars);
+    pubvars = (struct dm_xvars *)dmp->dm_vars.pub_vars;
+
     bu_vls_init(&dmp->dm_pathName);
     bu_vls_init(&dmp->dm_tkName);
     bu_vls_init(&dmp->dm_dName);
@@ -67,6 +73,45 @@
     }
     ++count;
 
+    if (bu_vls_strlen(&dmp->dm_dName) == 0) {
+       char *dp;
+
+       dp = getenv("DISPLAY");
+       if (dp)
+           bu_vls_strcpy(&dmp->dm_dName, dp);
+       else
+           bu_vls_strcpy(&dmp->dm_dName, ":0.0");
+    }
+    if (bu_vls_strlen(&init_proc_vls) == 0)
+       bu_vls_strcpy(&init_proc_vls, "bind_dm");
+
+    if (dmp->dm_top) {
+       /* Make xtkwin a toplevel window */
+       pubvars->xtkwin = Tk_CreateWindowFromPath(interp, tkwin,
+                                                 
bu_vls_addr(&dmp->dm_pathName),
+                                                 bu_vls_addr(&dmp->dm_dName));
+       pubvars->top = pubvars->xtkwin;
+    } else {
+       char *cp;
+
+       cp = strrchr(bu_vls_addr(&dmp->dm_pathName), (int)'.');
+       if (cp == bu_vls_addr(&dmp->dm_pathName)) {
+           pubvars->top = tkwin;
+       } else {
+           struct bu_vls top_vls = BU_VLS_INIT_ZERO;
+
+           bu_vls_strncpy(&top_vls, (const char 
*)bu_vls_addr(&dmp->dm_pathName), cp - bu_vls_addr(&dmp->dm_pathName));
+
+           pubvars->top = Tk_NameToWindow(interp, bu_vls_addr(&top_vls), 
tkwin);
+           bu_vls_free(&top_vls);
+       }
+
+       /* Make xtkwin an embedded window */
+       pubvars->xtkwin =
+           Tk_CreateWindow(interp, pubvars->top,
+                           cp + 1, (char *)NULL);
+    }
+
     bu_log("qt_open called\n");
     return dmp;
 }

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


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to