Files
edgetx-gx12/radio/src/gui/480x272/zone.h
T
Max PapernoandBertrand Songis 4f988babbf Fix initializer list issue with ZoneOptionValue (#4203)
* [480x272] Fix initializer list issue with ZoneOptionValue (technically not C++11), now works x-platform as well, lowers Flash use; Spit out Zone, ZoneOption, ZoneOptionValue to own unit. (Fixes https://github.com/opentx/opentx/pull/4199/files#r94867147)

* [480x272] Revert to Flash usage for ZoneOptionValue types (still fixes MSVC build). (Ref: https://github.com/opentx/opentx/commit/82dce3ee601049cf548ff4518902ab8e8fa62a0b#commitcomment-20388918 & https://github.com/opentx/opentx/pull/4199#discussion_r94835251)

* Cosmetics.

* [480x272] Cosmetics.
2017-01-08 09:48:37 +01:00

56 lines
1.0 KiB
C

#ifndef _ZONE_H_
#define _ZONE_H_
#include <inttypes.h>
#define LEN_ZONE_OPTION_STRING 8
#if defined(_MSC_VER)
#define OPTION_VALUE_UNSIGNED(x) uint32_t(x)
#define OPTION_VALUE_SIGNED(x) uint32_t(x)
#define OPTION_VALUE_BOOL(x) bool(x)
#define OPTION_VALUE_STRING(...) *(ZoneOptionValue *)(const char *) #__VA_ARGS__
#else
#define OPTION_VALUE_UNSIGNED(x) { .unsignedValue = (x) }
#define OPTION_VALUE_SIGNED(x) { .signedValue = (x) }
#define OPTION_VALUE_BOOL(x) { .boolValue = (x) }
#define OPTION_VALUE_STRING(...) { .stringValue = {__VA_ARGS__} }
#endif
struct Zone
{
uint16_t x, y, w, h;
};
union ZoneOptionValue
{
uint32_t unsignedValue;
int32_t signedValue;
bool boolValue;
char stringValue[LEN_ZONE_OPTION_STRING];
};
struct ZoneOption
{
enum Type {
Integer,
Source,
Bool,
String,
File,
TextSize,
Timer,
Switch,
Color
};
const char * name;
Type type;
ZoneOptionValue deflt;
ZoneOptionValue min;
ZoneOptionValue max;
};
#endif