1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
|
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
return;
}
sqlite3_bind_text(st,2,s,-1,SQLITE_TRANSIENT);
i=sqlite3_step(st);
sqlite3_finalize(st);
if(i!=SQLITE_DONE) screen_message(sqlite3_errmsg(userdb));
}
static sqlite3_int64 copy_picture(void) {
sqlite3_stmt*st;
const char*s=screen_prompt("Copy from:");
int i;
sqlite3_set_last_insert_rowid(userdb,0);
if(!s || !*s) return 0;
if(sqlite3_prepare_v2(userdb,"INSERT INTO `PICEDIT`(`NAME`,`TYPE`,`DATA`) SELECT VALID_NAME(?2)||SUBSTR(`NAME`,-4),`TYPE`,`DATA` "
"FROM `PICEDIT` WHERE SUBSTR(`NAME`,1,LENGTH(`NAME`)-4)=?1 AND `TYPE`<>0;",-1,&st,0)) {
screen_message(sqlite3_errmsg(userdb));
return;
}
sqlite3_bind_text(st,1,s,-1,SQLITE_TRANSIENT);
s=screen_prompt("Copy to:");
if(!s || !*s) {
sqlite3_finalize(st);
return;
}
sqlite3_bind_text(st,2,s,-1,SQLITE_TRANSIENT);
i=sqlite3_step(st);
sqlite3_finalize(st);
if(i==SQLITE_DONE) {
return sqlite3_last_insert_rowid(userdb);
} else {
screen_message(sqlite3_errmsg(userdb));
return 0;
}
}
static void do_config(void) {
sqlite3_stmt*st;
const char*s;
char buf[16];
int i,n;
for(n=0;n<15;n++) {
|
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
|
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
|
-
+
|
if(sc>max-screen->h/8+1) sc=max-screen->h/8+1;
if(sc<0) sc=0;
sqlite3_bind_int(st,1,screen->h/8-1);
sqlite3_bind_int(st,2,sc);
SDL_LockSurface(screen);
r.x=r.y=0; r.w=screen->w; r.h=screen->h;
SDL_FillRect(screen,&r,0xF0);
draw_text(0,0,"<ESC> Save/Quit <F1> Add <F2> Delete <F3> Edit <F4> Rename <F5> AddDependent <F6> Config",0xF0,0xFB);
draw_text(0,0,"<ESC> Save/Quit <F1> Add <F2> Delete <F3> Edit <F4> Rename <F5> AddDependent <F6> Config <F7> Copy",0xF0,0xFB);
n=0;
while((i=sqlite3_step(st))==SQLITE_ROW) {
ids[n++]=sqlite3_column_int64(st,0);
draw_text(16,8*n,sqlite3_column_text(st,1),0xF0,sqlite3_column_int(st,2)==1?0xF7:0xF2);
if(8*n+8>screen->h-8) break;
}
SDL_UnlockSurface(screen);
|
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
|
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
|
+
+
+
+
+
+
+
|
case SDLK_F5:
if(max<65535) max+=add_picture(2);
else screen_message("Too many pictures");
goto redraw;
case SDLK_F6:
do_config();
goto redraw;
case SDLK_F7:
*ids=copy_picture();
if(*ids) edit_picture(*ids);
goto redraw;
case SDLK_F12:
sqlite3_exec(userdb,screen_prompt("<SQL>")?:"",response_cb,0,0);
goto redraw;
}
break;
case SDL_MOUSEMOTION:
set_cursor(XC_arrow);
break;
case SDL_VIDEOEXPOSE:
goto redraw;
}
}
}
|