Skip to content

Commit 6db1419

Browse files
committed
Fixed comments.
Fixed path for AddInstrumentDIalog on connection error.
1 parent ddd3540 commit 6db1419

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

src/ngscopeclient/AddInstrumentDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ AddInstrumentDialog::AddInstrumentDialog(
6767
{
6868
SCPITransport::EnumTransports(m_transports);
6969
m_supportedTransports.insert(m_transports.begin(), m_transports.end());
70-
m_pathEdited = false;
70+
m_pathEdited = !m_path.empty();
7171
m_defaultNickname = nickname;
7272
m_originalNickname = nickname;
7373
m_nicknameEdited = false;

src/ngscopeclient/WaveformArea.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ void WaveformArea::AddStream(StreamDescriptor desc, bool persistence, const stri
448448
}
449449

450450
/**
451-
@brief Adds a new stream to this plot at given position
451+
@brief Adds a new stream to this plot at a given position
452452
*/
453453
void WaveformArea::AddStream(StreamDescriptor desc, size_t position, bool persistence, const string& ramp)
454454
{
@@ -468,7 +468,7 @@ void WaveformArea::AddStream(StreamDescriptor desc, size_t position, bool persis
468468
/**
469469
* Get the position of the provided Stream in this WaveformArea
470470
* @param desc the stream to get the position for
471-
* @return the position of the stream if found or the number of channel in this WaveformArea otherwise
471+
* @return the position of the stream if found or the number of displayed channels in this WaveformArea otherwise
472472
*/
473473
size_t WaveformArea::GetStreamPosition(StreamDescriptor desc)
474474
{
@@ -485,7 +485,9 @@ size_t WaveformArea::GetStreamPosition(StreamDescriptor desc)
485485
}
486486

487487
/**
488-
@brief Adds a new stream to this plot
488+
@brief Move a stream to another position in this plot
489+
@param desc the stream to move
490+
@param newPosition the position to move the stream to
489491
*/
490492
void WaveformArea::MoveStream(StreamDescriptor desc, size_t newPosition)
491493
{
@@ -3332,7 +3334,8 @@ void WaveformArea::DragDropOverlays(ImVec2 start, ImVec2 size, int iArea, int nu
33323334
{
33333335
bool isFirst = (iArea == 0);
33343336
bool isLast = (iArea == (numAreas-1));
3335-
//Drag/drop areas for splitting
3337+
// Drag/drop areas size and positions : we keep 10% of the waveform area for edge ans split drop areas,
3338+
// the rest is used for dropping/moving wavefroms at a specific postion in the waveform area
33363339
float dragAreaWidth = max((double)size.x*0.1,(double)FILL_SIZE);
33373340
float dragAreaHeight = max((double)size.y*0.1,(double)FILL_SIZE);
33383341
// Make sure we have room for two split drag area overlays (needed for last row)
@@ -3343,11 +3346,12 @@ void WaveformArea::DragDropOverlays(ImVec2 start, ImVec2 size, int iArea, int nu
33433346
float bottomDragAreaY = start.y + size.y - dragAreaHeight;
33443347
float bottomSplitDragAreaY = start.y + size.y - splitDragAreaHeight;
33453348
ImVec2 edgeSize(dragAreaWidth, dragAreaHeight);
3349+
// Height for split area may be reduced to fit available space in waveform area
33463350
ImVec2 edgeSizeSplit(dragAreaWidth, splitDragAreaHeight);
33473351
bool hit = false;
33483352

33493353
if(isFirst)
3350-
{
3354+
{ // Add top drop area to first waveform area of the group
33513355
hit |= EdgeDropArea(
33523356
"top",
33533357
ImVec2(middleDragAreaX, start.y),
@@ -3356,20 +3360,23 @@ void WaveformArea::DragDropOverlays(ImVec2 start, ImVec2 size, int iArea, int nu
33563360
}
33573361

33583362
if(isLast)
3359-
{
3363+
{ // Add bottom drop area to last waveform area of the group
33603364
hit |= EdgeDropArea(
33613365
"bottom",
33623366
ImVec2(middleDragAreaX, bottomDragAreaY),
33633367
edgeSize,
33643368
ImGuiDir_Down);
33653369
}
33663370

3371+
// Add split drop area at the top of each and every waveform area of the waveform group
33673372
hit |= CenterRightDropArea(ImVec2(middleDragAreaX + dragAreaWidth, start.y), edgeSizeSplit, ImGuiDir_Up);
3373+
// Only add bottom split drop area to the last waveform area of a waveform group
33683374
if(isLast) hit |= CenterRightDropArea(ImVec2(middleDragAreaX + dragAreaWidth, bottomSplitDragAreaY), edgeSizeSplit, ImGuiDir_Down);
33693375

33703376
hit |= EdgeDropArea("left", ImVec2(start.x, middleDragAreaY), edgeSize, ImGuiDir_Left);
33713377
hit |= EdgeDropArea("right", ImVec2(rightDragAreaX, middleDragAreaY), edgeSize, ImGuiDir_Right);
33723378

3379+
// If we've hit any of other drop areas, process center drop area
33733380
if(!hit) CenterDropArea(start, ImVec2(size.x, size.y));
33743381

33753382
//Cannot drop scalars into a waveform view. Make this a bit more obvious
@@ -3545,15 +3552,12 @@ bool WaveformArea::EdgeDropArea(const string& name, ImVec2 start, ImVec2 size, I
35453552
}
35463553

35473554
/**
3548-
@brief Drop area between two waveform areas in a waveform group
3549-
3550-
Used to reorder waveform areas within the waveform group
3555+
@brief Main drop area used to drop a stream in this waveform area at a given position
35513556
*/
35523557
void WaveformArea::CenterDropArea(ImVec2 start, ImVec2 size)
35533558
{
35543559
ImGui::SetCursorScreenPos(start);
35553560
ImGui::InvisibleButton("center", size);
3556-
//ImGui::Button("center", size);
35573561
ImGui::SetNextItemAllowOverlap();
35583562

35593563
auto payload = ImGui::GetDragDropPayload();
@@ -3680,10 +3684,9 @@ void WaveformArea::CenterDropArea(ImVec2 start, ImVec2 size)
36803684
return;
36813685
}
36823686

3683-
//Draw overlay target
36843687
if(hover)
36853688
{
3686-
//Draw overlay target
3689+
//Draw an horizontal line at the insertion position
36873690
const ImU32 lineColor = ImGui::GetColorU32(ImGuiCol_DockingPreview, 1.00f);
36883691
ImVec2 center(start.x + size.x/2, start.y + insertionYPosition);
36893692
float fillSize = size.x;

src/ngscopeclient/WaveformGroup.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* ngscopeclient *
44
* *
5-
* Copyright (c) 2012-2025 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -102,6 +102,9 @@ void WaveformGroup::AddArea(shared_ptr<WaveformArea>& area)
102102
m_parent->RefreshStreamBrowserDialog();
103103
}
104104

105+
/**
106+
@brief Adds a new area to this group at a given position
107+
*/
105108
void WaveformGroup::AddArea(shared_ptr<WaveformArea>& area, size_t position)
106109
{
107110
lock_guard<mutex> lock(m_areaMutex);
@@ -145,6 +148,11 @@ size_t WaveformGroup::GetAreaPosition(WaveformArea& area)
145148
}
146149
}
147150

151+
/**
152+
@brief Move a waveform are to another position in this group
153+
@param area the waveform area to move
154+
@param newPosition the position to move the waveform area to
155+
*/
148156
void WaveformGroup::MoveArea(WaveformArea& area, size_t newPosition)
149157
{
150158
lock_guard<mutex> lock(m_areaMutex);

src/ngscopeclient/WaveformGroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* *
33
* ngscopeclient *
44
* *
5-
* Copyright (c) 2012-2025 Andrew D. Zonenberg and contributors *
5+
* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
66
* All rights reserved. *
77
* *
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *

0 commit comments

Comments
 (0)