diff --git a/svelte_blinkenweb/src/components/Controls.svelte b/svelte_blinkenweb/src/components/Controls.svelte index 8020985..39b9578 100644 --- a/svelte_blinkenweb/src/components/Controls.svelte +++ b/svelte_blinkenweb/src/components/Controls.svelte @@ -15,9 +15,66 @@ //render conditionals let showControls = false; - $: showControls = !mobile || !showEditor; + let canstart = false; + let canstep = false; + let cancompile = false; + $: showControls = ( + !mobile || !showEditor + ) + $: canstart = ( + $blinkStore.state == blink.states.PROGRAM_LOADED || + $blinkStore.state == blink.states.PROGRAM_STOPPED + ) + $: canstep = ( + $blinkStore.state == blink.states.PROGRAM_RUNNING + ) + $: cancompile = ( + $blinkStore.state != blink.states.NOT_READY && + $blinkStore.state != blink.states.ASSEMBLING && + $blinkStore.state != blink.states.LINKING + ) + + //temporary control state logic + let compiler_options = [ + { id: 1, text: `Fasm`, uri: 'fasm' }, + { id: 2, text: `Gnu AS`, uri: 'gnu' }, + ]; + let demo_options = [ + { id: 1, text: `Hello World`, uri: 'hello_world' }, + { id: 2, text: `Functions`, uri:'functions' } + ] + + let selected_compiler; + let selected_demo; + + onMount(() => { + const params = new URLSearchParams(window.location.search); + let compiler_opt = compiler_options.find(c => c.uri == params.get('compiler')); + if(compiler_opt) selected_compiler = compiler_opt; + let demo_opt = demo_options.find(c => c.uri == params.get('demo')); + if(demo_opt) selected_demo = demo_opt; + }); + + function handle_compiler_change(){ + window.location.search = `?compiler=${selected_compiler.uri}&demo=${selected_demo.uri}`; + } + + function handle_demo_change(e){ + window.location.search = `?compiler=${selected_compiler.uri}&demo=${selected_demo.uri}`; + } + + + //control handlers - $: console.log(mobile) + async function handle_compile(){ + // let filedata = await fetchBinaryFile(demo1_url) + // blink.loadElf(filedata); + blink.loadASM($blinkStore.asm); + } + + function handle_back(){ + blink.setready() + } @@ -34,24 +91,21 @@
exit reason
{/if} @@ -133,7 +197,7 @@ .controls__row{ display: flex; align-items: center; - justify-content: space-between; + justify-content: left; padding: .5rem; padding-left: 1rem; padding-right: 1rem; @@ -147,6 +211,9 @@ + /* -------------------- */ + /* Buttons&c */ + /* -------------------- */ button, select{ border: 1px solid var(--color-gray-t); color: white; @@ -164,12 +231,14 @@ button svg{ stroke: white; + fill: white; height: 18px; width: 18px; margin-right: 3px; } button:disabled svg{ fill: gray; + stroke: gray; } .group{ @@ -212,6 +281,7 @@ .compilebt button svg{ width: 25px; height: 25px; + stroke: white; } .compilebt select{ border: 1px solid transparent; @@ -220,11 +290,6 @@ border-bottom-right-radius: 0; } - section.editor select{ - background-color:rgba(255,255,255,.1); - } - - .stopinfo{ /*TODO: remove hardcoded colors, find proper design */