int32 _BStyleRecordBuffer_::InsertRecord(const BFont *inFont, const rgb_color *inColor) { int32 index = 0; // look for style in buffer if (MatchRecord(inFont, inColor, &index)) return index; // style not found, add it font_height fh; inFont->GetHeight(&fh); // check if there's any unused space for (index = 0; index < fItemCount; index++) { if (fBuffer[index].refs < 1) { fBuffer[index].refs = 0; fBuffer[index].ascent = fh.ascent; fBuffer[index].descent = fh.descent + fh.leading; fBuffer[index].style.font = *inFont; fBuffer[index].style.color = *inColor; return index; } } // no unused space, expand the buffer index = fItemCount; STEStyleRecord newRecord; newRecord.refs = 0; newRecord.ascent = fh.ascent; newRecord.descent = fh.descent + fh.leading; newRecord.style.font = *inFont; newRecord.style.color = *inColor; InsertItemsAt(1, index, &newRecord); return index; }
void ChoiceTable::TreeList(int input_vertex, int reference_vertex, TreeGraphPtr T1, TreeGraphPtr T2, MatchRecordList& sequence){ if ((!T1->isNull())&&(!T2->isNull())) { ChoiceList* L=getList(input_vertex,reference_vertex); int tree_choice=L->front(); switch(tree_choice) { case 1: { TreeList(Lat(L,1),reference_vertex,T1,T2,sequence); } break; case 2: { TreeList(input_vertex,Lat(L,1),T1,T2,sequence); } break; case 3: { sequence.push_back(MatchRecord(input_vertex,reference_vertex)); ForestList(input_vertex,reference_vertex,T1,T2,sequence); } break; case 4: { int size = Lat(L,1); int nbChoices = L->size(); /* Fred temptative of fix: The actual list of id of matched elements seems to be the n last value of the choice list. */ int input_vertex; for (int i=0;i<size;i++){ input_vertex = Lat(L,nbChoices-size+i); sequence.push_back(MatchRecord(input_vertex,reference_vertex)); } // question : is input_vertex to continue the fist or the last of the list. I choose the first input_vertex = Lat(L,nbChoices-size); ForestList(input_vertex,reference_vertex,T1,T2,sequence); } break; case 5: { int size = Lat(L,1); int nbChoices = L->size(); /* Fred temptative of fix: The actual list of id of matched elements seems to be the n last value of the choice list. */ int reference_vertex; for (int i=0;i<size;i++){ reference_vertex = Lat(L,nbChoices-size+i); sequence.push_back(MatchRecord(input_vertex,reference_vertex)); } // question : is reference_vertex to continue the fist or the last of the list. I choose the first reference_vertex = Lat(L,nbChoices-size); ForestList(input_vertex,reference_vertex,T1,T2,sequence); } break; default : break; } } }