本文整理汇总了C++中GUI_TextSelectHelper函数的典型用法代码示例。如果您正苦于以下问题:C++ GUI_TextSelectHelper函数的具体用法?C++ GUI_TextSelectHelper怎么用?C++ GUI_TextSelectHelper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GUI_TextSelectHelper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ELEM_TYPE
static const char *dlgts_cb(guiObject_t *obj, int dir, void *data)
{
(void)obj;
int idx = (long)data;
int type = ELEM_TYPE(pc->elem[idx]);
switch (type) {
case ELEM_SMALLBOX:
case ELEM_BIGBOX:
{
u8 changed = 0;
pc->elem[idx].src = GUI_TextSelectHelper(pc->elem[idx].src, 0, NUM_RTC + NUM_TELEM + NUM_TIMERS + NUM_CHANNELS, dir, 1, 1, &changed);
if(changed && dir) {
pc->elem[idx].src = _adjust_src_for_telemetry(pc->elem[idx].src, dir);
}
return GetBoxSource(tempstring, pc->elem[idx].src);
}
case ELEM_BAR:
pc->elem[idx].src = GUI_TextSelectHelper(pc->elem[idx].src, 0, NUM_CHANNELS, dir, 1, 1, NULL);
return INPUT_SourceName(tempstring, pc->elem[idx].src ? pc->elem[idx].src + NUM_INPUTS : 0);
case ELEM_TOGGLE:
{
pc->elem[idx].src = INPUT_SelectAbbrevSource(pc->elem[idx].src, dir);
return INPUT_SourceNameAbbrevSwitch(tempstring, pc->elem[idx].src);
}
case ELEM_HTRIM:
case ELEM_VTRIM:
pc->elem[idx].src = GUI_TextSelectHelper(pc->elem[idx].src, 0, NUM_TRIMS, dir, 1, 1, NULL);
if (pc->elem[idx].src == 0)
return _tr("None");
snprintf(tempstring, sizeof(tempstring), "%s%d", _tr("Trim"),pc->elem[idx].src);
return tempstring;
}
return _tr("None");
}
示例2: MIXER_SRC_IS_INV
const char *set_drsource_cb(guiObject_t *obj, int dir, void *data)
{
(void) obj;
u8 *source = (u8 *)data;
u8 is_neg = MIXER_SRC_IS_INV(*source);
u8 changed;
u8 oldsrc = *source;
*source = GUI_TextSelectHelper(MIXER_SRC(*source), 0, NUM_SOURCES, dir, 1, 1, &changed);
MIXER_SET_SRC_INV(*source, is_neg);
if (changed) {
sync_mixers();
if ((!! MIXER_SRC(oldsrc)) ^ (!! MIXER_SRC(*source))) {
// bug fix (issues #191) : only invoke _update_rate_widgets() for expo template
if (mp->cur_template == MIXERTEMPLATE_EXPO_DR) {
if(data == &mp->mixer[1].sw)
_update_rate_widgets(0);
else if(data == &mp->mixer[2].sw)
_update_rate_widgets(1);
}
} else {
MIXPAGE_RedrawGraphs();
}
}
GUI_TextSelectEnablePress((guiTextSelect_t *)obj, MIXER_SRC(*source));
return INPUT_SourceName(mp->tmpstr, *source);
}
示例3: GUI_TextSelectHelper
static const char *ratesel_cb(guiObject_t *obj, int dir, void *data)
{
(void)obj;
(void)data;
dlog->rate = GUI_TextSelectHelper(dlog->rate, 0, DLOG_RATE_LAST-1, dir, 1, 1, NULL);
return DATALOG_RateString(dlog->rate);
}
示例4: GUI_TextSelectHelper
static const char *gyro_output_cb(guiObject_t *obj, int dir, void *data)
{
(void)obj;
(void)data;
u8 changed = 1;
gyro_output = GUI_TextSelectHelper(gyro_output, GYROOUTPUT_GEAR , GYROOUTPUT_AUX2, dir, 2, 2, &changed);
if (changed) { // switch gyro output between the gear and the aux2
// firstly: dynamically create mixes for target gyro channel
int i;
for (i = 0; i < GYROMIXER_COUNT; i ++) {
if(! mp->mixer_ptr[i])
break;
mp->mixer[i] = *mp->mixer_ptr[i];
mp->mixer[i].dest = gyro_output;
}
MIXER_SetTemplate(gyro_output, MIXERTEMPLATE_EXPO_DR);
// secondly: clear mix for original gyro channel
MIXER_SetTemplate(gyro_output == GYROOUTPUT_GEAR ? GYROOUTPUT_AUX2 : GYROOUTPUT_GEAR, MIXERTEMPLATE_NONE);
// save mixers
MIXER_SetMixers(mp->mixer, i);
// reload mixers because order may change
int count = STDMIX_GetMixers(mp->mixer_ptr, gyro_output, GYROMIXER_COUNT);
convert_output_to_percentile();
for (i = 0; i < count; i ++) {
GUI_Redraw(&gui->gyro[i]);
}
}
if (gyro_output == GYROOUTPUT_GEAR)
snprintf(tempstring, sizeof(tempstring), "%s/%s5", _tr("GEAR"), _tr("Ch"));
else
snprintf(tempstring, sizeof(tempstring), "%s/%s7", _tr("AUX2"), _tr("Ch"));
return tempstring;
}
示例5: MIXER_MUX
const char *set_mux_cb(guiObject_t *obj, int dir, void *data)
{
(void)obj;
(void)data;
u8 changed;
u8 mux = MIXER_MUX(mp->cur_mixer);
mux = GUI_TextSelectHelper(mux, MUX_REPLACE, MUX_LAST-1, dir, 1, 1, &changed);
if (changed) {
MIXER_SET_MUX(mp->cur_mixer, mux);
MIXPAGE_RedrawGraphs();
sync_mixers();
}
switch(mux) {
case MUX_REPLACE:
return _tr("replace");
case MUX_MULTIPLY:
return _tr("mult");
case MUX_ADD:
return _tr("add");
case MUX_MAX:
return _tr("max");
case MUX_MIN:
return _tr("min");
case MUX_DELAY:
return _tr("delay");
case MUX_LAST:
break;
}
return "";
}
示例6: GUI_TextSelectHelper
const char *newelem_cb(guiObject_t *obj, int dir, void *data)
{
(void)data;
(void)obj;
lp.newelem = GUI_TextSelectHelper(lp.newelem, 0, ELEM_LAST-1, dir, 1, 1, NULL);
return GetElemName(lp.newelem);
}
示例7: INPUT_SourceName
static const char *set_source_cb(guiObject_t *obj, int dir, void *data)
{
(void) obj;
u8 *source = (u8 *)data;
*source = GUI_TextSelectHelper(MIXER_SRC(*source), 0, NUM_SOURCES, dir, 1, 1, NULL);
return INPUT_SourceName(tp->tmpstr, MIXER_MapChannel(*source));
}
示例8: GUI_TextSelectHelper
static const char *rtc_display_cb(guiObject_t *obj, int dir, void *data)
{
(void)obj;
(void)data;
Transmitter.clock12hr = GUI_TextSelectHelper(Transmitter.clock12hr, 0, 1, dir, 1, 4, NULL);
return Transmitter.clock12hr ? _tr("12 hour") : _tr("24 hour");
}
示例9: GUI_TextSelectHelper
static const char *throhold_cb(guiObject_t *obj, int dir, void *data)
{
(void)obj;
(void)data;
u8 changed = 1;
u8 throhold_state = 0;
if (Model.limits[mapped_std_channels.throttle].safetysw)
throhold_state = 1; // here we set it either 1 or 0
throhold_state = GUI_TextSelectHelper(throhold_state, 0, 1, dir, 1, 1, &changed);
if (changed) {
if (throhold_state == 1) {
Model.limits[mapped_std_channels.throttle].safetysw = // bug fix: must use inverse position for hold switch
mapped_std_channels.switches[SWITCHFUNC_HOLD]
? 0x80 | mapped_std_channels.switches[SWITCHFUNC_HOLD] // inverse of '0'
: 0;
if (Model.limits[mapped_std_channels.throttle].safetyval == 0)
Model.limits[mapped_std_channels.throttle].safetyval = -110;
} else
Model.limits[mapped_std_channels.throttle].safetysw = 0;
}
if (throhold_state == 1) {
strcpy(mp->tmpstr, (const char *)_tr("On"));
GUI_TextSelectEnable(&gui->value, 1);
}
else {
strcpy(mp->tmpstr, (const char *)_tr("Off"));
GUI_TextSelectEnable(&gui->value, 0);
}
return mp->tmpstr;
}
示例10: GUI_TextSelectHelper
static const char *_vibration_state_cb(guiObject_t *obj, int dir, void *data)
{
(void)data;
(void)obj;
Transmitter.vibration_state = GUI_TextSelectHelper(Transmitter.vibration_state, 0, 1, dir, 1, 1, NULL);
return Transmitter.vibration_state ? "On" : "Off";
}
示例11: _tr
static const char *swashmix_val_cb(guiObject_t *obj, int dir, void *data)
{
(void)data;
if (!GUI_IsTextSelectEnabled(obj))
return _tr("None");
int i = (long)data;
u8 changed = 1;
swashmix[i] = GUI_TextSelectHelper(swashmix[i], -100, 100, dir, 1, 5, &changed);
if (changed) {
u8 mask = SWASH_INV_ELEVATOR_MASK;
switch (i) {
case 0: // aile
mask = SWASH_INV_AILERON_MASK;
break;
case 1: // elev
mask = SWASH_INV_ELEVATOR_MASK;
break;
default: // pit
mask = SWASH_INV_COLLECTIVE_MASK;
break;
}
if (swashmix[i] >= 0) {
Model.swashmix[i] = swashmix[i];
Model.swash_invert = Model.swash_invert & ~mask;
} else {
Model.swashmix[i] = -swashmix[i];
Model.swash_invert = Model.swash_invert | mask;
}
}
sprintf(tempstring, "%d", swashmix[i]);
return tempstring;
}
示例12: GUI_TextSelectHelper
static const char *swash_val_cb(guiObject_t *obj, int dir, void *data)
{
(void)obj;
(void)data;
u8 changed = 1;
Model.swash_type = GUI_TextSelectHelper(Model.swash_type, SWASH_TYPE_NONE , SWASH_TYPE_90, dir, 1, 1, &changed);
if (changed)
update_swashmixes();
switch(Model.swash_type) {
case SWASH_TYPE_NONE:
snprintf(tempstring, sizeof(tempstring), "1%s", _tr("Servo"));
break;
case SWASH_TYPE_120:
snprintf(tempstring, sizeof(tempstring), "3%s 120", _tr("Servo"));
break;
case SWASH_TYPE_120X:
snprintf(tempstring, sizeof(tempstring), "3%s 120x", _tr("Servo"));
break;
case SWASH_TYPE_140:
snprintf(tempstring, sizeof(tempstring), "3%s 140", _tr("Servo"));
break;
case SWASH_TYPE_90:
snprintf(tempstring, sizeof(tempstring), "3%s 90", _tr("Servo"));
break;
default:
break;
}
return tempstring;
}
示例13: strcpy
const char *set_source_cb(guiObject_t *obj, int dir, void *data)
{
(void) obj;
u8 *source = (u8 *)data;
if (!GUI_IsTextSelectEnabled(obj) ) {
strcpy(mp->tmpstr, _tr("None"));
return mp->tmpstr;
}
u8 is_neg = MIXER_SRC_IS_INV(*source);
u8 changed;
*source = GUI_TextSelectHelper(MIXER_SRC(*source), 1, NUM_SOURCES, dir, 1, 1, &changed);
MIXER_SET_SRC_INV(*source, is_neg);
if (changed) {
if(mp->cur_template == MIXERTEMPLATE_COMPLEX) {
guiObject_t *trim = _get_obj(COMPLEX_TRIM, 0);
if(trim) {
if (MIXER_SourceHasTrim(MIXER_SRC(mp->mixer[0].src)))
GUI_SetHidden(trim, 0);
else
GUI_SetHidden(trim, 1);
}
}
sync_mixers();
MIXPAGE_RedrawGraphs();
}
GUI_TextSelectEnablePress((guiTextSelect_t *)obj, MIXER_SRC(*source));
return INPUT_SourceName(mp->tmpstr, *source);
}
示例14: GUI_TextSelectHelper
const char *newelem_cb(guiObject_t *obj, int dir, void *data)
{
(void)data;
(void)obj;
const int last_elem = (HAS_TOUCH) ? ELEM_BATTERY : ELEM_LAST; //FIXME
lp->newelem = GUI_TextSelectHelper(lp->newelem, 0, last_elem-1, dir, 1, 1, NULL);
return GetElemName(lp->newelem);
}
示例15: GUI_TextSelectHelper
static const char *modeselect_cb(guiObject_t *obj, int dir, void *data)
{
(void)data;
(void)obj;
Transmitter.mode = GUI_TextSelectHelper(Transmitter.mode, MODE_1, MODE_4, dir, 1, 1, NULL);
snprintf(tempstring, sizeof(tempstring), _tr("Mode %d"), Transmitter.mode);
return tempstring;
}