diff --git a/src-interface/viewer2/handler/dataset/dataset_handler.cpp b/src-interface/viewer2/handler/dataset/dataset_handler.cpp index 58d3fc0b0..eb9d88b85 100644 --- a/src-interface/viewer2/handler/dataset/dataset_handler.cpp +++ b/src-interface/viewer2/handler/dataset/dataset_handler.cpp @@ -11,6 +11,10 @@ namespace satdump { instrument_products = std::make_shared("Instruments"); general_products = std::make_shared(); + instrument_products->setCanBeDragged(false); + instrument_products->setCanBeDraggedTo(false); + instrument_products->setSubHandlersCanBeDragged(false); + general_products->setCanBeDragged(false); addSubHandler(instrument_products); addSubHandler(general_products); } diff --git a/src-interface/viewer2/handler/handler.cpp b/src-interface/viewer2/handler/handler.cpp index 5e1b2c0da..c25702a02 100644 --- a/src-interface/viewer2/handler/handler.cpp +++ b/src-interface/viewer2/handler/handler.cpp @@ -41,7 +41,8 @@ namespace satdump h = handler; // TODOREWORK CLEANUP - if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) + if (handler_can_subhandlers_be_dragged && handler->handler_can_be_dragged && + ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) { auto del = [this](std::shared_ptr handler) { @@ -55,7 +56,7 @@ namespace satdump ImGui::EndDragDropSource(); } - if (ImGui::BeginDragDropTarget()) + if (handler->handler_can_be_dragged_to && ImGui::BeginDragDropTarget()) { if (const ImGuiPayload *payload = ImGui::AcceptDragDropPayload("VIEWER_HANDLER")) { diff --git a/src-interface/viewer2/handler/handler.h b/src-interface/viewer2/handler/handler.h index 38b3035e2..0bc3752cd 100644 --- a/src-interface/viewer2/handler/handler.h +++ b/src-interface/viewer2/handler/handler.h @@ -28,13 +28,17 @@ namespace satdump * handler as a dependency. */ class Handler - { // TODOREWORK PRIVATE DELETE STUFF + { private: TreeDrawerToClean tree_local; std::vector> subhandlers; std::mutex subhandlers_mtx; std::vector> subhandlers_marked_for_del; + bool handler_can_be_dragged = true; + bool handler_can_be_dragged_to = true; + bool handler_can_subhandlers_be_dragged = true; + public: /** * @brief Render viewer menu left sidebar @@ -88,6 +92,33 @@ namespace satdump */ void delSubHandler(std::shared_ptr handler); + /** + * @brief Set if a handler can be dragged around in the tree + * @param v true to have it be draggable + */ + void setCanBeDragged(bool v) + { + handler_can_be_dragged = v; + } + + /** + * @brief Set if a handler can be dragged to in the tree + * @param v true to have it be a valid drag target + */ + void setCanBeDraggedTo(bool v) + { + handler_can_be_dragged_to = v; + } + + /** + * @brief Set if a handler's subhandlers can be dragged to in the tree + * @param v true to have them be draggable + */ + void setSubHandlersCanBeDragged(bool v) + { + handler_can_subhandlers_be_dragged = v; + } + public: static std::string getID(); // TODOREWORK static std::shared_ptr getInstance(); diff --git a/src-interface/viewer2/handler/product/image_product_handler.cpp b/src-interface/viewer2/handler/product/image_product_handler.cpp index 24e9e891f..ddae4ec8d 100644 --- a/src-interface/viewer2/handler/product/image_product_handler.cpp +++ b/src-interface/viewer2/handler/product/image_product_handler.cpp @@ -36,7 +36,9 @@ namespace satdump auto &ch = product->images[channel_selection_curr_id]; if (ch.wavenumber != -1) + { ImGui::Text("Wavenumber : %f", ch.wavenumber); + } } if (needs_to_be_disabled) @@ -58,6 +60,7 @@ namespace satdump if (needs_to_be_disabled) style::endDisabled(); + ImGui::SameLine(); ImGui::ProgressBar(progress); }