add menu item of marker all off

This commit is contained in:
TT 2017-01-02 16:59:10 +09:00
parent 6c7da59a57
commit a76698c166
3 changed files with 33 additions and 23 deletions

View file

@ -528,20 +528,20 @@ const uint16_t x5x7_bits [] =
/* Character (0x1b):
bbw=5, bbh=7, bbx=0, bby=-1, width=5
+----------------+
| * |
| * |
| * |
|***** |
| * |
| * |
| * |
| *** |
| |
| |
+----------------+ */
0x4000,
0x2000,
0x1000,
0xF800,
0x1000,
0x2000,
0x4000,
0x7000,
0x0000,
0x0000,
/* Character (0x1c):

View file

@ -134,6 +134,7 @@ extern const uint32_t numfont20x24[][24];
#define S_MICRO "\035"
#define S_OHM "\036"
#define S_DEGREE "\037"
#define S_RARROW "\033"
// trace

43
ui.c
View file

@ -22,6 +22,7 @@
#include "hal.h"
#include "nanovna.h"
#include <stdlib.h>
#include <string.h>
struct {
@ -510,22 +511,29 @@ menu_marker_op_cb(int item)
ui_mode_normal();
redraw();
force_set_markmap();
draw_cell_all();
//draw_cell_all();
}
static void
menu_marker_sel_cb(int item)
{
if (item < 0 || item >= 4)
return;
if (active_marker == item) {
markers[active_marker].enabled = FALSE;
choose_active_marker();
} else {
active_marker = item;
markers[active_marker].enabled = TRUE;
if (item >= 0 && item < 4) {
if (active_marker == item) {
markers[active_marker].enabled = FALSE;
choose_active_marker();
} else {
active_marker = item;
markers[active_marker].enabled = TRUE;
}
} else if (item == 4) {
// ALL OFF
markers[0].enabled = FALSE;
markers[1].enabled = FALSE;
markers[2].enabled = FALSE;
markers[3].enabled = FALSE;
active_marker = -1;
}
if (active_marker >= 0)
redraw_marker(active_marker, TRUE);
ui_mode_normal();
@ -599,7 +607,7 @@ const menuitem_t menu_channel[] = {
};
const menuitem_t menu_display[] = {
{ MT_CALLBACK, "SGL TRC", menu_single_trace_cb },
{ MT_CALLBACK, "\2SINGLE\0TRACE", menu_single_trace_cb },
{ MT_SUBMENU, "TRACE", menu_trace },
{ MT_SUBMENU, "FORMAT", menu_format },
{ MT_CALLBACK, "SCALE", menu_scale_cb },
@ -624,16 +632,17 @@ const menuitem_t menu_marker_sel[] = {
{ MT_CALLBACK, "2", menu_marker_sel_cb },
{ MT_CALLBACK, "3", menu_marker_sel_cb },
{ MT_CALLBACK, "4", menu_marker_sel_cb },
{ MT_CALLBACK, "ALL OFF", menu_marker_sel_cb },
{ MT_CANCEL, "BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
const menuitem_t menu_marker[] = {
{ MT_SUBMENU, "SELECT", menu_marker_sel },
{ MT_CALLBACK, "\2MARKER>\0START", menu_marker_op_cb },
{ MT_CALLBACK, "\2MARKER>\0STOP", menu_marker_op_cb },
{ MT_CALLBACK, "\2MARKER>\0CENTER", menu_marker_op_cb },
{ MT_CALLBACK, "\2MARKER>\0SPAN", menu_marker_op_cb },
{ MT_CALLBACK, "\2MARKER"S_RARROW"\0START", menu_marker_op_cb },
{ MT_CALLBACK, "\2MARKER"S_RARROW"\0STOP", menu_marker_op_cb },
{ MT_CALLBACK, "\2MARKER"S_RARROW"\0CENTER", menu_marker_op_cb },
{ MT_CALLBACK, "\2MARKER"S_RARROW"\0SPAN", menu_marker_op_cb },
{ MT_CANCEL, "BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -824,7 +833,7 @@ draw_numeric_input(const char *buf)
}
static int
menu_is_multiline(const char *label, char **l1, char **l2)
menu_is_multiline(const char *label, const char **l1, const char **l2)
{
if (label[0] != '\2')
return FALSE;
@ -839,7 +848,7 @@ draw_menu_buttons(const menuitem_t *menu)
{
int i = 0;
for (i = 0; i < 7; i++) {
char *l1, *l2;
const char *l1, *l2;
if (menu[i].type == MT_NONE)
break;
if (menu[i].type == MT_BLANK)