+
+ // Set up SIGNAL/SLOTs for this LayerItemWidget
+ connect(li, SIGNAL(HideToggled(QListWidgetItem *, bool)), this, SLOT(HandleHideToggle(QListWidgetItem *, bool)));
+ connect(li, SIGNAL(LockToggled(QListWidgetItem *, bool)), this, SLOT(HandleLockToggle(QListWidgetItem *, bool)));
+
+ // Fix up the global state...
+ // N.B.: Because we handle the button states correctly, we should never
+ // have a situation where the reference in the vector is bad.
+ int layer = (Global::numLayers - currentRow) - 1;
+ bool old = Global::layerHidden[layer];
+ Global::layerHidden[layer] = Global::layerHidden[layer + 1];
+ Global::layerHidden[layer + 1] = old;
+ old = Global::layerLocked[layer];
+ Global::layerLocked[layer] = Global::layerLocked[layer + 1];
+ Global::layerLocked[layer + 1] = old;
+ std::string oldStr = Global::layerName[layer];
+ Global::layerName[layer] = Global::layerName[layer + 1];
+ Global::layerName[layer + 1] = oldStr;
+ // We also have to tell the document to shuffle its layers too
+ emit LayersSwapped(layer, layer + 1);