summaryrefslogtreecommitdiff
path: root/gui/src
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2017-09-21 13:13:18 +0100
committerTim Redfern <tim@getdrop.com>2017-09-21 13:13:18 +0100
commit2beb8c19d86bf601940224f1ead1acff19e4ebd4 (patch)
tree29ee78aa71dc1ac9dd47bc5ca6ee28c7605786b5 /gui/src
parent6361fc600aefdec174c88213a9e84e76f2982019 (diff)
correctly deleting images
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/chainImageSet.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/gui/src/chainImageSet.cpp b/gui/src/chainImageSet.cpp
index 963333a..252e4e6 100644
--- a/gui/src/chainImageSet.cpp
+++ b/gui/src/chainImageSet.cpp
@@ -260,23 +260,36 @@ void chainImageSet::keyPressed(ofKeyEventArgs &keyargs){
(*selected)->linkPos.x++;
break;
case OF_KEY_BACKSPACE:{
- images.clear();
- filename.clear();
- /*
+
+ if (images.size()==1){
+ //also OF_KEY_DEL ?
+ images.clear();
+ filename.clear();
+ break;
+ }
+
auto previous=selected;
- previous--;
- if (previous==images.end()){
- previous=images.end()--;
+ if (previous==images.begin()){
+ previous=images.end();
+ previous--;
}
- previous->link=selected->link;
- printf("DELETED: %s \n",selected->filename.c_str());
+ else {
+ previous--;
+ }
+ (*previous)->link=(*selected)->link;
+ printf("DELETING: %s \n",(*selected)->filename.c_str());
+ printf("LINKING %s to %s\n",(*previous)->filename.c_str(),(*selected)->link->filename.c_str());
images.erase(selected);
- selected=previous++;
+ //printf("%s is now selected\n",(*selected)->filename.c_str()); //crashes
+ selected=previous;
+ selected++;
if (selected==images.end()){
selected=images.begin();
}
+ printf("%s is set selected\n",(*selected)->filename.c_str());
break;
- */
+
+
}
case 's':
case 83: {