[Debichem-commits] [SCM] massXpert mass spectrometry suite: debian packaging branch, debian, updated. upstream/3.2.0-1-g5564507

Filippo Rusconi (Debian Maintainer) rusconi-debian at laposte.net
Thu Nov 24 21:27:09 UTC 2011


The following commit has been merged in the debian branch:
commit 0d057db80ac18b29ba5ab16f7f002c2388045a25
Author: Filippo Rusconi (Debian Maintainer) <rusconi-debian at laposte.net>
Date:   Mon Sep 14 20:26:59 2009 +0200

    Added spaces around formulas being added in the calculator's formula line edit widget
    when both Ctrl and Shift keys are pressed while clicking onto a chemical pad's button. Useful to maintain good lisibility of the
    formulas being added to the formula line edit widget.

diff --git a/gui/calculatorChemPadDlg.cpp b/gui/calculatorChemPadDlg.cpp
index 121d211..4294d70 100644
--- a/gui/calculatorChemPadDlg.cpp
+++ b/gui/calculatorChemPadDlg.cpp
@@ -114,8 +114,20 @@ namespace massXpert
     CalculatorWnd *wnd = static_cast<CalculatorWnd *>(parentWidget());
    
     Qt::KeyboardModifiers modifiers = event->modifiers();
+
+    int formulaHandling = wnd->m_formulaHandling;
+
     if (modifiers & Qt::ControlModifier)
-      wnd->shouldAppendFormula(true);
+      {
+	formulaHandling |= MXP_FORMULA_HANDLING_PRINT;
+      }
+    
+    if (modifiers & Qt::ShiftModifier)
+      {
+	formulaHandling |= MXP_FORMULA_HANDLING_WITH_SPACE;
+      }
+    
+      wnd->setFormulaHandling(formulaHandling);
     
     return event->accept(); 
   }
@@ -128,8 +140,19 @@ namespace massXpert
 
     Qt::KeyboardModifiers modifiers = event->modifiers();
 
+    int formulaHandling = wnd->m_formulaHandling;
+    
     if (!(modifiers & Qt::ControlModifier))
-      wnd->shouldAppendFormula(false);
+      {
+	formulaHandling &= ~MXP_FORMULA_HANDLING_PRINT;
+      }
+    
+    if (!(modifiers & Qt::ShiftModifier))
+      {
+	formulaHandling &= ~MXP_FORMULA_HANDLING_WITH_SPACE;
+      }
+    
+    wnd->setFormulaHandling(formulaHandling);
 
     return event->accept(); 
   }
diff --git a/gui/calculatorWnd.cpp b/gui/calculatorWnd.cpp
index 91a6d68..1b1311b 100644
--- a/gui/calculatorWnd.cpp
+++ b/gui/calculatorWnd.cpp
@@ -59,7 +59,7 @@ namespace massXpert
     m_forciblyClose = false;
     m_noDelistWnd = false;
 
-    m_shouldAppendFormula = false;
+    m_formulaHandling = MXP_FORMULA_HANDLING_IMMEDIATE;
     
     if (filePath.isEmpty())
       {
@@ -890,10 +890,17 @@ namespace massXpert
     
     // If the 'formula' parameter contains a string, then two cases arise:
 
-    // 1. If m_shouldAppendFormula is true, then do not account the
-    // formula, but simply insert it in the formula line edit widget.
+    // 1. If m_formulaHandling has the MXP_FORMULA_HANDLING_PRINT bit
+    // set, then do not account the formula, but simply insert it in
+    // the formula line edit widget.
 
-    // 2. Otherwise, account the formula and return immediately.
+    // 2. If m_formulaHandling has the MXP_FORMULA_HANDLING_WITH_SPACE
+    // bit set, then also add a space to the formula (this is
+    // interesting when sending a large number of forumulas, so that
+    // each sent one is distinct from the next one.
+
+    // 2. If m_formulaHandling has the MXP_FORMULA_HANDLING_IMMEDIATE
+    // bit set, then account the formula immediately and return.
 
     // Both situations 1. and 2. are related to this function being
     //  called from one chemical pad button.
@@ -904,9 +911,19 @@ namespace massXpert
 	// evaluate it immediately or if we have to just insert it in
 	// the formula line edit widget.
 
-	if (m_shouldAppendFormula)
+	if (m_formulaHandling & MXP_FORMULA_HANDLING_PRINT)
 	  {
-	    m_ui.formulaLineEdit->insert(formula);
+	    if (m_formulaHandling & MXP_FORMULA_HANDLING_WITH_SPACE)
+	      {
+		m_ui.formulaLineEdit->insert(QString (" "));
+		m_ui.formulaLineEdit->insert(formula);
+		m_ui.formulaLineEdit->insert(QString (" "));
+	      }
+	    else
+	      {
+		m_ui.formulaLineEdit->insert(formula);
+	      }
+	    
 	    return;
 	  }
 	else
@@ -1308,9 +1325,9 @@ namespace massXpert
 
 
   void  
-  CalculatorWnd::shouldAppendFormula(bool append)
+  CalculatorWnd::setFormulaHandling(int val)
   {
-    m_shouldAppendFormula = append;
+    m_formulaHandling = val;
   }
   
 
diff --git a/gui/calculatorWnd.hpp b/gui/calculatorWnd.hpp
index 06b152a..19352d9 100644
--- a/gui/calculatorWnd.hpp
+++ b/gui/calculatorWnd.hpp
@@ -50,10 +50,20 @@
 #include "calculatorRecorderDlg.hpp"
 #include "calculatorChemPadDlg.hpp"
 
-
+  
 namespace massXpert
 {
 
+  enum MxpFormulaHandling
+    {
+      MXP_FORMULA_HANDLING_IMMEDIATE = 1 << 0,
+      MXP_FORMULA_HANDLING_PRINT = 1 << 1,
+      MXP_FORMULA_HANDLING_WITH_SPACE = 1 << 2,
+      MXP_FORMULA_HANDLING_PRINT_WITH_SPACE =
+      (MXP_FORMULA_HANDLING_PRINT | MXP_FORMULA_HANDLING_WITH_SPACE),
+    };
+  
+  
   class CalculatorWnd : public QMainWindow
   {
     Q_OBJECT
@@ -75,7 +85,8 @@ namespace massXpert
   public:
     bool m_forciblyClose;
     bool m_noDelistWnd;
-    bool m_shouldAppendFormula;
+
+    int m_formulaHandling;
   
     CalculatorWnd(QString &);
     ~CalculatorWnd();
@@ -100,7 +111,7 @@ namespace massXpert
     int accountModif();
     int accountSequence();
 
-    void shouldAppendFormula(bool);
+    void setFormulaHandling(int);
 				  		      
   public slots:
     void addToResult();

-- 
massXpert mass spectrometry suite: debian packaging



More information about the Debichem-commits mailing list