예제 #1
0
void openFile(TCHAR *file)
{
    if(file == NULL || PathFileExists(file) == FALSE)
    {
        ::MessageBox(nppData._nppHandle, TEXT("No file to open"), TEXT("error"), MB_OK);
        return;
    }

    HWND window = openTempFile();

    ifstream myfile(file,ios::in|ios::ate| ios::binary);

    if(myfile.is_open())
    {		
        long size = myfile.tellg();
        char *memblock = new char [size+1];
        myfile.seekg(0);
        myfile.read(memblock, size);
        myfile.close();	

        memblock[size] = 0;
        ::SendMessageA(window, SCI_GRABFOCUS, 0, 0);
        ::SendMessageA(window, SCI_APPENDTEXT, size, (LPARAM)memblock);	
        delete[] memblock;

        if(startCompare())
        {
            ::SendMessageA(window, SCI_GRABFOCUS, 0, 0);
            ::SendMessageA(window, SCI_SETSAVEPOINT, 1, 0);
            ::SendMessageA(window, SCI_EMPTYUNDOBUFFER, 0, 0);
            ::SendMessageA(window, SCI_SETREADONLY, 1, 0);
            reset();
        }
        else
        {
            ::SendMessageA(window, SCI_GRABFOCUS, 0, 0);
            ::SendMessageA(window, SCI_SETSAVEPOINT, 1, 0);
            ::SendMessageA(window, SCI_EMPTYUNDOBUFFER, 0, 0);
            ::SendMessageA(window, SCI_SETREADONLY, 1, 0);            
 			::SendMessageA(nppData._scintillaSecondHandle, SCI_GRABFOCUS, 0, 1);
        }
    }
}
예제 #2
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , m_progress(new QProgressDialog(this))

{
    ui->setupUi(this);
    m_progress->setWindowModality(Qt::WindowModal);
    m_progress->setRange(0, 100);
    m_progress->setCancelButton(0);
    m_progress->setLabelText("Working on Fourier Transformation...");
    m_progress->cancel();

    for (int i = 0; i < FT::FTTYPECOUNT; ++i) {
        QString text;

        switch (i) {
        case FT::DFTCPU:
            text = QStringLiteral("DFT CPU");
            break;
        case FT::DFTGPU:
            text = QStringLiteral("DFT GPU");
            break;
        case FT::FFTCPU:
            text = QStringLiteral("FFT CPU");
            break;
        case FT::FFTGPU:
            text = QStringLiteral("FFT GPU");
            break;
        default:
            text = QStringLiteral("Unknown");
        }

        ui->refFtCombo->insertItem(i, text);
        ui->modFtCombo->insertItem(i, text);
        ui->benchFtCombo->insertItem(i, text);
    }

    ui->refFtCombo->setCurrentIndex(FT::FFTCPU);
    ui->refElapsedLabel->setStyleSheet("QLabel { color: red; }");
    ui->modFtCombo->setCurrentIndex(FT::FFTGPU);
    ui->modElapsedLabel->setStyleSheet("QLabel { color: red; }");
    ui->benchFtCombo->setCurrentIndex(FT::FFTGPU);

    ui->compareInputLine->setText(QStringLiteral(":/images/qt-logo-128.png"));
    ui->benchInputLine->setText(QStringLiteral("rect-128-128-32-16-50-200"));

    ui->benchResultView->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));

    connect(ui->browseButton, SIGNAL(pressed()), this, SLOT(showImageBrowser()));
    connect(ui->compareRectButton, SIGNAL(pressed()), this, SLOT(showRectDialogForCompare()));
    connect(ui->benchRectButton, SIGNAL(pressed()), this, SLOT(showRectDialogForBench()));

    rangeMinSBPrevValue = ui->rangeMinSB->value();
    connect(ui->rangeMinSB, SIGNAL(valueChanged(int)), this, SLOT(roundSBToPowerOfTwo(int)));
    rangeMaxSBPrevValue = ui->rangeMaxSB->value();
    connect(ui->rangeMaxSB, SIGNAL(valueChanged(int)), this, SLOT(roundSBToPowerOfTwo(int)));

    connect(ui->startCompareButton, SIGNAL(pressed()), m_progress, SLOT(show()));
    connect(ui->startCompareButton, SIGNAL(pressed()), this, SLOT(startCompare()));

    connect(ui->startBenchButton, SIGNAL(pressed()), m_progress, SLOT(show()));
    connect(ui->startBenchButton, SIGNAL(pressed()), this, SLOT(startBench()));
}
예제 #3
0
void compare()
{
    startCompare();
}