More trace viewer updates

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

@ -64,14 +64,21 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name">
<cstring>splitter1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="TraceWidget" row="0" column="0" colspan="1">
<property name="name">
<cstring>traceWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
@ -81,11 +88,12 @@
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">

@ -64,14 +64,21 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSplitter" row="0" column="0" colspan="1">
<property name="name">
<cstring>splitter1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<widget class="TraceWidget" row="0" column="0" colspan="1">
<property name="name">
<cstring>traceWidget</cstring>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
@ -81,11 +88,12 @@
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">

@ -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& )
: 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
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(3, 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(2, true);
m_traceWidget->setCursorEnabled(3, true);
@ -972,6 +972,8 @@ void ScopePart::recallWaveforms() {
ds >> cursorPos;
m_traceWidget->setCursorPosition(cursorno, cursorPos);
}
m_triggerChannel = -1;
m_triggerLevel = 0;
updateGraticule();
postProcessTrace();
// HACK
@ -1008,10 +1010,16 @@ void ScopePart::updateGraticule() {
m_base->traceZoomWidget->setNumberOfHorizontalDivisions(m_hdivs);
m_base->traceZoomWidget->setNumberOfVerticalDivisions(m_vdivs);
if ((m_triggerChannel > 0) && (m_triggerChannel <= m_maxNumberOfTraces)) {
TraceNumberList activeTraces;
activeTraces.append(m_triggerChannel-1);
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(1, TQColor(128, 255, 128));

@ -336,6 +336,7 @@ CursorData::~CursorData() {
}
void CursorData::drawCursor(TQPainter* p, int graticule_width, int graticule_height) {
if (enabled) {
if (highlighted) {
p->setPen(highlightColor.dark(parentWidget->m_cursorDarkness));
}
@ -352,6 +353,7 @@ void CursorData::drawCursor(TQPainter* p, int graticule_width, int graticule_hei
p->drawLine(0, y, graticule_width, y);
}
}
}
void CursorData::movePosOneTick() {
double increment;
@ -603,6 +605,7 @@ void GraticuleWidget::mouseReleaseEvent(TQMouseEvent *e) {
if (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;
updateGraticule();
repaint(false);
@ -770,6 +773,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
if (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();
repaint(false);
cursorHighlightChanged = false;
@ -811,6 +815,7 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent,
m_primaryLayout = new TQGridLayout(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_rightPaneLayout = new TQGridLayout;
m_traceLabelLayout = new TQGridLayout;
@ -1139,6 +1144,7 @@ void TraceWidget::setCursorPosition(uint cursorNumber, double position) {
if (position > 100.0) position = 100.0;
m_cursorArray[cursorNumber]->position = position;
emit(cursorPositionChanged(cursorNumber, m_cursorArray[cursorNumber]->position));
updateCursorText();
m_graticuleWidget->updateGraticule();
m_graticuleWidget->repaint(false);
@ -1376,18 +1382,22 @@ void TraceWidget::setZoomCursorBox(const TQRectF rect) {
// If two of each cannot be found, return TQRectF()
CursorData* horiz[2];
CursorData* vert[2];
uint horizIndex[2];
uint vertIndex[2];
int j = 0;
int k = 0;
for (i=m_zoomCursorStartIndex;i<m_cursorArray.count(); i++) {
if (m_cursorArray[i]->orientation == TQt::Horizontal) {
if (j<2) {
vert[j] = m_cursorArray[i];
vertIndex[j] = i;
j++;
}
}
else {
if (k<2) {
horiz[k] = m_cursorArray[i];
horizIndex[j] = i;
k++;
}
}
@ -1398,9 +1408,13 @@ void TraceWidget::setZoomCursorBox(const TQRectF rect) {
if ((j>1) && (k>1)) {
// Set cursors...
vert[0]->position = boundedRect.y();
emit(cursorPositionChanged(vertIndex[0], m_cursorArray[vertIndex[0]]->position));
vert[1]->position = boundedRect.height();
emit(cursorPositionChanged(vertIndex[1], m_cursorArray[vertIndex[1]]->position));
horiz[0]->position = boundedRect.x();
emit(cursorPositionChanged(horizIndex[0], m_cursorArray[horizIndex[0]]->position));
horiz[1]->position = boundedRect.width();
emit(cursorPositionChanged(horizIndex[1], m_cursorArray[horizIndex[1]]->position));
updateCursorText();
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) {
uint oldcount = m_traceArray.count();

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

Loading…
Cancel
Save