ENH: Auxiliary GUI

Change-Id: Iaefd8bb6a2a560f4f2ec8235b21231763d8562fe
This commit is contained in:
liz.li 2022-08-24 20:14:23 +08:00 committed by Lane.Wei
parent 16bbcf6f97
commit 36ca76c2a4
5 changed files with 215 additions and 107 deletions

View File

@ -1,19 +1,9 @@
<svg width="300" height="300" xmlns="http://www.w3.org/2000/svg" fill="none"> <svg width="168" height="168" viewBox="0 0 168 168" fill="none" xmlns="http://www.w3.org/2000/svg">
<g> <rect width="168" height="168" rx="5" fill="#F8F8F8"/>
<title>Layer 1</title> <path d="M53 51.1445C53 49.4877 54.3431 48.1445 56 48.1445H85H99.0608L106.394 59.2441L117 66.3776V84.6106V118.077C117 119.734 115.657 121.077 114 121.077H56C54.3431 121.077 53 119.734 53 118.077V51.1445Z" fill="#45AF72"/>
<rect y="0.18359" width="300" height="300" rx="5" fill="#F8F8F8" id="svg_1"/> <path d="M98.9473 48L107.813 57.0281L116.999 66.0522H98.9473V48Z" fill="#259956"/>
<g id="svg_11"> <path fill-rule="evenodd" clip-rule="evenodd" d="M67 81C67 78.7909 68.7909 77 71 77H86V93H67V81ZM71 79C69.8954 79 69 79.8954 69 81V91H84V79H71Z" fill="white"/>
<path d="m181.19115,206.00378l-69.9793,0c-0.87657,0 -1.46095,-0.594 -1.46095,-1.486l0,-99.3736c0,-5.79309 4.67505,-10.5464 10.37275,-10.5464l39.2994,0c0.8766,0 1.461,0.59416 1.461,1.48541c0,0.89125 -0.5844,1.48541 -1.461,1.48541l-39.2994,0c-4.0907,0 -7.45086,3.41645 -7.45086,7.57558l0,97.8886l68.51836,0c4.0907,0 7.4508,-3.416 7.4508,-7.576l0,-77.0924c0,-0.8913 0.5844,-1.4854 1.461,-1.4854c0.8765,0 1.4609,0.5941 1.4609,1.4854l0,77.0924c0,5.942 -4.675,10.547 -10.3727,10.547z" fill="#6B6B6B" id="svg_1"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M84 77H99C101.209 77 103 78.7909 103 81V93H84V77ZM86 79V91H101V81C101 79.8954 100.105 79 99 79H86Z" fill="white"/>
<path d="m167.16695,120.59108c-0.4383,0 -0.7305,-0.1485 -1.0227,-0.4456c-0.2922,-0.2971 -0.4383,-0.5942 -0.4383,-1.0398l0.2922,-23.61803c0,-0.59417 0.2922,-1.18833 0.8766,-1.33687c0.5844,-0.29708 1.1687,-0.14854 1.607,0.29708l23.083,23.46952c0.4383,0.4456 0.5844,1.0398 0.2922,1.6339c-0.2922,0.5942 -0.7305,0.8913 -1.3149,0.8913l-23.3751,0.1485c0.1461,0 0.1461,0 0,0zm1.7531,-21.53845l-0.1461,18.56765l18.2618,-0.1485l-18.1157,-18.41915z" fill="#6B6B6B" id="svg_2"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M67 91H86V107H71C68.7909 107 67 105.209 67 103V91ZM69 93V103C69 104.105 69.8954 105 71 105H84V93H69Z" fill="white"/>
<path d="m192.58655,187.43408l-85.31922,0c-1.75314,0 -3.36018,-1.4854 -3.36018,-3.4164l0,-27.3316c0,-1.7825 1.46095,-3.4164 3.36018,-3.4164l85.46532,0c1.7532,0 3.3602,1.4854 3.3602,3.4164l0,27.4801c-0.1461,1.7825 -1.607,3.2679 -3.5063,3.2679z" fill="#259956" id="svg_3"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M84 91H103V103C103 105.209 101.209 107 99 107H84V91ZM86 93V105H99C100.105 105 101 104.105 101 103V93H86Z" fill="white"/>
<path d="m124.36035,173.17558l-7.3047,0l0,4.6048l8.4734,0l0,3.2679l-12.12581,0l0,-18.5677l11.83371,0l0,3.1194l-8.3274,0l0,4.3077l7.3047,0l0,3.2679l0.1461,0z" fill="white" id="svg_4"/> </svg>
<path d="m143.93735,162.48058l-6.4282,8.9125l6.7204,9.5066l-4.529,0l-4.3828,-6.5358l-4.3828,6.5358l-4.2368,0l6.7204,-9.3581l-6.4282,-9.061l4.3828,0l4.2368,6.0902l4.2367,-6.0902l4.0907,0z" fill="white" id="svg_5"/>
<path d="m155.18655,177.18648c0.5843,-0.4456 1.1687,-1.1883 1.4609,-1.931l3.068,1.7825c-0.4383,1.1883 -1.3149,2.2281 -2.4836,3.1193c-1.1688,0.7427 -2.6297,1.1883 -4.2368,1.1883c-1.607,0 -3.0679,-0.4456 -4.3828,-1.1883c-1.3148,-0.7427 -2.3375,-1.931 -3.2141,-3.4164c-0.7305,-1.4854 -1.1687,-3.1194 -1.1687,-5.0504c0,-1.9311 0.4382,-3.565 1.1687,-5.0504c0.7305,-1.4854 1.7532,-2.5252 3.2141,-3.4165c1.3149,-0.7427 2.7758,-1.1883 4.3828,-1.1883c1.6071,0 3.068,0.4456 4.2368,1.1883c1.1687,0.7427 2.0453,1.7825 2.4836,3.1194l-3.068,1.7825c-0.4383,-0.8913 -0.8766,-1.4854 -1.4609,-1.931c-0.5844,-0.4457 -1.461,-0.7428 -2.3376,-0.7428c-0.8765,0 -1.7531,0.2971 -2.4836,0.7428c-0.7304,0.4456 -1.3148,1.1883 -1.7531,2.2281c-0.4383,1.0398 -0.5844,2.0795 -0.5844,3.2679c0,1.1883 0.1461,2.3766 0.5844,3.2679c0.4383,0.8912 1.0227,1.6339 1.7531,2.2281c0.7305,0.4456 1.6071,0.7427 2.4836,0.7427c0.8766,0 1.7532,-0.2971 2.3376,-0.7427z" fill="white" id="svg_6"/>
<path d="m173.01075,173.17558l-7.3048,0l0,4.6048l8.4735,0l0,3.2679l-12.1258,0l0,-18.5677l11.8337,0l0,3.1194l-8.1814,0l0,4.3077l7.3048,0l0,3.2679z" fill="white" id="svg_7"/>
<path d="m177.10055,162.48058l3.6523,0l0,15.1512l8.3274,0l0,3.2679l-11.8336,0l0,-18.4191l-0.1461,0z" fill="white" id="svg_8"/>
<path d="m155.77065,123.56018l-30.6799,0c-0.8766,0 -1.4609,-0.5941 -1.4609,-1.4854l0,-10.3978c0,-0.8913 0.5843,-1.4854 1.4609,-1.4854l30.6799,0c0.8765,0 1.4609,0.5941 1.4609,1.4854l0,10.3978c0,0.8913 -0.5844,1.4854 -1.4609,1.4854zm-29.219,-2.9708l27.758,0l0,-7.427l-27.758,0l0,7.427z" fill="#6B6B6B" id="svg_9"/>
<path d="m182.06765,144.35708l-56.9769,0c-0.8766,0 -1.4609,-0.5941 -1.4609,-1.4854l0,-10.3979c0,-0.8912 0.5843,-1.4854 1.4609,-1.4854l56.9769,0c0.8766,0 1.4609,0.5942 1.4609,1.4854l0,10.3979c0,0.8913 -0.5843,1.4854 -1.4609,1.4854zm-55.516,-2.9708l54.0551,0l0,-7.4271l-54.0551,0l0,7.4271z" fill="#6B6B6B" id="svg_10"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,15 +1,9 @@
<svg width="300" height="300" xmlns="http://www.w3.org/2000/svg" fill="none"> <svg width="168" height="168" viewBox="0 0 168 168" fill="none" xmlns="http://www.w3.org/2000/svg">
<g> <rect width="168" height="168" rx="5" fill="#F8F8F8"/>
<title>Layer 1</title> <path d="M53 51.1445C53 49.4877 54.3431 48.1445 56 48.1445H85H99.0608L106.394 59.2441L117 66.3776V84.6106V118.077C117 119.734 115.657 121.077 114 121.077H56C54.3431 121.077 53 119.734 53 118.077V51.1445Z" fill="#ED3535"/>
<rect y="0.18359" width="300" height="300" rx="5" fill="#F8F8F8" id="svg_1"/> <path d="M98.9473 48L107.813 57.0281L116.999 66.0522H98.9473V48Z" fill="#E31313"/>
<g id="svg_11"> <path d="M76.2658 100C77.0253 100 77.6329 100.152 78.2405 100.38C78.8481 100.608 79.2278 100.987 79.5316 101.443C79.8354 101.899 79.9873 102.431 79.9873 103.114C79.9873 103.722 79.8354 104.254 79.5316 104.785C79.2278 105.241 78.7721 105.621 78.2405 105.849C77.7088 106.077 77.0253 106.229 76.2658 106.229H74.8987V109.419H73V100H76.2658ZM76.1139 104.633C76.7215 104.633 77.1772 104.482 77.5569 104.254C77.9367 104.026 78.0886 103.646 78.0886 103.114C78.0886 102.583 77.9367 102.203 77.5569 101.975C77.1772 101.747 76.7215 101.595 76.1139 101.595H74.9747V104.633H76.1139Z" fill="#F8F8F8"/>
<path id="svg_2" fill="#6B6B6B" d="m181.8561,206.00361l-71.46989,0c-0.89523,0 -1.49206,-0.594 -1.49206,-1.485l0,-99.3742c0,-5.79314 4.77465,-10.54646 10.59365,-10.54646l40.1365,0c0.8952,0 1.4921,0.59417 1.4921,1.48541c0,0.89125 -0.5969,1.48542 -1.4921,1.48542l-40.1365,0c-4.1778,0 -7.60952,3.41644 -7.60952,7.57563l0,97.8882l69.97782,0c4.1777,0 7.6095,-3.416 7.6095,-7.575l0,-77.0931c0,-0.8912 0.5968,-1.4854 1.492,-1.4854c0.8953,0 1.4921,0.5942 1.4921,1.4854l0,77.0931c0,5.941 -4.7746,10.546 -10.5936,10.546z"/> <path d="M84.3932 100C85.3046 100 86.14 100.152 86.8995 100.532C87.659 100.912 88.2666 101.443 88.6464 102.127C89.0261 102.81 89.3299 103.646 89.3299 104.633C89.3299 105.621 89.1021 106.456 88.6464 107.14C88.1907 107.824 87.659 108.431 86.8995 108.811C86.14 109.191 85.3046 109.343 84.3932 109.343H81.2793V100H84.3932ZM84.2413 107.824C85.2287 107.824 86.0641 107.52 86.5957 106.988C87.1274 106.456 87.4312 105.697 87.4312 104.633C87.4312 103.646 87.1274 102.886 86.5957 102.355C86.0641 101.823 85.3046 101.519 84.2413 101.519H83.178V107.748H84.2413V107.824Z" fill="#F8F8F8"/>
<path id="svg_3" fill="#6B6B6B" d="m167.5327,120.59131c-0.4476,0 -0.746,-0.1486 -1.0444,-0.4457c-0.2985,-0.297 -0.4477,-0.5941 -0.4477,-1.0398l0.2984,-23.61799c0,-0.59416 0.2985,-1.18833 0.8953,-1.33687c0.5968,-0.29708 1.1936,-0.14854 1.6413,0.29708l23.5746,23.46948c0.4476,0.4456 0.5968,1.0398 0.2984,1.634c-0.2984,0.5941 -0.7461,0.8912 -1.3429,0.8912l-23.873,0.1486c0.1492,0 0.1492,0 0,0zm1.7905,-21.5385l-0.1492,18.5676l18.6508,-0.1485l-18.5016,-18.4191z"/> <path d="M90.8477 100H96.9995V101.671H92.7464V104.102H96.5438V105.697H92.7464V109.495H90.8477V100Z" fill="#F8F8F8"/>
<path id="svg_4" fill="#E51A1A" d="m193.4936,187.43431l-87.13645,0c-1.79048,0 -3.43175,-1.4854 -3.43175,-3.4165l0,-27.3315c0,-1.7825 1.49206,-3.4165 3.43175,-3.4165l87.28575,0c1.7904,0 3.4317,1.4854 3.4317,3.4165l0,27.4801c-0.1492,1.7825 -1.6413,3.2679 -3.581,3.2679z"/> <path d="M96.5479 87.8591C94.15 87.6792 91.8381 86.7914 89.9714 85.1879C86.3277 85.9896 82.8638 87.1473 79.3959 88.5709C76.6426 93.4675 74.0652 95.9588 71.843 95.9588C71.3978 95.9588 70.8667 95.8688 70.5113 95.6029C69.535 95.157 69 94.1793 69 93.2015C69 92.3998 69.1796 90.1744 77.619 86.5254C79.5755 82.9664 81.083 79.3175 82.3287 75.4886C81.2626 73.3532 78.9507 68.1007 80.5518 65.4334C81.0869 64.4556 82.153 63.9198 83.3051 64.0098C84.1955 64.0098 85.082 64.4556 85.617 65.1674C86.773 66.7709 86.6831 70.15 85.1718 75.1366C86.5933 77.8078 88.46 80.2092 90.6821 82.2546C92.5489 81.8987 94.4156 81.6328 96.2823 81.6328C100.461 81.7227 101.082 83.6782 100.992 84.8359C100.992 87.8591 98.0592 87.8591 96.5479 87.8591ZM71.6673 93.3775L71.9329 93.2876C73.1787 92.8417 74.155 91.9539 74.8657 90.7963C73.534 91.3321 72.464 92.2199 71.6673 93.3775ZM83.4847 66.6771H83.2191C83.1293 66.6771 82.9536 66.6771 82.8638 66.767C82.5084 68.2806 82.7739 69.8802 83.3988 71.3077C83.9299 69.7941 83.9299 68.1906 83.4847 66.6771ZM84.1056 79.5834L84.0158 79.7633L83.926 79.6734C83.1293 81.7188 82.2428 83.7643 81.2626 85.7237L81.4422 85.6337V85.8136C83.3988 85.1018 85.5311 84.48 87.4837 84.0341L87.3939 83.9442H87.6595C86.3277 82.6105 85.0859 81.097 84.1056 79.5834ZM96.1925 84.3001C95.3919 84.3001 94.6812 84.3001 93.8806 84.48C94.771 84.9258 95.6575 85.1018 96.5479 85.1918C97.1688 85.2817 97.7937 85.1918 98.3248 85.0119C98.3248 84.7459 97.9694 84.3001 96.1925 84.3001Z" fill="white"/>
<path id="svg_5" fill="#F8F8F8" d="m133.812,162.48081c1.492,0 2.6857,0.297 3.8793,0.7427c1.1937,0.4456 1.9397,1.1883 2.5365,2.0795c0.5969,0.8913 0.8953,1.9311 0.8953,3.2679c0,1.1884 -0.2984,2.2282 -0.8953,3.268c-0.5968,0.8912 -1.492,1.6339 -2.5365,2.0795c-1.0444,0.4456 -2.3873,0.7427 -3.8793,0.7427l-2.6857,0l0,6.2388l-3.7302,0l0,-18.4191l6.4159,0zm-0.2984,9.061c1.1936,0 2.0889,-0.2971 2.8349,-0.7427c0.746,-0.4457 1.0444,-1.1884 1.0444,-2.2282c0,-1.0397 -0.2984,-1.7824 -1.0444,-2.2281c-0.746,-0.4456 -1.6413,-0.7427 -2.8349,-0.7427l-2.2381,0l0,5.9417l2.2381,0z"/> </svg>
<path id="svg_6" fill="#F8F8F8" d="m149.7772,162.48081c1.7905,0 3.4318,0.297 4.9238,1.0397c1.4921,0.7428 2.6858,1.7825 3.4318,3.1194c0.746,1.3369 1.3429,2.9708 1.3429,4.9019c0,1.931 -0.4477,3.565 -1.3429,4.9018c-0.8952,1.3369 -1.9397,2.5252 -3.4318,3.2679c-1.492,0.7427 -3.1333,1.0398 -4.9238,1.0398l-6.1174,0l0,-18.2705l6.1174,0zm-0.2984,15.2997c1.9397,0 3.581,-0.5942 4.6254,-1.634c1.0445,-1.0397 1.6413,-2.5252 1.6413,-4.6047c0,-1.9311 -0.5968,-3.4165 -1.6413,-4.4563c-1.0444,-1.0398 -2.5365,-1.6339 -4.6254,-1.6339l-2.0889,0l0,12.1804l2.0889,0l0,0.1485z"/>
<path id="svg_7" fill="#F8F8F8" d="m162.4606,162.48081l12.0857,0l0,3.2679l-8.3556,0l0,4.7533l7.4603,0l0,3.1193l-7.4603,0l0,7.4271l-3.7301,0l0,-18.5676z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,17 +1,13 @@
<svg width="300" height="300" xmlns="http://www.w3.org/2000/svg" fill="none"> <svg width="168" height="168" viewBox="0 0 168 168" fill="none" xmlns="http://www.w3.org/2000/svg">
<g> <rect width="168" height="168" rx="5" fill="#F8F8F8"/>
<title>Layer 1</title> <path d="M53 51.1367C53 49.4799 54.3431 48.1367 56 48.1367H85H99.0608L106.394 59.2363L117 66.3698V84.6028V118.069C117 119.726 115.657 121.069 114 121.069H56C54.3431 121.069 53 119.726 53 118.069V51.1367Z" fill="#4C7CDB"/>
<rect y="0.18359" width="300" height="300" rx="5" fill="#F8F8F8" id="svg_1"/> <path d="M98.9473 48L107.813 57.0281L116.999 66.0522H98.9473V48Z" fill="#3264C7"/>
<g id="svg_11"> <path d="M81.1445 74.9102H85.0016V78.7672H81.1445V74.9102Z" fill="#4C7CDB"/>
<path id="svg_2" fill="#6B6B6B" d="m181.7133,206.00351l-71.15118,0c-0.89125,0 -1.48541,-0.594 -1.48541,-1.485l0,-99.3741c0,-5.79305 4.75329,-10.54637 10.54639,-10.54637l39.9576,0c0.8912,0 1.4854,0.59417 1.4854,1.48541c0,0.89125 -0.5942,1.48541 -1.4854,1.48541l-39.9576,0c-4.1591,0 -7.57557,3.41645 -7.57557,7.57555l0,97.8891l69.66577,0c4.1592,0 7.5756,-3.417 7.5756,-7.576l0,-77.0929c0,-0.8912 0.5942,-1.4854 1.4854,-1.4854c0.8913,0 1.4854,0.5942 1.4854,1.4854l0,77.0929c0,5.942 -4.7533,10.546 -10.5464,10.546z"/> <path d="M85.002 78.7695H88.859V82.6266H85.002V78.7695Z" fill="#4C7CDB"/>
<path id="svg_3" fill="#6B6B6B" d="m167.4527,120.59131c-0.4456,0 -0.7427,-0.1485 -1.0397,-0.4456c-0.2971,-0.2971 -0.4457,-0.5941 -0.4457,-1.0398l0.2971,-23.618c0,-0.59417 0.2971,-1.18833 0.8913,-1.33687c0.5941,-0.29708 1.1883,-0.14854 1.6339,0.29708l23.4695,23.46949c0.4456,0.4456 0.5942,1.0398 0.2971,1.634c-0.2971,0.5941 -0.7427,0.8912 -1.3369,0.8912l-23.7666,0.1485c0.1486,0 0.1486,0 0,0zm1.7825,-21.53841l-0.1485,18.56761l18.5676,-0.1485l-18.4191,-18.41911z"/> <path d="M81.1445 82.625H85.0016V86.482H81.1445V82.625Z" fill="#4C7CDB"/>
<path id="svg_4" fill="#919191" d="m193.2998,187.43441l-86.74805,0c-1.7825,0 -3.41645,-1.4855 -3.41645,-3.4165l0,-27.3315c0,-1.7825 1.48541,-3.4165 3.41645,-3.4165l86.89655,0c1.7825,0 3.4164,1.4854 3.4164,3.4165l0,27.4801c-0.1485,1.7824 -1.6339,3.2679 -3.5649,3.2679z"/> <path d="M85.002 86.4805H88.859V90.3375H85.002V86.4805Z" fill="#4C7CDB"/>
<path id="svg_5" fill="white" d="m127.3483,162.48081l14.8541,0l0,3.2679l-5.6446,0l0,15.1512l-3.7135,0l0,-15.1512l-5.6445,0l0,-3.2679l0.1485,0z"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M78.1074 96.4461C78.1074 96.0595 78.4208 95.7461 78.8074 95.7461H91.192C91.5786 95.7461 91.892 96.0595 91.892 96.4461V101.793C91.892 102.179 91.5786 102.493 91.192 102.493H78.8074C78.4208 102.493 78.1074 102.179 78.1074 101.793V96.4461ZM79.1074 96.7461V101.493H90.892V96.7461H79.1074Z" fill="#4C7CDB"/>
<path id="svg_6" fill="white" d="m160.0283,162.48081l-6.3873,8.9125l6.8329,9.5066l-4.6048,0l-4.4562,-6.5358l-4.4562,6.5358l-4.3077,0l6.8329,-9.358l-6.5358,-9.0611l4.4562,0l4.3077,6.0902l4.3077,-6.0902l4.0106,0z"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M67 73.5C67 72.6716 67.6716 72 68.5 72H84.5C85.3284 72 86 72.6716 86 73.5C86 74.3284 85.3284 75 84.5 75H68.5C67.6716 75 67 74.3284 67 73.5Z" fill="white"/>
<path id="svg_7" fill="white" d="m160.7702,162.48081l14.8541,0l0,3.2679l-5.6446,0l0,15.1512l-3.7135,0l0,-15.1512l-5.6446,0l0,-3.2679l0.1486,0z"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M67 87.5C67 86.6716 67.6716 86 68.5 86H100.5C101.328 86 102 86.6716 102 87.5C102 88.3284 101.328 89 100.5 89H68.5C67.6716 89 67 88.3284 67 87.5Z" fill="white"/>
<path id="svg_8" fill="#6B6B6B" d="m147.6978,118.36181l-23.7665,0c-0.8913,0 -1.4855,-0.5941 -1.4855,-1.4854c0,-0.8912 0.5942,-1.4854 1.4855,-1.4854l23.7665,0c0.8913,0 1.4854,0.5942 1.4854,1.4854c0,0.8913 -0.5941,1.4854 -1.4854,1.4854z"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M67 103.5C67 102.672 67.6716 102 68.5 102H100.5C101.328 102 102 102.672 102 103.5C102 104.328 101.328 105 100.5 105H68.5C67.6716 105 67 104.328 67 103.5Z" fill="white"/>
<path id="svg_9" fill="#6B6B6B" d="m172.9498,139.15871l-49.0185,0c-0.8913,0 -1.4855,-0.5942 -1.4855,-1.4854c0,-0.8913 0.5942,-1.4854 1.4855,-1.4854l49.0185,0c0.8913,0 1.4854,0.5941 1.4854,1.4854c0,0.8912 -0.5941,1.4854 -1.4854,1.4854z"/> </svg>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -17,6 +17,8 @@
#include <wx/filedlg.h> #include <wx/filedlg.h>
#include <wx/wupdlock.h> #include <wx/wupdlock.h>
#include <wx/dataview.h> #include <wx/dataview.h>
#include <wx/tokenzr.h>
#include <wx/arrstr.h>
#include <wx/tglbtn.h> #include <wx/tglbtn.h>
#include "wxExtensions.hpp" #include "wxExtensions.hpp"
@ -44,18 +46,17 @@ const std::vector<std::string> license_list = {
AuFile::AuFile(wxWindow *parent, fs::path file_path, wxString file_name, AuxiliaryFolderType type, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) AuFile::AuFile(wxWindow *parent, fs::path file_path, wxString file_name, AuxiliaryFolderType type, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
{ {
wxPanel::Create(parent, id, pos, wxSize(FromDIP(300), FromDIP(340)), style);
SetBackgroundColour(AUFILE_GREY300);
wxBoxSizer *sizer_body = new wxBoxSizer(wxVERTICAL);
SetSize(wxSize(FromDIP(300), FromDIP(340)));
SetMinSize(wxSize(FromDIP(300), FromDIP(340)));
SetMaxSize(wxSize(FromDIP(300), FromDIP(340)));
m_type = type; m_type = type;
m_file_path = file_path; m_file_path = file_path;
m_file_name = file_name; m_file_name = file_name;
wxSize panel_size = m_type == MODEL_PICTURE ? AUFILE_PICTURES_PANEL_SIZE : AUFILE_PANEL_SIZE;
wxPanel::Create(parent, id, pos, panel_size, style);
SetBackgroundColour(AUFILE_GREY300);
wxBoxSizer *sizer_body = new wxBoxSizer(wxVERTICAL);
SetSize(panel_size);
if (m_type == MODEL_PICTURE) { if (m_type == MODEL_PICTURE) {
if (m_file_path.empty()) { return; } if (m_file_path.empty()) { return; }
auto image = new wxImage(encode_path(m_file_path.string().c_str())); auto image = new wxImage(encode_path(m_file_path.string().c_str()));
@ -64,19 +65,25 @@ AuFile::AuFile(wxWindow *parent, fs::path file_path, wxString file_name, Auxilia
auto size = wxSize(0, 0); auto size = wxSize(0, 0);
float proportion = float(image->GetSize().x) / float(image->GetSize().y); float proportion = float(image->GetSize().x) / float(image->GetSize().y);
if (proportion >= 1) { if (proportion >= 1) {
size.x = FromDIP(300); size.x = AUFILE_PICTURES_SIZE.x;
size.y = FromDIP(300) / proportion; size.y = AUFILE_PICTURES_SIZE.x / proportion;
} else { } else {
size.y = FromDIP(300); size.y = AUFILE_PICTURES_SIZE.y;
size.x = FromDIP(300) * proportion; size.x = AUFILE_PICTURES_SIZE.y * proportion;
} }
image->Rescale(size.x, size.y); image->Rescale(size.x, size.y);
m_file_bitmap = wxBitmap(*image); m_file_bitmap = wxBitmap(*image);
} else { } else {
<<<<<<< HEAD (40727c FIX: Slicing process crashes when enable timelapse)
m_bitmap_excel = create_scaled_bitmap("placeholder_excel", nullptr, 300); m_bitmap_excel = create_scaled_bitmap("placeholder_excel", nullptr, 300);
m_bitmap_pdf = create_scaled_bitmap("placeholder_pdf", nullptr, 300); m_bitmap_pdf = create_scaled_bitmap("placeholder_pdf", nullptr, 300);
m_bitmap_txt = create_scaled_bitmap("placeholder_txt", nullptr, 300); m_bitmap_txt = create_scaled_bitmap("placeholder_txt", nullptr, 300);
=======
m_bitmap_excel = ScalableBitmap(this, "placeholder_excel", 168);
m_bitmap_pdf = ScalableBitmap(this, "placeholder_pdf", 168);
m_bitmap_txt = ScalableBitmap(this, "placeholder_txt", 168);
>>>>>>> CHANGE (3c1599 ENH: Auxiliary GUI)
if (m_type == OTHERS) {m_file_bitmap = m_bitmap_txt;} if (m_type == OTHERS) {m_file_bitmap = m_bitmap_txt;}
if (m_type == BILL_OF_MATERIALS) { if (m_type == BILL_OF_MATERIALS) {
@ -90,6 +97,7 @@ AuFile::AuFile(wxWindow *parent, fs::path file_path, wxString file_name, Auxilia
if (m_type == ASSEMBLY_GUIDE) {m_file_bitmap = m_bitmap_pdf;} if (m_type == ASSEMBLY_GUIDE) {m_file_bitmap = m_bitmap_pdf;}
} }
m_add_file = _L("Add File");
cover_text_left = _L("Set as cover"); cover_text_left = _L("Set as cover");
cover_text_right = _L("Rename"); cover_text_right = _L("Rename");
cover_text_cover = _L("Cover"); cover_text_cover = _L("Cover");
@ -98,15 +106,15 @@ AuFile::AuFile(wxWindow *parent, fs::path file_path, wxString file_name, Auxilia
m_file_edit_mask = ScalableBitmap(this, "auxiliary_edit_mask", 43); m_file_edit_mask = ScalableBitmap(this, "auxiliary_edit_mask", 43);
m_file_delete = ScalableBitmap(this, "auxiliary_delete", 28); m_file_delete = ScalableBitmap(this, "auxiliary_delete", 28);
auto m_text_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(300), FromDIP(40)), wxTAB_TRAVERSAL); auto m_text_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(panel_size.x, AUFILE_TEXT_HEIGHT), wxTAB_TRAVERSAL);
m_text_panel->SetBackgroundColour(AUFILE_GREY300); m_text_panel->SetBackgroundColour(AUFILE_GREY300);
wxBoxSizer *m_text_sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *m_text_sizer = new wxBoxSizer(wxVERTICAL);
m_text_name = new wxStaticText(m_text_panel, wxID_ANY, m_file_name, wxDefaultPosition, wxSize(FromDIP(300), FromDIP(20)), 0); m_text_name = new wxStaticText(m_text_panel, wxID_ANY, m_file_name, wxDefaultPosition, wxSize(panel_size.x, -1), wxST_ELLIPSIZE_END);
m_text_name->Wrap(FromDIP(290)); m_text_name->Wrap(panel_size.x - FromDIP(10));
m_text_name->SetFont(::Label::Body_14); m_text_name->SetFont(::Label::Body_14);
m_input_name = new ::TextInput(m_text_panel, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(300), FromDIP(35)), wxTE_PROCESS_ENTER); m_input_name = new ::TextInput(m_text_panel, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxSize(panel_size.x, FromDIP(35)), wxTE_PROCESS_ENTER);
m_input_name->GetTextCtrl()->SetFont(::Label::Body_13); m_input_name->GetTextCtrl()->SetFont(::Label::Body_13);
m_input_name->SetFont(::Label::Body_14); m_input_name->SetFont(::Label::Body_14);
m_input_name->Hide(); m_input_name->Hide();
@ -117,7 +125,7 @@ AuFile::AuFile(wxWindow *parent, fs::path file_path, wxString file_name, Auxilia
m_text_panel->SetSizer(m_text_sizer); m_text_panel->SetSizer(m_text_sizer);
m_text_panel->Layout(); m_text_panel->Layout();
sizer_body->Add(0, 0, 0, wxTOP, FromDIP(300)); sizer_body->Add(0, 0, 0, wxTOP, panel_size.y - AUFILE_TEXT_HEIGHT);
sizer_body->Add(m_text_panel, 0, wxALIGN_CENTER, 0); sizer_body->Add(m_text_panel, 0, wxALIGN_CENTER, 0);
SetSizer(sizer_body); SetSizer(sizer_body);
@ -149,12 +157,26 @@ void AuFile::exit_rename_mode()
void AuFile::OnPaint(wxPaintEvent &event) void AuFile::OnPaint(wxPaintEvent &event)
{ {
//wxPaintDC dc(this); wxPaintDC dc(this);
//render(dc); #ifdef __WXMSW__
wxBufferedPaintDC dc(this); wxSize size = GetSize();
PrepareDC(dc); wxMemoryDC memdc;
wxBitmap bmp(size.x, size.y);
memdc.SelectObject(bmp);
memdc.Blit({ 0, 0 }, size, &dc, { 0, 0 });
{
wxGCDC dc2(memdc);
PaintBackground(dc2);
PaintForeground(dc2);
}
memdc.SelectObject(wxNullBitmap);
dc.DrawBitmap(bmp, 0, 0);
#else
PaintBackground(dc); PaintBackground(dc);
PaintForeground(dc); PaintForeground(dc);
#endif
} }
void AuFile::PaintBackground(wxDC &dc) void AuFile::PaintBackground(wxDC &dc)
@ -169,20 +191,68 @@ void AuFile::PaintBackground(wxDC &dc)
dc.DrawRectangle(windowRect); dc.DrawRectangle(windowRect);
<<<<<<< HEAD (40727c FIX: Slicing process crashes when enable timelapse)
wxSize size = wxSize(FromDIP(300), FromDIP(300)); wxSize size = wxSize(FromDIP(300), FromDIP(300));
dc.SetPen(AUFILE_GREY200); dc.SetPen(AUFILE_GREY200);
dc.SetBrush(AUFILE_GREY200); dc.SetBrush(AUFILE_GREY200);
dc.DrawRectangle(0,0,size.x,size.y); dc.DrawRectangle(0,0,size.x,size.y);
dc.DrawBitmap(m_file_bitmap, (size.x - m_file_bitmap.GetSize().x) / 2, (size.y - m_file_bitmap.GetSize().y) / 2); dc.DrawBitmap(m_file_bitmap, (size.x - m_file_bitmap.GetSize().x) / 2, (size.y - m_file_bitmap.GetSize().y) / 2);
=======
wxSize size = m_type == MODEL_PICTURE ? AUFILE_PICTURES_SIZE : AUFILE_SIZE;
if (m_type == AddFileButton)
{
auto pen_width = FromDIP(2);
dc.SetPen(wxPen(AUFILE_GREY500, pen_width));
dc.SetBrush(AUFILE_GREY200);
dc.DrawRoundedRectangle(pen_width / 2, pen_width / 2, size.x - pen_width / 2, size.y - pen_width / 2, AUFILE_ROUNDING);
auto line_length = FromDIP(50);
dc.DrawLine(wxPoint((size.x - line_length) / 2, size.y / 2), wxPoint((size.x + line_length) / 2, size.y / 2));
dc.DrawLine(wxPoint(size.x / 2, (size.y - line_length) / 2), wxPoint(size.x / 2, (size.y + line_length) / 2));
dc.SetFont(Label::Body_16);
auto sizet = dc.GetTextExtent(m_add_file);
auto pos = wxPoint(0, 0);
pos.x = (size.x - sizet.x) / 2;
pos.y = (size.y - 40); // to modify
dc.SetTextForeground(AUFILE_GREY500);
dc.DrawText(m_add_file, pos);
}
else {
dc.SetPen(AUFILE_GREY200);
dc.SetBrush(AUFILE_GREY200);
dc.DrawRoundedRectangle(0, 0, size.x, size.y, AUFILE_ROUNDING);
dc.DrawBitmap(m_file_bitmap.bmp(), (size.x - m_file_bitmap.GetBmpWidth()) / 2, (size.y - m_file_bitmap.GetBmpHeight()) / 2);
}
>>>>>>> CHANGE (3c1599 ENH: Auxiliary GUI)
} }
void AuFile::OnEraseBackground(wxEraseEvent &evt) {} void AuFile::OnEraseBackground(wxEraseEvent &evt) {}
void AuFile::PaintForeground(wxDC &dc) void AuFile::PaintForeground(wxDC &dc)
{ {
wxSize size = wxSize(FromDIP(300), FromDIP(300)); wxSize size = m_type == MODEL_PICTURE ? AUFILE_PICTURES_SIZE : AUFILE_SIZE;
if (m_hover) { if (m_hover) {
if (m_type == AddFileButton) {
auto pen_width = FromDIP(2);
dc.SetPen(wxPen(AUFILE_BRAND, pen_width));
dc.SetBrush(AUFILE_BRAND_TRANSPARENT);
dc.DrawRoundedRectangle(pen_width / 2, pen_width / 2, size.x - pen_width / 2, size.y - pen_width / 2, AUFILE_ROUNDING);
auto line_length = FromDIP(50);
dc.DrawLine(wxPoint((size.x - line_length) / 2, size.y / 2), wxPoint((size.x + line_length) / 2, size.y / 2));
dc.DrawLine(wxPoint(size.x / 2, (size.y - line_length) / 2), wxPoint(size.x / 2, (size.y + line_length) / 2));
auto sizet = dc.GetTextExtent(m_add_file);
auto pos = wxPoint(0, 0);
pos.x = (size.x - sizet.x) / 2;
pos.y = (size.y - 40); // to modify
dc.SetTextForeground(AUFILE_BRAND);
dc.DrawText(m_add_file, pos);
return;
}
dc.DrawBitmap(m_file_edit_mask.bmp(), 0, size.y - m_file_edit_mask.GetBmpSize().y); dc.DrawBitmap(m_file_edit_mask.bmp(), 0, size.y - m_file_edit_mask.GetBmpSize().y);
dc.SetFont(Label::Body_14); dc.SetFont(Label::Body_14);
dc.SetTextForeground(*wxWHITE); dc.SetTextForeground(*wxWHITE);
@ -246,7 +316,7 @@ void AuFile::on_mouse_leave(wxMouseEvent &evt)
void AuFile::on_input_enter(wxCommandEvent &evt) void AuFile::on_input_enter(wxCommandEvent &evt)
{ {
auto new_file_name = into_u8(m_input_name->GetTextCtrl()->GetValue()); auto new_file_name = m_input_name->GetTextCtrl()->GetValue();
auto m_valid_type = Valid; auto m_valid_type = Valid;
wxString info_line; wxString info_line;
@ -271,8 +341,8 @@ void AuFile::on_input_enter(wxCommandEvent &evt)
auto new_fullname = new_file_name + m_file_path.extension().string(); auto new_fullname = new_file_name + m_file_path.extension().string();
auto new_fullname_path = dir.string() + "/" + new_fullname; wxString new_fullname_path = dir.wstring() + "/" + new_fullname;
fs::path new_dir_path(new_fullname_path.c_str()); fs::path new_dir_path(new_fullname_path);
if (fs::exists(new_dir_path)) existing = true; if (fs::exists(new_dir_path)) existing = true;
@ -314,7 +384,7 @@ void AuFile::on_input_enter(wxCommandEvent &evt)
// post event // post event
auto event = wxCommandEvent(EVT_AUXILIARY_UPDATE_RENAME); auto event = wxCommandEvent(EVT_AUXILIARY_UPDATE_RENAME);
event.SetString(wxString::Format("%s|%s|%s", s_default_folders[m_type], m_file_path.string(), new_dir_path.string())); event.SetString(wxString::Format("%s|%s|%s", s_default_folders[m_type], m_file_path.wstring(), new_dir_path.wstring()));
event.SetEventObject(m_parent); event.SetEventObject(m_parent);
wxPostEvent(m_parent, event); wxPostEvent(m_parent, event);
@ -328,12 +398,19 @@ void AuFile::on_input_enter(wxCommandEvent &evt)
void AuFile::on_dclick(wxMouseEvent &evt) void AuFile::on_dclick(wxMouseEvent &evt)
{ {
wxLaunchDefaultApplication(m_file_path.wstring(), 0); if (m_type == AddFileButton)
return;
else
wxLaunchDefaultApplication(m_file_path.wstring(), 0);
} }
void AuFile::on_mouse_left_up(wxMouseEvent &evt) void AuFile::on_mouse_left_up(wxMouseEvent &evt)
{ {
wxSize size = wxSize(FromDIP(300), FromDIP(300)); if (m_type == AddFileButton) {
return;
}
wxSize size = m_type == MODEL_PICTURE ? AUFILE_PICTURES_SIZE : AUFILE_SIZE;
auto pos = evt.GetPosition(); auto pos = evt.GetPosition();
// set cover // set cover
@ -343,21 +420,29 @@ void AuFile::on_mouse_left_up(wxMouseEvent &evt)
auto cover_right = mask_size.x / 2; auto cover_right = mask_size.x / 2;
auto cover_bottom = size.y; auto cover_bottom = size.y;
if (pos.x > cover_left && pos.x < cover_right && pos.y > cover_top && pos.y < cover_bottom) { on_set_cover(); } if (pos.x > cover_left && pos.x < cover_right && pos.y > cover_top && pos.y < cover_bottom) {
if(m_type == MODEL_PICTURE)
on_set_cover();
else
on_set_rename();
return;
}
// rename // rename
auto rename_left = mask_size.x / 2; auto rename_left = mask_size.x / 2;
auto rename_top = size.y - mask_size.y; auto rename_top = size.y - mask_size.y;
auto rename_right = mask_size.x; auto rename_right = mask_size.x;
auto rename_bottom = size.y; auto rename_bottom = size.y;
if (pos.x > rename_left && pos.x < rename_right && pos.y > rename_top && pos.y < rename_bottom) { on_set_rename(); } if (pos.x > rename_left && pos.x < rename_right && pos.y > rename_top && pos.y < rename_bottom) { on_set_rename(); return; }
// close // close
auto close_left = size.x - m_file_delete.GetBmpSize().x - FromDIP(15); auto close_left = size.x - m_file_delete.GetBmpSize().x - FromDIP(15);
auto close_top = FromDIP(15); auto close_top = FromDIP(15);
auto close_right = size.x - FromDIP(15); auto close_right = size.x - FromDIP(15);
auto close_bottom = m_file_delete.GetBmpSize().y + FromDIP(15); auto close_bottom = m_file_delete.GetBmpSize().y + FromDIP(15);
if (pos.x > close_left && pos.x < close_right && pos.y > close_top && pos.y < close_bottom) { on_set_delete(); } if (pos.x > close_left && pos.x < close_right && pos.y > close_top && pos.y < close_bottom) { on_set_delete(); return; }
exit_rename_mode();
} }
void AuFile::on_set_cover() void AuFile::on_set_cover()
@ -430,7 +515,7 @@ void AuFile::on_set_delete()
if (is_fine) { if (is_fine) {
auto evt = wxCommandEvent(EVT_AUXILIARY_UPDATE_DELETE); auto evt = wxCommandEvent(EVT_AUXILIARY_UPDATE_DELETE);
evt.SetString(wxString::Format("%s|%s", s_default_folders[m_type], m_file_path.string())); evt.SetString(wxString::Format("%s|%s", s_default_folders[m_type], m_file_path.wstring()));
evt.SetEventObject(m_parent); evt.SetEventObject(m_parent);
wxPostEvent(m_parent, evt); wxPostEvent(m_parent, evt);
} }
@ -471,9 +556,15 @@ void AuFile::msw_rescale()
image->Rescale(size.x, size.y); image->Rescale(size.x, size.y);
m_file_bitmap = wxBitmap(*image); m_file_bitmap = wxBitmap(*image);
} else { } else {
<<<<<<< HEAD (40727c FIX: Slicing process crashes when enable timelapse)
m_bitmap_excel = create_scaled_bitmap("placeholder_excel", nullptr, 300); m_bitmap_excel = create_scaled_bitmap("placeholder_excel", nullptr, 300);
m_bitmap_pdf = create_scaled_bitmap("placeholder_pdf", nullptr, 300); m_bitmap_pdf = create_scaled_bitmap("placeholder_pdf", nullptr, 300);
m_bitmap_txt = create_scaled_bitmap("placeholder_txt", nullptr, 300); m_bitmap_txt = create_scaled_bitmap("placeholder_txt", nullptr, 300);
=======
m_bitmap_excel = ScalableBitmap(this, "placeholder_excel", 168);
m_bitmap_pdf = ScalableBitmap(this, "placeholder_pdf", 168);
m_bitmap_txt = ScalableBitmap(this, "placeholder_txt", 168);
>>>>>>> CHANGE (3c1599 ENH: Auxiliary GUI)
if (m_type == OTHERS) { m_file_bitmap = m_bitmap_txt; } if (m_type == OTHERS) { m_file_bitmap = m_bitmap_txt; }
if (m_type == BILL_OF_MATERIALS) { m_file_bitmap = m_bitmap_excel; } if (m_type == BILL_OF_MATERIALS) { m_file_bitmap = m_bitmap_excel; }
@ -505,7 +596,8 @@ AuFolderPanel::AuFolderPanel(wxWindow *parent, AuxiliaryFolderType type, wxWindo
m_button_add->SetMinSize(wxSize(-1, FromDIP(24))); m_button_add->SetMinSize(wxSize(-1, FromDIP(24)));
m_button_add->SetCornerRadius(FromDIP(12)); m_button_add->SetCornerRadius(FromDIP(12));
m_button_add->SetFont(Label::Body_14); m_button_add->SetFont(Label::Body_14);
// m_button_add->Bind(wxEVT_LEFT_UP, &AuxiliaryPanel::on_add, this);
m_big_button_add = new AuFile(m_scrolledWindow, fs::path(), "", AddFileButton, -1);
/*m_button_del = new Button(m_scrolledWindow, _L("Delete"), "auxiliary_delete_file", 12, 12); /*m_button_del = new Button(m_scrolledWindow, _L("Delete"), "auxiliary_delete_file", 12, 12);
m_button_del->SetBackgroundColor(btn_bg_white); m_button_del->SetBackgroundColor(btn_bg_white);
@ -516,12 +608,18 @@ AuFolderPanel::AuFolderPanel(wxWindow *parent, AuxiliaryFolderType type, wxWindo
// m_button_del->Bind(wxEVT_LEFT_UP, &AuxiliaryPanel::on_delete, this); // m_button_del->Bind(wxEVT_LEFT_UP, &AuxiliaryPanel::on_delete, this);
sizer_top->Add(0, 0, 0, wxLEFT, FromDIP(10)); sizer_top->Add(0, 0, 0, wxLEFT, FromDIP(10));
sizer_top->Add(m_button_add, 0, wxALL, 0); m_gsizer_content = new wxWrapSizer(wxHORIZONTAL, wxWRAPSIZER_DEFAULT_FLAGS);
if (m_type == MODEL_PICTURE) {
sizer_top->Add(m_button_add, 0, wxALL, 0);
m_big_button_add->Hide();
}
else {
m_gsizer_content->Add(m_big_button_add, 0, wxALL, FromDIP(8));
m_button_add->Hide();
}
// sizer_top->Add(m_button_del, 0, wxALL, 0); // sizer_top->Add(m_button_del, 0, wxALL, 0);
m_gsizer_content = new wxGridSizer(0, 3, FromDIP(18), FromDIP(18));
sizer_body->Add(sizer_top, 0, wxEXPAND | wxTOP, FromDIP(35)); sizer_body->Add(sizer_top, 0, wxEXPAND | wxTOP, FromDIP(35));
sizer_body->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(30)); sizer_body->AddSpacer(FromDIP(14));
sizer_body->Add(m_gsizer_content, 0, 0, 0); sizer_body->Add(m_gsizer_content, 0, 0, 0);
m_scrolledWindow->SetSizer(sizer_body); m_scrolledWindow->SetSizer(sizer_body);
m_scrolledWindow->Layout(); m_scrolledWindow->Layout();
@ -530,18 +628,25 @@ AuFolderPanel::AuFolderPanel(wxWindow *parent, AuxiliaryFolderType type, wxWindo
this->SetSizer(sizer_main); this->SetSizer(sizer_main);
this->Layout(); this->Layout();
m_button_add->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AuFolderPanel::on_add), NULL, this); m_big_button_add->Bind(wxEVT_LEFT_DOWN, [this](auto& e)
// m_button_del->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AuFolderPanel::on_delete), NULL, this); {
auto evt = wxCommandEvent(EVT_AUXILIARY_IMPORT);
evt.SetString(s_default_folders[m_type]);
evt.SetEventObject(m_parent);
wxPostEvent(m_parent, evt);
});
m_button_add->Bind(wxEVT_BUTTON, &AuFolderPanel::on_add, this);
} }
void AuFolderPanel::clear() void AuFolderPanel::clear()
{ {
for (auto i = 0; i < m_aufiles_list.GetCount(); i++) { for (auto i = 0; i < m_aufiles_list.GetCount(); i++) {
AuFiles *aufile = m_aufiles_list[i]; AuFiles *aufile = m_aufiles_list[i];
if (aufile->file != NULL) { aufile->file->Destroy(); } if (aufile->file) { aufile->file->Destroy(); }
} }
m_aufiles_list.clear(); m_aufiles_list.clear();
m_gsizer_content->Layout(); Layout();
Refresh();
} }
void AuFolderPanel::update(std::vector<fs::path> paths) void AuFolderPanel::update(std::vector<fs::path> paths)
@ -552,7 +657,7 @@ void AuFolderPanel::update(std::vector<fs::path> paths)
auto name = encode_path(temp_name.c_str()); auto name = encode_path(temp_name.c_str());
auto aufile = new AuFile(m_scrolledWindow, paths[i], name, m_type, wxID_ANY); auto aufile = new AuFile(m_scrolledWindow, paths[i], name, m_type, wxID_ANY);
m_gsizer_content->Add(aufile, 0, 0, 0); m_gsizer_content->Add(aufile, 0, wxALL, FromDIP(8));
auto af = new AuFiles; auto af = new AuFiles;
af->path = paths[i].string(); af->path = paths[i].string();
af->file = aufile; af->file = aufile;
@ -571,7 +676,7 @@ void AuFolderPanel::msw_rescale()
} }
} }
void AuFolderPanel::on_add(wxCommandEvent &event) void AuFolderPanel::on_add(wxCommandEvent& event)
{ {
auto evt = wxCommandEvent(EVT_AUXILIARY_IMPORT); auto evt = wxCommandEvent(EVT_AUXILIARY_IMPORT);
evt.SetString(s_default_folders[m_type]); evt.SetString(s_default_folders[m_type]);
@ -583,8 +688,6 @@ void AuFolderPanel::on_delete(wxCommandEvent &event) { clear(); }
AuFolderPanel::~AuFolderPanel() AuFolderPanel::~AuFolderPanel()
{ {
m_button_add->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AuFolderPanel::on_add), NULL, this);
// m_button_del->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AuFolderPanel::on_delete), NULL, this);
} }
void AuFolderPanel::update_cover() void AuFolderPanel::update_cover()
@ -618,12 +721,19 @@ AuxiliaryPanel::AuxiliaryPanel(wxWindow *parent, wxWindowID id, const wxPoint &p
// delete event // delete event
Bind(EVT_AUXILIARY_UPDATE_DELETE, [this](wxCommandEvent &e) { Bind(EVT_AUXILIARY_UPDATE_DELETE, [this](wxCommandEvent &e) {
auto info_str = e.GetString(); auto info_str = e.GetString();
auto parems = std::vector<std::string>{};
Split(info_str.ToStdString(), "|", parems); wxArrayString parems;
wxStringTokenizer tokenizer(info_str, "|");
while (tokenizer.HasMoreTokens()) {
wxString token = tokenizer.GetNextToken();
parems.Add(token);
}
auto model = parems[0]; auto model = parems[0];
auto name = parems[1]; auto name = parems[1];
auto iter = m_paths_list.find(model); auto iter = m_paths_list.find(model.ToStdString());
if (iter != m_paths_list.end()) { if (iter != m_paths_list.end()) {
auto list = iter->second; auto list = iter->second;
for (auto i = 0; i < list.size(); i++) { for (auto i = 0; i < list.size(); i++) {
@ -633,7 +743,7 @@ AuxiliaryPanel::AuxiliaryPanel(wxWindow *parent, wxWindowID id, const wxPoint &p
} }
} }
m_paths_list[model] = list; m_paths_list[model.ToStdString()] = list;
update_all_panel(); update_all_panel();
update_all_cover(); update_all_cover();
} }
@ -643,14 +753,18 @@ AuxiliaryPanel::AuxiliaryPanel(wxWindow *parent, wxWindowID id, const wxPoint &p
Bind(EVT_AUXILIARY_UPDATE_RENAME, [this](wxCommandEvent &e) { Bind(EVT_AUXILIARY_UPDATE_RENAME, [this](wxCommandEvent &e) {
auto info_str = e.GetString(); auto info_str = e.GetString();
auto parems = std::vector<std::string>{}; wxArrayString parems;
Split(info_str.ToStdString(), "|", parems); wxStringTokenizer tokenizer(info_str, "|");
while (tokenizer.HasMoreTokens()) {
wxString token = tokenizer.GetNextToken();
parems.Add(token);
}
auto model = parems[0]; auto model = parems[0];
auto old_name = parems[1]; auto old_name = parems[1];
auto new_name = parems[2]; auto new_name = parems[2];
auto iter = m_paths_list.find(model); auto iter = m_paths_list.find(model.ToStdString());
if (iter != m_paths_list.end()) { if (iter != m_paths_list.end()) {
auto list = iter->second; auto list = iter->second;
for (auto i = 0; i < list.size(); i++) { for (auto i = 0; i < list.size(); i++) {
@ -660,7 +774,7 @@ AuxiliaryPanel::AuxiliaryPanel(wxWindow *parent, wxWindowID id, const wxPoint &p
} }
} }
m_paths_list[model] = list; m_paths_list[model.ToStdString()] = list;
} }
}); });
} }
@ -944,6 +1058,7 @@ void AuxiliaryPanel::update_all_panel()
{ {
std::map<std::string, std::vector<fs::path>>::iterator mit; std::map<std::string, std::vector<fs::path>>::iterator mit;
Freeze();
m_pictures_panel->clear(); m_pictures_panel->clear();
m_bill_of_materials_panel->clear(); m_bill_of_materials_panel->clear();
m_assembly_panel->clear(); m_assembly_panel->clear();
@ -955,6 +1070,7 @@ void AuxiliaryPanel::update_all_panel()
if (mit->first == "Assembly Guide") { m_assembly_panel->update(mit->second); } if (mit->first == "Assembly Guide") { m_assembly_panel->update(mit->second); }
if (mit->first == "Others") { m_others_panel->update(mit->second); } if (mit->first == "Others") { m_others_panel->update(mit->second); }
} }
Thaw();
} }
void AuxiliaryPanel::update_all_cover() void AuxiliaryPanel::update_all_cover()
@ -978,7 +1094,7 @@ void AuxiliaryPanel::update_all_cover()
wxBoxSizer *m_sizer_body = new wxBoxSizer(wxVERTICAL); wxBoxSizer *m_sizer_body = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *m_sizer_designer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *m_sizer_designer = new wxBoxSizer(wxHORIZONTAL);
auto m_text_designer = new wxStaticText(this, wxID_ANY, _L("Designer"), wxDefaultPosition, wxSize(120, -1), 0); auto m_text_designer = new wxStaticText(this, wxID_ANY, _L("Author"), wxDefaultPosition, wxSize(120, -1), 0);
m_text_designer->Wrap(-1); m_text_designer->Wrap(-1);
m_sizer_designer->Add(m_text_designer, 0, wxALIGN_CENTER, 0); m_sizer_designer->Add(m_text_designer, 0, wxALIGN_CENTER, 0);

View File

@ -48,8 +48,17 @@
#include "Widgets/SideTools.hpp" #include "Widgets/SideTools.hpp"
#define AUFILE_GREY700 wxColour(107, 107, 107) #define AUFILE_GREY700 wxColour(107, 107, 107)
#define AUFILE_GREY500 wxColour(158, 158, 158)
#define AUFILE_GREY300 wxColour(238, 238, 238) #define AUFILE_GREY300 wxColour(238, 238, 238)
#define AUFILE_GREY200 wxColour(248, 248, 248) #define AUFILE_GREY200 wxColour(248, 248, 248)
#define AUFILE_BRAND wxColour(0, 174, 66)
#define AUFILE_BRAND_TRANSPARENT wxColour(215, 232, 222)
#define AUFILE_PICTURES_SIZE wxSize(FromDIP(300), FromDIP(300))
#define AUFILE_PICTURES_PANEL_SIZE wxSize(FromDIP(300), FromDIP(340))
#define AUFILE_SIZE wxSize(FromDIP(168), FromDIP(168))
#define AUFILE_PANEL_SIZE wxSize(FromDIP(168), FromDIP(208))
#define AUFILE_TEXT_HEIGHT FromDIP(40)
#define AUFILE_ROUNDING FromDIP(5)
enum AuxiliaryFolderType { enum AuxiliaryFolderType {
MODEL_PICTURE, MODEL_PICTURE,
@ -58,6 +67,7 @@ enum AuxiliaryFolderType {
OTHERS, OTHERS,
THUMBNAILS, THUMBNAILS,
DESIGNER, DESIGNER,
AddFileButton,
}; };
const static std::array<wxString, 5> s_default_folders = {("Model Pictures"), ("Bill of Materials"), ("Assembly Guide"), ("Others"), (".thumbnails")}; const static std::array<wxString, 5> s_default_folders = {("Model Pictures"), ("Bill of Materials"), ("Assembly Guide"), ("Others"), (".thumbnails")};
@ -76,6 +86,7 @@ public:
wxStaticText* m_text_name {nullptr}; wxStaticText* m_text_name {nullptr};
::TextInput* m_input_name {nullptr}; ::TextInput* m_input_name {nullptr};
fs::path m_file_path; fs::path m_file_path;
wxString m_add_file;
wxString m_file_name; wxString m_file_name;
wxString cover_text_left; wxString cover_text_left;
wxString cover_text_right; wxString cover_text_right;
@ -144,12 +155,13 @@ public:
public: public:
AuxiliaryFolderType m_type; AuxiliaryFolderType m_type;
wxScrolledWindow * m_scrolledWindow{nullptr}; wxScrolledWindow * m_scrolledWindow{nullptr};
wxGridSizer * m_gsizer_content{nullptr}; wxWrapSizer * m_gsizer_content{nullptr};
Button * m_button_add{nullptr}; Button * m_button_add{nullptr};
Button * m_button_del{nullptr}; Button * m_button_del{nullptr};
AuFile * m_big_button_add{ nullptr };
AuFilesHash m_aufiles_list; AuFilesHash m_aufiles_list;
void on_add(wxCommandEvent &event); void on_add(wxCommandEvent& event);
void on_delete(wxCommandEvent &event); void on_delete(wxCommandEvent &event);
}; };