mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
1) Use arrow keys to navigate through the diagram editor. 2) Use PgUp, PgDn, Home and End keys to navigate through open folios. 3)Use Delete Key inside elements panel widget to delete diagrams. 4) Added a scroll area in auto numbering page.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4476 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
#include "integrationmovetemplateshandler.h"
|
||||
#include "xmlelementcollection.h"
|
||||
#include "importelementdialog.h"
|
||||
#include "numerotationcontextcommands.h"
|
||||
|
||||
|
||||
#include <QStandardPaths>
|
||||
|
||||
@@ -54,7 +56,8 @@ QETProject::QETProject(int diagrams, QObject *parent) :
|
||||
titleblocks_ (this ),
|
||||
folioSheetsQuantity (0 ),
|
||||
m_auto_conductor (true ),
|
||||
m_elements_collection (nullptr)
|
||||
m_elements_collection (nullptr),
|
||||
m_auto_folio (true )
|
||||
{
|
||||
// 0 a n schema(s) vide(s)
|
||||
int diagrams_count = qMax(0, diagrams);
|
||||
@@ -91,7 +94,8 @@ QETProject::QETProject(const QString &path, QObject *parent) :
|
||||
titleblocks_ (this ),
|
||||
folioSheetsQuantity (0 ),
|
||||
m_auto_conductor (true ),
|
||||
m_elements_collection (nullptr)
|
||||
m_elements_collection (nullptr),
|
||||
m_auto_folio (true )
|
||||
{
|
||||
//Open the file
|
||||
QFile project_file(path);
|
||||
@@ -442,9 +446,17 @@ QHash <QString, NumerotationContext> QETProject::conductorAutoNum() const {
|
||||
return m_conductor_autonum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::folioAutoNum
|
||||
* @return All value of conductor autonum stored in project
|
||||
*/
|
||||
QHash <QString, NumerotationContext> QETProject::folioAutoNum() const {
|
||||
return m_folio_autonum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::addConductorAutoNum
|
||||
* Add a new numerotation context. If key already exist,
|
||||
* Add a new conductor numerotation context. If key already exist,
|
||||
* replace old context by the new context
|
||||
* @param key
|
||||
* @param context
|
||||
@@ -453,18 +465,38 @@ void QETProject::addConductorAutoNum(QString key, NumerotationContext context) {
|
||||
m_conductor_autonum.insert(key, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::addFolioAutoNum
|
||||
* Add a new folio numerotation context. If key already exist,
|
||||
* replace old context by the new context
|
||||
* @param key
|
||||
* @param context
|
||||
*/
|
||||
void QETProject::addFolioAutoNum(QString key, NumerotationContext context) {
|
||||
m_folio_autonum.insert(key, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::removeConductorAutonum
|
||||
* Remove the Numerotation Context stored with key
|
||||
* Remove Conductor Numerotation Context stored with key
|
||||
* @param key
|
||||
*/
|
||||
void QETProject::removeConductorAutonum(QString key) {
|
||||
m_conductor_autonum.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::removeFolioAutonum
|
||||
* Remove Folio Numerotation Context stored with key
|
||||
* @param key
|
||||
*/
|
||||
void QETProject::removeFolioAutoNum(QString key) {
|
||||
m_folio_autonum.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::conductorAutoNum
|
||||
* Return the numerotation context stored with @key.
|
||||
* Return conductor numerotation context stored with @key.
|
||||
* If key is not found, return an empty numerotation context
|
||||
* @param key
|
||||
*/
|
||||
@@ -473,6 +505,17 @@ NumerotationContext QETProject::conductorAutoNum (const QString &key) const {
|
||||
else return NumerotationContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::folioAutoNum
|
||||
* Return folio numerotation context stored with @key.
|
||||
* If key is not found, return an empty numerotation context
|
||||
* @param key
|
||||
*/
|
||||
NumerotationContext QETProject::folioAutoNum (const QString &key) const {
|
||||
if (m_folio_autonum.contains(key)) return m_folio_autonum[key];
|
||||
else return NumerotationContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::autoConductor
|
||||
* @return true if use of auto conductor is authorized.
|
||||
@@ -483,6 +526,16 @@ bool QETProject::autoConductor() const
|
||||
return m_auto_conductor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::autoFolio
|
||||
* @return true if use of auto folio is authorized.
|
||||
* See also Q_PROPERTY autoFolio
|
||||
*/
|
||||
bool QETProject::autoFolio() const
|
||||
{
|
||||
return m_auto_folio;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::setAutoConductor
|
||||
* @param ac
|
||||
@@ -495,6 +548,46 @@ void QETProject::setAutoConductor(bool ac)
|
||||
m_auto_conductor = ac;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::setAutoFolio
|
||||
* @param ac
|
||||
* Enable the use of auto folio if true
|
||||
* See also Q_PROPERTY autoConductor
|
||||
*/
|
||||
void QETProject::setAutoFolio(bool af)
|
||||
{
|
||||
if (af != m_auto_folio)
|
||||
m_auto_folio = af;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::autoFolioNumberingNewFolios
|
||||
* emit Signal to add new Diagram with autonum
|
||||
* properties
|
||||
*/
|
||||
void QETProject::autoFolioNumberingNewFolios(){
|
||||
emit addAutoNumDiagram();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETProject::autoFolioNumberingNewFolios
|
||||
* @param autonum used, index from selected tabs "from" and "to"
|
||||
* rename folios with selected autonum
|
||||
*/
|
||||
void QETProject::autoFolioNumberingSelectedFolios(int from, int to, QString autonum){
|
||||
int total_folio = diagrams_.count();
|
||||
DiagramContext project_wide_properties = project_properties_;
|
||||
for (int i=from; i<=to; i++) {
|
||||
QString title = diagrams_[i] -> title();
|
||||
NumerotationContext nC = folioAutoNum(autonum);
|
||||
NumerotationContextCommands nCC = NumerotationContextCommands(nC);
|
||||
diagrams_[i] -> border_and_titleblock.setFolio("%autonum");
|
||||
diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties);
|
||||
diagrams_[i] -> project() -> addFolioAutoNum(autonum,nCC.next());
|
||||
diagrams_[i] -> update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@return un document XML representant le projet
|
||||
*/
|
||||
@@ -1157,7 +1250,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
||||
m_default_xref_properties = XRefProperties:: defaultProperties();
|
||||
|
||||
//Read values indicate in project
|
||||
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums;
|
||||
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums, folio_autonums;
|
||||
|
||||
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling())
|
||||
{
|
||||
@@ -1176,6 +1269,8 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
||||
xref_elmt = child_elmt;
|
||||
else if (child_elmt.tagName() == "conductors_autonums")
|
||||
conds_autonums = child_elmt;
|
||||
else if (child_elmt.tagName()== "folio_autonums")
|
||||
folio_autonums = child_elmt;
|
||||
}
|
||||
|
||||
// size, titleblock, conductor, report, conductor autonum
|
||||
@@ -1201,6 +1296,15 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
||||
m_conductor_autonum.insert(elmt.attribute("title"), nc);
|
||||
}
|
||||
}
|
||||
if (!folio_autonums.isNull())
|
||||
{
|
||||
foreach (QDomElement elmt, QET::findInDomElement(folio_autonums, "folio_autonum"))
|
||||
{
|
||||
NumerotationContext nc;
|
||||
nc.fromXml(elmt);
|
||||
m_folio_autonum.insert(elmt.attribute("title"), nc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1261,6 +1365,15 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
||||
conds_autonums.appendChild(cond_autonum);
|
||||
}
|
||||
xml_element.appendChild(conds_autonums);
|
||||
|
||||
//Export Folio Autonums
|
||||
QDomElement folio_autonums = xml_document.createElement("folio_autonums");
|
||||
foreach (QString key, folioAutoNum().keys()) {
|
||||
QDomElement folio_autonum = folioAutoNum(key).toXml(xml_document, "folio_autonum");
|
||||
folio_autonum.setAttribute("title", key);
|
||||
folio_autonums.appendChild(folio_autonum);
|
||||
}
|
||||
xml_element.appendChild(folio_autonums);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1416,7 +1529,17 @@ void QETProject::updateDiagramsFolioData() {
|
||||
project_wide_properties.addValue("projecttitle", title());
|
||||
|
||||
for (int i = 0 ; i < total_folio ; ++ i) {
|
||||
diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, project_wide_properties);
|
||||
QString title = diagrams_[i] -> title();
|
||||
QString autopagenum = diagrams_[i]->border_and_titleblock.autoPageNum();
|
||||
NumerotationContext nC = folioAutoNum(autopagenum);
|
||||
NumerotationContextCommands nCC = NumerotationContextCommands(nC);
|
||||
if((diagrams_[i]->border_and_titleblock.folio().contains("%autonum"))&&(!autopagenum.isNull())){
|
||||
diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties);
|
||||
diagrams_[i]->project()->addFolioAutoNum(autopagenum,nCC.next());
|
||||
}
|
||||
else{
|
||||
diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, NULL, project_wide_properties);
|
||||
}
|
||||
diagrams_[i] -> update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user