rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
log_viewer_events.c File Reference

The log viewer's touch events: taps, drags and the scroll bar on the browse view, the DELETE question, the import view's columns and overrides, and the plot's cursor, pinch zoom and pan. log_viewer_screen.c holds the state, the card's listing and paging and the screen's interface (log_viewer_screen.h); log_viewer_int.h is what the screen's four files share. More...

#include <stdio.h>
#include <string.h>
#include "log_viewer_screen.h"
#include "settings.h"
#include "ui_screen.h"
#include "ui_tabs.h"
#include "ui_text.h"
#include "log_viewer_int.h"

Macros

#define DRAG_SLOP   8
 A press that moves further than this, in x or in y, is not a tap; on a list, vertical travel past it is a scroll.

Functions

static int hit_button (const gfx_rect_t *rects, int n, int x, int y)
 Returns the index of the first rectangle that holds (x, y).
static bool tap_begin (const touch_event_t *e)
 A button or a row is a tap: the press arms it and the release activates it. One contact holds the press from its DOWN to its UP; another presses nothing and ends nothing.
static bool tap_mine (const touch_event_t *e)
 Returns whether e belongs to the contact that holds the press.
static bool tap_far (const touch_event_t *e)
 Whether e is further than the slop from the press, in x or in y.
static bool tap_on (const touch_event_t *e, gfx_rect_t r)
 Whether the release e is a tap on r: inside it, the contact never further than the slop from its press, and the release made by the finger, not for it (TOUCH_FLAG_NO_TAP).
static gfx_rect_t list_row_rect (gfx_rect_t list, int row_h, int r)
 Row r of the rows showing in a list: under its 30px heading.
static void clamp_scroll (int *scroll, int total, int visible)
 Limits scroll to 0 through total - visible rows.
static void ask_delete (void)
 Opens the DELETE question for the selected file, if DELETE is offered.
static void delete_doomed (void)
 Delete the file the DELETE question named, and read the page again.
static void question_event (const touch_event_t *e)
 Takes a touch event for the DELETE question: CANCEL and DELETE, one contact at a time.
static void browse_event (const touch_event_t *e)
 Takes a touch event for the browse view: the tabs, the list and its scroll bar, and the footer's buttons.
static void toggle_column (int i)
 Toggles column i of the import as a plotted series; the time column is not offered.
static void import_event (const touch_event_t *e)
 Takes a touch event for the import view: its footer buttons and the column list.
static void set_cursor_from_x (int x)
 Puts the cursor on the sample under pixel column x of the plot.
static void follow_cursor (void)
 Keep the cursor's sample on screen after an arrow press.
static float pinch_dist (void)
 Returns the distance between the two pinch fingers, px.
static float pinch_mid (void)
 Returns the midpoint of the two pinch fingers, px.
static void pinch_start (uint8_t id0, int16_t x0, uint8_t id1, int16_t x1)
 A second finger lands on the plot: the gesture starts from here.
static void pinch_apply (void)
 Both fingers' positions changed: set the window from them.
static bool pan_enabled (void)
 A drag pans only a view that is zoomed in, and only when the setting asks.
static void pan_apply (int x)
 The finger is at x: keep the sample that was under it where it began.
static void plot_event (const touch_event_t *e)
 Takes a touch event for the plot: the cursor, the pinch zoom, the pan and the footer's buttons.
static void text_event (const touch_event_t *e)
 A touch on the TEXT view: a drag on the rows or on the scroll bar scrolls them, a tap on BACK returns to the list.
void lv_event (const touch_event_t *e)
 Takes a touch event for the view on screen.

Detailed Description

The log viewer's touch events: taps, drags and the scroll bar on the browse view, the DELETE question, the import view's columns and overrides, and the plot's cursor, pinch zoom and pan. log_viewer_screen.c holds the state, the card's listing and paging and the screen's interface (log_viewer_screen.h); log_viewer_int.h is what the screen's four files share.

SPDX-License-Identifier: MIT

Function Documentation

◆ delete_doomed()

void delete_doomed ( void )
static

Delete the file the DELETE question named, and read the page again.

What the import, the plot and the text held is dropped when it was read from that file. A refused delete leaves the list as it was and says so in the footer.

◆ lv_event()

void lv_event ( const touch_event_t * e)

Takes a touch event for the view on screen.

Parameters
ethe event

◆ text_event()

void text_event ( const touch_event_t * e)
static

A touch on the TEXT view: a drag on the rows or on the scroll bar scrolls them, a tap on BACK returns to the list.

Parameters
eThe event.