1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
/* Copyright INRIA */
/* UI generator main routine */
/* Bertrand Guiheneuf, INRIA 1997 */
#include "C-LAB_Interf.h"
#include <math.h>
#include <stdio.h>
#include "tksci.h"
#include "TK_uicontrol.h"
void LAB_figure()
{
Matrix **MVars;
int NbParam;
int NbChamps;
int i;
char MyCommand[2000];
char *StrHandle;
int Handle=0;
Matrix *Mfield;
Matrix *Mvalue;
Matrix *MOutputHandle;
double *OutputHandle;
int FigureHandle=0;
int FirstField=0;
NbParam = Interf.NbParamIn;
if ( (NbParam >0) && MatrixIsNumeric(Interf.Param[0]) )
/* the first parameter is a figure handle */
{
FigureHandle = (int)(floor( MatrixGetScalar(Interf.Param[0]) ) );
FirstField = 1;
sprintf(MyCommand, "set MyTmpBertrand [FigureSelect %d];", FigureHandle);
Tcl_Eval(TKinterp,MyCommand);
StrHandle = Tcl_GetVar(TKinterp, "MyTmpBertrand", 0);
Handle = (int)atoi(StrHandle);
} else {
/* creation of a figure */
sprintf(MyCommand, "set MyTmpBertrand [CreateFigure 0];");
Tcl_Eval(TKinterp,MyCommand);
StrHandle = Tcl_GetVar(TKinterp, "MyTmpBertrand", 0);
Handle = (int)atoi(StrHandle);
}
/* Now let's set all properties for the uicontrol */
for (i=FirstField; i<NbParam; i++)
{
Mfield = Interf.Param[i];
if (++i==NbParam)
{
InterfError("figure :The last value is missing \n");
return;
}
else Mvalue = Interf.Param[i];
TK_UiSet(Handle, Mfield, Mvalue);
}
MOutputHandle = MatrixCreate(1,1,"real");
OutputHandle = (double *)MatrixGetPr(MOutputHandle);
*OutputHandle = Handle;
ReturnParam(MOutputHandle);
}
|