summaryrefslogtreecommitdiffstats
path: root/CategoriesPanel.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-12-25 16:42:35 +0100
committerBenny Baumann <BenBE@geshi.org>2021-08-22 16:15:59 +0200
commit9060a4179da07c82e73142b2b2afab5e6efaa8b0 (patch)
tree1451b10537097d248c9fee671f3eb01af808fdb8 /CategoriesPanel.c
parent7269faf651cbb789156113df0a540943a24ded27 (diff)
Add option to change Header layout
Diffstat (limited to 'CategoriesPanel.c')
-rw-r--r--CategoriesPanel.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/CategoriesPanel.c b/CategoriesPanel.c
index d415760c..14f74c0e 100644
--- a/CategoriesPanel.c
+++ b/CategoriesPanel.c
@@ -17,6 +17,8 @@ in the source distribution for its full text.
#include "ColumnsPanel.h"
#include "DisplayOptionsPanel.h"
#include "FunctionBar.h"
+#include "Header.h"
+#include "HeaderOptionsPanel.h"
#include "ListItem.h"
#include "MetersPanel.h"
#include "Object.h"
@@ -34,13 +36,23 @@ static void CategoriesPanel_delete(Object* object) {
}
void CategoriesPanel_makeMetersPage(CategoriesPanel* this) {
- MetersPanel* leftMeters = MetersPanel_new(this->settings, "Left column", this->header->columns[0], this->scr);
- MetersPanel* rightMeters = MetersPanel_new(this->settings, "Right column", this->header->columns[1], this->scr);
- leftMeters->rightNeighbor = rightMeters;
- rightMeters->leftNeighbor = leftMeters;
- Panel* availableMeters = (Panel*) AvailableMetersPanel_new(this->settings, this->header, (Panel*) leftMeters, (Panel*) rightMeters, this->scr, this->pl);
- ScreenManager_add(this->scr, (Panel*) leftMeters, 20);
- ScreenManager_add(this->scr, (Panel*) rightMeters, 20);
+ size_t columns = HeaderLayout_getColumns(this->scr->header->headerLayout);
+ MetersPanel** meterPanels = xMallocArray(columns, sizeof(MetersPanel));
+
+ for (size_t i = 0; i < columns; i++) {
+ char titleBuffer[32];
+ xSnprintf(titleBuffer, sizeof(titleBuffer), "Column %zu", i + 1);
+ meterPanels[i] = MetersPanel_new(this->settings, titleBuffer, this->header->columns[i], this->scr);
+
+ if (i != 0) {
+ meterPanels[i]->leftNeighbor = meterPanels[i - 1];
+ meterPanels[i - 1]->rightNeighbor = meterPanels[i];
+ }
+
+ ScreenManager_add(this->scr, (Panel*) meterPanels[i], 20);
+ }
+
+ Panel* availableMeters = (Panel*) AvailableMetersPanel_new(this->settings, this->header, columns, meterPanels, this->scr, this->pl);
ScreenManager_add(this->scr, availableMeters, -1);
}
@@ -61,6 +73,11 @@ static void CategoriesPanel_makeColumnsPage(CategoriesPanel* this) {
ScreenManager_add(this->scr, availableColumns, -1);
}
+static void CategoriesPanel_makeHeaderOptionsPage(CategoriesPanel* this) {
+ Panel* colors = (Panel*) HeaderOptionsPanel_new(this->settings, this->scr);
+ ScreenManager_add(this->scr, colors, -1);
+}
+
static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
CategoriesPanel* this = (CategoriesPanel*) super;
@@ -111,6 +128,9 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
case 3:
CategoriesPanel_makeColumnsPage(this);
break;
+ case 4:
+ CategoriesPanel_makeHeaderOptionsPage(this);
+ break;
}
}
return result;
@@ -139,5 +159,6 @@ CategoriesPanel* CategoriesPanel_new(ScreenManager* scr, Settings* settings, Hea
Panel_add(super, (Object*) ListItem_new("Display options", 0));
Panel_add(super, (Object*) ListItem_new("Colors", 0));
Panel_add(super, (Object*) ListItem_new("Columns", 0));
+ Panel_add(super, (Object*) ListItem_new("Header layout", 0));
return this;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy