Skip to content

Commit 1fd1a19

Browse files
author
Frederic Borry
committed
Fixed node rendering for fiters.
1 parent 2633bf1 commit 1fd1a19

1 file changed

Lines changed: 52 additions & 46 deletions

File tree

src/ngscopeclient/StreamBrowserDialog.cpp

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,13 +1910,16 @@ void StreamBrowserDialog::renderChannelNode(shared_ptr<Instrument> instrument, s
19101910
{
19111911
if(!singleStream)
19121912
{
1913-
if(BeginBlock("stream_params",true,"Open channel properties"))
1914-
{
1915-
m_parent->ShowChannelProperties(scopechan);
1916-
}
19171913
auto scopeState = m_session.GetOscillopscopeState(scope);
1918-
renderChannelProperties(scope,scopechan,channelIndex,scopeState);
1914+
if(scopeState)
1915+
{
1916+
if(BeginBlock("stream_params",true,"Open channel properties"))
1917+
{
1918+
m_parent->ShowChannelProperties(scopechan);
1919+
}
1920+
renderChannelProperties(scope,scopechan,channelIndex,scopeState);
19191921
EndBlock();
1922+
}
19201923
}
19211924
size_t streamCount = channel->GetStreamCount();
19221925
for(size_t j=0; j<streamCount; j++)
@@ -2070,58 +2073,61 @@ void StreamBrowserDialog::renderStreamNode(shared_ptr<Instrument> instrument, In
20702073
}
20712074
if(hasProps)
20722075
{
2073-
if(BeginBlock("stream_params",true,"Open channel properties"))
2074-
{
2075-
m_parent->ShowChannelProperties(scopechan);
2076-
}
2077-
2078-
Unit unit = channel->GetYAxisUnits(streamIndex);
2079-
size_t channelIndex = scopechan->GetIndex();
20802076
auto scopeState = m_session.GetOscillopscopeState(scope);
2077+
if(scopeState)
2078+
{ // For now, only show properties for scope channel / streams
2079+
if(BeginBlock("stream_params",true,"Open channel properties"))
2080+
{
2081+
m_parent->ShowChannelProperties(scopechan);
2082+
}
20812083

2082-
switch (type)
2083-
{
2084-
case Stream::STREAM_TYPE_ANALOG:
2085-
{
2086-
if(!renderName)
2087-
{ // No streams => display channel properties here
2088-
renderChannelProperties(scope,scopechan,channelIndex,scopeState);
2089-
}
2090-
if(renderEditablePropertyWithExplicitApply(0,"Offset",scopeState->m_strOffset[channelIndex][streamIndex],scopeState->m_committedOffset[channelIndex][streamIndex],unit))
2091-
{ // Update offset
2092-
scopechan->SetOffset(scopeState->m_committedOffset[channelIndex][streamIndex],streamIndex);
2093-
scopeState->m_needsUpdate[channelIndex] = true;
2094-
}
2095-
if(renderEditablePropertyWithExplicitApply(0,"Vertical range",scopeState->m_strRange[channelIndex][streamIndex],scopeState->m_committedRange[channelIndex][streamIndex],unit))
2096-
{ // Update offset
2097-
scopechan->SetVoltageRange(scopeState->m_committedRange[channelIndex][streamIndex],streamIndex);
2098-
scopeState->m_needsUpdate[channelIndex] = true;
2099-
}
2100-
}
2101-
break;
2102-
case Stream::STREAM_TYPE_DIGITAL:
2103-
if(scope)
2104-
{
2105-
if(scope->IsDigitalThresholdConfigurable())
2084+
Unit unit = channel->GetYAxisUnits(streamIndex);
2085+
size_t channelIndex = scopechan->GetIndex();
2086+
2087+
switch (type)
2088+
{
2089+
case Stream::STREAM_TYPE_ANALOG:
21062090
{
2107-
if(renderEditablePropertyWithExplicitApply(0,"Threshold",scopeState->m_strDigitalThreshold[channelIndex],scopeState->m_committedDigitalThreshold[channelIndex],unit))
2091+
if(!renderName)
2092+
{ // No streams => display channel properties here
2093+
renderChannelProperties(scope,scopechan,channelIndex,scopeState);
2094+
}
2095+
if(renderEditablePropertyWithExplicitApply(0,"Offset",scopeState->m_strOffset[channelIndex][streamIndex],scopeState->m_committedOffset[channelIndex][streamIndex],unit))
2096+
{ // Update offset
2097+
scopechan->SetOffset(scopeState->m_committedOffset[channelIndex][streamIndex],streamIndex);
2098+
scopeState->m_needsUpdate[channelIndex] = true;
2099+
}
2100+
if(renderEditablePropertyWithExplicitApply(0,"Vertical range",scopeState->m_strRange[channelIndex][streamIndex],scopeState->m_committedRange[channelIndex][streamIndex],unit))
21082101
{ // Update offset
2109-
scopechan->SetDigitalThreshold(scopeState->m_committedDigitalThreshold[channelIndex]);
2102+
scopechan->SetVoltageRange(scopeState->m_committedRange[channelIndex][streamIndex],streamIndex);
21102103
scopeState->m_needsUpdate[channelIndex] = true;
21112104
}
21122105
}
2113-
else
2106+
break;
2107+
case Stream::STREAM_TYPE_DIGITAL:
2108+
if(scope)
21142109
{
2115-
auto threshold_txt = unit.PrettyPrint(scope->GetDigitalThreshold(scopechan->GetIndex()));
2116-
renderReadOnlyProperty(0,"Threshold", threshold_txt);
2110+
if(scope->IsDigitalThresholdConfigurable())
2111+
{
2112+
if(renderEditablePropertyWithExplicitApply(0,"Threshold",scopeState->m_strDigitalThreshold[channelIndex],scopeState->m_committedDigitalThreshold[channelIndex],unit))
2113+
{ // Update offset
2114+
scopechan->SetDigitalThreshold(scopeState->m_committedDigitalThreshold[channelIndex]);
2115+
scopeState->m_needsUpdate[channelIndex] = true;
2116+
}
2117+
}
2118+
else
2119+
{
2120+
auto threshold_txt = unit.PrettyPrint(scope->GetDigitalThreshold(scopechan->GetIndex()));
2121+
renderReadOnlyProperty(0,"Threshold", threshold_txt);
2122+
}
2123+
break;
21172124
}
2125+
//fall through
2126+
default:
21182127
break;
2119-
}
2120-
//fall through
2121-
default:
2122-
break;
2128+
}
2129+
EndBlock();
21232130
}
2124-
EndBlock();
21252131
}
21262132
}
21272133
ImGui::PopID();

0 commit comments

Comments
 (0)