...
|
...
|
@@ -27,6 +27,7 @@
|
27
|
27
|
* 20250316 Add android target support.
|
28
|
28
|
* Delay loading images if over fps deadline.
|
29
|
29
|
* Scroll by finger. Big image on double click.
|
|
30
|
+ * 20250319 Add-dirdata button.
|
30
|
31
|
*
|
31
|
32
|
* Author: Dario Rodriguez dario@darionomono.com
|
32
|
33
|
* (c) Dario Rodriguez 2025
|
...
|
...
|
@@ -58,12 +59,13 @@
|
58
|
59
|
#define DEFAULTWIDTH 2400
|
59
|
60
|
#define DEFAULTHEIGHT 1080
|
60
|
61
|
#define LEFTSIZE 1600
|
61
|
|
-#define DEFAULTDIRDATAHEIGHT 520
|
|
62
|
+#define DEFAULTDIRDATAHEIGHT 492
|
62
|
63
|
#define DEFAULTDIRDATATRIANGLEW 100
|
63
|
64
|
#define LEFTIMAGESIDELEN 326
|
64
|
65
|
#define FONTSIZE 64
|
65
|
66
|
#define FONTBIGSIZE 96
|
66
|
67
|
#define FONTHUGESIZE 128
|
|
68
|
+#define ADDREMOVEDIRDATAHEIGHT 128
|
67
|
69
|
#else
|
68
|
70
|
#define ROOTDIR "/var/www/default/animeshot/"
|
69
|
71
|
#define DEFAULTWIDTH 1280
|
...
|
...
|
@@ -75,6 +77,7 @@
|
75
|
77
|
#define FONTSIZE 18
|
76
|
78
|
#define FONTBIGSIZE 32
|
77
|
79
|
#define FONTHUGESIZE 48
|
|
80
|
+#define ADDREMOVEDIRDATAHEIGHT 64
|
78
|
81
|
#endif
|
79
|
82
|
|
80
|
83
|
#define SCROLLTHRESHOLD (LEFTIMAGESIDELEN/3)
|
...
|
...
|
@@ -217,6 +220,8 @@ typedef struct body_t {
|
217
|
220
|
int is_displayingtexture;
|
218
|
221
|
texture_t bigtexture;
|
219
|
222
|
int flag_drawbigtexture;
|
|
223
|
+ xywh_t dirdataadd;
|
|
224
|
+ Font roundedbox;
|
220
|
225
|
} body_t;
|
221
|
226
|
|
222
|
227
|
typedef struct im_t {
|
...
|
...
|
@@ -754,6 +759,11 @@ im_body_init(int x, int y, font_t *font, font_t *fontbig, font_t *fonthuge, int
|
754
|
759
|
body->ptrfonthuge=fonthuge;
|
755
|
760
|
if(body->rootdir[0]!='\0' && strcmp(body->rootdir,SEP)!=0 && body->rootdir[strlen(body->rootdir)-1]==sep[0])
|
756
|
761
|
body->rootdir[strlen(body->rootdir)-1]='\0'; /* rootdir doesn't need the final '/' */
|
|
762
|
+ /* init rounded box glyph (a really big zero) */
|
|
763
|
+ {
|
|
764
|
+ int codepoints[]={'O','+','-'};
|
|
765
|
+ body->roundedbox=LoadFontFromMemory(".ttf",(const unsigned char *)roboto_regular,sizeof(roboto_regular)-1,ADDREMOVEDIRDATAHEIGHT*4,codepoints,sizeof(codepoints)/sizeof(codepoints[0]));
|
|
766
|
+ }
|
757
|
767
|
return(body);
|
758
|
768
|
}
|
759
|
769
|
|
...
|
...
|
@@ -779,6 +789,7 @@ im_body_free(body_t *body)
|
779
|
789
|
texture_freedata(&(body->bigtexture));
|
780
|
790
|
if(body->rootdir!=NULL)
|
781
|
791
|
free(body->rootdir),body->rootdir=NULL;
|
|
792
|
+ /* NOTE: Cannot call UnloadFont(body->roundedbox) as the data was not malloc'd; see https://github.com/raysan5/raylib/blob/master/examples/others/embedded_files_loading.c */
|
782
|
793
|
free(body),body=NULL;
|
783
|
794
|
return;
|
784
|
795
|
}
|
...
|
...
|
@@ -890,6 +901,15 @@ im_body_mouse(body_t *body, Vector2 mousepos, Vector2 wheel, int lmbpressed, int
|
890
|
901
|
return(0);
|
891
|
902
|
}
|
892
|
903
|
}
|
|
904
|
+ /* dirdata select */
|
|
905
|
+#warning TODO
|
|
906
|
+ /* detect click on "add dirdata" button */
|
|
907
|
+ if(is_imutil_insidexywh(mousepos,&(body->dirdataadd),0)) {
|
|
908
|
+ im_body_add(body,body->dirdata[body->currentdirdata]->dirname);
|
|
909
|
+ *click_avail=0;
|
|
910
|
+ return(0);
|
|
911
|
+ }
|
|
912
|
+ /* dirdata remove */
|
893
|
913
|
#warning TODO
|
894
|
914
|
return(0);
|
895
|
915
|
}
|
...
|
...
|
@@ -1169,6 +1189,33 @@ fprintf(stderr,"elem:\"%s\" sidelen:%i old:%ix%i new:%ix%i\n",elem->name+1,sidel
|
1169
|
1189
|
}
|
1170
|
1190
|
}
|
1171
|
1191
|
}
|
|
1192
|
+ if(flag_skiprightside==0 && (righty+DEFAULTDIRDATAHEIGHT)<=(body->xywh.y+body->xywh.h)) {
|
|
1193
|
+ GlyphInfo gi;
|
|
1194
|
+ int xoff;
|
|
1195
|
+ int margin;
|
|
1196
|
+ margin=20;
|
|
1197
|
+ FILLXYWH(body->dirdataadd,(body->xywh.x+body->xywh.w-ADDREMOVEDIRDATAHEIGHT-margin),righty+margin,ADDREMOVEDIRDATAHEIGHT,ADDREMOVEDIRDATAHEIGHT);
|
|
1198
|
+ gi=GetGlyphInfo(body->roundedbox,'O');
|
|
1199
|
+ xoff=0;
|
|
1200
|
+ DrawTexturePro(body->roundedbox.texture
|
|
1201
|
+ ,(Rectangle){0.0+xoff,0.0,(float)gi.image.width+5,(float)gi.image.height+2}
|
|
1202
|
+ ,(Rectangle) { (float) body->dirdataadd.x, (float) body->dirdataadd.y, (float) body->dirdataadd.w, (float)body->dirdataadd.h}
|
|
1203
|
+ ,(Vector2){0.0,0.0}
|
|
1204
|
+ ,0.0
|
|
1205
|
+ ,(Color){ 168, 168, 168, 255 }
|
|
1206
|
+ );
|
|
1207
|
+ xoff+=gi.image.width+4;
|
|
1208
|
+ gi=GetGlyphInfo(body->roundedbox,'+');
|
|
1209
|
+ DrawTexturePro(body->roundedbox.texture
|
|
1210
|
+ ,(Rectangle){xoff,0.0,(float)gi.image.width,(float)gi.image.height}
|
|
1211
|
+ ,(Rectangle) { (float) body->dirdataadd.x+30-2, (float) body->dirdataadd.y+30, (float) body->dirdataadd.w-60, (float)body->dirdataadd.h-60}
|
|
1212
|
+ ,(Vector2){0.0,0.0}
|
|
1213
|
+ ,0.0
|
|
1214
|
+ ,(Color){ 168, 168, 168, 255 }
|
|
1215
|
+ );
|
|
1216
|
+ } else {
|
|
1217
|
+ memset(&(body->dirdataadd),0,sizeof(body->dirdataadd));
|
|
1218
|
+ }
|
1172
|
1219
|
if(statustooltip[0]!='\0') {
|
1173
|
1220
|
m2=MeasureTextEx(font->font,statustooltip,font->height,0);
|
1174
|
1221
|
DrawRectangle(0,windowheight-1-margin*2-font->height,m2.x+margin*2,font->height+margin*2,((Color){0,0,0,96}));
|