Exemple #1
0
int pushStack(Stack *stack, Value *value) {
  int inserted = insertCell(stack->items, value);
  if (inserted)
    stack->size += 1;

  return inserted;
}
Exemple #2
0
    void Scene::loadCell (Ptr::CellStore *cell)
    {
        // register local scripts
        MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);



        std::pair<CellStoreCollection::iterator, bool> result =
            mActiveCells.insert(cell);

        if(result.second)
        {
            insertCell(*cell);
            mRendering.cellAdded (cell);

            float verts = ESM::Land::LAND_SIZE;
            float worldsize = ESM::Land::REAL_SIZE;

            if (!(cell->cell->data.flags & ESM::Cell::Interior))
            {
                ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cell->cell->data.gridX,cell->cell->data.gridY);
                if (land)
                    mPhysics->addHeightField (land->landData->heights,
                        cell->cell->data.gridX, cell->cell->data.gridY,
                        0, ( worldsize/(verts-1) ), verts);
            }

            mRendering.configureAmbient(*cell);
            mRendering.requestMap(cell);
            mRendering.configureAmbient(*cell);

        }

    }
Exemple #3
0
    void Scene::loadCell (CellStore *cell, Loading::Listener* loadingListener)
    {
        std::pair<CellStoreCollection::iterator, bool> result = mActiveCells.insert(cell);

        if(result.second)
        {
            float verts = ESM::Land::LAND_SIZE;
            float worldsize = ESM::Land::REAL_SIZE;

            // Load terrain physics first...
            if (cell->getCell()->isExterior())
            {
                ESM::Land* land =
                    MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
                        cell->getCell()->getGridX(),
                        cell->getCell()->getGridY()
                    );
                if (land) {
                    // Actually only VHGT is needed here, but we'll need the rest for rendering anyway.
                    // Load everything now to reduce IO overhead.
                    const int flags = ESM::Land::DATA_VCLR|ESM::Land::DATA_VHGT|ESM::Land::DATA_VNML|ESM::Land::DATA_VTEX;
                    if (!land->isDataLoaded(flags))
                        land->loadData(flags);
                    mPhysics->addHeightField (
                        land->mLandData->mHeights,
                        cell->getCell()->getGridX(),
                        cell->getCell()->getGridY(),
                        0,
                        worldsize / (verts-1),
                        verts)
                    ;
                }
            }

            cell->respawn();

            // ... then references. This is important for adjustPosition to work correctly.
            /// \todo rescale depending on the state of a new GMST
            insertCell (*cell, true, loadingListener);

            mRendering.cellAdded (cell);
            bool waterEnabled = cell->getCell()->hasWater();
            mRendering.setWaterEnabled(waterEnabled);
            if (waterEnabled)
            {
                mPhysics->enableWater(cell->getWaterLevel());
                mRendering.setWaterHeight(cell->getWaterLevel());
            }
            else
                mPhysics->disableWater();

            mRendering.configureAmbient(*cell);
        }

        // register local scripts
        // ??? Should this go into the above if block ???
        MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);
    }
void FieldGUIController::prepareField()
{
  clearChildren();
  insertLayout();
  insertCell(0,0,":/Graph/White.png");
  for (int i=1; i<=10; i++) {
      insertCell(i,0,":/Graph/Dig/"+QString::number(i)+".png");
    }
  for (int i=1; i<=10; i++) {
      insertCell(0,i,":/Graph/Sum/"+QString::number(i)+".png");
    }
  for(int i=1;i<=10;i++) {
      for(int j=1;j<=10;j++) {
          insertCell(i,j,":/Graph/Ships/Empty.png");
          makeCellHoverSensitiveAndClicable(i,j,"red");
        }
    }
}
Exemple #5
0
List *deepCopy(List *listToCopy) {
  Value *head = listToCopy->head;
  Value *newValue = NULL;
  List *newList = (List *)malloc(sizeof(List));
  

  while (head) {   
    newValue = (Value *) malloc(sizeof(Value));
    switch (head->cons->car->type) {
      case booleanType:
        newValue->type = booleanType;
        newValue->boolValue = head->cons->car->boolValue;
	break;
      case integerType:
	newValue->type = integerType;
	newValue->intValue = head->cons->car->intValue;
	break;
      case floatType:
	newValue->type = floatType;
	newValue->dblValue = head->cons->car->dblValue;
	break;
      case stringType:
	newValue->type = stringType;
	newValue->stringValue = (char *)malloc(sizeof(char)*
					       strlen(head->stringValue));
	strcpy(newValue->stringValue,
	     head->cons->car->stringValue);
	break;
      case symbolType:
	newValue->type = symbolType;
	newValue->symbolValue = (char *)malloc(sizeof(char)*
				    strlen(head->cons->car->symbolValue));
	strcpy(newValue->symbolValue,
	     head->cons->car->symbolValue);
	break;
      case openType:
	newValue->type = openType;
	newValue->open = head->cons->car->open;
	break;
      case closeType:
	newValue->type = closeType;
	newValue->close = head->cons->car->close;
	break;
      default:
	break;
    }
    insertCell(newList, newValue);
    head = head->cons->cdr;
  }
    
  reverse(newList);
  
  return newList;
}
Exemple #6
0
void GridView::updateCellAtIndex(int idx, int row)
{
    if (0 >= _cellCounts) return;
 
    GridViewCell* pCell = GridViewCell::create(Color4B(0, 0, 255, 255));
    pCell->setIdx(idx);
    pCell->setRow(row);
    pCell->setAnchorPoint(Vec2(0, 1));
    pCell->setContentSize(_cellSize);
    pCell->setPosition(cellPosition(idx, row));
    _container->addChild(pCell);
    insertCell(pCell, idx);
//    pCell->retain();
    
    _idxIndices.insert(idx);
}
Exemple #7
0
    void Scene::loadCell (Ptr::CellStore *cell)
    {
        // register local scripts
        mWorld->getLocalScripts().addCell (cell);



        std::pair<CellStoreCollection::iterator, bool> result =
            mActiveCells.insert(cell);
       if(result.second){
              insertCell(*cell, mEnvironment);
               mRendering.cellAdded (cell);
               mRendering.configureAmbient(*cell);

        }


    }
Exemple #8
0
    void Scene::loadCell (CellStore *cell, Loading::Listener* loadingListener)
    {
        std::pair<CellStoreCollection::iterator, bool> result = mActiveCells.insert(cell);

        if(result.second)
        {
            float verts = ESM::Land::LAND_SIZE;
            float worldsize = ESM::Land::REAL_SIZE;

            // Load terrain physics first...
            if (cell->getCell()->isExterior())
            {
                ESM::Land* land =
                    MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
                        cell->getCell()->getGridX(),
                        cell->getCell()->getGridY()
                    );
                if (land) {
                    mPhysics->addHeightField (
                        land->mLandData->mHeights,
                        cell->getCell()->getGridX(),
                        cell->getCell()->getGridY(),
                        0,
                        worldsize / (verts-1),
                        verts)
                    ;
                }
            }

            cell->respawn();

            // ... then references. This is important for adjustPosition to work correctly.
            /// \todo rescale depending on the state of a new GMST
            insertCell (*cell, true, loadingListener);

            mRendering.cellAdded (cell);

            mRendering.configureAmbient(*cell);
        }

        // register local scripts
        // ??? Should this go into the above if block ???
        MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);
    }
Exemple #9
0
    void Scene::loadCell (Ptr::CellStore *cell)
    {
        // register local scripts
        MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);
        std::pair<CellStoreCollection::iterator, bool> result = mActiveCells.insert(cell);

        if(result.second)
        {
            /// \todo rescale depending on the state of a new GMST
            insertCell (*cell, true);

            mRendering.cellAdded (cell);

            float verts = ESM::Land::LAND_SIZE;
            float worldsize = ESM::Land::REAL_SIZE;

            if (cell->mCell->isExterior())
            {
                ESM::Land* land =
                    MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
                        cell->mCell->getGridX(),
                        cell->mCell->getGridY()
                    );
                if (land) {
                    mPhysics->addHeightField (
                        land->mLandData->mHeights,
                        cell->mCell->getGridX(),
                        cell->mCell->getGridY(),
                        0,
                        worldsize / (verts-1),
                        verts)
                    ;
                }
            }

            mRendering.configureAmbient(*cell);
            mRendering.requestMap(cell);
            mRendering.configureAmbient(*cell);
        }
    }
setColValuesDialog::setColValuesDialog( ScriptingEnv *env, QWidget* parent,  const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
  scriptEnv = env;
    if ( !name )
	setName( "setColValuesDialog" );
    setCaption( tr( "QtiPlot - Set column values" ) );
    setFocusPolicy( QDialog::StrongFocus );
	
	QHBox *hbox1=new QHBox (this, "hbox1"); 
	hbox1->setSpacing (5);
	
	QVBox *box1=new QVBox (hbox1, "box2"); 
	box1->setSpacing (5);

	explain = new QTextEdit(box1, "explain" );
	explain->setReadOnly (true);
	explain->setPaletteBackgroundColor(QColor(197, 197, 197));
	
	colNameLabel = new QLabel(box1, "colNameLabel" );

	QVBox *box2=new QVBox (hbox1, "box2"); 
	box2->setMargin(5);
	box2->setFrameStyle (QFrame::Box);

	QHBox *hbox2=new QHBox (box2, "hbox2"); 
	hbox2->setMargin(5);
	hbox2->setSpacing (5);
	
	QLabel *TextLabel1 = new QLabel(hbox2, "TextLabel1" );
    TextLabel1->setText( tr( "For row (i)" ) );
	
	start = new QSpinBox(hbox2, "start" );
   
    QLabel *TextLabel2 = new QLabel(hbox2, "TextLabel2" );
    TextLabel2->setText( tr( "to" ) );

    end = new QSpinBox(hbox2, "end" );

    start->setMinValue(1);
    end->setMinValue(1);
    if (sizeof(int)==2)
	 { // 16 bit signed integer
	 start->setMaxValue(0x7fff);
	 end->setMaxValue(0x7fff);
	 }
    else
	 { // 32 bit signed integer
	 start->setMaxValue(0x7fffffff);
	 end->setMaxValue(0x7fffffff);
	 }
  
	QButtonGroup *GroupBox0 = new QButtonGroup(2,QGroupBox::Horizontal,tr( "" ),box2, "GroupBox0" );
	GroupBox0->setLineWidth(0);
	GroupBox0->setFlat(true);

    functions = new QComboBox( FALSE, GroupBox0, "functions" );
	
	PushButton3 = new QPushButton(GroupBox0, "PushButton3" );
    PushButton3->setText( tr( "Add function" ) );
    
    boxColumn = new QComboBox( FALSE, GroupBox0, "boxColumn" );
   
    PushButton4 = new QPushButton(GroupBox0, "PushButton4" );
    PushButton4->setText( tr( "Add column" ) );

	QHBox *hbox6=new QHBox (GroupBox0, "hbox6"); 
	hbox6->setSpacing (5);

	buttonPrev = new QPushButton( hbox6, "buttonPrev" );
	buttonPrev->setText("&<<");

	buttonNext = new QPushButton( hbox6, "buttonNext" );
	buttonNext->setText("&>>");

	addCellButton = new QPushButton(GroupBox0, "addCellButton" );
    addCellButton->setText( tr( "Add cell" ) );

	QHBox *hbox3=new QHBox (this, "hbox3"); 
	hbox3->setSpacing (5);
	
	commandes = new ScriptEdit( env, hbox3, "commandes" );
    commandes->setGeometry( QRect(10, 100, 260, 70) );
	commandes->setFocus();
	
	QVBox *box3=new QVBox (hbox3,"box3"); 
	box3->setSpacing (5);
	
    btnOk = new QPushButton(box3, "btnOk" );
    btnOk->setText( tr( "OK" ) );

	btnApply = new QPushButton(box3, "btnApply" );
    btnApply->setText( tr( "Apply" ) );

    btnCancel = new QPushButton( box3, "btnCancel" );
    btnCancel->setText( tr( "Cancel" ) );
	
	QVBoxLayout* layout = new QVBoxLayout(this,5,5, "hlayout3");
    layout->addWidget(hbox1);
	layout->addWidget(hbox3);

setFunctions();
insertExplain(0);

connect(PushButton3, SIGNAL(clicked()),this, SLOT(insertFunction()));
connect(PushButton4, SIGNAL(clicked()),this, SLOT(insertCol()));
connect(addCellButton, SIGNAL(clicked()),this, SLOT(insertCell()));
connect(btnOk, SIGNAL(clicked()),this, SLOT(accept()));
connect(btnApply, SIGNAL(clicked()),this, SLOT(apply()));
connect(btnCancel, SIGNAL(clicked()),this, SLOT(close()));
connect(functions, SIGNAL(activated(int)),this, SLOT(insertExplain(int)));
connect(buttonPrev, SIGNAL(clicked()), this, SLOT(prevColumn()));
connect(buttonNext, SIGNAL(clicked()), this, SLOT(nextColumn()));
}
SetColValuesDialog::SetColValuesDialog( ScriptingEnv *env, QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl ), scripted(env)
{
    setName( "SetColValuesDialog" );
	setWindowTitle( tr( "QtiPlot - Set column values" ) );
	setSizeGripEnabled(true);

	QHBoxLayout *hbox1 = new QHBoxLayout();
	hbox1->addWidget(new QLabel(tr("For row (i)")));
	start = new QSpinBox();
	start->setMinValue(1);
	hbox1->addWidget(start);

	hbox1->addWidget(new QLabel(tr("to")));

	end = new QSpinBox();
	end->setMinValue(1);
	hbox1->addWidget(end);

	if (sizeof(int)==2)
	{ // 16 bit signed integer
		start->setMaxValue(0x7fff);
		end->setMaxValue(0x7fff);
	}
	else
	{ // 32 bit signed integer
		start->setMaxValue(0x7fffffff);
		end->setMaxValue(0x7fffffff);
	}

	QGridLayout *gl1 = new QGridLayout();
	functions = new QComboBox(false);
	gl1->addWidget(functions, 0, 0);
	btnAddFunction = new QPushButton(tr( "Add function" ));
	gl1->addWidget(btnAddFunction, 0, 1);
	boxColumn = new QComboBox(false);
	gl1->addWidget(boxColumn, 1, 0);
	btnAddCol = new QPushButton(tr( "Add column" ));
	gl1->addWidget(btnAddCol, 1, 1);

	QHBoxLayout *hbox3 = new QHBoxLayout();
	hbox3->addStretch();
	buttonPrev = new QPushButton("&<<");
	hbox3->addWidget(buttonPrev);
	buttonNext = new QPushButton("&>>");
	hbox3->addWidget(buttonNext);
	gl1->addLayout(hbox3, 2, 0);
	addCellButton = new QPushButton(tr( "Add cell" ));
	gl1->addWidget(addCellButton, 2, 1);

	QGroupBox *gb = new QGroupBox();
	QVBoxLayout *vbox1 = new QVBoxLayout();
	vbox1->addLayout(hbox1);
	vbox1->addLayout(gl1);
	gb->setLayout(vbox1);
	gb->setSizePolicy(QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred));

	explain = new QTextEdit();
	explain->setReadOnly (true);
	explain->setSizePolicy(QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred));
	QPalette palette = explain->palette();
	palette.setColor(QPalette::Active, QPalette::Base, Qt::lightGray);
	explain->setPalette(palette);

	QHBoxLayout *hbox2 = new QHBoxLayout();
	hbox2->addWidget(explain);
	hbox2->addWidget(gb);

	commands = new ScriptEdit( scriptEnv);

	QVBoxLayout *vbox2 = new QVBoxLayout();
	btnApply = new QPushButton(tr( "&Apply" ));
	vbox2->addWidget(btnApply);
	btnCancel = new QPushButton(tr( "&Close" ));
	vbox2->addWidget(btnCancel);
	vbox2->addStretch();

	QHBoxLayout *hbox4 = new QHBoxLayout();
	hbox4->addWidget(commands);
	hbox4->addLayout(vbox2);

	QVBoxLayout* vbox3 = new QVBoxLayout();
	vbox3->addLayout(hbox2);
#ifdef SCRIPTING_PYTHON
	boxMuParser = NULL;
	if (env->name() != QString("muParser")){
		boxMuParser = new QCheckBox(tr("Use built-in muParser (much faster)"));
		boxMuParser->setChecked(true);
		vbox3->addWidget(boxMuParser);
	}
#endif

	colNameLabel = new QLabel();
	vbox3->addWidget(colNameLabel);
	vbox3->addLayout(hbox4);

	setLayout(vbox3);
	setFocusProxy (commands);
	commands->setFocus();

	functions->insertStringList(scriptEnv->mathFunctions(), -1);
	if (functions->count() > 0)
		insertExplain(0);

	connect(btnAddFunction, SIGNAL(clicked()),this, SLOT(insertFunction()));
	connect(btnAddCol, SIGNAL(clicked()),this, SLOT(insertCol()));
	connect(addCellButton, SIGNAL(clicked()),this, SLOT(insertCell()));
	connect(btnApply, SIGNAL(clicked()),this, SLOT(apply()));
	connect(btnCancel, SIGNAL(clicked()),this, SLOT(close()));
	connect(functions, SIGNAL(activated(int)),this, SLOT(insertExplain(int)));
	connect(buttonPrev, SIGNAL(clicked()), this, SLOT(prevColumn()));
	connect(buttonNext, SIGNAL(clicked()), this, SLOT(nextColumn()));
}
Exemple #12
0
List *tokenize(char *expression) {
  
  int i; // counter for expression

  int numStart, numEnd, stringStart,
  symbolStart, symbolEnd;// record the start and ends of the floats

  numStart = numEnd = symbolStart = symbolEnd = stringStart = 0;

  i = 0;
  
  float floatNum;
  int intNum;
  char scratchFloat[256]; // I assume there isn't any float that has more than 256 digits.
  char *scratchString; 
  char scratchInt[256]; // same thing for int
  char *scratchSymbol;
  int isFloat = 0;
  int notDigit = 0;
  char *boolString;
  int boolStart = 0;
  int boolEnd = 0;

  Value *newValue;
  List *list = initializeList();
  // now while loop that does main work

  while (expression[i] != '\n' && expression[i] != EOF && expression[i]!='\0') {
    if (isspace(expression[i])) {
      i++; 
      continue;
    }
    
    if (expression[i] == ';') {
      break; // comment so get out
    }
    if (isdigit(expression[i]) || expression[i]=='.'
	|| expression[i]=='-' || expression[i]=='+') {
      numStart = i;
      if (expression[i] == '.') {
	isFloat=1; 
      }
      i++; 
      
      // handle numbers here
      while ((!isspace(expression[i])) 
	     && expression[i] != ')'
	     && expression[i] != '('
	     && expression[i] != '"'
	     && expression[i] != ';') {


	if (expression[i] == '.') {
	  if (isFloat){
	    notDigit =1;
	  }
	  isFloat=1; 
	  i++; 
	  continue;
	}
	
	if (!isdigit(expression[i])) {
	  // then we know it's not a digit but a symbol
	  notDigit = 1;
	}
	i++;
      }
      
      i--;
      numEnd = i;
      if (numStart == numEnd && (!isdigit(expression[numStart]))){
	notDigit = 1;
      }
      if (isFloat && !notDigit) {
	
	strncpy(scratchFloat,
		&expression[numStart],
		numEnd - numStart + 1);
	scratchFloat[numEnd-numStart +1] = '\0';
	floatNum = atof(scratchFloat);
	// ====== USE ME ======== I'M A FLOAT
	// USE ME IN FLOATNUM
	
	newValue = (Value *)malloc(sizeof(Value));
	newValue->type = floatType;
	newValue->dblValue = floatNum;
	insertCell(list, newValue);
      } else if (!isFloat && !notDigit) {
	strncpy(scratchInt,
		&expression[numStart],
		numEnd - numStart + 1);
	scratchInt[numEnd-numStart + 1] = '\0';
	intNum = atoi(scratchInt);
	
	// ========== USE ========== I'M AN INT
	// USE ME IN INTNUM
	newValue = (Value *)malloc(sizeof(Value));
	newValue->type = integerType;
	newValue->intValue = intNum;
	insertCell(list, newValue);
	
      } 
      
      if (notDigit) {
	// if it's not a digit, then it's probably a symbol
	// ======= USE ME ======= I'M A SYMBOL
	int length = numEnd - numStart + 1;
	scratchSymbol = (char *)malloc(sizeof(char)  * (length+1));
	
	strncpy(scratchSymbol,
		&expression[numStart],
		length);
	
	scratchSymbol[length] = '\0';
	newValue = (Value *)malloc(sizeof(Value));
	newValue->type = symbolType;
	newValue->symbolValue = scratchSymbol;
	insertCell(list, newValue);
      }
      
      isFloat = notDigit = 0;
      i++;
      continue;
    }
    
    // == GOING INTO THE SWITCH STATEMENT ==
    switch(expression[i]) { // these are for chars and strings
    case '(':
      // === USE ME === OPEN PARENS
      while (isspace(expression[i+1])){
	i++;
      }
      newValue = (Value *)malloc(sizeof(Value));
      newValue->type = openType;
      newValue->open = '(';
      insertCell(list, newValue);
      
      break;
    case ')':
      // ======= USE ME ======== CLOSE PARENS
      newValue = (Value *)malloc(sizeof(Value));
      newValue->type = closeType;
      newValue->close = ')';
      insertCell(list, newValue);
      break;
    case '"':
      stringStart = i;
      while (expression[++i] != '"'){
	if (expression[i]=='\n'|| expression[i]=='\0'){
	  reverse(list);
	  return list;
	}
      }
    
      
      scratchString = (char *)malloc(sizeof(char) * (i-stringStart+2));
      strncpy(scratchString, 
	      &expression[stringStart],
	      i - stringStart+1);
      scratchString[i-stringStart +1] = '\0'; // terminate the string
      
      // ======== USE ME ========== STRING
      // I'm in scratchString
       newValue = (Value *)malloc(sizeof(Value));
       newValue->type = stringType;
       newValue->stringValue = scratchString;
       insertCell(list, newValue);
    
      break;
    case '#':
      boolStart= i;
      while (!isspace(expression[i]) && 
	     expression[i] != ')' &&
	     expression[i] != '(' &&
	     expression[i] != ';' &&
	     expression[i] != '"' &&
	     expression[i] != '\n'){
	i++;
      }
      i--;
      boolEnd = i;
      if (boolEnd<boolStart){
	i++;
      }
      
      newValue = (Value *)malloc(sizeof(Value));
     
      boolString = (char *)malloc(sizeof(char)*(boolEnd-boolStart+2));
      strncpy(boolString, 
	      &expression[boolStart],
	      boolEnd-boolStart+1);
      boolString[boolEnd-boolStart+1] ='\0'; 
      if ((strcmp(boolString,"#f")==0) || (strcmp(boolString,"#F")==0) || (strcmp(boolString,"#false")==0)){
	newValue->type = booleanType;
	newValue->boolValue = 0;
	insertCell(list, newValue);
	free(boolString);
      }else if ((strcmp(boolString,"#t")==0) ||(strcmp(boolString,"#T")==0) || (strcmp(boolString,"#true")==0)) {
	newValue->type = booleanType;
	newValue->boolValue = 1;
	insertCell(list, newValue);
	free(boolString);
      }
      else{
	newValue->type = symbolType;
	newValue->symbolValue = boolString;
	insertCell(list, newValue);
      }
      break;
      
    default:
      // every other thing is a symbol
      symbolStart = i;

      while (expression[i] != '(' &&
	     expression[i] != ')' &&
	     expression[i] != ';' &&
	     expression[i] != '"' &&
	     !isspace(expression[i]) &&
	     expression[i] != '\n'
	     ) {
	i++;
      }
      i--; // take me to the end of the symbol
      symbolEnd = i;
      if (symbolEnd<symbolStart){
	i++;
      }
     
      scratchSymbol = (char *) malloc(sizeof(char) *
				      (symbolEnd - symbolStart + 2));
      strncpy(scratchSymbol,
	      &expression[symbolStart],
	      (symbolEnd-symbolStart+1));
      
      scratchSymbol[symbolEnd-symbolStart+1] = '\0';
      newValue = (Value *)malloc(sizeof(Value));
      newValue->type = symbolType;
      newValue->symbolValue = scratchSymbol;
      insertCell(list, newValue);
      // USE ME ================== I'M A SYMBOL
	break;
    }

    i++;

  }
  if (!list->head){
    return NULL;
  }
  reverse(list);
  return list;   
}
SetColValuesDialog::SetColValuesDialog(ScriptingEnv *env, Table *t,
                                       Qt::WFlags fl)
    : QDialog(t, fl), Scripted(env) {
  setObjectName("SetColValuesDialog");
  setWindowTitle(tr("MantidPlot - Set column values"));
  setSizeGripEnabled(true);

  QHBoxLayout *hbox1 = new QHBoxLayout();
  hbox1->addWidget(new QLabel(tr("For row (i)")));
  start = new QSpinBox();
  start->setMinimum(1);
  hbox1->addWidget(start);

  hbox1->addWidget(new QLabel(tr("to")));

  end = new QSpinBox();
  end->setMinimum(1);
  hbox1->addWidget(end);

  // Ideally this would be checked at compile time. Until we have 'constexpr if`
  // on all platforms, the added complexity and minimal cost isn't worthwhile.
  if (sizeof(int) == 2) { // 16 bit signed integer
    start->setMaximum(0x7fff);
    end->setMaximum(0x7fff);
  } else { // 32 bit signed integer
    start->setMaximum(0x7fffffff);
    end->setMaximum(0x7fffffff);
  }

  QGridLayout *gl1 = new QGridLayout();
  boxColumn = new QComboBox();
  gl1->addWidget(boxColumn, 1, 0);
  btnAddCol = new QPushButton(tr("Add column"));
  gl1->addWidget(btnAddCol, 1, 1);

  QHBoxLayout *hbox3 = new QHBoxLayout();
  hbox3->addStretch();
  buttonPrev = new QPushButton("&<<");
  hbox3->addWidget(buttonPrev);
  buttonNext = new QPushButton("&>>");
  hbox3->addWidget(buttonNext);
  gl1->addLayout(hbox3, 2, 0);
  addCellButton = new QPushButton(tr("Add cell"));
  gl1->addWidget(addCellButton, 2, 1);

  QGroupBox *gb = new QGroupBox();
  QVBoxLayout *vbox1 = new QVBoxLayout();
  vbox1->addLayout(hbox1);
  vbox1->addLayout(gl1);
  gb->setLayout(vbox1);
  gb->setSizePolicy(
      QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));

  explain = new QTextEdit();
  explain->setReadOnly(true);
  explain->setSizePolicy(
      QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
  QPalette palette = explain->palette();
  palette.setColor(QPalette::Active, QPalette::Base, Qt::lightGray);
  explain->setPalette(palette);

  QHBoxLayout *hbox2 = new QHBoxLayout();
  hbox2->addWidget(explain);
  hbox2->addWidget(gb);

  commands = new ScriptEditor(this, scriptingEnv()->createCodeLexer());

  QVBoxLayout *vbox2 = new QVBoxLayout();
  btnApply = new QPushButton(tr("&Apply"));
  vbox2->addWidget(btnApply);
  btnCancel = new QPushButton(tr("&Close"));
  vbox2->addWidget(btnCancel);
  vbox2->addStretch();

  QHBoxLayout *hbox4 = new QHBoxLayout();
  hbox4->addWidget(commands);
  hbox4->addLayout(vbox2);

  QVBoxLayout *vbox3 = new QVBoxLayout();
  vbox3->addLayout(hbox2);

  colNameLabel = new QLabel();
  vbox3->addWidget(colNameLabel);
  vbox3->addLayout(hbox4);

  setLayout(vbox3);
  setFocusProxy(commands);
  commands->setFocus();

  connect(btnAddCol, SIGNAL(clicked()), this, SLOT(insertCol()));
  connect(addCellButton, SIGNAL(clicked()), this, SLOT(insertCell()));
  connect(btnApply, SIGNAL(clicked()), this, SLOT(apply()));
  connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
  connect(buttonPrev, SIGNAL(clicked()), this, SLOT(prevColumn()));
  connect(buttonNext, SIGNAL(clicked()), this, SLOT(nextColumn()));

  setTable(t);
}
PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableRowElement::insertCell(ExceptionState& exceptionState)
{
    // The default 'index' argument value is -1.
    return insertCell(-1, exceptionState);
}
Exemple #15
0
int push(List *list, Value *value){
  return insertCell(list, value);
}