-
-
Notifications
You must be signed in to change notification settings - Fork 597
Remember meter positions across layout changes #1993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -98,6 +98,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { | |||||||||||||||||||||||||||||||||||
| int selected = Panel_getSelectedIndex(super); | ||||||||||||||||||||||||||||||||||||
| HandlerResult result = IGNORED; | ||||||||||||||||||||||||||||||||||||
| bool sideMove = false; | ||||||||||||||||||||||||||||||||||||
| bool modified = false; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| switch (ch) { | ||||||||||||||||||||||||||||||||||||
| case 0x0a: | ||||||||||||||||||||||||||||||||||||
|
|
@@ -136,8 +137,11 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { | |||||||||||||||||||||||||||||||||||
| case KEY_F(7): | ||||||||||||||||||||||||||||||||||||
| case '[': | ||||||||||||||||||||||||||||||||||||
| case '-': | ||||||||||||||||||||||||||||||||||||
| Vector_moveUp(this->meters, selected); | ||||||||||||||||||||||||||||||||||||
| Panel_moveSelectedUp(super); | ||||||||||||||||||||||||||||||||||||
| if (selected > 0) { | ||||||||||||||||||||||||||||||||||||
| Vector_moveUp(this->meters, selected); | ||||||||||||||||||||||||||||||||||||
| Panel_moveSelectedUp(super); | ||||||||||||||||||||||||||||||||||||
| modified = true; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| result = HANDLED; | ||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||
| case KEY_DOWN: | ||||||||||||||||||||||||||||||||||||
|
|
@@ -147,8 +151,11 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { | |||||||||||||||||||||||||||||||||||
| case KEY_F(8): | ||||||||||||||||||||||||||||||||||||
| case ']': | ||||||||||||||||||||||||||||||||||||
| case '+': | ||||||||||||||||||||||||||||||||||||
| Vector_moveDown(this->meters, selected); | ||||||||||||||||||||||||||||||||||||
| Panel_moveSelectedDown(super); | ||||||||||||||||||||||||||||||||||||
| if (selected + 1 < Vector_size(this->meters)) { | ||||||||||||||||||||||||||||||||||||
| Vector_moveDown(this->meters, selected); | ||||||||||||||||||||||||||||||||||||
| Panel_moveSelectedDown(super); | ||||||||||||||||||||||||||||||||||||
| modified = true; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| result = HANDLED; | ||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||
| case KEY_F(6): | ||||||||||||||||||||||||||||||||||||
|
|
@@ -178,6 +185,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { | |||||||||||||||||||||||||||||||||||
| Panel_remove(super, selected); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| MetersPanel_setMoving(this, false); | ||||||||||||||||||||||||||||||||||||
| modified = true; | ||||||||||||||||||||||||||||||||||||
| result = HANDLED; | ||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||
| case EVENT_PANEL_LOST_FOCUS: | ||||||||||||||||||||||||||||||||||||
|
|
@@ -189,6 +197,10 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| if (result == HANDLED || sideMove) { | ||||||||||||||||||||||||||||||||||||
| Header* header = this->scr->header; | ||||||||||||||||||||||||||||||||||||
| if (modified || sideMove) { | ||||||||||||||||||||||||||||||||||||
| Header_collapseLayout(header); | ||||||||||||||||||||||||||||||||||||
| header->metersCopied = false; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+200
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Treat style changes as a real meter modification. The new Suggested fix case ' ':
case KEY_F(4):
case 't': {
if (!Vector_size(this->meters))
break;
Meter* meter = (Meter*) Vector_get(this->meters, selected);
MeterModeId mode = Meter_nextSupportedMode(meter);
Meter_setMode(meter, mode);
Panel_set(super, selected, (Object*) Meter_toListItem(meter, this->moving));
+ modified = true;
result = HANDLED;
break;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| this->settings->changed = true; | ||||||||||||||||||||||||||||||||||||
| this->settings->lastUpdate++; | ||||||||||||||||||||||||||||||||||||
| Header_calculateHeight(header); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Header_forEachColumnonly iterates over visible columns. Since hidden columns now stay allocated in memory,Header_deleteneeds to free all of them up tomaxColumns