summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-07-07 18:53:22 (GMT)
committerjoye <joye>2014-07-07 18:53:22 (GMT)
commit3e75328238011f0a9469c10604a0622926f82e70 (patch)
tree136c5fd11dd77cd2d83a6c413239904f8eeb567e /src
parent2ee980a2ccdee7f03cfe914e85d7a2ede2682d36 (diff)
downloadblt-3e75328238011f0a9469c10604a0622926f82e70.zip
blt-3e75328238011f0a9469c10604a0622926f82e70.tar.gz
blt-3e75328238011f0a9469c10604a0622926f82e70.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElem.C2
-rw-r--r--src/bltGrElem.h4
-rw-r--r--src/bltGrElemOption.C45
3 files changed, 15 insertions, 36 deletions
diff --git a/src/bltGrElem.C b/src/bltGrElem.C
index 17f74c1..7823a0a 100644
--- a/src/bltGrElem.C
+++ b/src/bltGrElem.C
@@ -42,9 +42,7 @@ using namespace Blt;
ElemValues::ElemValues()
{
- type = SOURCE_VALUES;
elemPtr =NULL;
- // vectorSource;
values =NULL;
nValues =0;
min =0;
diff --git a/src/bltGrElem.h b/src/bltGrElem.h
index 1402eac..665caff 100644
--- a/src/bltGrElem.h
+++ b/src/bltGrElem.h
@@ -64,10 +64,6 @@ namespace Blt {
class ElemValues {
public:
- enum ElemSource {SOURCE_VALUES, SOURCE_VECTOR};
-
- public:
- ElemSource type;
Element* elemPtr;
double *values;
int nValues;
diff --git a/src/bltGrElemOption.C b/src/bltGrElemOption.C
index 8c73056..5eeeea0 100644
--- a/src/bltGrElemOption.C
+++ b/src/bltGrElemOption.C
@@ -91,7 +91,6 @@ static int ValuesSetProc(ClientData clientData, Tcl_Interp* interp,
if ((objc == 1) && (Blt_VectorExists2(interp, string))) {
ElemValuesVector* valuesPtr = new ElemValuesVector();
valuesPtr->elemPtr = elemPtr;
- valuesPtr->type = ElemValues::SOURCE_VECTOR;
if (valuesPtr->GetVectorData(interp, string) != TCL_OK)
return TCL_ERROR;
*valuesPtrPtr = valuesPtr;
@@ -99,7 +98,6 @@ static int ValuesSetProc(ClientData clientData, Tcl_Interp* interp,
else {
ElemValuesSource* valuesPtr = new ElemValuesSource();
valuesPtr->elemPtr = elemPtr;
- valuesPtr->type = ElemValues::SOURCE_VALUES;
double* values;
int nValues;
@@ -120,32 +118,19 @@ static Tcl_Obj* ValuesGetProc(ClientData clientData, Tk_Window tkwin,
ElemValues* valuesPtr = *(ElemValues**)(widgRec + offset);
if (!valuesPtr)
- return Tcl_NewStringObj("", -1);
+ return Tcl_NewStringObj("", -1);
- switch (valuesPtr->type) {
- case ElemValues::SOURCE_VECTOR:
- {
- const char* vecName =
- Blt_NameOfVectorId(((ElemValuesVector*)valuesPtr)->vectorSource.vector);
- return Tcl_NewStringObj(vecName, -1);
- }
- case ElemValues::SOURCE_VALUES:
- {
- int cnt = valuesPtr->nValues;
- if (!cnt)
- return Tcl_NewListObj(0, (Tcl_Obj**)NULL);
-
- Tcl_Obj** ll = new Tcl_Obj*[cnt];
- for (int ii=0; ii<cnt; ii++)
- ll[ii] = Tcl_NewDoubleObj(valuesPtr->values[ii]);
- Tcl_Obj* listObjPtr = Tcl_NewListObj(cnt, ll);
- delete [] ll;
-
- return listObjPtr;
- }
- default:
- return Tcl_NewStringObj("", -1);
- }
+ int cnt = valuesPtr->nValues;
+ if (!cnt)
+ return Tcl_NewListObj(0, (Tcl_Obj**)NULL);
+
+ Tcl_Obj** ll = new Tcl_Obj*[cnt];
+ for (int ii=0; ii<cnt; ii++)
+ ll[ii] = Tcl_NewDoubleObj(valuesPtr->values[ii]);
+ Tcl_Obj* listObjPtr = Tcl_NewListObj(cnt, ll);
+ delete [] ll;
+
+ return listObjPtr;
}
static void ValuesFreeProc(ClientData clientData, Tk_Window tkwin, char *ptr)
@@ -408,14 +393,14 @@ static int ParseValues(Tcl_Interp* interp, Tcl_Obj *objPtr, int *nValuesPtr,
*arrayPtr = NULL;
*nValuesPtr = 0;
if (objc > 0) {
- double *p;
- int i;
-
double* array = new double[objc];
if (!array) {
Tcl_AppendResult(interp, "can't allocate new vector", NULL);
return TCL_ERROR;
}
+
+ double *p;
+ int i;
for (p = array, i = 0; i < objc; i++, p++) {
if (Tcl_GetDoubleFromObj(interp, objv[i], p) != TCL_OK) {
delete [] array;