|
|
|
@ -15,9 +15,9 @@
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
|
|
|
|
* (c) 2012-2019 Timothy Pearson
|
|
|
|
|
* Raptor Engineering
|
|
|
|
|
* http://www.raptorengineeringinc.com
|
|
|
|
|
* (c) 2012 - 2019 Timothy Pearson
|
|
|
|
|
* Raptor Engineering, LLC
|
|
|
|
|
* http://www.raptorengineering.com
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "define.h"
|
|
|
|
@ -191,6 +191,63 @@ void TraceControlWidget::triggerRequested() {
|
|
|
|
|
emit(triggerChannelChangeRequested());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TracePostProcessControlWidget::TracePostProcessControlWidget(TQWidget *parent, const char *name)
|
|
|
|
|
: TQWidget(parent, name)
|
|
|
|
|
{
|
|
|
|
|
TQGridLayout *topGrid = new TQGridLayout(this);
|
|
|
|
|
m_groupBox = new TQGroupBox(this);
|
|
|
|
|
m_groupBox->setColumnLayout(0, TQt::Vertical);
|
|
|
|
|
topGrid->addMultiCellWidget(m_groupBox, 0, 0, 0, 0);
|
|
|
|
|
m_groupBox->setTitle(i18n("Unknown Channel"));
|
|
|
|
|
m_primaryLayout = new TQGridLayout(m_groupBox->layout(), 1, 1, KDialog::spacingHint());
|
|
|
|
|
|
|
|
|
|
m_postProcessEnabledCheckBox = new TQCheckBox(m_groupBox);
|
|
|
|
|
connect(m_postProcessEnabledCheckBox, SIGNAL(clicked()), this, SLOT(enableClicked()));
|
|
|
|
|
m_postProcessEnabledCheckBox->setText(i18n("Enable"));
|
|
|
|
|
m_primaryLayout->addMultiCellWidget(m_postProcessEnabledCheckBox, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
m_voltsMultiplierSpinBox = new FloatSpinBox(m_groupBox);
|
|
|
|
|
m_voltsMultiplierSpinBox->setFloatMax(1000);
|
|
|
|
|
m_voltsMultiplierSpinBox->setFloatMin(-1000);
|
|
|
|
|
m_voltsMultiplierSpinBox->setFloatValue(1.0);
|
|
|
|
|
connect(m_voltsMultiplierSpinBox, SIGNAL(floatValueChanged(double)), this, SLOT(vMultChanged(double)));
|
|
|
|
|
m_voltsMultiplierSpinBox->setEnabled(false);
|
|
|
|
|
m_primaryLayout->addMultiCellWidget(m_voltsMultiplierSpinBox, 0, 0, 1, 1);
|
|
|
|
|
|
|
|
|
|
TQLabel* label = new TQLabel(m_groupBox);
|
|
|
|
|
label->setText(i18n("V/div multiplier"));
|
|
|
|
|
m_primaryLayout->addMultiCellWidget(label, 0, 0, 2, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TracePostProcessControlWidget::~TracePostProcessControlWidget() {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TracePostProcessControlWidget::setSelectedVoltsMultiplier(double vmult) {
|
|
|
|
|
m_voltsMultiplierSpinBox->setFloatValue(vmult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TracePostProcessControlWidget::setPostProcessEnabled(bool enabled) {
|
|
|
|
|
m_postProcessEnabledCheckBox->setChecked(enabled);
|
|
|
|
|
m_voltsMultiplierSpinBox->setEnabled(enabled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TracePostProcessControlWidget::setTraceName(TQString name) {
|
|
|
|
|
m_groupBox->setTitle(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TracePostProcessControlWidget::enableClicked() {
|
|
|
|
|
bool enabled = m_postProcessEnabledCheckBox->isOn();
|
|
|
|
|
m_voltsMultiplierSpinBox->setEnabled(enabled);
|
|
|
|
|
emit(enableChanged(enabled));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TracePostProcessControlWidget::vMultChanged(double vmult) {
|
|
|
|
|
Q_UNUSED(vmult)
|
|
|
|
|
double value = m_voltsMultiplierSpinBox->floatValue();
|
|
|
|
|
emit(voltsMultiplierChanged(value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MathTraceControlWidget::MathTraceControlWidget(TQWidget *parent, const char *name)
|
|
|
|
|
: TQWidget(parent, name)
|
|
|
|
|
{
|
|
|
|
@ -494,7 +551,10 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
|
|
|
|
|
m_traceAllowedVoltsDiv[traceno].clear();
|
|
|
|
|
m_voltsDiv[traceno] = 0;
|
|
|
|
|
m_secsDiv[traceno] = 0;
|
|
|
|
|
m_channelPostProcessActive[traceno] = false;
|
|
|
|
|
m_channelPostProcessVoltsMult[traceno] = 1;
|
|
|
|
|
m_traceControlWidgetList[traceno] = NULL;
|
|
|
|
|
m_tracePostProcessControlWidgetList[traceno] = NULL;
|
|
|
|
|
|
|
|
|
|
m_voltsDivSet[traceno] = false;
|
|
|
|
|
m_channelActiveSet[traceno] = false;
|
|
|
|
@ -520,6 +580,7 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
|
|
|
|
|
// Create widgets
|
|
|
|
|
m_base = new ScopeBase(widget());
|
|
|
|
|
m_traceControlWidgetGrid = new TQGridLayout(m_base->traceControlLayoutWidget);
|
|
|
|
|
m_postProcessTraceControlWidgetGrid = new TQGridLayout(m_base->postProcessTraceControlLayoutWidget);
|
|
|
|
|
m_mathTraceControlWidgetGrid = new TQGridLayout(m_base->mathTraceControlLayoutWidget);
|
|
|
|
|
m_timebaseControlWidgetGrid = new TQGridLayout(m_base->timebaseControlLayoutWidget);
|
|
|
|
|
m_timebaseControlWidget = new TimebaseControlWidget(m_base->timebaseControlLayoutWidget);
|
|
|
|
@ -2134,15 +2195,19 @@ void ScopePart::recallWaveforms() {
|
|
|
|
|
TQDataStream ds(&file);
|
|
|
|
|
TQ_INT32 magicNumber;
|
|
|
|
|
TQ_INT32 version;
|
|
|
|
|
TQ_INT16 savedMaxNumberOfMathTraces;
|
|
|
|
|
ds >> magicNumber;
|
|
|
|
|
if (magicNumber == WAVEFORM_MAGIC_NUMBER) {
|
|
|
|
|
ds >> version;
|
|
|
|
|
if ((version >= 1) && (version <= WAVEFORM_FILE_VERSION)) {
|
|
|
|
|
ds >> m_hdivs;
|
|
|
|
|
ds >> m_vdivs;
|
|
|
|
|
ds >> m_maxNumberOfTraces;
|
|
|
|
|
ds >> savedMaxNumberOfMathTraces;
|
|
|
|
|
if (version >= 3) {
|
|
|
|
|
ds >> m_maxNumberOfMathTraces;
|
|
|
|
|
ds >> savedMaxNumberOfMathTraces;
|
|
|
|
|
if (savedMaxNumberOfMathTraces > m_maxNumberOfMathTraces) {
|
|
|
|
|
m_maxNumberOfMathTraces = savedMaxNumberOfMathTraces;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int traceno=1; traceno<=m_maxNumberOfTraces; traceno++) {
|
|
|
|
|
TQ_UINT8 boolValue;
|
|
|
|
@ -2169,7 +2234,7 @@ void ScopePart::recallWaveforms() {
|
|
|
|
|
m_base->traceZoomWidget->setTraceOffset(traceno-1, offset);
|
|
|
|
|
}
|
|
|
|
|
if (version >= 3) {
|
|
|
|
|
for (int traceno=1; traceno<=m_maxNumberOfMathTraces; traceno++) {
|
|
|
|
|
for (int traceno=1; traceno<=savedMaxNumberOfMathTraces; traceno++) {
|
|
|
|
|
TQ_UINT8 boolValue;
|
|
|
|
|
ds >> boolValue;
|
|
|
|
|
m_mathChannelActive[traceno] = (boolValue!=0)?true:false;
|
|
|
|
@ -2184,6 +2249,13 @@ void ScopePart::recallWaveforms() {
|
|
|
|
|
m_base->traceZoomWidget->setTraceOffset(traceno-1+m_maxNumberOfTraces, offset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int traceno=savedMaxNumberOfMathTraces+1; traceno<=m_maxNumberOfMathTraces; traceno++) {
|
|
|
|
|
m_mathChannelActive[traceno] = false;
|
|
|
|
|
m_mathVoltsDiv[traceno] = m_mathTraceAllowedVoltsDiv[traceno][0];
|
|
|
|
|
m_mathFirstOperand[traceno] = 1;
|
|
|
|
|
m_mathSecondOperand[traceno] = 1;
|
|
|
|
|
m_mathOperator[traceno] = "+";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int cursorno=0; cursorno<5; cursorno++) {
|
|
|
|
|
double cursorPos;
|
|
|
|
@ -2359,12 +2431,24 @@ void ScopePart::updateTraceControlWidgets() {
|
|
|
|
|
m_traceControlWidgetList[i]->setTraceName(i18n("Channel %1").arg(i+1));
|
|
|
|
|
m_traceControlWidgetList[i]->show();
|
|
|
|
|
}
|
|
|
|
|
if (!m_tracePostProcessControlWidgetList[i]) {
|
|
|
|
|
m_tracePostProcessControlWidgetList[i] = new TracePostProcessControlWidget(m_base->postProcessTraceControlLayoutWidget);
|
|
|
|
|
connect(m_tracePostProcessControlWidgetList[i], SIGNAL(enableChanged(bool)), this, SLOT(tracePostProcessControlEnableChanged(bool)));
|
|
|
|
|
connect(m_tracePostProcessControlWidgetList[i], SIGNAL(voltsMultiplierChanged(double)), this, SLOT(tracePostProcessControlVMultChanged(double)));
|
|
|
|
|
m_postProcessTraceControlWidgetGrid->addMultiCellWidget(m_tracePostProcessControlWidgetList[i], i, i, 0, 0);
|
|
|
|
|
m_tracePostProcessControlWidgetList[i]->setTraceName(i18n("Channel %1").arg(i+1));
|
|
|
|
|
m_tracePostProcessControlWidgetList[i]->show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (i=m_maxNumberOfTraces; i<MAXTRACES;i++) {
|
|
|
|
|
if (m_traceControlWidgetList[i]) {
|
|
|
|
|
m_traceControlWidgetGrid->remove(m_traceControlWidgetList[i]);
|
|
|
|
|
delete m_traceControlWidgetList[i];
|
|
|
|
|
}
|
|
|
|
|
if (m_tracePostProcessControlWidgetList[i]) {
|
|
|
|
|
m_postProcessTraceControlWidgetGrid->remove(m_tracePostProcessControlWidgetList[i]);
|
|
|
|
|
delete m_tracePostProcessControlWidgetList[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (i=0; i<m_maxNumberOfMathTraces;i++) {
|
|
|
|
|
if (!m_mathTraceControlWidgetList[i]) {
|
|
|
|
@ -2438,6 +2522,66 @@ void ScopePart::traceControlSDivChanged(double sdiv) {
|
|
|
|
|
m_horizontalTimebaseSet = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScopePart::tracePostProcessControlEnableChanged(bool enabled) {
|
|
|
|
|
int i;
|
|
|
|
|
int channel = -1;
|
|
|
|
|
const TracePostProcessControlWidget* widget = dynamic_cast<const TracePostProcessControlWidget*>(sender());
|
|
|
|
|
if (widget) {
|
|
|
|
|
for (i=0; i<MAXTRACES;i++) {
|
|
|
|
|
if (m_tracePostProcessControlWidgetList[i] == widget) {
|
|
|
|
|
channel = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((channel >= 0) && (channel <=MAXTRACES)) {
|
|
|
|
|
m_channelPostProcessActive[channel+1] = enabled;
|
|
|
|
|
if (m_channelPostProcessActive[channel+1]) {
|
|
|
|
|
m_traceWidget->setTraceVerticalMultiplier(channel, m_channelPostProcessVoltsMult[channel+1]);
|
|
|
|
|
m_base->traceZoomWidget->setTraceVerticalMultiplier(channel, m_channelPostProcessVoltsMult[channel+1]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_traceWidget->setTraceVerticalMultiplier(channel, 1.0);
|
|
|
|
|
m_base->traceZoomWidget->setTraceVerticalMultiplier(channel, 1.0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateGraticule();
|
|
|
|
|
m_traceWidget->repaint(false);
|
|
|
|
|
m_base->traceZoomWidget->repaint(false);
|
|
|
|
|
updateTraceControlWidgets();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScopePart::tracePostProcessControlVMultChanged(double vmult) {
|
|
|
|
|
int i;
|
|
|
|
|
int channel = -1;
|
|
|
|
|
const TracePostProcessControlWidget* widget = dynamic_cast<const TracePostProcessControlWidget*>(sender());
|
|
|
|
|
if (widget) {
|
|
|
|
|
for (i=0; i<MAXTRACES;i++) {
|
|
|
|
|
if (m_tracePostProcessControlWidgetList[i] == widget) {
|
|
|
|
|
channel = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((channel >= 0) && (channel <=MAXTRACES)) {
|
|
|
|
|
m_channelPostProcessVoltsMult[channel+1] = vmult;
|
|
|
|
|
if (m_channelPostProcessActive[channel+1]) {
|
|
|
|
|
m_traceWidget->setTraceVerticalMultiplier(channel, m_channelPostProcessVoltsMult[channel+1]);
|
|
|
|
|
m_base->traceZoomWidget->setTraceVerticalMultiplier(channel, m_channelPostProcessVoltsMult[channel+1]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_traceWidget->setTraceVerticalMultiplier(channel, 1.0);
|
|
|
|
|
m_base->traceZoomWidget->setTraceVerticalMultiplier(channel, 1.0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateGraticule();
|
|
|
|
|
m_traceWidget->repaint(false);
|
|
|
|
|
m_base->traceZoomWidget->repaint(false);
|
|
|
|
|
updateTraceControlWidgets();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScopePart::mathTraceControlEnableChanged(bool enabled) {
|
|
|
|
|
int i;
|
|
|
|
|
int channel = -1;
|
|
|
|
|