Skip to content

Commit b94ca5f

Browse files
committed
fix asPad fields not updating
1 parent d7789f4 commit b94ca5f

File tree

1 file changed

+72
-5
lines changed

1 file changed

+72
-5
lines changed

src/items.cpp

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,11 @@ bool menuNode::changed(const navNode &nav,const menuOut& out,bool sub,bool test)
204204
}
205205
// idx_t tit=hasTitle(nav.root->path[lev])?1:0;//TODO: this might not be correct.. checking
206206
idx_t my=out.maxY()-((has(showTitle)||(nav.root->showTitle&&!has(noTitle)))?1:0);
207-
trace(Serial<<"level:"<<level<<" target:"<<*nav.root->navFocus<<" "<<nav.root->navFocus->has(_parentDraw)<<" "<<nav.root->navFocus->has(_asPad)<<endl);
208-
idx_t lev=level-(nav.root->navFocus->has(_parentDraw)&&nav.root->navFocus->isMenu());
207+
// trace(Serial<<"level:"<<level<<" target:"<<*nav.root->navFocus<<" "<<nav.root->navFocus->has(_parentDraw)<<" "<<nav.root->navFocus->has(_asPad)<<endl);
208+
// idx_t lev=level-(nav.root->navFocus->has(_parentDraw)&&nav.root->navFocus->isMenu());
209+
idx_t t=out.tops[level-nav.root->navFocus->has(_parentDraw)&&has(_asPad)];
209210
// trace(Serial<<"tit:"<<tit<<endl;);
210-
idx_t t=out.tops[lev];
211+
// idx_t t=out.tops[lev];
211212
trace(Serial<<"t:"<<t<<endl;);
212213
if (sub) for(int i=0;i<my;i++,t++) {
213214
if (t>=sz()) break;
@@ -233,8 +234,9 @@ void menuNode::clearChanged(const navNode &nav,const menuOut& out,bool sub) {
233234
if (parentDraw())
234235
return nav.root->path[level-1].target->clearChanged(nav.root->path[level-1],out,sub);
235236
idx_t my=out.maxY()-((has(showTitle)||(nav.root->showTitle&&!has(noTitle)))?1:0);
236-
idx_t lev=level-(nav.root->navFocus->has(_parentDraw)&&nav.root->navFocus->isMenu());
237-
idx_t t=out.tops[lev];
237+
// idx_t lev=level-(nav.root->navFocus->has(_parentDraw)&&nav.root->navFocus->isMenu());
238+
// idx_t t=out.tops[lev];
239+
idx_t t=out.tops[level-nav.root->navFocus->has(_parentDraw)&&has(_asPad)];
238240
for(idx_t i=0;i<my;i++,t++) {//only signal visible
239241
if (t>=sz()) break;//menu ended
240242
operator[](t).clearChanged(nav,out,false);
@@ -466,3 +468,68 @@ void menuVariantBase::doNav(navNode& nav,navCmd cmd) {
466468
nav.root->exit();
467469
}
468470
}
471+
472+
// template<bool clear>
473+
// bool menuNode::_changes(const navNode &nav,const menuOut& out,bool sub,bool test) {
474+
// trace(Serial<<*this<<" menuNode::"<<(clear?"clearChanged":"changed")<<" test:"<<test<<endl);
475+
// if (clear) dirty=false;
476+
// else if (dirty) {
477+
// trace(if (test) Serial<<"just dirty!"<<endl);
478+
// return true;
479+
// }
480+
// if (has((systemStyles)(_asPad|_parentDraw))) {
481+
// for(int i=0;i<sz();i++)
482+
// if (clear) operator[](i).clearChanged(nav,out,false);
483+
// else if (operator[](i).changed(nav,out,false,test)) {
484+
// trace(if (test) Serial<<"APPD! "<<operator[](i)<<endl);
485+
// return true;
486+
// }
487+
// } else {
488+
// // if (!(nav.target==this&&sub)) return;???
489+
// if (!(clear||(nav.target==this&&sub))) {
490+
// trace(if (test&&dirty) Serial<<"indirect!"<<endl);
491+
// return dirty;// second hand check, just report self
492+
// }
493+
// idx_t level=nav.root->level;
494+
// if (parentDraw()) {
495+
// if (clear) nav.root->path[level-1].target->clearChanged(nav.root->path[level-1],out,sub);
496+
// else {
497+
// trace(Serial<<"return changed of parent-draw element"<<endl);
498+
// trace(if (test) Serial<<"parentDraw()!"<<endl);
499+
// return nav.root->path[level-1].target->changed(nav.root->path[level-1],out,sub,test);
500+
// }
501+
// }
502+
// // idx_t tit=hasTitle(nav.root->path[lev])?1:0;//TODO: this might not be correct.. checking
503+
// idx_t my=out.maxY()-((has(showTitle)||(nav.root->showTitle&&!has(noTitle)))?1:0);
504+
// // trace(Serial<<"level:"<<level<<" target:"<<*nav.root->navFocus<<" "<<nav.root->navFocus->has(_parentDraw)<<" "<<nav.root->navFocus->has(_asPad)<<endl);
505+
// // idx_t lev=level-(nav.root->navFocus->has(_parentDraw)&&(nav.root->navFocus->isMenu()||nav.root->navFocus->has(_asPad)));
506+
// // idx_t t=out.tops[lev];
507+
// idx_t t=out.tops[level-nav.root->navFocus->has(_parentDraw)&&has(_asPad)];
508+
// trace(Serial<<"t:"<<t<<endl;);
509+
// if (sub) for(int i=0;i<my;i++,t++) {
510+
// if (t>=sz()) break;
511+
// if (clear) operator[](t).clearChanged(nav,out,false);
512+
// {
513+
// trace(Serial<<"checking:"<<operator[](t)<<endl);
514+
// if (operator[](t).changed(nav,out,false,test)) {
515+
// trace(if (test) Serial<<"sub changed!"<<endl);
516+
// return true;
517+
// }
518+
// }
519+
// }
520+
// }
521+
// if (clear) {
522+
// #ifdef MENU_DEBUG
523+
// if(changed(nav,out,sub,true)) {
524+
// Serial<<"\nERROR clear changed fail!"<<endl;
525+
// Serial<<*this<<endl;
526+
// Serial<<"level:"<<nav.root->level<<endl;
527+
// // Serial<<"type:"<<type()<<endl;
528+
// Serial.flush();
529+
// // while(1);
530+
// return false;
531+
// }
532+
// #endif
533+
// return true;
534+
// } else return false;
535+
// }

0 commit comments

Comments
 (0)