diff options
author | wm4 <wm4@nowhere> | 2012-09-18 14:00:08 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-12 10:10:31 +0200 |
commit | cac7702565b560d5a16bc82bf553d1a4c08297e1 (patch) | |
tree | 5d1246e28da246dc26fa54de267c35545ac0f09f /m_property.h | |
parent | 3d67041089c7945dcea0162c0038e495d588b379 (diff) | |
download | mpv-cac7702565b560d5a16bc82bf553d1a4c08297e1.tar.bz2 mpv-cac7702565b560d5a16bc82bf553d1a4c08297e1.tar.xz |
commands: handle property stepping in a generic way
Instead of forcing each property implementation implement its own logic
for M_PROPERTY_STEP_UP/M_PROPERTY_STEP_DOWN, handle it in the generic
property code.
Rename the M_PROPERTY_STEP_UP command to M_PROPERTY_SWITCH (the other
property command, M_PROPERTY_STEP_DOWN, isn't needed anymore: stepping
downwards is done by passing a negative argument). Always use double as
argument type; it makes the code easier, and covers all property types.
Move the code which does the actual type-specific value stepping to
m_option.c (the idea is that m_option handles types).
Some properties still have custom handlers implemented with
M_PROPERTY_SWITCH. They can't be mapped to the generic mechanism,
because their value range is dynamic or entirely unknown.
For some properties, the default step stride is changed to 1. This is no
issue, because the default bindings in input.conf all use an explicit
stride in the affected cases.
Diffstat (limited to 'm_property.h')
-rw-r--r-- | m_property.h | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/m_property.h b/m_property.h index 902f38c77e..180dbbf618 100644 --- a/m_property.h +++ b/m_property.h @@ -58,18 +58,6 @@ */ #define M_PROPERTY_PARSE 3 -/// Increment the current value. -/** The sign of the argument is also taken into account if applicable. - * \param arg Pointer to a variable of the right type or NULL. - */ -#define M_PROPERTY_STEP_UP 4 - -/// Decrement the current value. -/** The sign of the argument is also taken into account if applicable. - * \param arg Pointer to a variable of the right type or NULL. - */ -#define M_PROPERTY_STEP_DOWN 5 - /// Get a string containg a parsable representation. /** Set the variable to a newly allocated string or NULL. * \param arg Pointer to a char* variable. @@ -82,6 +70,10 @@ /// Get a m_option describing the property. #define M_PROPERTY_GET_TYPE 8 +// Switch the property up/down by a given value. +// arg: (double) value to add to the property +#define M_PROPERTY_SWITCH 9 + ///@} /// \defgroup PropertyActionsArg Property actions argument type |