@@ -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 */
453453void 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 */
473473size_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 */
490492void 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 */
35523557void 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 ;
0 commit comments