Revision: 55903
          http://sourceforge.net/p/brlcad/code/55903
Author:   vladbogo
Date:     2013-06-30 21:56:42 +0000 (Sun, 30 Jun 2013)
Log Message:
-----------
Init dm, open display and set window dimensions.

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 21:24:31 UTC (rev 55902)
+++ brlcad/trunk/src/libdm/dm-qt.cpp    2013-06-30 21:56:42 UTC (rev 55903)
@@ -393,8 +393,10 @@
 qt_open(Tcl_Interp *interp, int argc, char **argv)
 {
     static int count = 0;
+    int make_square = -1;
     struct dm *dmp = (struct dm *)NULL;
     struct bu_vls init_proc_vls = BU_VLS_INIT_ZERO;
+    struct bu_vls str = BU_VLS_INIT_ZERO;
     Tk_Window tkwin;
 
     struct dm_xvars *pubvars = NULL;
@@ -470,6 +472,51 @@
        return DM_NULL;
     }
 
+    bu_vls_printf(&dmp->dm_tkName, "%s", (char *)Tk_Name(pubvars->xtkwin));
+
+    bu_vls_printf(&str, "_init_dm %V %V\n", &init_proc_vls, &dmp->dm_pathName);
+
+    if (Tcl_Eval(interp, bu_vls_addr(&str)) == TCL_ERROR) {
+       bu_log("qt_open: _init_dm failed\n");
+       bu_vls_free(&init_proc_vls);
+       bu_vls_free(&str);
+       (void)qt_close(dmp);
+       return DM_NULL;
+    }
+
+    bu_vls_free(&init_proc_vls);
+    bu_vls_free(&str);
+
+    pubvars->dpy = Tk_Display(pubvars->top);
+
+    /* make sure there really is a display before proceeding. */
+    if (!pubvars->dpy) {
+       bu_log("qt_open: Unable to attach to display (%s)\n", 
bu_vls_addr(&dmp->dm_pathName));
+       (void)qt_close(dmp);
+       return DM_NULL;
+    }
+
+    if (dmp->dm_width == 0) {
+       dmp->dm_width =
+           WidthOfScreen(Tk_Screen(pubvars->xtkwin)) - 30;
+       ++make_square;
+    }
+
+    if (dmp->dm_height == 0) {
+       dmp->dm_height =
+           HeightOfScreen(Tk_Screen(pubvars->xtkwin)) - 30;
+       ++make_square;
+    }
+
+    if (make_square > 0) {
+       /* Make window square */
+       if (dmp->dm_height <
+           dmp->dm_width)
+           dmp->dm_width = dmp->dm_height;
+       else
+           dmp->dm_height = dmp->dm_width;
+    }
+
     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