Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Kharisov <albkharisov@gmail.com>2021-11-26 15:19:30 +0300
committerGitHub <noreply@github.com>2021-11-26 15:19:30 +0300
commit3ab9112c21f4791da34a175b98700af4785b89e1 (patch)
tree4c020ee55940291d99ad648490f9cf685165aef9 /applications/gui
parent6857b98ecdb4584bf99aa7bb0c236999e21e5d85 (diff)
Fix out of screen drawings (#842)
* Fix lock screen menu * Fix pin setup in lock menu * Desktop GUI layer on FS, black status bar * Desktop: fix spelling * Fix first start screen * Fix status bar drawing Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
Diffstat (limited to 'applications/gui')
-rw-r--r--applications/gui/gui.c73
-rw-r--r--applications/gui/gui_i.h6
-rw-r--r--applications/gui/modules/code_input.c13
3 files changed, 54 insertions, 38 deletions
diff --git a/applications/gui/gui.c b/applications/gui/gui.c
index f20718ca..5700e642 100644
--- a/applications/gui/gui.c
+++ b/applications/gui/gui.c
@@ -1,3 +1,4 @@
+#include "gui/canvas.h"
#include "gui_i.h"
#define TAG "GuiSrv"
@@ -53,7 +54,19 @@ void gui_redraw_status_bar(Gui* gui) {
canvas_set_orientation(gui->canvas, CanvasOrientationHorizontal);
canvas_frame_set(
gui->canvas, GUI_STATUS_BAR_X, GUI_STATUS_BAR_Y, GUI_DISPLAY_WIDTH, GUI_STATUS_BAR_HEIGHT);
+
+ /* for support black theme - paint white area and
+ * draw icon with transparent white color
+ */
+ canvas_set_color(gui->canvas, ColorWhite);
+ canvas_draw_box(gui->canvas, 1, 1, 9, 7);
+ canvas_draw_box(gui->canvas, 7, 3, 58, 6);
+ canvas_draw_box(gui->canvas, 61, 1, 32, 7);
+ canvas_draw_box(gui->canvas, 89, 3, 38, 6);
+ canvas_set_color(gui->canvas, ColorBlack);
+ canvas_set_bitmap_mode(gui->canvas, 1);
canvas_draw_icon(gui->canvas, 0, 0, &I_Background_128x11);
+ canvas_set_bitmap_mode(gui->canvas, 0);
// Right side
x = GUI_DISPLAY_WIDTH;
@@ -66,25 +79,22 @@ void gui_redraw_status_bar(Gui* gui) {
if(!width) width = 8;
x_used += width;
x -= (width + 2);
- canvas_frame_set(gui->canvas, x - 3, GUI_STATUS_BAR_Y, width, GUI_STATUS_BAR_HEIGHT);
+ canvas_frame_set(
+ gui->canvas, x - 3, GUI_STATUS_BAR_Y, width + 5, GUI_STATUS_BAR_HEIGHT);
canvas_set_color(gui->canvas, ColorWhite);
- canvas_draw_box(gui->canvas, 1, 1, width + 3, 11);
-
+ canvas_draw_box(gui->canvas, 2, 1, width + 2, 10);
canvas_set_color(gui->canvas, ColorBlack);
- canvas_draw_box(gui->canvas, 1, 0, 1, 12);
- canvas_draw_box(gui->canvas, 0, 1, 1, 11);
-
- canvas_draw_box(gui->canvas, 1, 11, width + 4, 2);
- canvas_draw_box(gui->canvas, 1, 0, width + 4, 1);
- canvas_draw_box(gui->canvas, width + 4, 1, 1, 11);
-
- canvas_set_color(gui->canvas, ColorWhite);
- canvas_draw_dot(gui->canvas, width + 4, 0);
- canvas_draw_dot(gui->canvas, width + 4, 12);
-
- canvas_set_color(gui->canvas, ColorBlack);
+ canvas_draw_rframe(
+ gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
+ canvas_draw_line(gui->canvas, 1, 1, 1, canvas_height(gui->canvas) - 2);
+ canvas_draw_line(
+ gui->canvas,
+ 2,
+ canvas_height(gui->canvas) - 2,
+ canvas_width(gui->canvas) - 2,
+ canvas_height(gui->canvas) - 2);
canvas_frame_set(
gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
@@ -103,26 +113,23 @@ void gui_redraw_status_bar(Gui* gui) {
width = view_port_get_width(view_port);
if(!width) width = 8;
x_used += width;
- canvas_frame_set(gui->canvas, x, GUI_STATUS_BAR_Y, width, GUI_STATUS_BAR_HEIGHT);
-
- canvas_set_color(gui->canvas, ColorWhite);
- canvas_draw_box(gui->canvas, 1, 1, width + 3, 11);
-
- canvas_set_color(gui->canvas, ColorBlack);
-
- if(x == 0) { // Frame start
- canvas_draw_box(gui->canvas, 1, 0, 1, 12);
- canvas_draw_box(gui->canvas, 0, 1, 1, 11);
- }
- canvas_draw_box(gui->canvas, 1, 11, width + 4, 2);
- canvas_draw_box(gui->canvas, 1, 0, width + 4, 1);
- canvas_draw_box(gui->canvas, width + 4, 0, 1, 12);
+ canvas_frame_set(
+ gui->canvas, 0, GUI_STATUS_BAR_Y, x + width + 5, GUI_STATUS_BAR_HEIGHT);
+ canvas_draw_rframe(
+ gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
+ canvas_draw_line(gui->canvas, 1, 1, 1, canvas_height(gui->canvas) - 2);
+ canvas_draw_line(
+ gui->canvas,
+ 2,
+ canvas_height(gui->canvas) - 2,
+ canvas_width(gui->canvas) - 2,
+ canvas_height(gui->canvas) - 2);
+
+ canvas_frame_set(gui->canvas, x, GUI_STATUS_BAR_Y, width + 5, GUI_STATUS_BAR_HEIGHT);
canvas_set_color(gui->canvas, ColorWhite);
- canvas_draw_dot(gui->canvas, width + 4, 0);
- canvas_draw_dot(gui->canvas, width + 4, 12);
-
+ canvas_draw_box(gui->canvas, 2, 1, width + 2, 10);
canvas_set_color(gui->canvas, ColorBlack);
canvas_frame_set(
@@ -148,7 +155,7 @@ bool gui_redraw_window(Gui* gui) {
bool gui_redraw_desktop(Gui* gui) {
canvas_set_orientation(gui->canvas, CanvasOrientationHorizontal);
- canvas_frame_set(gui->canvas, GUI_WINDOW_X, GUI_WINDOW_Y, GUI_WINDOW_WIDTH, GUI_WINDOW_HEIGHT);
+ canvas_frame_set(gui->canvas, 0, 0, GUI_DISPLAY_WIDTH, GUI_DISPLAY_HEIGHT);
ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerDesktop]);
if(view_port) {
view_port_draw(view_port, gui->canvas);
diff --git a/applications/gui/gui_i.h b/applications/gui/gui_i.h
index d8e3983b..06784f81 100644
--- a/applications/gui/gui_i.h
+++ b/applications/gui/gui_i.h
@@ -23,7 +23,13 @@
#define GUI_STATUS_BAR_X 0
#define GUI_STATUS_BAR_Y 0
#define GUI_STATUS_BAR_WIDTH GUI_DISPLAY_WIDTH
+/* 0-1 pixels for upper thin frame
+ * 2-9 pixels for icons (battery, sd card, etc)
+ * 10-12 pixels for lower bold line */
#define GUI_STATUS_BAR_HEIGHT 13
+/* icon itself area (battery, sd card, etc) excluding frame.
+ * painted 2 pixels below GUI_STATUS_BAR_X.
+ */
#define GUI_STATUS_BAR_WORKAREA_HEIGHT 8
#define GUI_WINDOW_X 0
diff --git a/applications/gui/modules/code_input.c b/applications/gui/modules/code_input.c
index 62f5118d..9e220d54 100644
--- a/applications/gui/modules/code_input.c
+++ b/applications/gui/modules/code_input.c
@@ -275,11 +275,14 @@ static void code_input_handle_dpad(CodeInputModel* model, InputKey key) {
static void code_input_view_draw_callback(Canvas* canvas, void* _model) {
CodeInputModel* model = _model;
uint8_t y_offset = 0;
- if(!strlen(model->header)) y_offset = 5;
canvas_clear(canvas);
canvas_set_color(canvas, ColorBlack);
- canvas_draw_str(canvas, 2, 9, model->header);
+ if(model->header && strlen(model->header)) {
+ canvas_draw_str(canvas, 2, 9, model->header);
+ } else {
+ y_offset = 4;
+ }
canvas_set_font(canvas, FontSecondary);
@@ -290,7 +293,7 @@ static void code_input_view_draw_callback(Canvas* canvas, void* _model) {
model->local_buffer[CodeInputFirst],
model->input_length[CodeInputFirst],
6,
- 30 - y_offset,
+ 30 + y_offset,
true);
break;
case CodeInputStateUpdate:
@@ -299,14 +302,14 @@ static void code_input_view_draw_callback(Canvas* canvas, void* _model) {
model->local_buffer[CodeInputFirst],
model->input_length[CodeInputFirst],
6,
- 14 - y_offset,
+ 14 + y_offset,
!model->current);
code_input_draw_sequence(
canvas,
model->local_buffer[CodeInputSecond],
model->input_length[CodeInputSecond],
6,
- 44 - y_offset,
+ 44 + y_offset,
model->current);
if(model->current) canvas_draw_str(canvas, 2, 39 - y_offset, "Repeat code");