|
|
|
@ -15,6 +15,7 @@
|
|
|
|
|
#include <tqlayout.h>
|
|
|
|
|
|
|
|
|
|
#include <klocale.h>
|
|
|
|
|
#include <kinputdialog.h>
|
|
|
|
|
|
|
|
|
|
#define VERIFY_TRACE_ARRAY_SIZE if (traceNumber >= m_traceArray.count()) resizeTraceArray(traceNumber+1);
|
|
|
|
|
#define VERIFY_CURSOR_ARRAY_SIZE if (cursorNumber >= m_cursorArray.count()) resizeCursorArray(cursorNumber+1);
|
|
|
|
@ -141,27 +142,36 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p
|
|
|
|
|
singleDecrBtn = new TQToolButton(TQt::DownArrow, labelParent);
|
|
|
|
|
posResetBtn = new TQToolButton(labelParent);
|
|
|
|
|
posResetBtn->setText("0");
|
|
|
|
|
posSetBtn = new TQToolButton(labelParent);
|
|
|
|
|
posSetBtn->setText("M");
|
|
|
|
|
singleIncrBtn->setFixedSize(16,16);
|
|
|
|
|
singleDecrBtn->setFixedSize(16,16);
|
|
|
|
|
posResetBtn->setFixedSize(16,16);
|
|
|
|
|
posSetBtn->setFixedSize(16,16);
|
|
|
|
|
singleIncrBtn->setAutoRepeat(true);
|
|
|
|
|
singleDecrBtn->setAutoRepeat(true);
|
|
|
|
|
posResetBtn->setAutoRepeat(false);
|
|
|
|
|
posSetBtn->setAutoRepeat(false);
|
|
|
|
|
singleIncrBtn->setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed));
|
|
|
|
|
singleDecrBtn->setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed));
|
|
|
|
|
posResetBtn->setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed));
|
|
|
|
|
posSetBtn->setSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed));
|
|
|
|
|
singleIncrBtn->setPaletteBackgroundColor(labelParent->paletteBackgroundColor());
|
|
|
|
|
singleIncrBtn->setPaletteForegroundColor(color);
|
|
|
|
|
singleDecrBtn->setPaletteBackgroundColor(labelParent->paletteBackgroundColor());
|
|
|
|
|
singleDecrBtn->setPaletteForegroundColor(color);
|
|
|
|
|
posResetBtn->setPaletteBackgroundColor(labelParent->paletteBackgroundColor());
|
|
|
|
|
posResetBtn->setPaletteForegroundColor(color);
|
|
|
|
|
posSetBtn->setPaletteBackgroundColor(labelParent->paletteBackgroundColor());
|
|
|
|
|
posSetBtn->setPaletteForegroundColor(color);
|
|
|
|
|
singleIncrBtn->hide();
|
|
|
|
|
singleDecrBtn->hide();
|
|
|
|
|
posResetBtn->hide();
|
|
|
|
|
posSetBtn->hide();
|
|
|
|
|
connect(singleIncrBtn, SIGNAL(clicked()), this, SLOT(movePosOneTick()));
|
|
|
|
|
connect(singleDecrBtn, SIGNAL(clicked()), this, SLOT(moveNegOneTick()));
|
|
|
|
|
connect(posResetBtn, SIGNAL(clicked()), this, SLOT(resetVPosition()));
|
|
|
|
|
connect(posSetBtn, SIGNAL(clicked()), this, SLOT(setVPosition()));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
paramLabel = NULL;
|
|
|
|
@ -170,6 +180,7 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p
|
|
|
|
|
singleIncrBtn = NULL;
|
|
|
|
|
singleDecrBtn = NULL;
|
|
|
|
|
posResetBtn = NULL;
|
|
|
|
|
posSetBtn = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -178,6 +189,7 @@ TraceData::~TraceData() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_height) {
|
|
|
|
|
p->save();
|
|
|
|
|
p->setPen(color);
|
|
|
|
|
|
|
|
|
|
if ((bottomEdge != topEdge) && (enabled) && (positionArray.count() >= numberOfSamples) && (sampleArray.count() >= numberOfSamples) && (numberOfSamples > 0)) {
|
|
|
|
@ -225,7 +237,34 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
|
|
|
|
|
|
|
|
|
|
p->drawLine(x, y, x2, y2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw the zero level indicator
|
|
|
|
|
int pixel_size = 20;
|
|
|
|
|
TQFont painterFont = p->font();
|
|
|
|
|
painterFont.setFamily("Monospace");
|
|
|
|
|
painterFont.setPixelSize(pixel_size);
|
|
|
|
|
p->setFont(painterFont);
|
|
|
|
|
int font_vertical_offset = pixel_size/5;
|
|
|
|
|
int font_height = p->fontMetrics().boundingRect("→").height();
|
|
|
|
|
|
|
|
|
|
x = 0;
|
|
|
|
|
y = (((offset-topEdge)/(bottomEdge-topEdge))*(graticule_height))+(font_height/2)-(font_vertical_offset/2);
|
|
|
|
|
if (y > graticule_height) {
|
|
|
|
|
font_height = p->fontMetrics().boundingRect("↓").height();
|
|
|
|
|
y = graticule_height-font_vertical_offset;
|
|
|
|
|
p->drawText(x, y, trUtf8("↓"));
|
|
|
|
|
}
|
|
|
|
|
else if (y < 0) {
|
|
|
|
|
font_height = p->fontMetrics().boundingRect("↑").height();
|
|
|
|
|
y = font_height-font_vertical_offset;
|
|
|
|
|
p->drawText(x, y, trUtf8("↑"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
p->drawText(x, y, trUtf8("→"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p->restore();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceData::movePosOneTick() {
|
|
|
|
@ -259,6 +298,22 @@ void TraceData::resetVPosition() {
|
|
|
|
|
parentWidget->m_graticuleWidget->repaint(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceData::setVPosition() {
|
|
|
|
|
bool ok;
|
|
|
|
|
double newoffset;
|
|
|
|
|
|
|
|
|
|
ok = false;
|
|
|
|
|
newoffset = KInputDialog::getDouble(i18n("Set Trace Offset"), i18n("New offset for %1 (%2):").arg(traceName).arg(verticalUnits), offset, (double)-2147483647, (double)2147483647, 0.1, 1, &ok, parentWidget);
|
|
|
|
|
if (ok) {
|
|
|
|
|
offset = newoffset;
|
|
|
|
|
emit(offsetChanged(offset));
|
|
|
|
|
|
|
|
|
|
parentWidget->updateTraceText();
|
|
|
|
|
parentWidget->updateCursorText();
|
|
|
|
|
parentWidget->m_graticuleWidget->repaint(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CursorData::CursorData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), parentWidget(parent) {
|
|
|
|
|
color = TQColor(0, 255, 0);
|
|
|
|
|
highlightColor = TQColor(192, 255, 192);
|
|
|
|
@ -869,6 +924,7 @@ void TraceWidget::setBackgroundColor(const TQColor color) {
|
|
|
|
|
m_traceArray[trace]->singleIncrBtn->setPaletteBackgroundColor(color);
|
|
|
|
|
m_traceArray[trace]->singleDecrBtn->setPaletteBackgroundColor(color);
|
|
|
|
|
m_traceArray[trace]->posResetBtn->setPaletteBackgroundColor(color);
|
|
|
|
|
m_traceArray[trace]->posSetBtn->setPaletteBackgroundColor(color);
|
|
|
|
|
}
|
|
|
|
|
for (uint cursor=0;cursor<m_cursorArray.count();cursor++) {
|
|
|
|
|
m_cursorArray[cursor]->paramLabel->setPaletteBackgroundColor(color);
|
|
|
|
@ -1087,6 +1143,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, bool showText)
|
|
|
|
|
m_traceArray[traceNumber]->singleIncrBtn->show();
|
|
|
|
|
m_traceArray[traceNumber]->singleDecrBtn->show();
|
|
|
|
|
m_traceArray[traceNumber]->posResetBtn->show();
|
|
|
|
|
m_traceArray[traceNumber]->posSetBtn->show();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_traceArray[traceNumber]->paramLabel->hide();
|
|
|
|
@ -1095,6 +1152,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, bool showText)
|
|
|
|
|
m_traceArray[traceNumber]->singleIncrBtn->hide();
|
|
|
|
|
m_traceArray[traceNumber]->singleDecrBtn->hide();
|
|
|
|
|
m_traceArray[traceNumber]->posResetBtn->hide();
|
|
|
|
|
m_traceArray[traceNumber]->posSetBtn->hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -1104,6 +1162,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, bool showText)
|
|
|
|
|
m_traceArray[traceNumber]->singleIncrBtn->hide();
|
|
|
|
|
m_traceArray[traceNumber]->singleDecrBtn->hide();
|
|
|
|
|
m_traceArray[traceNumber]->posResetBtn->hide();
|
|
|
|
|
m_traceArray[traceNumber]->posSetBtn->hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_graticuleWidget->updateGraticule();
|
|
|
|
@ -1525,6 +1584,12 @@ TQString TraceWidget::prettyFormat(double value, double rangeDetectValue, TQStri
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double TraceWidget::traceOffset(uint traceNumber) {
|
|
|
|
|
VERIFY_TRACE_ARRAY_SIZE
|
|
|
|
|
|
|
|
|
|
return m_traceArray[traceNumber]->offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TraceWidget::setTraceOffset(uint traceNumber, double offset) {
|
|
|
|
|
VERIFY_TRACE_ARRAY_SIZE
|
|
|
|
|
|
|
|
|
@ -1582,7 +1647,8 @@ void TraceWidget::resizeTraceArray(uint newsize) {
|
|
|
|
|
m_traceLabelLayout->addMultiCellWidget(m_traceArray[i]->paramLabel, 0, 2, i*2, i*2);
|
|
|
|
|
m_traceLabelLayout->addWidget(m_traceArray[i]->singleIncrBtn, 0, (i*2)+1);
|
|
|
|
|
m_traceLabelLayout->addWidget(m_traceArray[i]->posResetBtn, 1, (i*2)+1);
|
|
|
|
|
m_traceLabelLayout->addWidget(m_traceArray[i]->singleDecrBtn, 2, (i*2)+1);
|
|
|
|
|
m_traceLabelLayout->addWidget(m_traceArray[i]->posSetBtn, 2, (i*2)+1);
|
|
|
|
|
m_traceLabelLayout->addWidget(m_traceArray[i]->singleDecrBtn, 3, (i*2)+1);
|
|
|
|
|
m_statusLabelLayout->insertWidget(i, m_traceArray[i]->graphStatusLabel, TQt::AlignTop);
|
|
|
|
|
m_statusLabelLayoutInner->insertWidget(i, m_traceArray[i]->graphStatusLabelInner);
|
|
|
|
|
}
|
|
|
|
@ -1595,6 +1661,7 @@ void TraceWidget::resizeTraceArray(uint newsize) {
|
|
|
|
|
m_traceLabelLayout->remove(m_traceArray[i]->paramLabel);
|
|
|
|
|
m_traceLabelLayout->remove(m_traceArray[i]->singleIncrBtn);
|
|
|
|
|
m_traceLabelLayout->remove(m_traceArray[i]->posResetBtn);
|
|
|
|
|
m_traceLabelLayout->remove(m_traceArray[i]->posSetBtn);
|
|
|
|
|
m_traceLabelLayout->remove(m_traceArray[i]->singleDecrBtn);
|
|
|
|
|
m_statusLabelLayout->remove(m_traceArray[i]->graphStatusLabel);
|
|
|
|
|
m_statusLabelLayoutInner->remove(m_traceArray[i]->graphStatusLabelInner);
|
|
|
|
|