Пример #1
0
/* - Params */
void setParam(unit *u, paramType type, paramOption option, float val) { /* sets value of a param to static value */
	float **p, **pLoc;
	int i;

	p = getParamAddress(u, type, option, 0); /* get pointer to the value. if unit is global there is only one, if local we only need the first one here */

	if (!isGlobalParam(p)) { /* create a new static value, if value is no */
		*p = addGlobalParam();
	}

	if (u->scope == usLOCAL) { /* if unit is local, set all values of inner units to the same value */
		for (i = 1; i < voiceCount; i++) {
			pLoc = getParamAddress(u, type, option, i); /* get pointer to the value to set */
			*pLoc = *p;
		}
	}

	**p = val; /* cahnge content of the value to specified value */
}
Пример #2
0
ModelWidget::ModelWidget(QWidget* Parent, openfluid::fluidx::AdvancedFluidXDescriptor& AFXDesc):
  WorkspaceWidget(Parent, AFXDesc), ui(new Ui::ModelWidget), m_Model(AFXDesc.model())
{
  ui->setupUi(this);

  mp_WaresManWidget = new WaresManagementWidget(this,true);
  ui->ModelTabWidget->insertTab(0,mp_WaresManWidget,"Management");
  ui->ModelTabWidget->setCurrentIndex(0);

  ui->GraphicalView->setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing);
  mp_ModelScene = new ModelScene(m_Model,this);
  ui->GraphicalView->setScene(mp_ModelScene);

  mp_ShowHideGlobalParamsLabel = new openfluid::ui::common::ActionLabel(tr("show"),ui->GlobalParamsWidget);
  ui->GlobalParamsTitleLayout->insertWidget(1,mp_ShowHideGlobalParamsLabel);
  ui->GlobalParamsManagementWidget->setVisible(false);

  ui->AddGlobalParamButton->setText("");
  ui->AddGlobalParamButton->setIcon(QIcon(":/ui/common/icons/add.png"));
  ui->AddGlobalParamButton->setIconSize(QSize(20,20));

  mp_WaresManWidget->ui->AddWareFirstButton->setText(tr("Add simulator"));
  mp_WaresManWidget->ui->AddWareSecondButton->setText(tr("Add generator"));

  connect(mp_ShowHideGlobalParamsLabel,SIGNAL(clicked()),this,SLOT(updateShowHideGlobalParams()));
  connect(ui->AddGlobalParamButton,SIGNAL(clicked()),this,SLOT(addGlobalParam()));

  connect(mp_WaresManWidget->ui->AddWareFirstButton,SIGNAL(clicked()),this,SLOT(addSimulator()));
  connect(mp_WaresManWidget->ui->AddWareSecondButton,SIGNAL(clicked()),this,SLOT(addGenerator()));

  connect(ui->FitViewButton,SIGNAL(clicked()),ui->GraphicalView,SLOT(fitViewToItems()));
  connect(ui->ResetViewButton,SIGNAL(clicked()),ui->GraphicalView,SLOT(resetView()));
  connect(ui->PNGExportButton,SIGNAL(clicked()),ui->GraphicalView,SLOT(exportSceneAsPNG()));
  connect(ui->SVGExportButton,SIGNAL(clicked()),ui->GraphicalView,SLOT(exportSceneAsSVG()));

  refresh();

  connect(ui->ShowVarsCheckBox,SIGNAL(clicked(bool)),mp_ModelScene,SLOT(showVariables(bool)));

  connect(mp_ModelScene,SIGNAL(srcEditAsked(const QString&,bool)),this,SLOT(notifySrcEditAsked(const QString&,bool)));
}