Example #1
0
File: idct.c Project: Jsoucek/q3ce
int CodecIDCTSetCount(codecidct* p, int Count)
{
	if (!p->IDCT.Ptr)
		return ERR_NONE;
	p->IDCT.Ptr->Set(p->IDCT.Ptr,IDCT_BUFFERCOUNT,&Count,sizeof(int));
	return UpdateCount(p);
}
Example #2
0
EventViewer::EventViewer(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::EventViewer), _ct(0), _colors(ds::TraceColors())
{
    ui->setupUi(this);

    _evTimer.setSingleShot(true);
    ui->lblEvent->setAutoFillBackground(true);

    connect(&_evTimer, SIGNAL(timeout()), this, SLOT(RevertLabel()), Qt::QueuedConnection);
    connect(&_updateTimer, SIGNAL(timeout()), this, SLOT(UpdateCount()), Qt::QueuedConnection);
    ui->buttonGroup->setId(ui->rbtnAbove, ABOVE);
    ui->buttonGroup->setId(ui->rbtnBelow, BELOW);

    ui->qwtEventRate->setAxisTitle( QwtPlot::xBottom, "Time" );
    ui->qwtEventRate->setAxisTitle( QwtPlot::yLeft, "Thresh. crossings per unit time x1000" );

    _sdfCurve = new QwtPlotCurve;
    _sdfCurve->setPen( QPen(_colors.at(0)) );
    _sdfCurve->attach(ui->qwtEventRate);

    //Hide these until they're actually implemented
//    ui->qwtEventRate->hide();
//    ui->edRowLen->hide();
//    ui->lblRowLen->hide();
}
Example #3
0
void wxSimpleHtmlListBox::DoDeleteOneItem(unsigned int n)
{
    m_items.RemoveAt(n);

    m_HTMLclientData.RemoveAt(n);

    UpdateCount();
}
Example #4
0
void wxSimpleHtmlListBox::DoClear()
{
    wxASSERT(m_items.GetCount() == m_HTMLclientData.GetCount());

    m_items.Clear();
    m_HTMLclientData.Clear();

    UpdateCount();
}
Example #5
0
void __fastcall TfrmBonePart::tvPartDragDrop(TObject *Sender,
        TObject *Source, int X, int Y)
{
    for (int k=0; k<(int)FDragItems.size(); k++) {
        FHelper.AppendObject(((TElTree*)Sender),FDragItems[k]->Text,false,true);
        FDragItems[k]->Delete();
    }
    FDragItems.clear();
    UpdateCount();
}
Example #6
0
/*
void __fastcall TfrmBonePart::ebAllClick(TObject *Sender)
{
	TExtBtn* B = dynamic_cast<TExtBtn*>(Sender); VERIFY(B); int idx = B->Tag;
    T[idx]->IsUpdating = true;
    T[idx]->Items->Clear();
    for (BoneIt it=m_EditObject->FirstBone(); it!=m_EditObject->LastBone(); it++)
        FHelper.AppendObject(T[idx],(*it)->Name(),false,true);
    T[idx]->IsUpdating = false;
    UpdateCount();
}
*/
void __fastcall TfrmBonePart::ebClearClick(TObject *Sender)
{
    TExtBtn* B = dynamic_cast<TExtBtn*>(Sender);
    VERIFY(B);
    int idx = B->Tag;
    T[idx]->IsUpdating = true;
    T[idx]->Items->Clear();
    T[idx]->IsUpdating = false;
    UpdateCount();
}
Example #7
0
    long long int GetCount() {
        if ((h_*w_) % 2 == 1) return 0;

        int comp_line = 0;
        for(int i=0; i<h_; ++i) {
            for (int j=0; j<case_num_; ++j) {
                if (0 < cnts_[i][j]) { UpdateCount(i, j, 0, comp_line); }
            }
        }

        return cnts_[h_][0];
    }
Example #8
0
void __fastcall TfrmBonePart::ExtBtn1Click(TObject *Sender)
{
    for (int k=0; k<4; k++) T[k]->IsUpdating = true;
    for (k=0; k<4; k++) {
        T[k]->Items->Clear();
        E[k]->Text="";
    }
    E[0]->Text = "default";
    for (BoneIt it=m_EditObject->FirstBone(); it!=m_EditObject->LastBone(); it++)
        FHelper.AppendObject(T[0],(*it)->Name().c_str(),false,true);
    for (k=0; k<4; k++) T[k]->IsUpdating = false;
    UpdateCount();
}
Example #9
0
void __fastcall TfrmBonePart::FillBoneParts()
{
    for (int k=0; k<4; k++) T[k]->IsUpdating = true;
    for (k=0; k<4; k++) {
        T[k]->Items->Clear();
        E[k]->Text="";
    }
    for (BPIt it=m_BoneParts->begin(); it!=m_BoneParts->end(); it++) {
        E[it-m_BoneParts->begin()]->Text = it->alias.c_str();
        for (RStringVecIt w_it=it->bones.begin(); w_it!=it->bones.end(); w_it++)
            FHelper.AppendObject(T[it-m_BoneParts->begin()],w_it->c_str(),false,true);
    }
    for (k=0; k<4; k++) T[k]->IsUpdating = false;
    lbTotalBones->Caption = m_EditObject->BoneCount();
    UpdateCount();
}
Example #10
0
void CTabProfsDlg::SetProfs(CObList &list)
{
	ClearCounts();

	CProfData *pData;
	POSITION pos = list.GetHeadPosition();
	while(pos)
	{
		pData = (CProfData*)list.GetNext(pos);
		UpdateCount(pData->m_chProf,pData->m_nFirstClass,pData->m_nSecondClass);

		// Clear the list, it isn't needed anymore and will save the view from
		// having to do it.
		delete pData;
	}

	list.RemoveAll();
}
Example #11
0
int wxSimpleHtmlListBox::DoInsertItems(const wxArrayStringsAdapter& items,
                                       unsigned int pos,
                                       void **clientData,
                                       wxClientDataType type)
{
    const unsigned int count = items.GetCount();

    m_items.Insert(wxEmptyString, pos, count);
    m_HTMLclientData.Insert(NULL, pos, count);

    for ( unsigned int i = 0; i < count; ++i, ++pos )
    {
        m_items[pos] = items[i];
        AssignNewItemClientData(pos, clientData, i, type);
    }

    UpdateCount();

    return pos - 1;
}
Example #12
0
BOOL CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_INITDIALOG:
		// Set Class icon
		g_OldIcon = SetClassLong(hDlg, GCL_HICON, (LONG)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON)));

		SetTimer(hDlg, 1, 100, NULL);
		return TRUE;  // return FALSE if modeless and SetFocus is called

	case WM_TIMER:
		UpdateTimer(hDlg);
		return TRUE;

	case WM_MOUSEMOVE:
		UpdateCount(LOWORD(lParam), HIWORD(lParam));
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDCANCEL:
			// Quit program...

			KillTimer(hDlg, 1);

			// Remove Class icon
			SetClassLong(hDlg, GCL_HICON, g_OldIcon);

			EndDialog(hDlg, 0);  // Close dialogwindow
			return TRUE;
		}
		break;
	}

	return FALSE;
}
Example #13
0
File: idct.c Project: Jsoucek/q3ce
static bool_t Prepair(codecidct* p)
{
	int Result;
	idct* IDCT = p->IDCT.Ptr;
	p->IDCT.Count = 0;

	if (!IDCT || !p->IDCT.Format.Pixel.Flags)
		return ERR_NONE;

	Result = IDCT->Set(IDCT,IDCT_BUFFERWIDTH,&p->IDCT.Width,sizeof(int));
	if (Result != ERR_NONE) return Result;
	Result = IDCT->Set(IDCT,IDCT_BUFFERHEIGHT,&p->IDCT.Height,sizeof(int));
	if (Result != ERR_NONE) return Result;
	Result = IDCT->Set(IDCT,IDCT_FORMAT,&p->IDCT.Format,sizeof(video));
	if (Result != ERR_NONE) return Result;

	IDCT->Set(IDCT,IDCT_BUFFERCOUNT,&p->MinCount,sizeof(int));
	if (p->DefCount > p->MinCount) // optional
		IDCT->Set(IDCT,IDCT_BUFFERCOUNT,&p->DefCount,sizeof(int));
	IDCT->Drop(IDCT);

	return UpdateCount(p);
}
Example #14
0
static void messagePos( TidyDocImpl* doc, TidyReportLevel level, uint code,
                        int line, int col, ctmbstr msg, va_list args )
{
    enum { sizeMessageBuf=2048 };
    char *messageBuf = TidyDocAlloc(doc,sizeMessageBuf);
    Bool go = UpdateCount( doc, level );

    if ( go )
    {
        va_list args_copy;
        va_copy(args_copy, args);
        TY_(tmbvsnprintf)(messageBuf, sizeMessageBuf, msg, args);
        if ( doc->mssgFilt )
        {
            TidyDoc tdoc = tidyImplToDoc( doc );
            go = doc->mssgFilt( tdoc, level, line, col, messageBuf );
        }
        if ( doc->mssgFilt2 )
        {
            /* mssgFilt2 is intended to allow LibTidy users to localize
               messages via their own means by providing a key string and
               the parameters to fill it. For the key string to remain
               consistent, we have to ensure that we only ever return the
               built-in English version of this string. */
            TidyDoc tdoc = tidyImplToDoc( doc );
            go = go | doc->mssgFilt2( tdoc, level, line, col, tidyDefaultString(code), args_copy );
        }
        if ( doc->mssgFilt3 )
        {
            /* mssgFilt3 is intended to allow LibTidy users to localize
               messages via their own means by providing a key string and
               the parameters to fill it. */
            TidyDoc tdoc = tidyImplToDoc( doc );
            go = go | doc->mssgFilt3( tdoc, level, line, col, tidyErrorCodeAsString(code), args_copy );
        }
    }

    if ( go )
    {
        enum { sizeBuf=1024 };
        char *buf = TidyDocAlloc(doc,sizeBuf);
        const char *cp;
        if ( line > 0 && col > 0 )
        {
            ReportPosition(doc, line, col, buf, sizeBuf);
#if !defined(NDEBUG) && defined(_MSC_VER)
            SPRTF("%s",buf);
#endif
            for ( cp = buf; *cp; ++cp )
                TY_(WriteChar)( *cp, doc->errout );
        }

        LevelPrefix( level, buf, sizeBuf );
#if !defined(NDEBUG) && defined(_MSC_VER)
            SPRTF("%s",buf);
            SPRTF("%s\n",messageBuf);
#else
        for ( cp = buf; *cp; ++cp )
            TY_(WriteChar)( *cp, doc->errout );

        for ( cp = messageBuf; *cp; ++cp )
            TY_(WriteChar)( *cp, doc->errout );
        TY_(WriteChar)( '\n', doc->errout );
#endif
        TidyDocFree(doc, buf);
    }
    TidyDocFree(doc, messageBuf);
}
Example #15
0
static void messagePos( TidyDocImpl* doc, TidyReportLevel level, uint code,
                        int line, int col, ctmbstr msg, va_list args )
{
    enum { sizeMessageBuf=2048 };
    char *messageBuf = TidyDocAlloc(doc,sizeMessageBuf);
    Bool go = UpdateCount( doc, level );

    if ( go )
    {
        va_list args_copy;
        va_copy(args_copy, args);
        TY_(tmbvsnprintf)(messageBuf, sizeMessageBuf, msg, args_copy);
        if ( doc->mssgFilt )
        {
            TidyDoc tdoc = tidyImplToDoc( doc );
            go = doc->mssgFilt( tdoc, level, line, col, messageBuf );
        }
        if ( doc->mssgFilt2 )
        {
            /* mssgFilt2 is intended to allow LibTidy users to localize
               messages via their own means by providing a key string and
               the parameters to fill it. For the key string to remain
               consistent, we have to ensure that we only ever return the
               built-in English version of this string. */
            TidyDoc tdoc = tidyImplToDoc( doc );
            va_end(args_copy);
            va_copy(args_copy, args);
            go = go | doc->mssgFilt2( tdoc, level, line, col, tidyDefaultString(code), args_copy );
        }
        if ( doc->mssgFilt3 )
        {
            /* mssgFilt3 is intended to allow LibTidy users to localize
               messages via their own means by providing a key string and
               the parameters to fill it. */
            TidyDoc tdoc = tidyImplToDoc( doc );
            va_end(args_copy);
            va_copy(args_copy, args);
            go = go | doc->mssgFilt3( tdoc, level, line, col, tidyErrorCodeAsString(code), args_copy );
        }
        va_end(args_copy);
    }

    if ( go )
    {
        enum { sizeBuf=1024 };
        TidyOutputSink *outp = &doc->errout->sink;
        char *buf = (char *)TidyDocAlloc(doc,sizeBuf);
        const char *cp;
        byte b;
        if ( line > 0 && col > 0 )
        {
            ReportPosition(doc, line, col, buf, sizeBuf);
            for ( cp = buf; *cp; ++cp )
            {
                b = (*cp & 0xff);
                outp->putByte( outp->sinkData, b );
            }
        }

        LevelPrefix( level, buf, sizeBuf );
        for ( cp = buf; *cp; ++cp )
        {
            b = (*cp & 0xff);
            outp->putByte( outp->sinkData, b );
        }
        for ( cp = messageBuf; *cp; ++cp )
        {
            b = (*cp & 0xff);
            outp->putByte( outp->sinkData, b );
        }
        TY_(WriteChar)( '\n', doc->errout );
        TidyDocFree(doc, buf);
    }
    TidyDocFree(doc, messageBuf);
}
Example #16
0
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
int
main(void)
{
    uint32_t ui32Read, ui32Write;

    //
    // Run from the PLL at 120 MHz.
    //
    g_ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                         SYSCTL_OSC_MAIN |
                                         SYSCTL_USE_PLL |
                                         SYSCTL_CFG_VCO_480), 120000000);

    //
    // Configure the device pins.
    //
    PinoutSet();

    //
    // Initialize the display driver.
    //
    Kentec320x240x16_SSD2119Init(g_ui32SysClock);

    //
    // Initialize the graphics context.
    //
    GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119);

    //
    // Draw the application frame.
    //
    FrameDraw(&g_sContext, "usb-dev-msc");

    //
    // Place the static status text on the display.
    //
    GrStringDrawCentered(&g_sContext, "Status", -1, 160, 58, false);
    GrStringDrawCentered(&g_sContext, "Bytes Read", -1, 160, 118, false);
    GrStringDrawCentered(&g_sContext, "Bytes Written", -1, 160, 178, false);
    GrContextForegroundSet(&g_sContext, ClrGray);
    UpdateCount(0, 138);
    UpdateCount(0, 198);

    //
    // Configure SysTick for a 100Hz interrupt.  This is to detect idle state
    // every 10ms after a state change.
    //
    ROM_SysTickPeriodSet(g_ui32SysClock / 100);
    ROM_SysTickEnable();
    ROM_SysTickIntEnable();

    //
    // Configure and enable uDMA
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    SysCtlDelay(10);
    ROM_uDMAControlBaseSet(&psDMAControlTable[0]);
    ROM_uDMAEnable();

    //
    // Initialize the idle timeout and reset all flags.
    //
    g_ui32IdleTimeout = 0;
    g_ui32Flags = 0;

    //
    // Initialize the state to idle.
    //
    g_eMSCState = MSC_DEV_DISCONNECTED;

    //
    // Draw the status bar and set it to idle.
    //
    UpdateStatus("Disconnected");

    //
    // Enable the USB controller.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);

    //
    // Enable the SSI3 used by SPI flash.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
    ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_SSI3);

    //
    // Set the USB stack mode to Device mode with VBUS monitoring.
    //
    USBStackModeSet(0, eUSBModeDevice, 0);

    //
    // Pass our device information to the USB library and place the device
    // on the bus.
    //
    USBDMSCInit(0, (tUSBDMSCDevice*)&g_sMSCDevice);

    //
    // Initialize the SD card, if present.  This prevents it from interfering
    // with accesses to the SPI flash.
    //
    disk_initialize(0);

    //
    // Initialize MX66L51235F Flash memory.
    //
    MX66L51235FInit(g_ui32SysClock);

    //
    // Drop into the main loop.
    //
    ui32Read = g_ui32ReadCount;
    ui32Write = g_ui32WriteCount;
    while(1)
    {
        switch(g_eMSCState)
        {
            case MSC_DEV_READ:
            {
                //
                // Update the screen if necessary.
                //
                if(g_ui32Flags & FLAG_UPDATE_STATUS)
                {
                    UpdateStatus("        Reading        ");
                    g_ui32Flags &= ~FLAG_UPDATE_STATUS;
                }

                //
                // If there is no activity then return to the idle state.
                //
                if(g_ui32IdleTimeout == 0)
                {
                    UpdateStatus("        Idle        ");
                    g_eMSCState = MSC_DEV_IDLE;
                }

                break;
            }

            case MSC_DEV_WRITE:
            {
                //
                // Update the screen if necessary.
                //
                if(g_ui32Flags & FLAG_UPDATE_STATUS)
                {
                    UpdateStatus("        Writing        ");
                    g_ui32Flags &= ~FLAG_UPDATE_STATUS;
                }

                //
                // If there is no activity then return to the idle state.
                //
                if(g_ui32IdleTimeout == 0)
                {
                    UpdateStatus("        Idle        ");
                    g_eMSCState = MSC_DEV_IDLE;
                }
                break;
            }

            case MSC_DEV_DISCONNECTED:
            {
                //
                // Update the screen if necessary.
                //
                if(g_ui32Flags & FLAG_UPDATE_STATUS)
                {
                    UpdateStatus("        Disconnected        ");
                    g_ui32Flags &= ~FLAG_UPDATE_STATUS;
                }
                break;
            }

            case MSC_DEV_IDLE:
            {
                break;
            }

            default:
            {
                break;
            }
        }

        //
        // Update the read count if it has changed.
        //
        if(g_ui32ReadCount != ui32Read)
        {
            ui32Read = g_ui32ReadCount;
            UpdateCount(ui32Read, 138);
        }

        //
        // Update the write count if it has changed.
        //
        if(g_ui32WriteCount != ui32Write)
        {
            ui32Write = g_ui32WriteCount;
            UpdateCount(ui32Write, 198);
        }
    }
}
Example #17
0
File: idct.c Project: Jsoucek/q3ce
static int SetIDCT(codecidct* p, idct* Dst)
{
	int Count;
	blitfx FX;
	planes SrcPlanes,DstPlanes;
	int SrcBrightness,DstBrightness;
	int No;
	int Result;
	idct* Src = p->IDCT.Ptr;

	if (Src == Dst)
		return ERR_NONE;

	if (!Src)
	{
		p->IDCT.Ptr = Dst;
		Result= Prepair(p);
		if (Result != ERR_NONE)
			p->IDCT.Ptr = NULL;
		return Result;
	}

	if (Dst)
	{
		assert(NodeIsClass(Dst->Class,IDCT_CLASS));

		Result = Dst->Set(Dst,IDCT_BUFFERWIDTH,&p->IDCT.Width,sizeof(int));
		if (Result != ERR_NONE)	return Result;
		Result = Dst->Set(Dst,IDCT_BUFFERHEIGHT,&p->IDCT.Height,sizeof(int));
		if (Result != ERR_NONE)	return Result;
		Result = Dst->Set(Dst,IDCT_FORMAT,&p->IDCT.Format,sizeof(video));
		if (Result != ERR_NONE)	return Result;
		Result = Dst->Set(Dst,IDCT_BUFFERCOUNT,&p->MinCount,sizeof(int));
		if (Result != ERR_NONE)	return Result;

		if (Src->Get(Src,IDCT_BUFFERCOUNT,&Count,sizeof(Count))==ERR_NONE && Count>p->MinCount)
			Dst->Set(Dst,IDCT_BUFFERCOUNT,&Count,sizeof(Count)); // optional

		memset(&FX,0,sizeof(FX));
		FX.ScaleX = SCALE_ONE;
		FX.ScaleY = SCALE_ONE;

		for (No=0;No<Count;++No)
		{
			video SrcFormat,DstFormat;
			int FrameNo = -1;
			Src->Get(Src,IDCT_FRAMENO+No,&FrameNo,sizeof(FrameNo));
			Dst->Set(Dst,IDCT_FRAMENO+No,&FrameNo,sizeof(FrameNo));

			if (Src->Lock(Src,No,SrcPlanes,&SrcBrightness,&SrcFormat) == ERR_NONE)
			{
				if (Dst->Lock(Dst,No,DstPlanes,&DstBrightness,&DstFormat) == ERR_NONE)
				{
					FX.Direction = CombineDir(SrcFormat.Direction, 0, DstFormat.Direction);
					FX.Brightness = DstBrightness - SrcBrightness;
					
					SurfaceCopy(&SrcFormat,&DstFormat,SrcPlanes,DstPlanes,&FX);

					Dst->Unlock(Dst,No);
				}
				Src->Unlock(Src,No);
			}
		}

		if (Src->Get(Src,IDCT_SHOW,&No,sizeof(No))==ERR_NONE)
			Dst->Set(Dst,IDCT_SHOW,&No,sizeof(No));
	}

	Src->Set(Src,IDCT_FORMAT,NULL,0);
	p->IDCT.Ptr = Dst;
	UpdateCount(p); // can't and shouldn't fail here (src already cleared and dst pointer saved)
	return ERR_NONE;
}
Example #18
0
void CDevCommReaderBase::RunL()
	{
	UpdateCount();
	iTester->ReadComplete(iStatus.Int());
	}
Example #19
0
void CDevCommWriterBase::RunL()
	{
	UpdateCount();
	iTester->WriteComplete(iStatus.Int());
	}