[qet] [4674] Conductor Autonum now works with variables.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4674
Author:   dfochi
Date:     2016-08-29 17:37:42 +0200 (Mon, 29 Aug 2016)
Log Message:
-----------
Conductor Autonum now works with variables. Folio Autonumberings added to conductor autonum

Modified Paths:
--------------
    trunk/sources/conductorautonumerotation.cpp
    trunk/sources/conductorproperties.cpp
    trunk/sources/conductorproperties.h
    trunk/sources/configpages.cpp
    trunk/sources/diagram.cpp
    trunk/sources/diagram.h
    trunk/sources/diagramevent/diagrameventaddelement.cpp
    trunk/sources/diagramview.cpp
    trunk/sources/elementsmover.cpp
    trunk/sources/numerotationcontextcommands.cpp
    trunk/sources/projectconfigpages.cpp
    trunk/sources/projectconfigpages.h
    trunk/sources/projectview.cpp
    trunk/sources/qetgraphicsitem/conductor.cpp
    trunk/sources/qetgraphicsitem/conductor.h
    trunk/sources/qetgraphicsitem/customelement.cpp
    trunk/sources/qetgraphicsitem/element.cpp
    trunk/sources/qetgraphicsitem/terminal.cpp
    trunk/sources/qetproject.cpp
    trunk/sources/qetproject.h
    trunk/sources/ui/autonumberingdockwidget.cpp
    trunk/sources/ui/autonumberingmanagementw.cpp
    trunk/sources/ui/folioautonumbering.ui
    trunk/sources/ui/numparteditorw.cpp
    trunk/sources/ui/projectpropertiesdialog.cpp
    trunk/sources/ui/selectautonumw.cpp
    trunk/sources/ui/selectautonumw.h
    trunk/sources/ui/selectautonumw.ui

Added Paths:
-----------
    trunk/sources/ui/formulaautonumberingw.cpp
    trunk/sources/ui/formulaautonumberingw.h
    trunk/sources/ui/formulaautonumberingw.ui

Removed Paths:
-------------
    trunk/sources/ui/elementautonumberingw.cpp
    trunk/sources/ui/elementautonumberingw.h
    trunk/sources/ui/elementautonumberingw.ui

Modified: trunk/sources/conductorautonumerotation.cpp
===================================================================
--- trunk/sources/conductorautonumerotation.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/conductorautonumerotation.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -121,6 +121,5 @@
 	if (context.isEmpty()) return;
 
 	NumerotationContextCommands ncc (context, m_diagram);
-	applyText(ncc.toRepresentedString());
-	m_diagram->project()->addConductorAutoNum(m_diagram -> conductorsAutonumName(), ncc.next());
+	applyText(m_diagram->project()->conductorAutoNumCurrentFormula());
 }

Modified: trunk/sources/conductorproperties.cpp
===================================================================
--- trunk/sources/conductorproperties.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/conductorproperties.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -368,6 +368,15 @@
 }
 
 /**
+ * @brief ConductorProperties::setText
+ * This method sets the current conductor text
+ * @param text to be setted
+ */
+void ConductorProperties::setText(QString text) {
+	text = text;
+}
+
+/**
  * @brief ConductorProperties::defaultProperties
  * @return the default properties stored in the setting file
  */

Modified: trunk/sources/conductorproperties.h
===================================================================
--- trunk/sources/conductorproperties.h	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/conductorproperties.h	2016-08-29 15:37:42 UTC (rev 4674)
@@ -96,6 +96,7 @@
 		void toSettings(QSettings &, const QString & = QString()) const;
 		void fromSettings(QSettings &, const QString & = QString());
 		static QString typeToString(ConductorType);
+		void setText(QString);
 
 		static ConductorProperties defaultProperties();
 	

Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/configpages.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -206,7 +206,7 @@
 
 /**
  * @brief NewDiagramPage::saveCurrentTbp
- * Save current TBP to retrieve after auto folio num
+ * Save current TBP to retrieve after auto folio	num
  */
 void NewDiagramPage::saveCurrentTbp(){
 	savedTbp = ipw->properties();

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/diagram.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -82,6 +82,7 @@
 	connect(&border_and_titleblock, SIGNAL(borderChanged(QRectF,QRectF)), this, SLOT(adjustSceneRect()));
 	connect(&border_and_titleblock, SIGNAL(titleBlockFolioChanged(const QString &)), this, SLOT(updateLabels()));
 	connect(this, SIGNAL (diagramActivated()), this, SLOT(loadElmtFolioSeq()));
+	connect(this, SIGNAL (diagramActivated()), this, SLOT(loadCndFolioSeq()));
 	adjustSceneRect();
 }
 
@@ -477,26 +478,47 @@
 		//Default New Element
 		racine.setAttribute("freezeNewElement", m_freeze_new_elements_ ? "true" : "false");
 
-		//Folio Sequential Variables
+		//Element Folio Sequential Variables
 		if (!m_elmt_unitfolio_max.isEmpty() || !m_elmt_tenfolio_max.isEmpty() || !m_elmt_hundredfolio_max.isEmpty()) {
-			QDomElement folioContainedAutonum = document.createElement("elementautonumfoliosequentials");
+			QDomElement elmtfoliosequential = document.createElement("elementautonumfoliosequentials");
 			if (!m_elmt_unitfolio_max.isEmpty()) {
 				QDomElement elmtfolioseq = document.createElement("elementunitfolioseq");
-				elementFolioSequentialsToXml(&m_elmt_unitfolio_max, &elmtfolioseq, "sequf_", "unitfolioseq", &document);
-				folioContainedAutonum.appendChild(elmtfolioseq);
+				folioSequentialsToXml(&m_elmt_unitfolio_max, &elmtfolioseq, "sequf_", "unitfolioseq", &document);
+				elmtfoliosequential.appendChild(elmtfolioseq);
 			}
 			if (!m_elmt_tenfolio_max.isEmpty()) {
 				QDomElement elmtfolioseq = document.createElement("elementtenfolioseq");
-				elementFolioSequentialsToXml(&m_elmt_tenfolio_max, &elmtfolioseq, "seqtf_", "tenfolioseq", &document);
-				folioContainedAutonum.appendChild(elmtfolioseq);
+				folioSequentialsToXml(&m_elmt_tenfolio_max, &elmtfolioseq, "seqtf_", "tenfolioseq", &document);
+				elmtfoliosequential.appendChild(elmtfolioseq);
 			}
 			if (!m_elmt_hundredfolio_max.isEmpty()) {
 				QDomElement elmtfolioseq = document.createElement("elementhundredfolioseq");
-				elementFolioSequentialsToXml(&m_elmt_hundredfolio_max, &elmtfolioseq, "seqhf_", "hundredfolioseq", &document);
-				folioContainedAutonum.appendChild(elmtfolioseq);
+				folioSequentialsToXml(&m_elmt_hundredfolio_max, &elmtfolioseq, "seqhf_", "hundredfolioseq", &document);
+				elmtfoliosequential.appendChild(elmtfolioseq);
 			}
-			racine.appendChild(folioContainedAutonum);
+			racine.appendChild(elmtfoliosequential);
 		}
+		//Conductor Folio Sequential Variables
+		if (!m_cnd_unitfolio_max.isEmpty() || !m_cnd_tenfolio_max.isEmpty() || !m_cnd_hundredfolio_max.isEmpty()) {
+			QDomElement cndfoliosequential = document.createElement("conductorautonumfoliosequentials");
+			QHash<QString, QStringList>::iterator i;
+			if (!m_cnd_unitfolio_max.isEmpty()) {
+				QDomElement cndfolioseq = document.createElement("conductorunitfolioseq");
+				folioSequentialsToXml(&m_cnd_unitfolio_max, &cndfolioseq, "sequf_", "unitfolioseq", &document);
+				cndfoliosequential.appendChild(cndfolioseq);
+			}
+			if (!m_cnd_tenfolio_max.isEmpty()) {
+				QDomElement cndfolioseq = document.createElement("conductortenfolioseq");
+				folioSequentialsToXml(&m_cnd_tenfolio_max, &cndfolioseq, "seqtf_", "tenfolioseq", &document);
+				cndfoliosequential.appendChild(cndfolioseq);
+			}
+			if (!m_cnd_hundredfolio_max.isEmpty()) {
+				QDomElement cndfolioseq = document.createElement("conductorhundredfolioseq");
+				folioSequentialsToXml(&m_cnd_hundredfolio_max, &cndfolioseq, "seqhf_", "hundredfolioseq", &document);
+				cndfoliosequential.appendChild(cndfolioseq);
+			}
+			racine.appendChild(cndfoliosequential);
+		}
 	}
 	else {
 			//this method with whole_content to false,
@@ -594,13 +616,13 @@
 }
 
 /**
-+ * @brief Diagram::elementFolioSequentialsToXml
-+ * Add element folio sequential to QDomElement
++ * @brief Diagram::folioSequentialsToXml
++ * Add folio sequential to QDomElement
 + * @param domElement to add attributes
 + * @param hash to retrieve content with content
 + * @param sequential type
 + */
-void Diagram::elementFolioSequentialsToXml(QHash<QString, QStringList> *hash, QDomElement *domElement, QString seq_type, QString type, QDomDocument *doc) {
+void Diagram::folioSequentialsToXml(QHash<QString, QStringList> *hash, QDomElement *domElement, QString seq_type, QString type, QDomDocument *doc) {
 	QHash<QString, QStringList>::iterator i;
 	for (i = hash->begin(); i != hash->end(); i++) {
 		QDomElement folioseq = doc->createElement(type);
@@ -702,9 +724,15 @@
 		// Load Freeze New Element
 		m_freeze_new_elements_ = root.attribute("freezeNewElement").toInt();
 
-		elementFolioSequentialsFromXml(root, &m_elmt_unitfolio_max, "elementunitfolioseq","sequf_","unitfolioseq");
-		elementFolioSequentialsFromXml(root, &m_elmt_tenfolio_max, "elementtenfolioseq","seqtf_", "tenfolioseq");
-		elementFolioSequentialsFromXml(root, &m_elmt_hundredfolio_max, "elementhundredfolioseq","seqhf_", "hundredfolioseq");
+		//Load Element Folio Sequential
+		folioSequentialsFromXml(root, &m_elmt_unitfolio_max, "elementunitfolioseq","sequf_","unitfolioseq", "elementautonumfoliosequentials");
+		folioSequentialsFromXml(root, &m_elmt_tenfolio_max, "elementtenfolioseq","seqtf_", "tenfolioseq", "elementautonumfoliosequentials");
+		folioSequentialsFromXml(root, &m_elmt_hundredfolio_max, "elementhundredfolioseq","seqhf_", "hundredfolioseq", "elementautonumfoliosequentials");
+
+		//Load Conductor Folio Sequential
+		folioSequentialsFromXml(root, &m_cnd_unitfolio_max, "conductorunitfolioseq","sequf_","unitfolioseq", "conductorautonumfoliosequentials");
+		folioSequentialsFromXml(root, &m_cnd_tenfolio_max, "conductortenfolioseq","seqtf_","tenfolioseq", "conductorautonumfoliosequentials");
+		folioSequentialsFromXml(root, &m_cnd_hundredfolio_max, "conductorhundredfolioseq","seqhf_","hundredfolioseq", "conductorautonumfoliosequentials");
 	}
 
 	// if child haven't got a child, loading is finish (diagram is empty)
@@ -879,16 +907,16 @@
 }
 
 /**
- * @brief Diagram::elementFolioSequentialsFromXml
- * Load element folio sequential from QDomElement
+ * @brief Diagram::folioSequentialsFromXml
+ * Load folio sequential from QDomElement
  * @param root containing all folio sequentials
  * @param hash to be loaded with content
  * @param folioSeq type
  * @param seq type
  * @param type of sequential
  */
-void Diagram::elementFolioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq, QString type) {
-	foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, "elementautonumfoliosequentials", folioSeq)) {
+void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq, QString type, QString autonumFolioSeqType) {
+	foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) {
 		for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
 			QString title = folioseq.attribute("title");
 			QStringList list;
@@ -1154,22 +1182,19 @@
  * @param type to be treated
  * @param Numerotation Context to be manipulated
  */
-void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc) {
-	if (project()->elementAutoNumFormula().contains(seq)) {
-		QStringList max;
-		for (int i = 0; i < nc->size(); i++) {
-				if (nc->itemAt(i).at(0) == type) {
-					nc->replaceValue(i, QString::number(nc->itemAt(i).at(3).toInt()));
-					max.append(QString::number(nc->itemAt(i).at(3).toInt() - nc->itemAt(i).at(2).toInt()));
-				}
+void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString type, NumerotationContext *nc) {
+	QStringList max;
+	for (int i = 0; i < nc->size(); i++) {
+		if (nc->itemAt(i).at(0) == type) {
+			nc->replaceValue(i, QString::number(nc->itemAt(i).at(3).toInt()));
+			max.append(QString::number(nc->itemAt(i).at(3).toInt() - nc->itemAt(i).at(2).toInt()));
 		}
-		hash->insert(title,max);
-		project()->addElementAutoNum(title,*nc);
 	}
+	hash->insert(title,max);
 }
 
 /**
- * @brief Diagram::loadElmtFolioSeqHash
+ * @brief Diagram::loadFolioSeqHash
  * This class loads all folio sequential variables
  * related to the current autonum
  * @param Hash to be accessed
@@ -1178,8 +1203,7 @@
  * @param type to be treated
  * @param Numerotation Context to be manipulated
  */
-void Diagram::loadElmtFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc) {
-	if (project()->elementAutoNumFormula().contains(seq)) {
+void Diagram::loadFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString type, NumerotationContext *nc) {
 		int j = 0;
 		for (int i = 0; i < nc->size(); i++) {
 			if (nc->itemAt(i).at(0) == type) {
@@ -1189,8 +1213,6 @@
 				j++;
 			}
 		}
-		project()->addElementAutoNum(title,*nc);
-	}
 }
 
 /**
@@ -1199,39 +1221,118 @@
  * to the current autonum
  */
 void Diagram::loadElmtFolioSeq() {
-	//Element
 	QString title = project()->elementCurrentAutoNum();
 	NumerotationContext nc = project()->elementAutoNum(title);
+
 	//Unit Folio
 	if (m_elmt_unitfolio_max.isEmpty() || !m_elmt_unitfolio_max.contains(title)) {
 		//Insert Initial Value
-		insertFolioSeqHash(&m_elmt_unitfolio_max,title,"%sequf_","unitfolio",&nc);
+		if (project()->elementAutoNumCurrentFormula().contains("%sequf_")) {
+			insertFolioSeqHash(&m_elmt_unitfolio_max,title,"unitfolio",&nc);
+			project()->addElementAutoNum(title,nc);
+		}
 	}
 	else if (m_elmt_unitfolio_max.contains(title)) {
 		//Load Folio Current Value
-		loadElmtFolioSeqHash(&m_elmt_unitfolio_max,title,"%sequf_","unitfolio",&nc);
+		if (project()->elementAutoNumCurrentFormula().contains("%sequf_")) {
+			loadFolioSeqHash(&m_elmt_unitfolio_max,title,"unitfolio",&nc);
+			project()->addElementAutoNum(title,nc);
+		}
 	}
+
 	//Ten Folio
 	if (m_elmt_tenfolio_max.isEmpty() || !m_elmt_tenfolio_max.contains(title)) {
 		//Insert Initial Value
-		insertFolioSeqHash(&m_elmt_tenfolio_max,title,"%seqtf_","tenfolio",&nc);
+		if (project()->elementAutoNumCurrentFormula().contains("%seqtf_")) {
+			insertFolioSeqHash(&m_elmt_tenfolio_max,title,"tenfolio",&nc);
+			project()->addElementAutoNum(title,nc);
+		}
 	}
 	else if (m_elmt_tenfolio_max.contains(title)) {
 		//Load Folio Current Value
-		loadElmtFolioSeqHash(&m_elmt_tenfolio_max,title,"%seqtf_","tenfolio",&nc);
+		if (project()->elementAutoNumCurrentFormula().contains("%seqtf_")) {
+			loadFolioSeqHash(&m_elmt_tenfolio_max,title,"tenfolio",&nc);
+			project()->addElementAutoNum(title,nc);
+		}
 	}
+
 	//Hundred Folio
 	if (m_elmt_hundredfolio_max.isEmpty() || !m_elmt_hundredfolio_max.contains(title)) {
 		//Insert Initial Value
-		insertFolioSeqHash(&m_elmt_hundredfolio_max,title,"%seqhf_","hundredfolio",&nc);
+		if (project()->elementAutoNumCurrentFormula().contains("%seqhf_")) {
+			insertFolioSeqHash(&m_elmt_hundredfolio_max,title,"hundredfolio",&nc);
+			project()->addElementAutoNum(title,nc);
+		}
 	}
 	else if (m_elmt_hundredfolio_max.contains(title)) {
 		//Load Folio Current Value
-		loadElmtFolioSeqHash(&m_elmt_hundredfolio_max,title,"%seqhf_","hundredfolio",&nc);
+		if (project()->elementAutoNumCurrentFormula().contains("%seqhf_")) {
+			loadFolioSeqHash(&m_elmt_hundredfolio_max,title,"hundredfolio",&nc);
+			project()->addElementAutoNum(title,nc);
+		}
 	}
 }
 
 /**
+ * @brief Diagram::loadCndFolioSeq
+ * This class loads all conductor folio sequential variables related
+ * to the current autonum
+ */
+void Diagram::loadCndFolioSeq() {
+	//Conductor
+	QString title = project()->conductorCurrentAutoNum();
+	NumerotationContext nc = project()->conductorAutoNum(title);
+
+	//Unit Folio
+	if (m_cnd_unitfolio_max.isEmpty() || !m_cnd_unitfolio_max.contains(title)) {
+		//Insert Initial Value
+		if (project()->conductorAutoNumCurrentFormula().contains("%sequf_")) {
+			insertFolioSeqHash(&m_cnd_unitfolio_max,title,"unitfolio",&nc);
+			project()->addConductorAutoNum(title,nc);
+		}
+	}
+	else if (m_cnd_unitfolio_max.contains(title)) {
+		//Load Folio Current Value
+		if (project()->conductorAutoNumCurrentFormula().contains("%sequf_")) {
+			loadFolioSeqHash(&m_cnd_unitfolio_max,title,"unitfolio",&nc);
+			project()->addConductorAutoNum(title,nc);
+		}
+	}
+
+	//Ten Folio
+	if (m_cnd_tenfolio_max.isEmpty() || !m_cnd_tenfolio_max.contains(title)) {
+		//Insert Initial Value
+		if (project()->conductorAutoNumCurrentFormula().contains("%seqtf_")) {
+			insertFolioSeqHash(&m_cnd_tenfolio_max,title,"tenfolio",&nc);
+			project()->addConductorAutoNum(title,nc);
+		}
+	}
+	else if (m_cnd_tenfolio_max.contains(title)) {
+		//Load Folio Current Value
+		if (project()->conductorAutoNumCurrentFormula().contains("%seqtf_")) {
+			loadFolioSeqHash(&m_cnd_tenfolio_max,title,"tenfolio",&nc);
+			project()->addConductorAutoNum(title,nc);
+		}
+	}
+
+	//Hundred Folio
+	if (m_cnd_hundredfolio_max.isEmpty() || !m_cnd_hundredfolio_max.contains(title)) {
+		//Insert Initial Value
+		if (project()->conductorAutoNumCurrentFormula().contains("%seqhf_")) {
+			insertFolioSeqHash(&m_cnd_hundredfolio_max,title,"hundredfolio",&nc);
+			project()->addConductorAutoNum(title,nc);
+		}
+	}
+	else if (m_cnd_hundredfolio_max.contains(title)) {
+		//Load Folio Current Value
+		if (project()->conductorAutoNumCurrentFormula().contains("%seqhf_")) {
+			loadFolioSeqHash(&m_cnd_hundredfolio_max,title,"hundredfolio",&nc);
+			project()->addConductorAutoNum(title,nc);
+		}
+	}
+}
+
+/**
 	@return le titre du cartouche
 */
 QString Diagram::title() const {

Modified: trunk/sources/diagram.h
===================================================================
--- trunk/sources/diagram.h	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/diagram.h	2016-08-29 15:37:42 UTC (rev 4674)
@@ -87,6 +87,10 @@
 		QHash <QString, QStringList> m_elmt_unitfolio_max;
 		QHash <QString, QStringList> m_elmt_tenfolio_max;
 		QHash <QString, QStringList> m_elmt_hundredfolio_max;
+		/// Hash containing max values for folio sequential autonums in this diagram
+		QHash <QString, QStringList> m_cnd_unitfolio_max;
+		QHash <QString, QStringList> m_cnd_tenfolio_max;
+		QHash <QString, QStringList> m_cnd_hundredfolio_max;
 		bool item_paste;
 
 	private:
@@ -158,8 +162,8 @@
 	void write(const QDomElement &);
 	bool wasWritten() const;
 	QDomElement writeXml(QDomDocument &) const;
-	void elementFolioSequentialsToXml(QHash<QString, QStringList>*, QDomElement *, QString, QString, QDomDocument *);
-	void elementFolioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, QString, QString, QString);
+	void folioSequentialsToXml(QHash<QString, QStringList>*, QDomElement *, QString, QString, QDomDocument *);
+	void folioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, QString, QString, QString, QString);
 
 	// methods related to graphics items addition/removal on the diagram
 	void initElementsLinks();
@@ -216,10 +220,11 @@
 	void unfreezeNew();
 	bool freezeNewElements();
 
-	//methods related to insertion and loading of element folio sequential
-	void insertFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc);
-	void loadElmtFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc);
+	//methods related to insertion and loading of folio sequential
+	void insertFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, NumerotationContext *nc);
+	void loadFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, NumerotationContext *nc);
 
+
 	public slots:
 		void adjustSceneRect ();
 		void titleChanged(const QString &);
@@ -229,6 +234,7 @@
 		void setTitleBlockTemplate(const QString &);
 		void updateLabels();
 		void loadElmtFolioSeq();
+		void loadCndFolioSeq();
 	
 		// methods related to graphics items selection
 		void selectAll();

Modified: trunk/sources/diagramevent/diagrameventaddelement.cpp
===================================================================
--- trunk/sources/diagramevent/diagrameventaddelement.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/diagramevent/diagrameventaddelement.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -231,6 +231,7 @@
 			//Autonum the new conductor, the undo command associated for this, have for parent undo_object
 		ConductorAutoNumerotation can  (conductor, m_diagram, undo_object);
 		can.numerate();
+		conductor->setSeq = true;
 	};
 	m_diagram -> undoStack().push(undo_object);
 	element->setSequential();

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/diagramview.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -83,6 +83,7 @@
 	adjustSceneRect();
 	updateWindowTitle();
 	scene->loadElmtFolioSeq();
+	scene->loadCndFolioSeq();
 
 	context_menu = new QMenu(this);
 	paste_here = new QAction(QET::Icons::EditPaste, tr("Coller ici", "context menu action"), this);

Modified: trunk/sources/elementsmover.cpp
===================================================================
--- trunk/sources/elementsmover.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/elementsmover.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -178,6 +178,7 @@
 					//Autonum the new conductor, the undo command associated for this, have for parent undo_object
 				ConductorAutoNumerotation can  (conductor, diagram_, undo_object);
 				can.numerate();
+				conductor->setSeq = true;
 			}
 		};
 	}

Modified: trunk/sources/numerotationcontextcommands.cpp
===================================================================
--- trunk/sources/numerotationcontextcommands.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/numerotationcontextcommands.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -445,7 +445,7 @@
  */
 QString IdFolioNum::toRepresentedString(const QString str) const {
 	Q_UNUSED(str);
-	return (QString::number(diagram_ -> folioIndex() + 1));
+	return ("%id");
 }
 
 /**

Modified: trunk/sources/projectconfigpages.cpp
===================================================================
--- trunk/sources/projectconfigpages.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/projectconfigpages.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -28,7 +28,7 @@
 #include "selectautonumw.h"
 #include "numerotationcontext.h"
 #include "folioautonumbering.h"
-#include "elementautonumberingw.h"
+#include "formulaautonumberingw.h"
 #include "autonumberingmanagementw.h"
 #include "ui_autonumberingmanagementw.h"
 
@@ -483,15 +483,21 @@
 	// With the the name "No name"
 	if (m_context_cb_conductor-> currentText() == tr("Nom de la nouvelle numérotation")) {
 		project_->addConductorAutoNum (tr("Sans nom"), m_saw_conductor -> toNumContext());
+		project()->addConductorAutoNumFormula (tr("Sans nom"), m_saw_conductor->formula()); //add hash <title, formula>
+		project()->setConductorAutoNumCurrentFormula (m_saw_conductor->formula(),tr("Sans nom")); //add last added conductor formula to current formula
 		m_context_cb_conductor-> addItem(tr("Sans nom"));
 	}
 	// If the text isn't yet to the autonum of the project, add this new item to the combo box.
 	else if ( !project_ -> conductorAutoNum().keys().contains( m_context_cb_conductor->currentText())) {
 		project()->addConductorAutoNum(m_context_cb_conductor->currentText(), m_saw_conductor->toNumContext());
+		project()->addConductorAutoNumFormula (m_context_cb_conductor->currentText(), m_saw_conductor->formula()); //add hash <title, formula>
+		project()->setConductorAutoNumCurrentFormula (m_saw_conductor->formula(),m_context_cb_conductor->currentText()); //add last added conductor formula to current formula
 		m_context_cb_conductor-> addItem(m_context_cb_conductor->currentText());
 	}
 	// Else, the text already exist in the autonum of the project, just update the context
 	else {
+		project()->addConductorAutoNumFormula (m_context_cb_conductor->currentText(), m_saw_conductor->formula()); //add hash <title, formula>
+		project()->setConductorAutoNumCurrentFormula (m_saw_conductor->formula(), m_context_cb_conductor->currentText()); //add last added conductor formula to current formula
 		project_->addConductorAutoNum (m_context_cb_conductor-> currentText(), m_saw_conductor -> toNumContext());
 	}
 	project()->conductorAutoNumAdded();
@@ -530,22 +536,22 @@
 	// With the the name "No name"
 	if (m_context_cb_element -> currentText() == tr("Nom de la nouvelle numérotation")) {
 		project_->addElementAutoNum (tr("Sans nom"), m_saw_element -> toNumContext());
-		project()->addElementAutoNumFormula (tr("Sans nom"), m_saw_element->elementFormula()); //add hash <title, formula>
-		project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula(),tr("Sans nom")); //add last added element formula to current formula
+		project()->addElementAutoNumFormula (tr("Sans nom"), m_saw_element->formula()); //add hash <title, formula>
+		project()->setElementAutoNumCurrentFormula (m_saw_element->formula(),tr("Sans nom")); //add last added element formula to current formula
 		m_context_cb_element -> addItem(tr("Sans nom"));
 	}
 	// If the text isn't yet to the autonum of the project, add this new item to the combo box.
 	else if ( !project_ -> elementAutoNum().keys().contains( m_context_cb_element->currentText())) {
 		project()->addElementAutoNum(m_context_cb_element->currentText(), m_saw_element->toNumContext()); //add hash <title, numcontext>
-		project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->elementFormula()); //add hash <title, formula>
-		project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula(),m_context_cb_element->currentText()); //add last added element formula to current formula
+		project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->formula()); //add hash <title, formula>
+		project()->setElementAutoNumCurrentFormula (m_saw_element->formula(),m_context_cb_element->currentText()); //add last added element formula to current formula
 		m_context_cb_element -> addItem(m_context_cb_element->currentText());
 	}
 	// Else, the text already exist in the autonum of the project, just update the context
 	else {
 		project_->addElementAutoNum (m_context_cb_element -> currentText(), m_saw_element -> toNumContext()); //add hash <title, numcontext>
-		project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->elementFormula()); //add hash <title, formula>
-		project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula(), m_context_cb_element->currentText()); //add last added element formula to current formula
+		project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->formula()); //add hash <title, formula>
+		project()->setElementAutoNumCurrentFormula (m_saw_element->formula(), m_context_cb_element->currentText()); //add last added element formula to current formula
 	}
 	project()->elementAutoNumAdded();
 }
@@ -705,11 +711,12 @@
 void ProjectAutoNumConfigPage::tabChanged(int i){
 	if (i>=1){
 		if (tab_widget->currentIndex() == 4){
-			tab_widget->resize(480,tab_widget->height());
+			tab_widget->resize(520,tab_widget->height());
 		}
-		else {
-			tab_widget->resize(475,tab_widget->height());
+		else if (tab_widget->currentIndex() == 1 || tab_widget->currentIndex() == 2 ){
+			tab_widget->resize(495,tab_widget->height());
 		}
+		else tab_widget->resize(475,tab_widget->height());
 	}
 	else {
 		tab_widget->resize(850,tab_widget->height());

Modified: trunk/sources/projectconfigpages.h
===================================================================
--- trunk/sources/projectconfigpages.h	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/projectconfigpages.h	2016-08-29 15:37:42 UTC (rev 4674)
@@ -31,7 +31,7 @@
 class QComboBox;
 class QPushButton;
 class FolioAutonumberingW;
-class ElementAutonumberingW;
+class FormulaAutonumberingW;
 class AutoNumberingManagementW;
 class QTabWidget;
 class QScrollArea;

Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/projectview.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -898,6 +898,7 @@
 	}
 
 	this->currentDiagram()->diagram()->loadElmtFolioSeq();
+	this->currentDiagram()->diagram()->loadCndFolioSeq();
 
 	// If project have the folios list, move it at the beginning of the project
 	if (m_project -> getFolioSheetsQuantity()) {

Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/qetgraphicsitem/conductor.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -28,6 +28,7 @@
 #include "conductorautonumerotation.h"
 #include "conductorpropertiesdialog.h"
 #include "QPropertyUndoCommand/qpropertyundocommand.h"
+#include "numerotationcontextcommands.h"
 
 #define PR(x) qDebug() << #x " = " << x;
 
@@ -46,6 +47,7 @@
 	QGraphicsPathItem(0),
 	terminal1(p1),
 	terminal2(p2),
+	setSeq(true),
 	bMouseOver(false),
 	m_handler(10),
 	text_item(0),
@@ -509,7 +511,7 @@
 	return(qobject_cast<Diagram *>(scene()));
 }
 
-/**
+/**4
 	@return le champ de texte associe a ce conducteur
 */
 ConductorTextItem *Conductor::textItem() const {
@@ -815,12 +817,37 @@
 	text_item -> fromXml(e);
 	ConductorProperties pr;
 	pr.fromXml(e);
+
+	//Load Sequential Values
+	loadSequential(&e,"sequ_",&seq_unit);
+	loadSequential(&e,"sequf_",&seq_unitfolio);
+	loadSequential(&e,"seqt_",&seq_ten);
+	loadSequential(&e,"seqtf_",&seq_tenfolio);
+	loadSequential(&e,"seqh_",&seq_hundred);
+	loadSequential(&e,"seqhf_",&seq_hundredfolio);
+
 	setProperties(pr);
 
 	return return_;
 }
 
 /**
+	Load Sequentials to display on conductor label
+	@param QDomElement to set Attributes
+	@param Qstring seq to be retrieved
+	@param QStringList list to be inserted values
+*/
+void Conductor::loadSequential(QDomElement* e, QString seq, QStringList* list) {
+	//Load Sequential Values
+	int i = 0;
+	while (!e->attribute(seq + QString::number(i+1)).isEmpty()) {
+		list->append(e->attribute(seq + QString::number(i+1)));
+		i++;
+	}
+	setSeq = false;
+}
+
+/**
 	Exporte les caracteristiques du conducteur sous forme d'une element XML.
 	@param d Le document XML a utiliser pour creer l'element XML
 	@param table_adr_id Hash stockant les correspondances entre les ids des
@@ -847,6 +874,37 @@
 			e.appendChild(current_segment);
 		}
 	}
+
+	// Save Conductor sequential values to Xml
+	// Save Unit Sequential Values
+	for (int i = 0; i < seq_unit.size(); i++) {
+			e.setAttribute("sequ_" + QString::number(i+1),seq_unit.at(i));
+	}
+
+	// Save UnitFolio Sequential Values
+	for (int i = 0; i < seq_unitfolio.size(); i++) {
+			e.setAttribute("sequf_" + QString::number(i+1),seq_unitfolio.at(i));
+	}
+
+	// Save Ten Sequential Values
+	for (int i = 0; i < seq_ten.size(); i++) {
+			e.setAttribute("seqt_" + QString::number(i+1),seq_ten.at(i));
+	}
+
+	// Save TenFolio Sequential Values
+	for (int i = 0; i < seq_tenfolio.size(); i++) {
+			e.setAttribute("seqtf_" + QString::number(i+1),seq_tenfolio.at(i));
+	}
+
+	// Save Hundred Sequential Values
+	for (int i = 0; i < seq_hundred.size(); i++) {
+			e.setAttribute("seqh_" + QString::number(i+1),seq_hundred.at(i));
+	}
+
+	// Save Hundred Sequential Values
+	for (int i = 0; i < seq_hundredfolio.size(); i++) {
+			e.setAttribute("seqhf_" + QString::number(i+1),seq_hundredfolio.at(i));
+	}
 	
 	// Export the properties and text
 	properties_. toXml(e);
@@ -1205,6 +1263,7 @@
 	//The check below was introduced to avoid crash caused by the addition of terminal elements
 	//Needs further debbugging.
 	if (diagram() == NULL) return label;
+
 	//Titleblock Variables
 		for (int i = 0; i < diagram()->border_and_titleblock.additionalFields().count(); i++)
 	{
@@ -1234,16 +1293,150 @@
 	label.replace("%F", diagram() -> border_and_titleblock.folio());
 	label.replace("%id", QString::number(diagram()->folioIndex()+1));
 	label.replace("%total", QString::number(diagram()->border_and_titleblock.folioTotal()));
+	label = assignSeq(label, this);
 	return label;
 }
 
+/**
+ * @brief Conductor::setSequential
+ * Set sequential values to conductor
+ */
+void Conductor::setSequential() {
+	if (diagram()==NULL) return;
+	QString conductor_currentAutoNum = diagram()->project()->conductorCurrentAutoNum();
+	QString formula = diagram()->project()->conductorAutoNumCurrentFormula();
+	QString label = this->text();
+	NumerotationContext nc = diagram()->project()->conductorAutoNum(conductor_currentAutoNum);
+	NumerotationContextCommands ncc (nc);
+	if (!nc.isEmpty()) {
+		if (label.contains("%sequ_"))
+			setSequentialToList(&seq_unit,&nc,"unit");
+		if (label.contains("%sequf_")) {
+			setSequentialToList(&seq_unitfolio,&nc,"unitfolio");
+			setFolioSequentialToHash(&seq_unitfolio,&diagram()->m_cnd_unitfolio_max,conductor_currentAutoNum);
+		}
+		if (label.contains("%seqt_"))
+			setSequentialToList(&seq_ten,&nc,"ten");
+		if (label.contains("%seqtf_")) {
+			setSequentialToList(&seq_tenfolio,&nc,"tenfolio");
+			setFolioSequentialToHash(&seq_tenfolio,&diagram()->m_cnd_tenfolio_max,conductor_currentAutoNum);
+		}
+		if (label.contains("%seqh_"))
+			setSequentialToList(&seq_hundred,&nc,"hundred");
+		if (label.contains("%seqhf_")) {
+			setSequentialToList(&seq_hundredfolio,&nc,"hundredfolio");
+			setFolioSequentialToHash(&seq_hundredfolio,&diagram()->m_cnd_hundredfolio_max,conductor_currentAutoNum);
+		}
+	this->diagram()->project()->addConductorAutoNum(conductor_currentAutoNum,ncc.next());
+	}
+}
 
 /**
+ * @brief Conductor::setSequentialToList
+ * This class appends all sequential to selected list
+ * @param list to have values inserted
+ * @param nc to retrieve values from
+ * @param sequential type
+ */
+void Conductor::setSequentialToList(QStringList* list, NumerotationContext* nc, QString type) {
+	for (int i = 0; i < nc->size(); i++) {
+		if (nc->itemAt(i).at(0) == type) {
+			QString number;
+			if (type == "ten" || type == "tenfolio")
+				number = QString("%1").arg(nc->itemAt(i).at(1).toInt(), 2, 10, QChar('0'));
+			else if (type == "hundred" || type == "hundredfolio")
+				number = QString("%1").arg(nc->itemAt(i).at(1).toInt(), 3, 10, QChar('0'));
+			else number = QString::number(nc->itemAt(i).at(1).toInt());
+				list->append(number);
+		}
+	}
+}
+
+/**
+ * @brief Conductor::setFolioSequentialToHash
+ * This class inserts all conductors from list to hash
+ * @param list to retrieve values from
+ * @param hash to have values inserted
+ * @param current element autonum to insert on hash
+ */
+void Conductor::setFolioSequentialToHash(QStringList* list, QHash<QString, QStringList> *hash, QString conductor_currentAutoNum) {
+	if (hash->isEmpty() || (!(hash->contains(conductor_currentAutoNum)))) {
+		QStringList max;
+		for (int i = 0; i < list->size(); i++) {
+			max.append(list->at(i));
+		}
+		hash->insert(conductor_currentAutoNum,max);
+	}
+	else if (hash->contains(conductor_currentAutoNum)) {
+		//Load the String List and update it
+		QStringList max = hash->value(conductor_currentAutoNum);
+		for (int i = 0; i < list->size(); i++) {
+			if ((list->at(i).toInt()) > max.at(i).toInt()) {
+				max.replace(i,list->at(i));
+				hash->remove(conductor_currentAutoNum);
+				hash->insert(conductor_currentAutoNum,max);
+			}
+		}
+	}
+}
+
+/**
+ * @brief Conductor::assignSeq
+ * Replace sequential values to conductor label
+ * @param label to be replaced
+ * @return replaced label
+ */
+QString Conductor::assignSeq(QString label, Conductor* cnd) {
+	for (int i = 1; i <= qMax(qMax(qMax(cnd->seq_unitfolio.size(), cnd->seq_tenfolio.size()),qMax(cnd->seq_hundredfolio.size(),cnd->seq_unit.size())),qMax(cnd->seq_hundred.size(),cnd->seq_ten.size())); i++) {
+		if (label.contains("%sequ_" + QString::number(i)) && !cnd->seq_unit.isEmpty()) {
+			label.replace("%sequ_" + QString::number(i),cnd->seq_unit.at(i-1));
+		}
+		if (label.contains("%seqt_" + QString::number(i)) && !cnd->seq_ten.isEmpty()) {
+			label.replace("%seqt_" + QString::number(i),cnd->seq_ten.at(i-1));
+		}
+		if (label.contains("%seqh_" + QString::number(i)) && !cnd->seq_hundred.isEmpty()) {
+			label.replace("%seqh_" + QString::number(i),cnd->seq_hundred.at(i-1));
+		}
+		if (label.contains("%sequf_" + QString::number(i)) && !cnd->seq_unitfolio.isEmpty()) {
+			label.replace("%sequf_" + QString::number(i),cnd->seq_unitfolio.at(i-1));
+		}
+		if (label.contains("%seqtf_" + QString::number(i)) && !cnd->seq_tenfolio.isEmpty()) {
+			label.replace("%seqtf_" + QString::number(i),cnd->seq_tenfolio.at(i-1));
+		}
+		if (label.contains("%seqhf_" + QString::number(i)) && !cnd->seq_hundredfolio.isEmpty()) {
+			label.replace("%seqhf_" + QString::number(i),cnd->seq_hundredfolio.at(i-1));
+		}
+	}
+	return label;
+}
+
+/**
+ * @brief Conductor::setOthersSequential
+ * Copy sequentials from conductor in argument to this conductor
+ * @param conductor to copy sequentials from
+ */
+void Conductor::setOthersSequential(Conductor *other) {
+	QString conductor_currentAutoNum = other->diagram()->project()->conductorCurrentAutoNum();
+	NumerotationContext nc = other->diagram()->project()->conductorAutoNum(conductor_currentAutoNum);
+	seq_unit = other->seq_unit;
+	seq_unitfolio = other->seq_unitfolio;
+	seq_ten = other->seq_ten;
+	seq_tenfolio = other->seq_tenfolio;
+	seq_hundred = other->seq_hundred;
+	seq_hundredfolio = other->seq_hundredfolio;
+}
+
+/**
  * @brief Conductor::setText
  * The text of this conductor
  * @param t
  */
 void Conductor::setText(const QString &t) {
+	text_item->setPlainText(t);
+	if (setSeq) {
+		setSequential();
+		setSeq = false;
+	}
 	QString label = assignVariables(t);
 	text_item -> setPlainText(label);
 }
@@ -1271,7 +1464,6 @@
 		other_properties.m_tension_protocol = properties_.m_tension_protocol;
 		other_conductor->setProperties(other_properties);
 	}
-
 	setText(properties_.text);
 	text_item -> setFontSize(properties_.text_size);
 	if (properties_.type != ConductorProperties::Multi)

Modified: trunk/sources/qetgraphicsitem/conductor.h
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.h	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/qetgraphicsitem/conductor.h	2016-08-29 15:37:42 UTC (rev 4674)
@@ -30,6 +30,7 @@
 class ConductorTextItem;
 class Element;
 class QETDiagramEditor;
+class NumerotationContext;
 typedef QPair<QPointF, Qt::Corner> ConductorBend;
 typedef QHash<Qt::Corner, ConductorProfile> ConductorProfilesGroup;
 /**
@@ -94,6 +95,11 @@
 	QString text() const;
 	QString assignVariables(QString) ;
 	void setText(const QString &);
+	QString assignSeq (QString, Conductor*);
+	void setSequential ();
+	void setOthersSequential (Conductor *);
+	void setSequentialToList(QStringList*, NumerotationContext*, QString);
+	void setFolioSequentialToHash(QStringList*, QHash<QString, QStringList>*, QString);
 
 	public:
 		static bool valideXml (QDomElement &);
@@ -117,6 +123,14 @@
 		QSet<Conductor *> relatedPotentialConductors(const bool all_diagram = true, QList <Terminal *> *t_list=0);
 		QETDiagramEditor* diagramEditor() const;
 		void editProperty ();
+		// Lists containing Sequentials
+		QStringList seq_unit;
+		QStringList seq_unitfolio;
+		QStringList seq_ten;
+		QStringList seq_tenfolio;
+		QStringList seq_hundred;
+		QStringList seq_hundredfolio;
+		bool setSeq;
 	
 	public slots:
 	void displayedTextChanged();
@@ -180,6 +194,7 @@
 	static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal = 9.0);
 	static Qt::Corner movementType(const QPointF &, const QPointF &);
 	static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &);
+	void loadSequential(QDomElement* e, QString seq, QStringList* list);
 };
 
 Conductor * longuestConductorInPotential (Conductor *conductor, bool all_diagram = false);

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -309,9 +309,9 @@
 								prefix = rxml.readElementText();
 								DiagramContext &dc = this->rElementInformations();
 								//if there is a formula to assign, assign it
-								if (!(location().project()->elementAutoNumFormula().isEmpty()) && (location().project()->elementAutoNumFormula() != "") &&
+								if (!(location().project()->elementAutoNumCurrentFormula().isEmpty()) && (location().project()->elementAutoNumCurrentFormula() != "") &&
 										(this->linkType()!=Element::Slave) && (this->linkType()!=Element::Terminale)) {
-									QString formula = location().project()->elementAutoNumFormula();
+									QString formula = location().project()->elementAutoNumCurrentFormula();
 									this->setPrefix(prefix);
 									dc.addValue("label", formula);
 									this->setTaggedText("label",formula);
@@ -340,10 +340,10 @@
 	//that are already specified in the element label (inside .elmt file). This method is not called if elements
 	//are being loaded at first time or being pasted
 	else if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) &&
-			 (!location().project()->elementAutoNumFormula().isEmpty()) &&
+			 (!location().project()->elementAutoNumCurrentFormula().isEmpty()) &&
 			 (this->linkType()!=Element::Slave) && (this->linkType()!=Element::Terminale) &&
 			 !this->diagram()->item_paste) {
-		QString formula = location().project()->elementAutoNumFormula();
+		QString formula = location().project()->elementAutoNumCurrentFormula();
 		DiagramContext &dc = this->rElementInformations();
 		QString prefix = this->taggedText("label")->toPlainText();
 		this->setPrefix(prefix);

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/qetgraphicsitem/element.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -772,7 +772,7 @@
 void Element::setSequential() {
 	DiagramContext &dc = this->rElementInformations();
 	QString element_currentAutoNum = diagram()->project()->elementCurrentAutoNum();
-	QString formula = diagram()->project()->elementAutoNumFormula();
+	QString formula = diagram()->project()->elementAutoNumCurrentFormula();
 	QString label = dc["label"].toString();
 	NumerotationContext nc = diagram()->project()->elementAutoNum(element_currentAutoNum);
 	NumerotationContextCommands ncc (nc);

Modified: trunk/sources/qetgraphicsitem/terminal.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/terminal.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/qetgraphicsitem/terminal.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -21,6 +21,7 @@
 #include "qetgraphicsitem/conductor.h"
 #include "diagramcommands.h"
 #include "conductorautonumerotation.h"
+#include "conductortextitem.h"
 
 QColor Terminal::neutralColor      = QColor(Qt::blue);
 QColor Terminal::allowedColor      = QColor(Qt::darkGreen);
@@ -594,25 +595,35 @@
 	{
 		use_properties = true;
 		others_properties = (*conductors_list.begin())->properties();
-		foreach (Conductor *conductor, conductors_list)
+		foreach (Conductor *conductor, conductors_list) {
 			if (conductor->properties() != others_properties)
 				use_properties = false;
+		}
 	}
 
 
 	QUndoCommand *undo = new AddItemCommand<Conductor *>(new_conductor, diagram());
 
-	if (use_properties)
+	if (use_properties) {
+		Conductor *other = conductors_list.toList().first();
+		new_conductor->setSeq = false;
+		new_conductor->setOthersSequential(other);
 		new_conductor->setProperties(others_properties);
+	}
 	else
 	{
-			//Autonum it
+		//Autonum it
 		ConductorAutoNumerotation can (new_conductor, diagram(), undo);
 		can.numerate();
+		new_conductor->setSeq = true;
 	}
-
-		//Add undo command to the parent diagram
+	//Add undo command to the parent diagram
 	diagram() -> undoStack().push(undo);
+	if (use_properties) {
+		Conductor *other = conductors_list.toList().first();
+		new_conductor->setText("");
+		new_conductor->setText(other->properties().text);
+	}
 }
 
 /**

Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/qetproject.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -425,6 +425,14 @@
 }
 
 /**
+ * @brief QETProject::conductorAutoNumHash
+ * @return Title and Formula Hash
+ */
+QHash <QString, QString> QETProject::conductorAutoNumHash() {
+	return m_conductor_autonum_formula;
+}
+
+/**
  * @brief QETProject::elementAutoNumFormula
  * @param element autonum title
  * @return Formula of element autonum stored in element autonum
@@ -436,14 +444,33 @@
 }
 
 /**
- * @brief QETProject::elementAutoNumFormula
+ * @brief QETProject::conductorAutoNumFormula
+ * @param conductor autonum title
+ * @return Formula of element autonum stored in conductor autonum
+ */
+QString QETProject::conductorAutoNumFormula (QString key) const {
+	if (m_conductor_autonum.contains(key))
+	return m_conductor_autonum_formula[key];
+	else return "";
+}
+
+/**
+ * @brief QETProject::elementAutoNumCurrentFormula
  * @return current formula being used by project
  */
-QString QETProject::elementAutoNumFormula () const {
+QString QETProject::elementAutoNumCurrentFormula() const {
 	return m_current_element_formula;
 }
 
 /**
+ * @brief QETProject::conductorAutoNumCurrentFormula
+ * @return current formula being used by project
+ */
+QString QETProject::conductorAutoNumCurrentFormula() const {
+	return m_current_conductor_formula;
+}
+
+/**
  * @brief QETProject::elementCurrentAutoNum
  * @return current element autonum title
  */
@@ -452,6 +479,14 @@
 }
 
 /**
+ * @brief QETProject::conductorCurrentAutoNum
+ * @return current element autonum title
+ */
+QString QETProject::conductorCurrentAutoNum () const {
+	return m_current_conductor_autonum;
+}
+
+/**
  * @brief QETProject::folioAutoNum
  * @return All value of folio autonum stored in project
  */
@@ -471,6 +506,26 @@
 }
 
 /**
+ * @brief QETProject::addConductorAutoNumFormula
+ * Add the new formula
+ * @param formula
+ */
+void QETProject::addConductorAutoNumFormula(QString key, QString formula) {
+	m_conductor_autonum_formula.insert(key, formula);
+}
+
+/**
+ * @brief QETProject::setConductorAutoNumCurrentFormula
+ * Add the formula and title to the current formula and current autonum
+ * @param formula
+ * @param title
+ */
+void QETProject::setConductorAutoNumCurrentFormula(QString formula, QString title) {
+	m_current_conductor_formula = formula;
+	m_current_conductor_autonum = title;
+}
+
+/**
  * @brief QETProject::addElementAutoNumFormula
  * Add the new formula
  * @param formula
@@ -1049,7 +1104,7 @@
 			diagram_folio_list -> border_and_titleblock.importTitleBlock(defaultTitleBlockProperties());
 			diagram_folio_list -> defaultConductorProperties = defaultConductorProperties();
 
-            diagram_folio_list -> border_and_titleblock.setTitle(tr("Liste des Folios"));
+			diagram_folio_list -> border_and_titleblock.setTitle(tr("Liste des Folios"));
 			// no need to display rows and columns
 			diagram_folio_list -> border_and_titleblock.displayRows(false);
 			diagram_folio_list -> border_and_titleblock.displayColumns(false);
@@ -1353,11 +1408,14 @@
 	}
 	if (!conds_autonums.isNull())
 	{
+		m_current_conductor_autonum = conds_autonums.attribute("current_autonum");
+		m_current_conductor_formula = conds_autonums.attribute("current_formula");
 		foreach (QDomElement elmt, QET::findInDomElement(conds_autonums, "conductor_autonum"))
 		{
 			NumerotationContext nc;
 			nc.fromXml(elmt);
 			m_conductor_autonum.insert(elmt.attribute("title"), nc);
+			m_conductor_autonum_formula.insert(elmt.attribute("title"),elmt.attribute("formula"));
 		}
 	}
 	if (!folio_autonums.isNull())
@@ -1434,14 +1492,19 @@
 	}
 	xml_element.appendChild(xrefs_elmt);
 
-	//Export conductors autonums
-	QDomElement conds_autonums = xml_document.createElement("conductors_autonums");
+	//Export Conductor Autonums
+	QDomElement conductor_autonums = xml_document.createElement("conductors_autonums");
+	conductor_autonums.setAttribute("current_autonum", m_current_conductor_autonum);
+	conductor_autonums.setAttribute("current_formula", m_current_conductor_formula);
 	foreach (QString key, conductorAutoNum().keys()) {
-		QDomElement cond_autonum = conductorAutoNum(key).toXml(xml_document, "conductor_autonum");
-		cond_autonum.setAttribute("title", key);
-		conds_autonums.appendChild(cond_autonum);
+	QDomElement conductor_autonum = conductorAutoNum(key).toXml(xml_document, "conductor_autonum");
+		if (key != "" && conductorAutoNumFormula(key) != "") {
+			conductor_autonum.setAttribute("title", key);
+			conductor_autonum.setAttribute("formula", conductorAutoNumFormula(key));
+			conductor_autonums.appendChild(conductor_autonum);
+		}
 	}
-	xml_element.appendChild(conds_autonums);
+	xml_element.appendChild(conductor_autonums);
 
 	//Export Folio Autonums
 	QDomElement folio_autonums = xml_document.createElement("folio_autonums");

Modified: trunk/sources/qetproject.h
===================================================================
--- trunk/sources/qetproject.h	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/qetproject.h	2016-08-29 15:37:42 UTC (rev 4674)
@@ -109,8 +109,11 @@
 		QHash <QString, NumerotationContext> conductorAutoNum() const;
 		QHash <QString, NumerotationContext> elementAutoNum() const;
 		QHash <QString, QString>             elementAutoNumHash();
+		QHash <QString, QString>             conductorAutoNumHash();
 		QHash <QString, NumerotationContext> folioAutoNum() const;
 		void addConductorAutoNum (QString key, NumerotationContext context);
+		void addConductorAutoNumFormula (QString key, QString formula);
+		void setConductorAutoNumCurrentFormula (QString formula, QString title);
 		void addElementAutoNum (QString key, NumerotationContext context);
 		void addElementAutoNumFormula (QString key, QString formula);
 		void setElementAutoNumCurrentFormula (QString formula, QString title);
@@ -121,9 +124,14 @@
 		NumerotationContext conductorAutoNum(const QString &key) const;
 		NumerotationContext folioAutoNum(const QString &key)     const;
 		NumerotationContext elementAutoNum(const QString &key);
+
+		QString conductorAutoNumFormula(const QString key) const; //returns Formula
+		QString conductorAutoNumCurrentFormula() const;
+		QString conductorCurrentAutoNum() const;
+
 		QString elementAutoNumFormula(const QString key) const; //returns Formula
-		QString elementAutoNumFormula() const;
-		QString elementCurrentAutoNum () const;
+		QString elementAutoNumCurrentFormula() const;
+		QString elementCurrentAutoNum() const;
 
 		void freezeExistentElementLabel(int,int);
 		void freezeNewElementLabel(int,int);
@@ -244,12 +252,15 @@
 	/// undo stack for this project
 	QUndoStack *undo_stack_;
 	/// Conductor auto numerotation
-	QHash <QString, NumerotationContext> m_conductor_autonum;
+	QHash <QString, NumerotationContext> m_conductor_autonum;//Title and NumContext hash
+	QHash <QString, QString> m_conductor_autonum_formula;//Title and Formula hash
+	QString m_current_conductor_formula;
+	QString m_current_conductor_autonum;
 	/// Folio auto numbering
 	QHash <QString, NumerotationContext> m_folio_autonum;
 	/// Element Auto Numbering
+	QHash <QString, NumerotationContext> m_element_autonum; //Title and NumContext hash
 	QHash <QString, QString> m_element_autonum_formula; //Title and Formula hash
-	QHash <QString, NumerotationContext> m_element_autonum; //Title and NumContext hash
 	QString m_current_element_formula;
 	QString m_current_element_autonum;
 	/// Folio List Sheets quantity for this project.

Modified: trunk/sources/ui/autonumberingdockwidget.cpp
===================================================================
--- trunk/sources/ui/autonumberingdockwidget.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/autonumberingdockwidget.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -153,7 +153,7 @@
 		}
 
 			//Element
-		QString element_formula = project_->elementAutoNumFormula();
+		QString element_formula = project_->elementAutoNumCurrentFormula();
 		QString active_element_autonum = project_->elementCurrentAutoNum();
 		int el_index = ui->m_element_cb->findText(active_element_autonum);
 		ui->m_element_cb->setCurrentIndex(el_index);
@@ -191,7 +191,14 @@
  */
 void AutoNumberingDockWidget::on_m_conductor_cb_activated(int) {
 	QString current_autonum = ui->m_conductor_cb->currentText();
+	QString current_formula = project_->conductorAutoNumFormula(current_autonum);
+	if (current_autonum != "") {
+		project_->setConductorAutoNumCurrentFormula(current_formula, current_autonum);
+	}
+	else
+		project_->setConductorAutoNumCurrentFormula("","");
 	projectview_->currentDiagram()->diagram()->setConductorsAutonumName(current_autonum);
+	projectview_->currentDiagram()->diagram()->loadCndFolioSeq();
 }
 
 /**

Modified: trunk/sources/ui/autonumberingmanagementw.cpp
===================================================================
--- trunk/sources/ui/autonumberingmanagementw.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/autonumberingmanagementw.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -20,8 +20,8 @@
 #include "numparteditorw.h"
 #include <QMessageBox>
 #include "numerotationcontextcommands.h"
-#include "elementautonumberingw.h"
-#include "ui_elementautonumberingw.h"
+#include "formulaautonumberingw.h"
+#include "ui_formulaautonumberingw.h"
 #include "qdebug.h"
 #include "qetproject.h"
 #include "diagram.h"

Deleted: trunk/sources/ui/elementautonumberingw.cpp
===================================================================
--- trunk/sources/ui/elementautonumberingw.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/elementautonumberingw.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -1,74 +0,0 @@
-/*
-	Copyright 2006-2016 The QElectroTech Team
-	This file is part of QElectroTech.
-	
-	QElectroTech is free software: you can redistribute it and/or modify
-	it under the terms of the GNU General Public License as published by
-	the Free Software Foundation, either version 2 of the License, or
-	(at your option) any later version.
-	
-	QElectroTech is distributed in the hope that it will be useful,
-	but WITHOUT ANY WARRANTY; without even the implied warranty of
-	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	GNU General Public License for more details.
-	
-	You should have received a copy of the GNU General Public License
-	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "elementautonumberingw.h"
-#include "ui_elementautonumberingw.h"
-#include <QMessageBox>
-#include <QPushButton>
-#include <QtWidgets>
-
-/**
- * Constructor
- */
-ElementAutonumberingW::ElementAutonumberingW(QWidget *parent) :
-	QWidget(parent),
-	ui(new Ui::ElementAutonumberingW)
-
-{
-	ui->setupUi(this);
-	setContext(formula_);
-}
-
-/**
- * Destructor
- */
-ElementAutonumberingW::~ElementAutonumberingW()
-{
-	delete ui;
-}
-
-/**
- * @brief ElementAutonumberingW::setContext
- * @param formula to be inserted into context
- */
-void ElementAutonumberingW::setContext(QString formula) {
-	ui->m_formula_le->insert(formula);
-}
-
-/**
- * @brief ElementAutonumberingW::clearContext
- * @param clear formula line edit text
- */
-void ElementAutonumberingW::clearContext() {
-	ui->m_formula_le->clear();
-}
-
-/**
- * @brief ElementAutonumberingW::formula
- * @return formula to be stored into project
- */
-QString ElementAutonumberingW::formula() {
-	return ui->m_formula_le->text();
-}
-
-/**
- * @brief ElementAutonumberingW::on_m_formula_le_textChanged
- * Update Apply Button
- */
-void ElementAutonumberingW::on_m_formula_le_textChanged(QString text) {
-	emit (textChanged(text));
-}

Deleted: trunk/sources/ui/elementautonumberingw.h
===================================================================
--- trunk/sources/ui/elementautonumberingw.h	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/elementautonumberingw.h	2016-08-29 15:37:42 UTC (rev 4674)
@@ -1,65 +0,0 @@
-/*
-	Copyright 2006-2016 The QElectroTech Team
-	This file is part of QElectroTech.
-	
-	QElectroTech is free software: you can redistribute it and/or modify
-	it under the terms of the GNU General Public License as published by
-	the Free Software Foundation, either version 2 of the License, or
-	(at your option) any later version.
-	
-	QElectroTech is distributed in the hope that it will be useful,
-	but WITHOUT ANY WARRANTY; without even the implied warranty of
-	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	GNU General Public License for more details.
-	
-	You should have received a copy of the GNU General Public License
-	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef ELEMENTAUTONUMBERINGW_H
-#define ELEMENTAUTONUMBERINGW_H
-
-#include <QWidget>
-
-class QAbstractButton;
-
-namespace Ui {
-		class ElementAutonumberingW;
-}
-
-/**
-	This class implements the element autonumbering widget.
-	It loads the current formula applied to new elements and allows
-	the user to overwrite it with a new formula. Formula is added
-	while parsing label in customelement.cpp
-*/
-class ElementAutonumberingW : public QWidget
-{
-	Q_OBJECT
-	
-	//METHODS
-	public:
-		explicit ElementAutonumberingW(QWidget *parent = 0);
-		~ElementAutonumberingW();
-		QString formula();
-		void setContext(QString);
-		void clearContext();
-		Ui::ElementAutonumberingW *ui;
-
-	private:
-
-	// SIGNALS
-	signals:
-		void applyPressed();
-		void textChanged(QString);
-
-	//SLOTS
-	private slots:
-		void on_m_formula_le_textChanged(QString);
-
-	//ATTRIBUTES
-	private:
-		QString formula_;
-
-};
-
-#endif // ELEMENTAUTONUMBERINGW_H

Deleted: trunk/sources/ui/elementautonumberingw.ui
===================================================================
--- trunk/sources/ui/elementautonumberingw.ui	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/elementautonumberingw.ui	2016-08-29 15:37:42 UTC (rev 4674)
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ElementAutonumberingW</class>
- <widget class="QWidget" name="ElementAutonumberingW">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>383</width>
-    <height>357</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="minimumSize">
-   <size>
-    <width>0</width>
-    <height>0</height>
-   </size>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="sizeConstraint">
-    <enum>QLayout::SetDefaultConstraint</enum>
-   </property>
-   <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="title">
-      <string>Auto Naming Pattern:</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="1">
-       <widget class="QLineEdit" name="m_formula_le">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="inputMask">
-         <string notr="true"/>
-        </property>
-        <property name="text">
-         <string notr="true"/>
-        </property>
-        <property name="placeholderText">
-         <string>Insert Formula Here e.g.: %prefix%l%c</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_5">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Formula:</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QLabel" name="label">
-     <property name="locale">
-      <locale language="French" country="France"/>
-     </property>
-     <property name="text">
-      <string>You can use the following variables to your formula:
- -%prefix: Default Element Prefix
- -%l: Element Line
- -%c: Element Column
- -%F: Folio Name
- -%f or %id: Folio ID
--%M:  Machine 
--%LM: Location
- -%total: Total of folios
-You can also assign any other titleblock variable 
-that you create. Text and number inputs are
- also available.</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>

Modified: trunk/sources/ui/folioautonumbering.ui
===================================================================
--- trunk/sources/ui/folioautonumbering.ui	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/folioautonumbering.ui	2016-08-29 15:37:42 UTC (rev 4674)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>467</width>
+    <width>524</width>
     <height>550</height>
    </rect>
   </property>
@@ -75,8 +75,8 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>448</width>
-        <height>498</height>
+        <width>504</width>
+        <height>495</height>
        </rect>
       </property>
       <property name="sizePolicy">
@@ -110,7 +110,7 @@
           <item row="2" column="1">
            <widget class="QComboBox" name="m_to_cb">
             <property name="sizePolicy">
-             <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
               <horstretch>0</horstretch>
               <verstretch>0</verstretch>
              </sizepolicy>
@@ -136,7 +136,7 @@
           <item row="1" column="1">
            <widget class="QComboBox" name="m_from_cb">
             <property name="sizePolicy">
-             <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
               <horstretch>0</horstretch>
               <verstretch>0</verstretch>
              </sizepolicy>
@@ -149,7 +149,7 @@
           <item row="0" column="1">
            <widget class="QSpinBox" name="m_new_tabs_sb">
             <property name="sizePolicy">
-             <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
               <horstretch>0</horstretch>
               <verstretch>0</verstretch>
              </sizepolicy>

Added: trunk/sources/ui/formulaautonumberingw.cpp
===================================================================
--- trunk/sources/ui/formulaautonumberingw.cpp	                        (rev 0)
+++ trunk/sources/ui/formulaautonumberingw.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -0,0 +1,74 @@
+/*
+	Copyright 2006-2016 The QElectroTech Team
+	This file is part of QElectroTech.
+	
+	QElectroTech is free software: you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation, either version 2 of the License, or
+	(at your option) any later version.
+	
+	QElectroTech is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+	
+	You should have received a copy of the GNU General Public License
+	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "formulaautonumberingw.h"
+#include "ui_formulaautonumberingw.h"
+#include <QMessageBox>
+#include <QPushButton>
+#include <QtWidgets>
+
+/**
+ * Constructor
+ */
+FormulaAutonumberingW::FormulaAutonumberingW(QWidget *parent) :
+	QWidget(parent),
+	ui(new Ui::FormulaAutonumberingW)
+
+{
+	ui->setupUi(this);
+	setContext(formula_);
+}
+
+/**
+ * Destructor
+ */
+FormulaAutonumberingW::~FormulaAutonumberingW()
+{
+	delete ui;
+}
+
+/**
+ * @brief FormulaAutonumberingW::setContext
+ * @param formula to be inserted into context
+ */
+void FormulaAutonumberingW::setContext(QString formula) {
+	ui->m_formula_le->insert(formula);
+}
+
+/**
+ * @brief FormulaAutonumberingW::clearContext
+ * @param clear formula line edit text
+ */
+void FormulaAutonumberingW::clearContext() {
+	ui->m_formula_le->clear();
+}
+
+/**
+ * @brief FormulaAutonumberingW::formula
+ * @return formula to be stored into project
+ */
+QString FormulaAutonumberingW::formula() {
+	return ui->m_formula_le->text();
+}
+
+/**
+ * @brief FormulaAutonumberingW::on_m_formula_le_textChanged
+ * Update Apply Button
+ */
+void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) {
+	emit (textChanged(text));
+}

Added: trunk/sources/ui/formulaautonumberingw.h
===================================================================
--- trunk/sources/ui/formulaautonumberingw.h	                        (rev 0)
+++ trunk/sources/ui/formulaautonumberingw.h	2016-08-29 15:37:42 UTC (rev 4674)
@@ -0,0 +1,65 @@
+/*
+	Copyright 2006-2016 The QElectroTech Team
+	This file is part of QElectroTech.
+	
+	QElectroTech is free software: you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation, either version 2 of the License, or
+	(at your option) any later version.
+	
+	QElectroTech is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+	
+	You should have received a copy of the GNU General Public License
+	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef FORMULAAUTONUMBERINGW_H
+#define FORMULAAUTONUMBERINGW_H
+
+#include <QWidget>
+
+class QAbstractButton;
+
+namespace Ui {
+		class FormulaAutonumberingW;
+}
+
+/**
+	This class implements the element autonumbering widget.
+	It loads the current formula applied to new elements and allows
+	the user to overwrite it with a new formula. Formula is added
+	while parsing label in customelement.cpp
+*/
+class FormulaAutonumberingW : public QWidget
+{
+	Q_OBJECT
+	
+	//METHODS
+	public:
+		explicit FormulaAutonumberingW(QWidget *parent = 0);
+		~FormulaAutonumberingW();
+		QString formula();
+		void setContext(QString);
+		void clearContext();
+		Ui::FormulaAutonumberingW *ui;
+
+	private:
+
+	// SIGNALS
+	signals:
+		void applyPressed();
+		void textChanged(QString);
+
+	//SLOTS
+	private slots:
+		void on_m_formula_le_textChanged(QString);
+
+	//ATTRIBUTES
+	private:
+		QString formula_;
+
+};
+
+#endif // FORMULAAUTONUMBERINGW_H

Added: trunk/sources/ui/formulaautonumberingw.ui
===================================================================
--- trunk/sources/ui/formulaautonumberingw.ui	                        (rev 0)
+++ trunk/sources/ui/formulaautonumberingw.ui	2016-08-29 15:37:42 UTC (rev 4674)
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormulaAutonumberingW</class>
+ <widget class="QWidget" name="FormulaAutonumberingW">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>370</width>
+    <height>305</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>0</width>
+    <height>0</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="sizeConstraint">
+    <enum>QLayout::SetDefaultConstraint</enum>
+   </property>
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="title">
+      <string>Auto Naming Pattern:</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="1">
+       <widget class="QLineEdit" name="m_formula_le">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="inputMask">
+         <string notr="true"/>
+        </property>
+        <property name="text">
+         <string notr="true"/>
+        </property>
+        <property name="placeholderText">
+         <string>Insert Formula Here e.g.: %prefix%l%c</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_5">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Formula:</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="locale">
+      <locale language="French" country="France"/>
+     </property>
+     <property name="text">
+      <string>You can use the following variables to your formula:
+ -%prefix: Default Element Prefix
+ -%l: Element Line
+ -%c: Element Column
+ -%F: Folio Name
+ -%f or %id: Folio ID
+ -%total: Total of folios
+You can also assign any other titleblock variable 
+that you create. Text and number inputs are
+ also available.</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Modified: trunk/sources/ui/numparteditorw.cpp
===================================================================
--- trunk/sources/ui/numparteditorw.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/numparteditorw.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -84,8 +84,8 @@
 				<< tr("Texte");
 	}
 	else if (parentWidget()->parentWidget()->objectName()=="ConductorTab") {
-		items	<< tr("Chiffre 1") << tr("Chiffre 01")
-				<< tr("Chiffre 001")
+		items	<< tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01")
+				<< tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio")
 				<< tr("Texte") << tr("N° folio") << tr("Folio");
 	}
 	else

Modified: trunk/sources/ui/projectpropertiesdialog.cpp
===================================================================
--- trunk/sources/ui/projectpropertiesdialog.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/projectpropertiesdialog.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -38,7 +38,7 @@
     connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString)));
     connect(projectAutoNumConfigPage,SIGNAL(saveCurrentTbp()),newDiagramPage,SLOT(saveCurrentTbp()));
     connect(projectAutoNumConfigPage,SIGNAL(loadSavedTbp()),newDiagramPage,SLOT(loadSavedTbp()));
-    m_properties_dialog->setMinimumHeight(690);
+	m_properties_dialog->setMinimumHeight(690);
     
 }
 

Modified: trunk/sources/ui/selectautonumw.cpp
===================================================================
--- trunk/sources/ui/selectautonumw.cpp	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/selectautonumw.cpp	2016-08-29 15:37:42 UTC (rev 4674)
@@ -20,8 +20,8 @@
 #include "numparteditorw.h"
 #include <QMessageBox>
 #include "numerotationcontextcommands.h"
-#include "elementautonumberingw.h"
-#include "ui_elementautonumberingw.h"
+#include "formulaautonumberingw.h"
+#include "ui_formulaautonumberingw.h"
 #include "qdebug.h"
 
 /**
@@ -34,9 +34,14 @@
 
 	ui->setupUi(this);
 	if (this->parentWidget() -> objectName()=="ElementTab"){
-		m_eaw = new ElementAutonumberingW();
-		ui->scrollAreaWidgetContents->layout()->addWidget(m_eaw);
+		m_feaw = new FormulaAutonumberingW();
+		ui->scrollAreaWidgetContents->layout()->addWidget(m_feaw);
 	}
+	else if (this->parentWidget() -> objectName()=="ConductorTab"){
+		m_fcaw = new FormulaAutonumberingW();
+		m_fcaw->ui->label->setHidden(true);
+		ui->scrollAreaWidgetContents->layout()->addWidget(m_fcaw);
+	}
 	setContext(NumerotationContext());
 }
 
@@ -45,9 +50,14 @@
 	ui(new Ui::SelectAutonumW)
 {
 	if (this->parentWidget() -> objectName()=="ElementTab"){
-		m_eaw = new ElementAutonumberingW();
-		ui->scrollAreaWidgetContents->layout()->addWidget(m_eaw);
+		m_feaw = new FormulaAutonumberingW();
+		ui->scrollAreaWidgetContents->layout()->addWidget(m_feaw);
 	}
+	else if (this->parentWidget() -> objectName()=="ConductorTab"){
+		m_fcaw = new FormulaAutonumberingW();
+		m_fcaw->ui->label->setHidden(true);
+		ui->scrollAreaWidgetContents->layout()->addWidget(m_fcaw);
+	}
 	ui->setupUi(this);
 	setContext(context);
 }
@@ -130,11 +140,15 @@
 }
 
 /**
- * @brief SelectAutonumW::elementFormula
- * @return element autonumbering widget formula
+ * @brief SelectAutonumW::formula
+ * @return autonumbering widget formula
  */
-QString SelectAutonumW::elementFormula() {
-	return m_eaw->formula();
+QString SelectAutonumW::formula() {
+	if (this->parentWidget() -> objectName()=="ElementTab")
+	return m_feaw->formula();
+	else if (this->parentWidget() ->objectName()=="ConductorTab")
+	return m_fcaw->formula();
+	else return "";
 }
 
 /**
@@ -222,6 +236,8 @@
 	}
 	if (this->parentWidget() -> objectName()=="ElementTab")
 		contextToFormula();
+	if (this->parentWidget()->objectName()=="ConductorTab")
+		contextToFormula();
 }
 
 /**
@@ -229,7 +245,12 @@
  * Apply formula to ElementAutonumbering Widget
  */
 void SelectAutonumW::contextToFormula() {
-	m_eaw->clearContext();
+	FormulaAutonumberingW* m_faw;
+	if (this->parentWidget() -> objectName()=="ElementTab")
+		m_faw = m_feaw;
+	if (this->parentWidget()->objectName()=="ConductorTab")
+		m_faw = m_fcaw;
+	m_faw->clearContext();
 	int count_unit = 0;
 	int count_unitf = 0;
 	int count_ten = 0;
@@ -239,54 +260,54 @@
 	foreach (NumPartEditorW *npe, num_part_list_) {
 		if (npe->isValid()) {
 			if (npe->type_ == NumPartEditorW::idfolio) {
-				m_eaw->setContext("%id");
+				m_faw->setContext("%id");
 			}
 			else if (npe->type_ == NumPartEditorW::folio) {
-				m_eaw->setContext("%F");
+				m_faw->setContext("%F");
 			}
 			else if (npe->type_ == NumPartEditorW::machine) {
-				m_eaw->setContext("%M");
+				m_faw->setContext("%M");
 			}
 			else if (npe->type_ == NumPartEditorW::locmach) {
-				m_eaw->setContext("%LM");
+				m_faw->setContext("%LM");
 			}
 			
 			
 			else if (npe->type_ == NumPartEditorW::elementcolumn) {
-				m_eaw->setContext("%c");
+				m_faw->setContext("%c");
 			}
 			else if (npe->type_ == NumPartEditorW::elementline) {
-				m_eaw->setContext("%l");
+				m_faw->setContext("%l");
 			}
 			else if (npe->type_ == NumPartEditorW::elementprefix) {
-				m_eaw->setContext("%prefix");
+				m_faw->setContext("%prefix");
 			}
 			else if (npe->type_ == NumPartEditorW::string) {
-				m_eaw->setContext(npe->toNumContext().itemAt(0).at(1));
+				m_faw->setContext(npe->toNumContext().itemAt(0).at(1));
 			}
 			else if (npe->type_ == NumPartEditorW::unit) {
 				count_unit++;
-				m_eaw->setContext("%sequ_"+QString::number(count_unit));
+				m_faw->setContext("%sequ_"+QString::number(count_unit));
 			}
 			else if (npe->type_ == NumPartEditorW::unitfolio) {
 				count_unitf++;
-				m_eaw->setContext("%sequf_"+QString::number(count_unitf));
+				m_faw->setContext("%sequf_"+QString::number(count_unitf));
 			}
 			else if (npe->type_ == NumPartEditorW::ten) {
 				count_ten++;
-				m_eaw->setContext("%seqt_"+QString::number(count_ten));
+				m_faw->setContext("%seqt_"+QString::number(count_ten));
 			}
 			else if (npe->type_ == NumPartEditorW::tenfolio) {
 				count_tenf++;
-				m_eaw->setContext("%seqtf_"+QString::number(count_tenf));
+				m_faw->setContext("%seqtf_"+QString::number(count_tenf));
 			}
 			else if (npe->type_ == NumPartEditorW::hundred) {
 				count_hundred++;
-				m_eaw->setContext("%seqh_"+QString::number(count_hundred));
+				m_faw->setContext("%seqh_"+QString::number(count_hundred));
 			}
 			else if (npe->type_ == NumPartEditorW::hundredfolio) {
 				count_hundredf++;
-				m_eaw->setContext("%seqhf_"+QString::number(count_hundredf));
+				m_faw->setContext("%seqhf_"+QString::number(count_hundredf));
 			}
 		}
 	}

Modified: trunk/sources/ui/selectautonumw.h
===================================================================
--- trunk/sources/ui/selectautonumw.h	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/selectautonumw.h	2016-08-29 15:37:42 UTC (rev 4674)
@@ -20,10 +20,11 @@
 
 #include <QWidget>
 #include "numerotationcontext.h"
-#include "elementautonumberingw.h"
+#include "formulaautonumberingw.h"
 
 class NumPartEditorW;
 class QAbstractButton;
+class FormulaAutonumberingW;
 
 namespace Ui {
 	class SelectAutonumW;
@@ -42,7 +43,7 @@
 		void setContext (const NumerotationContext &context);
 		NumerotationContext toNumContext() const;
 		void contextToFormula ();
-		QString elementFormula();
+		QString formula();
 
 	signals:
 		void applyPressed();
@@ -65,7 +66,8 @@
 		Ui::SelectAutonumW *ui;
 		QList <NumPartEditorW *> num_part_list_;
 		NumerotationContext m_context;
-		ElementAutonumberingW *m_eaw;
+		FormulaAutonumberingW *m_feaw;
+		FormulaAutonumberingW *m_fcaw;
 };
 
 #endif // SELECTAUTONUMW_H

Modified: trunk/sources/ui/selectautonumw.ui
===================================================================
--- trunk/sources/ui/selectautonumw.ui	2016-08-26 19:44:15 UTC (rev 4673)
+++ trunk/sources/ui/selectautonumw.ui	2016-08-29 15:37:42 UTC (rev 4674)
@@ -224,7 +224,7 @@
                  <string>Type</string>
                 </property>
                 <property name="alignment">
-                 <set>Qt::AlignCenter</set>
+                 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
                 </property>
                </widget>
               </item>
@@ -234,7 +234,7 @@
                  <string>Valeur</string>
                 </property>
                 <property name="alignment">
-                 <set>Qt::AlignCenter</set>
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                 </property>
                </widget>
               </item>
@@ -250,7 +250,7 @@
                  <string>Incrémentation</string>
                 </property>
                 <property name="alignment">
-                 <set>Qt::AlignCenter</set>
+                 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                 </property>
                </widget>
               </item>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/