Remove reference comments and cosmetics
This commit is contained in:
@@ -33,20 +33,20 @@
|
||||
|
||||
float curveLinear(float x, float coeff, float yMin, float yMid, float yMax)
|
||||
{
|
||||
float a = (yMax-yMin) / 200.0;
|
||||
return yMin + a * (x+100.0);
|
||||
float a = (yMax - yMin) / 200.0;
|
||||
return yMin + a * (x + 100.0);
|
||||
}
|
||||
|
||||
float c9xexpou(float point, float coeff)
|
||||
{
|
||||
float x = point*1024.0/100.0;
|
||||
float k = coeff*256.0/100.0;
|
||||
return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256) / 1024.0 * 100;
|
||||
float x = point * 1024.0 / 100.0;
|
||||
float k = coeff * 256.0 / 100.0;
|
||||
return ((k * x * x * x / (1024 * 1024) + x * (256 - k) + 128) / 256) / 1024.0 * 100;
|
||||
}
|
||||
|
||||
float curveExpo(float x, float coeff, float yMin, float yMid, float yMax)
|
||||
{
|
||||
float a = (yMax-yMin) / 100.0;
|
||||
float a = (yMax - yMin) / 100.0;
|
||||
|
||||
x += 100.0;
|
||||
x /= 2.0;
|
||||
@@ -57,14 +57,14 @@ float curveExpo(float x, float coeff, float yMin, float yMid, float yMax)
|
||||
else {
|
||||
coeff = -coeff;
|
||||
x = 100 - x;
|
||||
return round((100.0 - c9xexpou(x, coeff))*a + yMin);
|
||||
return round((100.0 - c9xexpou(x, coeff)) * a + yMin);
|
||||
}
|
||||
}
|
||||
|
||||
float curveSymmetricalY(float x, float coeff, float yMin, float yMid, float yMax)
|
||||
{
|
||||
bool invert;
|
||||
if (x<0) {
|
||||
if (x < 0) {
|
||||
x = -x;
|
||||
invert = 1;
|
||||
}
|
||||
@@ -74,12 +74,12 @@ float curveSymmetricalY(float x, float coeff, float yMin, float yMid, float yMax
|
||||
|
||||
float y;
|
||||
if (coeff >= 0) {
|
||||
y = round(c9xexpou(x, coeff) * (yMax/100.0));
|
||||
y = round(c9xexpou(x, coeff) * (yMax / 100.0));
|
||||
}
|
||||
else {
|
||||
coeff = -coeff;
|
||||
x = 100.0 - x;
|
||||
y = round((100.0-c9xexpou(x, coeff)) * (yMax/100.0));
|
||||
y = round((100.0 - c9xexpou(x, coeff)) * (yMax / 100.0));
|
||||
}
|
||||
|
||||
if (invert) {
|
||||
@@ -91,9 +91,9 @@ float curveSymmetricalY(float x, float coeff, float yMin, float yMid, float yMax
|
||||
|
||||
float curveSymmetricalX(float x, float coeff, float yMin, float yMid, float yMax)
|
||||
{
|
||||
float a = (yMax-yMid) / 100.0;
|
||||
float a = (yMax - yMid) / 100.0;
|
||||
|
||||
if (x<0)
|
||||
if (x < 0)
|
||||
x = -x;
|
||||
|
||||
float y;
|
||||
@@ -102,8 +102,8 @@ float curveSymmetricalX(float x, float coeff, float yMin, float yMid, float yMax
|
||||
}
|
||||
else {
|
||||
coeff = -coeff;
|
||||
x = 100-x;
|
||||
y = round((100.0-c9xexpou(x, coeff)) * a + yMid);
|
||||
x = 100 - x;
|
||||
y = round((100.0 - c9xexpou(x, coeff)) * a + yMid);
|
||||
}
|
||||
|
||||
return y;
|
||||
@@ -148,38 +148,6 @@ CurvesPanel::CurvesPanel(QWidget * parent, ModelData & model, GeneralSettings &
|
||||
// The edit curve button
|
||||
QPushButton * edit = new QPushButton(this);
|
||||
edit->setProperty("index", i);
|
||||
/*
|
||||
From https://doc.qt.io/qt-5/qwidget.html#palette-prop
|
||||
|
||||
The current style, which is used to render the content of all standard Qt widgets, is free to choose colors and brushes
|
||||
from the widget palette, or in some cases, to ignore the palette (partially, or completely).
|
||||
In particular, certain styles like GTK style, Mac style, and Windows Vista style, depend on third party APIs to render
|
||||
the content of widgets, and these styles typically do not follow the palette. Because of this, assigning roles to a widget's palette
|
||||
is not guaranteed to change the appearance of the widget. Instead, you may choose to apply a styleSheet.
|
||||
|
||||
Warning: Do not use this function in conjunction with Qt Style Sheets.
|
||||
When using style sheets, the palette of a widget can be customized using the "color", "background-color",
|
||||
"selection-color", "selection-background-color" and "alternate-background-color".
|
||||
*/
|
||||
|
||||
// can only assume there have been some OS version specific display issues so the stylesheet was added
|
||||
// to ensure control remove use of QPalette
|
||||
//QPalette palette;
|
||||
//palette.setBrush(QPalette::Active, QPalette::Button, QBrush(colors[i]));
|
||||
//palette.setBrush(QPalette::Active, QPalette::ButtonText, QBrush(Qt::white));
|
||||
|
||||
/* rework see below
|
||||
#ifdef __APPLE__
|
||||
// this sets text color to background color !!!!
|
||||
//edit->setStyleSheet(QString("color: %1;").arg(colors[i].name()));
|
||||
#elif defined WIN32 || !defined __GNUC__
|
||||
edit->setStyleSheet(QString("background-color: %1; color: white;").arg(colors[i].name()));
|
||||
#else
|
||||
// creates more compact buttons
|
||||
edit->setStyleSheet(QString("background-color: %1; color: white; padding: 2px 3px; border-style: outset; border-width: 1px;
|
||||
border-radius: 2px; border-color: inherit;").arg(colors[i].name()));
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
// creates more compact and likely consistent buttons across OS flavors
|
||||
@@ -188,7 +156,6 @@ CurvesPanel::CurvesPanel(QWidget * parent, ModelData & model, GeneralSettings &
|
||||
edit->setStyleSheet(QString("background-color: %1; color: white;").arg(colors[i].name()));
|
||||
#endif
|
||||
|
||||
//edit->setPalette(palette);
|
||||
edit->setText(tr("Curve %1").arg(i + 1));
|
||||
edit->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
edit->setToolTip(tr("Popup menu available"));
|
||||
@@ -203,8 +170,6 @@ CurvesPanel::CurvesPanel(QWidget * parent, ModelData & model, GeneralSettings &
|
||||
// The curve plot checkbox
|
||||
QCheckBox * plot = new QCheckBox(this);
|
||||
plot->setProperty("index", i);
|
||||
// this has no effect on the checkbox so remove
|
||||
//plot->setPalette(palette);
|
||||
connect(plot, SIGNAL(toggled(bool)), this, SLOT(plotCurve(bool)));
|
||||
if (i < limit) {
|
||||
ui->curvesLayout->addWidget(plot, i, 2, 1, 1);
|
||||
@@ -363,9 +328,15 @@ void CurvesPanel::updateCurve()
|
||||
int numpoints = model->curves[k].count;
|
||||
for (int i = 0; i < numpoints - 1; i++) {
|
||||
if (model->curves[k].type == CurveData::CURVE_TYPE_CUSTOM)
|
||||
scene->addLine(centerX + (qreal)model->curves[k].points[i].x*width/200, centerY - (qreal)model->curves[k].points[i].y*height/200,centerX + (qreal)model->curves[k].points[i+1].x*width/200,centerY - (qreal)model->curves[k].points[i+1].y*height/200, pen);
|
||||
scene->addLine(centerX + (qreal)model->curves[k].points[i].x * width / 200,
|
||||
centerY - (qreal)model->curves[k].points[i].y * height / 200,
|
||||
centerX + (qreal)model->curves[k].points[i + 1].x * width / 200,
|
||||
centerY - (qreal)model->curves[k].points[i + 1].y * height / 200, pen);
|
||||
else
|
||||
scene->addLine(GFX_MARGIN + i*width/(numpoints-1), centerY - (qreal)model->curves[k].points[i].y*height/200,GFX_MARGIN + (i+1)*width/(numpoints-1),centerY - (qreal)model->curves[k].points[i+1].y*height/200, pen);
|
||||
scene->addLine(GFX_MARGIN + i * width / (numpoints - 1),
|
||||
centerY - (qreal)model->curves[k].points[i].y * height / 200,
|
||||
GFX_MARGIN + (i + 1) * width / (numpoints - 1),
|
||||
centerY - (qreal)model->curves[k].points[i + 1].y * height / 200, pen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -387,11 +358,13 @@ void CurvesPanel::updateCurve()
|
||||
else {
|
||||
nodex->setFixedX(true);
|
||||
}
|
||||
nodex->setPos(centerX + (qreal)model->curves[currentCurve].points[i].x * width / 200, centerY - (qreal)model->curves[currentCurve].points[i].y * height / 200);
|
||||
nodex->setPos(centerX + (qreal)model->curves[currentCurve].points[i].x * width / 200,
|
||||
centerY - (qreal)model->curves[currentCurve].points[i].y * height / 200);
|
||||
}
|
||||
else {
|
||||
nodex->setFixedX(true);
|
||||
nodex->setPos(GFX_MARGIN + i * width / (numpoints - 1), centerY - (qreal)model->curves[currentCurve].points[i].y * height / 200);
|
||||
nodex->setPos(GFX_MARGIN + i * width / (numpoints - 1),
|
||||
centerY - (qreal)model->curves[currentCurve].points[i].y * height / 200);
|
||||
}
|
||||
connect(nodex, SIGNAL(moved(int, int)), this, SLOT(onNodeMoved(int, int)));
|
||||
connect(nodex, SIGNAL(focus()), this, SLOT(onNodeFocus()));
|
||||
@@ -623,7 +596,8 @@ void CurvesPanel::on_curveApply_clicked()
|
||||
}
|
||||
|
||||
if (apply) {
|
||||
model->curves[currentCurve].points[i].y = templates[index].function(x, ui->curveCoeff->value(), ui->yMin->value(), ui->yMid->value(), ui->yMax->value());
|
||||
model->curves[currentCurve].points[i].y = templates[index].function(x, ui->curveCoeff->value(), ui->yMin->value(), ui->yMid->value(),
|
||||
ui->yMax->value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user