committed by
Damjan Adamic
parent
0b0059908c
commit
8626c0728c
@@ -908,12 +908,12 @@ QString CustomFunctionData::paramToString(const ModelData * model) const
|
||||
}
|
||||
else if ((func>=FuncAdjustGV1) && (func<FuncCount)) {
|
||||
switch (adjustMode) {
|
||||
case 0:
|
||||
case FUNC_ADJUST_GVAR_CONSTANT:
|
||||
return QObject::tr("Value ")+QString("%1").arg(param);
|
||||
case 1:
|
||||
case 2:
|
||||
case FUNC_ADJUST_GVAR_SOURCE:
|
||||
case FUNC_ADJUST_GVAR_GVAR:
|
||||
return RawSource(param).toString();
|
||||
case 3:
|
||||
case FUNC_ADJUST_GVAR_INCDEC:
|
||||
if (param==0) return QObject::tr("Decr:") + " -1";
|
||||
else return QObject::tr("Incr:") + " +1";
|
||||
}
|
||||
|
||||
@@ -608,6 +608,14 @@ enum AssignFunc {
|
||||
FuncReserve = -1
|
||||
};
|
||||
|
||||
enum GVarAdjustModes
|
||||
{
|
||||
FUNC_ADJUST_GVAR_CONSTANT,
|
||||
FUNC_ADJUST_GVAR_SOURCE,
|
||||
FUNC_ADJUST_GVAR_GVAR,
|
||||
FUNC_ADJUST_GVAR_INCDEC
|
||||
};
|
||||
|
||||
class CustomFunctionData { // Function Switches data
|
||||
public:
|
||||
CustomFunctionData(AssignFunc func=FuncOverrideCH1) { clear(); this->func = func; }
|
||||
|
||||
@@ -2115,12 +2115,17 @@ class ArmCustomFunctionField: public TransformedField {
|
||||
}
|
||||
}
|
||||
|
||||
static bool hasRepeatParam(const CustomFunctionData & fn)
|
||||
{
|
||||
return (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic);
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
if (fn.swtch.type != SWITCH_TYPE_NONE) {
|
||||
_func = fn.func;
|
||||
|
||||
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast))
|
||||
if (hasRepeatParam(fn))
|
||||
_active = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5));
|
||||
else
|
||||
_active = (fn.enabled ? 1 : 0);
|
||||
@@ -2216,7 +2221,7 @@ class ArmCustomFunctionField: public TransformedField {
|
||||
{
|
||||
fn.func = (AssignFunc)_func;
|
||||
|
||||
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast))
|
||||
if (hasRepeatParam(fn))
|
||||
fn.repeatParam = (version >= 216 ? _active : (_active*5));
|
||||
else
|
||||
fn.enabled = (_active & 0x01);
|
||||
|
||||
@@ -367,8 +367,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
}
|
||||
else if (func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) {
|
||||
if (modified) cfn.adjustMode = fswtchGVmode[i]->currentIndex();
|
||||
widgetsMask |= CUSTOM_FUNCTION_GV_MODE | (IS_ARM(firmware->getBoard()) ? CUSTOM_FUNCTION_REPEAT : CUSTOM_FUNCTION_ENABLE);
|
||||
if (cfn.adjustMode==0 || cfn.adjustMode==3) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_GV_MODE | CUSTOM_FUNCTION_ENABLE;
|
||||
if (cfn.adjustMode==FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode==FUNC_ADJUST_GVAR_INCDEC) {
|
||||
if (modified) cfn.param = fswtchParam[i]->value();
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
|
||||
Reference in New Issue
Block a user