954
955
956
957
958
959
960
961
962
963
964
965
966
967
|
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
sqlite3_finalize(st);
if(i!=SQLITE_DONE) {
screen_message(sqlite3_errmsg(userdb));
return 0;
}
return 1;
}
static void rename_picture(void) {
sqlite3_stmt*st;
const char*s=screen_prompt("Old name:");
int i;
if(!s || !*s) return;
if(sqlite3_prepare_v2(userdb,"UPDATE `PICEDIT` SET `NAME`=REPLACE(?2||'.IMG','.IMG.IMG','.IMG') WHERE `NAME`=?1||'.IMG';",-1,&st,0)) {
screen_message(sqlite3_errmsg(userdb));
return;
}
sqlite3_bind_text(st,1,s,-1,SQLITE_TRANSIENT);
s=screen_prompt("New name:");
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) screen_message(sqlite3_errmsg(userdb));
}
static void set_caption(void) {
char buf[256];
snprintf(buf,255,"Free Hero Mesh - %s - Picture",basefilename);
SDL_WM_SetCaption(buf,buf);
}
|
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
|
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
|
-
+
|
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",0xF0,0xFB);
draw_text(0,0,"<ESC> Save/Quit <F1> Add <F2> Delete <F3> Edit <F4> Rename",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,0xF7);
if(8*n+8>screen->h-8) break;
}
SDL_UnlockSurface(screen);
|
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
|
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
|
+
+
+
|
case SDLK_F2:
max-=delete_picture();
goto redraw;
case SDLK_F3:
*ids=ask_picture_id("Edit:");
if(*ids) edit_picture(*ids);
goto redraw;
case SDLK_F4:
rename_picture();
goto redraw;
}
break;
case SDL_MOUSEMOTION:
set_cursor(XC_arrow);
break;
case SDL_VIDEOEXPOSE:
goto redraw;
}
}
}
|