Ejemplo n.º 1
0
Function* FunctionManager::copyFunction(t_function_id fid)
{
	Function* newFunction = NULL;
	QString msg;

	Function* function = _app->doc()->function(fid);
	Q_ASSERT(function != NULL);

	switch(function->type())
	{
	case Function::Scene:
	{
		newFunction = _app->doc()->newFunction(Function::Scene);
		Scene* scene = static_cast<Scene*> (newFunction);
		scene->copyFrom(static_cast<Scene*> (function));
		scene->setName("Copy of " + function->name());
	}
	break;

	case Function::Chaser:
	{
		newFunction = _app->doc()->newFunction(Function::Chaser);
		Chaser* chaser = static_cast<Chaser*> (newFunction);
		chaser->copyFrom(static_cast<Chaser*> (function));
		chaser->setName("Copy of " + function->name());
	}
	break;

	case Function::Collection:
	{
		newFunction =
			_app->doc()->newFunction(Function::Collection);

		Collection* fc = static_cast<Collection*> (newFunction);
		fc->copyFrom(static_cast<Collection*> (function));
		fc->setName("Copy of " + function->name());
	}
	break;

	case Function::EFX:
	{
		newFunction = _app->doc()->newFunction(Function::EFX);
		EFX* efx = static_cast<EFX*> (newFunction);
		efx->copyFrom(static_cast<EFX*> (function));
		efx->setName("Copy of " + function->name());
	}
	break;

	default:
		newFunction = NULL;
		break;
	}

	return newFunction;
}
Ejemplo n.º 2
0
void DeviceManagerView::copyFunction(Function* function, Device* device)
{
  switch(function->type())
    {
    case Function::Scene:
      {
	Scene* scene = static_cast<Scene*>
	  (_app->doc()->newFunction(Function::Scene));

	scene->copyFrom(static_cast<Scene*> (function), device->id());
      }
      break;

    case Function::Chaser:
      {
	Chaser* chaser = static_cast<Chaser*>
	  (_app->doc()->newFunction(Function::Chaser));

	chaser->copyFrom(static_cast<Chaser*> (function));
	assert(device == NULL);
      }
      break;

    case Function::Collection:
      {
	FunctionCollection* fc = static_cast<FunctionCollection*>
	  (_app->doc()->newFunction(Function::Collection));

	fc->copyFrom(static_cast<FunctionCollection*> (function));
	assert(device == NULL);
      }
      break;

    case Function::Sequence:
      {
	Sequence* sequence = static_cast<Sequence*> 
	  (_app->doc()->newFunction(Function::Sequence));
	
	sequence->copyFrom(static_cast<Sequence*> (function), device->id());
      }
      break;

    default:
      break;
    }
}