From 238e49b83e3e89900166e7e68225e74903410402 Mon Sep 17 00:00:00 2001
From: even <philippe.even@loria.fr>
Date: Sat, 10 Nov 2018 11:41:37 +0100
Subject: [PATCH] All segments on black background

---
 Code/Seg/BSTools/bsdetectionwidget.cpp | 10 +++++++++-
 Code/Seg/BSTools/bsdetectionwidget.h   |  2 ++
 Methode/ctrl.tex                       |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Code/Seg/BSTools/bsdetectionwidget.cpp b/Code/Seg/BSTools/bsdetectionwidget.cpp
index 290d72a..a5e919e 100755
--- a/Code/Seg/BSTools/bsdetectionwidget.cpp
+++ b/Code/Seg/BSTools/bsdetectionwidget.cpp
@@ -34,6 +34,7 @@ BSDetectionWidget::BSDetectionWidget (QWidget *parent)
   alternate = 0;
   verbose = false;
   capture = false;
+  paintItBlack = false;
   exam = -1;
 }
 
@@ -289,7 +290,12 @@ void BSDetectionWidget::keyPressEvent (QKeyEvent *event)
         cout << "Multi-selection "
              << (detector.isMultiSelection () ? "on" : "off") << endl;
       }
-      else extractAll ();
+      else
+      {
+        if (event->modifiers () & Qt::ControlModifier)
+          paintItBlack = ! paintItBlack;
+        extractAll ();
+      }
       break;
 
     case Qt::Key_L : // Next multi-selected segment
@@ -621,6 +627,8 @@ void BSDetectionWidget::extractAll ()
   if (! formerMultiMode) detector.switchMultiSelection ();
   augmentedImage = loadedImage;
   QPainter painter (&augmentedImage);
+  if (paintItBlack) painter.fillRect (0, 0, width, height, QBrush (Qt::black));
+  paintItBlack = false;
 
   detector.detectAll ();
 
diff --git a/Code/Seg/BSTools/bsdetectionwidget.h b/Code/Seg/BSTools/bsdetectionwidget.h
index 3930f64..d85c2d7 100755
--- a/Code/Seg/BSTools/bsdetectionwidget.h
+++ b/Code/Seg/BSTools/bsdetectionwidget.h
@@ -164,6 +164,8 @@ private:
   bool verbose;
   /** Flag indicating whether extraction result should be captured. */
   bool capture;
+  /** Flag indicating whether no background should be displayed. */
+  bool paintItBlack;
 
   /** Activation of alternate comparative tests (F8). */
   int alternate;
diff --git a/Methode/ctrl.tex b/Methode/ctrl.tex
index d63bfd9..4a9450c 100755
--- a/Methode/ctrl.tex
+++ b/Methode/ctrl.tex
@@ -35,6 +35,7 @@ q && Retour d'absence (1 / longueur absence) \\
 Ctrl-c/v/z && Enregistre / Affiche / Supprime les segments \\
 M && Commute la multi-d\'etection \\
 m && D\'etection exhaustive de tous les segments \\
+Ctrl-m && D\'etection exhaustive de tous les segments sur fond noir \\
 l && Examine le segment suivant dans une multi-d\'etection \\
 j && Commute la d\'etection pr\'eliminaire \\
 t && Commute l'amincissement progressif \\
-- 
GitLab