Exemple #1
0
void Plugin_Commercial::OnEdit()
{
    CCString s;
    LLSegment NewSegment;
    int iSegment;
    int iItem = this->cRanges.GetSelectionMark();

    if(iItem == -1) return;


    this->cRanges.GetItemText(iItem, COLUMN_ID, &s);
    iSegment = s.ToInt(10);

    // Delete that one.
    LLSegment* p = NULL;
    int nSegments;

    if(FAILED(this->pCore->db.GetSegmentCount(&nSegments, &this->pCore->Log)))
    {
        return;
    }

    p = (LLSegment*)malloc(sizeof(LLSegment) * nSegments);

    if(FAILED(this->pCore->db.GetSegmentData(p, &this->pCore->Log)))
    {
        free(p);
        return;
    }

    NewSegment.dwIn = p[iSegment].dwIn;
    NewSegment.dwOut = p[iSegment].dwOut;
    NewSegment.dwSize = p[iSegment].dwSize;

    if(FAILED(GetSegmentDataDlg(&NewSegment, this->cMainWindow)))
    {
        free(p);
        return;
    }

    p[iSegment].dwIn = NewSegment.dwIn;
    p[iSegment].dwOut = NewSegment.dwOut;
    p[iSegment].dwSize = NewSegment.dwSize;

    if(FAILED(this->pCore->db.SetSegmentData(nSegments, p, &this->pCore->Log)))
    {
        free(p);
        return;
    }

    LL_DBUPDATE_STRUCT us;
    us.dwOperation = DBUPDATE_CHANGED;
    us.dwType = DBUPDATE_SEGMENT;
    this->pCore->SendPluginMessage(LL_DBUPDATE, &us);

    free(p);
    return;
}
Exemple #2
0
void Plugin_Commercial::OnRemove()
{
    int iSegment;
    int iItem = this->cRanges.GetSelectionMark();
    if(iItem == -1) return;

    CCString s;

    this->cRanges.GetItemText(iItem, COLUMN_ID, &s);
    iSegment = s.ToInt(10);

    // Delete that one.
    LLSegment* p = NULL;
    int nSegments;

    if(FAILED(this->pCore->db.GetSegmentCount(&nSegments, &this->pCore->Log)))
    {
        return;
    }

    p = (LLSegment*)malloc(sizeof(LLSegment) * nSegments);

    if(FAILED(this->pCore->db.GetSegmentData(p, &this->pCore->Log)))
    {
        free(p);
        return;
    }

    // Close the gap.
    PVOID pFrom = &p[iSegment + 1];
    PVOID pTo = &p[iSegment];
    int nLen = (nSegments - (iSegment+1)) * sizeof(LLSegment);
    memmove(pTo, pFrom, nLen);

    nSegments --;

    if(FAILED(this->pCore->db.SetSegmentData(nSegments, p, &this->pCore->Log)))
    {
        free(p);
        return;
    }

    free(p);

    LL_DBUPDATE_STRUCT us;
    us.dwOperation = DBUPDATE_CHANGED;
    us.dwType = DBUPDATE_SEGMENT;
    this->pCore->SendPluginMessage(LL_DBUPDATE, &us);

    return;
}
Exemple #3
0
void CALLBACK Plugin_Playback::NotificationProc(PVOID pUser, DWORD dwMsg, PVOID pParams)
{
    Plugin_Playback* pThis = (Plugin_Playback*)pUser;

    switch(dwMsg)
    {
    case LL_COMPLETE:
        {
            LL_SEEKEPISODE_STRUCT* lse = (LL_SEEKEPISODE_STRUCT*)pParams;

            // Advance to the next episode automatically.
            GUID idNew;
            LLEpisode ThisEpisode;

            if(pThis->bIsDragging == FALSE)
            {
                if(FAILED(pThis->pCore->db.GetEpisode(
                    lse->guidEpisode, &ThisEpisode, &pThis->pCore->Log)))
                {
                    //
                    return;
                }

                if(FAILED(pThis->pCore->db.GetNextEpisode(
                    MAKELLTIME(ThisEpisode.dwYear, ThisEpisode.dwMonth, ThisEpisode.dwDay),
                    &idNew, &pThis->pCore->Log)))
                {
                    // Gracefully cancel....
                    return;
                }

                // Seek to that episode.
                pThis->pCore->SeekEpisode(idNew, 0);
            }

            break;
        }
    case LL_SEEKEPISODE:
        {
            LL_SEEKEPISODE_STRUCT* lse = (LL_SEEKEPISODE_STRUCT*)pParams;
            pThis->Refresh();
            break;
        }
    case LL_SEEKCURRENT:
        {
            LL_SEEKCURRENT_STRUCT* lsc = (LL_SEEKCURRENT_STRUCT*)pParams;
			GUID id;
			pThis->pCore->GetCurrentEpisode(&id);
			pThis->UpdateNav(lsc->dwMS, id);
            pThis->NotifySeekCurrent();
            break;
        }
    case LL_SETFOCUS:
        {
            break;
        }
    case LL_INITIALIZE:
        {
            // Grab the last saved position and travel there..
            GUID guid;
            DWORD dwPos;

            if(FAILED(pThis->pCore->db.GetLastPosition(
                &guid, &dwPos, &pThis->pCore->Log)))
            {
                // Use defaults.
                dwPos = 0;
                ZeroMemory(&guid, sizeof(GUID));
            }

            // Load settings and set them up.
            CCString s;

            if(SUCCEEDED(
                pThis->pCore->db.GetSetting(
                L"Playback_IsPlaying", &s, &pThis->pCore->Log)))
            {
                if(s.ToInt(10) == TRUE) pThis->pCore->Player.Play(&pThis->pCore->Log);
            }

            if(SUCCEEDED(
                pThis->pCore->db.GetSetting(
                L"Playback_Volume", &s, &pThis->pCore->Log)))
            {
                pThis->pCore->Player.SetVolume(s.ToInt(10), &pThis->pCore->Log);
                pThis->cVol.SetPos(s.ToInt(10));
            }

            pThis->pCore->SeekEpisode(guid, dwPos);
            break;
        }
    case LL_DBUPDATE:
        {
            // The database has changed.  Pretty much we have to 
            // force the display to be updated.
            pThis->Refresh();
            break;
        }
    case LL_ATTACH:
        {
            LL_ATTACH_STRUCT* pas = (LL_ATTACH_STRUCT*)pParams;
            StandardPlugins* psp = (StandardPlugins*)pas->pUserData;
            pThis = (Plugin_Playback*)psp->pPlayback;

            pThis->pPlugins = psp;
            pThis->pCore = pas->pCore;

            pThis->Create();

            pas->hWnd = pThis->cMainWindow;
            pas->pUserData = pThis;

            break;
        }
    case LL_DETACH:
        {
            pThis->Destroy();
            break;
        }
    }

    return;
}