Overview
Comment: | Implement F7 (copy) and F12 (SQL) in the main menu of the picture editor. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d90f0ae800343c7ce963a4ca7cafe446 |
User & Date: | user on 2021-05-14 22:57:38 |
Other Links: | manifest | tags |
Context
2021-05-15
| ||
06:15 | Implement the "CL" SQL function as a useful shortcut to get class numbers from class names. check-in: c9044f59ed user: user tags: trunk | |
2021-05-14
| ||
22:57 | Implement F7 (copy) and F12 (SQL) in the main menu of the picture editor. check-in: d90f0ae800 user: user tags: trunk | |
2021-05-13
| ||
00:17 | Implement a {make} macro for making synthetic tokens. check-in: 6a9faa4fb1 user: user tags: trunk | |
Changes
Modified picedit.c from [d414016cc6] to [d23040b86d].
︙ | ︙ | |||
1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | 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 void do_config(void) { sqlite3_stmt*st; const char*s; char buf[16]; int i,n; for(n=0;n<15;n++) { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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); | | | 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 <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 | 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; } break; case SDL_MOUSEMOTION: set_cursor(XC_arrow); break; case SDL_VIDEOEXPOSE: goto redraw; } } } | > > > > > > > | 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; } } } |
Modified picedit.doc from [87de92095b] to [cb491484cb].
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | The F6 key is used to set configuration. Currently, this only sets the default picture sizes. If you specify zero, then it will use the user configuration, otherwise it is saved with the puzzle set, and will be used when adding new pictures. You can specify multiple sizes; it will create it with variants of all of those sizes. You can also specify the same numbers multiple times if you want multiple variants of that size. === Drawing === The following keyboard commands are available: Esc Leave the drawing screen. | > > > > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | The F6 key is used to set configuration. Currently, this only sets the default picture sizes. If you specify zero, then it will use the user configuration, otherwise it is saved with the puzzle set, and will be used when adding new pictures. You can specify multiple sizes; it will create it with variants of all of those sizes. You can also specify the same numbers multiple times if you want multiple variants of that size. The F7 key copies a picture. The F12 key allows entering a SQL statement. If there are any result rows, only the first row and first column are displayed. === Drawing === The following keyboard commands are available: Esc Leave the drawing screen. |
︙ | ︙ |