From 9be9059fbb6c705872b6371b64660592f33a0d95 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Mon, 20 Nov 2023 13:17:28 +0100
Subject: [PATCH] hide footprint form

---
 GUI/View/Instrument/DepthprobeInstrumentEditor.cpp |  2 +-
 GUI/View/Instrument/OffspecInstrumentEditor.cpp    |  2 +-
 GUI/View/Instrument/ScanEditor.cpp                 | 12 ++++++++----
 GUI/View/Instrument/ScanEditor.h                   |  3 ++-
 GUI/View/Instrument/SpecularInstrumentEditor.cpp   |  2 +-
 5 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/GUI/View/Instrument/DepthprobeInstrumentEditor.cpp b/GUI/View/Instrument/DepthprobeInstrumentEditor.cpp
index cf11dbc41db..0eaf771804f 100644
--- a/GUI/View/Instrument/DepthprobeInstrumentEditor.cpp
+++ b/GUI/View/Instrument/DepthprobeInstrumentEditor.cpp
@@ -29,7 +29,7 @@ DepthprobeInstrumentEditor::DepthprobeInstrumentEditor(QWidget* parent,
     auto* layout = new QVBoxLayout(this);
     layout->setContentsMargins(0, 0, 0, 0);
 
-    auto* scanEditor = new ScanEditor(this, instrument->scanItem(), &m_ec, false);
+    auto* scanEditor = new ScanEditor(this, instrument->scanItem(), &m_ec, false, false);
     layout->addWidget(scanEditor);
 
     auto* depthAxisEditor = new AxisPropertyForm(this, "Depth axis", &instrument->zAxis(),
diff --git a/GUI/View/Instrument/OffspecInstrumentEditor.cpp b/GUI/View/Instrument/OffspecInstrumentEditor.cpp
index 5259d72a055..77ad00d0558 100644
--- a/GUI/View/Instrument/OffspecInstrumentEditor.cpp
+++ b/GUI/View/Instrument/OffspecInstrumentEditor.cpp
@@ -29,7 +29,7 @@ OffspecInstrumentEditor::OffspecInstrumentEditor(QWidget* parent, OffspecInstrum
     auto* layout = new QVBoxLayout(this);
     layout->setContentsMargins(0, 0, 0, 0);
 
-    auto* scanEditor = new ScanEditor(this, instrument->scanItem(), &m_ec, false);
+    auto* scanEditor = new ScanEditor(this, instrument->scanItem(), &m_ec, true, false);
     layout->addWidget(scanEditor);
 
     auto* detectorEditor = new OffspecDetectorEditor(this, instrument);
diff --git a/GUI/View/Instrument/ScanEditor.cpp b/GUI/View/Instrument/ScanEditor.cpp
index cba5bec3cbe..93d2cd4ae27 100644
--- a/GUI/View/Instrument/ScanEditor.cpp
+++ b/GUI/View/Instrument/ScanEditor.cpp
@@ -24,7 +24,8 @@
 #include <QFormLayout>
 #include <QLineEdit>
 
-ScanEditor::ScanEditor(QWidget* parent, ScanItem* item, InstrumentNotifier* ec, bool allow_distr)
+ScanEditor::ScanEditor(QWidget* parent, ScanItem* item, InstrumentNotifier* ec,
+                       bool allow_footprint, bool allow_distr)
     : CollapsibleGroupBox("Beam and scan parameters", parent, item->expandBeamParameters)
 {
     auto* layout = new QVBoxLayout;
@@ -44,6 +45,7 @@ ScanEditor::ScanEditor(QWidget* parent, ScanItem* item, InstrumentNotifier* ec,
     validator->setRange(0.0, 1e32, 1000);
 
     auto* hLayout = new QHBoxLayout;
+    hLayout->setAlignment(Qt::AlignLeft);
     layout->addLayout(hLayout);
 
     auto* wavelengthEditor = new DistributionEditor("Wavelength (nm)", MeanConfig{true},
@@ -54,8 +56,11 @@ ScanEditor::ScanEditor(QWidget* parent, ScanItem* item, InstrumentNotifier* ec,
     auto* inclinationEditor = new AlphaScanEditor(this, item->grazingScanItem(), allow_distr);
     hLayout->addWidget(inclinationEditor);
 
-    auto* footprintEditor = new FootprintForm(this, item);
-    hLayout->addWidget(footprintEditor);
+    if (allow_footprint) {
+        auto* footprintEditor = new FootprintForm(this, item);
+        hLayout->addWidget(footprintEditor);
+        connect(footprintEditor, &FootprintForm::dataChanged, this, &ScanEditor::dataChanged);
+    }
 
     intensityLineEdit->setText(QString::number(item->intensity()));
 
@@ -73,7 +78,6 @@ ScanEditor::ScanEditor(QWidget* parent, ScanItem* item, InstrumentNotifier* ec,
     connect(inclinationEditor, &AlphaScanEditor::dataChanged, wavelengthEditor,
             &DistributionEditor::updateData);
 
-    connect(footprintEditor, &FootprintForm::dataChanged, this, &ScanEditor::dataChanged);
 
     // validate value while typing
     connect(intensityLineEdit, &QLineEdit::textEdited, [this, intensityLineEdit, item]() {
diff --git a/GUI/View/Instrument/ScanEditor.h b/GUI/View/Instrument/ScanEditor.h
index 976fe909ca4..e1db8820998 100644
--- a/GUI/View/Instrument/ScanEditor.h
+++ b/GUI/View/Instrument/ScanEditor.h
@@ -25,7 +25,8 @@ class ScanItem;
 class ScanEditor : public CollapsibleGroupBox {
     Q_OBJECT
 public:
-    ScanEditor(QWidget* parent, ScanItem* item, InstrumentNotifier* ec, bool allow_distr = true);
+    ScanEditor(QWidget* parent, ScanItem* item, InstrumentNotifier* ec, bool allow_footprint,
+               bool allow_distr);
 
 signals:
     void dataChanged();
diff --git a/GUI/View/Instrument/SpecularInstrumentEditor.cpp b/GUI/View/Instrument/SpecularInstrumentEditor.cpp
index 018c1dc5186..23d26f89f9b 100644
--- a/GUI/View/Instrument/SpecularInstrumentEditor.cpp
+++ b/GUI/View/Instrument/SpecularInstrumentEditor.cpp
@@ -29,7 +29,7 @@ SpecularInstrumentEditor::SpecularInstrumentEditor(QWidget* parent,
     auto* layout = new QVBoxLayout(this);
     layout->setContentsMargins(0, 0, 0, 0);
 
-    auto* scanEditor = new ScanEditor(this, instrument->scanItem(), &m_ec);
+    auto* scanEditor = new ScanEditor(this, instrument->scanItem(), &m_ec, true, true);
     layout->addWidget(scanEditor);
 
     auto* polMatricesAnalysisEditor = new PolarizationAnalysisEditor(this, instrument);
-- 
GitLab