Revision: 76594
          http://sourceforge.net/p/brlcad/code/76594
Author:   starseeker
Date:     2020-07-30 13:05:39 +0000 (Thu, 30 Jul 2020)
Log Message:
-----------
Shift primitive label list

Modified Paths:
--------------
    brlcad/branches/bioh/include/tclcad.h
    brlcad/branches/bioh/src/libtclcad/view/draw.c
    brlcad/branches/bioh/src/libtclcad/view/labels.c

Modified: brlcad/branches/bioh/include/tclcad.h
===================================================================
--- brlcad/branches/bioh/include/tclcad.h       2020-07-30 12:57:45 UTC (rev 
76593)
+++ brlcad/branches/bioh/include/tclcad.h       2020-07-30 13:05:39 UTC (rev 
76594)
@@ -136,6 +136,11 @@
     struct ged_obj             *gdv_gop;
     struct bu_vls      go_rt_end_callback;
     struct bu_vls      go_more_args_callback;
+
+    // TODO - these really shouldn't be libtclcad specific... we don't want to
+    // depend on Tcl for label primitives...
+    struct bu_vls      *go_prim_label_list;
+    int                        go_prim_label_list_size;
 };
 
 struct tclcad_view_data {
@@ -148,9 +153,6 @@
 struct ged_obj {
     struct ged         *go_gedp;
     struct bview       go_head_views;
-    //struct bu_vls    go_name;
-    struct bu_vls      *go_prim_label_list;
-    int                        go_prim_label_list_size;
     int                        go_refresh_on;
     int                        go_dlist_on;
     Tcl_Interp         *interp;

Modified: brlcad/branches/bioh/src/libtclcad/view/draw.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/draw.c      2020-07-30 12:57:45 UTC 
(rev 76593)
+++ brlcad/branches/bioh/src/libtclcad/view/draw.c      2020-07-30 13:05:39 UTC 
(rev 76594)
@@ -276,6 +276,8 @@
 void
 go_draw_other(struct ged_obj *gop, struct bview *gdvp)
 {
+    struct tclcad_ged_data *tgd = (struct tclcad_ged_data 
*)gop->go_gedp->u_data;
+
     int width = dm_get_width((struct dm *)gdvp->dmp);
     fastf_t sf = (fastf_t)(gdvp->gv_size) / (fastf_t)width;
 
@@ -321,10 +323,10 @@
     if (gdvp->gv_prim_labels.gos_draw) {
        register int i;
 
-       for (i = 0; i < gop->go_prim_label_list_size; ++i) {
+       for (i = 0; i < tgd->go_prim_label_list_size; ++i) {
            dm_draw_labels((struct dm *)gdvp->dmp,
                           gop->go_gedp->ged_wdbp,
-                          bu_vls_addr(&gop->go_prim_label_list[i]),
+                          bu_vls_addr(&tgd->go_prim_label_list[i]),
                           gdvp->gv_model2view,
                           gdvp->gv_prim_labels.gos_text_color,
                           NULL, NULL);

Modified: brlcad/branches/bioh/src/libtclcad/view/labels.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/labels.c    2020-07-30 12:57:45 UTC 
(rev 76593)
+++ brlcad/branches/bioh/src/libtclcad/view/labels.c    2020-07-30 13:05:39 UTC 
(rev 76594)
@@ -345,28 +345,29 @@
              int UNUSED(maxargs))
 {
     register int i;
+    struct tclcad_ged_data *tgd = (struct tclcad_ged_data 
*)current_top->to_gop->go_gedp->u_data;
 
     /* initialize result */
     bu_vls_trunc(gedp->ged_result_str, 0);
 
     /* Free the previous list of primitives scheduled for labeling */
-    if (current_top->to_gop->go_prim_label_list_size) {
-       for (i = 0; i < current_top->to_gop->go_prim_label_list_size; ++i)
-           bu_vls_free(&current_top->to_gop->go_prim_label_list[i]);
-       bu_free((void *)current_top->to_gop->go_prim_label_list, "prim_label");
-       current_top->to_gop->go_prim_label_list = (struct bu_vls *)0;
+    if (tgd->go_prim_label_list_size) {
+       for (i = 0; i < tgd->go_prim_label_list_size; ++i)
+           bu_vls_free(&tgd->go_prim_label_list[i]);
+       bu_free((void *)tgd->go_prim_label_list, "prim_label");
+       tgd->go_prim_label_list = (struct bu_vls *)0;
     }
 
     /* Set the list of primitives scheduled for labeling */
-    current_top->to_gop->go_prim_label_list_size = argc - 1;
-    if (current_top->to_gop->go_prim_label_list_size < 1)
+    tgd->go_prim_label_list_size = argc - 1;
+    if (tgd->go_prim_label_list_size < 1)
        return GED_OK;
 
-    current_top->to_gop->go_prim_label_list = (struct bu_vls 
*)bu_calloc(current_top->to_gop->go_prim_label_list_size,
+    tgd->go_prim_label_list = (struct bu_vls 
*)bu_calloc(tgd->go_prim_label_list_size,
                                                                         
sizeof(struct bu_vls), "prim_label");
-    for (i = 0; i < current_top->to_gop->go_prim_label_list_size; ++i) {
-       bu_vls_init(&current_top->to_gop->go_prim_label_list[i]);
-       bu_vls_printf(&current_top->to_gop->go_prim_label_list[i], "%s", 
argv[i+1]);
+    for (i = 0; i < tgd->go_prim_label_list_size; ++i) {
+       bu_vls_init(&tgd->go_prim_label_list[i]);
+       bu_vls_printf(&tgd->go_prim_label_list[i], "%s", argv[i+1]);
     }
 
     return GED_OK;

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



_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to