2016-05-30 10:02:15 +00:00
|
|
|
//
|
|
|
|
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
|
|
|
//
|
|
|
|
// This file is part of Open Source Scan Converter project.
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef MENU_H_
|
|
|
|
#define MENU_H_
|
|
|
|
|
2016-06-12 20:43:24 +00:00
|
|
|
#include "alt_types.h"
|
|
|
|
#include "controls.h"
|
|
|
|
|
2016-05-30 10:02:15 +00:00
|
|
|
typedef enum {
|
|
|
|
OPT_AVCONFIG_SELECTION,
|
|
|
|
OPT_AVCONFIG_NUMVALUE,
|
2016-08-16 19:45:23 +00:00
|
|
|
OPT_AVCONFIG_NUMVAL_U16,
|
2016-05-30 10:02:15 +00:00
|
|
|
OPT_SUBMENU,
|
|
|
|
OPT_FUNC_CALL,
|
|
|
|
} menuitem_type;
|
|
|
|
|
|
|
|
typedef int (*func_call)(void);
|
2017-10-22 19:45:29 +00:00
|
|
|
typedef void (*arg_func)(void);
|
2016-05-30 10:02:15 +00:00
|
|
|
typedef void (*disp_func)(alt_u8);
|
2019-06-24 21:23:45 +00:00
|
|
|
typedef void (*disp_func_u16)(alt_u16*);
|
2016-05-30 10:02:15 +00:00
|
|
|
|
2017-10-22 19:45:29 +00:00
|
|
|
typedef struct {
|
|
|
|
alt_u8 *data;
|
|
|
|
alt_u8 max;
|
|
|
|
disp_func df;
|
|
|
|
} arg_info_t;
|
2016-05-30 10:02:15 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
alt_u8 *data;
|
2016-06-12 20:43:24 +00:00
|
|
|
alt_u8 wrap_cfg;
|
|
|
|
alt_u8 min;
|
|
|
|
alt_u8 max;
|
2016-05-30 10:02:15 +00:00
|
|
|
const char **setting_str;
|
|
|
|
} opt_avconfig_selection;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
alt_u8 *data;
|
2016-06-12 20:43:24 +00:00
|
|
|
alt_u8 wrap_cfg;
|
2016-05-30 10:02:15 +00:00
|
|
|
alt_u8 min;
|
|
|
|
alt_u8 max;
|
2016-08-16 19:45:23 +00:00
|
|
|
disp_func df;
|
2016-05-30 10:02:15 +00:00
|
|
|
} opt_avconfig_numvalue;
|
|
|
|
|
2016-08-16 19:45:23 +00:00
|
|
|
typedef struct {
|
|
|
|
alt_u16 *data;
|
|
|
|
alt_u16 min;
|
|
|
|
alt_u16 max;
|
|
|
|
disp_func_u16 df;
|
|
|
|
} opt_avconfig_numvalue_u16;
|
|
|
|
|
2016-05-30 10:02:15 +00:00
|
|
|
typedef struct {
|
|
|
|
func_call f;
|
2017-10-22 19:45:29 +00:00
|
|
|
const arg_info_t *arg_info;
|
2016-05-30 10:02:15 +00:00
|
|
|
} opt_func_call;
|
|
|
|
|
|
|
|
typedef struct menustruct menu_t;
|
|
|
|
|
2016-08-16 19:45:23 +00:00
|
|
|
typedef struct {
|
|
|
|
const menu_t *menu;
|
2017-10-22 19:45:29 +00:00
|
|
|
const arg_info_t *arg_info;
|
|
|
|
arg_func arg_f;
|
2016-08-16 19:45:23 +00:00
|
|
|
} opt_submenu;
|
|
|
|
|
2016-05-30 10:02:15 +00:00
|
|
|
typedef struct {
|
2016-10-26 22:08:23 +00:00
|
|
|
const char *name;
|
2016-05-30 10:02:15 +00:00
|
|
|
menuitem_type type;
|
|
|
|
union {
|
|
|
|
opt_avconfig_selection sel;
|
|
|
|
opt_avconfig_numvalue num;
|
2016-08-16 19:45:23 +00:00
|
|
|
opt_avconfig_numvalue_u16 num_u16;
|
|
|
|
opt_submenu sub;
|
2016-05-30 10:02:15 +00:00
|
|
|
opt_func_call fun;
|
|
|
|
};
|
|
|
|
} menuitem_t;
|
|
|
|
|
|
|
|
struct menustruct {
|
|
|
|
alt_u8 num_items;
|
|
|
|
menuitem_t *items;
|
|
|
|
};
|
|
|
|
|
2016-06-12 20:43:24 +00:00
|
|
|
#define SETTING_ITEM(x) 0, sizeof(x)/sizeof(char*)-1, x
|
2016-05-30 10:02:15 +00:00
|
|
|
#define MENU(X, Y) menuitem_t X##_items[] = Y; const menu_t X = { sizeof(X##_items)/sizeof(menuitem_t), X##_items };
|
|
|
|
#define P99_PROTECT(...) __VA_ARGS__
|
|
|
|
|
|
|
|
typedef enum {
|
2016-06-12 20:43:24 +00:00
|
|
|
NO_ACTION = 0,
|
|
|
|
OPT_SELECT = RC_OK,
|
|
|
|
PREV_MENU = RC_BACK,
|
|
|
|
PREV_PAGE = RC_UP,
|
|
|
|
NEXT_PAGE = RC_DOWN,
|
|
|
|
VAL_MINUS = RC_LEFT,
|
|
|
|
VAL_PLUS = RC_RIGHT,
|
|
|
|
} menucode_id; // order must be consequential with rc_code_t
|
2016-05-30 10:02:15 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const menu_t *m;
|
|
|
|
alt_u8 mp;
|
|
|
|
} menunavi;
|
|
|
|
|
2016-06-12 20:43:24 +00:00
|
|
|
void display_menu(alt_u8 forcedisp);
|
2019-05-07 21:05:16 +00:00
|
|
|
static void vm_select();
|
2019-06-24 21:23:45 +00:00
|
|
|
static void vm_tweak(alt_u16 *v);
|
2019-05-07 21:05:16 +00:00
|
|
|
static void sampler_phase_tweak(alt_u8 v);
|
2016-05-30 10:02:15 +00:00
|
|
|
|
|
|
|
#endif
|