diff options
Diffstat (limited to 'clients')
-rw-r--r-- | clients/tde/src/part/commanalyzer/layout.ui | 48 | ||||
-rw-r--r-- | clients/tde/src/part/scope/layout.ui | 48 | ||||
-rw-r--r-- | clients/tde/src/part/scope/part.cpp | 20 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.cpp | 44 | ||||
-rw-r--r-- | clients/tde/src/widgets/tracewidget.h | 5 |
5 files changed, 106 insertions, 59 deletions
diff --git a/clients/tde/src/part/commanalyzer/layout.ui b/clients/tde/src/part/commanalyzer/layout.ui index 172fc93..fca0baa 100644 --- a/clients/tde/src/part/commanalyzer/layout.ui +++ b/clients/tde/src/part/commanalyzer/layout.ui @@ -64,27 +64,35 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="TraceWidget" row="0" column="0" colspan="1"> + <widget class="TQSplitter" row="0" column="0" colspan="1"> <property name="name"> - <cstring>traceWidget</cstring> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>80</height> - </size> - </property> - </widget> - <widget class="TraceWidget" row="1" column="0" colspan="1"> - <property name="name"> - <cstring>traceZoomWidget</cstring> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>80</height> - </size> - </property> + <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>0</width> + <height>0</height> + </size> + </property> + </widget> + <widget class="TraceWidget" row="1" column="0" colspan="1"> + <property name="name"> + <cstring>traceZoomWidget</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </widget> </widget> </grid> </widget> diff --git a/clients/tde/src/part/scope/layout.ui b/clients/tde/src/part/scope/layout.ui index 038bf7f..9390e82 100644 --- a/clients/tde/src/part/scope/layout.ui +++ b/clients/tde/src/part/scope/layout.ui @@ -64,27 +64,35 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="TraceWidget" row="0" column="0" colspan="1"> + <widget class="TQSplitter" row="0" column="0" colspan="1"> <property name="name"> - <cstring>traceWidget</cstring> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>80</height> - </size> - </property> - </widget> - <widget class="TraceWidget" row="1" column="0" colspan="1"> - <property name="name"> - <cstring>traceZoomWidget</cstring> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>80</height> - </size> - </property> + <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>0</width> + <height>0</height> + </size> + </property> + </widget> + <widget class="TraceWidget" row="1" column="0" colspan="1"> + <property name="name"> + <cstring>traceZoomWidget</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </widget> </widget> </grid> </widget> diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp index d6dda20..9909e65 100644 --- a/clients/tde/src/part/scope/part.cpp +++ b/clients/tde/src/part/scope/part.cpp @@ -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); - 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)))); + 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)); diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index e62bdb0..6375a13 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -336,20 +336,22 @@ CursorData::~CursorData() { } void CursorData::drawCursor(TQPainter* p, int graticule_width, int graticule_height) { - if (highlighted) { - p->setPen(highlightColor.dark(parentWidget->m_cursorDarkness)); - } - else { - p->setPen(color.dark(parentWidget->m_cursorDarkness)); - } + if (enabled) { + if (highlighted) { + p->setPen(highlightColor.dark(parentWidget->m_cursorDarkness)); + } + else { + p->setPen(color.dark(parentWidget->m_cursorDarkness)); + } - if (orientation == TQt::Vertical) { - int x = abs(((position)/(100.0))*(graticule_width)); - p->drawLine(x, 0, x, graticule_height); - } - else { - int y = abs(((position)/(100.0))*(graticule_height)); - p->drawLine(0, y, graticule_width, y); + if (orientation == TQt::Vertical) { + int x = abs(((position)/(100.0))*(graticule_width)); + p->drawLine(x, 0, x, graticule_height); + } + else { + int y = abs(((position)/(100.0))*(graticule_height)); + 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) { 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(); diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h index 130904f..7ca1e24 100644 --- a/clients/tde/src/widgets/tracewidget.h +++ b/clients/tde/src/widgets/tracewidget.h @@ -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); |