Consolidate styles (#1116)

* Consolidate styles into a Styles class and clean up code

* Format

* Add style_bg_dark_grey for nav bar

* Fix bugs found in PR

* Rename styles

* Add bg_white style

---------

Co-authored-by: kallanreed <kallanreed@outlook.com>
Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com>
This commit is contained in:
Kyle Reed 2023-06-07 08:33:32 -07:00 committed by GitHub
parent 496b124baf
commit 0f28fefc82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 299 additions and 400 deletions

View file

@ -44,6 +44,7 @@
#include "ui_debug.hpp"
#include "ui_encoders.hpp"
#include "ui_fileman.hpp"
#include "ui_font_fixed_8x16.hpp"
#include "ui_freqman.hpp"
#include "ui_jammer.hpp"
// #include "ui_keyfob.hpp"
@ -65,6 +66,7 @@
#include "ui_siggen.hpp"
#include "ui_sonde.hpp"
#include "ui_sstvtx.hpp"
#include "ui_styles.hpp"
// #include "ui_test.hpp"
#include "ui_text_editor.hpp"
#include "ui_tone_search.hpp"
@ -104,12 +106,6 @@ namespace ui {
SystemStatusView::SystemStatusView(
NavigationView& nav)
: nav_(nav) {
static constexpr Style style_systemstatus{
.font = font::fixed_8x16,
.background = Color::dark_grey(),
.foreground = Color::white(),
};
add_children({
&backdrop,
&button_back,
@ -147,7 +143,7 @@ SystemStatusView::SystemStatusView(
}
button_back.id = -1; // Special ID used by FocusManager
title.set_style(&style_systemstatus);
title.set_style(&Styles::bg_dark_grey);
if (portapack::persistent_memory::stealth_mode())
button_stealth.set_foreground(ui::Color::green());
@ -645,17 +641,12 @@ SystemMenuView::SystemMenuView(NavigationView& nav) {
/* SystemView ************************************************************/
static constexpr ui::Style style_default{
.font = ui::font::fixed_8x16,
.background = ui::Color::black(),
.foreground = ui::Color::white()};
SystemView::SystemView(
Context& context,
const Rect parent_rect)
: View{parent_rect},
context_(context) {
set_style(&style_default);
set_style(&ui::Styles::white);
constexpr ui::Dim status_view_height = 16;
constexpr ui::Dim info_view_height = 16;