Changeset 3072


Ignore:
Timestamp:
Jun 29, 2012, 3:09:38 PM (12 years ago)
Author:
gah
Message:

fixes for drawingentry

Location:
trunk/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/drawingentry.tcl

    r3042 r3072  
    2828    private variable _drawingWidth 0
    2929    private variable _owner
    30     private variable _parser ""
     30    private variable _parser "";        # Slave interpreter where all
     31                                        # substituted variables are stored.
    3132    private variable _path
    3233    private variable _showing ""
     
    4142    private variable _cursor ""
    4243
    43     constructor {owner path args} { # defined below }
    44 
     44    constructor {owner path args} {
     45        # defined below
     46    }
     47    destructor {} {
     48        # defined below
     49    }
    4550    public method value { args }
    4651    public method label {}
     
    102107    pack $itk_component(drawing) -expand yes -fill both
    103108    bind $itk_component(drawing) <Configure> [itcl::code $this Redraw]
     109    set _parser [interp create -safe]
    104110    Redraw
    105111    eval itk_initialize $args
    106112}
    107113
     114itcl::body Rappture::DrawingEntry::destructor {} {
     115    if { $_parser != "" } {
     116        $_parser delete
     117    }
     118}
    108119# ----------------------------------------------------------------------
    109120# USAGE: label
     
    645656    set id [eval $c create hotspot $coords]
    646657    set _cname2id($cname) $id
     658    set options(-interp) $_parser
    647659    eval $c itemconfigure $id [array get options]
    648660    if { $hotspot == "inline" } {
     
    964976itcl::body Rappture::DrawingEntry::InitSubstitutions {} {
    965977    # Load a new parser with the variables representing the substitution
    966     set _parser [interp create -safe]
    967978    foreach name [array names _name2path] {
    968979        set path $_name2path($name)
     
    974985        }
    975986        $_parser eval [list set $name $value]
    976         set ::$name $value
    977987    }
    978988}
  • trunk/gui/scripts/vtkviewer.tcl

    r3067 r3072  
    11721172            foreach dataset [CurrentDatasets -visible $_first] {
    11731173                SendCmd "polydata opacity $sval $dataset"
     1174                if { $_haveGlyphs } {
     1175                    SendCmd "glyphs opacity $sval $dataset"
     1176                }
    11741177            }
    11751178        }
     
    11781181            foreach dataset [CurrentDatasets -visible $_first] {
    11791182                SendCmd "polydata wireframe $bool $dataset"
     1183                if { $_haveGlyphs } {
     1184                    SendCmd "glyphs wireframe $bool $dataset"
     1185                }
    11801186            }
    11811187        }
     
    11831189            set bool $_volume(visible)
    11841190            foreach dataset [CurrentDatasets -visible $_first] {
     1191                if { $_haveGlyphs } {
     1192                    SendCmd "glyphs visible $bool $dataset"
     1193                }
    11851194                SendCmd "polydata visible $bool $dataset"
    11861195            }
     
    11891198            set bool $_volume(lighting)
    11901199            foreach dataset [CurrentDatasets -visible $_first] {
     1200                if { $_haveGlyphs } {
     1201                    SendCmd "glyphs lighting $bool $dataset"
     1202                }
    11911203                SendCmd "polydata lighting $bool $dataset"
    11921204            }
     
    11951207            set bool $_volume(edges)
    11961208            foreach dataset [CurrentDatasets -visible $_first] {
     1209                if { $_haveGlyphs } {
     1210                    SendCmd "glyphs edges $bool $dataset"
     1211                }
    11971212                SendCmd "polydata edges $bool $dataset"
    11981213            }
  • trunk/gui/src/RpCanvHotspot.c

    r3052 r3072  
    156156};
    157157
     158static Tk_OptionParseProc ValueInterpParseProc;
     159static Tk_OptionPrintProc ValueInterpPrintProc;
     160static Tk_CustomOption interpOption = {
     161    (Tk_OptionParseProc *)ValueInterpParseProc, ValueInterpPrintProc,
     162    (ClientData) NULL
     163};
     164
    158165static Tk_ConfigSpec configSpecs[] = {
    159166    {TK_CONFIG_BORDER, "-activebackground", (char *)NULL, (char*)NULL,
     
    177184    {TK_CONFIG_COLOR, "-foreground", "foreground", (char*)NULL,
    178185        "black", Tk_Offset(HotspotItem, textColor), 0},
     186    {TK_CONFIG_CUSTOM, "-interp", (char*)NULL, (char*)NULL, (char*)NULL,
     187        Tk_Offset(HotspotItem, valueInterp), TK_CONFIG_NULL_OK, &interpOption},
    179188    {TK_CONFIG_FONT, "-valuefont", (char*)NULL, (char*)NULL,
    180189        "helvetica -12 bold", Tk_Offset(HotspotItem, valueFont), 0},
     
    466475
    467476
     477/*
     478 *----------------------------------------------------------------------
     479 *
     480 * ValueInterpParseProc --
     481 *
     482 *      Converts the name of an axis to a pointer to its axis structure.
     483 *
     484 * Results:
     485 *      The return value is a standard Tcl result.  The axis flags are
     486 *      written into the widget record.
     487 *
     488 *----------------------------------------------------------------------
     489 */
     490/*ARGSUSED*/
     491static int
     492ValueInterpParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin,
     493                     CONST84 char *string, char *widgRec, int offset)
     494{
     495    HotspotItem *itemPtr = (HotspotItem *)widgRec;
     496
     497    if (string[0] == '\0') {
     498        itemPtr->valueInterp = NULL;
     499        return TCL_OK;
     500    }
     501    itemPtr->valueInterp = Tcl_GetSlave(interp, string);
     502    if (itemPtr->valueInterp == NULL) {
     503        return TCL_ERROR;
     504    }
     505    return TCL_OK;
     506}
     507
     508/*
     509 *----------------------------------------------------------------------
     510 *
     511 * ValueInterpParseProc --
     512 *
     513 *      Convert the window coordinates into a string.
     514 *
     515 * Results:
     516 *      The string representing the coordinate position is returned.
     517 *
     518 *----------------------------------------------------------------------
     519 */
     520/*ARGSUSED*/
     521static char *
     522ValueInterpPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec,
     523                     int offset, Tcl_FreeProc **freeProcPtr)
     524{
     525    HotspotItem *itemPtr = (HotspotItem *)widgRec;
     526
     527    if (itemPtr->valueInterp != NULL) {
     528        Tcl_Obj *objPtr;
     529
     530        Tcl_GetInterpPath(itemPtr->interp, itemPtr->valueInterp);
     531        objPtr = Tcl_GetObjResult(itemPtr->interp);
     532        *freeProcPtr = TCL_VOLATILE;
     533        return Tcl_GetString(objPtr);
     534    }
     535    return "";
     536}
    468537
    469538/*
Note: See TracChangeset for help on using the changeset viewer.