void CSVWorld::GenericCreator::setScope (unsigned int scope) { mScopes = scope; int count = (mScopes & CSMWorld::Scope_Content) + (mScopes & CSMWorld::Scope_Project) + (mScopes & CSMWorld::Scope_Session); // scope selector widget if (count>1) { mScope = new QComboBox (this); insertAtBeginning (mScope, false); if (mScopes & CSMWorld::Scope_Content) addScope ("Content", CSMWorld::Scope_Content, "Record will be stored in the currently edited content file."); if (mScopes & CSMWorld::Scope_Project) addScope ("Project", CSMWorld::Scope_Project, "Record will be stored in a local project file.<p>" "Record will be created in the reserved namespace \"project\".<p>" "Record is available when running OpenMW via OpenCS."); if (mScopes & CSMWorld::Scope_Session) addScope ("Session", CSMWorld::Scope_Session, "Record exists only for the duration of the current editing session.<p>" "Record will be created in the reserved namespace \"session\".<p>" "Record is not available when running OpenMW via OpenCS."); connect (mScope, SIGNAL (currentIndexChanged (int)), this, SLOT (scopeChanged (int))); mScopeLabel = new QLabel ("Scope", this); insertAtBeginning (mScopeLabel, false); mScope->setCurrentIndex (0); }
CSVWorld::CellCreator::CellCreator (CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id) : GenericCreator (data, undoStack, id) { mY = new QSpinBox (this); mY->setVisible (false); mY->setMinimum (std::numeric_limits<int>::min()); mY->setMaximum (std::numeric_limits<int>::max()); connect (mY, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int))); insertAtBeginning (mY, true); mYLabel = new QLabel ("Y", this); mYLabel->setVisible (false); insertAtBeginning (mYLabel, false); mX = new QSpinBox (this); mX->setVisible (false); mX->setMinimum (std::numeric_limits<int>::min()); mX->setMaximum (std::numeric_limits<int>::max()); connect (mX, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int))); insertAtBeginning (mX, true); mXLabel = new QLabel ("X", this); mXLabel->setVisible (false); insertAtBeginning (mXLabel, false); mType = new QComboBox (this); mType->addItem ("Interior Cell"); mType->addItem ("Exterior Cell"); connect (mType, SIGNAL (currentIndexChanged (int)), this, SLOT (setType (int))); insertAtBeginning (mType, false); }
void CSVWorld::GenericCreator::setScope (unsigned int scope) { mScopes = scope; int count = (mScopes & CSMWorld::Scope_Content) + (mScopes & CSMWorld::Scope_Project) + (mScopes & CSMWorld::Scope_Session); // scope selector widget if (count>1) { mScope = new QComboBox (this); insertAtBeginning (mScope, false); if (mScopes & CSMWorld::Scope_Content) mScope->addItem ("Content", static_cast<int> (CSMWorld::Scope_Content)); if (mScopes & CSMWorld::Scope_Project) mScope->addItem ("Project", static_cast<int> (CSMWorld::Scope_Project)); if (mScopes & CSMWorld::Scope_Session) mScope->addItem ("Session", static_cast<int> (CSMWorld::Scope_Session)); connect (mScope, SIGNAL (currentIndexChanged (int)), this, SLOT (scopeChanged (int))); mScopeLabel = new QLabel ("Scope", this); insertAtBeginning (mScopeLabel, false); mScope->setCurrentIndex (0); }
// Inserts alphabetically on name void insert(List **list, char *p, int size, int free) { Node *scan, *back = NULL; Node *newNode = malloc(sizeof(Node)); newNode->p = p; newNode->size = size; newNode->free = free; newNode->next = NULL; if (*list == NULL) // Insert the very first node to the list: *list = newNode; else { scan = *list; while (scan != NULL && scan->p < p) { back = scan; scan = scan->next; } if (scan == *list) insertAtBeginning(list, newNode); else if (scan == NULL) { // insert at the end: newNode->next = back->next; //yeah, I know, its already NULL back->next = newNode; } else { // insert in the middle: newNode->next = scan; back->next = newNode; } } }
void XMLNodeList::setElementAtPosition(double index, const XMLElement & elem) { if (size == 0) { insertAtEnd(elem); prevNode = parent->children; prev = 1; } else if (index < 1) { insertAtBeginning(elem); } else if (index > size) { insertAtEnd(elem); } else if ((int)index == index) { replaceAtIndex((int)index, elem); } else { insertAtIndex((int)index, elem); } }
void main() { node *head,*tail; createList(&head); insertAtBeginning(&head,4); insertAtBeginning(&head,3); insertAtBeginning(&head,2); insertAtBeginning(&head,5); insertAtBeginning(&head,6); insertAtBeginning(&head,10); insertAtEnd(&head,1); insertInBetween(&head,9,2); traverseList(head); printf("\n"); reverseTraversal(head); reverseList(&head); traverseList(head); deleteEnd(&head); traverseList(head); deleteBeginning(&head); traverseList(head); deleteAfter(&head,2); traverseList(head); deleteList(&head); traverseList(head); // tail= getTail(head); // printf("\nTail= %d",tail->info); }