More trace viewer updates

master
Timothy Pearson 13 years ago
parent 192a06da8d
commit 3ce46cc90f

@ -64,27 +64,35 @@
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="TraceWidget" row="0" column="0" colspan="1"> <widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name"> <property name="name">
<cstring>traceWidget</cstring> <cstring>splitter1</cstring>
</property> </property>
<property name="minimumSize"> <property name="orientation">
<size> <enum>Vertical</enum>
<width>80</width> </property>
<height>80</height> <widget class="TraceWidget" row="0" column="0" colspan="1">
</size> <property name="name">
</property> <cstring>traceWidget</cstring>
</widget> </property>
<widget class="TraceWidget" row="1" column="0" colspan="1"> <property name="minimumSize">
<property name="name"> <size>
<cstring>traceZoomWidget</cstring> <width>0</width>
</property> <height>0</height>
<property name="minimumSize"> </size>
<size> </property>
<width>80</width> </widget>
<height>80</height> <widget class="TraceWidget" row="1" column="0" colspan="1">
</size> <property name="name">
</property> <cstring>traceZoomWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</widget> </widget>
</grid> </grid>
</widget> </widget>

@ -64,27 +64,35 @@
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="TraceWidget" row="0" column="0" colspan="1"> <widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name"> <property name="name">
<cstring>traceWidget</cstring> <cstring>splitter1</cstring>
</property> </property>
<property name="minimumSize"> <property name="orientation">
<size> <enum>Vertical</enum>
<width>80</width> </property>
<height>80</height> <widget class="TraceWidget" row="0" column="0" colspan="1">
</size> <property name="name">
</property> <cstring>traceWidget</cstring>
</widget> </property>
<widget class="TraceWidget" row="1" column="0" colspan="1"> <property name="minimumSize">
<property name="name"> <size>
<cstring>traceZoomWidget</cstring> <width>0</width>
</property> <height>0</height>
<property name="minimumSize"> </size>
<size> </property>
<width>80</width> </widget>
<height>80</height> <widget class="TraceWidget" row="1" column="0" colspan="1">
</size> <property name="name">
</property> <cstring>traceZoomWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</widget> </widget>
</grid> </grid>
</widget> </widget>

@ -62,7 +62,7 @@ K_EXPORT_COMPONENT_FACTORY( libremotelab_scope, RemoteLab::Factory )
ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList& ) ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList& )
: RemoteInstrumentPart( parent, name ), m_traceWidget(0), m_commHandlerState(-1), m_commHandlerMode(0), m_commHandlerCommandState(0), m_connectionActiveAndValid(false), : RemoteInstrumentPart( parent, name ), m_traceWidget(0), m_commHandlerState(-1), m_commHandlerMode(0), m_commHandlerCommandState(0), m_connectionActiveAndValid(false),
m_base(0), stopTraceUpdate(false) m_triggerChannel(-1), m_base(0), stopTraceUpdate(false)
{ {
// Initialize important base class variables // Initialize important base class variables
m_clientLibraryName = CLIENT_LIBRARY; m_clientLibraryName = CLIENT_LIBRARY;
@ -103,7 +103,7 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
m_traceWidget->setCursorOrientation(2, TQt::Horizontal); m_traceWidget->setCursorOrientation(2, TQt::Horizontal);
m_traceWidget->setCursorOrientation(3, TQt::Vertical); m_traceWidget->setCursorOrientation(3, TQt::Vertical);
m_traceWidget->setCursorOrientation(4, TQt::Vertical); m_traceWidget->setCursorOrientation(4, TQt::Vertical);
m_traceWidget->setCursorEnabled(0, true); m_traceWidget->setCursorEnabled(0, false);
m_traceWidget->setCursorEnabled(1, true); m_traceWidget->setCursorEnabled(1, true);
m_traceWidget->setCursorEnabled(2, true); m_traceWidget->setCursorEnabled(2, true);
m_traceWidget->setCursorEnabled(3, true); m_traceWidget->setCursorEnabled(3, true);
@ -972,6 +972,8 @@ void ScopePart::recallWaveforms() {
ds >> cursorPos; ds >> cursorPos;
m_traceWidget->setCursorPosition(cursorno, cursorPos); m_traceWidget->setCursorPosition(cursorno, cursorPos);
} }
m_triggerChannel = -1;
m_triggerLevel = 0;
updateGraticule(); updateGraticule();
postProcessTrace(); postProcessTrace();
// HACK // HACK
@ -1008,10 +1010,16 @@ void ScopePart::updateGraticule() {
m_base->traceZoomWidget->setNumberOfHorizontalDivisions(m_hdivs); m_base->traceZoomWidget->setNumberOfHorizontalDivisions(m_hdivs);
m_base->traceZoomWidget->setNumberOfVerticalDivisions(m_vdivs); m_base->traceZoomWidget->setNumberOfVerticalDivisions(m_vdivs);
TraceNumberList activeTraces; if ((m_triggerChannel > 0) && (m_triggerChannel <= m_maxNumberOfTraces)) {
activeTraces.append(m_triggerChannel-1); TraceNumberList activeTraces;
m_traceWidget->setCursorActiveTraceList(0, activeTraces); activeTraces.append(m_triggerChannel-1);
m_traceWidget->setCursorPosition(0, (50.0-((m_triggerLevel*100.0)/(m_voltsDiv[m_triggerChannel]*m_vdivs)))); m_traceWidget->setCursorActiveTraceList(0, activeTraces);
m_traceWidget->setCursorPosition(0, (50.0-((m_triggerLevel*100.0)/(m_voltsDiv[m_triggerChannel]*m_vdivs))));
m_traceWidget->setCursorEnabled(0, true);
}
else {
m_traceWidget->setCursorEnabled(0, false);
}
m_traceWidget->setTraceColor(0, TQColor(255, 255, 255)); m_traceWidget->setTraceColor(0, TQColor(255, 255, 255));
m_traceWidget->setTraceColor(1, TQColor(128, 255, 128)); m_traceWidget->setTraceColor(1, TQColor(128, 255, 128));

@ -336,20 +336,22 @@ CursorData::~CursorData() {
} }
void CursorData::drawCursor(TQPainter* p, int graticule_width, int graticule_height) { void CursorData::drawCursor(TQPainter* p, int graticule_width, int graticule_height) {
if (highlighted) { if (enabled) {
p->setPen(highlightColor.dark(parentWidget->m_cursorDarkness)); if (highlighted) {
} p->setPen(highlightColor.dark(parentWidget->m_cursorDarkness));
else { }
p->setPen(color.dark(parentWidget->m_cursorDarkness)); else {
} p->setPen(color.dark(parentWidget->m_cursorDarkness));
}
if (orientation == TQt::Vertical) { if (orientation == TQt::Vertical) {
int x = abs(((position)/(100.0))*(graticule_width)); int x = abs(((position)/(100.0))*(graticule_width));
p->drawLine(x, 0, x, graticule_height); p->drawLine(x, 0, x, graticule_height);
} }
else { else {
int y = abs(((position)/(100.0))*(graticule_height)); int y = abs(((position)/(100.0))*(graticule_height));
p->drawLine(0, y, graticule_width, y); p->drawLine(0, y, graticule_width, y);
}
} }
} }
@ -603,6 +605,7 @@ void GraticuleWidget::mouseReleaseEvent(TQMouseEvent *e) {
if (m_base->m_cursorArray[m_movingCursor]->position > 100.0) { if (m_base->m_cursorArray[m_movingCursor]->position > 100.0) {
m_base->m_cursorArray[m_movingCursor]->position = 100.0; m_base->m_cursorArray[m_movingCursor]->position = 100.0;
} }
emit(cursorPositionChanged(m_movingCursor, m_base->m_cursorArray[m_movingCursor]->position));
m_movingCursor = -1; m_movingCursor = -1;
updateGraticule(); updateGraticule();
repaint(false); repaint(false);
@ -770,6 +773,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
if (m_base->m_cursorArray[m_movingCursor]->position > 100.0) { if (m_base->m_cursorArray[m_movingCursor]->position > 100.0) {
m_base->m_cursorArray[m_movingCursor]->position = 100.0; m_base->m_cursorArray[m_movingCursor]->position = 100.0;
} }
emit(cursorPositionChanged(m_movingCursor, m_base->m_cursorArray[m_movingCursor]->position));
updateGraticule(); updateGraticule();
repaint(false); repaint(false);
cursorHighlightChanged = false; cursorHighlightChanged = false;
@ -811,6 +815,7 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent,
m_primaryLayout = new TQGridLayout(this); m_primaryLayout = new TQGridLayout(this);
m_graticuleWidget = new GraticuleWidget(this); m_graticuleWidget = new GraticuleWidget(this);
connect(m_graticuleWidget, SIGNAL(cursorPositionChanged(uint, double)), this, SLOT(processChangedCursor(uint, double)));
m_primaryLayout->addMultiCellWidget(m_graticuleWidget, 0, 254, 0, 254); m_primaryLayout->addMultiCellWidget(m_graticuleWidget, 0, 254, 0, 254);
m_rightPaneLayout = new TQGridLayout; m_rightPaneLayout = new TQGridLayout;
m_traceLabelLayout = new TQGridLayout; m_traceLabelLayout = new TQGridLayout;
@ -1139,6 +1144,7 @@ void TraceWidget::setCursorPosition(uint cursorNumber, double position) {
if (position > 100.0) position = 100.0; if (position > 100.0) position = 100.0;
m_cursorArray[cursorNumber]->position = position; m_cursorArray[cursorNumber]->position = position;
emit(cursorPositionChanged(cursorNumber, m_cursorArray[cursorNumber]->position));
updateCursorText(); updateCursorText();
m_graticuleWidget->updateGraticule(); m_graticuleWidget->updateGraticule();
m_graticuleWidget->repaint(false); m_graticuleWidget->repaint(false);
@ -1376,18 +1382,22 @@ void TraceWidget::setZoomCursorBox(const TQRectF rect) {
// If two of each cannot be found, return TQRectF() // If two of each cannot be found, return TQRectF()
CursorData* horiz[2]; CursorData* horiz[2];
CursorData* vert[2]; CursorData* vert[2];
uint horizIndex[2];
uint vertIndex[2];
int j = 0; int j = 0;
int k = 0; int k = 0;
for (i=m_zoomCursorStartIndex;i<m_cursorArray.count(); i++) { for (i=m_zoomCursorStartIndex;i<m_cursorArray.count(); i++) {
if (m_cursorArray[i]->orientation == TQt::Horizontal) { if (m_cursorArray[i]->orientation == TQt::Horizontal) {
if (j<2) { if (j<2) {
vert[j] = m_cursorArray[i]; vert[j] = m_cursorArray[i];
vertIndex[j] = i;
j++; j++;
} }
} }
else { else {
if (k<2) { if (k<2) {
horiz[k] = m_cursorArray[i]; horiz[k] = m_cursorArray[i];
horizIndex[j] = i;
k++; k++;
} }
} }
@ -1398,9 +1408,13 @@ void TraceWidget::setZoomCursorBox(const TQRectF rect) {
if ((j>1) && (k>1)) { if ((j>1) && (k>1)) {
// Set cursors... // Set cursors...
vert[0]->position = boundedRect.y(); vert[0]->position = boundedRect.y();
emit(cursorPositionChanged(vertIndex[0], m_cursorArray[vertIndex[0]]->position));
vert[1]->position = boundedRect.height(); vert[1]->position = boundedRect.height();
emit(cursorPositionChanged(vertIndex[1], m_cursorArray[vertIndex[1]]->position));
horiz[0]->position = boundedRect.x(); horiz[0]->position = boundedRect.x();
emit(cursorPositionChanged(horizIndex[0], m_cursorArray[horizIndex[0]]->position));
horiz[1]->position = boundedRect.width(); horiz[1]->position = boundedRect.width();
emit(cursorPositionChanged(horizIndex[1], m_cursorArray[horizIndex[1]]->position));
updateCursorText(); updateCursorText();
m_graticuleWidget->updateGraticule(); m_graticuleWidget->updateGraticule();
@ -1514,6 +1528,10 @@ void TraceWidget::processChangedOffset(double offset) {
} }
} }
void TraceWidget::processChangedCursor(uint cursorNumber, double newPosition) {
emit(cursorPositionChanged(cursorNumber, newPosition));
}
void TraceWidget::resizeTraceArray(uint newsize) { void TraceWidget::resizeTraceArray(uint newsize) {
uint oldcount = m_traceArray.count(); uint oldcount = m_traceArray.count();

@ -149,6 +149,9 @@ class GraticuleWidget : public TQWidget
virtual void enterEvent(TQEvent *); virtual void enterEvent(TQEvent *);
virtual void leaveEvent(TQEvent *); virtual void leaveEvent(TQEvent *);
signals:
void cursorPositionChanged(uint cursorNumber, double newPosition);
private slots: private slots:
void updateGraticule(); void updateGraticule();
@ -233,10 +236,12 @@ class TraceWidget : public TQWidget
void updateTraceText(); void updateTraceText();
void updateCursorText(); void updateCursorText();
void processChangedOffset(double offset); void processChangedOffset(double offset);
void processChangedCursor(uint cursorNumber, double newPosition);
signals: signals:
void zoomBoxChanged(const TQRectF&); void zoomBoxChanged(const TQRectF&);
void offsetChanged(uint traceNumber, double offset); void offsetChanged(uint traceNumber, double offset);
void cursorPositionChanged(uint cursorNumber, double newPosition);
private: private:
void resizeTraceArray(uint newsize); void resizeTraceArray(uint newsize);

Loading…
Cancel
Save