Esempio n. 1
0
void CompOutput::OnText(wxCommandEvent &evt)
{
    bool clear = false;
    //SetValue shouldn't make dirty; only user's keypresses should
    if (m_setval)
        return;
    //PyPrintDebug(false, "value -> %s\n", evt.GetString().c_str());
    if (evt.GetString().empty())
        clear = true;

    switch (evt.GetId())
    {
    case ID_COMP_TIME:
        if (clear) ClearDirty(TIME_DIRTY);
        else AddDirty(TIME_DIRTY);
        break;
    case ID_COMP_SCORE_B:
        if (clear) ClearDirty(SCOREB_DIRTY);
        else AddDirty(SCOREB_DIRTY);
        break;
    case ID_COMP_SCORE_A: 
        if (clear) ClearDirty(SCOREA_DIRTY);
        else AddDirty(SCOREA_DIRTY);
        break;
    case ID_COMP_NAME_B:
        if (clear) ClearDirty(NAMEB_DIRTY);
        else AddDirty(NAMEB_DIRTY); 
        break;
    case ID_COMP_NAME_A:
        if (clear) ClearDirty(NAMEA_DIRTY);
        else AddDirty(NAMEA_DIRTY);
    }

}
Esempio n. 2
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CSoundSet::GetRandomNotDirtyFile()
//
//	PURPOSE:	Get a random sound from the set that has not been played recently
//
// ----------------------------------------------------------------------- //
const char* CSoundSet::GetRandomNotDirtyFile()
{
#if defined(PLATFORM_WIN32) || defined(PLATFORM_LINUX)
    //if we're not set up or we have no files, bail
    if (!m_hRecord || !m_nTotalWeight || !m_vecWeights.size())
        return "";

    HATTRIBUTE hFiles =	g_pLTDatabase->GetAttribute(m_hRecord,SndDB_sSoundFile);

    //only got one, return it
    if (m_vecWeights.size() == 1)
        return g_pLTDatabase->GetString(hFiles,0,"");

    uint32 nRand = GetRandom(0,m_nTotalWeight-1);

    uint32 n;
    for ( n = 0; n < m_vecWeights.size(); ++n)
    {
        if (nRand < m_vecWeights[n])
            break;
    }

    bool bFoundClean = false;
    uint32 nStart = n;
    while (!bFoundClean)
    {
        //found a clean one
        if (!m_vecDirty[n])
        {
            m_vecDirty[n] = true;
            return g_pLTDatabase->GetString(hFiles,n,"");
        }

        //it's dirty check the next one
        n = (n + 1) % m_vecWeights.size();

        //all dirty
        if (n == nStart)
        {
            ClearDirty();
            m_vecDirty[n] = true;
            return g_pLTDatabase->GetString(hFiles,n,"");
        }

    }

    //if we got this far, just return the first value
    m_vecDirty[0] = true;
    return g_pLTDatabase->GetString(hFiles,0,"");
#endif //PLATFORM_WIN32 || PLATFORM_LINUX


#ifdef PLATFORM_XENON
    //if we're not set up or we have no files, bail
    if (!m_hRecord)
        return "";

    HATTRIBUTE hCue = g_pLTDatabase->GetAttribute(m_hRecord,SndDB_sXActCue);

    if (hCue)
    {
        return g_pLTDatabase->GetString(hCue,0,"");
    }
    else
    {
        return "";
    }
#endif // PLATFORM_XENON

}
Esempio n. 3
0
File: GText.cpp Progetto: FEI17N/Lgi
void TextView::OnSave()
{
	ClearDirty(FALSE);
}