From fd2adc88fc798d916f5a3c6e6a0a52c32716f4c5 Mon Sep 17 00:00:00 2001 From: "Diego E. Moreno" Date: Wed, 28 Aug 2024 23:27:44 +0200 Subject: [PATCH] Some UI multi tasking stuffs --- .cache/icon_home.png | Bin 991 -> 0 bytes CMakeLists.txt | 25 +- .../desktop/vortex_desktop.desktop | 0 {.cache => assets/images}/b_all_bases.png | Bin {.cache => assets/images}/b_app_svc.png | Bin .../images}/b_assets_components.png | Bin {.cache => assets/images}/b_core_versions.png | Bin .../images}/b_modules_managment.png | Bin .../images}/b_operating_systems.png | Bin .../images}/b_plugins_managment.png | Bin .../images}/b_templates_managment.png | Bin {.cache => assets/images}/b_tools_utils.png | Bin {.cache => assets/images}/base_vortex.png | Bin {.cache => assets/images}/editor.png | Bin {.cache => assets/images}/icon.png | Bin assets/images/icon_add.png | Bin 0 -> 416 bytes .../images}/icon_arrow_l_disabled.png | Bin .../images}/icon_arrow_l_enabled.png | Bin .../images}/icon_arrow_r_disabled.png | Bin .../images}/icon_arrow_r_enabled.png | Bin {.cache => assets/images}/icon_asm_file.png | Bin {.cache => assets/images}/icon_bin_2_file.png | Bin {.cache => assets/images}/icon_bin_file.png | Bin {.cache => assets/images}/icon_c_file.png | Bin {.cache => assets/images}/icon_c_h_file.png | Bin {.cache => assets/images}/icon_cfg_file.png | Bin {.cache => assets/images}/icon_cmake_file.png | Bin assets/images/icon_collection.png | Bin 0 -> 830 bytes {.cache => assets/images}/icon_cpp_file.png | Bin {.cache => assets/images}/icon_cpp_h_file.png | Bin .../images}/icon_docker_file.png | Bin {.cache => assets/images}/icon_folder.png | Bin {.cache => assets/images}/icon_git_file.png | Bin assets/images/icon_home.png | Bin 0 -> 968 bytes assets/images/icon_import.png | Bin 0 -> 918 bytes {.cache => assets/images}/icon_ini_file.png | Bin {.cache => assets/images}/icon_inl_file.png | Bin .../images}/icon_license_file.png | Bin .../images}/icon_lright_arrow.png | Bin .../images}/icon_picture_file.png | Bin assets/images/icon_return.png | Bin 0 -> 1011 bytes {.cache => assets/images}/icon_rust_file.png | Bin assets/images/icon_save.png | Bin 0 -> 849 bytes assets/images/icon_settings.png | Bin 0 -> 1734 bytes assets/images/icon_star.png | Bin 0 -> 1542 bytes .../images}/icon_unknow_file.png | Bin .../images}/icon_vortex_file.png | Bin .../images}/operating_system_banner.png | Bin {.cache => assets/images}/vortex.png | Bin main/include/vortex_internals.h | 22 +- main/src/vortex.cpp | 237 ++- .../vortex/content_browser/custom_folders.cpp | 0 main/src/vortex/content_browser/pools.cpp | 0 tools/editor/app/core/ContentBrowser.cpp | 1780 ++++++++++++----- tools/editor/app/core/ContentBrowser.hpp | 57 +- tools/editor/app/include/editor.h | 2 +- 56 files changed, 1576 insertions(+), 547 deletions(-) delete mode 100644 .cache/icon_home.png rename vortex_desktop.desktop => assets/desktop/vortex_desktop.desktop (100%) rename {.cache => assets/images}/b_all_bases.png (100%) rename {.cache => assets/images}/b_app_svc.png (100%) rename {.cache => assets/images}/b_assets_components.png (100%) rename {.cache => assets/images}/b_core_versions.png (100%) rename {.cache => assets/images}/b_modules_managment.png (100%) rename {.cache => assets/images}/b_operating_systems.png (100%) rename {.cache => assets/images}/b_plugins_managment.png (100%) rename {.cache => assets/images}/b_templates_managment.png (100%) rename {.cache => assets/images}/b_tools_utils.png (100%) rename {.cache => assets/images}/base_vortex.png (100%) rename {.cache => assets/images}/editor.png (100%) rename {.cache => assets/images}/icon.png (100%) create mode 100644 assets/images/icon_add.png rename {.cache => assets/images}/icon_arrow_l_disabled.png (100%) rename {.cache => assets/images}/icon_arrow_l_enabled.png (100%) rename {.cache => assets/images}/icon_arrow_r_disabled.png (100%) rename {.cache => assets/images}/icon_arrow_r_enabled.png (100%) rename {.cache => assets/images}/icon_asm_file.png (100%) rename {.cache => assets/images}/icon_bin_2_file.png (100%) rename {.cache => assets/images}/icon_bin_file.png (100%) rename {.cache => assets/images}/icon_c_file.png (100%) rename {.cache => assets/images}/icon_c_h_file.png (100%) rename {.cache => assets/images}/icon_cfg_file.png (100%) rename {.cache => assets/images}/icon_cmake_file.png (100%) create mode 100644 assets/images/icon_collection.png rename {.cache => assets/images}/icon_cpp_file.png (100%) rename {.cache => assets/images}/icon_cpp_h_file.png (100%) rename {.cache => assets/images}/icon_docker_file.png (100%) rename {.cache => assets/images}/icon_folder.png (100%) rename {.cache => assets/images}/icon_git_file.png (100%) create mode 100644 assets/images/icon_home.png create mode 100644 assets/images/icon_import.png rename {.cache => assets/images}/icon_ini_file.png (100%) rename {.cache => assets/images}/icon_inl_file.png (100%) rename {.cache => assets/images}/icon_license_file.png (100%) rename {.cache => assets/images}/icon_lright_arrow.png (100%) rename {.cache => assets/images}/icon_picture_file.png (100%) create mode 100644 assets/images/icon_return.png rename {.cache => assets/images}/icon_rust_file.png (100%) create mode 100644 assets/images/icon_save.png create mode 100644 assets/images/icon_settings.png create mode 100644 assets/images/icon_star.png rename {.cache => assets/images}/icon_unknow_file.png (100%) rename {.cache => assets/images}/icon_vortex_file.png (100%) rename {.cache => assets/images}/operating_system_banner.png (100%) rename {.cache => assets/images}/vortex.png (100%) create mode 100644 main/src/vortex/content_browser/custom_folders.cpp create mode 100644 main/src/vortex/content_browser/pools.cpp diff --git a/.cache/icon_home.png b/.cache/icon_home.png deleted file mode 100644 index afca104a1f9881a6dc68b4e76e74ded4607c2027..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 991 zcmeAS@N?(olHy`uVBq!ia0vp^DIm``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&di49q2-E{-7;jBoGm_q!b+!TRC6r-1Bdwy)A3 z(qDz8zvl42;304%>{#BEwR5c$6(=g%Febeb*<7mhQrM)HS<5g)>EPdWPZU>a9r#xM zw)pT*&#*-r8%6ro)%s7$cIkivjhcxpIra7S7iTBmo%Cm6$o9z(3ubsNxFxjWV8Vs# zv%T*=TH1d1@4s)~zP+D4d-i*w1q#d;Cw}zI-)Hw}O1YHRl7&lzW;|dzdDx=vSny;4 zXHKmNd-v`Q6mga3+M{yw)~zn}$tS0>D0NK!b@5{0_jm8k&D9suOt+eUzIyS+7hwku zvKLiUNa%}opVm2TwvX4Ek+}j_vvhtH5VuEa(uXXT2|wo+)WNi~8 z&hJ%2>-kyRnKI=#vL1d;xb?E6Z0+u@OobOf(SD}PFdk>1D{4eMCJPEBJltHidhyco zx;ne5U0VGU_I&7l`n2s~N$D0JK0dyC-mX)Z?bQzW;ghLh9lG1=r9;??50R@w6uenC zHMO3PddU=NAs{Q6%$w}~LNou=pLIJf=xERP?QQLPA^P)&+_&l7tDXAQA}2liPw8-rY)7<^LL7PLT#mTHAm4;fL;u z2VaHi|JK>ZMMqb!ZJ!gtb;``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eBIa5y;$B+ufw|5SDGCN8*JoMbaU~QnA!5TH~ zLEr|RwGQ3}WfR!$NPJk;xqv(W>2JR3n>%eKBz~kH1DXW}`!-2&fBjIj&+^; zxwo89m~VJ({qbvi-Y-9U_v*V`oikMvlstMA44aN{2q_cG*nB2+u2jq~ z^zzwB}=?N-~1<~g^;mW~iYA}#5>#=UAmNzA(n&01#!)-dx-5zOPUA?ZhYx(WW8mLrT(oxC`4u1` MPgg&ebxsLQ0N?kM!~g&Q literal 0 HcmV?d00001 diff --git a/.cache/icon_arrow_l_disabled.png b/assets/images/icon_arrow_l_disabled.png similarity index 100% rename from .cache/icon_arrow_l_disabled.png rename to assets/images/icon_arrow_l_disabled.png diff --git a/.cache/icon_arrow_l_enabled.png b/assets/images/icon_arrow_l_enabled.png similarity index 100% rename from .cache/icon_arrow_l_enabled.png rename to assets/images/icon_arrow_l_enabled.png diff --git a/.cache/icon_arrow_r_disabled.png b/assets/images/icon_arrow_r_disabled.png similarity index 100% rename from .cache/icon_arrow_r_disabled.png rename to assets/images/icon_arrow_r_disabled.png diff --git a/.cache/icon_arrow_r_enabled.png b/assets/images/icon_arrow_r_enabled.png similarity index 100% rename from .cache/icon_arrow_r_enabled.png rename to assets/images/icon_arrow_r_enabled.png diff --git a/.cache/icon_asm_file.png b/assets/images/icon_asm_file.png similarity index 100% rename from .cache/icon_asm_file.png rename to assets/images/icon_asm_file.png diff --git a/.cache/icon_bin_2_file.png b/assets/images/icon_bin_2_file.png similarity index 100% rename from .cache/icon_bin_2_file.png rename to assets/images/icon_bin_2_file.png diff --git a/.cache/icon_bin_file.png b/assets/images/icon_bin_file.png similarity index 100% rename from .cache/icon_bin_file.png rename to assets/images/icon_bin_file.png diff --git a/.cache/icon_c_file.png b/assets/images/icon_c_file.png similarity index 100% rename from .cache/icon_c_file.png rename to assets/images/icon_c_file.png diff --git a/.cache/icon_c_h_file.png b/assets/images/icon_c_h_file.png similarity index 100% rename from .cache/icon_c_h_file.png rename to assets/images/icon_c_h_file.png diff --git a/.cache/icon_cfg_file.png b/assets/images/icon_cfg_file.png similarity index 100% rename from .cache/icon_cfg_file.png rename to assets/images/icon_cfg_file.png diff --git a/.cache/icon_cmake_file.png b/assets/images/icon_cmake_file.png similarity index 100% rename from .cache/icon_cmake_file.png rename to assets/images/icon_cmake_file.png diff --git a/assets/images/icon_collection.png b/assets/images/icon_collection.png new file mode 100644 index 0000000000000000000000000000000000000000..8c1fc0320efb8ca076afd2c786f5cfd6346fc62d GIT binary patch literal 830 zcmeAS@N?(olHy`uVBq!ia0vp^DIm``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&di3{00jT^vIy7~kFv^pgsdXnQ#SqW0p>yN%un z?3YAMRJ1BmBN|g#A90=H(+FqTvB6s7O@r(d)dI$FmKXIL6HG2lQ7rhetaAR56^3q4 zOV7!r74`}M@S#p^#`+mt#*#q;mOhYK?WT{ti0ZO`5r^X{xsj@|t5 z(@%@;`sr-susPP9I!9hLux{ZZmcsIBwSjH7A{?ux)!KF|culyO6ZTQ~*99Z3n)eUW zH*hREyNPLjX6?tx$;;9r>)uK99)Dc7G)PjCf#JYDzImyoR&)34KPA2Ghse(FfBx8P zVU`hjQh#H%m1+F$J=49G&RROfs$;z>*T186QvXi&PdQ(=FWpE zhplY>5pcAt)PJA0;g%^u>^pbt$VjV<*P8Z0qH@B%r6m_U_g>AqTRFr0|034IV)CwR zb^lh#SzTrV+Q0GboNs1Qy|-u2o-ID#UA%|)NHSOVtA+Nuf0C`{ek=Fw-rm&G>-@hZ zJU%()tv-)&`gOJ^YA3QbeovGU46K~e*za=m>%~nstrU+{{#a%AUip%{g>TFE>5hjC zQjb{77I^yVRo2fxL3ySje~sqcO)>g8<;T3gs~r!0{rWXqVw1!wmzKN5O&KTE*O)K4 zbL>|+%bQMxBo3uE`Vc~S_KK+@>)1>TR!FEkl-k6`Syxcwe~33qV%xd=TILx`B6RxF zHs9R+@J`mlTYFDOhV6`5_d77id`_#p?AM@`S9tRCm+kHE?+^X&a8@9+;*70Z>ED0X zw%(6k8+P!#_Whpjpkv!KMRhv8uhE|82^%MdJ4)2 b3<``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&di49u~fE{-7;jBoFr&Xo!jVS8ZgyeHX_eIZM^ zKn#=9qm5lJ53D;7;CP3zqOn3ZhUqcan-GCZjNA#P{d2M#r?f6Em|2{D?&yE@NCn9W zGw&C_|Jx|p0kj1Q4%9PN=Io3y`|(Kev{A9Aqkv1H41e|BIG1^!%qAR7Dm*Q|xW8`t zvX`~nZ`Z2uw?0|;v&L>geM@3X;*ZA#((fy_x6j}`>wNjJ=Juxxb8fsWVS6IDp6Q{% zF_~lKn~d{-nm)CNH}<$Kj@lYkYv*@w+mE{Z-+%utyZ=7l!}4pR&+^MvOM@z(t-e0x zyp`u9>A1$Vo`zQ&We!DrylQnaK)&l%sF;5C`qsk+_n6HbCkJUU8@BeV=f5=Q^U+u@ zOX54(@LcY#@zEY z_?}L5-no3zR4I>phn_oZx&3xls@RE3OoBQ!m%QF;EoFJM;De{O?vz8}k$qhAw_M^% zS=eZy2b9yC(8?MV@NjZiMWc?&ghkx*wf-BG3wC zY-ZAw>v(iX{nQ@aImr8Ed``q(QCI~^PE>8&IeGQ)l^0~3}aD^?Il73eU+Faw*gApa2=7kQS( z7n$?#yY}P5Y7bb-2hm%8G4JD@@aIs7V=Rd4>FVdQ&MBb@ E0Fhaowg3PC literal 0 HcmV?d00001 diff --git a/assets/images/icon_import.png b/assets/images/icon_import.png new file mode 100644 index 0000000000000000000000000000000000000000..52307b720ff5ebfd4bbaa2dc4a34dc8d45b451c9 GIT binary patch literal 918 zcmV;H18Mw;P)fPrnA}Xtl4Z%DWf7O z;27^I-WZ~Ma&mG@3RHrybBY`vH}6P6<{;}++X_Ls+wEpP#m^jsPj4#(za1VPzM+gt zl+kLn+IWh~1F2jGpu56*gOqZnbqoO|2oe|s2@HY+20;RYAb~-Uz?cXkR|908g(6^O z3#sy?*Ha8p%T-LMSwugRJks$n7qS=Xj1{ z_O#dQ?#uKz#A6im14D07T#VE`MR9ZK#7h)c*RniB*?8J3D<^1=k|cS>bN5>%n+hr}s5UzGv)?)}a zK|I6|E`oT8AzXxe=N#;Jy9dGFMku_oT>c454x7VwFFj z_J(EDf_RQ0OzpC~#}Hf#NlxGBcjKPKa1CYa(#V$Mj2@x zL$Y&{$_6(4>wBs# zp^D&{vCTX(zmHTArH+L8W<0jX3K0MR00000000000001lt3rVr38@6*&#hK# zLY}>&fJux>rSi;Q)=o}No_oDsM4kmZLedzU&E{G!!e7NiN`iJ4>k&lT!$T_6n??3Tj>)LShgN~G7&$6^e z3HriNW0c^p)U`zkK8Vm11wj&8q9Di?4N(x}Kfa?N$PPZEAjm6xMM01~d_+Nz42O=Q zE=afAJv%);jrdDhS|$E4&dI+!!#l(xR}}9-k^q;y!yov=zvOR4bo`v7cndNd4(t4K z&;M!`zkSEVDayfv@QU3HkAz!}P@}icI?BO0d@(@}?0dk2UN*N)1G1cK1 z_mtn1cg%RWmxcEwvf17>hA4av$r&T&or(G9W1a|q+Z=n#BKt%CPS1_xi6IIdA##}F zmoC|nQSdOI&mT1e*k=37l{bbcEQsYpXhLlW;Uk79-Al;*?c6We8&()T!)NJHj+1w7};_K zNzSUGtnF}^GM9IRnCwK180MUVBzJG4jLoKUHbqKliy@qY@SD3f*yaJJwsxG(vc}`_ z*-;?wD-r>r~x3h|C`b4=AWSTnYJ*v!eLCZn6%tTrN$X7WqYr?Th03 zBGx(xAFeX*=*r>}DYq+%hC2!_b4b>sol}kL8@p^r(Q5JVZ5ds$gm;u8XA)sng_(t5#j`f6?mu)Y!K4lV&(P(roPrnlY0000000000 h00000002OV{sPJSa>CKTiX#93002ovPDHLkV1l{Z#_s?C literal 0 HcmV?d00001 diff --git a/.cache/icon_rust_file.png b/assets/images/icon_rust_file.png similarity index 100% rename from .cache/icon_rust_file.png rename to assets/images/icon_rust_file.png diff --git a/assets/images/icon_save.png b/assets/images/icon_save.png new file mode 100644 index 0000000000000000000000000000000000000000..756fb7b8ca6e6493d6a9609f5defa83dccd20f69 GIT binary patch literal 849 zcmeAS@N?(olHy`uVBq!ia0vp^DIm``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&di3{1~FT^vIy7~kG?%)8|va_nO|v$o0<@A z#H6Xg`0q^5#7Tu>)zq|6Zh2ZwmE;l*KP6IIgQ&DR$pBeE^;(P zPx(-CbZ=2@pT@$92X3v$B2K3sD_G>Vc;h_3<>5hwpE)$$k40rU%zyr@z#_(9ZSvfZ zC7NzeO;QWj?|&S}z~Xq}`s#n3^UH6){WkaB91m9?$5X5}Ld><3W?S^_=VFk3J8_@o zFaJBbo|j9^W%%s9SbefP_RWxA()OkDe#R94Aja2=?oFL_Nn`uzr=Q$xjC~`m_GsUK zRk7}9lA!7AvoEgHe*69R*d~Ye#ERw0Py7Ai?=6e@yr|F1JUIU=@8mhV{Fh(u{Bml` z(Iv{MX7kV2_a1-TTk+s&vB%x5QERtKPkhAK{G;%xoyD(?Lkj;~>=qex#81@wa{ow! zqfPPrXGa?x4;XMrurVH1NRVLRX>LdqFyLWog9;XJv|e#VeD4{*yNL!8f5Z&*)^>ls4%l6XIE-Trpxo%?0|jtmRd zD86H@Jh3Tf+4lNVk}plZhLvlnYTRGo7=2~(ry{dm&L>?3Mee*|#cDs9g2$v%w7<-F zxnR~cg}A;Wm5DyFj-XOrE;6^-J`9 zpWKu=W68yg9hW0^ELJ)ox90w$o(+ZSi#}E=)F~mrsw44CW5EhaR z?7zJ2$RdW!Ojixw$`A4nV`U_R4R)k#N*@RTMC@u1;LjXkr0yNY7x93AR;*;3Y?$?f&UOU zF&7sXZzy1b7DU6ubi3W4{YcP)NcxWfQ&Uqx`;pK`h`4#t5LuGYM~Jw230;sWQs(63 zq&Yb``S;Du&7X}%<2uWG*@xf@BuVm!d~k5ExUjIW)$8>twOVbT6j7b29~~V(c5oPgvBa$V-Y<(%s3pvU|o3|z=ChBq}=sQwEO%U|1 zI-U-G@UjHGuZd9f%izml6Nmr%FzAt*;2L}D>+4PadC&>cTpOmVy1BV|NeXBRlGWU_ z@ObMUMUt>79X3m8-gA3jj;$BYKZGWAL7lVml8n-i!$Y_3k{sSo>K0?@$ zWAb%Xgvohjt}#lMq(_PP2tib}TLLkd#ksk;KS&tS5i%U+mIdiBSagIyjL%du*dmZ1 zVuH9ZH=^^cAdHxU7a1Wup`!AN!7NIJ!QLa}wH-Mkx&-rx z#Ql?_yU0Bk%{3hSa@uve=kQ+bm3C?=;6=(7M7V^R_-mAzaEpS!$0hZ`?4vf|a^oh-c&s|LFerAY8f&~jC5#sI-O+}pF9v-I?=Gz+~Z(!Qf2qj0>8&=ZA}uycLWb3HdAL?Ep5Ue zaGiu%U0vOiYNPv{SV{~=bS;ac3unUGNis)ceG(z(A>o`sVx zx!Q(#MnZ}NTe+xFK=1_Z&(Fm;><=jw!3x4T7E+|ZMaN923W8`RqMXdk%tWM1F2V2a z?tUdj)CA$$ET5I&>FMd;ND0p2N(o#cGb=am5(kVlX0ta0af|>v=h|aR!2f zGcg2y9m zm%G6AIUC4Zo#PR|Ry`eC`v9|e=rDo)-avlTYPD2ViLZTt*{F`eBT2(|3{Vw>!I#?K zE)27Dm^GV*HL|Nm`EwUDA3)~v<}pmwFOpjiMxic<4-k|0FxE*BJ{t>u!)vFkCZQh_ zn~*Tbk*HPGOAz`ovHy@T8X`*)v>@os;xm5Ct`iEFpato6yW-{rpZPBZOwdl9fnygv zNf{AV(DytJ`$H0vBcZ?U@oN@S*M`C^ipH6=9_4t)c^nh07*qoM6N<$f}nUj?f?J) literal 0 HcmV?d00001 diff --git a/assets/images/icon_star.png b/assets/images/icon_star.png new file mode 100644 index 0000000000000000000000000000000000000000..d3150522d010d14ec481106c414789774d356a27 GIT binary patch literal 1542 zcmV+h2Ko7kP)UIF|csw4D$K&yMJRVPOE-x>m)6>%sW`GLJ z06`F}EiEm5h8bWc1bKaZ{fx^2%mCsAxw*M%;wr)=MC*z{IN}AFo15Doy{=ZPhaj9e z5DX=A6yd+|ZG*vJb!TU%3qlbcA@4;*rBeAD1S2*=-ir=J|MBs0rPXTnK_Fry1jUFG z-U=m`z>+O1F@Z}ifkg^(cXzi2KTF*t#FoG!1)&?ktbL@Gz~Yj6N;3b2=jZ48-rnAK z5QMl0$#dn`YBg~su&4;>bUGnk_1_>pe~crp1Qrz`C`MK?pCnvdT-*miNVBXWiFyqL zAx4nf+uIoOMaPI(QVA?Z5G-{ITaTm?SVU6KQ|cyx$^CZ;$z4Q*n7G2F^tYr~Rt%a@ ze@ntd2__j3;6& z5S+eqced;`QR*h(bbrg)2uT^D)y3%{Ue*Y~Zf%4O!VvR9gvmO@A)frVZMaZb zN=pPh^l<6panRBm3ST+BM8nVUCLFDma6Q_NLO!UU$qsuuc99!x|Z zuFp3&H&aJ2r;3p4>+3`O&yK)T7`%{=wzjsuWbHS#WqDDGgZ6!}y}f-h&Az#E2#T_X zUU@1#A28C#{My>x-Ti0Ue~>$=)BOR8@-HQB@Fb!Vej_VqOj4-I@}i_eVxUdYEc_ni zq|l8a{i0f}R>zlJ@J!NudU~oC5rfdaF~qU%ue0(vnJ#!9jd0( z#-z(-u~vgn2W#`P)boP>gM-+7bivxZEF4KQIYrbc3kwU@j?Lyoxxc_ss@3YBU=%!X93mz{z(OA3ex%LW zhGG)jjYif8DWjoC;}*Dz(Oz2WwNbbmjREjtGJnv}>M@R6oTw}K9+xxIt;xFbX>{M8tD6UVsk)Amy%eJ#A_xyRw+ zL(So0R?A{b>eNug)i)@{q&?+A*Ty)%|Ci0O@JcP3KN9U}T6ArUv(d7?@zmAvwO;hwQ1vHT^~%7d>Q@ zIb@6bMeFP94^T2JmPHLkw5-JU$(~S%cAn?CO`wEtpfJrW8&l

C;JBEGw;{II<^h zF~%Vqqse<|HpbOxfsa<7hON zZdv0EMRjvmcU=r(WMe4E@n{=Iqmje1M$Nf4mYbrUJ5)B-#%MV~8|!d48cSgo{yyyp s)&B8#JRXn7> contentbrowser_items; std::vector> contentbrowser_customfolders; - std::string contentbrowser_basepath; + std::string contentbrowser_mainpool; + std::string contentbrowser_absolute_mainpool; std::vector contentbrowser_pools; + std::vector copy_selection; + std::vector cut_selection; + float past_state; // from 0.0f (0%) to 1.0f (100%) // Main utilities std::vector> em_utilities; @@ -313,8 +317,9 @@ namespace VortexMaker // Publish to ROM VORTEX_API void PublishContentBrowserCustomFolder(const std::string& path, const std::string &hex_color, const bool& isFav); + VORTEX_API void PublishPool(const std::string& absolute_pool_path); VORTEX_API void PostCustomFolderToJson(); - VORTEX_API void AddNewFolderPool(const std::string& path); + VORTEX_API void PostPoolsToJson(); // Fetch from ROM VORTEX_API void FetchCustomFolders(); @@ -325,6 +330,19 @@ namespace VortexMaker VORTEX_API bool GetContentBrowserFolderColor(const std::string& path, ImU32* color); + VORTEX_API void Copy(std::vector selection, bool in_addition); + VORTEX_API void Cut(std::vector selection, bool in_addition); + VORTEX_API void ClearCopySelection(); + VORTEX_API void ClearCutSelection(); + VORTEX_API void PasteAllSelections(const std::string& target_path); + + VORTEX_API void DeleteFolder(const std::string& target_path); + VORTEX_API void DeleteFile(const std::string& target_path); + VORTEX_API void DeletePath(const std::string& target_path); + + VORTEX_API void RenameFolder(const std::string& target_path, const std::string& new_name); + VORTEX_API void RenameFile(const std::string& target_path, const std::string& new_name); + VORTEX_API ImU32 HexToImU32(const std::string& hex); VORTEX_API std::string ImU32ToHex(ImU32 color); } diff --git a/main/src/vortex.cpp b/main/src/vortex.cpp index 2779247..1a22431 100644 --- a/main/src/vortex.cpp +++ b/main/src/vortex.cpp @@ -806,6 +806,30 @@ VORTEX_API void VortexMaker::PostCustomFolderToJson() VortexMaker::PopulateJSON(json_data, file_path); } +VORTEX_API void VortexMaker::PublishPool(const std::string &absolute_pool_path) +{ + VxContext &ctx = *CVortexMaker; + + std::size_t endPos = absolute_pool_path.size() - 1; + + if (absolute_pool_path[endPos] == '/' || absolute_pool_path[endPos] == '\\') + { + endPos--; + } + + for (auto path : ctx.IO.contentbrowser_pools) + { + if (path == absolute_pool_path) + { + return; + } + } + + ctx.IO.contentbrowser_pools.push_back(absolute_pool_path); + + VortexMaker::PostPoolsToJson(); +} + VORTEX_API void VortexMaker::PublishContentBrowserCustomFolder(const std::string &path, const std::string &hex_color, const bool &isFav) { VxContext &ctx = *CVortexMaker; @@ -832,10 +856,6 @@ VORTEX_API void VortexMaker::PublishContentBrowserCustomFolder(const std::string VortexMaker::PostCustomFolderToJson(); } -VORTEX_API void VortexMaker::AddNewFolderPool(const std::string &path) -{ -} - VORTEX_API bool VortexMaker::ContentBrowserFolderIsFav(const std::string &path) { VxContext &ctx = *CVortexMaker; @@ -900,6 +920,60 @@ VORTEX_API std::string VortexMaker::ImU32ToHex(ImU32 color) return ss.str(); } +VORTEX_API void VortexMaker::FetchPools() +{ + VxContext &ctx = *CVortexMaker; + std::string path = ctx.projectPath.string() + "/.vx/configs/content_browser/"; + VortexMaker::createFolderIfNotExists(path); + + std::string file_path = path + "/pools.json"; + + nlohmann::json json_data; + + VortexMaker::createJsonFileIfNotExists(file_path, json_data); + + std::ifstream file(file_path); + + file >> json_data; + + // From master pool relative path (from project path) + ctx.IO.contentbrowser_mainpool = json_data["main_pool"].get(); + + std::string projectPath = ctx.projectPath.c_str(); + ctx.IO.contentbrowser_absolute_mainpool = projectPath + "/" + ctx.IO.contentbrowser_mainpool; + + // From other pool absolute paths + for (auto directory : json_data["other_pools"]) + { + std::string path = directory["path"].get(); + ctx.IO.contentbrowser_pools.push_back(path); + } +} + +VORTEX_API void VortexMaker::PostPoolsToJson() +{ + VxContext &ctx = *CVortexMaker; + std::string path = ctx.projectPath.string() + "/.vx/configs/content_browser/"; + VortexMaker::createFolderIfNotExists(path); + + std::string file_path = path + "/pools.json"; + + nlohmann::json json_data; + + json_data["pools"] = nlohmann::json::array(); + json_data["main_pool"] = ctx.IO.contentbrowser_mainpool; + + for (const std::string &path : ctx.IO.contentbrowser_pools) + { + nlohmann::json folder_data; + folder_data["path"] = path; + + json_data["pools"].push_back(folder_data); + } + + VortexMaker::PopulateJSON(json_data, file_path); +} + VORTEX_API void VortexMaker::FetchCustomFolders() { VxContext &ctx = *CVortexMaker; @@ -927,8 +1001,161 @@ VORTEX_API void VortexMaker::FetchCustomFolders() } } -VORTEX_API void VortexMaker::FetchPools() +VORTEX_API void VortexMaker::Copy(std::vector selection, bool in_addition) { + VxContext &ctx = *CVortexMaker; + + if (!in_addition) + { + ctx.IO.copy_selection.clear(); + } + + for (auto selected : selection) + { + ctx.IO.copy_selection.push_back(selected); + } +} + +VORTEX_API void VortexMaker::Cut(std::vector selection, bool in_addition) +{ + VxContext &ctx = *CVortexMaker; + + if (!in_addition) + { + ctx.IO.cut_selection.clear(); + } + + for (auto selected : selection) + { + ctx.IO.cut_selection.push_back(selected); + } } +VORTEX_API void VortexMaker::ClearCutSelection() +{ + VxContext &ctx = *CVortexMaker; + + ctx.IO.cut_selection.clear(); +} + +VORTEX_API void VortexMaker::ClearCopySelection() +{ + VxContext &ctx = *CVortexMaker; + + ctx.IO.copy_selection.clear(); +} + +VORTEX_API void VortexMaker::PasteAllSelections(const std::string &target_path) +{ + VxContext &ctx = *CVortexMaker; + + for (auto cut_selected : ctx.IO.copy_selection) + { + std::string cmd = "cp -r " + cut_selected + " " + target_path; + system(cmd.c_str()); + } + + for (auto copy_selected : ctx.IO.cut_selection) + { + std::string cmd = "mv " + copy_selected + " " + target_path; + system(cmd.c_str()); + } +} + +VORTEX_API void VortexMaker::RenameFolder(const std::string& target_path, const std::string& new_name) { + namespace fs = std::filesystem; + + try { + fs::path target(target_path); + if (!fs::exists(target) || !fs::is_directory(target)) { + throw std::runtime_error("Target path does not exist or is not a directory."); + } + + fs::path new_path = target.parent_path() / new_name; + fs::rename(target, new_path); + } catch (const fs::filesystem_error& e) { + throw std::runtime_error(std::string("Filesystem error: ") + e.what()); + } catch (const std::exception& e) { + throw std::runtime_error(std::string("Error: ") + e.what()); + } +} + +VORTEX_API void VortexMaker::RenameFile(const std::string& target_path, const std::string& new_name) +{ + namespace fs = std::filesystem; + + try { + fs::path target(target_path); + if (!fs::exists(target) || !fs::is_regular_file(target)) { + throw std::runtime_error("Target path does not exist or is not a file."); + } + + fs::path new_path = target.parent_path() / new_name; + fs::rename(target, new_path); + } catch (const fs::filesystem_error& e) { + throw std::runtime_error(std::string("Filesystem error: ") + e.what()); + } catch (const std::exception& e) { + throw std::runtime_error(std::string("Error: ") + e.what()); + } +} + +VORTEX_API void VortexMaker::DeleteFile(const std::string& target_path) { + try { + // Check if the target path exists and is a file + if (!std::filesystem::exists(target_path) || !std::filesystem::is_regular_file(target_path)) { + throw std::invalid_argument("The specified path does not exist or is not a file."); + } + + // Attempt to remove the file + std::filesystem::remove(target_path); + } catch (const std::filesystem::filesystem_error& e) { + std::cerr << "Filesystem error: " << e.what() << '\n'; + // Additional handling for different types of filesystem errors can be done here + } catch (const std::exception& e) { + std::cerr << "General error: " << e.what() << '\n'; + } catch (...) { + std::cerr << "An unknown error occurred while deleting the file." << '\n'; + } +} + +VORTEX_API void VortexMaker::DeleteFolder(const std::string& target_path) { + try { + // Check if the target path exists and is a directory + if (!std::filesystem::exists(target_path) || !std::filesystem::is_directory(target_path)) { + throw std::invalid_argument("The specified path does not exist or is not a directory."); + } + + // Attempt to remove the directory and its contents + std::filesystem::remove_all(target_path); + } catch (const std::filesystem::filesystem_error& e) { + std::cerr << "Filesystem error: " << e.what() << '\n'; + // Additional handling for different types of filesystem errors can be done here + } catch (const std::exception& e) { + std::cerr << "General error: " << e.what() << '\n'; + } catch (...) { + std::cerr << "An unknown error occurred while deleting the folder." << '\n'; + } +} + +VORTEX_API void VortexMaker::DeletePath(const std::string& target_path) { + try { + // Check if the path exists + if (!std::filesystem::exists(target_path)) { + throw std::invalid_argument("The specified path does not exist."); + } + + // Determine if it's a file or directory + if (std::filesystem::is_directory(target_path)) { + DeleteFolder(target_path); + } else if (std::filesystem::is_regular_file(target_path)) { + DeleteFile(target_path); + } else { + throw std::invalid_argument("The specified path is neither a regular file nor a directory."); + } + } catch (const std::exception& e) { + std::cerr << "Error: " << e.what() << '\n'; + } catch (...) { + std::cerr << "An unknown error occurred while processing the path." << '\n'; + } +} #endif // VORTEX_DISABLE \ No newline at end of file diff --git a/main/src/vortex/content_browser/custom_folders.cpp b/main/src/vortex/content_browser/custom_folders.cpp new file mode 100644 index 0000000..e69de29 diff --git a/main/src/vortex/content_browser/pools.cpp b/main/src/vortex/content_browser/pools.cpp new file mode 100644 index 0000000..e69de29 diff --git a/tools/editor/app/core/ContentBrowser.cpp b/tools/editor/app/core/ContentBrowser.cpp index 3bb62eb..ae4cc38 100644 --- a/tools/editor/app/core/ContentBrowser.cpp +++ b/tools/editor/app/core/ContentBrowser.cpp @@ -7,7 +7,52 @@ Selection (dont multiple), Cpy, Past, etc... +- Main pool, Collections & Pools +- Copy, Paste, Cut (with multi selection) (make copy x elements) +- Rename +- Register handler and launch with handler +- Filters +- Up menubar +- Show mode + +- Widjets for Details, Contents +- Toolchains & other modules +- Finish (winbehavior + components) + Doc ! + + */ +static float padding = 30.0f; +static float thumbnailSize = 94.0f; + +static std::string pathToRename = ""; +static char pathRename[256]; + +static const std::string File_LICENSE_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_license_file.png"; +static const std::string File_ASM_Logo = "/usr/local/include/Vortex/1.1/imgs/file_asm_logo.png"; +static const std::string File_GIT_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_git_file.png"; +static const std::string File_C_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_c_file.png"; +static const std::string File_C_H_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_c_h_file.png"; +static const std::string File_CPP_H_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_cpp_h_file.png"; +static const std::string File_CPP_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_cpp_file.png"; +static const std::string File_UNKNOW_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_unknow_file.png"; +static const std::string File_PICTURE_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_picture_file.png"; +static const std::string Folder_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_folder.png"; +static const std::string Star_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_star.png"; +static const std::string Collection_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_collection.png"; +static const std::string Home_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_home.png"; +static const std::string Add_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_add.png"; +static const std::string Import_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_import.png"; +static const std::string Save_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_save.png"; +static const std::string Settings_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_settings.png"; +static const std::string Return_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_settings.png"; + +static const std::string Icon_Left_Arrow_Enabled = "/usr/local/include/Vortex/1.1/imgs/icon_arrow_l_enabled.png"; +static const std::string Icon_Left_Arrow_Disabled = "/usr/local/include/Vortex/1.1/imgs/icon_arrow_l_disabled.png"; +static const std::string Icon_Right_Arrow_Enabled = "/usr/local/include/Vortex/1.1/imgs/icon_arrow_r_enabled.png"; +static const std::string Icon_Right_Arrow_Disabled = "/usr/local/include/Vortex/1.1/imgs/icon_arrow_r_disabled.png"; + +static bool pool_add_mode = false; +static char pool_add_path[512]; static std::string _parent; static char ProjectSearch[256]; @@ -100,22 +145,6 @@ static bool areStringsSimilar(const std::string &s1, const std::string &s2, doub return similarity >= threshold; } -static const std::string File_LICENSE_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_license_file.png"; -static const std::string File_ASM_Logo = "/usr/local/include/Vortex/1.1/imgs/file_asm_logo.png"; -static const std::string File_GIT_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_git_file.png"; -static const std::string File_C_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_c_file.png"; -static const std::string File_C_H_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_c_h_file.png"; -static const std::string File_CPP_H_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_cpp_h_file.png"; -static const std::string File_CPP_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_cpp_file.png"; -static const std::string File_UNKNOW_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_unknow_file.png"; -static const std::string File_PICTURE_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_picture_file.png"; -static const std::string Folder_Logo = "/usr/local/include/Vortex/1.1/imgs/icon_folder.png"; - -static const std::string Icon_Left_Arrow_Enabled = "/usr/local/include/Vortex/1.1/imgs/icon_arrow_l_enabled.png"; -static const std::string Icon_Left_Arrow_Disabled = "/usr/local/include/Vortex/1.1/imgs/icon_arrow_l_disabled.png"; -static const std::string Icon_Right_Arrow_Enabled = "/usr/local/include/Vortex/1.1/imgs/icon_arrow_r_enabled.png"; -static const std::string Icon_Right_Arrow_Disabled = "/usr/local/include/Vortex/1.1/imgs/icon_arrow_r_disabled.png"; - static std::string default_project_avatar = "/usr/local/include/Vortex/imgs/base_vortex.png"; static std::vector loadPngHex(const std::string &filePath) @@ -364,7 +393,7 @@ static void DrawHighlightedText(ImDrawList *drawList, ImVec2 textPos, const char } } -bool MyButton(const std::string &name, const std::string &description, const std::string &size, bool selected, const std::string &logo, ImU32 bgColor = IM_COL32(100, 100, 100, 255), ImU32 borderColor = IM_COL32(150, 150, 150, 255), ImU32 lineColor = IM_COL32(255, 255, 0, 255), float maxTextWidth = 100.0f, float borderRadius = 5.0f) +bool ContentBrowserPanel::MyButton(const std::string &name, const std::string &path, const std::string &description, const std::string &size, bool selected, const std::string &logo, ImU32 bgColor = IM_COL32(100, 100, 100, 255), ImU32 borderColor = IM_COL32(150, 150, 150, 255), ImU32 lineColor = IM_COL32(255, 255, 0, 255), float maxTextWidth = 100.0f, float borderRadius = 5.0f) { bool pressed = false; @@ -423,6 +452,177 @@ bool MyButton(const std::string &name, const std::string &description, const std ImGui::SetMouseCursor(ImGuiMouseCursor_Hand); } + // Changer la couleur du texte en gris + ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) + ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) + ImVec4 darkBackgroundColor = ImVec4(0.15f, 0.15f, 0.15f, 1.0f); // Fond plus foncé + ImVec4 lightBorderColor = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); // Bordure plus claire + + // Pousser le style pour le fond plus foncé + ImGui::PushStyleColor(ImGuiCol_PopupBg, darkBackgroundColor); + + // Pousser le style pour la bordure plus claire + ImGui::PushStyleColor(ImGuiCol_Border, lightBorderColor); + + // Pousser le style pour les bords arrondis moins prononcés + ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 3.0f); + + static bool open_deletion_modal = false; + + static bool delete_single_file = false; + static std::string delete_single_file_path = ""; + + if (open_deletion_modal) + { + ImGui::SetNextWindowSize(ImVec2(300, 200)); + + static ImGuiTableFlags window_flags = ImGuiWindowFlags_NoResize; + if (ImGui::BeginPopupModal("Delete file(s)", NULL, window_flags)) + { + // Set the size of the modal to 200x75 pixels the first time it is created + + // 3 text inputs + static char path_input_all[512]; + // inputs widget + + if (delete_single_file) + { + ImGui::TextWrapped("WARNING, one file"); + } + else + { + ImGui::TextWrapped("WARNING, if you click on the Delete button, the project will be erase forever."); + } + + ImGui::SetItemDefaultFocus(); + + if (ImGui::Button("Cancel", ImVec2(120, 0))) + { + open_deletion_modal = false; + ImGui::CloseCurrentPopup(); + } + ImGui::SameLine(); + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 0.2f, 0.2f, 0.9f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 0.2f, 0.2f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 0.2f, 0.2f, 1.8f)); + if (ImGui::Button("Delete", ImVec2(120, 0))) + { + if (delete_single_file) + { + VortexMaker::DeletePath(delete_single_file_path); + delete_single_file_path = ""; + delete_single_file = false; + } + else + { + for (auto item : m_Selected) + { + VortexMaker::DeletePath(item); + } + } + + open_deletion_modal = false; + ImGui::CloseCurrentPopup(); + } + ImGui::PopStyleColor(3); + ImGui::EndPopup(); + } + } + if (open_deletion_modal) + ImGui::OpenPopup("Delete file(s)"); + + if (ImGui::IsItemHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Right)) + { + m_Selected.push_back(path); + } + + if (ImGui::BeginPopupContextItem("ContextPopup")) + { + // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); + + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + ImGui::Text("Main"); + ImGui::PopStyleColor(); + + if (ImGui::MenuItem("Rename", "Ctrl + R")) + { + pathToRename = path; + strncpy(pathRename, name.c_str(), sizeof(pathRename)); + pathRename[sizeof(pathRename) - 1] = '\0'; + } + + std::string cpy_label = "Copy (" + std::to_string(m_Selected.size()) + ") selected"; + + if (ImGui::MenuItem(cpy_label.c_str(), "Ctrl + C")) + { + VortexMaker::Copy(m_Selected, false); + m_Selected.clear(); + + ImGui::CloseCurrentPopup(); + } + + if (this->ctx->IO.copy_selection.size() > 0) + { + std::string label = "Copy in addition (" + std::to_string(this->ctx->IO.copy_selection.size()) + " copies)"; + if (ImGui::MenuItem(label.c_str(), "Ctrl + Alt + C")) + { + VortexMaker::Copy(m_Selected, true); + m_Selected.clear(); + ImGui::CloseCurrentPopup(); + } + } + + if (ImGui::MenuItem("Delete", "Suppr")) + { + delete_single_file = true; + delete_single_file_path = path; + open_deletion_modal = true; + ImGui::CloseCurrentPopup(); + } + + if (m_Selected.size() > 1) + { + std::string label = "Delete (" + std::to_string(m_Selected.size()) + " selected)"; + if (ImGui::MenuItem(label.c_str(), "Alt + Suppr")) + { + // + open_deletion_modal = true; + ImGui::CloseCurrentPopup(); + } + } + + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); + + // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); + + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + ImGui::Text("Customization"); + ImGui::PopStyleColor(); + + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); + + // Ajouter d'autres options de menu ici... + + ImGui::EndPopup(); + } + // Pop les styles appliqués + ImGui::PopStyleVar(); // Pour les bords arrondis + ImGui::PopStyleColor(2); // Pour le fond et la bordure + ImDrawList *drawList = ImGui::GetWindowDrawList(); drawList->AddRectFilled(cursorPos, ImVec2(cursorPos.x + fixedSize.x, cursorPos.y + fixedSize.y), bgColor, borderRadius); @@ -462,7 +662,26 @@ bool MyButton(const std::string &name, const std::string &description, const std ImU32 highlightColor = IM_COL32(255, 255, 0, 255); ImU32 highlightTextColor = IM_COL32(0, 0, 0, 255); - DrawHighlightedText(drawList, textPos, truncatedText.c_str(), ProjectSearch, highlightColor, textColor, highlightTextColor); + if (pathToRename == path) + { + ImGui::SetItemAllowOverlap(); + ImGui::PushID(path.c_str()); + if (ImGui::InputText("", pathRename, sizeof(pathRename), ImGuiInputTextFlags_EnterReturnsTrue)) + { + std::cout << "Renamed file to: " << pathRename << std::endl; + pathToRename = ""; + } + if (ImGui::IsItemDeactivatedAfterEdit()) + { + std::cout << "Renamed file to: " << pathRename << std::endl; + pathToRename = ""; + } + ImGui::PopID(); + } + else + { + DrawHighlightedText(drawList, textPos, truncatedText.c_str(), ProjectSearch, highlightColor, textColor, highlightTextColor); + } ImGui::PopItemWidth(); @@ -545,10 +764,11 @@ FileTypes detect_file(const std::string &path) } } -void ContentBrowserPanel::DrawHierarchy(std::filesystem::path path, bool isDir, const std::string& label = "") +void ContentBrowserPanel::DrawHierarchy(std::filesystem::path path, bool isDir, const std::string &label = "") { + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 12.0f); std::string tree_label = "???"; - if(label.empty()) + if (label.empty()) { tree_label = path.filename().string() + "###treenode"; } @@ -556,25 +776,23 @@ void ContentBrowserPanel::DrawHierarchy(std::filesystem::path path, bool isDir, { tree_label = label + "###treenode"; } - + ImGuiTreeNodeFlags treeNodeFlags = ImGuiTreeNodeFlags_AllowItemOverlap | ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_FramePadding; ImVec2 cursorPos = ImGui::GetCursorPos(); ImGui::SetItemAllowOverlap(); - ImVec2 pos = ImGui::GetCursorScreenPos(); ImU32 col; if (VortexMaker::GetContentBrowserFolderColor(path.string(), &col)) { - DrawFolderIcon(pos, ImVec2(12,12), col); + DrawFolderIcon(pos, ImVec2(12, 12), col); } else { - DrawFolderIcon(pos, ImVec2(12,12), folder_color); + DrawFolderIcon(pos, ImVec2(12, 12), folder_color); } - //ImGui::SameLine(); if (ImGui::TreeNode(tree_label.c_str())) { for (auto &dirEntry : std::filesystem::directory_iterator(path)) @@ -584,35 +802,32 @@ void ContentBrowserPanel::DrawHierarchy(std::filesystem::path path, bool isDir, DrawHierarchy(otherPath, dirEntry.is_directory()); } - //this->ChangeDirectory(path); ImGui::TreePop(); } ImVec2 finalCursorPos = ImGui::GetCursorPos(); ImVec2 size = ImGui::GetItemRectSize(); +} - // if (!isDir) - //{ - /*ImGui::SetCursorPos(cursorPos); - ImGui::SetItemAllowOverlap(); +ContentBrowserPanel::ContentBrowserPanel(VxContext *_ctx, const std::string &parentwindow) + : m_BaseDirectory(VortexMaker::getHomeDirectory()), m_CurrentDirectory(m_BaseDirectory) +{ + this->ctx = _ctx; + + VortexMaker::FetchCustomFolders(); + VortexMaker::FetchPools(); - if (ImGui::InvisibleButton(("##" + path.string()).c_str(), size)) + if (!this->ctx->IO.contentbrowser_absolute_mainpool.empty()) { - this->ChangeDirectory(path); + m_BaseDirectory = this->ctx->IO.contentbrowser_absolute_mainpool; } - ImGui::SetCursorPos(finalCursorPos);*/ - //} -} + m_CurrentDirectory = m_BaseDirectory; + + VortexMaker::LogInfo("contentbrowser_absolute_mainpool", this->ctx->IO.contentbrowser_absolute_mainpool); -ContentBrowserPanel::ContentBrowserPanel(VxContext *_ctx, const std::string &parentwindow) - : m_BaseDirectory("/"), m_CurrentDirectory(m_BaseDirectory) -{ - this->ctx = _ctx; parent = parentwindow; _parent = parentwindow; - VortexMaker::FetchCustomFolders(); - { uint32_t w, h; void *data = UIKit::Image::Decode(icons::i_FolderIcon, icons::i_FolderIcon_size, w, h); @@ -631,6 +846,20 @@ ContentBrowserPanel::ContentBrowserPanel(VxContext *_ctx, const std::string &par m_ProjectIcon = std::make_shared(w, h, UIKit::ImageFormat::RGBA, parent, data); free(data); } + + addTexture(Icon_Left_Arrow_Enabled, Icon_Left_Arrow_Enabled); + addTexture(Icon_Right_Arrow_Enabled, Icon_Right_Arrow_Enabled); + addTexture(Icon_Left_Arrow_Disabled, Icon_Left_Arrow_Disabled); + addTexture(Icon_Right_Arrow_Disabled, Icon_Right_Arrow_Disabled); + addTexture(Add_Logo, Add_Logo); + addTexture(Home_Logo, Home_Logo); + addTexture(Collection_Logo, Collection_Logo); + addTexture(Star_Logo, Star_Logo); + addTexture(Import_Logo, Import_Logo); + addTexture(Save_Logo, Save_Logo); + addTexture(Settings_Logo, Settings_Logo); + addTexture(Return_Logo, Return_Logo); + addTexture(File_PICTURE_Logo, File_PICTURE_Logo); } void ContentBrowserPanel::DrawPathBar() @@ -670,14 +899,18 @@ void ContentBrowserPanel::menubar() { static ImTextureID refreshIcon = this->m_ProjectIcon->GetImGuiTextureID(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); - addTexture(Icon_Left_Arrow_Enabled, Icon_Left_Arrow_Enabled); - addTexture(Icon_Right_Arrow_Enabled, Icon_Right_Arrow_Enabled); - addTexture(Icon_Left_Arrow_Disabled, Icon_Left_Arrow_Disabled); - addTexture(Icon_Right_Arrow_Disabled, Icon_Right_Arrow_Disabled); + ImGuiStyle &style = ImGui::GetStyle(); + ImVec2 framePadding = style.FramePadding; + + // Calculate the adjusted window position + ImGuiIO &io = ImGui::GetIO(); + float menuBarHeight = ImGui::GetFrameHeight(); // Get the height of the menu bar + ImVec2 windowPos = ImVec2(io.DisplaySize.x - 200 - framePadding.x, framePadding.y); ImGui::SetNextWindowSize(ImVec2(200, 300)); - ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x - 200, 300)); - ImGui::PushStyleColor(ImGuiCol_Separator, ImVec4(0.3f, 0.3f, 0.3f, 0.3f)); + ImGui::SetNextWindowPos(windowPos); + + ImGui::PushStyleColor(ImGuiCol_Separator, ImVec4(0.3f, 0.3f, 0.3f, 0.3f)); if (ImGui::BeginMenuBar()) { @@ -697,7 +930,7 @@ void ContentBrowserPanel::menubar() ImGui::SetCursorPosY(ImGui::GetCursorPosY() + offsetY); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 0.7f)); - if (ImGui::UIKit_ImageButtonWithText(refreshIcon, "Add", ImVec2(15, 15))) + if (ImGui::UIKit_ImageButtonWithText(getTexture(Add_Logo), "Add", ImVec2(15, 15))) { // Action du bouton } @@ -707,7 +940,10 @@ void ContentBrowserPanel::menubar() ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(62, 62, 62, 0)); ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(62, 62, 62, 0)); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(62, 62, 62, 0)); - if (ImGui::UIKit_ImageButtonWithText(refreshIcon, "Import", ImVec2(15, 15))) + if (ImGui::UIKit_ImageButtonWithText(getTexture(Save_Logo), "Save all", ImVec2(15, 15))) + { + } + if (ImGui::UIKit_ImageButtonWithText(getTexture(Import_Logo), "Import", ImVec2(15, 15))) { } ImGui::PopStyleColor(4); @@ -768,9 +1004,22 @@ void ContentBrowserPanel::menubar() ImGui::Separator(); + if (this->ctx->IO.copy_selection.size() > 0) + { + + std::string label = std::to_string(this->ctx->IO.copy_selection.size()) + " copies"; + ImGui::TextColored(ImVec4(0.5f, 0.5f, 0.5f, 1.0f), label.c_str()); + } + + if (this->ctx->IO.cut_selection.size() > 0) + { + std::string label = std::to_string(this->ctx->IO.cut_selection.size()) + " cuts"; + ImGui::Text(label.c_str()); + } + if (m_Selected.size() > 0) { - std::string label = std::to_string(m_Selected.size()) + " element(s) selected"; + std::string label = std::to_string(m_Selected.size()) + " selected."; ImGui::Text(label.c_str()); } @@ -779,10 +1028,24 @@ void ContentBrowserPanel::menubar() ImGui::SameLine(ImGui::GetWindowWidth() - buttonWidth - spacing); - if (ImGui::BeginMenu("Settings")) + ImGui::GetFont()->Scale *= 0.85; + ImGui::PushFont(ImGui::GetFont()); + + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(62, 62, 62, 0)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(62, 62, 62, 0)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(62, 62, 62, 0)); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(62, 62, 62, 0)); + if (ImGui::UIKit_ImageButtonWithText(getTexture(Settings_Logo), "Settings", ImVec2(15, 15))) { + ImGui::OpenPopup("SettingsPopup"); + } + ImGui::PopStyleColor(4); + + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); - float oldsize = ImGui::GetFont()->Scale; + if (ImGui::BeginPopup("SettingsPopup")) + { ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); @@ -798,6 +1061,44 @@ void ContentBrowserPanel::menubar() ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); + + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + ImGui::Text("Show mode"); + ImGui::PopStyleColor(); + + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); + + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + + static bool ThumbmailsMode; + static bool ListMode; + static bool ColumnsMode; + + ImGui::Checkbox("Thumbmails", &ThumbmailsMode); + ImGui::Checkbox("Columns", &ColumnsMode); + ImGui::Checkbox("List", &ListMode); + + if (ThumbmailsMode) + { + this->m_ShowMode = ContentShowMode::Thumbmails; + } + else if (ListMode) + { + this->m_ShowMode = ContentShowMode::List; + } + else if (ColumnsMode) + { + this->m_ShowMode = ContentShowMode::Columns; + } + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); ImGui::Text("Pannels"); ImGui::PopStyleColor(); @@ -845,7 +1146,7 @@ void ContentBrowserPanel::menubar() ImGui::PopStyleVar(); ImGui::PopStyleColor(2); - ImGui::EndMenu(); + ImGui::EndPopup(); } ImGui::PopStyleVar(); @@ -982,8 +1283,16 @@ void ContentBrowserPanel::MyFolderButton(const char *id, ImVec2 size, ImU32 colo ChangeDirectory(path); } + // Calculer l'offset pour centrer l'icône du dossier horizontalement + float thumbmailWidth = thumbnailSize; // Assurez-vous que size.x est la largeur du thumbnail + float folderWidth = size.x; + float offsetX = (thumbmailWidth - folderWidth) / 2.0f; + + // Ajuster la position de dessin de l'icône du dossier + ImVec2 iconPos = ImVec2(pos.x + offsetX + 7.5f, pos.y); + // Dessiner l'icône du dossier - DrawFolderIcon(pos, size, color); + DrawFolderIcon(iconPos, size, color); if (ImGui::IsItemHovered()) { @@ -1149,16 +1458,15 @@ void ContentBrowserPanel::OnImGuiRender(const std::string &parent, std::function static ImTextureID projectIcon = this->m_ProjectIcon->GetImGuiTextureID(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar; - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); ImGui::SetNextWindowDockID(ImGui::GetID("MainDockspace"), ImGuiCond_FirstUseEver); - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10, 12)); - + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10, 12)); + if (ImGui::UIKit_BeginLogoWindow("Content Browser", &projectIcon, &this->opened, window_flags)) { - // Render the menubar with proper paddin this->menubar(); } + ImGui::PopStyleVar(); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); @@ -1200,7 +1508,7 @@ void ContentBrowserPanel::OnImGuiRender(const std::string &parent, std::function ImGui::GetFont()->Scale *= 0.85; ImGui::PushFont(ImGui::GetFont()); - if (MyCollapsingHeader("Favorites", projectIcon, size1 - 50.0f)) + if (MyCollapsingHeader("Favorites", getTexture(Star_Logo), size1 - 50.0f)) { for (auto custom_dir : this->ctx->IO.contentbrowser_customfolders) { @@ -1210,16 +1518,55 @@ void ContentBrowserPanel::OnImGuiRender(const std::string &parent, std::function } } } - if (MyCollapsingHeader(this->ctx->name.c_str(), projectIcon, size1 - 50.0f)) + if (MyCollapsingHeader(this->ctx->name.c_str(), getTexture(Home_Logo), size1 - 50.0f)) { + VXINFO("ér", m_BaseDirectory); DrawHierarchy(m_BaseDirectory, true, this->ctx->name); } - if (MyCollapsingHeader("Pools & Collections", projectIcon, size1 - 50.0f)) + if (MyCollapsingHeader("Pools & Collections", getTexture(Collection_Logo), size1 - 50.0f)) { + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 2.0f)); + + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 0.7f)); + if (!pool_add_mode) + { + if (ImGui::UIKit_ImageSizeButtonWithText(getTexture(Add_Logo), size1 - 40.0f, "Add pool")) + { + pool_add_mode = true; + } + } + else + { + ImGui::Text("Please enter a path"); + ImGui::SetNextItemWidth(-FLT_MIN); // Set the item width to take the full width + ImGui::InputText("###AddPool", pool_add_path, sizeof(pool_add_path)); + if (ImGui::UIKit_ImageButtonWithText(getTexture(Add_Logo), "Add")) + { + VortexMaker::PublishPool(pool_add_path); + pool_add_mode = false; + } + ImGui::SameLine(); + if (ImGui::UIKit_ImageButtonWithText(getTexture(Return_Logo), "Cancel")) + { + pool_add_mode = false; + } + } + ImGui::PopStyleVar(); + ImGui::PopStyleColor(); } ImGui::GetFont()->Scale = oldsize; ImGui::PopFont(); + + for (auto custom_dir : this->ctx->IO.contentbrowser_pools) + { + std::size_t lastSlashPos = custom_dir.find_last_of("/\\"); + + std::string name = custom_dir.substr(lastSlashPos + 1); + + DrawHierarchy(custom_dir, true, name); + } + ImGui::EndChild(); ImGui::PopStyleVar(4); @@ -1270,8 +1617,6 @@ void ContentBrowserPanel::OnImGuiRender(const std::string &parent, std::function ImGui::BeginChild("Child3", ImVec2(size3, 0), true); - static float padding = 30.0f; - static float thumbnailSize = 94.0f; float cellSize = thumbnailSize + padding; float panelWidth = ImGui::GetContentRegionAvail().x; @@ -1280,7 +1625,6 @@ void ContentBrowserPanel::OnImGuiRender(const std::string &parent, std::function columnCount = 1; ImGui::InputText("Search", ProjectSearch, sizeof(ProjectSearch)); - ImGui::Columns(columnCount, 0, false); std::vector directories; std::vector files; @@ -1318,370 +1662,297 @@ void ContentBrowserPanel::OnImGuiRender(const std::string &parent, std::function std::sort(directories.begin(), directories.end(), [](const auto &a, const auto &b) { return a.path().filename().string() < b.path().filename().string(); }); - for (auto &directoryEntry : directories) + if (this->m_ShowMode == ContentShowMode::Thumbmails) { - const auto &path = directoryEntry.path(); - std::string filenameString = path.filename().string(); + ImGui::Columns(columnCount, 0, false); - if (areStringsSimilar(filenameString, ProjectSearch, threshold) || isOnlySpacesOrEmpty(ProjectSearch)) - { - ImGui::PushID(filenameString.c_str()); + // Changer la couleur du texte en gris + ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) + ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) + ImVec4 darkBackgroundColor = ImVec4(0.15f, 0.15f, 0.15f, 1.0f); // Fond plus foncé + ImVec4 lightBorderColor = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); // Bordure plus claire - // Réduire légèrement la taille du dossier - float reducedThumbnailSize = thumbnailSize * 0.9f; + // Pousser le style pour le fond plus foncé + ImGui::PushStyleColor(ImGuiCol_PopupBg, darkBackgroundColor); - // Calculer les positions pour centrer l'image du dossier et le texte - float availableWidth = ImGui::GetContentRegionAvail().x; - float imageOffsetX = (availableWidth - reducedThumbnailSize) * 0.5f; + // Pousser le style pour la bordure plus claire + ImGui::PushStyleColor(ImGuiCol_Border, lightBorderColor); - // Enlever le fond gris, les contours et la bordure - ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0)); - ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0)); - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); - ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f); + // Pousser le style pour les bords arrondis moins prononcés + ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 3.0f); - // Old folder logo - /*ImGui::SetCursorPosX(ImGui::GetCursorPosX() + imageOffsetX); - addTexture(Folder_Logo, Folder_Logo); - ImGui::ImageButton(getTexture(Folder_Logo), {reducedThumbnailSize, reducedThumbnailSize}, {-1, 0}, {0, 1}); + if (ImGui::IsWindowHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Right)) + { + m_Selected.clear(); + ImGui::OpenPopup("EmptySpacePopup"); + } - if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) - { - ChangeDirectory(path); - }*/ + if (ImGui::IsWindowHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Left)) + { + m_Selected.clear(); + } - // Définir la taille et la couleur de l'icône du dossier - ImVec2 folderSize(reducedThumbnailSize, reducedThumbnailSize); // Taille de l'icône - // ImU32 folderColor = ; // Jaune + if (ImGui::BeginPopup("EmptySpacePopup")) + { // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); - // Chemin du dossier à ouvrir - std::string folderPath = "path/to/folder"; + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); - // Dessiner le bouton dossier - if (current_editing_folder.first == path.string()) - { - MyFolderButton("folder_icon", folderSize, current_editing_folder.second, path); - } - else - { - ImU32 col; + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + ImGui::Text("Main"); + ImGui::PopStyleColor(); + std::string label = "Paste (" + std::to_string(this->ctx->IO.copy_selection.size() + this->ctx->IO.cut_selection.size()) + " items)"; - if (VortexMaker::GetContentBrowserFolderColor(path.string(), &col)) - { - MyFolderButton("folder_icon", folderSize, col, path); - } - else - { - MyFolderButton("folder_icon", folderSize, folder_color, path); - } + if (ImGui::Selectable(label.c_str())) + { + VortexMaker::PasteAllSelections(m_CurrentDirectory); } + ImGui::GetFont()->Scale = 1.0f; + ImGui::PushFont(ImGui::GetFont()); + ImGui::EndPopup(); + } - float oldsize = ImGui::GetFont()->Scale; + // Pop les styles appliqués + ImGui::PopStyleVar(); // Pour les bords arrondis + ImGui::PopStyleColor(2); // Pour le fond et la bordure + for (auto &directoryEntry : directories) + { + const auto &path = directoryEntry.path(); + std::string filenameString = path.filename().string(); - // Changer la couleur du texte en gris - ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) - ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) - ImVec4 darkBackgroundColor = ImVec4(0.15f, 0.15f, 0.15f, 1.0f); // Fond plus foncé - ImVec4 lightBorderColor = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); // Bordure plus claire + if (areStringsSimilar(filenameString, ProjectSearch, threshold) || isOnlySpacesOrEmpty(ProjectSearch)) + { + ImGui::PushID(filenameString.c_str()); - // Pousser le style pour le fond plus foncé - ImGui::PushStyleColor(ImGuiCol_PopupBg, darkBackgroundColor); + // Réduire légèrement la taille du dossier + float reducedThumbnailSize = thumbnailSize * 0.9f; - // Pousser le style pour la bordure plus claire - ImGui::PushStyleColor(ImGuiCol_Border, lightBorderColor); + // Calculer les positions pour centrer l'image du dossier et le texte + float availableWidth = ImGui::GetContentRegionAvail().x; + float imageOffsetX = (availableWidth - reducedThumbnailSize) * 0.5f; - // Pousser le style pour les bords arrondis moins prononcés - ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 3.0f); - if (ImGui::BeginPopupContextItem("ContextPopup")) - { - // Appliquer le nouveau scale - ImGui::GetFont()->Scale *= 0.9; - ImGui::PushFont(ImGui::GetFont()); + // Enlever le fond gris, les contours et la bordure + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f); - // Ajouter un espace au-dessus - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); + // Old folder logo + /*ImGui::SetCursorPosX(ImGui::GetCursorPosX() + imageOffsetX); + addTexture(Folder_Logo, Folder_Logo); + ImGui::ImageButton(getTexture(Folder_Logo), {reducedThumbnailSize, reducedThumbnailSize}, {-1, 0}, {0, 1}); - ImGui::PushStyleColor(ImGuiCol_Text, grayColor); - ImGui::Text("Main"); - ImGui::PopStyleColor(); + if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) + { + ChangeDirectory(path); + }*/ - ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); - ImGui::Separator(); - ImGui::PopStyleColor(); + // Définir la taille et la couleur de l'icône du dossier + ImVec2 folderSize(reducedThumbnailSize, reducedThumbnailSize); // Taille de l'icône + // ImU32 folderColor = ; // Jaune - // Restaurer l'ancien scale de la police - ImGui::GetFont()->Scale = oldsize; - ImGui::PopFont(); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + // Chemin du dossier à ouvrir + std::string folderPath = "path/to/folder"; - if (ImGui::MenuItem("Open", "Ctrl + O")) - { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); - } - if (ImGui::MenuItem("Copy folder", "Ctrl + C")) + // Dessiner le bouton dossier + if (current_editing_folder.first == path.string()) { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); + MyFolderButton("folder_icon", folderSize, current_editing_folder.second, path); } - if (ImGui::MenuItem("Cut folder", "Ctrl + X")) + else { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); + ImU32 col; + + if (VortexMaker::GetContentBrowserFolderColor(path.string(), &col)) + { + MyFolderButton("folder_icon", folderSize, col, path); + } + else + { + MyFolderButton("folder_icon", folderSize, folder_color, path); + } } - // Appliquer le nouveau scale - ImGui::GetFont()->Scale *= 0.9; - ImGui::PushFont(ImGui::GetFont()); + float oldsize = ImGui::GetFont()->Scale; - // Ajouter un espace au-dessus - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); + // Changer la couleur du texte en gris + ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) + ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) + ImVec4 darkBackgroundColor = ImVec4(0.15f, 0.15f, 0.15f, 1.0f); // Fond plus foncé + ImVec4 lightBorderColor = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); // Bordure plus claire - ImGui::PushStyleColor(ImGuiCol_Text, grayColor); - ImGui::Text("Customization"); - ImGui::PopStyleColor(); + // Pousser le style pour le fond plus foncé + ImGui::PushStyleColor(ImGuiCol_PopupBg, darkBackgroundColor); - ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); - ImGui::Separator(); - ImGui::PopStyleColor(); + // Pousser le style pour la bordure plus claire + ImGui::PushStyleColor(ImGuiCol_Border, lightBorderColor); - // Restaurer l'ancien scale de la police - ImGui::GetFont()->Scale = oldsize; - ImGui::PopFont(); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + // Pousser le style pour les bords arrondis moins prononcés + ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 3.0f); + if (ImGui::BeginPopupContextItem("ContextPopup")) + { + // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); - static bool EditingColor = false; - static bool ColorChanged = false; + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); - current_editing_folder_is_favorite = VortexMaker::ContentBrowserFolderIsFav(directoryEntry.path().string()); + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + ImGui::Text("Main"); + ImGui::PopStyleColor(); - if (ImGui::BeginMenu("Change color")) - { - if (!EditingColor) - { - current_editing_folder = {directoryEntry.path().string(), folder_color}; + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); - ImU32 col; - if (VortexMaker::GetContentBrowserFolderColor(path.string(), &col)) - { - current_editing_folder = {directoryEntry.path().string(), col}; - } - else - { - current_editing_folder = {directoryEntry.path().string(), folder_color}; - } + // Restaurer l'ancien scale de la police + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); - current_editing_folder_is_favorite = VortexMaker::ContentBrowserFolderIsFav(directoryEntry.path().string()); + if (ImGui::MenuItem("Open", "Ctrl + O")) + { + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); } + if (ImGui::MenuItem("Copy folder", "Ctrl + C")) + { + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); + } + if (ImGui::MenuItem("Cut folder", "Ctrl + X")) + { + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); + } + + // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); + + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + ImGui::Text("Customization"); + ImGui::PopStyleColor(); + + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); - EditingColor = true; + // Restaurer l'ancien scale de la police + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); - static bool alpha_preview = true; - static bool alpha_half_preview = false; - static bool drag_and_drop = true; - static bool options_menu = true; - static bool hdr = false; + static bool EditingColor = false; + static bool ColorChanged = false; - ColorPicker3U32("MyColor", ¤t_editing_folder.second); + current_editing_folder_is_favorite = VortexMaker::ContentBrowserFolderIsFav(directoryEntry.path().string()); - if (VortexMaker::ImU32ToHex(current_editing_folder.second) != VortexMaker::ImU32ToHex(folder_color)) + if (ImGui::BeginMenu("Change color")) { - ColorChanged = true; - } + if (!EditingColor) + { + current_editing_folder = {directoryEntry.path().string(), folder_color}; - ImGui::EndMenu(); // Fin du sous-menu "Change folder color" - } - else - { - EditingColor = false; - } + ImU32 col; + if (VortexMaker::GetContentBrowserFolderColor(path.string(), &col)) + { + current_editing_folder = {directoryEntry.path().string(), col}; + } + else + { + current_editing_folder = {directoryEntry.path().string(), folder_color}; + } + + current_editing_folder_is_favorite = VortexMaker::ContentBrowserFolderIsFav(directoryEntry.path().string()); + } - if (ImGui::MenuItem("Mark as favorite", "", current_editing_folder_is_favorite)) - { - current_editing_folder = {directoryEntry.path().string(), current_editing_folder.second}; + EditingColor = true; - current_editing_folder_is_favorite = !current_editing_folder_is_favorite; - VortexMaker::PublishContentBrowserCustomFolder(current_editing_folder.first, VortexMaker::ImU32ToHex(current_editing_folder.second), current_editing_folder_is_favorite); - } - // Ajouter d'autres options de menu ici... + static bool alpha_preview = true; + static bool alpha_half_preview = false; + static bool drag_and_drop = true; + static bool options_menu = true; + static bool hdr = false; - ImGui::EndPopup(); - } - // Pop les styles appliqués - ImGui::PopStyleVar(); // Pour les bords arrondis - ImGui::PopStyleColor(2); // Pour le fond et la bordure + ColorPicker3U32("MyColor", ¤t_editing_folder.second); - ImGui::PopStyleVar(2); // Pop FrameBorderSize and FramePadding - ImGui::PopStyleColor(3); + if (VortexMaker::ImU32ToHex(current_editing_folder.second) != VortexMaker::ImU32ToHex(folder_color)) + { + ColorChanged = true; + } - // Centrer le texte - float textWidth = ImGui::CalcTextSize(filenameString.c_str()).x; - float textOffsetX = (availableWidth - textWidth) * 0.5f; + ImGui::EndMenu(); // Fin du sous-menu "Change folder color" + } + else + { + EditingColor = false; + } - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + textOffsetX); - ImGui::TextWrapped(filenameString.c_str()); + if (ImGui::MenuItem("Mark as favorite", "", current_editing_folder_is_favorite)) + { + current_editing_folder = {directoryEntry.path().string(), current_editing_folder.second}; - ImGui::PopID(); - ImGui::NextColumn(); - } - } + current_editing_folder_is_favorite = !current_editing_folder_is_favorite; + VortexMaker::PublishContentBrowserCustomFolder(current_editing_folder.first, VortexMaker::ImU32ToHex(current_editing_folder.second), current_editing_folder_is_favorite); + } + // Ajouter d'autres options de menu ici... + ImGui::EndPopup(); + } + // Pop les styles appliqués + ImGui::PopStyleVar(); // Pour les bords arrondis + ImGui::PopStyleColor(2); // Pour le fond et la bordure -for (auto &itemEntry : recognized_modules_items) -{ - const auto &path = itemEntry.second; - fs::path fsPath(path); - std::string filenameString = fsPath.filename().string(); - - bool selected = false; - - if (std::find(m_Selected.begin(), m_Selected.end(), path) != m_Selected.end()) - { - selected = true; - } - - if (areStringsSimilar(filenameString, ProjectSearch, threshold) || isOnlySpacesOrEmpty(ProjectSearch)) - { - std::uintmax_t folderSize = getDirectorySize(path); - std::string folderSizeString = formatFileSize(folderSize); - ImGui::PushID(filenameString.c_str()); - - if (MyButton(filenameString, itemEntry.first->m_Description, folderSizeString, selected, File_PICTURE_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(itemEntry.first->m_LineColor.x, itemEntry.first->m_LineColor.y, itemEntry.first->m_LineColor.z, itemEntry.first->m_LineColor.w))) - { - if (ImGui::IsMouseDoubleClicked(0)) - { - // itemEntry.first->f_Execute(path); - VXERROR("te", "tyr"); - } - - if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) - { - m_Selected.push_back(path); - } - else - { - m_Selected.clear(); - m_Selected.push_back(path); - } - } - - // Vérifiez le clic droit pour ouvrir le menu contextuel - if (ImGui::BeginPopupContextItem("ContextPopup_")) - { - // Appliquer le nouveau scale - ImGui::GetFont()->Scale *= 0.9; - ImGui::PushFont(ImGui::GetFont()); - - // Ajouter un espace au-dessus - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); - - ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) - ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) - ImVec4 darkBackgroundColor = ImVec4(0.15f, 0.15f, 0.15f, 1.0f); // Fond plus foncé - ImVec4 lightBorderColor = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); // Bordure plus claire - - // Pousser le style pour le fond plus foncé - ImGui::PushStyleColor(ImGuiCol_PopupBg, darkBackgroundColor); - - // Pousser le style pour la bordure plus claire - ImGui::PushStyleColor(ImGuiCol_Border, lightBorderColor); - - // Pousser le style pour les bords arrondis moins prononcés - ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 3.0f); - - ImGui::PushStyleColor(ImGuiCol_Text, grayColor); - ImGui::Text("Main"); - ImGui::PopStyleColor(); - - ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); - ImGui::Separator(); - ImGui::PopStyleColor(); - - // Restaurer l'ancien scale de la police - ImGui::GetFont()->Scale = oldsize; - ImGui::PopFont(); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); - - if (ImGui::MenuItem("Open", "Ctrl + O")) - { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); - } - if (ImGui::MenuItem("Copy folder", "Ctrl + C")) - { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); - } - if (ImGui::MenuItem("Cut folder", "Ctrl + X")) - { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); - } - - // Appliquer le nouveau scale - ImGui::GetFont()->Scale *= 0.9; - ImGui::PushFont(ImGui::GetFont()); - - // Ajouter un espace au-dessus - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); - - ImGui::PushStyleColor(ImGuiCol_Text, grayColor); - ImGui::Text("Customization"); - ImGui::PopStyleColor(); - - ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); - ImGui::Separator(); - ImGui::PopStyleColor(); - - // Restaurer l'ancien scale de la police - ImGui::GetFont()->Scale = oldsize; - ImGui::PopFont(); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); - - static bool EditingColor = false; - static bool ColorChanged = false; - - // Ajouter d'autres options de menu ici... - - ImGui::EndPopup(); - - // Pop les styles appliqués - ImGui::PopStyleVar(); // Pour les bords arrondis - ImGui::PopStyleColor(2); // Pour le fond et la bordure - } - - ImGui::PopID(); - ImGui::NextColumn(); - } -} + ImGui::PopStyleVar(2); // Pop FrameBorderSize and FramePadding + ImGui::PopStyleColor(3); - for (auto &fileEntry : files) - { - const auto &path = fileEntry.path(); - std::string filenameString = path.filename().string(); + // Centrer le texte + float textWidth = ImGui::CalcTextSize(filenameString.c_str()).x; + float textOffsetX = (availableWidth - textWidth) * 0.5f; - bool selected = false; + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + textOffsetX); + ImGui::TextWrapped(filenameString.c_str()); - if (std::find(m_Selected.begin(), m_Selected.end(), path) != m_Selected.end()) - { - selected = true; + ImGui::PopID(); + ImGui::NextColumn(); + } } - if (areStringsSimilar(filenameString, ProjectSearch, threshold) || isOnlySpacesOrEmpty(ProjectSearch)) + for (auto &itemEntry : recognized_modules_items) { - size_t fileSize = std::filesystem::file_size(path); - std::string fileSizeString = formatFileSize(fileSize); - ImGui::PushID(filenameString.c_str()); + const auto &path = itemEntry.second; + fs::path fsPath(path); + std::string filenameString = fsPath.filename().string(); - FileTypes fileType = detect_file(path.string()); + bool selected = false; - switch (fileType) + if (std::find(m_Selected.begin(), m_Selected.end(), path) != m_Selected.end()) { - case FileTypes::File_PICTURE: + selected = true; + } + + if (areStringsSimilar(filenameString, ProjectSearch, threshold) || isOnlySpacesOrEmpty(ProjectSearch)) { - if (MyButton(filenameString, "Picture file", fileSizeString, selected, File_PICTURE_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(255, 100, 150, 255))) + std::uintmax_t folderSize = getDirectorySize(path); + std::string folderSizeString = formatFileSize(folderSize); + ImGui::PushID(filenameString.c_str()); + + if (MyButton(filenameString, path, itemEntry.first->m_Description, folderSizeString, selected, File_PICTURE_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(itemEntry.first->m_LineColor.x, itemEntry.first->m_LineColor.y, itemEntry.first->m_LineColor.z, itemEntry.first->m_LineColor.w))) { + if (ImGui::IsMouseDoubleClicked(0)) + { + // itemEntry.first->f_Execute(path); + VXERROR("te", "tyr"); + } + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) { m_Selected.push_back(path); @@ -1692,210 +1963,718 @@ for (auto &itemEntry : recognized_modules_items) m_Selected.push_back(path); } } - break; + + ImGui::PopID(); + ImGui::NextColumn(); } - case FileTypes::File_GIT: + } + + for (auto &fileEntry : files) + { + const auto &path = fileEntry.path(); + std::string filenameString = path.filename().string(); + + bool selected = false; + + if (std::find(m_Selected.begin(), m_Selected.end(), path) != m_Selected.end()) + { + selected = true; + } + + if (areStringsSimilar(filenameString, ProjectSearch, threshold) || isOnlySpacesOrEmpty(ProjectSearch)) { - if (MyButton(filenameString, "Git File", fileSizeString, selected, File_GIT_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(100, 100, 255, 255))) + size_t fileSize = std::filesystem::file_size(path); + std::string fileSizeString = formatFileSize(fileSize); + ImGui::PushID(filenameString.c_str()); + + FileTypes fileType = detect_file(path.string()); + + switch (fileType) { - if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + case FileTypes::File_PICTURE: + { + if (MyButton(filenameString, path, "Picture file", fileSizeString, selected, File_PICTURE_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(255, 100, 150, 255))) { - m_Selected.push_back(path); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } } - else + break; + } + case FileTypes::File_GIT: + { + if (MyButton(filenameString, path, "Git File", fileSizeString, selected, File_GIT_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(100, 100, 255, 255))) { - m_Selected.clear(); - m_Selected.push_back(path); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } } + break; } - break; - } - case FileTypes::File_H: - { - if (MyButton(filenameString, "C Header File", fileSizeString, selected, File_C_H_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(220, 100, 220, 255))) + case FileTypes::File_H: { - if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + if (MyButton(filenameString, path, "C Header File", fileSizeString, selected, File_C_H_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(220, 100, 220, 255))) { - m_Selected.push_back(path); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } } - else + break; + } + case FileTypes::File_C: + { + if (MyButton(filenameString, path, "C Source File", fileSizeString, selected, File_C_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(100, 100, 255, 255))) { - m_Selected.clear(); - m_Selected.push_back(path); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } } + break; } - break; - } - case FileTypes::File_C: - { - if (MyButton(filenameString, "C Source File", fileSizeString, selected, File_C_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(100, 100, 255, 255))) + case FileTypes::File_HPP: { - if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + if (MyButton(filenameString, path, "C++ Header File", fileSizeString, selected, File_CPP_H_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(100, 100, 255, 255))) { - m_Selected.push_back(path); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } } - else + break; + } + case FileTypes::File_CPP: + { + if (MyButton(filenameString, path, "C++ Source File", fileSizeString, selected, File_CPP_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(100, 100, 255, 255))) { - m_Selected.clear(); - m_Selected.push_back(path); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } } + break; } - break; - } - case FileTypes::File_HPP: - { - if (MyButton(filenameString, "C++ Header File", fileSizeString, selected, File_CPP_H_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(100, 100, 255, 255))) + case FileTypes::File_INI: { - if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + if (MyButton(filenameString, path, "Init File", fileSizeString, selected, File_CPP_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(150, 150, 150, 255))) { - m_Selected.push_back(path); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } } - else + break; + } + default: + { + if (MyButton(filenameString, path, "File", fileSizeString, selected, File_UNKNOW_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(150, 150, 150, 255))) { - m_Selected.clear(); - m_Selected.push_back(path); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } } + break; } - break; - } - case FileTypes::File_CPP: - { - if (MyButton(filenameString, "C++ Source File", fileSizeString, selected, File_CPP_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(100, 100, 255, 255))) + + ImGui::PopStyleVar(2); // Pop FrameBorderSize and FramePadding + ImGui::PopStyleColor(3); + } + float oldsize = ImGui::GetFont()->Scale; + + if (ImGui::BeginPopupContextItem("ItemContextPopup")) { - if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + + // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); + + // Changer la couleur du texte en gris + ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) + ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + + ImGui::Text("Main"); + + // Restaurer la couleur du texte précédente + ImGui::PopStyleColor(); + + // Changer la couleur du separator en gris + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); // Restaurer la couleur du separator précédente + + // Restaurer l'ancien scale de la police + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + + if (ImGui::MenuItem("Open", "Ctrl + O")) { - m_Selected.push_back(path); + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); } - else + if (ImGui::MenuItem("Copy folder", "Ctrl + C")) { + VortexMaker::Copy(m_Selected, false); m_Selected.clear(); - m_Selected.push_back(path); + ImGui::CloseCurrentPopup(); } - } - break; - } - case FileTypes::File_INI: - { - if (MyButton(filenameString, "Init File", fileSizeString, selected, File_CPP_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(150, 150, 150, 255))) - { - if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + if (this->ctx->IO.copy_selection.size() > 0) { - m_Selected.push_back(path); + std::string label = "Copy in addition (" + this->ctx->IO.copy_selection.size() + ' copies)'; + if (ImGui::MenuItem(label.c_str(), "Ctrl + C")) + { + VortexMaker::Copy(m_Selected, true); + m_Selected.clear(); + ImGui::CloseCurrentPopup(); + } } - else + if (ImGui::MenuItem("Cut folder", "Ctrl + X")) { - m_Selected.clear(); - m_Selected.push_back(path); + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); } + + // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); + + // Changer la couleur du texte en gris + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + + ImGui::Text("Main"); + + // Restaurer la couleur du texte précédente + ImGui::PopStyleColor(); + + // Changer la couleur du separator en gris + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); // Restaurer la couleur du separator précédente + + // Restaurer l'ancien scale de la police + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + + if (ImGui::MenuItem("Change color")) + { + } + if (ImGui::MenuItem("Mark as favorite")) + { + } + // Ajouter d'autres options de menu ici... + + ImGui::EndPopup(); } - break; + + ImGui::PopID(); + ImGui::NextColumn(); } - default: + } + + ImGui::Columns(1); + } + + ImGui::Text(std::to_string(m_Selected.size()).c_str()); + + if (this->m_ShowMode == ContentShowMode::Columns) + { + static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable; + + if (ImGui::BeginTable("tablhjke_", 5, flags)) + { + ImGui::TableSetupColumn("Icon", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Size", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Last Updated", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableHeadersRow(); + + ImGui::PopStyleVar(4); + + for (auto &directoryEntry : directories) { - if (MyButton(filenameString, "File", fileSizeString, selected, File_UNKNOW_Logo, IM_COL32(56, 56, 56, 150), IM_COL32(50, 50, 50, 255), IM_COL32(150, 150, 150, 255))) + const auto &path = directoryEntry.path(); + std::string filenameString = path.filename().string(); + + if (areStringsSimilar(filenameString, ProjectSearch, threshold) || isOnlySpacesOrEmpty(ProjectSearch)) { - if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + bool selected = false; + bool rename = false; + if (path == pathToRename) { - m_Selected.push_back(path); + rename = true; } - else + + if (std::find(m_Selected.begin(), m_Selected.end(), path) != m_Selected.end()) { - m_Selected.clear(); - m_Selected.push_back(path); + selected = true; } - } - break; - } - ImGui::PopStyleVar(2); // Pop FrameBorderSize and FramePadding - ImGui::PopStyleColor(3); - } - float oldsize = ImGui::GetFont()->Scale; + std::cout << "Selected : " << m_Selected.size() << std::endl; - if (ImGui::BeginPopupContextItem("ItemContextPopup")) - { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + + // Utiliser ImGui::Selectable avec la variable selected pour capturer la sélection + if (selected) + { + ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.0f, 0.0f, 1.0f, 0.5f)); // Bleu avec transparence + ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.0f, 0.0f, 1.0f, 0.5f)); + ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.0f, 0.0f, 1.0f, 0.5f)); + } + if (ImGui::Selectable("", &selected, ImGuiSelectableFlags_SpanAllColumns)) + { + if (selected) + { + m_Selected.push_back(path); + } + else + { + m_Selected.erase(std::remove(m_Selected.begin(), m_Selected.end(), path), m_Selected.end()); + } + } - // Appliquer le nouveau scale - ImGui::GetFont()->Scale *= 0.9; - ImGui::PushFont(ImGui::GetFont()); + if (selected) + { + ImGui::PopStyleColor(3); + } - // Ajouter un espace au-dessus - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); + // Ajoutez le menu contextuel ici + std::string label = "RowContextMenu###" + filenameString; + // Changer la couleur du texte en gris + ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) + ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) + ImVec4 darkBackgroundColor = ImVec4(0.15f, 0.15f, 0.15f, 1.0f); // Fond plus foncé + ImVec4 lightBorderColor = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); // Bordure plus claire + + // Pousser le style pour le fond plus foncé + ImGui::PushStyleColor(ImGuiCol_PopupBg, darkBackgroundColor); + + // Pousser le style pour la bordure plus claire + ImGui::PushStyleColor(ImGuiCol_Border, lightBorderColor); + // Ajoutez le chemin à m_Selected lorsque la ligne est sélectionnée + /* if (ImGui::IsMouseDoubleClicked(0)) + { + ChangeDirectory(path); + }*/ - // Changer la couleur du texte en gris - ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) - ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) - ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) + { - ImGui::Text("Main"); + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) + { + m_Selected.push_back(path); + } + else + { + m_Selected.clear(); + m_Selected.push_back(path); + } + } - // Restaurer la couleur du texte précédente - ImGui::PopStyleColor(); + // Pousser le style pour les bords arrondis moins prononcés + ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 3.0f); + if (ImGui::BeginPopupContextItem(label.c_str())) + { + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); - // Changer la couleur du separator en gris - ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); - ImGui::Separator(); - ImGui::PopStyleColor(); // Restaurer la couleur du separator précédente + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); - // Restaurer l'ancien scale de la police - ImGui::GetFont()->Scale = oldsize; - ImGui::PopFont(); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + ImGui::Text("Main"); + ImGui::PopStyleColor(); - if (ImGui::MenuItem("Open", "Ctrl + O")) - { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); + + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + + if (ImGui::MenuItem("Open", "Ctrl + O")) + { + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); + } + if (ImGui::MenuItem("Copy folder", "Ctrl + C")) + { + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); + } + if (ImGui::MenuItem("Cut folder", "Ctrl + X")) + { + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); + } + + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); + + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + ImGui::Text("Customization"); + ImGui::PopStyleColor(); + + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); + + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + + static bool EditingColor = false; + static bool ColorChanged = false; + + current_editing_folder_is_favorite = VortexMaker::ContentBrowserFolderIsFav(directoryEntry.path().string()); + + if (ImGui::BeginMenu("Change color")) + { + if (!EditingColor) + { + current_editing_folder = {directoryEntry.path().string(), folder_color}; + + ImU32 col; + if (VortexMaker::GetContentBrowserFolderColor(path.string(), &col)) + { + current_editing_folder = {directoryEntry.path().string(), col}; + } + else + { + current_editing_folder = {directoryEntry.path().string(), folder_color}; + } + + current_editing_folder_is_favorite = VortexMaker::ContentBrowserFolderIsFav(directoryEntry.path().string()); + } + + EditingColor = true; + + static bool alpha_preview = true; + static bool alpha_half_preview = false; + static bool drag_and_drop = true; + static bool options_menu = true; + static bool hdr = false; + + ColorPicker3U32("MyColor", ¤t_editing_folder.second); + + if (VortexMaker::ImU32ToHex(current_editing_folder.second) != VortexMaker::ImU32ToHex(folder_color)) + { + ColorChanged = true; + } + + ImGui::EndMenu(); // Fin du sous-menu "Change folder color" + } + else + { + EditingColor = false; + } + + if (ImGui::MenuItem("Mark as favorite", "", current_editing_folder_is_favorite)) + { + current_editing_folder = {directoryEntry.path().string(), current_editing_folder.second}; + + current_editing_folder_is_favorite = !current_editing_folder_is_favorite; + VortexMaker::PublishContentBrowserCustomFolder(current_editing_folder.first, VortexMaker::ImU32ToHex(current_editing_folder.second), current_editing_folder_is_favorite); + } + // Ajouter d'autres options de menu ici... + + ImGui::EndPopup(); + } + + // Pop les styles appliqués + ImGui::PopStyleVar(); // Pour les bords arrondis + ImGui::PopStyleColor(2); // Pour le fond et la bordure + + for (int column = 0; column < 4; column++) + { + ImGui::TableSetColumnIndex(column); + + if (column == 0) + { + ImVec2 pos = ImGui::GetCursorScreenPos(); + ImU32 col; + + if (VortexMaker::GetContentBrowserFolderColor(path.string(), &col)) + { + DrawFolderIcon(pos, ImVec2(12, 12), col); + } + else + { + DrawFolderIcon(pos, ImVec2(12, 12), folder_color); + } + } + else if (column == 1) + { + ImGui::Text(filenameString.c_str()); + } + else if (column == 2) + { + ImGui::TextColored(ImVec4(0.4f, 0.4f, 0.4f, 1.0f), "Folder"); + } + else if (column == 3) + { + ImGui::Text("---"); + } + else if (column == 4) + { + ImGui::Text("---"); + } + } } - if (ImGui::MenuItem("Copy folder", "Ctrl + C")) + } + + for (auto &fileEntry : files) + { + const auto &path = fileEntry.path(); + std::string filenameString = path.filename().string(); + + bool selected = false; + + if (std::find(m_Selected.begin(), m_Selected.end(), path) != m_Selected.end()) { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); + selected = true; } - if (ImGui::MenuItem("Cut folder", "Ctrl + X")) + + if (areStringsSimilar(filenameString, ProjectSearch, threshold) || isOnlySpacesOrEmpty(ProjectSearch)) { - ChangeDirectory(path); - ImGui::CloseCurrentPopup(); - } + size_t fileSize = std::filesystem::file_size(path); + std::string fileSizeString = formatFileSize(fileSize); + ImGui::PushID(filenameString.c_str()); - // Appliquer le nouveau scale - ImGui::GetFont()->Scale *= 0.9; - ImGui::PushFont(ImGui::GetFont()); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); - // Ajouter un espace au-dessus - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); + FileTypes fileType = detect_file(path.string()); - // Changer la couleur du texte en gris - ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + switch (fileType) + { + case FileTypes::File_PICTURE: + { + for (int column = 0; column < 4; column++) + { + ImGui::TableSetColumnIndex(column); + + if (column == 0) + { + ImGui::Image(getTexture(File_PICTURE_Logo), ImVec2(15, 15)); + } + else if (column == 1) + { + ImGui::Text(filenameString.c_str()); + } + else if (column == 2) + { + ImGui::TextColored(ImVec4(0.4f, 0.4f, 0.4f, 1.0f), "Folder"); + } + else if (column == 3) + { + ImGui::Text("---"); + } + else if (column == 4) + { + ImGui::Text("---"); + } + } + } + case FileTypes::File_GIT: + { - ImGui::Text("Main"); + break; + } + case FileTypes::File_H: + { - // Restaurer la couleur du texte précédente - ImGui::PopStyleColor(); + break; + } + case FileTypes::File_C: + { - // Changer la couleur du separator en gris - ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); - ImGui::Separator(); - ImGui::PopStyleColor(); // Restaurer la couleur du separator précédente + break; + } + case FileTypes::File_HPP: + { - // Restaurer l'ancien scale de la police - ImGui::GetFont()->Scale = oldsize; - ImGui::PopFont(); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + break; + } + case FileTypes::File_CPP: + { - if (ImGui::MenuItem("Change color")) - { - } - if (ImGui::MenuItem("Mark as favorite")) - { - } - // Ajouter d'autres options de menu ici... + break; + } + case FileTypes::File_INI: + { + break; + } + default: + { + + break; + } + + ImGui::PopStyleVar(2); // Pop FrameBorderSize and FramePadding + ImGui::PopStyleColor(3); + } + float oldsize = ImGui::GetFont()->Scale; + + if (ImGui::BeginPopupContextItem("ItemContextPopup")) + { + + // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f); + + // Changer la couleur du texte en gris + ImVec4 grayColor = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); // Gris (50% blanc) + ImVec4 graySeparatorColor = ImVec4(0.4f, 0.4f, 0.4f, 0.5f); // Gris (50% blanc) + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + + ImGui::Text("Main"); + + // Restaurer la couleur du texte précédente + ImGui::PopStyleColor(); + + // Changer la couleur du separator en gris + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); // Restaurer la couleur du separator précédente + + // Restaurer l'ancien scale de la police + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + + if (ImGui::MenuItem("Open", "Ctrl + O")) + { + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); + } + if (ImGui::MenuItem("Copy folder", "Ctrl + C")) + { + VortexMaker::Copy(m_Selected, false); + m_Selected.clear(); + ImGui::CloseCurrentPopup(); + } + if (this->ctx->IO.copy_selection.size() > 0) + { + std::string label = "Copy in addition (" + this->ctx->IO.copy_selection.size() + ' copies)'; + if (ImGui::MenuItem(label.c_str(), "Ctrl + C")) + { + VortexMaker::Copy(m_Selected, true); + m_Selected.clear(); + ImGui::CloseCurrentPopup(); + } + } + if (ImGui::MenuItem("Cut folder", "Ctrl + X")) + { + ChangeDirectory(path); + ImGui::CloseCurrentPopup(); + } + + // Appliquer le nouveau scale + ImGui::GetFont()->Scale *= 0.9; + ImGui::PushFont(ImGui::GetFont()); + + // Ajouter un espace au-dessus + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f); + + // Changer la couleur du texte en gris + ImGui::PushStyleColor(ImGuiCol_Text, grayColor); + + ImGui::Text("Main"); + + // Restaurer la couleur du texte précédente + ImGui::PopStyleColor(); - ImGui::EndPopup(); + // Changer la couleur du separator en gris + ImGui::PushStyleColor(ImGuiCol_Separator, graySeparatorColor); + ImGui::Separator(); + ImGui::PopStyleColor(); // Restaurer la couleur du separator précédente + + // Restaurer l'ancien scale de la police + ImGui::GetFont()->Scale = oldsize; + ImGui::PopFont(); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2.0f); + + if (ImGui::MenuItem("Change color")) + { + } + if (ImGui::MenuItem("Mark as favorite")) + { + } + // Ajouter d'autres options de menu ici... + + ImGui::EndPopup(); + } + + ImGui::PopID(); + ImGui::NextColumn(); + } } - ImGui::PopID(); - ImGui::NextColumn(); + ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 0.0f); + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f); + + ImGui::EndTable(); } } @@ -1929,7 +2708,6 @@ for (auto &itemEntry : recognized_modules_items) style.Colors[ImGuiCol_ChildBg] = originalChildBgColor; style.Colors[ImGuiCol_Border] = originalBorderColor; style.Colors[ImGuiCol_BorderShadow] = originalBorderShadowColor; - ImGui::Columns(1); ImGui::End(); } diff --git a/tools/editor/app/core/ContentBrowser.hpp b/tools/editor/app/core/ContentBrowser.hpp index dfd79fb..9e858f8 100644 --- a/tools/editor/app/core/ContentBrowser.hpp +++ b/tools/editor/app/core/ContentBrowser.hpp @@ -8,6 +8,13 @@ #include "../include/instanceFactory.h" +enum class ContentShowMode +{ + Thumbmails, + List, + Columns +}; + enum class FileTypes { // Very low level @@ -61,15 +68,33 @@ class ContentBrowserPanel ContentBrowserPanel(VxContext *_ctx, const std::string &parent); void OnImGuiRender(const std::string &parent, std::function controller); - - void ChangeDirectory(const std::filesystem::path &newDirectory); - void GoBack(); - void GoForward(); - void DrawPathBar(); - -void DrawFolderIcon(ImVec2 pos, ImVec2 size, ImU32 color); -void MyFolderButton(const char* id, ImVec2 size, ImU32 color, const std::string& path); -void DrawHierarchy(std::filesystem::path path, bool isDir, const std::string& label); + bool MyButton(const std::string &name, const std::string &path, const std::string &description, const std::string &size, bool selected, const std::string &logo, ImU32 bgColor, ImU32 borderColor, ImU32 lineColor, float maxTextWidth, float borderRadius); + + void ChangeDirectory(const std::filesystem::path &newDirectory); + void GoBack(); + void GoForward(); + void DrawPathBar(); + + void Select(const std::string &path) + { + for (auto already : m_Selected) + { + if (path == already) + { + return; + } + } + m_Selected.push_back(path); + } + + void ChangeShowMode(ContentShowMode mode) + { + this->m_ShowMode = mode; + } + + void DrawFolderIcon(ImVec2 pos, ImVec2 size, ImU32 color); + void MyFolderButton(const char *id, ImVec2 size, ImU32 color, const std::string &path); + void DrawHierarchy(std::filesystem::path path, bool isDir, const std::string &label); VxContext *ctx; std::string parent; @@ -84,21 +109,23 @@ void DrawHierarchy(std::filesystem::path path, bool isDir, const std::string& la bool m_ShowTypes = false; bool m_ShowSizes = false; -// !!! + // !!! bool m_ShowFolderPannel = true; bool m_ShowFilterPannel = false; bool m_ShowThumbnailVisualizer = false; bool m_ShowSelectionQuantifier = false; + ContentShowMode m_ShowMode = ContentShowMode::Thumbmails; + std::filesystem::path m_BaseDirectory; - std::filesystem::path m_CurrentDirectory; - std::stack m_BackHistory; - std::stack m_ForwardHistory; + std::filesystem::path m_CurrentDirectory; + std::stack m_BackHistory; + std::stack m_ForwardHistory; - std::vector m_Selected; + std::vector m_Selected; - std::vector m_Favorites; + std::vector m_Favorites; std::shared_ptr m_ProjectIcon; std::shared_ptr m_FileIcon; diff --git a/tools/editor/app/include/editor.h b/tools/editor/app/include/editor.h index aa86bc1..3de48fb 100644 --- a/tools/editor/app/include/editor.h +++ b/tools/editor/app/include/editor.h @@ -132,7 +132,7 @@ class EditorLayer : public UIKit::Layer ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 11.0f); ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 11.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(15.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(15.0f, 10.0f)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(9.0f, 3.0f)); ImGui::PushStyleVar(ImGuiStyleVar_TabRounding, 7.0f); }