Skip to content

Commit 9e1182f

Browse files
committed
cond. compile seek function
part of MENU_ASYNC also turned ebentHandler non-virtual
1 parent 6bb13b4 commit 9e1182f

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/menu.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Used prompt::printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,id
3939
return r;
4040
}
4141

42+
#ifdef MENU_ASYNC
4243
prompt* menuNode::seek(idx_t* uri,idx_t len) {
4344
trace(Serial<<"menuNode::seek"<<endl);
4445
if (len&&uri[0]>=0&&uri[0]<sz()) {
@@ -47,7 +48,6 @@ prompt* menuNode::seek(idx_t* uri,idx_t len) {
4748
return e.seek(++uri,--len);
4849
} else return NULL;
4950
}
50-
#ifdef MENU_ASYNC
5151
bool menuNode::async(const char *uri,navRoot& root,idx_t lvl) {
5252
trace(Serial<<"menuNode::async"<<endl);
5353
if ((!*uri)||(uri[0]=='/'&&!uri[1])) return this;
@@ -216,7 +216,7 @@ Used outputsList::printMenu(navNode& nav) const {
216216
void menuOut::previewMenu(navRoot& root,menuNode& menu,idx_t panelNr) {
217217
trace(Serial<<"menuOut::previewMenu"<<endl);
218218
setColor(fgColor,false);
219-
if (menu.asPad()) {
219+
if (menu.has(_asPad)) {
220220
for(int i=0;i<menu.sz();i++) {
221221
prompt& p=menu[i];
222222
setColor(fgColor,false,p.enabled);
@@ -279,7 +279,7 @@ Used menuOut::printMenu(navNode &nav,idx_t panelNr) {
279279
idx_t topi=nav.root->level;
280280
if(topi&&nav.root->active().parentDraw()) topi--;
281281
idx_t ot=tops[topi];
282-
bool asPad=nav.target->asPad();
282+
bool asPad=nav.target->has(_asPad);
283283
idx_t st
284284
=((nav.target->style()&showTitle)||(nav.root->showTitle&&(!(nav.target->style()&noTitle))))
285285
&&!(asPad||(maxY(panelNr)<2));//do not use titles on single line devices!

src/menu.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,27 @@ for correcting unsigned values validation
8484
inline bool is(eventMask chk) const {return (events()&chk)==chk;}
8585
inline bool has(eventMask chk) const {return events()&chk;}
8686

87-
8887
inline bool canWrap() const {return style()&wrapStyle;}
8988
inline bool canNav() const {return sysStyles()&_canNav;}//can receive navigation focus and process keys
9089
inline bool isMenu() const {return sysStyles()&_menuData;}//has menu data list and can be a navNode target
9190
inline bool isVariant() const {return sysStyles()&_isVariant;}//a menu as an enumerated field, connected to a variable value
9291
inline bool parentDraw() const {return sysStyles()&_parentDraw;}//a menu as an enumerated field, connected to a variable value
9392
inline bool asPad() const {return sysStyles()&_asPad;}//a menu as an enumerated field, connected to a variable value
93+
9494
inline bool hasTitle(navNode& nav) const;
9595

9696
virtual Used printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,idx_t panelNr=0);//raw print to output device
9797
virtual bool changed(const navNode &nav,const menuOut& out,bool sub=true) {return dirty;}
9898
//this is the system version of enter handler, its used by elements like toggle
9999
virtual result sysHandler(SYS_FUNC_PARAMS) {return proceed;}
100-
virtual result eventHandler(eventMask e,navNode& nav,idx_t i) {
100+
/*virtual*/ result eventHandler(eventMask e,navNode& nav,idx_t i) {
101101
return operator()(e,nav,*this);
102102
}
103103
inline result operator()(FUNC_PARAMS) const {return (*shadow)(FUNC_VALUES);}
104104
idx_t printRaw(menuOut& out,idx_t len) const;
105-
virtual prompt* seek(idx_t* uri,idx_t len) {return len?NULL:this;}
105+
#ifdef ASYNC_NAV
106+
virtual prompt* seek(idx_t* uri,idx_t len) {return len?NULL:this;}
107+
#endif
106108
#ifdef MENU_ASYNC
107109
virtual bool async(const char *uri,navRoot& root,idx_t lvl) {
108110
return ((!*uri)||(uri[0]=='/'&&!uri[1]));
@@ -267,7 +269,9 @@ for correcting unsigned values validation
267269
void clearChanged(const navNode &nav,const menuOut& out,bool sub) override;
268270
inline idx_t sz() const {return ((menuNodeShadow*)shadow)->_sz();}
269271
inline prompt* constMEM* data() const {return ((menuNodeShadow*)shadow)->_data();}
270-
prompt* seek(idx_t* uri,idx_t len) override;
272+
#ifdef ASYNC_NAV
273+
prompt* seek(idx_t* uri,idx_t len) override;
274+
#endif
271275
#ifdef MENU_ASYNC
272276
bool async(const char *uri,navRoot& root,idx_t lvl=0) override;
273277
#endif

0 commit comments

Comments
 (0)