When 'Play' is pressed, it turns to pause.
If song does not play (file not found or pmo/pmi error) the button should not 
become 'pause' really.
It should remain as 'play'.

Perhaps good solution would be not to do as:
[from HandleControlMessage()]
   if (oControlName == string("Play") && eMesg == CM_Pressed)
   {
           int iState = 0;

           // get control state
       m_pWindow->ControlIntValue(oControlName, false, iState);
       if (iState == 0) // PLAY
       {
           // set button state to PAUSE
           iState = 1;
           m_pWindow->ControlIntValue(oControlName, true, iState);
           m_pContext->target->AcceptEvent(new Event(CMD_Play));
           m_bPlayShown = false;
       }    
           else  // PAUSE
       {
           // set button state to PLAY
           iState = 0;
           m_pWindow->ControlIntValue(oControlName, true, iState);
           m_pContext->target->AcceptEvent(new Event(CMD_Pause));
           m_bPlayShown = true;
       }    
       return kError_NoErr;
   }



but to remove the above button manipulations and leave button state
transitions to code that already is under AcceptEvent():

      case INFO_Playing:
      {
         int iState = 1;
         m_pWindow->ControlIntValue(string("Play"), true, iState);
         m_bPlayShown = true;
         break;
      }   
      case INFO_Paused:
      case INFO_Stopped:
      {
         int iState = 0;
         m_pWindow->ControlIntValue(string("Play"), true, iState);
         m_bPlayShown = true;
         break;
      }   
      case INFO_DoneOutputting:


other:
[from HandeControlMessage()]
   if (oControlName == string("Stop") && eMesg == CM_Pressed)
   {
           int iState = 0;
       m_pWindow->ControlIntValue(oControlName, true, iState);
       m_pContext->target->AcceptEvent(new Event(CMD_Stop));
       m_bPlayShown = true;
       return kError_NoErr;
   }
what does code for Stop button do? My guess is disable it, but 
how do I know? I could not find where these transitons/states are
defined/documented... aarrgh.

--
Valters "WaTT" Vingolds

Reply via email to