1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: genset.cpp,v 1.1.1.1 2003/10/29 10:06:28 wschweer Exp $
//
// (C) Copyright 2001 Werner Schweer (ws@seh.de)
//=========================================================
#include <stdio.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qlineedit.h>
#include "genset.h"
#include "song.h"
#include "globals.h"
#include "midithread.h"
static int rtcResolutions[] = {
1024, 2048, 4096, 8192
};
static int divisions[] = {
48, 96, 192, 384, 768, 1536, 3072, 6144, 12288
};
//---------------------------------------------------------
// GlobalSettingsConfig
//---------------------------------------------------------
GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent, const char* name)
: GlobalSettingsDialogBase(parent, name)
{
for (unsigned i = 0; i < sizeof(rtcResolutions)/sizeof(*rtcResolutions); ++i) {
if (rtcResolutions[i] == rtcTicks) {
rtcResolutionSelect->setCurrentItem(i);
break;
}
}
for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) {
if (divisions[i] == division) {
midiDivisionSelect->setCurrentItem(i);
break;
}
}
guiRefreshSelect->setValue(guiRefresh);
minSliderSelect->setValue(minSlider);
minMeterSelect->setValue(minMeter);
helpBrowser->setText(::helpBrowser);
connect(applyButton, SIGNAL(clicked()), SLOT(apply()));
connect(okButton, SIGNAL(clicked()), SLOT(ok()));
connect(cancelButton, SIGNAL(clicked()), SLOT(cancel()));
}
//---------------------------------------------------------
// apply
//---------------------------------------------------------
void GlobalSettingsConfig::apply()
{
applySettings();
}
//---------------------------------------------------------
// ok
//---------------------------------------------------------
void GlobalSettingsConfig::ok()
{
applySettings();
close();
}
//---------------------------------------------------------
// cancel
//---------------------------------------------------------
void GlobalSettingsConfig::cancel()
{
close();
}
//---------------------------------------------------------
// applySettings
//---------------------------------------------------------
void GlobalSettingsConfig::applySettings()
{
int rtcticks = rtcResolutionSelect->currentItem();
int div = midiDivisionSelect->currentItem();
guiRefresh = guiRefreshSelect->value();
minSlider = minSliderSelect->value();
minMeter = minMeterSelect->value();
rtcTicks = rtcResolutions[rtcticks];
div = divisions[div];
::helpBrowser = helpBrowser->text();
midiThread->setHeartBeat(); // set guiRefresh
MidiMsg msg;
msg.id = SEQM_SET_RTC_TICKS;
midiThread->sendMessage(&msg, false); // rtcTicks
}
|