On 28 Feb, Valters Vingolds wrote:
> 
> problem:
> maybe you have noticed that tooltip support goes dead after you switch themes.
> (after you change to another theme, tooltips won't display).
> 
> resolution:
> that happens because for some reason in Win32Window::CreateTooltips()
> is this code:
> 
>     if (m_bMindMeldInProgress)
>       return;

Good catch -- I just fixed it in cvs.

> Sorry for not using bugzilla. Keep up the good work! I'll be back a bit
> later, maybe bearing some code :) Actually I want to implement "knob"
> control (so one could convert some of those immensely cool kjofol skins to
> freeamp).  Maybe you can explain me about the state table (TransitionsInfo)
> - I can't seem to figure it out. 

Each control is a finite state machine. A finite state machine is a
piece of code that has a clearly defined set of states, and when
certain actions happen, the finite state machine transitions from one
state to another state. When the machine transitions state, it usually
means that there is some action that gets triggered.

static TransitionInfo pTransitions[] =
{
    // Curr. state   Transition           Next state
    { CS_Normal,     CT_MouseEnter,       CS_MouseOver  },
     .  .  .
    { CS_MouseOver,  CT_MouseLeave,       CS_Normal     },
     .  .  .
};

In the table above are two example transitions taken from the button
control state table. CS_Normal (For ControlState Normal) means the
button is is the normal state (no mouse over, not disabled, etc). When
the control gets a CT_MouseEnter (ControlTransition MouseEnter)
transition (sent by the freeamp theme when the mouse enters the
boundary of the control) the state changes to CS_MouseOver. When the
mouse leaves the control the theme sends the CT_MouseLeave transition 
and the state goes back to normal. There obviously are many more states
to this control, but these two are the most basic as an example. Look
at the /ui/freeamp/src/ButtonControl.cpp:Transition function to check
out the case statement that carries out the various BltFunctions as the
control accepts transitions from one state to another.

So, by adding and removing states from the table you can change the
behaviour of the control without having to write many complicated
if-then statements. 

Can you tell I like FSMs? Very powerful stuff!



--ruaok         Freezerburn! All else is only icing. -- Soul Coughing

Robert Kaye -- [EMAIL PROTECTED]  http://moon.eorbit.net/~robert

_______________________________________________
[EMAIL PROTECTED]
http://www.freeamp.org/mailman/listinfo/freeamp-dev

Reply via email to