| e8555c89 Andy McCall |
1 |
#pragma once |
| 2 |
|
| 3 |
#if defined(__clang__) |
| 4 |
#pragma clang diagnostic ignored "-Wunknown-pragmas" |
| 5 |
#elif defined(__GNUC__) |
| 6 |
#pragma GCC diagnostic ignored "-Wunknown-pragmas" |
| 7 |
#endif |
| 8 |
|
| 9 |
#ifdef _MSC_VER |
| 10 |
#pragma warning(disable : 4251) |
| 11 |
#endif |
| 12 |
|
| 13 |
#pragma region IGFD LICENSE |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
#pragma endregion |
| 40 |
|
| 41 |
#pragma region IGFD DOCUMENTATION |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
|
| 923 |
|
| 924 |
|
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
|
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
|
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
|
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
|
| 956 |
|
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
|
| 1005 |
|
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
|
| 1015 |
|
| 1016 |
|
| 1017 |
|
| 1018 |
|
| 1019 |
|
| 1020 |
|
| 1021 |
|
| 1022 |
|
| 1023 |
|
| 1024 |
|
| 1025 |
|
| 1026 |
|
| 1027 |
|
| 1028 |
|
| 1029 |
|
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
|
| 1035 |
|
| 1036 |
|
| 1037 |
|
| 1038 |
|
| 1039 |
|
| 1040 |
|
| 1041 |
|
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
|
| 1071 |
|
| 1072 |
|
| 1073 |
|
| 1074 |
|
| 1075 |
|
| 1076 |
|
| 1077 |
|
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
|
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
|
| 1086 |
|
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
|
| 1119 |
|
| 1120 |
|
| 1121 |
|
| 1122 |
|
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
|
| 1127 |
|
| 1128 |
|
| 1129 |
|
| 1130 |
|
| 1131 |
|
| 1132 |
|
| 1133 |
|
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
|
| 1139 |
|
| 1140 |
|
| 1141 |
|
| 1142 |
|
| 1143 |
|
| 1144 |
|
| 1145 |
|
| 1146 |
|
| 1147 |
|
| 1148 |
|
| 1149 |
|
| 1150 |
|
| 1151 |
|
| 1152 |
|
| 1153 |
|
| 1154 |
|
| 1155 |
|
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
|
| 1161 |
|
| 1162 |
|
| 1163 |
|
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
|
| 1175 |
|
| 1176 |
|
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 1183 |
|
| 1184 |
|
| 1185 |
|
| 1186 |
|
| 1187 |
|
| 1188 |
|
| 1189 |
|
| 1190 |
|
| 1191 |
|
| 1192 |
|
| 1193 |
|
| 1194 |
|
| 1195 |
|
| 1196 |
|
| 1197 |
|
| 1198 |
|
| 1199 |
|
| 1200 |
|
| 1201 |
|
| 1202 |
|
| 1203 |
|
| 1204 |
#pragma endregion |
| 1205 |
|
| 1206 |
#pragma region IGFD VERSION |
| 1207 |
|
| 1208 |
|
| 1209 |
#define IMGUIFILEDIALOG_VERSION "v0.6.6.1" |
| 1210 |
|
| 1211 |
#pragma endregion |
| 1212 |
|
| 1213 |
#pragma region CONFIG FILE INCLUSION |
| 1214 |
|
| 1215 |
#ifndef CUSTOM_IMGUIFILEDIALOG_CONFIG |
| 1216 |
#include "ImGuiFileDialogConfig.h" |
| 1217 |
#else |
| 1218 |
#include CUSTOM_IMGUIFILEDIALOG_CONFIG |
| 1219 |
#endif |
| 1220 |
|
| 1221 |
#pragma endregion |
| 1222 |
|
| 1223 |
#pragma region FLAGS : FileStyleFlags |
| 1224 |
|
| 1225 |
|
| 1226 |
typedef int IGFD_FileStyleFlags; |
| 1227 |
enum IGFD_FileStyleFlags_ |
| 1228 |
{ |
| 1229 |
IGFD_FileStyle_None = 0, |
| 1230 |
IGFD_FileStyleByTypeFile = (1 << 0), |
| 1231 |
IGFD_FileStyleByTypeDir = (1 << 1), |
| 1232 |
IGFD_FileStyleByTypeLink = (1 << 2), |
| 1233 |
IGFD_FileStyleByExtention = (1 << 3), |
| 1234 |
IGFD_FileStyleByFullName = (1 << 4), |
| 1235 |
IGFD_FileStyleByContainedInFullName = (1 << 5), |
| 1236 |
}; |
| 1237 |
|
| 1238 |
#pragma endregion |
| 1239 |
|
| 1240 |
#pragma region FLAGS : ImGuiFileDialogFlags |
| 1241 |
|
| 1242 |
typedef int ImGuiFileDialogFlags; |
| 1243 |
enum ImGuiFileDialogFlags_ { |
| 1244 |
ImGuiFileDialogFlags_None = 0, |
| 1245 |
ImGuiFileDialogFlags_ConfirmOverwrite = (1 << 0), |
| 1246 |
ImGuiFileDialogFlags_DontShowHiddenFiles = (1 << 1), |
| 1247 |
ImGuiFileDialogFlags_DisableCreateDirectoryButton = (1 << 2), |
| 1248 |
ImGuiFileDialogFlags_HideColumnType = (1 << 3), |
| 1249 |
ImGuiFileDialogFlags_HideColumnSize = (1 << 4), |
| 1250 |
ImGuiFileDialogFlags_HideColumnDate = (1 << 5), |
| 1251 |
ImGuiFileDialogFlags_NoDialog = (1 << 6), |
| 1252 |
ImGuiFileDialogFlags_ReadOnlyFileNameField = (1 << 7), |
| 1253 |
ImGuiFileDialogFlags_CaseInsensitiveExtention = (1 << 8), |
| 1254 |
ImGuiFileDialogFlags_Modal = (1 << 9), |
| 1255 |
ImGuiFileDialogFlags_DisableThumbnailMode = (1 << 10), |
| 1256 |
ImGuiFileDialogFlags_DisableBookmarkMode = (1 << 11), |
| 1257 |
ImGuiFileDialogFlags_DisableQuickPathSelection = (1 << 12), |
| 1258 |
|
| 1259 |
|
| 1260 |
ImGuiFileDialogFlags_Default = ImGuiFileDialogFlags_ConfirmOverwrite | |
| 1261 |
ImGuiFileDialogFlags_Modal | |
| 1262 |
ImGuiFileDialogFlags_HideColumnType |
| 1263 |
}; |
| 1264 |
|
| 1265 |
|
| 1266 |
typedef int IGFD_ResultMode; |
| 1267 |
enum IGFD_ResultMode_ { |
| 1268 |
|
| 1269 |
|
| 1270 |
|
| 1271 |
|
| 1272 |
|
| 1273 |
|
| 1274 |
|
| 1275 |
|
| 1276 |
|
| 1277 |
|
| 1278 |
|
| 1279 |
|
| 1280 |
|
| 1281 |
|
| 1282 |
|
| 1283 |
|
| 1284 |
IGFD_ResultMode_AddIfNoFileExt = 0, |
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
|
| 1296 |
|
| 1297 |
|
| 1298 |
|
| 1299 |
|
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
IGFD_ResultMode_OverwriteFileExt = 1, |
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
|
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
IGFD_ResultMode_KeepInputFile = 2 |
| 1323 |
}; |
| 1324 |
|
| 1325 |
#pragma endregion |
| 1326 |
|
| 1327 |
#pragma region Common Cpp& C Structures |
| 1328 |
|
| 1329 |
#ifdef USE_THUMBNAILS |
| 1330 |
struct IGFD_Thumbnail_Info { |
| 1331 |
int isReadyToDisplay = 0; |
| 1332 |
int isReadyToUpload = 0; |
| 1333 |
int isLoadingOrLoaded = 0; |
| 1334 |
int textureWidth = 0; |
| 1335 |
int textureHeight = 0; |
| 1336 |
int textureChannels = 0; |
| 1337 |
unsigned char* textureFileDatas = 0; |
| 1338 |
void* textureID = 0; |
| 1339 |
void* userDatas = 0; |
| 1340 |
}; |
| 1341 |
#endif |
| 1342 |
|
| 1343 |
#pragma endregion |
| 1344 |
|
| 1345 |
#ifdef __cplusplus |
| 1346 |
|
| 1347 |
#pragma region Includes |
| 1348 |
|
| 1349 |
#ifndef IMGUI_DEFINE_MATH_OPERATORS |
| 1350 |
#define IMGUI_DEFINE_MATH_OPERATORS |
| 1351 |
#endif |
| 1352 |
|
| 1353 |
#ifdef IMGUI_INCLUDE |
| 1354 |
#include IMGUI_INCLUDE |
| 1355 |
#else |
| 1356 |
#include <imgui.h> |
| 1357 |
#endif |
| 1358 |
|
| 1359 |
#include <set> |
| 1360 |
#include <map> |
| 1361 |
#include <list> |
| 1362 |
#include <regex> |
| 1363 |
#include <array> |
| 1364 |
#include <mutex> |
| 1365 |
#include <condition_variable> |
| 1366 |
#include <thread> |
| 1367 |
#include <cfloat> |
| 1368 |
#include <memory> |
| 1369 |
#include <string> |
| 1370 |
#include <vector> |
| 1371 |
#include <utility> |
| 1372 |
#include <fstream> |
| 1373 |
#include <functional> |
| 1374 |
#include <unordered_map> |
| 1375 |
|
| 1376 |
#pragma endregion |
| 1377 |
|
| 1378 |
#pragma region IGFD API |
| 1379 |
|
| 1380 |
|
| 1381 |
|
| 1382 |
|
| 1383 |
|
| 1384 |
|
| 1385 |
#ifndef IGFD_API |
| 1386 |
#define IGFD_API |
| 1387 |
#endif |
| 1388 |
|
| 1389 |
#pragma endregion |
| 1390 |
|
| 1391 |
#pragma region Defines |
| 1392 |
|
| 1393 |
#ifndef defaultSortField |
| 1394 |
#define defaultSortField FIELD_FILENAME |
| 1395 |
#endif |
| 1396 |
|
| 1397 |
#ifndef defaultSortOrderFilename |
| 1398 |
#define defaultSortOrderFilename true |
| 1399 |
#endif |
| 1400 |
#ifndef defaultSortOrderType |
| 1401 |
#define defaultSortOrderType true |
| 1402 |
#endif |
| 1403 |
#ifndef defaultSortOrderSize |
| 1404 |
#define defaultSortOrderSize true |
| 1405 |
#endif |
| 1406 |
#ifndef defaultSortOrderDate |
| 1407 |
#define defaultSortOrderDate true |
| 1408 |
#endif |
| 1409 |
#ifndef defaultSortOrderThumbnails |
| 1410 |
#define defaultSortOrderThumbnails true |
| 1411 |
#endif |
| 1412 |
|
| 1413 |
#ifndef MAX_FILE_DIALOG_NAME_BUFFER |
| 1414 |
#define MAX_FILE_DIALOG_NAME_BUFFER 1024 |
| 1415 |
#endif |
| 1416 |
|
| 1417 |
#ifndef MAX_PATH_BUFFER_SIZE |
| 1418 |
#define MAX_PATH_BUFFER_SIZE 1024 |
| 1419 |
#endif |
| 1420 |
|
| 1421 |
#ifndef EXT_MAX_LEVEL |
| 1422 |
#define EXT_MAX_LEVEL 10U |
| 1423 |
#endif |
| 1424 |
|
| 1425 |
#pragma endregion |
| 1426 |
|
| 1427 |
#pragma region IGFD NAMESPACE |
| 1428 |
|
| 1429 |
namespace IGFD { |
| 1430 |
|
| 1431 |
#pragma region INTERNAL |
| 1432 |
|
| 1433 |
#pragma region SEARCHABLE VECTOR |
| 1434 |
|
| 1435 |
template <typename T> |
| 1436 |
class SearchableVector { |
| 1437 |
private: |
| 1438 |
std::unordered_map<T, size_t> m_Dico; |
| 1439 |
std::vector<T> m_Array; |
| 1440 |
|
| 1441 |
public: |
| 1442 |
void clear() { |
| 1443 |
m_Dico.clear(); |
| 1444 |
m_Array.clear(); |
| 1445 |
} |
| 1446 |
|
| 1447 |
bool empty() const { |
| 1448 |
return m_Array.empty(); |
| 1449 |
} |
| 1450 |
size_t size() const { |
| 1451 |
return m_Array.size(); |
| 1452 |
} |
| 1453 |
T& operator[](const size_t& vIdx) { |
| 1454 |
return m_Array[vIdx]; |
| 1455 |
} |
| 1456 |
T& at(const size_t& vIdx) { |
| 1457 |
return m_Array.at(vIdx); |
| 1458 |
} |
| 1459 |
typename std::vector<T>::iterator begin() { |
| 1460 |
return m_Array.begin(); |
| 1461 |
} |
| 1462 |
typename std::vector<T>::const_iterator begin() const { |
| 1463 |
return m_Array.begin(); |
| 1464 |
} |
| 1465 |
typename std::vector<T>::iterator end() { |
| 1466 |
return m_Array.end(); |
| 1467 |
} |
| 1468 |
typename std::vector<T>::const_iterator end() const { |
| 1469 |
return m_Array.end(); |
| 1470 |
} |
| 1471 |
|
| 1472 |
bool try_add(T vKey) { |
| 1473 |
if (!exist(vKey)) { |
| 1474 |
m_Dico[vKey] = m_Array.size(); |
| 1475 |
m_Array.push_back(vKey); |
| 1476 |
return true; |
| 1477 |
} |
| 1478 |
return false; |
| 1479 |
} |
| 1480 |
|
| 1481 |
bool try_set_existing(T vKey) { |
| 1482 |
if (exist(vKey)) { |
| 1483 |
auto row = m_Dico.at(vKey); |
| 1484 |
m_Array[row] = vKey; |
| 1485 |
return true; |
| 1486 |
} |
| 1487 |
return false; |
| 1488 |
} |
| 1489 |
|
| 1490 |
bool exist(const std::string& vKey) const { |
| 1491 |
return (m_Dico.find(vKey) != m_Dico.end()); |
| 1492 |
} |
| 1493 |
}; |
| 1494 |
|
| 1495 |
#pragma endregion |
| 1496 |
|
| 1497 |
#pragma region Utils |
| 1498 |
|
| 1499 |
class IGFD_API Utils { |
| 1500 |
public: |
| 1501 |
struct PathStruct { |
| 1502 |
std::string path; |
| 1503 |
std::string name; |
| 1504 |
std::string ext; |
| 1505 |
bool isOk = false; |
| 1506 |
}; |
| 1507 |
|
| 1508 |
public: |
| 1509 |
static bool ImSplitter( |
| 1510 |
bool split_vertically, float thickness, float* size1, float* size2, float min_size1, float min_size2, float splitter_long_axis_size = -1.0f); |
| 1511 |
static bool ReplaceString(std::string& str, const std::string& oldStr, const std::string& newStr, const size_t& vMaxRecursion = 10U); |
| 1512 |
static void AppendToBuffer(char* vBuffer, size_t vBufferLen, const std::string& vStr); |
| 1513 |
static void ResetBuffer(char* vBuffer); |
| 1514 |
static void SetBuffer(char* vBuffer, size_t vBufferLen, const std::string& vStr); |
| 1515 |
static std::string UTF8Encode(const std::wstring& wstr); |
| 1516 |
static std::wstring UTF8Decode(const std::string& str); |
| 1517 |
static std::vector<std::string> SplitStringToVector(const std::string& vText, const char& vDelimiter, const bool& vPushEmpty); |
| 1518 |
static std::string LowerCaseString(const std::string& vString); |
| 1519 |
static size_t GetCharCountInString(const std::string& vString, const char& vChar); |
| 1520 |
static size_t GetLastCharPosWithMinCharCount(const std::string& vString, const char& vChar, const size_t& vMinCharCount); |
| 1521 |
static std::string GetPathSeparator(); |
| 1522 |
static std::string RoundNumber(double vvalue, int n); |
| 1523 |
static std::pair<std::string, std::string> FormatFileSize(size_t vByteSize); |
| 1524 |
}; |
| 1525 |
|
| 1526 |
#pragma endregion |
| 1527 |
|
| 1528 |
#pragma region FileStyle |
| 1529 |
|
| 1530 |
class IGFD_API FileInfos; |
| 1531 |
class IGFD_API FileStyle { |
| 1532 |
public: |
| 1533 |
typedef std::function<bool(const FileInfos&, FileStyle&)> FileStyleFunctor; |
| 1534 |
|
| 1535 |
public: |
| 1536 |
ImVec4 color = ImVec4(0, 0, 0, 0); |
| 1537 |
std::string icon; |
| 1538 |
ImFont* font = nullptr; |
| 1539 |
IGFD_FileStyleFlags flags = 0; |
| 1540 |
|
| 1541 |
public: |
| 1542 |
FileStyle(); |
| 1543 |
FileStyle(const FileStyle& vStyle); |
| 1544 |
FileStyle(const ImVec4& vColor, const std::string& vIcon = "", ImFont* vFont = nullptr); |
| 1545 |
}; |
| 1546 |
|
| 1547 |
#pragma endregion |
| 1548 |
|
| 1549 |
#pragma region SearchManager |
| 1550 |
|
| 1551 |
class IGFD_API FileDialogInternal; |
| 1552 |
class IGFD_API SearchManager { |
| 1553 |
public: |
| 1554 |
std::string searchTag; |
| 1555 |
char searchBuffer[MAX_FILE_DIALOG_NAME_BUFFER] = ""; |
| 1556 |
bool searchInputIsActive = false; |
| 1557 |
|
| 1558 |
public: |
| 1559 |
void Clear(); |
| 1560 |
void DrawSearchBar(FileDialogInternal& vFileDialogInternal); |
| 1561 |
}; |
| 1562 |
|
| 1563 |
#pragma endregion |
| 1564 |
|
| 1565 |
#pragma region FilterInfos |
| 1566 |
|
| 1567 |
class IGFD_API FilterInfos { |
| 1568 |
private: |
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
std::string empty_string; |
| 1573 |
|
| 1574 |
public: |
| 1575 |
std::string title; |
| 1576 |
SearchableVector<std::string> filters; |
| 1577 |
SearchableVector<std::string> filters_optimized; |
| 1578 |
std::vector<std::regex> filters_regex; |
| 1579 |
size_t count_dots = 0U; |
| 1580 |
|
| 1581 |
public: |
| 1582 |
void clear(); |
| 1583 |
bool empty() const; |
| 1584 |
const std::string& getFirstFilter() const; |
| 1585 |
bool regexExist(const std::string& vFilter) const; |
| 1586 |
bool exist(const FileInfos& vFileInfos, bool vIsCaseInsensitive) const; |
| 1587 |
void setCollectionTitle(const std::string& vTitle); |
| 1588 |
void addFilter(const std::string& vFilter, const bool& vIsRegex); |
| 1589 |
void addCollectionFilter(const std::string& vFilter, const bool& vIsRegex); |
| 1590 |
std::string transformAsteriskBasedFilterToRegex(const std::string& vFilter); |
| 1591 |
}; |
| 1592 |
|
| 1593 |
#pragma endregion |
| 1594 |
|
| 1595 |
#pragma region FilterManager |
| 1596 |
|
| 1597 |
class IGFD_API FileInfos; |
| 1598 |
class IGFD_API FilterManager { |
| 1599 |
#ifdef NEED_TO_BE_PUBLIC_FOR_TESTS |
| 1600 |
public: |
| 1601 |
#else |
| 1602 |
private: |
| 1603 |
#endif |
| 1604 |
std::vector<FilterInfos> m_ParsedFilters; |
| 1605 |
std::unordered_map<IGFD_FileStyleFlags, std::unordered_map<std::string, std::shared_ptr<FileStyle>>> m_FilesStyle; |
| 1606 |
|
| 1607 |
std::vector<FileStyle::FileStyleFunctor> m_FilesStyleFunctors; |
| 1608 |
FilterInfos m_SelectedFilter; |
| 1609 |
|
| 1610 |
public: |
| 1611 |
std::string dLGFilters; |
| 1612 |
std::string dLGdefaultExt; |
| 1613 |
|
| 1614 |
public: |
| 1615 |
const FilterInfos& GetSelectedFilter() const; |
| 1616 |
void ParseFilters(const char* vFilters); |
| 1617 |
void SetSelectedFilterWithExt(const std::string& vFilter); |
| 1618 |
bool m_FillFileStyle(std::shared_ptr<FileInfos> vFileInfos) const; |
| 1619 |
void SetFileStyle(const IGFD_FileStyleFlags& vFlags, const char* vCriteria, const FileStyle& vInfos); |
| 1620 |
void SetFileStyle(const IGFD_FileStyleFlags& vFlags, |
| 1621 |
const char* vCriteria, |
| 1622 |
const ImVec4& vColor, |
| 1623 |
const std::string& vIcon, |
| 1624 |
ImFont* vFont); |
| 1625 |
void SetFileStyle(FileStyle::FileStyleFunctor vFunctor); |
| 1626 |
bool GetFileStyle(const IGFD_FileStyleFlags& vFlags, |
| 1627 |
const std::string& vCriteria, |
| 1628 |
ImVec4* vOutColor, |
| 1629 |
std::string* vOutIcon, |
| 1630 |
ImFont** vOutFont); |
| 1631 |
void ClearFilesStyle(); |
| 1632 |
bool IsCoveredByFilters(const FileInfos& vFileInfos, |
| 1633 |
bool vIsCaseInsensitive) const; |
| 1634 |
float GetFilterComboBoxWidth() const; |
| 1635 |
bool DrawFilterComboBox(FileDialogInternal& vFileDialogInternal); |
| 1636 |
std::string ReplaceExtentionWithCurrentFilterIfNeeded(const std::string& vFileName, |
| 1637 |
IGFD_ResultMode vFlag) const; |
| 1638 |
void SetDefaultFilterIfNotDefined(); |
| 1639 |
}; |
| 1640 |
|
| 1641 |
#pragma endregion |
| 1642 |
|
| 1643 |
#pragma region FileType |
| 1644 |
|
| 1645 |
class IGFD_API FileType { |
| 1646 |
public: |
| 1647 |
enum class ContentType { |
| 1648 |
|
| 1649 |
Invalid = -1, |
| 1650 |
Directory = 0, |
| 1651 |
File = 1, |
| 1652 |
LinkToUnknown = 2, |
| 1653 |
}; |
| 1654 |
|
| 1655 |
private: |
| 1656 |
ContentType m_Content = ContentType::Invalid; |
| 1657 |
bool m_Symlink = false; |
| 1658 |
|
| 1659 |
public: |
| 1660 |
FileType(); |
| 1661 |
FileType(const ContentType& vContentType, const bool& vIsSymlink); |
| 1662 |
|
| 1663 |
void SetContent(const ContentType& vContentType); |
| 1664 |
void SetSymLink(const bool& vIsSymlink); |
| 1665 |
|
| 1666 |
bool isValid() const; |
| 1667 |
bool isDir() const; |
| 1668 |
bool isFile() const; |
| 1669 |
bool isLinkToUnknown() const; |
| 1670 |
bool isSymLink() const; |
| 1671 |
|
| 1672 |
|
| 1673 |
bool operator==(const FileType& rhs) const; |
| 1674 |
bool operator!=(const FileType& rhs) const; |
| 1675 |
bool operator<(const FileType& rhs) const; |
| 1676 |
bool operator>(const FileType& rhs) const; |
| 1677 |
}; |
| 1678 |
|
| 1679 |
#pragma endregion |
| 1680 |
|
| 1681 |
#pragma region FileInfos |
| 1682 |
|
| 1683 |
class IGFD_API FileInfos { |
| 1684 |
public: |
| 1685 |
|
| 1686 |
|
| 1687 |
std::array<std::string, EXT_MAX_LEVEL> fileExtLevels; |
| 1688 |
std::array<std::string, EXT_MAX_LEVEL> fileExtLevels_optimized; |
| 1689 |
|
| 1690 |
std::array<std::string, EXT_MAX_LEVEL> fileNameLevels; |
| 1691 |
std::array<std::string, EXT_MAX_LEVEL> fileNameLevels_optimized; |
| 1692 |
size_t countExtDot = 0U; |
| 1693 |
FileType fileType; |
| 1694 |
std::string filePath; |
| 1695 |
std::string fileName; |
| 1696 |
std::string fileNameExt; |
| 1697 |
std::string fileNameExt_optimized; |
| 1698 |
std::string tooltipMessage; |
| 1699 |
int32_t tooltipColumn = -1; |
| 1700 |
size_t fileSize = 0U; |
| 1701 |
std::pair<std::string, std::string> formatedFileSize; |
| 1702 |
std::string fileModifDate; |
| 1703 |
std::shared_ptr<FileStyle> fileStyle = nullptr; |
| 1704 |
#ifdef USE_THUMBNAILS |
| 1705 |
IGFD_Thumbnail_Info thumbnailInfo; |
| 1706 |
#endif |
| 1707 |
|
| 1708 |
public: |
| 1709 |
bool SearchForTag(const std::string& vTag) const; |
| 1710 |
bool SearchForExt(const std::string& vExt, |
| 1711 |
const bool& vIsCaseInsensitive, |
| 1712 |
const size_t& vMaxLevel = EXT_MAX_LEVEL) const; |
| 1713 |
bool SearchForExts(const std::string& vComaSepExts, |
| 1714 |
const bool& vIsCaseInsensitive, |
| 1715 |
const size_t& vMaxLevel = EXT_MAX_LEVEL) const; |
| 1716 |
bool FinalizeFileTypeParsing(const size_t& vMaxDotToExtract); |
| 1717 |
}; |
| 1718 |
|
| 1719 |
#pragma endregion |
| 1720 |
|
| 1721 |
#pragma region FILE SYSTEM INTERFACE |
| 1722 |
|
| 1723 |
class IFileSystem { |
| 1724 |
public: |
| 1725 |
virtual ~IFileSystem() = default; |
| 1726 |
|
| 1727 |
virtual bool IsDirectoryCanBeOpened(const std::string& vName) = 0; |
| 1728 |
|
| 1729 |
virtual bool IsDirectoryExist(const std::string& vName) = 0; |
| 1730 |
|
| 1731 |
virtual bool IsFileExist(const std::string& vName) = 0; |
| 1732 |
|
| 1733 |
virtual bool CreateDirectoryIfNotExist(const std::string& vName) = 0; |
| 1734 |
|
| 1735 |
virtual IGFD::Utils::PathStruct ParsePathFileName(const std::string& vPathFileName) = 0; |
| 1736 |
|
| 1737 |
virtual std::vector<IGFD::FileInfos> ScanDirectory(const std::string& vPath) = 0; |
| 1738 |
|
| 1739 |
virtual bool IsDirectory(const std::string& vFilePathName) = 0; |
| 1740 |
|
| 1741 |
virtual std::vector<std::string> GetDrivesList() = 0; |
| 1742 |
}; |
| 1743 |
|
| 1744 |
#pragma endregion |
| 1745 |
|
| 1746 |
#pragma region FileManager |
| 1747 |
|
| 1748 |
class IGFD_API FileManager { |
| 1749 |
public: |
| 1750 |
enum SortingFieldEnum { |
| 1751 |
FIELD_FILENAME, |
| 1752 |
FIELD_TYPE, |
| 1753 |
FIELD_SIZE, |
| 1754 |
FIELD_DATE, |
| 1755 |
#ifdef USE_THUMBNAILS |
| 1756 |
FIELD_THUMBNAILS, |
| 1757 |
#endif |
| 1758 |
NUM_FIELDS, |
| 1759 |
}; |
| 1760 |
|
| 1761 |
#ifdef NEED_TO_BE_PUBLIC_FOR_TESTS |
| 1762 |
public: |
| 1763 |
#else |
| 1764 |
private: |
| 1765 |
#endif |
| 1766 |
std::string m_CurrentPath; |
| 1767 |
std::vector<std::string> m_CurrentPathDecomposition; |
| 1768 |
std::vector<std::shared_ptr<FileInfos>> m_FileList; |
| 1769 |
std::vector<std::shared_ptr<FileInfos>> m_FilteredFileList; |
| 1770 |
std::vector<std::shared_ptr<FileInfos>> m_PathList; |
| 1771 |
std::vector<std::shared_ptr<FileInfos>> m_FilteredPathList; |
| 1772 |
std::vector<std::string>::iterator m_PopupComposedPath; |
| 1773 |
std::string m_LastSelectedFileName; |
| 1774 |
std::set<std::string> m_SelectedFileNames; |
| 1775 |
bool m_CreateDirectoryMode = false; |
| 1776 |
std::string m_FileSystemName; |
| 1777 |
std::unique_ptr<IFileSystem> m_FileSystemPtr = nullptr; |
| 1778 |
|
| 1779 |
public: |
| 1780 |
bool inputPathActivated = false; |
| 1781 |
bool drivesClicked = false; |
| 1782 |
bool puPathClicked = false; |
| 1783 |
char inputPathBuffer[MAX_PATH_BUFFER_SIZE] = ""; |
| 1784 |
char variadicBuffer[MAX_FILE_DIALOG_NAME_BUFFER] = ""; |
| 1785 |
char fileNameBuffer[MAX_FILE_DIALOG_NAME_BUFFER] = ""; |
| 1786 |
char directoryNameBuffer[MAX_FILE_DIALOG_NAME_BUFFER] = ""; |
| 1787 |
std::string header[SortingFieldEnum::NUM_FIELDS]; |
| 1788 |
bool sortingDirection[SortingFieldEnum::NUM_FIELDS] = { |
| 1789 |
defaultSortOrderFilename, defaultSortOrderType, defaultSortOrderSize, defaultSortOrderDate, |
| 1790 |
#ifdef USE_THUMBNAILS |
| 1791 |
defaultSortOrderThumbnails, |
| 1792 |
#endif |
| 1793 |
}; |
| 1794 |
SortingFieldEnum sortingField = SortingFieldEnum::FIELD_FILENAME; |
| 1795 |
bool showDrives = false; |
| 1796 |
|
| 1797 |
std::string dLGpath; |
| 1798 |
std::string dLGDefaultFileName; |
| 1799 |
size_t dLGcountSelectionMax = 1U; |
| 1800 |
bool dLGDirectoryMode = false; |
| 1801 |
|
| 1802 |
std::string fsRoot; |
| 1803 |
|
| 1804 |
#ifdef NEED_TO_BE_PUBLIC_FOR_TESTS |
| 1805 |
public: |
| 1806 |
#else |
| 1807 |
private: |
| 1808 |
#endif |
| 1809 |
static void m_CompleteFileInfos(const std::shared_ptr<FileInfos>& vInfos); |
| 1810 |
void m_RemoveFileNameInSelection(const std::string& vFileName); |
| 1811 |
void m_m_AddFileNameInSelection(const std::string& vFileName, bool vSetLastSelectionFileName); |
| 1812 |
void m_AddFile(const FileDialogInternal& vFileDialogInternal, |
| 1813 |
const std::string& vPath, |
| 1814 |
const std::string& vFileName, |
| 1815 |
const FileType& vFileType); |
| 1816 |
void m_AddPath(const FileDialogInternal& vFileDialogInternal, |
| 1817 |
const std::string& vPath, |
| 1818 |
const std::string& vFileName, |
| 1819 |
const FileType& vFileType); |
| 1820 |
void m_ScanDirForPathSelection(const FileDialogInternal& vFileDialogInternal, |
| 1821 |
const std::string& vPath); |
| 1822 |
void m_OpenPathPopup(const FileDialogInternal& vFileDialogInternal, |
| 1823 |
std::vector<std::string>::iterator vPathIter); |
| 1824 |
void m_SetCurrentPath(std::vector<std::string>::iterator vPathIter); |
| 1825 |
void m_ApplyFilteringOnFileList(const FileDialogInternal& vFileDialogInternal, |
| 1826 |
std::vector<std::shared_ptr<FileInfos>>& vFileInfosList, |
| 1827 |
std::vector<std::shared_ptr<FileInfos>>& vFileInfosFilteredList); |
| 1828 |
void m_SortFields(const FileDialogInternal& vFileDialogInternal, |
| 1829 |
std::vector<std::shared_ptr<FileInfos>>& vFileInfosList, |
| 1830 |
std::vector<std::shared_ptr<FileInfos>>& vFileInfosFilteredList); |
| 1831 |
bool m_CompleteFileInfosWithUserFileAttirbutes(const FileDialogInternal& vFileDialogInternal, const std::shared_ptr<FileInfos>& vInfos); |
| 1832 |
|
| 1833 |
public: |
| 1834 |
FileManager(); |
| 1835 |
bool IsComposerEmpty(); |
| 1836 |
size_t GetComposerSize(); |
| 1837 |
bool IsFileListEmpty(); |
| 1838 |
bool IsPathListEmpty(); |
| 1839 |
bool IsFilteredListEmpty(); |
| 1840 |
bool IsPathFilteredListEmpty(); |
| 1841 |
size_t GetFullFileListSize(); |
| 1842 |
std::shared_ptr<FileInfos> GetFullFileAt(size_t vIdx); |
| 1843 |
size_t GetFilteredListSize(); |
| 1844 |
size_t GetPathFilteredListSize(); |
| 1845 |
std::shared_ptr<FileInfos> GetFilteredFileAt(size_t vIdx); |
| 1846 |
std::shared_ptr<FileInfos> GetFilteredPathAt(size_t vIdx); |
| 1847 |
std::vector<std::string>::iterator GetCurrentPopupComposedPath(); |
| 1848 |
bool IsFileNameSelected(const std::string& vFileName); |
| 1849 |
std::string GetBack(); |
| 1850 |
void ClearComposer(); |
| 1851 |
void ClearFileLists(); |
| 1852 |
void ClearPathLists(); |
| 1853 |
void ClearAll(); |
| 1854 |
void ApplyFilteringOnFileList(const FileDialogInternal& vFileDialogInternal); |
| 1855 |
void SortFields(const FileDialogInternal& vFileDialogInternal); |
| 1856 |
void OpenCurrentPath(const FileDialogInternal& vFileDialogInternal); |
| 1857 |
|
| 1858 |
bool GetDrives(); |
| 1859 |
bool CreateDir(const std::string& vPath); |
| 1860 |
std::string ComposeNewPath(std::vector<std::string>::iterator vIter); |
| 1861 |
bool SetPathOnParentDirectoryIfAny(); |
| 1862 |
std::string GetCurrentPath(); |
| 1863 |
void SetCurrentPath(const std::string& vCurrentPath); |
| 1864 |
void SetDefaultFileName(const std::string& vFileName); |
| 1865 |
bool SelectDirectory(const std::shared_ptr<FileInfos>& vInfos); |
| 1866 |
void SelectFileName(const FileDialogInternal& vFileDialogInternal, |
| 1867 |
const std::shared_ptr<FileInfos>& vInfos); |
| 1868 |
void SetCurrentDir(const std::string& vPath); |
| 1869 |
void ScanDir(const FileDialogInternal& vFileDialogInternal, |
| 1870 |
const std::string& vPath); |
| 1871 |
|
| 1872 |
std::string GetResultingPath(); |
| 1873 |
std::string GetResultingFileName(FileDialogInternal& vFileDialogInternal, IGFD_ResultMode vFlag); |
| 1874 |
std::string GetResultingFilePathName(FileDialogInternal& vFileDialogInternal, IGFD_ResultMode vFlag); |
| 1875 |
std::map<std::string, std::string> GetResultingSelection(FileDialogInternal& vFileDialogInternal, IGFD_ResultMode vFlag); |
| 1876 |
|
| 1877 |
void DrawDirectoryCreation(const FileDialogInternal& vFileDialogInternal); |
| 1878 |
void DrawPathComposer(const FileDialogInternal& vFileDialogInternal); |
| 1879 |
|
| 1880 |
IFileSystem* GetFileSystemInstance() { |
| 1881 |
return m_FileSystemPtr.get(); |
| 1882 |
} |
| 1883 |
const std::string& GetFileSystemName() { |
| 1884 |
return m_FileSystemName; |
| 1885 |
} |
| 1886 |
}; |
| 1887 |
|
| 1888 |
#pragma endregion |
| 1889 |
|
| 1890 |
#pragma region FileDialogInternal |
| 1891 |
|
| 1892 |
typedef void* UserDatas; |
| 1893 |
typedef std::function<void(const char*, UserDatas, bool*)> PaneFun; |
| 1894 |
typedef std::function<bool(FileInfos*, UserDatas)> UserFileAttributesFun; |
| 1895 |
|
| 1896 |
struct IGFD_API FileDialogConfig { |
| 1897 |
std::string path; |
| 1898 |
std::string fileName; |
| 1899 |
std::string filePathName; |
| 1900 |
int32_t countSelectionMax = 1; |
| 1901 |
UserDatas userDatas = nullptr; |
| 1902 |
ImGuiFileDialogFlags flags = ImGuiFileDialogFlags_None; |
| 1903 |
PaneFun sidePane; |
| 1904 |
float sidePaneWidth = 250.0f; |
| 1905 |
UserFileAttributesFun userFileAttributes; |
| 1906 |
}; |
| 1907 |
|
| 1908 |
class IGFD_API FileDialogInternal { |
| 1909 |
public: |
| 1910 |
FileManager fileManager; |
| 1911 |
FilterManager filterManager; |
| 1912 |
SearchManager searchManager; |
| 1913 |
|
| 1914 |
public: |
| 1915 |
std::string name; |
| 1916 |
bool showDialog = false; |
| 1917 |
ImVec2 dialogCenterPos = ImVec2(0, 0); |
| 1918 |
int lastImGuiFrameCount = 0; |
| 1919 |
float footerHeight = 0.0f; |
| 1920 |
bool canWeContinue = true; |
| 1921 |
bool okResultToConfirm = false; |
| 1922 |
bool isOk = false; |
| 1923 |
bool fileInputIsActive = false; |
| 1924 |
bool fileListViewIsActive = false; |
| 1925 |
std::string dLGkey; |
| 1926 |
std::string dLGtitle; |
| 1927 |
bool needToExitDialog = false; |
| 1928 |
bool puUseCustomLocale = false; |
| 1929 |
int localeCategory = LC_ALL; |
| 1930 |
std::string localeBegin; |
| 1931 |
std::string localeEnd; |
| 1932 |
|
| 1933 |
private: |
| 1934 |
FileDialogConfig m_DialogConfig; |
| 1935 |
|
| 1936 |
public: |
| 1937 |
void NewFrame(); |
| 1938 |
void EndFrame(); |
| 1939 |
void ResetForNewDialog(); |
| 1940 |
|
| 1941 |
void configureDialog( |
| 1942 |
const std::string& vKey, |
| 1943 |
const std::string& vTitle, |
| 1944 |
const char* vFilters, |
| 1945 |
const FileDialogConfig& vConfig); |
| 1946 |
const FileDialogConfig& getDialogConfig() const; |
| 1947 |
FileDialogConfig& getDialogConfigRef(); |
| 1948 |
}; |
| 1949 |
|
| 1950 |
#pragma endregion |
| 1951 |
|
| 1952 |
#pragma endregion |
| 1953 |
|
| 1954 |
#pragma region Optional Features |
| 1955 |
|
| 1956 |
#pragma region ThumbnailFeature |
| 1957 |
|
| 1958 |
#ifdef USE_THUMBNAILS |
| 1959 |
typedef std::function<void(IGFD_Thumbnail_Info*)> CreateThumbnailFun; |
| 1960 |
typedef std::function<void(IGFD_Thumbnail_Info*)> DestroyThumbnailFun; |
| 1961 |
#endif |
| 1962 |
class IGFD_API ThumbnailFeature { |
| 1963 |
protected: |
| 1964 |
ThumbnailFeature(); |
| 1965 |
~ThumbnailFeature(); |
| 1966 |
|
| 1967 |
void m_NewThumbnailFrame(FileDialogInternal& vFileDialogInternal); |
| 1968 |
void m_EndThumbnailFrame(FileDialogInternal& vFileDialogInternal); |
| 1969 |
void m_QuitThumbnailFrame(FileDialogInternal& vFileDialogInternal); |
| 1970 |
|
| 1971 |
#ifdef USE_THUMBNAILS |
| 1972 |
protected: |
| 1973 |
enum class DisplayModeEnum { FILE_LIST = 0, THUMBNAILS_LIST, THUMBNAILS_GRID }; |
| 1974 |
|
| 1975 |
private: |
| 1976 |
uint32_t m_CountFiles = 0U; |
| 1977 |
bool m_IsWorking = false; |
| 1978 |
std::shared_ptr<std::thread> m_ThumbnailGenerationThread = nullptr; |
| 1979 |
std::list<std::shared_ptr<FileInfos>> m_ThumbnailFileDatasToGet; |
| 1980 |
std::mutex m_ThumbnailFileDatasToGetMutex; |
| 1981 |
std::condition_variable m_ThumbnailFileDatasToGetCv; |
| 1982 |
std::list<std::shared_ptr<FileInfos>> m_ThumbnailToCreate; |
| 1983 |
std::mutex m_ThumbnailToCreateMutex; |
| 1984 |
std::list<IGFD_Thumbnail_Info> m_ThumbnailToDestroy; |
| 1985 |
std::mutex m_ThumbnailToDestroyMutex; |
| 1986 |
|
| 1987 |
CreateThumbnailFun m_CreateThumbnailFun = nullptr; |
| 1988 |
DestroyThumbnailFun m_DestroyThumbnailFun = nullptr; |
| 1989 |
|
| 1990 |
protected: |
| 1991 |
DisplayModeEnum m_DisplayMode = DisplayModeEnum::FILE_LIST; |
| 1992 |
|
| 1993 |
private: |
| 1994 |
void m_VariadicProgressBar(float fraction, const ImVec2& size_arg, const char* fmt, ...); |
| 1995 |
|
| 1996 |
protected: |
| 1997 |
|
| 1998 |
void m_StartThumbnailFileDatasExtraction(); |
| 1999 |
bool m_StopThumbnailFileDatasExtraction(); |
| 2000 |
void m_ThreadThumbnailFileDatasExtractionFunc(); |
| 2001 |
void m_DrawThumbnailGenerationProgress(); |
| 2002 |
void m_AddThumbnailToLoad(const std::shared_ptr<FileInfos>& vFileInfos); |
| 2003 |
void m_AddThumbnailToCreate(const std::shared_ptr<FileInfos>& vFileInfos); |
| 2004 |
void m_AddThumbnailToDestroy(const IGFD_Thumbnail_Info& vIGFD_Thumbnail_Info); |
| 2005 |
void m_DrawDisplayModeToolBar(); |
| 2006 |
void m_ClearThumbnails(FileDialogInternal& vFileDialogInternal); |
| 2007 |
|
| 2008 |
public: |
| 2009 |
void SetCreateThumbnailCallback(const CreateThumbnailFun& vCreateThumbnailFun); |
| 2010 |
void SetDestroyThumbnailCallback(const DestroyThumbnailFun& vCreateThumbnailFun); |
| 2011 |
|
| 2012 |
|
| 2013 |
void ManageGPUThumbnails(); |
| 2014 |
#endif |
| 2015 |
}; |
| 2016 |
|
| 2017 |
#pragma endregion |
| 2018 |
|
| 2019 |
#pragma region BookMarkFeature |
| 2020 |
|
| 2021 |
class IGFD_API BookMarkFeature { |
| 2022 |
protected: |
| 2023 |
BookMarkFeature(); |
| 2024 |
|
| 2025 |
#ifdef USE_BOOKMARK |
| 2026 |
private: |
| 2027 |
struct BookmarkStruct { |
| 2028 |
std::string name; |
| 2029 |
|
| 2030 |
|
| 2031 |
std::string path; |
| 2032 |
|
| 2033 |
bool defined_by_code = false; |
| 2034 |
}; |
| 2035 |
|
| 2036 |
private: |
| 2037 |
ImGuiListClipper m_BookmarkClipper; |
| 2038 |
std::vector<BookmarkStruct> m_Bookmarks; |
| 2039 |
char m_BookmarkEditBuffer[MAX_FILE_DIALOG_NAME_BUFFER] = ""; |
| 2040 |
|
| 2041 |
protected: |
| 2042 |
float m_BookmarkWidth = 200.0f; |
| 2043 |
bool m_BookmarkPaneShown = false; |
| 2044 |
|
| 2045 |
protected: |
| 2046 |
void m_DrawBookmarkButton(); |
| 2047 |
bool m_DrawBookmarkPane(FileDialogInternal& vFileDialogInternal, const ImVec2& vSize); |
| 2048 |
|
| 2049 |
public: |
| 2050 |
std::string SerializeBookmarks( |
| 2051 |
const bool& vDontSerializeCodeBasedBookmarks = true); |
| 2052 |
void DeserializeBookmarks( |
| 2053 |
const std::string& vBookmarks); |
| 2054 |
void AddBookmark( |
| 2055 |
const std::string& vBookMarkName, |
| 2056 |
const std::string& vBookMarkPath); |
| 2057 |
bool RemoveBookmark( |
| 2058 |
const std::string& vBookMarkName); |
| 2059 |
|
| 2060 |
#endif |
| 2061 |
}; |
| 2062 |
|
| 2063 |
#pragma endregion |
| 2064 |
|
| 2065 |
#pragma region KeyExplorerFeature |
| 2066 |
|
| 2067 |
|
| 2068 |
class IGFD_API KeyExplorerFeature { |
| 2069 |
protected: |
| 2070 |
KeyExplorerFeature(); |
| 2071 |
|
| 2072 |
#ifdef USE_EXPLORATION_BY_KEYS |
| 2073 |
private: |
| 2074 |
bool m_LocateFileByInputChar_lastFound = false; |
| 2075 |
ImWchar m_LocateFileByInputChar_lastChar = 0; |
| 2076 |
float m_FlashAlpha = 0.0f; |
| 2077 |
float m_FlashAlphaAttenInSecs = 1.0f; |
| 2078 |
int m_LocateFileByInputChar_InputQueueCharactersSize = 0; |
| 2079 |
size_t m_FlashedItem = 0; |
| 2080 |
size_t m_LocateFileByInputChar_lastFileIdx = 0; |
| 2081 |
|
| 2082 |
protected: |
| 2083 |
void m_LocateByInputKey(FileDialogInternal& vFileDialogInternal); |
| 2084 |
bool m_LocateItem_Loop(FileDialogInternal& vFileDialogInternal, |
| 2085 |
ImWchar vC); |
| 2086 |
void m_ExploreWithkeys(FileDialogInternal& vFileDialogInternal, |
| 2087 |
ImGuiID vListViewID); |
| 2088 |
void m_StartFlashItem(size_t vIdx); |
| 2089 |
bool m_BeginFlashItem(size_t vIdx); |
| 2090 |
static void m_EndFlashItem(); |
| 2091 |
static bool m_FlashableSelectable(const char* label, |
| 2092 |
bool selected = false, |
| 2093 |
ImGuiSelectableFlags flags = 0, |
| 2094 |
bool vFlashing = false, |
| 2095 |
const ImVec2& size = ImVec2(0, 0)); |
| 2096 |
|
| 2097 |
public: |
| 2098 |
void SetFlashingAttenuationInSeconds( |
| 2099 |
float vAttenValue); |
| 2100 |
#endif |
| 2101 |
}; |
| 2102 |
|
| 2103 |
#pragma endregion |
| 2104 |
|
| 2105 |
#pragma endregion |
| 2106 |
|
| 2107 |
#pragma region FileDialog |
| 2108 |
|
| 2109 |
class IGFD_API FileDialog : public BookMarkFeature, public KeyExplorerFeature, public ThumbnailFeature { |
| 2110 |
protected: |
| 2111 |
FileDialogInternal m_FileDialogInternal; |
| 2112 |
ImGuiListClipper m_FileListClipper; |
| 2113 |
ImGuiListClipper m_PathListClipper; |
| 2114 |
float prOkCancelButtonWidth = 0.0f; |
| 2115 |
|
| 2116 |
public: |
| 2117 |
|
| 2118 |
|
| 2119 |
static FileDialog* Instance(FileDialog* vCopy = nullptr, bool vForce = false) { |
| 2120 |
static FileDialog _instance; |
| 2121 |
static FileDialog* _instance_copy = nullptr; |
| 2122 |
if (vCopy || vForce) { |
| 2123 |
_instance_copy = vCopy; |
| 2124 |
} |
| 2125 |
if (_instance_copy) { |
| 2126 |
return _instance_copy; |
| 2127 |
} |
| 2128 |
return &_instance; |
| 2129 |
} |
| 2130 |
|
| 2131 |
public: |
| 2132 |
FileDialog(); |
| 2133 |
virtual ~FileDialog(); |
| 2134 |
|
| 2135 |
|
| 2136 |
virtual void OpenDialog( |
| 2137 |
const std::string& vKey, |
| 2138 |
const std::string& vTitle, |
| 2139 |
const char* vFilters, |
| 2140 |
const FileDialogConfig& vConfig = {}); |
| 2141 |
|
| 2142 |
|
| 2143 |
bool Display( |
| 2144 |
const std::string& vKey, |
| 2145 |
ImGuiWindowFlags vFlags = ImGuiWindowFlags_NoCollapse, |
| 2146 |
ImVec2 vMinSize = ImVec2(0, 0), |
| 2147 |
ImVec2 vMaxSize = ImVec2(FLT_MAX, FLT_MAX)); |
| 2148 |
void Close(); |
| 2149 |
|
| 2150 |
|
| 2151 |
bool WasOpenedThisFrame(const std::string& vKey) const; |
| 2152 |
bool WasOpenedThisFrame() const; |
| 2153 |
bool IsOpened(const std::string& vKey) const; |
| 2154 |
bool IsOpened() const; |
| 2155 |
std::string GetOpenedKey() const; |
| 2156 |
|
| 2157 |
|
| 2158 |
bool IsOk() const; |
| 2159 |
std::map<std::string, std::string> GetSelection( |
| 2160 |
IGFD_ResultMode vFlag = IGFD_ResultMode_KeepInputFile); |
| 2161 |
|
| 2162 |
std::string GetFilePathName( |
| 2163 |
IGFD_ResultMode vFlag = IGFD_ResultMode_AddIfNoFileExt); |
| 2164 |
std::string GetCurrentFileName(IGFD_ResultMode vFlag = IGFD_ResultMode_AddIfNoFileExt); |
| 2165 |
std::string GetCurrentPath(); |
| 2166 |
std::string GetCurrentFilter(); |
| 2167 |
UserDatas GetUserDatas() const; |
| 2168 |
|
| 2169 |
|
| 2170 |
void SetFileStyle( |
| 2171 |
const IGFD_FileStyleFlags& vFlags, |
| 2172 |
const char* vCriteria, |
| 2173 |
const FileStyle& vInfos); |
| 2174 |
|
| 2175 |
void SetFileStyle( |
| 2176 |
const IGFD_FileStyleFlags& vFlags, |
| 2177 |
const char* vCriteria, |
| 2178 |
const ImVec4& vColor, |
| 2179 |
const std::string& vIcon = "", |
| 2180 |
ImFont* vFont = nullptr); |
| 2181 |
void SetFileStyle(FileStyle::FileStyleFunctor vFunctor); |
| 2182 |
bool GetFileStyle( |
| 2183 |
const IGFD_FileStyleFlags& vFlags, |
| 2184 |
const std::string& vCriteria, |
| 2185 |
ImVec4* vOutColor, |
| 2186 |
std::string* vOutIcon = nullptr, |
| 2187 |
ImFont** vOutFont = nullptr); |
| 2188 |
void ClearFilesStyle(); |
| 2189 |
|
| 2190 |
void SetLocales( |
| 2191 |
const int& vLocaleCategory, |
| 2192 |
const std::string& vLocaleBegin, |
| 2193 |
const std::string& vLocaleEnd); |
| 2194 |
|
| 2195 |
protected: |
| 2196 |
void m_NewFrame(); |
| 2197 |
void m_EndFrame(); |
| 2198 |
void m_QuitFrame(); |
| 2199 |
|
| 2200 |
|
| 2201 |
bool m_Confirm_Or_OpenOverWriteFileDialog_IfNeeded( |
| 2202 |
bool vLastAction, ImGuiWindowFlags vFlags); |
| 2203 |
|
| 2204 |
|
| 2205 |
|
| 2206 |
virtual void m_DrawHeader(); |
| 2207 |
|
| 2208 |
virtual void m_DrawContent(); |
| 2209 |
virtual bool m_DrawFooter(); |
| 2210 |
|
| 2211 |
|
| 2212 |
virtual void m_DisplayPathPopup(ImVec2 vSize); |
| 2213 |
virtual bool m_DrawValidationButtons(); |
| 2214 |
virtual bool m_DrawOkButton(); |
| 2215 |
virtual bool m_DrawCancelButton(); |
| 2216 |
virtual void m_DrawSidePane(float vHeight); |
| 2217 |
virtual void m_SelectableItem(int vidx, |
| 2218 |
std::shared_ptr<FileInfos> vInfos, |
| 2219 |
bool vSelected, |
| 2220 |
const char* vFmt, |
| 2221 |
...); |
| 2222 |
virtual void m_DrawFileListView(ImVec2 vSize); |
| 2223 |
|
| 2224 |
#ifdef USE_THUMBNAILS |
| 2225 |
virtual void m_DrawThumbnailsListView(ImVec2 vSize); |
| 2226 |
virtual void m_DrawThumbnailsGridView(ImVec2 vSize); |
| 2227 |
#endif |
| 2228 |
|
| 2229 |
|
| 2230 |
|
| 2231 |
|
| 2232 |
|
| 2233 |
void m_BeginFileColorIconStyle(std::shared_ptr<FileInfos> vFileInfos, |
| 2234 |
bool& vOutShowColor, |
| 2235 |
std::string& vOutStr, |
| 2236 |
ImFont** vOutFont); |
| 2237 |
void m_EndFileColorIconStyle(const bool& vShowColor, ImFont* vFont); |
| 2238 |
|
| 2239 |
void m_DisplayFileInfosTooltip(const int32_t& vRowIdx, const int32_t& vColumnIdx, std::shared_ptr<FileInfos> vFileInfos); |
| 2240 |
}; |
| 2241 |
|
| 2242 |
#pragma endregion |
| 2243 |
|
| 2244 |
} |
| 2245 |
|
| 2246 |
#pragma endregion |
| 2247 |
|
| 2248 |
#endif |
| 2249 |
|
| 2250 |
#pragma region IGFD_C_API |
| 2251 |
|
| 2252 |
#include <stdint.h> |
| 2253 |
|
| 2254 |
#if defined _WIN32 || defined __CYGWIN__ |
| 2255 |
#ifdef IMGUIFILEDIALOG_NO_EXPORT |
| 2256 |
#define API |
| 2257 |
#else |
| 2258 |
#define API __declspec(dllexport) |
| 2259 |
#endif |
| 2260 |
#else |
| 2261 |
#ifdef __GNUC__ |
| 2262 |
#define API __attribute__((__visibility__("default"))) |
| 2263 |
#else |
| 2264 |
#define API |
| 2265 |
#endif |
| 2266 |
#endif |
| 2267 |
|
| 2268 |
#ifdef __cplusplus |
| 2269 |
#define IGFD_C_API extern "C" API |
| 2270 |
typedef IGFD::UserDatas IGFDUserDatas; |
| 2271 |
typedef IGFD::PaneFun IGFDPaneFun; |
| 2272 |
typedef IGFD::FileDialog ImGuiFileDialog; |
| 2273 |
#else |
| 2274 |
#define IGFD_C_API |
| 2275 |
typedef struct ImGuiFileDialog ImGuiFileDialog; |
| 2276 |
typedef struct IGFD_Selection_Pair IGFD_Selection_Pair; |
| 2277 |
typedef struct IGFD_Selection IGFD_Selection; |
| 2278 |
#endif |
| 2279 |
|
| 2280 |
typedef void (*IGFD_PaneFun)(const char*, void*, bool*); |
| 2281 |
|
| 2282 |
struct IGFD_FileDialog_Config { |
| 2283 |
const char* path; |
| 2284 |
const char* fileName; |
| 2285 |
const char* filePathName; |
| 2286 |
int32_t countSelectionMax; |
| 2287 |
void* userDatas; |
| 2288 |
IGFD_PaneFun sidePane; |
| 2289 |
float sidePaneWidth; |
| 2290 |
ImGuiFileDialogFlags flags; |
| 2291 |
}; |
| 2292 |
IGFD_C_API IGFD_FileDialog_Config IGFD_FileDialog_Config_Get(); |
| 2293 |
|
| 2294 |
struct IGFD_Selection_Pair { |
| 2295 |
char* fileName; |
| 2296 |
char* filePathName; |
| 2297 |
}; |
| 2298 |
|
| 2299 |
IGFD_C_API IGFD_Selection_Pair IGFD_Selection_Pair_Get(); |
| 2300 |
IGFD_C_API void IGFD_Selection_Pair_DestroyContent(IGFD_Selection_Pair* vSelection_Pair); |
| 2301 |
|
| 2302 |
struct IGFD_Selection { |
| 2303 |
IGFD_Selection_Pair* table; |
| 2304 |
size_t count; |
| 2305 |
}; |
| 2306 |
|
| 2307 |
IGFD_C_API IGFD_Selection IGFD_Selection_Get(); |
| 2308 |
IGFD_C_API void IGFD_Selection_DestroyContent(IGFD_Selection* vSelection); |
| 2309 |
|
| 2310 |
|
| 2311 |
IGFD_C_API ImGuiFileDialog* IGFD_Create(void); |
| 2312 |
IGFD_C_API void IGFD_Destroy(ImGuiFileDialog* vContextPtr); |
| 2313 |
|
| 2314 |
#ifdef USE_THUMBNAILS |
| 2315 |
typedef void (*IGFD_CreateThumbnailFun)(IGFD_Thumbnail_Info*); |
| 2316 |
typedef void (*IGFD_DestroyThumbnailFun)(IGFD_Thumbnail_Info*); |
| 2317 |
#endif |
| 2318 |
|
| 2319 |
IGFD_C_API void IGFD_OpenDialog( |
| 2320 |
ImGuiFileDialog* vContextPtr, |
| 2321 |
const char* vKey, |
| 2322 |
const char* vTitle, |
| 2323 |
const char* vFilters, |
| 2324 |
const IGFD_FileDialog_Config vConfig); |
| 2325 |
|
| 2326 |
IGFD_C_API bool IGFD_DisplayDialog( |
| 2327 |
ImGuiFileDialog* vContextPtr, |
| 2328 |
const char* vKey, |
| 2329 |
ImGuiWindowFlags vFlags, |
| 2330 |
ImVec2 vMinSize, |
| 2331 |
ImVec2 vMaxSize); |
| 2332 |
|
| 2333 |
IGFD_C_API void IGFD_CloseDialog( |
| 2334 |
ImGuiFileDialog* vContextPtr); |
| 2335 |
|
| 2336 |
IGFD_C_API bool IGFD_IsOk( |
| 2337 |
ImGuiFileDialog* vContextPtr); |
| 2338 |
|
| 2339 |
IGFD_C_API bool IGFD_WasKeyOpenedThisFrame( |
| 2340 |
ImGuiFileDialog* vContextPtr, |
| 2341 |
const char* vKey); |
| 2342 |
|
| 2343 |
IGFD_C_API bool IGFD_WasOpenedThisFrame( |
| 2344 |
ImGuiFileDialog* vContextPtr); |
| 2345 |
|
| 2346 |
IGFD_C_API bool IGFD_IsKeyOpened( |
| 2347 |
ImGuiFileDialog* vContextPtr, |
| 2348 |
const char* vCurrentOpenedKey); |
| 2349 |
|
| 2350 |
IGFD_C_API bool IGFD_IsOpened( |
| 2351 |
ImGuiFileDialog* vContextPtr); |
| 2352 |
|
| 2353 |
IGFD_C_API IGFD_Selection IGFD_GetSelection( |
| 2354 |
ImGuiFileDialog* vContextPtr, |
| 2355 |
IGFD_ResultMode vMode); |
| 2356 |
|
| 2357 |
IGFD_C_API char* IGFD_GetFilePathName( |
| 2358 |
|
| 2359 |
ImGuiFileDialog* vContextPtr, |
| 2360 |
IGFD_ResultMode vMode); |
| 2361 |
|
| 2362 |
IGFD_C_API char* IGFD_GetCurrentFileName( |
| 2363 |
|
| 2364 |
ImGuiFileDialog* vContextPtr, |
| 2365 |
IGFD_ResultMode vMode); |
| 2366 |
|
| 2367 |
IGFD_C_API char* IGFD_GetCurrentPath( |
| 2368 |
ImGuiFileDialog* vContextPtr); |
| 2369 |
|
| 2370 |
IGFD_C_API char* IGFD_GetCurrentFilter( |
| 2371 |
ImGuiFileDialog* vContextPtr); |
| 2372 |
|
| 2373 |
IGFD_C_API void* IGFD_GetUserDatas( |
| 2374 |
ImGuiFileDialog* vContextPtr); |
| 2375 |
|
| 2376 |
IGFD_C_API void IGFD_SetFileStyle( |
| 2377 |
ImGuiFileDialog* vContextPtr, |
| 2378 |
IGFD_FileStyleFlags vFileStyleFlags, |
| 2379 |
const char* vFilter, |
| 2380 |
ImVec4 vColor, |
| 2381 |
const char* vIconText, |
| 2382 |
ImFont* vFont); |
| 2383 |
|
| 2384 |
IGFD_C_API void IGFD_SetFileStyle2( |
| 2385 |
ImGuiFileDialog* vContextPtr, |
| 2386 |
IGFD_FileStyleFlags vFileStyleFlags, |
| 2387 |
const char* vFilter, |
| 2388 |
float vR, |
| 2389 |
float vG, |
| 2390 |
float vB, |
| 2391 |
float vA, |
| 2392 |
const char* vIconText, |
| 2393 |
ImFont* vFont); |
| 2394 |
|
| 2395 |
IGFD_C_API bool IGFD_GetFileStyle(ImGuiFileDialog* vContextPtr, |
| 2396 |
IGFD_FileStyleFlags vFileStyleFlags, |
| 2397 |
const char* vFilter, |
| 2398 |
ImVec4* vOutColor, |
| 2399 |
char** vOutIconText, |
| 2400 |
ImFont** vOutFont); |
| 2401 |
|
| 2402 |
IGFD_C_API void IGFD_ClearFilesStyle( |
| 2403 |
ImGuiFileDialog* vContextPtr); |
| 2404 |
|
| 2405 |
IGFD_C_API void SetLocales( |
| 2406 |
ImGuiFileDialog* vContextPtr, |
| 2407 |
const int vCategory, |
| 2408 |
const char* vBeginLocale, |
| 2409 |
const char* vEndLocale); |
| 2410 |
|
| 2411 |
#ifdef USE_EXPLORATION_BY_KEYS |
| 2412 |
IGFD_C_API void IGFD_SetFlashingAttenuationInSeconds( |
| 2413 |
|
| 2414 |
ImGuiFileDialog* vContextPtr, |
| 2415 |
float vAttenValue); |
| 2416 |
#endif |
| 2417 |
|
| 2418 |
#ifdef USE_BOOKMARK |
| 2419 |
IGFD_C_API char* IGFD_SerializeBookmarks( |
| 2420 |
|
| 2421 |
ImGuiFileDialog* vContextPtr, |
| 2422 |
bool vDontSerializeCodeBasedBookmarks); |
| 2423 |
|
| 2424 |
IGFD_C_API void IGFD_DeserializeBookmarks( |
| 2425 |
|
| 2426 |
ImGuiFileDialog* vContextPtr, |
| 2427 |
const char* vBookmarks); |
| 2428 |
|
| 2429 |
IGFD_C_API void IGFD_AddBookmark( |
| 2430 |
ImGuiFileDialog* vContextPtr, |
| 2431 |
const char* vBookMarkName, |
| 2432 |
const char* vBookMarkPath); |
| 2433 |
|
| 2434 |
IGFD_C_API void IGFD_RemoveBookmark( |
| 2435 |
ImGuiFileDialog* vContextPtr, |
| 2436 |
const char* vBookMarkName); |
| 2437 |
#endif |
| 2438 |
|
| 2439 |
#ifdef USE_THUMBNAILS |
| 2440 |
IGFD_C_API void SetCreateThumbnailCallback( |
| 2441 |
ImGuiFileDialog* vContextPtr, |
| 2442 |
IGFD_CreateThumbnailFun vCreateThumbnailFun); |
| 2443 |
|
| 2444 |
IGFD_C_API void SetDestroyThumbnailCallback( |
| 2445 |
ImGuiFileDialog* vContextPtr, |
| 2446 |
IGFD_DestroyThumbnailFun vDestroyThumbnailFun); |
| 2447 |
|
| 2448 |
IGFD_C_API void ManageGPUThumbnails( |
| 2449 |
|
| 2450 |
ImGuiFileDialog* vContextPtr); |
| 2451 |
#endif |
| 2452 |
|
| 2453 |
#pragma endregion |