curvedraw

diff src/app.cc @ 10:95fada20c638

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 19 Dec 2015 17:40:27 +0200
parents 6e980fddbf3b
children 84a647283237
line diff
     1.1 --- a/src/app.cc	Sat Dec 19 08:00:53 2015 +0200
     1.2 +++ b/src/app.cc	Sat Dec 19 17:40:27 2015 +0200
     1.3 @@ -257,11 +257,29 @@
     1.4  		case 'e':
     1.5  		case 'E':
     1.6  			// TODO: GUI for filename at least
     1.7 -			if(!save_curves(stdout, &curves[0], (int)curves.size())) {
     1.8 +			if(!save_curves("test.curves", &curves[0], (int)curves.size())) {
     1.9  				fprintf(stderr, "failed to export curves\n");
    1.10  			}
    1.11  			printf("exported %d curves\n", (int)curves.size());
    1.12  			break;
    1.13 +
    1.14 +		case 'i':
    1.15 +		case 'I':
    1.16 +			{
    1.17 +				std::list<Curve*> clist = load_curves("test.curves");
    1.18 +				if(clist.empty()) {
    1.19 +					fprintf(stderr, "failed to import curves\n");
    1.20 +				}
    1.21 +
    1.22 +				int num = 0;
    1.23 +				std::list<Curve*>::iterator it = clist.begin();
    1.24 +				while(it != clist.end()) {
    1.25 +					curves.push_back(*it++);
    1.26 +					++num;
    1.27 +				}
    1.28 +				printf("imported %d curves\n", num);
    1.29 +			}
    1.30 +			break;
    1.31  		}
    1.32  	}
    1.33