+
+void EditorWindow::MoveLevelUp(void)
+{
+ // Swap in the vector...
+ int n = editor->currentLevel;
+ std::swap(editor->levelStorage[n], editor->levelStorage[n - 1]);
+
+ // Swap in the QListWidget too...
+ int currentRow = list->currentRow();
+ QListWidgetItem * currentItem = list->takeItem(currentRow);
+ list->insertItem(currentRow - 1, currentItem);
+ list->setCurrentRow(currentRow - 1);
+}
+
+
+void EditorWindow::MoveLevelDown(void)
+{
+ int n = editor->currentLevel;
+ std::swap(editor->levelStorage[n], editor->levelStorage[n + 1]);
+
+ int currentRow = list->currentRow();
+ QListWidgetItem * currentItem = list->takeItem(currentRow);
+ list->insertItem(currentRow + 1, currentItem);
+ list->setCurrentRow(currentRow + 1);
+}
+
+
+void EditorWindow::AddLevel(void)
+{
+ editor->AddNewLevelAtCurrentPosition();
+ editor->SetNameOnCurrentLevel("New Level");
+
+ QListWidgetItem * item = new QListWidgetItem("New Level");
+ item->setFlags(item->flags() | Qt::ItemIsEditable);
+ int currentRow = list->currentRow();
+ list->insertItem(currentRow, item);
+ list->setCurrentRow(currentRow);
+}
+
+
+void EditorWindow::DeleteLevel(void)
+{
+//printf("DeleteLevel: Erasing level from levelStorage...\n");
+ editor->levelStorage.erase(editor->levelStorage.begin() + editor->currentLevel);
+
+//printf("DeleteLevel: Erasing level from list...\n");
+ int currentRow = list->currentRow();
+//printf("DeleteLevel: currentRow = %i\n", currentRow);
+ QListWidgetItem * item = list->takeItem(currentRow);
+//Does nothing--the same as a click on the item, it's the wrong number (item + 1)...!
+// list->setCurrentRow(currentRow);
+ // According to the docs, it's now our responsibility to care for this item...
+//printf("DeleteLevel: Deleting item...\n");
+ delete item;
+
+ // We need to do this because of a bug in QListWidget::takeItem(). For some reason,
+ // it sets the current item to the one following the one taken. Bad!
+ SetEditorLevel(currentRow);
+}
+