diff --git a/sources/conductorautonumerotation.cpp b/sources/conductorautonumerotation.cpp index cc3fc995e..6cd04a417 100644 --- a/sources/conductorautonumerotation.cpp +++ b/sources/conductorautonumerotation.cpp @@ -99,6 +99,30 @@ void ConductorAutoNumerotation::applyText(const QString& t) m_diagram->undoStack().push(undo); } +/** + * @brief ConductorAutoNumerotation::newProperties + * Create a new properties according to the current autonum rule of diagram + * @param d + * @param cp + * @param seq + */ +void ConductorAutoNumerotation::newProperties(Diagram *diagram, ConductorProperties &cp, autonum::sequentialNumbers &seq) +{ + NumerotationContext context = diagram->project()->conductorAutoNum(diagram->conductorsAutonumName()); + if (context.isEmpty()) { + return; + } + + QString autoNum_name = diagram->project()->conductorCurrentAutoNum(); + QString formula = autonum::numerotationContextToFormula(context); + cp.m_formula = formula; + + autonum::setSequential(formula, seq, context, diagram, autoNum_name); + + NumerotationContextCommands ncc (context, diagram); + diagram->project()->addConductorAutoNum(autoNum_name, ncc.next()); +} + /** * @brief ConductorAutoNumerotation::numeratePotential * Numerate a conductor on an existing potential diff --git a/sources/conductorautonumerotation.h b/sources/conductorautonumerotation.h index 081a5d575..740e10e50 100644 --- a/sources/conductorautonumerotation.h +++ b/sources/conductorautonumerotation.h @@ -19,10 +19,12 @@ #define CONDUCTORAUTONUMEROTATION_H #include +#include "assignvariables.h" class Diagram; class Conductor; class QUndoCommand; +class ConductorProperties; class ConductorAutoNumerotation { @@ -33,6 +35,7 @@ class ConductorAutoNumerotation //methods void numerate (); void applyText (const QString&); + static void newProperties(Diagram *diagram, ConductorProperties &cp, autonum::sequentialNumbers &seq); private: //methods