You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
3.5 KiB
130 lines
3.5 KiB
/*
|
|
Rosegarden
|
|
A MIDI and audio sequencer and musical notation editor.
|
|
|
|
This program is Copyright 2000-2008
|
|
Guillaume Laurent <glaurent@telegraph-road.org>,
|
|
Chris Cannam <cannam@all-day-breakfast.com>,
|
|
Richard Bown <richard.bown@ferventsoftware.com>
|
|
|
|
The moral rights of Guillaume Laurent, Chris Cannam, and Richard
|
|
Bown to claim authorship of this work have been asserted.
|
|
|
|
Other copyrights also apply to some parts of this work. Please
|
|
see the AUTHORS file and individual file headers for details.
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation; either version 2 of the
|
|
License, or (at your option) any later version. See the file
|
|
COPYING included with this distribution for more information.
|
|
*/
|
|
|
|
|
|
#include "RescaleDialog.h"
|
|
|
|
#include <tdelocale.h>
|
|
#include "document/ConfigGroups.h"
|
|
#include "base/Composition.h"
|
|
#include "gui/widgets/TimeWidget.h"
|
|
#include <tdeconfig.h>
|
|
#include <kdialogbase.h>
|
|
#include <tqcheckbox.h>
|
|
#include <tqgroupbox.h>
|
|
#include <tqstring.h>
|
|
#include <tqvbox.h>
|
|
#include <tqwidget.h>
|
|
#include <tdeapplication.h>
|
|
|
|
|
|
namespace Rosegarden
|
|
{
|
|
|
|
RescaleDialog::RescaleDialog(TQWidget *parent,
|
|
Composition *composition,
|
|
timeT startTime,
|
|
timeT originalDuration,
|
|
bool showCloseGapOption,
|
|
bool constrainToCompositionDuration) :
|
|
KDialogBase(parent, 0, true, i18n("Rescale"), User1 | Ok | Cancel)
|
|
{
|
|
TQVBox *vbox = makeVBoxMainWidget();
|
|
|
|
m_newDuration = new TimeWidget
|
|
(i18n("Duration of selection"), vbox, composition,
|
|
startTime, originalDuration, true,
|
|
constrainToCompositionDuration);
|
|
|
|
if (showCloseGapOption) {
|
|
TQGroupBox *optionBox = new TQGroupBox(1, TQt::Horizontal, i18n("Options"), vbox);
|
|
m_closeGap = new TQCheckBox(i18n("Adjust times of following events accordingly"),
|
|
optionBox);
|
|
TDEConfig *config = kapp->config();
|
|
config->setGroup(GeneralOptionsConfigGroup);
|
|
m_closeGap->setChecked
|
|
(config->readBoolEntry("rescaledialogadjusttimes", true));
|
|
} else {
|
|
m_closeGap = 0;
|
|
}
|
|
|
|
setButtonText(User1, i18n("Reset"));
|
|
connect(this, TQ_SIGNAL(user1Clicked()),
|
|
m_newDuration, TQ_SLOT(slotResetToDefault()));
|
|
}
|
|
|
|
timeT
|
|
RescaleDialog::getNewDuration()
|
|
{
|
|
return m_newDuration->getTime();
|
|
}
|
|
|
|
bool
|
|
RescaleDialog::shouldCloseGap()
|
|
{
|
|
if (m_closeGap) {
|
|
TDEConfig *config = kapp->config();
|
|
config->setGroup(GeneralOptionsConfigGroup);
|
|
config->writeEntry("rescaledialogadjusttimes", m_closeGap->isChecked());
|
|
return m_closeGap->isChecked();
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/*
|
|
int
|
|
RescaleDialog::getMultiplier()
|
|
{
|
|
return m_to;
|
|
}
|
|
|
|
int
|
|
RescaleDialog::getDivisor()
|
|
{
|
|
return m_from;
|
|
}
|
|
|
|
void
|
|
RescaleDialog::slotFromChanged(int i)
|
|
{
|
|
m_from = i + 1;
|
|
int perTenThou = m_to * 10000 / m_from;
|
|
m_percent->setText(TQString("%1.%2%").
|
|
arg(perTenThou / 100).
|
|
arg(perTenThou % 100));
|
|
}
|
|
|
|
void
|
|
RescaleDialog::slotToChanged(int i)
|
|
{
|
|
m_to = i + 1;
|
|
int perTenThou = m_to * 10000 / m_from;
|
|
m_percent->setText(TQString("%1.%2%").
|
|
arg(perTenThou / 100).
|
|
arg(perTenThou % 100));
|
|
}
|
|
*/
|
|
|
|
}
|
|
#include "RescaleDialog.moc"
|