progress.cpp

来自「QAM module to use in Java with an easy i」· C++ 代码 · 共 60 行

CPP
60
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Progress.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "JvExControls"
#pragma link "JvXPButtons"
#pragma link "JvXPCore"
#pragma link "JvLabel"
#pragma resource "*.dfm"
TProgressForm *ProgressForm;


__fastcall ProgressThread::ProgressThread(int N, double *in, double *out, fftw_plan *p)
        : TThread(true)
{
        plan=p;
        _N=N;_in=in;_out=out;
        FreeOnTerminate=false;
        Priority=tpNormal;
        OnTerminate=FinshedEvent;
        Finished=false;
        Resume();
}

void __fastcall ProgressThread::FinshedEvent(TObject* Sender)
{
        Finished=true;
}

void __fastcall ProgressThread::Execute()
{
        *plan=fftw_plan_r2r_1d(_N,_in,_out,FFTW_R2HC,FFTW_MEASURE);
}
//---------------------------------------------------------------------------
__fastcall TProgressForm::TProgressForm(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TProgressForm::Timer1Timer(TObject *Sender)
{
        if(*Finished)Close();
}
//---------------------------------------------------------------------------
void __fastcall TProgressForm::FormShow(TObject *Sender)
{
        Timer1->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TProgressForm::FormClose(TObject *Sender,
      TCloseAction &Action)
{
        Timer1->Enabled=false;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?