|
1 | 1 | <script lang="ts"> |
2 | | - import { drawerState } from '../lib/stores'; |
| 2 | + import { drawerState, drawerContent } from '../lib/stores'; |
3 | 3 | import { Drawer } from '@skeletonlabs/skeleton'; |
4 | | -</script> |
| 4 | + import MemoryAccessInfo from './MemoryAccessInfo.svelte'; |
| 5 | + import { get } from 'svelte/store'; |
5 | 6 |
|
6 | | -<Drawer> |
7 | | - <div class="mx-auto text-center text-2xl my-3"> |
8 | | - Active Inspection: {$drawerState.currentMemoryRegion.name} ({$drawerState.showSingleAccessTable |
9 | | - ? 'All' |
10 | | - : $drawerState.showReadAccess |
11 | | - ? 'Read' |
12 | | - : 'Write'}) |
13 | | - </div> |
| 7 | + const toggleCurrentlyShownType = () => { |
| 8 | + const currentlyShownType = get(drawerState); |
14 | 9 |
|
15 | | - {#if $drawerState.currentMemoryRegionIndex > -1} |
16 | | - {#each drawerState.getCurrentData() as access} |
17 | | - <div class="flex bg-cyan-800 mb-1 break-words overflow-hidden"> |
18 | | - <div class="bg-cyan-900 p-4 flex-1 break-words max-w-full"> |
19 | | - {JSON.stringify(access)} |
| 10 | + // If currently reading, and not the combined accesses change it to writing |
| 11 | + if (currentlyShownType.showReadAccess && !currentlyShownType.showSingleAccessTable) { |
| 12 | + drawerState.update((state) => { |
| 13 | + state.showReadAccess = false; |
| 14 | + return state; |
| 15 | + }); |
| 16 | + } |
| 17 | + // If we are showing write accesses, and not the combined accesses change it to combined |
| 18 | + else if (!currentlyShownType.showReadAccess && !currentlyShownType.showSingleAccessTable) { |
| 19 | + drawerState.update((state) => { |
| 20 | + state.showReadAccess = true; |
| 21 | + state.showSingleAccessTable = true; |
| 22 | + return state; |
| 23 | + }); |
| 24 | + } |
| 25 | + // If we are showing combined accesses, change it to reading |
| 26 | + else if (currentlyShownType.showReadAccess && currentlyShownType.showSingleAccessTable) { |
| 27 | + drawerState.update((state) => { |
| 28 | + state.showSingleAccessTable = false; |
| 29 | + return state; |
| 30 | + }); |
| 31 | + } |
| 32 | + }; |
| 33 | +</script> |
| 34 | + |
| 35 | +<Drawer height="h-[70%]" blur="backdrop-blur-lg"> |
| 36 | + <div class="overflow-hidden h-full flex flex-col"> |
| 37 | + <div class="mx-auto text-center text-2xl my-3 cursor-pointer" on:click={toggleCurrentlyShownType}> |
| 38 | + Address: {$drawerState.currentMemoryRegion.convertIndexToAddressString($drawerState.currentMemoryRegionIndex)} [{$drawerState.currentMemoryRegionIndex}] |
| 39 | + - {$drawerState.showSingleAccessTable ? 'All' : $drawerState.showReadAccess ? 'Read' : 'Write'} accesses in chronological |
| 40 | + order |
| 41 | + <div class="inline opacity-50 text-sm">(click to toggle shown accesses)</div> |
| 42 | + </div> |
| 43 | + <div class="flex flex-row justify-around items-center flex-wrap my-2"> |
| 44 | + <div class="section-container flex-1 max-w-xl !variant-glass-secondary mx-3"> |
| 45 | + <div class="text-center font-mono">Grid Sizing:</div> |
| 46 | + <div class="flex flex-row justify-around"> |
| 47 | + <div class="description-container mx-3"> |
| 48 | + <div class="description-prefix">X:</div> |
| 49 | + <div class="description-content"> |
| 50 | + {$drawerState.currentMemoryRegion.kernelSettings.GridDimensions.x} |
| 51 | + </div> |
| 52 | + </div> |
| 53 | + <div class="description-container mx-3"> |
| 54 | + <div class="description-prefix">Y:</div> |
| 55 | + <div class="description-content"> |
| 56 | + {$drawerState.currentMemoryRegion.kernelSettings.GridDimensions.y} |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + <div class="description-container mx-3"> |
| 60 | + <div class="description-prefix">Z:</div> |
| 61 | + <div class="description-content"> |
| 62 | + {$drawerState.currentMemoryRegion.kernelSettings.GridDimensions.z} |
| 63 | + </div> |
| 64 | + </div> |
20 | 65 | </div> |
21 | 66 | </div> |
22 | | - {/each} |
23 | | - {/if} |
| 67 | + <div class="section-container flex-1 max-w-xl !variant-glass-secondary mx-3"> |
| 68 | + <div class="text-center font-mono">Block Sizing:</div> |
| 69 | + <div class="flex flex-row justify-around"> |
| 70 | + <div class="description-container mx-3"> |
| 71 | + <div class="description-prefix">X:</div> |
| 72 | + <div class="description-content"> |
| 73 | + {$drawerState.currentMemoryRegion.kernelSettings.BlockDimensions.x} |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + <div class="description-container mx-3"> |
| 77 | + <div class="description-prefix">Y:</div> |
| 78 | + <div class="description-content"> |
| 79 | + {$drawerState.currentMemoryRegion.kernelSettings.BlockDimensions.y} |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + <div class="description-container mx-3"> |
| 83 | + <div class="description-prefix">Z:</div> |
| 84 | + <div class="description-content"> |
| 85 | + {$drawerState.currentMemoryRegion.kernelSettings.BlockDimensions.z} |
| 86 | + </div> |
| 87 | + </div> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + </div> |
| 91 | + |
| 92 | + <div class="min-w-full max-w-full bg-black/20 py-1" /> |
| 93 | + |
| 94 | + <div class="overflow-y-auto flex-1"> |
| 95 | + {#if $drawerState.currentMemoryRegionIndex > -1} |
| 96 | + {#each $drawerContent as access, index} |
| 97 | + <MemoryAccessInfo {access} {index} /> |
| 98 | + {/each} |
| 99 | + {/if} |
| 100 | + </div> |
| 101 | + </div> |
24 | 102 | </Drawer> |
0 commit comments