...
|
...
|
@@ -12,6 +12,7 @@
|
12
|
12
|
* 20250223 Draw pane titles and main dir list.
|
13
|
13
|
* 20250224 Draw right dir list and store elem positions.
|
14
|
14
|
* 20250225 Draw image placeholders
|
|
15
|
+ * 20250226 Fix rightside positions
|
15
|
16
|
*
|
16
|
17
|
* Author: Dario Rodriguez dario@darionomono.com
|
17
|
18
|
* (c) Dario Rodriguez 2025
|
...
|
...
|
@@ -37,7 +38,7 @@
|
37
|
38
|
#define LEFTSIZE 720
|
38
|
39
|
#define DEFAULTDIRDATAHEIGHT 150
|
39
|
40
|
#define DEFAULTDIRDATATRIANGLEW 35
|
40
|
|
-#define LEFTIMAGESIDELEN 150
|
|
41
|
+#define LEFTIMAGESIDELEN 130
|
41
|
42
|
|
42
|
43
|
#define FONTSIZE 18
|
43
|
44
|
#define FONTBIGSIZE 32
|
...
|
...
|
@@ -686,6 +687,8 @@ im_body_draw(body_t *body, int windowwidth, int windowheight)
|
686
|
687
|
int sidelen;
|
687
|
688
|
if(is_leftside && !(i==body->currentdirdata))
|
688
|
689
|
continue; /* this element is not in leftside */
|
|
690
|
+ margin=font->height/4;
|
|
691
|
+ sidelen=(is_leftside)?LEFTIMAGESIDELEN:dirdata->height-(fontbig->height+fontbig->height/4+font->height+margin*4+fontbig->height/4);
|
689
|
692
|
if(is_leftside) {
|
690
|
693
|
/* draw left side back arrow */
|
691
|
694
|
v2.x=(float) (body->xywh.x+fontbig->height/2);
|
...
|
...
|
@@ -721,7 +724,7 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
721
|
724
|
,(Vector2) {body->xywh.x+body->leftsize+fontbig->height/2,righty+fontbig->height/4}
|
722
|
725
|
,fontbig->height
|
723
|
726
|
,0
|
724
|
|
- ,(Color){ 65, 65, 65, 255 }
|
|
727
|
+ ,(Color){ 240, 240, 240, 255 }
|
725
|
728
|
);
|
726
|
729
|
}
|
727
|
730
|
/* directories */
|
...
|
...
|
@@ -733,11 +736,11 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
733
|
736
|
} else {
|
734
|
737
|
x0=body->xywh.x+body->leftsize+fontbig->height/2;
|
735
|
738
|
x1=body->xywh.x+body->xywh.w-font->height/2;
|
736
|
|
- y0=righty+fontbig->height/4+fontbig->height+font->height/4;
|
|
739
|
+ y0=righty+fontbig->height/4+fontbig->height+margin;
|
737
|
740
|
y1=y0+margin*2+font->height-1;
|
738
|
741
|
}
|
739
|
|
- margin=font->height/4;
|
740
|
742
|
for(k=0,x=x0,y=y0;k<dirdata->listing.usedelems;k++) {
|
|
743
|
+ Color c=(is_leftside)?((Color){ 65, 65, 65, 255 }):((Color){ 240, 240, 240, 255 });
|
741
|
744
|
elem=dirdata->listing.elems+k;
|
742
|
745
|
if(elem->name[0]!='d' || strcmp(elem->name,"d.")==0 || strcmp(elem->name,"d..")==0)
|
743
|
746
|
continue;
|
...
|
...
|
@@ -751,7 +754,7 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
751
|
754
|
,(Vector2) {x+margin,y+(fontbig->height-fonthuge->height)}
|
752
|
755
|
,fonthuge->height
|
753
|
756
|
,0
|
754
|
|
- ,(Color){ 65, 65, 65, 255 }
|
|
757
|
+ ,c
|
755
|
758
|
);
|
756
|
759
|
}
|
757
|
760
|
x=x0,y+=font->height+margin*2+font->height/4;
|
...
|
...
|
@@ -760,12 +763,12 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
760
|
763
|
}
|
761
|
764
|
if(is_leftside) {
|
762
|
765
|
FILLXYWH(elem->leftxywh,x,y,margin*2+m2.x,margin*2+font->height);
|
763
|
|
- DrawRectangleLines(UNROLLXYWH(elem->leftxywh),((Color){0,0,0,255}));
|
|
766
|
+ DrawRectangleLines(UNROLLXYWH(elem->leftxywh),c);
|
764
|
767
|
} else {
|
765
|
768
|
FILLXYWH(elem->xywh,x,y,margin*2+m2.x,margin*2+font->height);
|
766
|
|
- DrawRectangleLines(UNROLLXYWH(elem->xywh),((Color){0,0,0,255}));
|
|
769
|
+ DrawRectangleLines(UNROLLXYWH(elem->xywh),c);
|
767
|
770
|
}
|
768
|
|
- DrawTextEx(font->font,elem->name+1,(Vector2){x+margin,y+margin},font->height,0,(Color){ 65, 65, 65, 255 });
|
|
771
|
+ DrawTextEx(font->font,elem->name+1,(Vector2){x+margin,y+margin},font->height,0,c);
|
769
|
772
|
x+=margin*2+m2.x+font->height/4;
|
770
|
773
|
}
|
771
|
774
|
/* files */
|
...
|
...
|
@@ -773,9 +776,9 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
773
|
776
|
y0=(x==x0)?y:y+font->height+margin*2+font->height/4;
|
774
|
777
|
sidelen=LEFTIMAGESIDELEN;
|
775
|
778
|
} else {
|
776
|
|
- y0=righty; //y0+margin*2+font->height+font->height/2;
|
777
|
|
- y1=righty+dirdata->height-fontbig->height/4;
|
778
|
|
- sidelen=y1-y0-1;
|
|
779
|
+ y0=righty+dirdata->height-sidelen-margin-fontbig->height/4;
|
|
780
|
+ y1=y0+sidelen+margin;
|
|
781
|
+ x0-=margin;
|
779
|
782
|
}
|
780
|
783
|
for(k=0,x=x0,y=y0;k<dirdata->listing.usedelems;k++) {
|
781
|
784
|
elem=dirdata->listing.elems+k;
|
...
|
...
|
@@ -790,7 +793,7 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
790
|
793
|
,(Vector2) {x+margin,y+(sidelen-fonthuge->height)}
|
791
|
794
|
,fonthuge->height
|
792
|
795
|
,0
|
793
|
|
- ,(Color){ 65, 65, 65, 255 }
|
|
796
|
+ ,(Color){ 0,0,0,64 }
|
794
|
797
|
);
|
795
|
798
|
}
|
796
|
799
|
x=x0,y+=sidelen+margin*2;
|
...
|
...
|
@@ -809,10 +812,11 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
809
|
812
|
char shortname[1024];
|
810
|
813
|
xywh_t *pos;
|
811
|
814
|
int l;
|
|
815
|
+ font_t *myfont=(is_leftside)?fonthuge:font;
|
812
|
816
|
pos=is_leftside?&(elem->leftxywh):&(elem->xywh);
|
813
|
817
|
if((ptr=strchr(elem->name+1,'.'))!=NULL) {
|
814
|
|
- m2=MeasureTextEx(fonthuge->font,ptr,fonthuge->height,0);
|
815
|
|
- DrawTextEx(fonthuge->font,ptr,(Vector2){x+margin+(sidelen-m2.x)/2,y+margin+(sidelen-fonthuge->height)/2},fonthuge->height,0,(Color){ 65, 65, 65, 255 });
|
|
818
|
+ m2=MeasureTextEx(myfont->font,ptr,myfont->height,0);
|
|
819
|
+ DrawTextEx(myfont->font,ptr,(Vector2){x+margin+(sidelen-m2.x)/2,y+(font->height)/2+margin+(sidelen-myfont->height)/2},myfont->height,0,(Color){ 0,0,0,96 });
|
816
|
820
|
}
|
817
|
821
|
ptr=(ptr==NULL)?elem->name+1:ptr;
|
818
|
822
|
l=(ptr-(elem->name+1));
|
...
|
...
|
@@ -820,7 +824,7 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
820
|
824
|
memcpy(shortname,elem->name+1,l);
|
821
|
825
|
shortname[l]='\0';
|
822
|
826
|
DrawRectangle(pos->x,pos->y,pos->w,font->height+font->height/2,((Color){0,0,0,64}));
|
823
|
|
- DrawTextEx(font->font,shortname,(Vector2){pos->x+font->height/4,pos->y+font->height/4},font->height,0,(Color){ 255, 255, 255, 255 });
|
|
827
|
+ DrawTextEx(font->font,shortname,(Vector2){pos->x+font->height/4,pos->y+font->height/4},font->height,0,(Color){ 192,192,192,255 });
|
824
|
828
|
}
|
825
|
829
|
x+=margin*2+sidelen;
|
826
|
830
|
}
|
...
|
...
|
@@ -834,67 +838,6 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
|
834
|
838
|
}
|
835
|
839
|
}
|
836
|
840
|
}
|
837
|
|
-#if 0
|
838
|
|
- /* example from menubar */
|
839
|
|
- int i,j,k,x;
|
840
|
|
- menudata_t *menudata;
|
841
|
|
- font_t *font;
|
842
|
|
- if(menubar==NULL || font==NULL)
|
843
|
|
- return(-1); /* sanity check failed */
|
844
|
|
- font=menubar->ptrfont;
|
845
|
|
- DrawRectangle(0,0,windowwidth, font->height+font->height/2, (Color){ 235, 235, 235, 235 } );
|
846
|
|
- for(i=0,x=0;i<menubar->sizemenudata;i++) {
|
847
|
|
- Vector2 v2;
|
848
|
|
- menudata=menubar->menudata[i];
|
849
|
|
- v2=MeasureTextEx(font->font,menudata->title,font->height,0);
|
850
|
|
- FILLXYWH(menudata->xywh,x,0,((int)v2.x)+font->height,font->height+font->height/2);
|
851
|
|
- v2.x=(float) (menudata->xywh.x+font->height/2);
|
852
|
|
- v2.y=(float) (menudata->xywh.y+font->height/4);
|
853
|
|
- DrawTextEx(font->font
|
854
|
|
- ,menudata->title
|
855
|
|
- ,v2
|
856
|
|
- ,font->height
|
857
|
|
- ,0
|
858
|
|
- ,(Color){ 45, 45, 45, 255 }
|
859
|
|
- );
|
860
|
|
- if(menudata->flag_open || menudata->flag_stickyopen) {
|
861
|
|
- int underline_height=3;
|
862
|
|
- int maxw;
|
863
|
|
- DrawRectangle(menudata->xywh.x,menudata->xywh.y+menudata->xywh.h-underline_height,menudata->xywh.w,underline_height, (Color){ 53,132,228,255 } );
|
864
|
|
- for(j=0,maxw=0;j<menudata->sizeoptions;j++) {
|
865
|
|
- v2=MeasureTextEx(font->font,menudata->options[j],font->height,0);
|
866
|
|
- maxw=(((int)(v2.x))>maxw)?((int)(v2.x)):maxw;
|
867
|
|
- }
|
868
|
|
- maxw=(maxw<(menudata->xywh.w+font->height))?(menudata->xywh.w+font->height):maxw;
|
869
|
|
- maxw+=font->height;
|
870
|
|
- FILLXYWH(menudata->optionsxywh,menudata->xywh.x+1,menudata->xywh.y+menudata->xywh.h+2,maxw,(font->height+font->height/2)*menudata->sizeoptions);
|
871
|
|
- DrawLine(menudata->optionsxywh.x-1,menudata->optionsxywh.y-2,menudata->optionsxywh.x+menudata->optionsxywh.w+2,menudata->optionsxywh.y-2,(Color){ 255,255,255,255 } );
|
872
|
|
- DrawLine(menudata->optionsxywh.x-1,menudata->optionsxywh.y,menudata->optionsxywh.x-1,menudata->optionsxywh.y+menudata->optionsxywh.h+1,(Color){ 255,255,255,255 } );
|
873
|
|
- DrawLine(menudata->optionsxywh.x+menudata->optionsxywh.w+2,menudata->optionsxywh.y,menudata->optionsxywh.x+menudata->optionsxywh.w+2,menudata->optionsxywh.y+menudata->optionsxywh.h+1,(Color){ 192,192,192,255 } );
|
874
|
|
- DrawLine(menudata->optionsxywh.x-1,menudata->optionsxywh.y+menudata->optionsxywh.h+1,menudata->optionsxywh.x+menudata->optionsxywh.w+2,menudata->optionsxywh.y+menudata->optionsxywh.h+1,(Color){ 192,192,192,255 } );
|
875
|
|
- DrawRectangle(menudata->optionsxywh.x,menudata->optionsxywh.y,menudata->optionsxywh.w,menudata->optionsxywh.h,(Color){ 235, 235, 235, 235 });
|
876
|
|
- for(k=0;k<menudata->sizeoptions;k++) {
|
877
|
|
- Color c;
|
878
|
|
- c=(k==menudata->currentoption)?((Color){ 255,255,255,255 }):((Color){ 45, 45, 45, 255 });
|
879
|
|
- if(k==menudata->currentoption)
|
880
|
|
- DrawRectangle(menudata->optionsxywh.x+1,menudata->optionsxywh.y+(font->height+(font->height/2))*k,menudata->optionsxywh.w-2,font->height+font->height/2,(Color){ 53,132,228,255 });
|
881
|
|
- v2.x=(float) (menudata->optionsxywh.x+font->height/2);
|
882
|
|
- v2.y=(float) (menudata->optionsxywh.y+(font->height/4)+(font->height+(font->height/2))*k);
|
883
|
|
- DrawTextEx(font->font
|
884
|
|
- ,menudata->options[k]
|
885
|
|
- ,v2
|
886
|
|
- ,font->height
|
887
|
|
- ,0
|
888
|
|
- ,c
|
889
|
|
- );
|
890
|
|
- }
|
891
|
|
- } else {
|
892
|
|
- FILLXYWH(menudata->optionsxywh,0,0,0,0);
|
893
|
|
- }
|
894
|
|
- x=menudata->xywh.x+menudata->xywh.w;
|
895
|
|
- }
|
896
|
|
- return(0);
|
897
|
|
-#endif
|
898
|
841
|
return(0);
|
899
|
842
|
}
|
900
|
843
|
|