Subversion Repositories svn.mios32

Rev

Rev 1542 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1542 Rev 1724
Line 1... Line 1...
1
/* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
1
/* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
2
// $Id: SysexLibrarian.cpp 1542 2012-11-25 21:27:23Z tk $
2
// $Id: SysexLibrarian.cpp 1724 2013-03-28 20:23:40Z tk $
3
/*
3
/*
4
 * SysEx Librarian Window
4
 * SysEx Librarian Window
5
 *
5
 *
6
 * ==========================================================================
6
 * ==========================================================================
7
 *
7
 *
Line 388... Line 388...
388
    stopButton->setEnabled(false);
388
    stopButton->setEnabled(false);
389
389
390
    addAndMakeVisible(progressBar = new ProgressBar(progress));
390
    addAndMakeVisible(progressBar = new ProgressBar(progress));
391
391
392
    // restore settings
392
    // restore settings
393
    PropertiesFile *propertiesFile = ApplicationProperties::getInstance()->getCommonSettings(true);
393
    PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
394
    if( propertiesFile ) {
394
    if( propertiesFile ) {
395
        deviceIdSlider->setValue(propertiesFile->getIntValue(T("sysexLibrarianDeviceId"), 0));
395
        deviceIdSlider->setValue(propertiesFile->getIntValue(T("sysexLibrarianDeviceId"), 0));
396
        String syxFileName(propertiesFile->getValue(T("sysexLibrarianSyxFile"), String::empty));
396
        String syxFileName(propertiesFile->getValue(T("sysexLibrarianSyxFile"), String::empty));
397
        if( syxFileName != String::empty )
397
        if( syxFileName != String::empty )
398
            syxFile = File(syxFileName);
398
            syxFile = File(syxFileName);
Line 467... Line 467...
467
                       T("*.syx"));
467
                       T("*.syx"));
468
468
469
        if( fc.browseForFileToOpen() ) {
469
        if( fc.browseForFileToOpen() ) {
470
            syxFile = fc.getResult();
470
            syxFile = fc.getResult();
471
            if( loadSyx(syxFile, buttonThatWasClicked == loadBankButton) ) {
471
            if( loadSyx(syxFile, buttonThatWasClicked == loadBankButton) ) {
472
                PropertiesFile *propertiesFile = ApplicationProperties::getInstance()->getCommonSettings(true);
472
                PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
473
                if( propertiesFile )
473
                if( propertiesFile )
474
                    propertiesFile->setValue(T("sysexLibrarianSyxFile"), syxFile.getFullPathName());
474
                    propertiesFile->setValue(T("sysexLibrarianSyxFile"), syxFile.getFullPathName());
475
            }
475
            }
476
        }
476
        }
477
    } else if( buttonThatWasClicked == saveBankButton ||
477
    } else if( buttonThatWasClicked == saveBankButton ||
Line 480... Line 480...
480
                       syxFile,
480
                       syxFile,
481
                       T("*.syx"));
481
                       T("*.syx"));
482
        if( fc.browseForFileToSave(true) ) {
482
        if( fc.browseForFileToSave(true) ) {
483
            syxFile = fc.getResult();
483
            syxFile = fc.getResult();
484
            if( saveSyx(syxFile, buttonThatWasClicked == saveBankButton) ) {
484
            if( saveSyx(syxFile, buttonThatWasClicked == saveBankButton) ) {
485
                PropertiesFile *propertiesFile = ApplicationProperties::getInstance()->getCommonSettings(true);
485
                PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
486
                if( propertiesFile )
486
                if( propertiesFile )
487
                    propertiesFile->setValue(T("sysexLibrarianSyxFile"), syxFile.getFullPathName());
487
                    propertiesFile->setValue(T("sysexLibrarianSyxFile"), syxFile.getFullPathName());
488
            }
488
            }
489
        }
489
        }
490
    } else if( buttonThatWasClicked == sendBankButton ||
490
    } else if( buttonThatWasClicked == sendBankButton ||
Line 539... Line 539...
539
//==============================================================================
539
//==============================================================================
540
void SysexLibrarianControl::sliderValueChanged(Slider* slider)
540
void SysexLibrarianControl::sliderValueChanged(Slider* slider)
541
{
541
{
542
    if( slider == deviceIdSlider ) {
542
    if( slider == deviceIdSlider ) {
543
        // store setting
543
        // store setting
544
        PropertiesFile *propertiesFile = ApplicationProperties::getInstance()->getCommonSettings(true);
544
        PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
545
        if( propertiesFile )
545
        if( propertiesFile )
546
            propertiesFile->setValue(T("sysexLibrarianDeviceId"), (int)slider->getValue());
546
            propertiesFile->setValue(T("sysexLibrarianDeviceId"), (int)slider->getValue());
547
    }
547
    }
548
}
548
}
549
549
Line 553... Line 553...
553
{
553
{
554
    if( comboBox == deviceTypeSelector ) {
554
    if( comboBox == deviceTypeSelector ) {
555
        setSpec(comboBox->getSelectedId()-1);
555
        setSpec(comboBox->getSelectedId()-1);
556
556
557
        // store setting
557
        // store setting
558
        PropertiesFile *propertiesFile = ApplicationProperties::getInstance()->getCommonSettings(true);
558
        PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
559
        if( propertiesFile )
559
        if( propertiesFile )
560
            propertiesFile->setValue(T("sysexLibrarianDevice"), (int)comboBox->getSelectedId());
560
            propertiesFile->setValue(T("sysexLibrarianDevice"), (int)comboBox->getSelectedId());
561
    }
561
    }
562
}
562
}
563
563
Line 783... Line 783...
783
}
783
}
784
784
785
//==============================================================================
785
//==============================================================================
786
void SysexLibrarianControl::handleIncomingMidiMessage(const MidiMessage& message, uint8 runningStatus)
786
void SysexLibrarianControl::handleIncomingMidiMessage(const MidiMessage& message, uint8 runningStatus)
787
{
787
{
788
    uint8 *data = message.getRawData();
788
    uint8 *data = (uint8 *)message.getRawData();
789
    uint32 size = message.getRawDataSize();
789
    uint32 size = message.getRawDataSize();
790
790
791
    int spec = deviceTypeSelector->getSelectedId()-1;
791
    int spec = deviceTypeSelector->getSelectedId()-1;
792
    if( spec < 0 || spec >= miosStudio->sysexPatchDb->getNumSpecs() )
792
    if( spec < 0 || spec >= miosStudio->sysexPatchDb->getNumSpecs() )
793
        return;
793
        return;