本文整理汇总了C++中Page::AddSystem方法的典型用法代码示例。如果您正苦于以下问题:C++ Page::AddSystem方法的具体用法?C++ Page::AddSystem怎么用?C++ Page::AddSystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::AddSystem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CastOffSystems
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;
}
示例2: ImportString
bool DarmsInput::ImportString(std::string data_str) {
int len, res;
int pos = 0;
const char *data = data_str.c_str();
len = data_str.length();
m_doc->Reset( Raw );
System *system = new System();
Page *page = new Page();
m_staff = new Staff( 1 );
m_measure = new Measure( true, 1 );
m_layer = new Layer( 1 );
m_current_tie = NULL;
m_staff->AddLayer(m_layer);
m_measure->AddStaff( m_staff );
system->AddMeasure( m_measure );
// do this the C style, char by char
while (pos < len) {
char c = data[pos];
if (c == '!') {
LogDebug("DarmsInput: Global spec. at %i", pos);
res = do_globalSpec(pos, data);
if (res) pos = res;
// if notehead type was specified in the !Nx option preserve it
m_staff->notAnc = m_antique_notation;
} else if (isdigit(c) || c == '-' ) { // check for '-' too as note positions can be negative
//is number followed by '!' ? it is a clef
if (data[pos + 1] == '!') {
res = do_Clef(pos, data);
if (res) pos = res;
} else { // we assume it is a note
res = do_Note(pos, data, false);
if (res) pos = res;
}
} else if (c == 'R') {
res = do_Note(pos, data, true);
if (res) pos = res;
} else {
//if (!isspace(c))
//LogMessage("Other %c", c);
}
pos++;
}
// add miniaml scoreDef
StaffGrp *staffGrp = new StaffGrp();
StaffDef *staffDef = new StaffDef();
staffDef->SetStaffNo( 1 );
staffGrp->AddStaffDef( staffDef );
m_doc->m_scoreDef.AddStaffGrp( staffGrp );
page->AddSystem( system );
m_doc->AddPage( page );
return true;
}
示例3: LayOut
void Doc::LayOut( )
{
this->SetCurrentScoreDef();
Page *contentPage = this->SetDrawingPage( 0 );
assert( contentPage );
contentPage->LayOutHorizontally();
System *contentSystem = dynamic_cast<System*>(contentPage->DetachChild( 0 ));
assert( contentSystem );
System *currentSystem = new System();
contentPage->AddSystem( currentSystem );
int shift = 0;
int systemFullWidth = this->m_drawingPageWidth - this->m_drawingPageLeftMar - this->m_drawingPageRightMar
- currentSystem->m_systemLeftMar - currentSystem->m_systemRightMar;
ArrayPtrVoid params;
params.push_back( contentSystem );
params.push_back( contentPage );
params.push_back( ¤tSystem );
params.push_back( &shift );
params.push_back( &systemFullWidth );
Functor castOffSystems( &Object::CastOffSystems );
contentSystem->Process( &castOffSystems, params );
delete contentSystem;
LogDebug("Layout: %d systems", contentPage->GetSystemCount());
// Reset the scoreDef at the beginning of each system
this->SetCurrentScoreDef( true );
contentPage->LayOutVertically( );
// Detach the contentPage
this->DetachChild( 0 );
assert( contentPage && !contentPage->m_parent );
Page *currentPage = new Page();
this->AddPage( currentPage );
shift = 0;
int pageFullHeight = this->m_drawingPageHeight - this->m_drawingPageTopMar; // obviously we need a bottom margin
params.clear();
params.push_back( contentPage );
params.push_back( this );
params.push_back( ¤tPage );
params.push_back( &shift );
params.push_back( &pageFullHeight );
Functor castOffPages( &Object::CastOffPages );
contentPage->Process( &castOffPages, params );
delete contentPage;
LogDebug("Layout: %d pages", this->GetChildCount());
// We need to reset the drawing page to NULL
// because idx will still be 0 but contentPage is dead!
this->ResetDrawingPage( );
this->SetCurrentScoreDef( true );
}
示例4: LayOutContinuously
void Doc::LayOutContinuously( )
{
Page *contentPage = new Page();
System *contentSystem = new System();
contentPage->AddSystem( contentSystem );
ArrayPtrVoid params;
params.push_back( contentSystem );
Functor unCastOff( &Object::UnCastOff );
this->Process( &unCastOff, params );
this->ClearChildren();
this->AddPage(contentPage);
LogDebug("ContinousLayout: %d pages", this->GetChildCount());
// We need to reset the drawing page to NULL
// because idx will still be 0 but contentPage is dead!
this->ResetDrawingPage( );
this->SetCurrentScoreDef( true );
}
示例5: parsePlainAndEasy
//.........这里部分代码省略.........
if (current_measure.clef)
delete current_measure.clef;
current_measure.clef = c;
} else {
// as above
if (current_note.clef)
delete current_note.clef;
current_note.clef = c;
}
}
//time signature change
else if ((incipit[i] == '@') && (i+1 < length)) {
MeterSig *meter = new MeterSig;
i += getTimeInfo( incipit, meter, i + 1);
if (current_measure.notes.size() == 0) {
if (current_measure.meter) {
delete current_measure.meter;
}
// When will this be deleted? Potential memory leak? LP
current_measure.meter = meter;
} else {
if (current_note.meter) {
delete current_note.meter;
}
current_note.meter = meter;
}
}
//key signature change
else if ((incipit[i] == '$') && (i+1 < length)) {
KeySig *k = new KeySig;
i += getKeyInfo( incipit, k, i + 1);
if (current_measure.notes.size() == 0) {
if (current_measure.key)
delete current_measure.key;
current_measure.key = k;
} else {
if (current_note.key)
delete current_note.key;
current_note.key = k;
}
}
i++;
}
// we need to add the last measure if it has no barLine at the end
if (current_measure.notes.size() != 0) {
//current_measure.barLine = "=-";
staff.push_back( current_measure );
current_measure.notes.clear();
}
m_doc->Reset( Raw );
Page *page = new Page();
System *system = new System();
int measure_count = 1;
std::vector<MeasureObject>::iterator it;
for ( it = staff.begin() ; it < staff.end(); it++ ) {
m_staff = new Staff( 1 );
m_measure = new Measure( true, measure_count );
m_layer = new Layer( );
m_layer->SetN( 1 );
m_staff->AddLayer(m_layer);
m_measure->AddStaff( m_staff );
system->AddMeasure( m_measure );
MeasureObject obj = *it;
convertMeasure( &obj );
measure_count++;
}
// add miniaml scoreDef
StaffGrp *staffGrp = new StaffGrp();
StaffDef *staffDef = new StaffDef();
staffDef->SetN( 1 );
staffDef->SetLines(5);
if (staffDefClef) {
staffDef->SetClefShape(staffDefClef->GetShape());
staffDef->SetClefLine(staffDefClef->GetLine());
staffDef->SetClefDis(staffDefClef->GetDis());
staffDef->SetClefDisPlace(staffDefClef->GetDisPlace());
delete staffDefClef;
}
staffGrp->AddStaffDef( staffDef );
m_doc->m_scoreDef.AddStaffGrp( staffGrp );
page->AddSystem( system );
m_doc->AddPage( page );
}