Skip to content
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

Show Function Bar as default on NULL #772

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AffinityPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static void AffinityPanel_updateTopo(AffinityPanel* this, MaskItem* item) {
static void AffinityPanel_update(AffinityPanel* this, bool keepSelected) {
Panel* super = (Panel*) this;

FunctionBar_setLabel(super->currentBar, KEY_F(3), this->topoView ? "Collapse/Expand" : "");
FunctionBar_setLabel(super->defaultBar, KEY_F(3), this->topoView ? "Collapse/Expand" : "");

int oldSelected = Panel_getSelectedIndex(super);
Panel_prune(super);
Expand Down
4 changes: 2 additions & 2 deletions IncSet.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ IncSet* IncSet_new(FunctionBar* bar) {
}

void IncSet_delete(IncSet* this) {
IncMode_done(&(this->modes[0]));
IncMode_done(&(this->modes[1]));
IncMode_done(&(this->modes[INC_SEARCH]));
IncMode_done(&(this->modes[INC_FILTER]));
free(this);
}

Expand Down
10 changes: 3 additions & 7 deletions MetersPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ void MetersPanel_setMoving(MetersPanel* this, bool moving) {
if (selected) {
selected->moving = moving;
}
if (!moving) {
Panel_setSelectionColor(super, PANEL_SELECTION_FOCUS);
Panel_setDefaultBar(super);
} else {
Panel_setSelectionColor(super, PANEL_SELECTION_FOLLOW);
super->currentBar = Meters_movingBar;
}

Panel_setSelectionColor(super, moving ? PANEL_SELECTION_FOLLOW : PANEL_SELECTION_FOCUS);
super->currentBar = moving ? Meters_movingBar : NULL;
}

static inline bool moveToNeighbor(MetersPanel* this, MetersPanel* neighbor, int selected) {
Expand Down
4 changes: 2 additions & 2 deletions Panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Panel_init(Panel* this, int x, int y, int w, int h, const ObjectClass* type
this->wasFocus = false;
RichString_beginAllocated(this->header);
this->defaultBar = fuBar;
this->currentBar = fuBar;
this->currentBar = NULL;
this->selectionColorId = PANEL_SELECTION_FOCUS;
}

Expand Down Expand Up @@ -324,7 +324,7 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect
if (Panel_drawFunctionBarFn(this))
Panel_drawFunctionBar(this, hideFunctionBar);
else if (!hideFunctionBar)
FunctionBar_draw(this->currentBar);
FunctionBar_draw(this->currentBar ? this->currentBar : this->defaultBar);
}

this->oldSelected = this->selected;
Expand Down
2 changes: 1 addition & 1 deletion Panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct Panel_ {
ColorElements selectionColorId;
};

#define Panel_setDefaultBar(this_) do { (this_)->currentBar = (this_)->defaultBar; } while (0)
#define Panel_setDefaultBar(this_) do { (this_)->defaultBar = NULL; } while (0)

#define KEY_CTRL(l) ((l)-'A'+1)

Expand Down
2 changes: 1 addition & 1 deletion ScreenManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
if (ok == OK) {
if (mevent.bstate & BUTTON1_RELEASED) {
if (mevent.y == LINES - 1) {
ch = FunctionBar_synthesizeEvent(panelFocus->currentBar, mevent.x);
ch = FunctionBar_synthesizeEvent(panelFocus->currentBar ? panelFocus->currentBar : panelFocus->defaultBar, mevent.x);
} else {
for (int i = 0; i < this->panelCount; i++) {
Panel* panel = (Panel*) Vector_get(this->panels, i);
Expand Down