@@ -27,16 +27,6 @@ void MenuItem::setSendRemoteNeeded(uint8_t remoteNo, bool needed) {
2727 bitWrite (flags, (remoteNo + (int )MENUITEM_REMOTE_SEND0), (needed && !isLocalOnly ()));
2828}
2929
30- void MenuItem::setEditing (bool active) {
31- bool isEditOnEntry = isEditing ();
32- bitWrite (flags, MENUITEM_EDITING, active);
33- setChanged (true );
34- if (isMenuRuntimeMultiEdit (this ) && !active && isEditOnEntry) {
35- auto * item = reinterpret_cast <EditableMultiPartMenuItem*>(this );
36- item->stopMultiEdit ();
37- }
38- }
39-
4030void MenuItem::setSendRemoteNeededAll () {
4131 // make sure local only fields are never marked for sending.
4232 if (isLocalOnly ()) clearSendRemoteNeededAll ();
@@ -119,9 +109,10 @@ uint16_t MenuItem::getEepromPosition() const
119109 return isInfoProgMem () ? get_info_uint (&info->eepromAddr ) : info->eepromAddr ;
120110}
121111
122- void MenuItem::setActive (bool active) {
123- bitWrite (flags, MENUITEM_ACTIVE, active);
124- setChanged (true );
112+ void MenuItem::setChanged (bool changed) {
113+ flags = flags | MENUITEM_ALL_CHANGE;
114+ if (isLocalOnly ()) return ;
115+ flags = flags | MENUITEM_ALL_REMOTES;
125116}
126117
127118// on avr boards we store all info structures in progmem, so we need this code to
@@ -320,19 +311,19 @@ const char NO_STR[] PGM_TCM = TXT_BOOL_NO_TEXT;
320311const char TRUE_STR[] PGM_TCM = TXT_BOOL_TRUE_TEXT;
321312const char FALSE_STR[] PGM_TCM= TXT_BOOL_FALSE_TEXT;
322313
323- void copyMenuItemNameAndValue (const MenuItem* item, char * buffer, size_t bufferSize, char additionalSep) {
314+ void copyMenuItemNameAndValue (const MenuItem* item, char * buffer, size_t bufferSize, char additionalSep, bool active ) {
324315 item->copyNameToBuffer (buffer, bufferSize);
325316 if (additionalSep != 0 ) appendChar (buffer, additionalSep, bufferSize);
326317 appendChar (buffer, ' ' , bufferSize);
327318
328319 int pos = strlen (buffer);
329- copyMenuItemValue (item, buffer + pos, bufferSize - pos);
320+ copyMenuItemValue (item, buffer + pos, bufferSize - pos, active );
330321}
331322
332323const char CHECKED_STR[] PROGMEM = " [X]" ;
333324const char UNCHECKED_STR[] PROGMEM = " [ ]" ;
334325
335- void copyMenuItemValue (const MenuItem* item, char * buffer, size_t bufferSize) {
326+ void copyMenuItemValue (const MenuItem* item, char * buffer, size_t bufferSize, bool active ) {
336327 buffer[0 ] = 0 ;
337328 if (item->getMenuType () == MENUTYPE_ENUM_VALUE) {
338329 auto * enItem = reinterpret_cast <const EnumMenuItem*>(item);
@@ -372,12 +363,12 @@ void copyMenuItemValue(const MenuItem* item, char* buffer, size_t bufferSize) {
372363 }
373364 else if (item->getMenuType () == MENUTYPE_BACK_VALUE) {
374365 buffer[0 ]=0 ;
375- if (item-> isActive () ) {
366+ if (active ) {
376367 strncpy (buffer, " [..]" , bufferSize);
377368 }
378369 }
379370 else if (item->getMenuType () == MENUTYPE_TITLE_ITEM) {
380- if (reinterpret_cast <const tcgfx::RuntimeTitleMenuItem*>(item)->getCallback () && item-> isActive () ) {
371+ if (reinterpret_cast <const tcgfx::RuntimeTitleMenuItem*>(item)->getCallback () && active ) {
381372 strncpy (buffer, " ..." , bufferSize);
382373 } else buffer[0 ] = 0 ;
383374 }
@@ -387,9 +378,9 @@ void copyMenuItemValue(const MenuItem* item, char* buffer, size_t bufferSize) {
387378 }
388379}
389380
390- void copyMenuItemValueDefault (const MenuItem* item, char * buffer, size_t bufferSize, const char * defValue) {
381+ void copyMenuItemValueDefault (const MenuItem* item, char * buffer, size_t bufferSize, const char * defValue, bool active ) {
391382 buffer[0 ]=0 ;
392- copyMenuItemValue (item, buffer, bufferSize);
383+ copyMenuItemValue (item, buffer, bufferSize, active );
393384 if (strlen (buffer)==0 ) {
394385 strncpy (buffer, defValue, bufferSize);
395386 buffer[bufferSize - 1 ] = 0 ;
0 commit comments