From 1e07d07feed42d1857def0172b52da25a0628a8b Mon Sep 17 00:00:00 2001 From: Graham Trott Date: Mon, 22 Jun 2020 17:21:01 +0100 Subject: [PATCH] Reorganise file structure --- iwsy/demo.html => demo.html | 0 iwsy/resources/ecs/help.txt | 35 +++++++++++++++++- iwsy/resources/ecs/iwsy.txt | 37 +++++++++++++------ iwsy/resources/ecs/steps.txt | 7 +++- .../{json/quickstart => scripts}/demo.json | 2 +- .../{json/quickstart => scripts}/liguria.json | 0 6 files changed, 64 insertions(+), 17 deletions(-) rename iwsy/demo.html => demo.html (100%) rename iwsy/resources/{json/quickstart => scripts}/demo.json (98%) rename iwsy/resources/{json/quickstart => scripts}/liguria.json (100%) diff --git a/iwsy/demo.html b/demo.html similarity index 100% rename from iwsy/demo.html rename to demo.html diff --git a/iwsy/resources/ecs/help.txt b/iwsy/resources/ecs/help.txt index f90e0e0..4033b21 100644 --- a/iwsy/resources/ecs/help.txt +++ b/iwsy/resources/ecs/help.txt @@ -4,6 +4,7 @@ import div Container + div Player callback DecoratorCallback a Link variable Mobile @@ -12,6 +13,8 @@ variable Payload variable ImageCount variable LinkCount + variable HasEmbed + variable Embed variable Function variable Data variable Source @@ -32,7 +35,14 @@ load showdown on DecoratorCallback go to Decorate - on message go to Show + on message + begin + if the message is `stop` + begin + if HasEmbed iwsy stop + end + else go to Show + end set ready stop @@ -40,6 +50,7 @@ Show: set style `display` of Container to `block` get Page from storage as `.help` GetPage: + clear HasEmbed if Page is empty begin put `iwsy` into Page @@ -66,9 +77,22 @@ GetPage: end on click Link begin + if HasEmbed iwsy stop put attribute `data-page` of Link into Page go to GetPage end + if HasEmbed + begin + attach Player to `iwsy-embed` + put attribute `data-url` of Player into Data + rest get Embed from Data + put the position of the last `/` in Data into N + add 1 to N + put left N of Data into Data + iwsy load Player Embed + iwsy path Data + iwsy run + end stop !------------------------------------------------------------------------------ @@ -92,6 +116,7 @@ Decorate: put `` cat Data cat `` into Payload else if Function is `img` gosub to ProcessImage else if Function is `page` gosub to ProcessPage + else if Function is `embed` gosub to ProcessEmbed end end set the payload of DecoratorCallback to Payload @@ -140,7 +165,7 @@ ProcessImage: add 1 to ImageCount return -! Process a request for a new page. +! Process a request for a new page ProcessPage: put the position of `:` in Data into N if N is -1 return @@ -152,6 +177,12 @@ ProcessPage: add 1 to LinkCount return +! Process a request for an embedded presentation +ProcessEmbed: + put `
` into Payload + set HasEmbed + return + Exit: set style `display` of Container to `none` stop \ No newline at end of file diff --git a/iwsy/resources/ecs/iwsy.txt b/iwsy/resources/ecs/iwsy.txt index 7a49286..1405691 100644 --- a/iwsy/resources/ecs/iwsy.txt +++ b/iwsy/resources/ecs/iwsy.txt @@ -52,7 +52,6 @@ variable Presentation variable OriginalPresentation variable Name - variable ShowRun variable ReadOnly variable CallStack variable Message @@ -121,8 +120,8 @@ Start: ! The left-hand panel create Left in Body - set the style of Left to - `flex:1;height:100%;border-right:1px solid black;margin-right:0.5em;display:flex;flex-direction:column` + set the style of Left to `flex:1;height:100%;border-right:1px solid black;margin-right:0.5em;` + cat `display:flex;flex-direction:column;max-width:50%` create Masthead in Left set the style of Masthead to @@ -194,7 +193,7 @@ Start: set attribute `title` of FileMan to `File Manager` create Link in Buttons create RunStop in Link - set the style of RunStop to `width:40px;margin-right:1.5em` + set the style of RunStop to `width:40px;margin-right:0.5em` set attribute `src` of RunStop to `resources/icon/run.png` set attribute `title` of RunStop to `Run` create Link in Buttons @@ -221,7 +220,7 @@ Start: set the style of FileManPanel to `flex:1;display:none;margin-top:0.5em;border-top:1px solid black` create HelpPanel in Left - set the style of HelpPanel to `flex:1;display:none;margin-top:0.5em;border-top:1px solid black` + set the style of HelpPanel to `flex:1;display:none;margin-top:0.5em;border-top:1px solid black;overflow:scroll` ! The right-hand panel create Right in Body @@ -313,6 +312,9 @@ Start: end clear FileIsOpen clear Player + clear Running + iwsy stop + set attribute `src` of RunStop to `resources/icon/run.png` set the content of NameEditor to empty put empty into CurrentScriptName gosub to CreateNewPresentation @@ -400,7 +402,7 @@ Start: end end - on click RunStop + on click FileMan begin if Running stop if UserRecord is empty stop @@ -411,6 +413,7 @@ Start: end set style `display` of Player to `none` set style `display` of HelpPanel to `none` + if HelpModule is running send `stop` to HelpModule set style `display` of FileManPanel to `block` send to FileManModule end @@ -473,6 +476,7 @@ Start: begin set style `display` of FileManPanel to `none` set style `display` of HelpPanel to `none` + if HelpModule is running send `stop` to HelpModule set style `display` of Player to `block` put property `block` of Message into N iwsy block N @@ -553,7 +557,8 @@ FullScreenManual: ShowHelp: if Running stop - if HelpModule is not running + if HelpModule is running send `stop` to HelpModule + else begin require js `https://cdn.jsdelivr.net/gh/easycoder/easycoder.github.io/dist/plugins/showdown.js?v=` cat now @@ -768,9 +773,11 @@ SelectFile: gosub to SetStatusGreen set the text of Status to `Presentation '` cat File cat `' loaded` fork to ResetStatus - set ShowRun + clear Running + set attribute `src` of RunStop to `resources/icon/run.png` set style `display` of FileManPanel to `none` set style `display` of HelpPanel to `none` + if HelpModule is running send `stop` to HelpModule set style `display` of Player to `block` iwsy script Presentation @@ -806,11 +813,13 @@ DoRunStop: begin put property `steps` of Presentation into Item if the json count of Item is 1 stop - set Running + if HelpModule is running send `stop` to HelpModule set style `display` of Player to `block` set style `display` of FileManPanel to `none` + set style `display` of HelpPanel to `none` gosub to ClearStepsButtons set attribute `src` of RunStop to `resources/icon/runstop.png` + set Running put 0 into N gosub to SelectSection @@ -820,7 +829,6 @@ DoRunStop: put the iwsy step into N if N is -1 begin -! set the content of NameEditor to empty put the iwsy script into Presentation go to PrepareScript end @@ -834,8 +842,8 @@ DoRunStop: end put Presentation into OriginalPresentation -! put NameEditor into OriginalName set style `display` of HelpPanel to `none` + if HelpModule is running send `stop` to HelpModule set Message to object set property `action` of Message to `running` send Message to StepsModule @@ -844,7 +852,6 @@ DoRunStop: gosub to ClearStepsButtons set attribute `src` of RunStop to `resources/icon/run.png` clear Running -! set the text of NameEditor to OriginalName put OriginalPresentation into Presentation go to PrepareScript end @@ -862,6 +869,12 @@ PrepareScript: RunFullScreen: put property `steps` of Presentation into Item if the json count of Item is 1 stop + if HelpModule is running send `stop` to HelpModule + set style `display` of Player to `block` + set style `display` of FileManPanel to `none` + set style `display` of HelpPanel to `none` + iwsy init + iwsy script Presentation if Running iwsy stop else iwsy run fullscreen toggle Running diff --git a/iwsy/resources/ecs/steps.txt b/iwsy/resources/ecs/steps.txt index 5fdeb3d..0becaec 100644 --- a/iwsy/resources/ecs/steps.txt +++ b/iwsy/resources/ecs/steps.txt @@ -776,10 +776,12 @@ EditBlockList: gosub to SaveCurrentStep json add empty to Blocks set property `blocks` of CurrentStep to Blocks + set element SelectedStep of Steps to CurrentStep clear Table go to ReloadStepEditor end put property `blocks` of CurrentStep into Blocks + if Blocks is empty set Blocks to array put the json count of Blocks into N set the elements of BlockSelect to N set the elements of DeleteContent to N @@ -814,6 +816,7 @@ EditBlockList: put the index of DeleteContent into N json delete element N of Blocks set property `blocks` of CurrentStep to Blocks + set element SelectedStep of Steps to CurrentStep clear Table go to ReloadStepEditor end @@ -912,7 +915,7 @@ CreateNewAction: put property `blocks` of CurrentStep into Blocks if Blocks is empty begin - set Blocks to object + set Blocks to array set property `blocks` of CurrentStep to Blocks end end @@ -1026,7 +1029,7 @@ SaveCurrentStep: put property `blocks` of CurrentStep into Blocks if Blocks is empty begin - set Blocks to object + set Blocks to array set property `blocks` of CurrentStep to Blocks end end diff --git a/iwsy/resources/json/quickstart/demo.json b/iwsy/resources/scripts/demo.json similarity index 98% rename from iwsy/resources/json/quickstart/demo.json rename to iwsy/resources/scripts/demo.json index 21d0611..fa1af8d 100644 --- a/iwsy/resources/json/quickstart/demo.json +++ b/iwsy/resources/scripts/demo.json @@ -170,7 +170,7 @@ "top": 0, "width": 1000, "height": 1000, - "background": "url('resources/img/SemoigoDawn.jpg')", + "background": "url('resources/img/quickstart/SemoigoDawn.jpg')", "border": "", "borderRadius": "", "fontFamily": "", diff --git a/iwsy/resources/json/quickstart/liguria.json b/iwsy/resources/scripts/liguria.json similarity index 100% rename from iwsy/resources/json/quickstart/liguria.json rename to iwsy/resources/scripts/liguria.json