Skip to content

Commit

Permalink
Add Dev theme, fix table details (fx controls), rename to Default proj
Browse files Browse the repository at this point in the history
index.css
- add dev theme
- add label color
- add comment color
- th is label color
- tooltip bg and color is bg and comment color

index.htm:
- add dev theme
- cosmetic changes

index.js:
- createHTML: don't show var if parent is ndiv, if rowNr and no value  (childVar without a value)
- add pin type (WIP)

AppEffect
- use preUpdateDetails and postUpdateDetails

AppFixture
- update fxStart and fxEnd (WIP)
- rename p_DistanceFromPoint to p_Default
- rename p_DistanceFromCenter to p_DistanceFromPoint
- use sinf / cosf
- refactor indexV checks
- don't add extra physmaps (sPc/gPC just ignores pixels without a mapping)
- count nrOfPixels and nrOfMappings (WIP)

AppModFixtureGen:
- use initPin
- use NUM_DIGITAL_PINS
- use (preUpdateDetails and) postUpdateDetails WIP

AppModLeds
- Move Leds constructor to fx ChangeFun
- projection changefun: use preUpdateDetails and postUpdateDetails to create point var for DistanceFromPoint WIP

SysModModel: add preUpdateDetails and postUpdateDetails

SysModPins:
- use NUM_DIGITAL_PINS and remove NUM_PINS)
- use initPin

SysModUI: add initPin
  • Loading branch information
ewowi committed Feb 26, 2024
1 parent 5df11be commit 249f391
Show file tree
Hide file tree
Showing 45 changed files with 1,671 additions and 1,580 deletions.
2 changes: 1 addition & 1 deletion data/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @date 20240114
// @repo https://github.com/ewowi/StarMod
// @Authors https://github.com/ewowi/StarMod/commits/main
// @Copyright (c) 2024 Github StarMod Commit Authors
// @Copyright © 2024 Github StarMod Commit Authors
// @license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
// @license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected]

Expand Down
23 changes: 18 additions & 5 deletions data/index.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
@title StarMod
@file index.css
@date 20240114
@date 20240226
@repo https://github.com/ewowi/StarMod
@Authors https://github.com/ewowi/StarMod/commits/main
@Copyright (c) 2024 Github StarMod Commit Authors
@Copyright © 2024 Github StarMod Commit Authors
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected]
*/
Expand Down Expand Up @@ -34,6 +34,16 @@
--border-color: #21482b;
--select-color: #21482b; /*used for view buttons*/
}
:root.dev {
--bg-color: #121212;
--text-color: #cfd096;
--th-color: #c27e66;
--h-color:#c27e66;
--border-color: #cdad6a;
--select-color: #1a8aff; /*used for view buttons*/
--label-color: #83c5eb;
--comment-color: #598a43;
}
:root.light {
--bg-color: #fff;
--text-color: #123;
Expand Down Expand Up @@ -107,12 +117,14 @@
/* default nodes */
label {
margin-right: 6px; /*space after*/
color: var(--label-color);
}

comment {
font-size: 10px;
font-style: italic;
margin-left: 6px; /*space before*/
color: var(--comment-color);
}

text { /*currently only for buttonSaveNode and buttonCancelNode*/
Expand Down Expand Up @@ -240,7 +252,7 @@ div {
padding-bottom: 12px; */
text-align: left;
background-color: var(--th-color);
color: white;
color: var(--label-color);
}

/* drag and drop style */
Expand Down Expand Up @@ -307,8 +319,9 @@ div {
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: #555;
color: #fff;
background-color: var(--bg-color);
font-style: italic;
color: var(--comment-color);
text-align: center;
padding: 5px 0;
border-radius: 6px;
Expand Down
13 changes: 7 additions & 6 deletions data/index.htm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!--
@title StarMod
@file index.htm
@date 20240114
@date 20240226
@repo https://github.com/ewowi/StarMod
@Authors https://github.com/ewowi/StarMod/commits/main
@Copyright (c) 2024 Github StarMod Commit Authors
@Copyright © 2024 Github StarMod Commit Authors
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected]
*/
Expand All @@ -13,8 +13,8 @@
<!DOCTYPE html>
<html>
<head>
<title>StarMod by MoonModules</title>
<meta charset="utf-8">
<title>StarMod💫 LEDs 🎨 by MoonModules 🌔</title>
<link rel="stylesheet" href="index.css">
<script src="app.js"></script>
<script src="index.js"></script>
Expand All @@ -34,7 +34,7 @@
</head>
<body onload="onLoad()">
<div class="module">
<h1>StarMod by MoonModules 💫</h1>
<h1>StarMod💫 LEDs 🎨 by MoonModules 🌔</h1>
<h2><div id="instanceName"></div></h2>
<input type="button" value="App" id="vApp" onclick="setView(this)">
<input type="button" value="Stage" id="vStage" onclick="setView(this)">
Expand All @@ -44,10 +44,11 @@ <h2><div id="instanceName"></div></h2>
<span> | </span>
<input type="button" value="Save" id="bSave" onclick="saveModel(this)">
<span> | </span>
Theme <select name="theme-select" id="theme-select" onchange="setTheme(this)">
<label>Theme</label> <select name="theme-select" id="theme-select" onchange="setTheme(this)">
<option value="starmod">StarMod</option>
<option value="wled">WLED</option>
<option value="grayeen">Grayeen</option>
<option value="dev">Dev</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
<option value="blue">Blue</option>
Expand All @@ -69,7 +70,7 @@ <h2><div id="instanceName"></div></h2>
</div>
<div id="connind">&#9790;</div>
<div id="modalView" class="modal"></div>
<p style="color:grey;"> (c) 2024 MoonModules Licensed under GPL-v3</p>
<p style="color:grey;"> © 2024 MoonModules ☾ - Licensed under GPL-v3</p>
<div id="canvasMenu" style="position:absolute;display:none"> <!--;background-color:#b60f62-->
<p><button id="canvasButton1"></button></p>
<p><button id="canvasButton2"></button></p>
Expand Down
50 changes: 33 additions & 17 deletions data/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @title StarMod
// @file index.css
// @date 20240114
// @date 20240226
// @repo https://github.com/ewowi/StarMod
// @Authors https://github.com/ewowi/StarMod/commits/main
// @Copyright (c) 2024 Github StarMod Commit Authors
// @Copyright © 2024 Github StarMod Commit Authors
// @license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
// @license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected]

Expand Down Expand Up @@ -155,10 +155,14 @@ function createHTML(json, parentNode = null, rowNr = UINT8_MAX) {
let variable = json;

if (Array.isArray(variable.value) && rowNr != UINT8_MAX) {
if ((rowNr < variable.value.length && variable.value[rowNr] == null)) { //rowNr >= variable.value.length ||
if ((rowNr < variable.value.length && variable.value[rowNr] == null)) { //rowNr >= variable.value.length || needed if row is created but value not yet
// console.log("not showing this var as value is null", variable, rowNr);
return;
}
if (parentNode.className == "ndiv" && rowNr >= variable.value.length) {
console.log("createHTML ndiv parent no create", parentNode, variable, rowNr, variable.value.length);
return;
}
}

//if root (type module) add the html to one of the mdlColumns
Expand Down Expand Up @@ -250,8 +254,8 @@ function createHTML(json, parentNode = null, rowNr = UINT8_MAX) {
}

//variable.n will add the columns
}
else if (parentNodeType == "table") {
} else if (parentNodeType == "table") {

// console.log("tableChild", parentNode, variable);

varNode = cE("th");
Expand All @@ -266,8 +270,19 @@ function createHTML(json, parentNode = null, rowNr = UINT8_MAX) {
varNode = cE("select");
varNode.addEventListener('change', (event) => {console.log("select change", event);sendValue(event.target);});
}
}
else if (variable.type == "canvas") {

} else if (variable.type == "pin") {

if (variable.ro) { //e.g. for reset/restart reason: do not show a select but only show the selected option
varNode = cE("span");
}
else {
varNode = cE("select");
varNode.addEventListener('change', (event) => {console.log("select change", event);sendValue(event.target);});
}

} else if (variable.type == "canvas") {

//3 lines of code to only add 🔍
let spanNode = cE("span");
spanNode.innerText= "🔍";
Expand All @@ -276,8 +291,8 @@ function createHTML(json, parentNode = null, rowNr = UINT8_MAX) {

varNode = cE("canvas");
varNode.addEventListener('dblclick', (event) => {toggleModal(event.target);});
}
else if (variable.type == "textarea") {

} else if (variable.type == "textarea") {

//3 lines of code to only add 🔍
let spanNode = cE("span");
Expand Down Expand Up @@ -505,8 +520,7 @@ function receiveData(json) {
}
else if (key == "canvasData") {
console.log("receiveData no action", key, value);
}
else if (key == "details") {
} else if (key == "details") {
let variable = value.var;
let rowNr = value.rowNr == null?UINT8_MAX:value.rowNr;
let nodeId = variable.id + ((rowNr != UINT8_MAX)?"#" + rowNr:"");
Expand Down Expand Up @@ -543,8 +557,9 @@ function receiveData(json) {
let newRowNr = tbodyNode.querySelectorAll("tr").length;

genTableRowHTML(tableVar, tableNode, newRowNr);
}
else if (key == "delRow") { //update the row of a table

} else if (key == "delRow") { //update the row of a table

console.log("receiveData", key, value);
let tableId = value.id;
let tableVar = findVar(tableId);
Expand All @@ -556,8 +571,8 @@ function receiveData(json) {

console.log("delRow ", tableVar, tableNode, rowNr);

}
else if (key == "updRow") { //update the row of a table
} else if (key == "updRow") { //update the row of a table

let tableId = value.id;
let tableVar = findVar(tableId);
let rowNr = value.rowNr;
Expand All @@ -573,8 +588,9 @@ function receiveData(json) {
changeHTML(colVar, {"value":colValue, "chk":"updRow"}, rowNr);
colNr++;
}
}
else { //{variable:{label:value:options:comment:}}

} else { //{variable:{label:value:options:comment:}}

let variable = findVar(key);

if (variable) {
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; @date 20240114
; @repo https://github.com/ewowi/StarMod
; @Authors https://github.com/ewowi/StarMod/commits/main
; @Copyright (c) 2024 Github StarMod Commit Authors
; @Copyright © 2024 Github StarMod Commit Authors
; @license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
; @license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected]

Expand Down
48 changes: 4 additions & 44 deletions src/App/AppEffects.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
@title StarMod
@file AppEffects.h
@date 20240114
@date 20240226
@repo https://github.com/ewowi/StarMod
@Authors https://github.com/ewowi/StarMod/commits/main
@Copyright (c) 2024 Github StarMod Commit Authors
@Copyright © 2024 Github StarMod Commit Authors
@license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected]
*/
Expand Down Expand Up @@ -36,7 +36,6 @@ class Effect {
JsonObject currentVar = ui->initSelect(parentVar, "pal", value, false, [](JsonObject var, uint8_t rowNr, uint8_t funType) { switch (funType) { //varFun
case f_UIFun: {
ui->setLabel(var, "Palette");
ui->setComment(var, "Colors");
JsonArray options = ui->setOptions(var);
options.add("CloudColors");
options.add("LavaColors");
Expand Down Expand Up @@ -1126,11 +1125,7 @@ class Effects {

leds.sharedData.clear(); //make sure all values are 0

for (JsonObject var: var["n"].as<JsonArray>()) { //for all controls
if (mdl->varOrder(var) >= 0) { //post init
mdl->varOrder(var, -mdl->varOrder(var)); // set all negative
}
}
mdl->preUpdateDetails(var);

Effect* effect = effects[leds.fx];

Expand All @@ -1140,42 +1135,7 @@ class Effects {

effect->setup(leds); //if changed then run setup once (like call==0 in WLED)

//check if post init added
bool postInit = false;
for (JsonObject childVar: mdl->varN(var)) {

if (mdl->varOrder(childVar) >= 0) { //post init, just added,
postInit = true;
break;
}
}
if (postInit) {
for (JsonObject childVar: mdl->varN(var)) {
if (childVar["value"].is<JsonArray>())
{
JsonArray valArray = childVar["value"];

if (mdl->varOrder(childVar) < 0) { //if not updated
valArray[rowNr] = (char*)0; //null
// mdl->setValue(var, -99, rowNr); //set value -99
mdl->varOrder(childVar, -mdl->varOrder(childVar)); //make positive again
//if some values in array are not -99
}

//if all values null, remove value
bool allNull = true;
for (JsonVariant element: valArray) {
if (!element.isNull())
allNull = false;
}
if (allNull) {
print->printJson("remove allnulls", childVar);
mdl->varN(var).remove(childVar);
}
}

}
}
mdl->postUpdateDetails(var, rowNr);

print->printJson("control", var);
// if (mdl->varOrder(var) >= 0) { //post init
Expand Down
Loading

0 comments on commit 249f391

Please sign in to comment.