Skip to content

Commit d62836e

Browse files
committed
changed cases
1 parent 6c60310 commit d62836e

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/items.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ idx_t menuVariantBase::togglePrintTo(navRoot &root,bool sel,menuOut& out, idx_t
462462
l+=operator[](at).printRaw(out,len-l);
463463
#ifdef MENU_FMT_WRAPS
464464
out.fmtEnd(*this,menuOut::fmtToggle,root.node(),idx);
465-
#endif
465+
#endif-
466466
}
467467
return l;
468468
}
@@ -479,7 +479,6 @@ void menuVariantBase::doNav(navNode& nav,navCmd cmd) {
479479

480480
template<bool clear>
481481
bool menuNode::_changes(const navNode &nav,const menuOut& out,bool sub,bool test) {
482-
trace(MENU_DEBUG_OUT<<*this<<" menuNode::"<<(clear?"clearChanged":"changed")<<" test:"<<test<<endl);
483482
if (clear) dirty=false;
484483
else if (dirty) {
485484
_trace(if (test) MENU_DEBUG_OUT<<"just dirty!"<<endl);
@@ -515,15 +514,32 @@ bool menuNode::_changes(const navNode &nav,const menuOut& out,bool sub,bool test
515514
// idx_t lev=level-(nav.root->navFocus->has(_parentDraw)&&(nav.root->navFocus->isMenu()||nav.root->navFocus->has(_asPad)));
516515
// idx_t t=out.tops[lev];
517516
// idx_t t=out.tops[level];//-nav.root->navFocus->has(_parentDraw)&&has(_asPad)];
518-
idx_t t=out.tops[level-((nav.root->navFocus->has(_parentDraw)&&has(_menuData))||nav.root->navFocus->has(_asPad))];
517+
// idx_t t=out.tops[level-((nav.root->navFocus->has(_parentDraw)&&nav.root->navFocus->has(_menuData))||nav.root->navFocus->has(_asPad))];
518+
// idx_t t=out.tops[level-(nav.root->path[level].target->has(_asPad))];
519+
menuNode* target=nav.root->path[level].target;
520+
idx_t t=out.tops[level-(target->has(_asPad)||target->has(_parentDraw))];
519521
trace(MENU_DEBUG_OUT<<"t:"<<t<<endl;);
520522
if (sub) for(int i=0;i<my;i++,t++) {
521523
if (t>=sz()) break;
524+
_trace(if (debugFlag) {
525+
MENU_DEBUG_OUT<<*this
526+
<<" level:"<<nav.root->level
527+
<<" focus:"<<*nav.root->navFocus
528+
<<" root target:"<<*nav.root->path[nav.root->level].target
529+
<<" nav target:"<<*nav.target
530+
<<" top:"<<out.tops[nav.root->level]
531+
<<" asPad:"<<has(_asPad)
532+
<<" parentdraw:"<<has(_parentDraw)
533+
<<" menuData:"<<has(_menuData)
534+
<<" draw level:"<<nav.root->drawLevel()
535+
<<" cur panel:"<<out.panels.cur
536+
<<endl;
537+
});
522538
if (clear) operator[](t).clearChanged(nav,out,false);
523539
{
524540
trace(MENU_DEBUG_OUT<<"checking:"<<operator[](t)<<endl);
525541
if (operator[](t).changed(nav,out,false,test)) {
526-
_trace(if (test) MENU_DEBUG_OUT<<"sub changed!"<<endl);
542+
trace(if (test) MENU_DEBUG_OUT<<"sub changed!"<<endl);
527543
return true;
528544
}
529545
}

src/nav.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
inline result sysEvent(eventMask e) {return sysEvent(e,sel);}//send event to current item
7070
navCmd navKeys(char ch);
7171
navCmd doNavigation(navCmd cmd);//aux function
72+
// inline int getPanelIdx(menuOut& out) const {return out.getPanelIdx(*this);}
7273
bool changed(const menuOut& out) const;
7374
inline prompt& operator[](idx_t i) const {return target->operator[](i);}
7475

@@ -121,6 +122,9 @@
121122
inline navNode& node() const {return path[level];}
122123
inline menuNode& active() const {return *node().target;}
123124
inline prompt& selected() const {return active()[node().sel];}
125+
inline int drawLevel() const {
126+
return level-(navFocus->has((systemStyles)(_parentDraw|_asPad))&&navFocus->has(_menuData));
127+
}
124128
bool changed(const menuOut& out);
125129
inline bool changed(idx_t n) {return changed(out[n]);}
126130
#ifdef MENU_ASYNC

0 commit comments

Comments
 (0)