int Measure::CastOffSystems( ArrayPtrVoid *params ) { // param 0: a pointer to the system we are taking the content from // param 1: a pointer the page we are adding system to // param 2: a pointer to the current system // param 3: the cummulated shift (m_drawingXRel of the first measure of the current system) // param 4: the system width // param 5: the current scoreDef width System *contentSystem = static_cast<System*>((*params).at(0)); Page *page = static_cast<Page*>((*params).at(1)); System **currentSystem = static_cast<System**>((*params).at(2)); int *shift = static_cast<int*>((*params).at(3)); int *systemWidth = static_cast<int*>((*params).at(4)); int *currentScoreDefWidth = static_cast<int*>((*params).at(5)); if ( ( (*currentSystem)->GetChildCount() > 0 ) && ( this->m_drawingXRel + this->GetWidth() + (*currentScoreDefWidth) - (*shift) > (*systemWidth) ) ) { (*currentSystem) = new System(); page->AddSystem( *currentSystem ); (*shift) = this->m_drawingXRel;; } // Special case where we use the Relinquish method. // We want to move the measure to the currentSystem. However, we cannot use DetachChild // from the content System because this screws up the iterator. Relinquish gives up // the ownership of the Measure - the contentSystem will be deleted afterwards. Measure *measure = dynamic_cast<Measure*>( contentSystem->Relinquish( this->GetIdx()) ); assert( measure ); (*currentSystem)->AddMeasure( measure ); return FUNCTOR_SIBLINGS; }
int ScoreDef::CastOffSystems( ArrayPtrVoid params ) { // param 0: a pointer to the system we are taking the content from // param 1: a pointer the page we are adding system to (unused) // param 2: a pointer to the current system // param 3: the cummulated shift (m_drawingXRel of the first measure of the current system) (unused) // param 4: the system width (unused) System *contentSystem = static_cast<System*>(params[0]); System **currentSystem = static_cast<System**>(params[2]); // Since the functor returns FUNCTOR_SIBLINGS we should never go lower than the system children assert( dynamic_cast<System*>(this->m_parent)); // Special case where we use the Relinquish method. // We want to move the measure to the currentSystem. However, we cannot use DetachChild // from the content System because this screws up the iterator. Relinquish gives up // the ownership of the Measure - the contentSystem will be deleted afterwards. ScoreDef *scoreDef = dynamic_cast<ScoreDef*>( contentSystem->Relinquish( this->GetIdx()) ); (*currentSystem)->AddScoreDef( scoreDef ); return FUNCTOR_SIBLINGS; }