diff --git a/qelectrotech.qrc b/qelectrotech.qrc
index 6174707ae..dc74de6b5 100644
--- a/qelectrotech.qrc
+++ b/qelectrotech.qrc
@@ -180,7 +180,7 @@
ico/oxygen-icons/48x48/apps/qelectrotech.png
ico/oxygen-icons/64x64/apps/qelectrotech.png
ico/splash.png
- insets/default.inset
+ titleblocks/default.titleblock
LICENSE
diff --git a/sources/borderpropertieswidget.cpp b/sources/borderpropertieswidget.cpp
index 5316f5543..74f70a5be 100644
--- a/sources/borderpropertieswidget.cpp
+++ b/sources/borderpropertieswidget.cpp
@@ -18,7 +18,7 @@
#include "borderpropertieswidget.h"
#include
#include "qetapp.h"
-#include "borderinset.h"
+#include "bordertitleblock.h"
/**
Constructeur
@@ -99,11 +99,11 @@ void BorderPropertiesWidget::build() {
QLabel *ds1 = new QLabel(tr("Colonnes :"));
columns_count = new QSpinBox(diagram_size_box);
- columns_count -> setMinimum(BorderInset::minNbColumns());
+ columns_count -> setMinimum(BorderTitleBlock::minNbColumns());
columns_count -> setMaximum(10000); // valeur arbitraire
columns_width = new QSpinBox(diagram_size_box);
- columns_width -> setMinimum(qRound(BorderInset::minColumnsWidth()));
+ columns_width -> setMinimum(qRound(BorderTitleBlock::minColumnsWidth()));
columns_width -> setSingleStep(10);
columns_width -> setPrefix(tr("\327", "multiplication symbol"));
columns_width -> setSuffix(tr("px", "unit for cols width"));
@@ -114,11 +114,11 @@ void BorderPropertiesWidget::build() {
QLabel *ds2 = new QLabel(tr("Lignes :"));
rows_count = new QSpinBox(diagram_size_box);
- rows_count -> setMinimum(BorderInset::minNbRows());
+ rows_count -> setMinimum(BorderTitleBlock::minNbRows());
rows_count -> setMaximum(10000); // valeur arbitraire
rows_height = new QSpinBox(diagram_size_box);
- rows_height -> setMinimum(qRound(BorderInset::minRowsHeight()));
+ rows_height -> setMinimum(qRound(BorderTitleBlock::minRowsHeight()));
rows_height -> setSingleStep(10);
rows_height -> setPrefix(tr("\327", "multiplication symbol"));
rows_height -> setSuffix(tr("px", "unit for rows height"));
diff --git a/sources/borderpropertieswidget.h b/sources/borderpropertieswidget.h
index 4399dec67..9583ee773 100644
--- a/sources/borderpropertieswidget.h
+++ b/sources/borderpropertieswidget.h
@@ -24,7 +24,7 @@ class QSpinBox;
/**
Cette classe represente un widget permettant d'editer les dimensions et les
options d'affichage d'un schema, cartouche non inclus.
- @see InsetPropertiesWidget
+ @see TitleBlockPropertiesWidget
*/
class BorderPropertiesWidget : public QWidget {
Q_OBJECT
diff --git a/sources/borderinset.cpp b/sources/bordertitleblock.cpp
similarity index 72%
rename from sources/borderinset.cpp
rename to sources/bordertitleblock.cpp
index 7f6ff21dd..95b9a30b6 100644
--- a/sources/borderinset.cpp
+++ b/sources/bordertitleblock.cpp
@@ -16,10 +16,10 @@
along with QElectroTech. If not, see .
*/
#include
-#include "insettemplate.h"
-#include "insettemplaterenderer.h"
+#include "titleblocktemplate.h"
+#include "titleblocktemplaterenderer.h"
#include "diagramcontext.h"
-#include "borderinset.h"
+#include "bordertitleblock.h"
#include "diagramposition.h"
#include "qetapp.h"
#include "math.h"
@@ -27,22 +27,22 @@
/**
Constructeur simple : construit une bordure en recuperant les dimensions
dans la configuration de l'application.
- @param parent QObject parent de ce BorderInset
+ @param parent QObject parent de ce BorderTitleBlock
*/
-BorderInset::BorderInset(QObject *parent) :
+BorderTitleBlock::BorderTitleBlock(QObject *parent) :
QObject(parent)
{
- // at first, the internal inset template renderer uses the default inset template
- inset_template_renderer = new InsetTemplateRenderer(this);
- inset_template_renderer -> setInsetTemplate(QETApp::defaultInsetTemplate());
+ // at first, the internal titleblock template renderer uses the default titleblock template
+ titleblock_template_renderer = new TitleBlockTemplateRenderer(this);
+ titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
// dimensions par defaut du schema
importBorder(BorderProperties());
// contenu par defaut du cartouche
- importInset(InsetProperties());
+ importTitleBlock(TitleBlockProperties());
- display_inset = true;
+ display_titleblock = true;
display_border = true;
setFolioData(1, 1);
updateRectangles();
@@ -51,49 +51,49 @@ BorderInset::BorderInset(QObject *parent) :
/**
Destructeur - ne fait rien
*/
-BorderInset::~BorderInset() {
+BorderTitleBlock::~BorderTitleBlock() {
}
/**
@return la hauteur du cartouche
*/
-qreal BorderInset::insetHeight() const {
- return(inset_template_renderer -> height());
+qreal BorderTitleBlock::titleBlockHeight() const {
+ return(titleblock_template_renderer -> height());
}
/**
@return Le nombre minimum de colonnes qu'un schema doit comporter
*/
-int BorderInset::minNbColumns() {
+int BorderTitleBlock::minNbColumns() {
return(3);
}
/**
@return la largeur minimale d'une colonne de schema
*/
-qreal BorderInset::minColumnsWidth() {
+qreal BorderTitleBlock::minColumnsWidth() {
return(5.0);
}
/**
@return Le nombre minimum de lignes qu'un schema doit comporter
*/
-int BorderInset::minNbRows() {
+int BorderTitleBlock::minNbRows() {
return(2);
}
/**
@return la hauteur minimale d'une ligne de schema
*/
-qreal BorderInset::minRowsHeight() {
+qreal BorderTitleBlock::minRowsHeight() {
return(5.0);
}
/**
@return les proprietes du cartouches
*/
-InsetProperties BorderInset::exportInset() {
- InsetProperties ip;
+TitleBlockProperties BorderTitleBlock::exportTitleBlock() {
+ TitleBlockProperties ip;
ip.author = bi_author;
ip.date = bi_date;
ip.title = bi_title;
@@ -105,20 +105,20 @@ InsetProperties BorderInset::exportInset() {
/**
@param ip les nouvelles proprietes du cartouche
*/
-void BorderInset::importInset(const InsetProperties &ip) {
+void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
bi_author = ip.author;
bi_date = ip.date;
setTitle(ip.title);
bi_folio = ip.folio;
bi_filename = ip.filename;
- updateDiagramContextForInset();
+ updateDiagramContextForTitleBlock();
emit(needFolioData());
}
/**
@return les proprietes de la bordure
*/
-BorderProperties BorderInset::exportBorder() {
+BorderProperties BorderTitleBlock::exportBorder() {
BorderProperties bp;
bp.columns_count = nbColumns();
bp.columns_width = columnsWidth();
@@ -134,7 +134,7 @@ BorderProperties BorderInset::exportBorder() {
/**
@param bp les nouvelles proprietes de la bordure
*/
-void BorderInset::importBorder(const BorderProperties &bp) {
+void BorderTitleBlock::importBorder(const BorderProperties &bp) {
setColumnsHeaderHeight(bp.columns_header_height);
setNbColumns(bp.columns_count);
setColumnsWidth(bp.columns_width);
@@ -146,34 +146,34 @@ void BorderInset::importBorder(const BorderProperties &bp) {
}
/**
- @return the inset template used to render the inset
- @see InsetTemplateRenderer::insetTemplate()
+ @return the titleblock template used to render the titleblock
+ @see TitleBlockTemplateRenderer::titleBlockTemplate()
*/
-const InsetTemplate *BorderInset::insetTemplate() {
- return(inset_template_renderer -> insetTemplate());
+const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate() {
+ return(titleblock_template_renderer -> titleBlockTemplate());
}
/**
- @param inset_template The new inset template to use to render the inset
- @see InsetTemplateRenderer::setInsetTemplate()
+ @param titleblock_template The new titleblock template to use to render the titleblock
+ @see TitleBlockTemplateRenderer::setTitleBlockTemplate()
*/
-void BorderInset::setInsetTemplate(const InsetTemplate *inset_template) {
- inset_template_renderer -> setInsetTemplate(inset_template);
+void BorderTitleBlock::setTitleBlockTemplate(const TitleBlockTemplate *titleblock_template) {
+ titleblock_template_renderer -> setTitleBlockTemplate(titleblock_template);
}
/**
@param di true pour afficher le cartouche, false sinon
*/
-void BorderInset::displayInset(bool di) {
- bool change = (di != display_inset);
- display_inset = di;
+void BorderTitleBlock::displayTitleBlock(bool di) {
+ bool change = (di != display_titleblock);
+ display_titleblock = di;
if (change) emit(displayChanged());
}
/**
@param dc true pour afficher les entetes des colonnes, false sinon
*/
-void BorderInset::displayColumns(bool dc) {
+void BorderTitleBlock::displayColumns(bool dc) {
bool change = (dc != display_columns);
display_columns = dc;
if (change) emit(displayChanged());
@@ -182,7 +182,7 @@ void BorderInset::displayColumns(bool dc) {
/**
@param dr true pour afficher les entetes des lignes, false sinon
*/
-void BorderInset::displayRows(bool dr) {
+void BorderTitleBlock::displayRows(bool dr) {
bool change = (dr != display_rows);
display_rows = dr;
if (change) emit(displayChanged());
@@ -193,7 +193,7 @@ void BorderInset::displayRows(bool dr) {
Note : si l'affichage de la bordure est ainsi desactivee, les lignes et
colonnes ne seront pas dessinees.
*/
-void BorderInset::displayBorder(bool db) {
+void BorderTitleBlock::displayBorder(bool db) {
bool change = (db != display_border);
display_border = db;
if (change) emit(displayChanged());
@@ -203,14 +203,14 @@ void BorderInset::displayBorder(bool db) {
Methode recalculant les rectangles composant le cadre et le cartouche en
fonction des attributs de taille
*/
-void BorderInset::updateRectangles() {
+void BorderTitleBlock::updateRectangles() {
// rectangle delimitant le schema
QRectF previous_diagram = diagram;
diagram = QRectF(0, 0, diagramWidth(), diagramHeight());
if (diagram != previous_diagram) emit(borderChanged(previous_diagram, diagram));
// rectangles relatifs au cartouche
- inset = QRectF(diagram.bottomLeft().x(), diagram.bottomLeft().y(), insetWidth(), insetHeight());
+ titleblock = QRectF(diagram.bottomLeft().x(), diagram.bottomLeft().y(), titleBlockWidth(), titleBlockHeight());
}
/**
@@ -219,10 +219,10 @@ void BorderInset::updateRectangles() {
@param x Abscisse du cadre
@param y Ordonnee du cadre
*/
-void BorderInset::draw(QPainter *qp, qreal x, qreal y) {
+void BorderTitleBlock::draw(QPainter *qp, qreal x, qreal y) {
// translate tous les rectangles
diagram .translate(x, y);
- inset .translate(x, y);
+ titleblock .translate(x, y);
// prepare le QPainter
qp -> save();
@@ -276,24 +276,24 @@ void BorderInset::draw(QPainter *qp, qreal x, qreal y) {
}
}
- // render the inset, using the InsetTemplate object
- if (display_inset) {
- qp -> translate(inset.topLeft());
- inset_template_renderer -> render(qp, inset.width());
- qp -> translate(-inset.topLeft());
+ // render the titleblock, using the TitleBlockTemplate object
+ if (display_titleblock) {
+ qp -> translate(titleblock.topLeft());
+ titleblock_template_renderer -> render(qp, titleblock.width());
+ qp -> translate(-titleblock.topLeft());
}
qp -> restore();
// annule la translation des rectangles
diagram .translate(-x, -y);
- inset .translate(-x, -y);
+ titleblock .translate(-x, -y);
}
/**
Ajoute une colonne.
*/
-void BorderInset::addColumn() {
+void BorderTitleBlock::addColumn() {
setNbColumns(nbColumns() + 1);
}
@@ -301,14 +301,14 @@ void BorderInset::addColumn() {
Enleve une colonne sans passer sous le minimum requis.
@see minNbColumns()
*/
-void BorderInset::removeColumn() {
+void BorderTitleBlock::removeColumn() {
setNbColumns(nbColumns() - 1);
}
/**
Ajoute une ligne.
*/
-void BorderInset::addRow() {
+void BorderTitleBlock::addRow() {
setNbRows(nbRows() + 1);
}
@@ -316,7 +316,7 @@ void BorderInset::addRow() {
Enleve une ligne sans passer sous le minimum requis.
@see minNbRows()
*/
-void BorderInset::removeRow() {
+void BorderTitleBlock::removeRow() {
setNbRows(nbRows() - 1);
}
@@ -327,10 +327,10 @@ void BorderInset::removeRow() {
@param nb_c nouveau nombre de colonnes
@see minNbColumns()
*/
-void BorderInset::setNbColumns(int nb_c) {
+void BorderTitleBlock::setNbColumns(int nb_c) {
if (nb_c == nbColumns()) return;
nb_columns = qMax(minNbColumns(), nb_c);
- setInsetWidth(diagramWidth());
+ setTitleBlockWidth(diagramWidth());
}
/**
@@ -340,10 +340,10 @@ void BorderInset::setNbColumns(int nb_c) {
@param new_cw nouvelle largeur des colonnes
@see minColumnsWidth()
*/
-void BorderInset::setColumnsWidth(const qreal &new_cw) {
+void BorderTitleBlock::setColumnsWidth(const qreal &new_cw) {
if (new_cw == columnsWidth()) return;
columns_width = qMax(minColumnsWidth(), new_cw);
- setInsetWidth(diagramWidth());
+ setTitleBlockWidth(diagramWidth());
}
/**
@@ -351,7 +351,7 @@ void BorderInset::setColumnsWidth(const qreal &new_cw) {
doit rester comprise entre 5 et 50 px.
@param new_chh nouvelle hauteur des en-tetes de colonnes
*/
-void BorderInset::setColumnsHeaderHeight(const qreal &new_chh) {
+void BorderTitleBlock::setColumnsHeaderHeight(const qreal &new_chh) {
columns_header_height = qBound(qreal(5.0), new_chh, qreal(50.0));
updateRectangles();
}
@@ -363,10 +363,10 @@ void BorderInset::setColumnsHeaderHeight(const qreal &new_chh) {
@param nb_r nouveau nombre de lignes
@see minNbRows()
*/
-void BorderInset::setNbRows(int nb_r) {
+void BorderTitleBlock::setNbRows(int nb_r) {
if (nb_r == nbRows()) return;
nb_rows = qMax(minNbRows(), nb_r);
- setInsetWidth(diagramWidth());
+ setTitleBlockWidth(diagramWidth());
updateRectangles();
}
@@ -377,7 +377,7 @@ void BorderInset::setNbRows(int nb_r) {
@param new_rh nouvelle hauteur des lignes
@see minRowsHeight()
*/
-void BorderInset::setRowsHeight(const qreal &new_rh) {
+void BorderTitleBlock::setRowsHeight(const qreal &new_rh) {
if (new_rh == rowsHeight()) return;
rows_height = qMax(minRowsHeight(), new_rh);
updateRectangles();
@@ -388,7 +388,7 @@ void BorderInset::setRowsHeight(const qreal &new_rh) {
doit rester comprise entre 5 et 50 px.
@param new_rhw nouvelle largeur des en-tetes des lignes
*/
-void BorderInset::setRowsHeaderWidth(const qreal &new_rhw) {
+void BorderTitleBlock::setRowsHeaderWidth(const qreal &new_rhw) {
rows_header_width = qBound(qreal(5.0), new_rhw, qreal(50.0));
updateRectangles();
}
@@ -397,7 +397,7 @@ void BorderInset::setRowsHeaderWidth(const qreal &new_rhw) {
Cette methode essaye de se rapprocher le plus possible de la hauteur donnee
en parametre en modifiant le nombre de lignes en cours.
*/
-void BorderInset::setDiagramHeight(const qreal &height) {
+void BorderTitleBlock::setDiagramHeight(const qreal &height) {
// taille des lignes a utiliser = rows_height
setNbRows(qRound(ceil(height / rows_height)));
}
@@ -406,8 +406,8 @@ void BorderInset::setDiagramHeight(const qreal &height) {
Change la largeur du cartouche. Cette largeur sera restreinte a celle du
schema.
*/
-void BorderInset::setInsetWidth(const qreal &new_iw) {
- inset_width = qMin(diagramWidth(), new_iw);
+void BorderTitleBlock::setTitleBlockWidth(const qreal &new_iw) {
+ titleblock_width = qMin(diagramWidth(), new_iw);
updateRectangles();
}
@@ -416,8 +416,8 @@ void BorderInset::setInsetWidth(const qreal &new_iw) {
Ajuste la largeur du cartouche de facon a ce que celui-ci soit aussi large
que le schema
*/
-void BorderInset::adjustInsetToColumns() {
- setInsetWidth(diagramWidth());
+void BorderTitleBlock::adjustTitleBlockToColumns() {
+ setTitleBlockWidth(diagramWidth());
}
/**
@@ -425,7 +425,7 @@ void BorderInset::adjustInsetToColumns() {
dans la grille (ex : B2)
@return la position dans la grille correspondant a pos
*/
-DiagramPosition BorderInset::convertPosition(const QPointF &pos) {
+DiagramPosition BorderTitleBlock::convertPosition(const QPointF &pos) {
// recupere le rectangle quadrille par les en-tetes
QRectF grid_rect(
rowsHeaderWidth(),
@@ -451,10 +451,10 @@ DiagramPosition BorderInset::convertPosition(const QPointF &pos) {
}
/**
- Update the informations given to the inset template by regenerating a
+ Update the informations given to the titleblock template by regenerating a
DiagramContext object.
*/
-void BorderInset::updateDiagramContextForInset() {
+void BorderTitleBlock::updateDiagramContextForTitleBlock() {
DiagramContext context;
context.addValue("author", bi_author);
context.addValue("date", bi_date.toString("dd/MM/yyyy"));
@@ -464,10 +464,10 @@ void BorderInset::updateDiagramContextForInset() {
context.addValue("folio-id", folio_index_);
context.addValue("folio-total", folio_total_);
- inset_template_renderer -> setContext(context);
+ titleblock_template_renderer -> setContext(context);
}
-QString BorderInset::incrementLetters(const QString &string) {
+QString BorderTitleBlock::incrementLetters(const QString &string) {
if (string.isEmpty()) {
return("A");
} else {
@@ -488,7 +488,7 @@ QString BorderInset::incrementLetters(const QString &string) {
@param index numero du schema (de 1 a total)
@param total nombre total de schemas dans le projet
*/
-void BorderInset::setFolioData(int index, int total) {
+void BorderTitleBlock::setFolioData(int index, int total) {
if (index < 1 || total < 1 || index > total) return;
// memorise les informations
@@ -500,5 +500,5 @@ void BorderInset::setFolioData(int index, int total) {
bi_final_folio.replace("%id", QString::number(folio_index_));
bi_final_folio.replace("%total", QString::number(folio_total_));
- updateDiagramContextForInset();
+ updateDiagramContextForTitleBlock();
}
diff --git a/sources/borderinset.h b/sources/bordertitleblock.h
similarity index 86%
rename from sources/borderinset.h
rename to sources/bordertitleblock.h
index d0744817f..dfe395dcb 100644
--- a/sources/borderinset.h
+++ b/sources/bordertitleblock.h
@@ -15,31 +15,31 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
-#ifndef BORDERINSET_H
-#define BORDERINSET_H
-#include "insetproperties.h"
+#ifndef BORDERTITLEBLOCK_H
+#define BORDERTITLEBLOCK_H
+#include "titleblockproperties.h"
#include "borderproperties.h"
#include
#include
#include
class QPainter;
class DiagramPosition;
-class InsetTemplate;
-class InsetTemplateRenderer;
+class TitleBlockTemplate;
+class TitleBlockTemplateRenderer;
/**
Cette classe represente l'ensemble bordure + cartouche qui encadre le
schema electrique.
*/
-class BorderInset : public QObject {
+class BorderTitleBlock : public QObject {
Q_OBJECT
// constructeurs, destructeur
public:
- BorderInset(QObject * = 0);
- virtual ~BorderInset();
+ BorderTitleBlock(QObject * = 0);
+ virtual ~BorderTitleBlock();
private:
- BorderInset(const BorderInset &);
+ BorderTitleBlock(const BorderTitleBlock &);
// methodes
public:
@@ -79,14 +79,14 @@ class BorderInset : public QObject {
// cartouche
/// @return la largeur du cartouche
- qreal insetWidth() const { return(inset_width); }
- qreal insetHeight() const;
+ qreal titleBlockWidth() const { return(titleblock_width); }
+ qreal titleBlockHeight() const;
// cadre avec le cartouche
/// @return la hauteur de la bordure
qreal borderWidth() const { return(diagramWidth()); }
/// @return la hauteur de la bordure
- qreal borderHeight() const { return(diagramHeight() + insetHeight()); }
+ qreal borderHeight() const { return(diagramHeight() + titleBlockHeight()); }
// methodes d'acces en lecture aux informations du cartouche
/// @return le champ "Auteur" du cartouche
@@ -102,7 +102,7 @@ class BorderInset : public QObject {
// methodes d'acces en lecture aux options
/// @return true si le cartouche est affiche, false sinon
- bool insetIsDisplayed() const { return(display_inset); }
+ bool titleBlockIsDisplayed() const { return(display_titleblock); }
/// @return true si les entetes des colonnes sont affiches, false sinon
bool columnsAreDisplayed() const { return(display_columns); }
/// @return true si les entetes des lignes sont affiches, false sinon
@@ -122,8 +122,8 @@ class BorderInset : public QObject {
void setColumnsHeaderHeight(const qreal &);
void setRowsHeaderWidth (const qreal &);
void setDiagramHeight (const qreal &);
- void setInsetWidth (const qreal &);
- void adjustInsetToColumns ();
+ void setTitleBlockWidth (const qreal &);
+ void adjustTitleBlockToColumns ();
DiagramPosition convertPosition(const QPointF &);
@@ -145,23 +145,23 @@ class BorderInset : public QObject {
/// @param filename le nouveau contenu du champ "Fichier"
void setFileName (const QString &filename) { bi_filename = filename; }
- InsetProperties exportInset();
- void importInset(const InsetProperties &);
+ TitleBlockProperties exportTitleBlock();
+ void importTitleBlock(const TitleBlockProperties &);
BorderProperties exportBorder();
void importBorder(const BorderProperties &);
- const InsetTemplate *insetTemplate();
- void setInsetTemplate(const InsetTemplate *);
+ const TitleBlockTemplate *titleBlockTemplate();
+ void setTitleBlockTemplate(const TitleBlockTemplate *);
// methodes d'acces en ecriture aux options
- void displayInset(bool);
+ void displayTitleBlock(bool);
void displayColumns(bool);
void displayRows(bool);
void displayBorder(bool);
private:
void updateRectangles();
- void updateDiagramContextForInset();
+ void updateDiagramContextForTitleBlock();
QString incrementLetters(const QString &);
// signaux
@@ -212,18 +212,18 @@ class BorderInset : public QObject {
qreal rows_header_width;
// dimensions du cartouche
- qreal inset_width;
- qreal inset_height;
+ qreal titleblock_width;
+ qreal titleblock_height;
// rectangles utilises pour le dessin
QRectF diagram;
- QRectF inset;
+ QRectF titleblock;
// booleens pour les options de dessin
- bool display_inset;
+ bool display_titleblock;
bool display_columns;
bool display_rows;
bool display_border;
- InsetTemplateRenderer *inset_template_renderer;
+ TitleBlockTemplateRenderer *titleblock_template_renderer;
};
#endif
diff --git a/sources/configpages.cpp b/sources/configpages.cpp
index e17d397e9..7b58dad87 100644
--- a/sources/configpages.cpp
+++ b/sources/configpages.cpp
@@ -18,10 +18,10 @@
#include "configpages.h"
#include "borderpropertieswidget.h"
#include "conductorpropertieswidget.h"
-#include "insetpropertieswidget.h"
+#include "titleblockpropertieswidget.h"
#include "qetapp.h"
#include "qetdiagrameditor.h"
-#include "borderinset.h"
+#include "bordertitleblock.h"
#include "qeticons.h"
#include "exportpropertieswidget.h"
@@ -34,7 +34,7 @@ NewDiagramPage::NewDiagramPage(QWidget *parent) : ConfigPage(parent) {
bpw = new BorderPropertiesWidget(QETDiagramEditor::defaultBorderProperties());
// proprietes par defaut d'un cartouche
- ipw = new InsetPropertiesWidget(QETDiagramEditor::defaultInsetProperties(), true);
+ ipw = new TitleBlockPropertiesWidget(QETDiagramEditor::defaultTitleBlockProperties(), true);
// proprietes par defaut des conducteurs
cpw = new ConductorPropertiesWidget(QETDiagramEditor::defaultConductorProperties());
@@ -77,7 +77,7 @@ void NewDiagramPage::applyConf() {
bpw -> borderProperties().toSettings(settings, "diagrameditor/default");
// proprietes du cartouche
- ipw-> insetProperties().toSettings(settings, "diagrameditor/default");
+ ipw-> titleBlockProperties().toSettings(settings, "diagrameditor/default");
// proprietes par defaut des conducteurs
cpw -> conductorProperties().toSettings(settings, "diagrameditor/defaultconductor");
diff --git a/sources/configpages.h b/sources/configpages.h
index 669fb7df2..edf65650a 100644
--- a/sources/configpages.h
+++ b/sources/configpages.h
@@ -20,7 +20,7 @@
#include
class BorderPropertiesWidget;
class ConductorPropertiesWidget;
-class InsetPropertiesWidget;
+class TitleBlockPropertiesWidget;
class ExportPropertiesWidget;
/**
Cette classe abstraite contient les methodes que toutes les pages de
@@ -65,7 +65,7 @@ class NewDiagramPage : public ConfigPage {
// attributs
public:
BorderPropertiesWidget *bpw; ///< Widget d'edition des dimensions du schema
- InsetPropertiesWidget *ipw; ///< Widget d'edition des proprietes par defaut du cartouche
+ TitleBlockPropertiesWidget *ipw; ///< Widget d'edition des proprietes par defaut du cartouche
ConductorPropertiesWidget *cpw; ///< Widget d'edition des proprietes par defaut des conducteurs
};
diff --git a/sources/diagram.cpp b/sources/diagram.cpp
index aba140684..006d27230 100644
--- a/sources/diagram.cpp
+++ b/sources/diagram.cpp
@@ -131,7 +131,7 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
p -> drawPoints(points);
}
- if (use_border) border_and_inset.draw(p, margin, margin);
+ if (use_border) border_and_titleblock.draw(p, margin, margin);
p -> restore();
}
@@ -190,8 +190,8 @@ bool Diagram::toPaintDevice(QPaintDevice &pix, int width, int height, Qt::Aspect
source_area = QRectF(
0.0,
0.0,
- border_and_inset.borderWidth () + 2.0 * margin,
- border_and_inset.borderHeight() + 2.0 * margin
+ border_and_titleblock.borderWidth () + 2.0 * margin,
+ border_and_titleblock.borderHeight() + 2.0 * margin
);
}
@@ -233,8 +233,8 @@ QSize Diagram::imageSize() const {
image_width = items_rect.width();
image_height = items_rect.height();
} else {
- image_width = border_and_inset.borderWidth();
- image_height = border_and_inset.borderHeight();
+ image_width = border_and_titleblock.borderWidth();
+ image_height = border_and_titleblock.borderHeight();
}
image_width += 2.0 * margin;
@@ -267,21 +267,21 @@ QDomDocument Diagram::toXml(bool whole_content) {
// proprietes du schema
if (whole_content) {
- if (!border_and_inset.author().isNull()) racine.setAttribute("author", border_and_inset.author());
- if (!border_and_inset.date().isNull()) racine.setAttribute("date", border_and_inset.date().toString("yyyyMMdd"));
- if (!border_and_inset.title().isNull()) racine.setAttribute("title", border_and_inset.title());
- if (!border_and_inset.fileName().isNull()) racine.setAttribute("filename", border_and_inset.fileName());
- if (!border_and_inset.folio().isNull()) racine.setAttribute("folio", border_and_inset.folio());
- racine.setAttribute("cols", border_and_inset.nbColumns());
- racine.setAttribute("colsize", QString("%1").arg(border_and_inset.columnsWidth()));
- racine.setAttribute("rows", border_and_inset.nbRows());
- racine.setAttribute("rowsize", QString("%1").arg(border_and_inset.rowsHeight()));
+ if (!border_and_titleblock.author().isNull()) racine.setAttribute("author", border_and_titleblock.author());
+ if (!border_and_titleblock.date().isNull()) racine.setAttribute("date", border_and_titleblock.date().toString("yyyyMMdd"));
+ if (!border_and_titleblock.title().isNull()) racine.setAttribute("title", border_and_titleblock.title());
+ if (!border_and_titleblock.fileName().isNull()) racine.setAttribute("filename", border_and_titleblock.fileName());
+ if (!border_and_titleblock.folio().isNull()) racine.setAttribute("folio", border_and_titleblock.folio());
+ racine.setAttribute("cols", border_and_titleblock.nbColumns());
+ racine.setAttribute("colsize", QString("%1").arg(border_and_titleblock.columnsWidth()));
+ racine.setAttribute("rows", border_and_titleblock.nbRows());
+ racine.setAttribute("rowsize", QString("%1").arg(border_and_titleblock.rowsHeight()));
// attribut datant de la version 0.1 - laisse pour retrocompatibilite
- racine.setAttribute("height", QString("%1").arg(border_and_inset.diagramHeight()));
- racine.setAttribute("displaycols", border_and_inset.columnsAreDisplayed() ? "true" : "false");
- racine.setAttribute("displayrows", border_and_inset.rowsAreDisplayed() ? "true" : "false");
- if (!inset_template_name_.isEmpty()) {
- racine.setAttribute("insettemplate", inset_template_name_);
+ racine.setAttribute("height", QString("%1").arg(border_and_titleblock.diagramHeight()));
+ racine.setAttribute("displaycols", border_and_titleblock.columnsAreDisplayed() ? "true" : "false");
+ racine.setAttribute("displayrows", border_and_titleblock.rowsAreDisplayed() ? "true" : "false");
+ if (!titleblock_template_name_.isEmpty()) {
+ racine.setAttribute("titleblocktemplate", titleblock_template_name_);
}
// type de conducteur par defaut
@@ -417,49 +417,49 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
// lecture des attributs de ce schema
if (consider_informations) {
- border_and_inset.setAuthor(root.attribute("author"));
- border_and_inset.setTitle(root.attribute("title"));
- border_and_inset.setDate(QDate::fromString(root.attribute("date"), "yyyyMMdd"));
- border_and_inset.setFileName(root.attribute("filename"));
- border_and_inset.setFolio(root.attribute("folio"));
- if (root.hasAttribute("insettemplate") && project_) {
- QString inset_template_name = root.attribute("insettemplate");
- const InsetTemplate *inset_template = project_ -> getTemplateByName(inset_template_name);
- if (inset_template) {
- inset_template_name_ = inset_template_name;
- border_and_inset.setInsetTemplate(inset_template);
+ border_and_titleblock.setAuthor(root.attribute("author"));
+ border_and_titleblock.setTitle(root.attribute("title"));
+ border_and_titleblock.setDate(QDate::fromString(root.attribute("date"), "yyyyMMdd"));
+ border_and_titleblock.setFileName(root.attribute("filename"));
+ border_and_titleblock.setFolio(root.attribute("folio"));
+ if (root.hasAttribute("titleblocktemplate") && project_) {
+ QString titleblock_template_name = root.attribute("titleblocktemplate");
+ const TitleBlockTemplate *titleblock_template = project_ -> getTemplateByName(titleblock_template_name);
+ if (titleblock_template) {
+ titleblock_template_name_ = titleblock_template_name;
+ border_and_titleblock.setTitleBlockTemplate(titleblock_template);
}
}
bool ok;
// nombre de colonnes
int nb_cols = root.attribute("cols").toInt(&ok);
- if (ok) border_and_inset.setNbColumns(nb_cols);
+ if (ok) border_and_titleblock.setNbColumns(nb_cols);
// taille des colonnes
double col_size = root.attribute("colsize").toDouble(&ok);
- if (ok) border_and_inset.setColumnsWidth(col_size);
+ if (ok) border_and_titleblock.setColumnsWidth(col_size);
// retrocompatibilite : les schemas enregistres avec la 0.1 ont un attribut "height"
if (root.hasAttribute("rows") && root.hasAttribute("rowsize")) {
// nombre de lignes
int nb_rows = root.attribute("rows").toInt(&ok);
- if (ok) border_and_inset.setNbRows(nb_rows);
+ if (ok) border_and_titleblock.setNbRows(nb_rows);
// taille des lignes
double row_size = root.attribute("rowsize").toDouble(&ok);
- if (ok) border_and_inset.setRowsHeight(row_size);
+ if (ok) border_and_titleblock.setRowsHeight(row_size);
} else {
// hauteur du schema
double height = root.attribute("height").toDouble(&ok);
- if (ok) border_and_inset.setDiagramHeight(height);
+ if (ok) border_and_titleblock.setDiagramHeight(height);
}
// affichage des lignes et colonnes
- border_and_inset.displayColumns(root.attribute("displaycols") != "false");
- border_and_inset.displayRows(root.attribute("displayrows") != "false");
+ border_and_titleblock.displayColumns(root.attribute("displaycols") != "false");
+ border_and_titleblock.displayRows(root.attribute("displayrows") != "false");
- border_and_inset.adjustInsetToColumns();
+ border_and_titleblock.adjustTitleBlockToColumns();
// repere le permier element "defaultconductor"
for (QDomNode node = root.firstChild() ; !node.isNull() ; node = node.nextSibling()) {
@@ -806,8 +806,8 @@ QRectF Diagram::border() const {
QRectF(
margin,
margin,
- border_and_inset.borderWidth(),
- border_and_inset.borderHeight()
+ border_and_titleblock.borderWidth(),
+ border_and_titleblock.borderHeight()
)
);
}
@@ -816,7 +816,7 @@ QRectF Diagram::border() const {
@return le titre du cartouche
*/
QString Diagram::title() const {
- return(border_and_inset.title());
+ return(border_and_titleblock.title());
}
/**
@@ -912,8 +912,8 @@ ExportProperties Diagram::applyProperties(const ExportProperties &new_properties
// exporte les options de rendu en cours
ExportProperties old_properties;
old_properties.draw_grid = displayGrid();
- old_properties.draw_border = border_and_inset.borderIsDisplayed();
- old_properties.draw_inset = border_and_inset.insetIsDisplayed();
+ old_properties.draw_border = border_and_titleblock.borderIsDisplayed();
+ old_properties.draw_titleblock = border_and_titleblock.titleBlockIsDisplayed();
old_properties.draw_terminals = drawTerminals();
old_properties.draw_colored_conductors = drawColoredConductors();
old_properties.exported_area = useBorder() ? QET::BorderArea : QET::ElementsArea;
@@ -923,8 +923,8 @@ ExportProperties Diagram::applyProperties(const ExportProperties &new_properties
setDrawTerminals (new_properties.draw_terminals);
setDrawColoredConductors (new_properties.draw_colored_conductors);
setDisplayGrid (new_properties.draw_grid);
- border_and_inset.displayBorder(new_properties.draw_border);
- border_and_inset.displayInset (new_properties.draw_inset);
+ border_and_titleblock.displayBorder(new_properties.draw_border);
+ border_and_titleblock.displayTitleBlock (new_properties.draw_titleblock);
// retourne les anciennes options de rendu
return(old_properties);
@@ -939,8 +939,8 @@ DiagramPosition Diagram::convertPosition(const QPointF &pos) {
// decale la position pour prendre en compte les marges en haut a gauche du schema
QPointF final_pos = pos - QPointF(margin, margin);
- // delegue le calcul au BorderInset
- DiagramPosition diagram_position = border_and_inset.convertPosition(final_pos);
+ // delegue le calcul au BorderTitleBlock
+ DiagramPosition diagram_position = border_and_titleblock.convertPosition(final_pos);
// embarque la position cartesienne
diagram_position.setPosition(pos);
diff --git a/sources/diagram.h b/sources/diagram.h
index dd47516a9..8a51ab044 100644
--- a/sources/diagram.h
+++ b/sources/diagram.h
@@ -19,7 +19,7 @@
#define DIAGRAM_H
#include
#include
-#include "borderinset.h"
+#include "bordertitleblock.h"
#include "conductorproperties.h"
#include "exportproperties.h"
#include "qgimanager.h"
@@ -57,14 +57,14 @@ class Diagram : public QGraphicsScene {
/**
Represente les options possibles pour l'affichage du schema :
* EmptyBorder : N'afficher que la bordure
- * Inset : Afficher le cartouche
+ * TitleBlock : Afficher le cartouche
* Columns : Afficher les colonnes
*/
- enum BorderOptions { EmptyBorder, Inset, Columns };
+ enum BorderOptions { EmptyBorder, TitleBlock, Columns };
/// Proprietes par defaut des nouveaux conducteurs
ConductorProperties defaultConductorProperties;
/// Dimensions et cartouches du schema
- BorderInset border_and_inset;
+ BorderTitleBlock border_and_titleblock;
/// taille de la grille en abscisse
static const int xGrid;
/// taille de la grille en ordonnee
@@ -85,7 +85,7 @@ class Diagram : public QGraphicsScene {
QDomDocument xml_document;
QETProject *project_;
bool read_only_;
- QString inset_template_name_;
+ QString titleblock_template_name_;
// methodes
protected:
@@ -249,9 +249,9 @@ inline bool Diagram::useBorder() {
@see BorderOptions
*/
inline void Diagram::setBorderOptions(Diagram::BorderOptions bo) {
- border_and_inset.displayBorder(!(bo & EmptyBorder));
- border_and_inset.displayColumns(bo & Columns);
- border_and_inset.displayInset(bo & Inset);
+ border_and_titleblock.displayBorder(!(bo & EmptyBorder));
+ border_and_titleblock.displayColumns(bo & Columns);
+ border_and_titleblock.displayTitleBlock(bo & TitleBlock);
}
/**
@@ -261,8 +261,8 @@ inline void Diagram::setBorderOptions(Diagram::BorderOptions bo) {
*/
inline Diagram::BorderOptions Diagram::borderOptions() {
BorderOptions retour = EmptyBorder;
- if (border_and_inset.insetIsDisplayed()) retour = (BorderOptions)(retour|Inset);
- if (border_and_inset.columnsAreDisplayed()) retour = (BorderOptions)(retour|Columns);
+ if (border_and_titleblock.titleBlockIsDisplayed()) retour = (BorderOptions)(retour|TitleBlock);
+ if (border_and_titleblock.columnsAreDisplayed()) retour = (BorderOptions)(retour|Columns);
return(retour);
}
diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp
index f5a8288d0..939b13df5 100644
--- a/sources/diagramcommands.cpp
+++ b/sources/diagramcommands.cpp
@@ -828,32 +828,32 @@ void ResetConductorCommand::redo() {
@param new_ip Nouvelles proprietes du cartouche
@param parent QUndoCommand parent
*/
-ChangeInsetCommand::ChangeInsetCommand(
+ChangeTitleBlockCommand::ChangeTitleBlockCommand(
Diagram *d,
- const InsetProperties &old_ip,
- const InsetProperties &new_ip,
+ const TitleBlockProperties &old_ip,
+ const TitleBlockProperties &new_ip,
QUndoCommand *parent
) :
QUndoCommand(QObject::tr("modifier le cartouche", "undo caption"), parent),
diagram(d),
- old_inset(old_ip),
- new_inset(new_ip)
+ old_titleblock(old_ip),
+ new_titleblock(new_ip)
{
}
/// Destructeur
-ChangeInsetCommand::~ChangeInsetCommand() {
+ChangeTitleBlockCommand::~ChangeTitleBlockCommand() {
}
/// Annule la modification de cartouche
-void ChangeInsetCommand::undo() {
- diagram -> border_and_inset.importInset(old_inset);
+void ChangeTitleBlockCommand::undo() {
+ diagram -> border_and_titleblock.importTitleBlock(old_titleblock);
diagram -> invalidate(diagram -> border());
}
/// Refait la modification de cartouche
-void ChangeInsetCommand::redo() {
- diagram -> border_and_inset.importInset(new_inset);
+void ChangeTitleBlockCommand::redo() {
+ diagram -> border_and_titleblock.importTitleBlock(new_titleblock);
diagram -> invalidate(diagram -> border());
}
@@ -878,12 +878,12 @@ ChangeBorderCommand::~ChangeBorderCommand() {
/// Annule les changements apportes au schema
void ChangeBorderCommand::undo() {
- diagram -> border_and_inset.importBorder(old_properties);
+ diagram -> border_and_titleblock.importBorder(old_properties);
}
/// Refait les changements apportes au schema
void ChangeBorderCommand::redo() {
- diagram -> border_and_inset.importBorder(new_properties);
+ diagram -> border_and_titleblock.importBorder(new_properties);
}
/**
diff --git a/sources/diagramcommands.h b/sources/diagramcommands.h
index a00b45731..68505efff 100644
--- a/sources/diagramcommands.h
+++ b/sources/diagramcommands.h
@@ -22,7 +22,7 @@
#include "conductor.h"
#include "conductorproperties.h"
#include "diagramcontent.h"
-#include "insetproperties.h"
+#include "titleblockproperties.h"
#include "qet.h"
class Diagram;
class DiagramTextItem;
@@ -419,13 +419,13 @@ class ResetConductorCommand : public QUndoCommand {
/**
Cette classe represente l'action de modifier les informations du cartouche d'un schema
*/
-class ChangeInsetCommand : public QUndoCommand {
+class ChangeTitleBlockCommand : public QUndoCommand {
// constructeurs, destructeur
public:
- ChangeInsetCommand(Diagram *, const InsetProperties &, const InsetProperties &, QUndoCommand * = 0);
- virtual ~ChangeInsetCommand();
+ ChangeTitleBlockCommand(Diagram *, const TitleBlockProperties &, const TitleBlockProperties &, QUndoCommand * = 0);
+ virtual ~ChangeTitleBlockCommand();
private:
- ChangeInsetCommand(const ChangeInsetCommand &);
+ ChangeTitleBlockCommand(const ChangeTitleBlockCommand &);
// methodes
public:
@@ -437,9 +437,9 @@ class ChangeInsetCommand : public QUndoCommand {
/// schema modifie
Diagram *diagram;
/// proprietes avant changement
- InsetProperties old_inset;
+ TitleBlockProperties old_titleblock;
/// proprietes apres changement
- InsetProperties new_inset;
+ TitleBlockProperties new_titleblock;
};
/**
diff --git a/sources/diagramcontext.h b/sources/diagramcontext.h
index 50bfc55ae..70168a8cb 100644
--- a/sources/diagramcontext.h
+++ b/sources/diagramcontext.h
@@ -22,7 +22,7 @@
#include
/**
This class represents a diagram context, i.e. the data (a list of key/value
- pairs) of a diagram at a given time. It is notably used by inset templates
+ pairs) of a diagram at a given time. It is notably used by titleblock templates
to fetch the informations they need to do their rendering.
*/
class DiagramContext {
diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp
index 0fcfcd358..709ae47fc 100644
--- a/sources/diagramview.cpp
+++ b/sources/diagramview.cpp
@@ -26,7 +26,7 @@
#include "conductortextitem.h"
#include "elementtextitem.h"
#include "independenttextitem.h"
-#include "insetpropertieswidget.h"
+#include "titleblockpropertieswidget.h"
#include "qetapp.h"
#include "qetproject.h"
#include "borderpropertieswidget.h"
@@ -67,9 +67,9 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : QGraphicsView(pare
connect(scene, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
connect(scene, SIGNAL(readOnlyChanged(bool)), this, SLOT(applyReadOnly()));
- connect(&(scene -> border_and_inset), SIGNAL(borderChanged(QRectF, QRectF)), this, SLOT(adjustSceneRect()));
- connect(&(scene -> border_and_inset), SIGNAL(displayChanged()), this, SLOT(adjustSceneRect()));
- connect(&(scene -> border_and_inset), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle()));
+ connect(&(scene -> border_and_titleblock), SIGNAL(borderChanged(QRectF, QRectF)), this, SLOT(adjustSceneRect()));
+ connect(&(scene -> border_and_titleblock), SIGNAL(displayChanged()), this, SLOT(adjustSceneRect()));
+ connect(&(scene -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle()));
connect(&(scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(updateWindowTitle()));
connect(this, SIGNAL(aboutToAddElement()), this, SLOT(addDroppedElement()), Qt::QueuedConnection);
@@ -412,8 +412,8 @@ void DiagramView::editDiagramProperties() {
bool diagram_is_read_only = scene -> isReadOnly();
// recupere le cartouche et les dimensions du schema
- InsetProperties inset = scene -> border_and_inset.exportInset();
- BorderProperties border = scene -> border_and_inset.exportBorder();
+ TitleBlockProperties titleblock = scene -> border_and_titleblock.exportTitleBlock();
+ BorderProperties border = scene -> border_and_titleblock.exportBorder();
// construit le dialogue
QDialog popup(diagramEditor());
@@ -426,8 +426,8 @@ void DiagramView::editDiagramProperties() {
BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
border_infos -> setReadOnly(diagram_is_read_only);
- InsetPropertiesWidget *inset_infos = new InsetPropertiesWidget(inset, false, &popup);
- inset_infos -> setReadOnly(diagram_is_read_only);
+ TitleBlockPropertiesWidget *titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, &popup);
+ titleblock_infos -> setReadOnly(diagram_is_read_only);
// boutons
QDialogButtonBox boutons(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
@@ -437,16 +437,16 @@ void DiagramView::editDiagramProperties() {
// ajout dans une disposition verticale
QVBoxLayout layout_v(&popup);
layout_v.addWidget(border_infos);
- layout_v.addWidget(inset_infos);
+ layout_v.addWidget(titleblock_infos);
layout_v.addStretch();
layout_v.addWidget(&boutons);
// si le dialogue est accepte
if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
- InsetProperties new_inset = inset_infos -> insetProperties();
+ TitleBlockProperties new_titleblock = titleblock_infos -> titleBlockProperties();
BorderProperties new_border = border_infos -> borderProperties();
// s'il y a des modifications au cartouche
- if (new_inset != inset) {
- scene -> undoStack().push(new ChangeInsetCommand(scene, inset, new_inset));
+ if (new_titleblock != titleblock) {
+ scene -> undoStack().push(new ChangeTitleBlockCommand(scene, titleblock, new_titleblock));
}
// s'il y a des modifications aux dimensions du schema
@@ -501,8 +501,8 @@ bool DiagramView::hasDeletableItems() {
*/
void DiagramView::addColumn() {
if (scene -> isReadOnly()) return;
- BorderProperties old_bp = scene -> border_and_inset.exportBorder();
- BorderProperties new_bp = scene -> border_and_inset.exportBorder();
+ BorderProperties old_bp = scene -> border_and_titleblock.exportBorder();
+ BorderProperties new_bp = scene -> border_and_titleblock.exportBorder();
new_bp.columns_count += 1;
scene -> undoStack().push(new ChangeBorderCommand(scene, old_bp, new_bp));
}
@@ -512,8 +512,8 @@ void DiagramView::addColumn() {
*/
void DiagramView::removeColumn() {
if (scene -> isReadOnly()) return;
- BorderProperties old_bp = scene -> border_and_inset.exportBorder();
- BorderProperties new_bp = scene -> border_and_inset.exportBorder();
+ BorderProperties old_bp = scene -> border_and_titleblock.exportBorder();
+ BorderProperties new_bp = scene -> border_and_titleblock.exportBorder();
new_bp.columns_count -= 1;
scene -> undoStack().push(new ChangeBorderCommand(scene, old_bp, new_bp));
}
@@ -523,8 +523,8 @@ void DiagramView::removeColumn() {
*/
void DiagramView::addRow() {
if (scene -> isReadOnly()) return;
- BorderProperties old_bp = scene -> border_and_inset.exportBorder();
- BorderProperties new_bp = scene -> border_and_inset.exportBorder();
+ BorderProperties old_bp = scene -> border_and_titleblock.exportBorder();
+ BorderProperties new_bp = scene -> border_and_titleblock.exportBorder();
new_bp.rows_count += 1;
scene -> undoStack().push(new ChangeBorderCommand(scene, old_bp, new_bp));
}
@@ -534,8 +534,8 @@ void DiagramView::addRow() {
*/
void DiagramView::removeRow() {
if (scene -> isReadOnly()) return;
- BorderProperties old_bp = scene -> border_and_inset.exportBorder();
- BorderProperties new_bp = scene -> border_and_inset.exportBorder();
+ BorderProperties old_bp = scene -> border_and_titleblock.exportBorder();
+ BorderProperties new_bp = scene -> border_and_titleblock.exportBorder();
new_bp.rows_count -= 1;
scene -> undoStack().push(new ChangeBorderCommand(scene, old_bp, new_bp));
}
@@ -987,14 +987,14 @@ QETDiagramEditor *DiagramView::diagramEditor() const {
Gere les double-clics sur le schema
*/
void DiagramView::mouseDoubleClickEvent(QMouseEvent *e) {
- BorderInset &bi = scene -> border_and_inset;
+ BorderTitleBlock &bi = scene -> border_and_titleblock;
// recupere le rectangle corespondant au cartouche
- QRectF inset_rect(
+ QRectF titleblock_rect(
Diagram::margin,
Diagram::margin + bi.diagramHeight(),
- bi.insetWidth(),
- bi.insetHeight()
+ bi.titleBlockWidth(),
+ bi.titleBlockHeight()
);
// recupere le rectangle correspondant aux en-tetes des colonnes
@@ -1025,7 +1025,7 @@ void DiagramView::mouseDoubleClickEvent(QMouseEvent *e) {
} else {
QGraphicsView::mouseDoubleClickEvent(e);
}
- } else if (inset_rect.contains(click_pos) || columns_rect.contains(click_pos) || rows_rect.contains(click_pos)) {
+ } else if (titleblock_rect.contains(click_pos) || columns_rect.contains(click_pos) || rows_rect.contains(click_pos)) {
// edite les proprietes du schema
editDiagramProperties();
} else {
diff --git a/sources/exportproperties.cpp b/sources/exportproperties.cpp
index cb242a0c9..c7a500692 100644
--- a/sources/exportproperties.cpp
+++ b/sources/exportproperties.cpp
@@ -31,7 +31,7 @@ ExportProperties::ExportProperties() :
format("PNG"),
draw_grid(false),
draw_border(true),
- draw_inset(true),
+ draw_titleblock(true),
draw_terminals(false),
draw_colored_conductors(true),
exported_area(QET::BorderArea)
@@ -54,7 +54,7 @@ void ExportProperties::toSettings(QSettings &settings, const QString &prefix) co
settings.setValue(prefix + "format", format);
settings.setValue(prefix + "drawgrid", draw_grid);
settings.setValue(prefix + "drawborder", draw_border);
- settings.setValue(prefix + "drawinset", draw_inset);
+ settings.setValue(prefix + "drawtitleblock", draw_titleblock);
settings.setValue(prefix + "drawterminals", draw_terminals);
settings.setValue(prefix + "drawcoloredconductors", draw_colored_conductors);
settings.setValue(prefix + "area", QET::diagramAreaToString(exported_area));
@@ -74,7 +74,7 @@ void ExportProperties::fromSettings(QSettings &settings, const QString &prefix)
draw_grid = settings.value(prefix + "drawgrid", false).toBool();
draw_border = settings.value(prefix + "drawborder", true ).toBool();
- draw_inset = settings.value(prefix + "drawinset", true ).toBool();
+ draw_titleblock = settings.value(prefix + "drawtitleblock", true ).toBool();
draw_terminals = settings.value(prefix + "drawterminals", false).toBool();
draw_colored_conductors = settings.value(prefix + "drawcoloredconductors", true ).toBool();
diff --git a/sources/exportproperties.h b/sources/exportproperties.h
index 7c919e200..1bb133a15 100644
--- a/sources/exportproperties.h
+++ b/sources/exportproperties.h
@@ -41,7 +41,7 @@ class ExportProperties {
QString format; ///< Quel format d'image faut-il utiliser ?
bool draw_grid; ///< Faut-il dessiner la grille ?
bool draw_border; ///< Faut-il dessiner le cadre ?
- bool draw_inset; ///< Faut-il dessiner le cartouche ?
+ bool draw_titleblock; ///< Faut-il dessiner le cartouche ?
bool draw_terminals; ///< Faut-il dessiner les bornes ?
bool draw_colored_conductors; ///< Faut-il respecter les couleurs des conducteurs ?
QET::DiagramArea exported_area; ///< Zone du schema a exporter
diff --git a/sources/exportpropertieswidget.cpp b/sources/exportpropertieswidget.cpp
index bae130a79..8112b6c59 100644
--- a/sources/exportpropertieswidget.cpp
+++ b/sources/exportpropertieswidget.cpp
@@ -50,7 +50,7 @@ ExportProperties ExportPropertiesWidget::exportProperties() const {
export_properties.format = format -> itemData(format -> currentIndex()).toString();
export_properties.draw_grid = draw_grid -> isChecked();
export_properties.draw_border = draw_border -> isChecked();
- export_properties.draw_inset = draw_inset -> isChecked();
+ export_properties.draw_titleblock = draw_titleblock -> isChecked();
export_properties.draw_terminals = draw_terminals -> isChecked();
export_properties.draw_colored_conductors = draw_colored_conductors -> isChecked();
export_properties.exported_area = export_border -> isChecked() ? QET::BorderArea : QET::ElementsArea;
@@ -70,7 +70,7 @@ void ExportPropertiesWidget::setExportProperties(const ExportProperties &export_
draw_grid -> setChecked(export_properties.draw_grid);
draw_border -> setChecked(export_properties.draw_border);
- draw_inset -> setChecked(export_properties.draw_inset);
+ draw_titleblock -> setChecked(export_properties.draw_titleblock);
draw_terminals -> setChecked(export_properties.draw_terminals);
draw_colored_conductors -> setChecked(export_properties.draw_colored_conductors);
@@ -169,8 +169,8 @@ void ExportPropertiesWidget::build() {
optionshlayout -> addWidget(draw_border, 1, 0);
// dessiner le cartouche
- draw_inset = new QCheckBox(tr("Dessiner le cartouche"), groupbox_options);
- optionshlayout -> addWidget(draw_inset, 2, 0);
+ draw_titleblock = new QCheckBox(tr("Dessiner le cartouche"), groupbox_options);
+ optionshlayout -> addWidget(draw_titleblock, 2, 0);
// dessiner les bornes
draw_terminals = new QCheckBox(tr("Dessiner les bornes"), groupbox_options);
@@ -190,8 +190,8 @@ void ExportPropertiesWidget::build() {
setTabOrder(format, export_border);
setTabOrder(export_border, draw_border);
setTabOrder(draw_border, draw_grid);
- setTabOrder(draw_grid, draw_inset);
- setTabOrder(draw_inset, draw_terminals);
+ setTabOrder(draw_grid, draw_titleblock);
+ setTabOrder(draw_titleblock, draw_terminals);
setTabOrder(draw_terminals, draw_colored_conductors);
// connexion du bouton permettant le choix du repertoire
@@ -202,7 +202,7 @@ void ExportPropertiesWidget::build() {
connect(exported_content_choices, SIGNAL(buttonClicked(QAbstractButton *)), this, SIGNAL(exportedAreaChanged()));
connect(draw_grid, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
connect(draw_border, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
- connect(draw_inset, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
+ connect(draw_titleblock, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
connect(draw_terminals, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
connect(draw_colored_conductors, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged()));
}
diff --git a/sources/exportpropertieswidget.h b/sources/exportpropertieswidget.h
index d1a2204a5..539165973 100644
--- a/sources/exportpropertieswidget.h
+++ b/sources/exportpropertieswidget.h
@@ -61,7 +61,7 @@ class ExportPropertiesWidget : public QWidget {
QComboBox *format;
QCheckBox *draw_grid;
QCheckBox *draw_border;
- QCheckBox *draw_inset;
+ QCheckBox *draw_titleblock;
QCheckBox *draw_terminals;
QCheckBox *draw_colored_conductors;
QRadioButton *export_border;
diff --git a/sources/hotspoteditor.cpp b/sources/hotspoteditor.cpp
index 716c492bc..4cdaa68c5 100644
--- a/sources/hotspoteditor.cpp
+++ b/sources/hotspoteditor.cpp
@@ -53,17 +53,17 @@ HotspotEditor::HotspotEditor(QWidget *parent) :
sb_hotspot_y -> setSingleStep(10);
diagram_scene = new Diagram();
- diagram_scene -> border_and_inset.setColumnsWidth(50.0);
- diagram_scene -> border_and_inset.setNbColumns(3);
- diagram_scene -> border_and_inset.setRowsHeight(60.0);
- diagram_scene -> border_and_inset.setNbRows(2);
- diagram_scene -> border_and_inset.displayRows(false);
- diagram_scene -> border_and_inset.displayInset(false);
+ diagram_scene -> border_and_titleblock.setColumnsWidth(50.0);
+ diagram_scene -> border_and_titleblock.setNbColumns(3);
+ diagram_scene -> border_and_titleblock.setRowsHeight(60.0);
+ diagram_scene -> border_and_titleblock.setNbRows(2);
+ diagram_scene -> border_and_titleblock.displayRows(false);
+ diagram_scene -> border_and_titleblock.displayTitleBlock(false);
diagram_view = new QGraphicsView(diagram_scene);
diagram_view -> setMinimumSize(
- qRound(diagram_scene -> border_and_inset.diagramWidth() + (3 * Diagram::margin)),
- qRound(diagram_scene -> border_and_inset.diagramHeight() + (3 * Diagram::margin))
+ qRound(diagram_scene -> border_and_titleblock.diagramWidth() + (3 * Diagram::margin)),
+ qRound(diagram_scene -> border_and_titleblock.diagramHeight() + (3 * Diagram::margin))
);
diagram_view -> setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
diagram_view -> setResizeAnchor(QGraphicsView::AnchorUnderMouse);
diff --git a/sources/insetpropertieswidget.cpp b/sources/insetpropertieswidget.cpp
deleted file mode 100644
index 9c5b424a0..000000000
--- a/sources/insetpropertieswidget.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- Copyright 2006-2010 Xavier Guerrin
- 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 .
-*/
-#include "insetpropertieswidget.h"
-#include "qetapp.h"
-
-/**
- Constructeur
- @param inset InsetProperties a afficher
- @param current true pour afficher l'option "Date courante"
- @param parent QWidget parent
-*/
-InsetPropertiesWidget::InsetPropertiesWidget(const InsetProperties &inset, bool current, QWidget *parent) : QWidget(parent), display_current_date(false) {
-
- QVBoxLayout *this_layout = new QVBoxLayout(this);
- this_layout -> setContentsMargins(0, 0, 0, 0);
- QGroupBox *inset_infos = new QGroupBox(tr("Informations du cartouche"), this);
- inset_infos -> setMinimumSize(300, 330);
- this_layout -> addWidget(inset_infos);
-
- inset_title = new QLineEdit(this);
- inset_author = new QLineEdit(this);
-
- QButtonGroup *date_policy_group = new QButtonGroup(this);
- inset_no_date = new QRadioButton(tr("Pas de date"), this);
- inset_current_date = new QRadioButton(tr("Date courante"), this);
- inset_fixed_date = new QRadioButton(tr("Date fixe : "), this);
- date_policy_group -> addButton(inset_no_date);
- date_policy_group -> addButton(inset_current_date);
- date_policy_group -> addButton(inset_fixed_date);
- inset_date = new QDateEdit(QDate::currentDate(), this);
- inset_date -> setEnabled(inset_fixed_date -> isChecked());
- inset_current_date -> setVisible(display_current_date);
- connect(inset_fixed_date, SIGNAL(toggled(bool)), inset_date, SLOT(setEnabled(bool)));
- inset_date -> setCalendarPopup(true);
-
- QGridLayout *layout_date = new QGridLayout();
- layout_date -> addWidget(inset_no_date, 0, 0);
- layout_date -> addWidget(inset_current_date, 1, 0);
- layout_date -> addWidget(inset_fixed_date, 2, 0);
- layout_date -> addWidget(inset_date, 2, 1);
- layout_date -> setColumnStretch(0, 1);
- layout_date -> setColumnStretch(1, 500);
-
- inset_filename = new QLineEdit(this);
- inset_folio = new QLineEdit(this);
- QLabel *folio_tip = new QLabel(
- tr(
- "Les variables suivantes sont utilisables dans le champ Folio :\n"
- " - %id : num\351ro du sch\351ma courant dans le projet\n"
- " - %total : nombre total de sch\351mas dans le projet"
- )
- );
- folio_tip -> setWordWrap(true);
-
- QGridLayout *layout_champs = new QGridLayout(inset_infos);
-
- layout_champs -> addWidget(new QLabel(tr("Titre : ")), 0, 0);
- layout_champs -> addWidget(inset_title, 0, 1);
- layout_champs -> addWidget(new QLabel(tr("Auteur : ")), 1, 0);
- layout_champs -> addWidget(inset_author, 1, 1);
- layout_champs -> addWidget(new QLabel(tr("Date : ")), 2, 0, Qt::AlignTop);
- layout_champs -> addLayout(layout_date, 2, 1);
- layout_champs -> addWidget(new QLabel(tr("Fichier : ")), 3, 0);
- layout_champs -> addWidget(inset_filename, 3, 1);
- layout_champs -> addWidget(new QLabel(tr("Folio : ")), 4, 0);
- layout_champs -> addWidget(inset_folio, 4, 1);
- layout_champs -> addWidget(folio_tip, 5, 1, Qt::AlignTop);
- layout_champs -> setRowStretch(5, 500);
-
- inset_current_date -> setVisible(display_current_date = current);
- setInsetProperties(inset);
- setLayout(this_layout);
-}
-
-/// Destructeur
-InsetPropertiesWidget::~InsetPropertiesWidget() {
-}
-
-/**
- @return Les proprietes affichees par le widget
-*/
-InsetProperties InsetPropertiesWidget::insetProperties() const {
- InsetProperties prop;
- prop.title = inset_title -> text();
- prop.author = inset_author -> text();
- prop.filename = inset_filename -> text();
- prop.folio = inset_folio -> text();
- if (inset_no_date -> isChecked()) {
- prop.useDate = InsetProperties::UseDateValue;
- prop.date = QDate();
- } else if (inset_fixed_date -> isChecked()) {
- prop.useDate = InsetProperties::UseDateValue;
- prop.date = inset_date -> date();
- } else if (display_current_date && inset_current_date -> isChecked()) {
- prop.useDate = InsetProperties::CurrentDate;
- prop.date = QDate::currentDate();
- }
- return(prop);
-}
-
-/**
- Specifie les proprietes que le widget doit afficher
- @param inset nouvelles proprietes affichees par le widget
-*/
-void InsetPropertiesWidget::setInsetProperties(const InsetProperties &inset) {
- inset_title -> setText(inset.title);
- inset_author -> setText(inset.author);
- inset_filename -> setText(inset.filename);
- inset_folio -> setText(inset.folio);
- if (display_current_date) {
- if (inset.useDate == InsetProperties::CurrentDate) {
- inset_current_date -> setChecked(true);
- } else {
- if (inset.date.isNull()) {
- inset_no_date -> setChecked(true);
- } else {
- inset_fixed_date -> setChecked(true);
- inset_date -> setDate(inset.date);
- }
- }
- } else {
- if (inset.useDate == InsetProperties::CurrentDate) {
- inset_fixed_date -> setChecked(true);
- inset_date -> setDate(QDate::currentDate());
- } else {
- if (inset.date.isNull()) {
- inset_no_date -> setChecked(true);
- } else {
- inset_fixed_date -> setChecked(true);
- inset_date -> setDate(inset.date);
- }
- }
- }
-}
-
-/**
- @return true si le widget affiche la proposition "Date courante", false sinon
-*/
-bool InsetPropertiesWidget::displayCurrentDate() const {
- return(display_current_date);
-}
-
-/**
- @return true si ce widget est en lecture seule, false sinon
-*/
-bool InsetPropertiesWidget::isReadOnly() const {
- return(inset_title -> isReadOnly());
-}
-
-/**
- @param ro true pour passer ce widget en lecture seule, false sinon
-*/
-void InsetPropertiesWidget::setReadOnly(bool ro) {
- inset_title -> setReadOnly(ro);
- inset_author -> setReadOnly(ro);
- inset_date -> setReadOnly(ro);
- inset_filename -> setReadOnly(ro);
- inset_folio -> setReadOnly(ro);
- inset_no_date -> setDisabled(ro);
- inset_current_date -> setDisabled(ro);
- inset_fixed_date -> setDisabled(ro);
-}
diff --git a/sources/insettemplaterenderer.cpp b/sources/insettemplaterenderer.cpp
deleted file mode 100644
index fdce778b2..000000000
--- a/sources/insettemplaterenderer.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "insettemplaterenderer.h"
-#include "insettemplate.h"
-
-/**
- Constructor
- @param parnet Parent QObject of this renderer
-*/
-InsetTemplateRenderer::InsetTemplateRenderer(QObject *parent) :
- QObject(parent),
- inset_template_(0),
- last_known_inset_width_(-1)
-{
-}
-
-/**
- Destructor
-*/
-InsetTemplateRenderer::~InsetTemplateRenderer() {
-}
-
-/**
- @return the inset template used for the rendering
-*/
-const InsetTemplate *InsetTemplateRenderer::insetTemplate() const {
- return(inset_template_);
-}
-
-/**
- @param inset_template Inset template to render.
-*/
-void InsetTemplateRenderer::setInsetTemplate(const InsetTemplate *inset_template) {
- if (inset_template != inset_template_) {
- inset_template_ = inset_template;
- invalidateRenderedTemplate();
- }
-}
-
-/**
- @param context Diagram Context to use when rendering the inset
-*/
-void InsetTemplateRenderer::setContext(const DiagramContext &context) {
- context_ = context;
- invalidateRenderedTemplate();
-}
-
-/**
- @return the height of the rendered template, or -1 if no template has been
- set for this renderer.
- @see InsetTemplate::height()
-*/
-int InsetTemplateRenderer::height() const {
- if (!inset_template_) return(-1);
- return(inset_template_ -> height());
-}
-
-/**
- Render the inset.
- @param provided_painter QPainter to use to render the inset.
- @param inset_width The total width of the inset to render
-*/
-void InsetTemplateRenderer::render(QPainter *provided_painter, int inset_width) {
- if (!inset_template_) return;
-
- // Do we really need to calculate all this again?
- if (inset_width != last_known_inset_width_ || rendered_template_.isNull()) {
- renderToQPicture(inset_width);
- }
-
- provided_painter -> save();
- rendered_template_.play(provided_painter);
- provided_painter -> restore();
-}
-
-/**
- Renders the inset to the internal QPicture
- @param inset_width Width of the inset to render
-*/
-void InsetTemplateRenderer::renderToQPicture(int inset_width) {
- if (!inset_template_) return;
-
- // we render the template on our internal QPicture
- QPainter painter(&rendered_template_);
-
- inset_template_ -> render(painter, context_, inset_width);
-
- // memorize the last known width
- last_known_inset_width_ = inset_width;
-}
-
-/**
- Invalidates the previous rendering of the template by resetting the internal
- QPicture.
-*/
-void InsetTemplateRenderer::invalidateRenderedTemplate() {
- rendered_template_ = QPicture();
-}
diff --git a/sources/projectview.cpp b/sources/projectview.cpp
index eaee66fb9..9f50c8566 100644
--- a/sources/projectview.cpp
+++ b/sources/projectview.cpp
@@ -26,7 +26,7 @@
#include "qetelementeditor.h"
#include "interactivemoveelementshandler.h"
#include "borderpropertieswidget.h"
-#include "insetpropertieswidget.h"
+#include "titleblockpropertieswidget.h"
#include "conductorpropertieswidget.h"
#include "qeticons.h"
#include "qetmessagebox.h"
@@ -424,7 +424,7 @@ void ProjectView::editProjectProperties() {
bpw -> setReadOnly(project_is_read_only);
// proprietes par defaut d'un cartouche
- InsetPropertiesWidget *ipw = new InsetPropertiesWidget(project_ -> defaultInsetProperties(), true);
+ TitleBlockPropertiesWidget *ipw = new TitleBlockPropertiesWidget(project_ -> defaultTitleBlockProperties(), true);
ipw -> setReadOnly(project_is_read_only);
// proprietes par defaut des conducteurs
@@ -469,7 +469,7 @@ void ProjectView::editProjectProperties() {
if (properties_dialog.exec() == QDialog::Accepted && !project_is_read_only) {
project_ -> setTitle(title_field -> text());
project_ -> setDefaultBorderProperties(bpw -> borderProperties());
- project_ -> setDefaultInsetProperties(ipw -> insetProperties());
+ project_ -> setDefaultTitleBlockProperties(ipw -> titleBlockProperties());
project_ -> setDefaultConductorProperties(cpw -> conductorProperties());
}
}
diff --git a/sources/qet.cpp b/sources/qet.cpp
index f49cc2837..9b251b46c 100644
--- a/sources/qet.cpp
+++ b/sources/qet.cpp
@@ -517,11 +517,11 @@ bool QET::compareCanonicalFilePaths(const QString &first, const QString &second)
}
/**
- @param icl an InsetColumnLength object
- @see InsetColumnLength
- @return a string describing the type of this InsetColumnLength object
+ @param icl an TitleBlockColumnLength object
+ @see TitleBlockColumnLength
+ @return a string describing the type of this TitleBlockColumnLength object
*/
-QString QET::insetColumnLengthToString(const InsetColumnLength &icl) {
+QString QET::titleBlockColumnLengthToString(const TitleBlockColumnLength &icl) {
QString type_str;
if (icl== Absolute) type_str = "absolute";
else if (icl == RelativeToTotalLength) type_str = "relative to total";
diff --git a/sources/qet.h b/sources/qet.h
index 80401a7ea..15331c9e7 100644
--- a/sources/qet.h
+++ b/sources/qet.h
@@ -98,7 +98,7 @@ namespace QET {
};
/// enum used to specify the type of a length
- enum InsetColumnLength {
+ enum TitleBlockColumnLength {
Absolute, ///< the length is absolute and should be applied as is
RelativeToTotalLength, ///< the length is just a fraction of the total available length
RelativeToRemainingLength ///< the length is just a fraction of the length that is still available when other types of lengths have been removed
@@ -132,6 +132,6 @@ namespace QET {
QString pointerString(void *);
qreal correctAngle(const qreal &);
bool compareCanonicalFilePaths(const QString &, const QString &);
- QString insetColumnLengthToString(const InsetColumnLength &);
+ QString titleBlockColumnLengthToString(const TitleBlockColumnLength &);
}
#endif
diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp
index 79bbea8c2..58039b5f6 100644
--- a/sources/qetapp.cpp
+++ b/sources/qetapp.cpp
@@ -22,7 +22,7 @@
#include "qetelementeditor.h"
#include "elementscollectionitem.h"
#include "fileelementscollection.h"
-#include "insettemplate.h"
+#include "titleblocktemplate.h"
#include "qetproject.h"
#include "qtextorientationspinboxwidget.h"
#include "recentfiles.h"
@@ -46,7 +46,7 @@ uint QETApp::next_project_id = 0;
RecentFiles *QETApp::projects_recent_files_ = 0;
RecentFiles *QETApp::elements_recent_files_ = 0;
AboutQET *QETApp::about_dialog_ = 0;
-InsetTemplate *QETApp::default_inset_template_ = 0;
+TitleBlockTemplate *QETApp::default_titleblock_template_ = 0;
/**
Constructeur
@@ -531,16 +531,16 @@ QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() {
}
/**
- @return the default inset template for diagrams
+ @return the default titleblock template for diagrams
*/
-InsetTemplate *QETApp::defaultInsetTemplate() {
- if (!QETApp::default_inset_template_) {
- InsetTemplate *inset_template = new InsetTemplate(QETApp::instance());
- if (inset_template -> loadFromXmlFile(":/insets/default.inset")) {
- QETApp::default_inset_template_ = inset_template;
+TitleBlockTemplate *QETApp::defaultTitleBlockTemplate() {
+ if (!QETApp::default_titleblock_template_) {
+ TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(QETApp::instance());
+ if (titleblock_template -> loadFromXmlFile(":/titleblocks/default.titleblock")) {
+ QETApp::default_titleblock_template_ = titleblock_template;
}
}
- return(default_inset_template_);
+ return(default_titleblock_template_);
}
diff --git a/sources/qetapp.h b/sources/qetapp.h
index dd86c53f9..577fecca9 100644
--- a/sources/qetapp.h
+++ b/sources/qetapp.h
@@ -30,7 +30,7 @@ class ElementsCollectionItem;
class FileElementsCollection;
class ElementsCategory;
class ElementDefinition;
-class InsetTemplate;
+class TitleBlockTemplate;
class QETProject;
class QTextOrientationSpinBoxWidget;
class RecentFiles;
@@ -99,7 +99,7 @@ class QETApp : public QETSingleApplication {
static QList elementEditors();
static QList elementEditors(QETProject *);
static QTextOrientationSpinBoxWidget *createTextOrientationSpinBoxWidget();
- static InsetTemplate *defaultInsetTemplate();
+ static TitleBlockTemplate *defaultTitleBlockTemplate();
protected:
#ifdef Q_OS_DARWIN
@@ -142,7 +142,7 @@ class QETApp : public QETSingleApplication {
static RecentFiles *projects_recent_files_;
static RecentFiles *elements_recent_files_;
static AboutQET *about_dialog_;
- static InsetTemplate *default_inset_template_;
+ static TitleBlockTemplate *default_titleblock_template_;
public slots:
void systray(QSystemTrayIcon::ActivationReason);
diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp
index aafa7606f..cf026dd00 100644
--- a/sources/qetdiagrameditor.cpp
+++ b/sources/qetdiagrameditor.cpp
@@ -660,7 +660,7 @@ bool QETDiagramEditor::newProject() {
// transmet les proprietes par defaut des nouveaux schemas
new_project -> setDefaultBorderProperties(defaultBorderProperties());
new_project -> setDefaultConductorProperties(defaultConductorProperties());
- new_project -> setDefaultInsetProperties(defaultInsetProperties());
+ new_project -> setDefaultTitleBlockProperties(defaultTitleBlockProperties());
// ajoute un schema au projet
new_project -> addNewDiagram();
@@ -1780,11 +1780,11 @@ void QETDiagramEditor::editElementInEditor(const ElementsLocation &location) {
/**
@return Les proprietes par defaut pour le cartouche d'un schema
*/
-InsetProperties QETDiagramEditor::defaultInsetProperties() {
+TitleBlockProperties QETDiagramEditor::defaultTitleBlockProperties() {
// accede a la configuration de l'application
QSettings &settings = QETApp::settings();
- InsetProperties def;
+ TitleBlockProperties def;
// lit le cartouche par defaut dans la configuration
def.fromSettings(settings, "diagrameditor/default");
diff --git a/sources/qetdiagrameditor.h b/sources/qetdiagrameditor.h
index 954752db4..d9aa22802 100644
--- a/sources/qetdiagrameditor.h
+++ b/sources/qetdiagrameditor.h
@@ -20,7 +20,7 @@
#include
#include "borderproperties.h"
#include "conductorproperties.h"
-#include "insetproperties.h"
+#include "titleblockproperties.h"
#include "exportproperties.h"
class QETProject;
class ProjectView;
@@ -56,7 +56,7 @@ class QETDiagramEditor : public QMainWindow {
QList projectViews() const;
QList editedFiles() const;
ProjectView *viewForFile(const QString &) const;
- static InsetProperties defaultInsetProperties();
+ static TitleBlockProperties defaultTitleBlockProperties();
static BorderProperties defaultBorderProperties();
static ConductorProperties defaultConductorProperties();
static ExportProperties defaultExportProperties();
diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp
index a76a20121..ae5cbf9a9 100644
--- a/sources/qetproject.cpp
+++ b/sources/qetproject.cpp
@@ -25,7 +25,7 @@
#include "integrationmoveelementshandler.h"
#include "basicmoveelementshandler.h"
#include "qetmessagebox.h"
-#include "insettemplate.h"
+#include "titleblocktemplate.h"
QString QETProject::integration_category_name = "import";
@@ -268,10 +268,10 @@ void QETProject::setTitle(const QString &title) {
}
/**
- @return the list of the inset templates embedded within this project
+ @return the list of the titleblock templates embedded within this project
*/
-QList QETProject::embeddedInsetTemplates() const {
- return(inset_templates_xml_.keys());
+QList QETProject::embeddedTitleBlockTemplates() const {
+ return(titleblock_templates_xml_.keys());
}
/**
@@ -279,22 +279,22 @@ QList QETProject::embeddedInsetTemplates() const {
@return the requested template, or 0 if there is no vltaid template of this
name within the project
*/
-const InsetTemplate *QETProject::getTemplateByName(const QString &template_name) {
+const TitleBlockTemplate *QETProject::getTemplateByName(const QString &template_name) {
// Do we have already loaded this template?
- if (inset_templates_.contains(template_name)) {
- return(inset_templates_[template_name]);
+ if (titleblock_templates_.contains(template_name)) {
+ return(titleblock_templates_[template_name]);
}
// No? Do we even know of it?
- if (!inset_templates_xml_.contains(template_name)) {
+ if (!titleblock_templates_xml_.contains(template_name)) {
return(0);
}
- // Ok, we have its XML description, we have to generate an InsetTemplate object
- InsetTemplate *inset_template = new InsetTemplate(this);
- if (inset_template -> loadFromXmlElement(inset_templates_xml_[template_name])) {
- inset_templates_.insert(template_name, inset_template);
- return(inset_template);
+ // Ok, we have its XML description, we have to generate an TitleBlockTemplate object
+ TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(this);
+ if (titleblock_template -> loadFromXmlElement(titleblock_templates_xml_[template_name])) {
+ titleblock_templates_.insert(template_name, titleblock_template);
+ return(titleblock_template);
} else {
return(0);
}
@@ -303,11 +303,11 @@ const InsetTemplate *QETProject::getTemplateByName(const QString &template_name)
/**
@param template_name Name of the requested template
@return the XML description of the requested template, or a null QDomElement
- if the project does not have such an inset template
+ if the project does not have such an titleblock template
*/
QDomElement QETProject::getTemplateXmlDescriptionByName(const QString &template_name) {
- if (inset_templates_xml_.contains(template_name)) {
- return(inset_templates_xml_[template_name]);
+ if (titleblock_templates_xml_.contains(template_name)) {
+ return(titleblock_templates_xml_[template_name]);
}
return(QDomElement());
}
@@ -333,17 +333,17 @@ void QETProject::setDefaultBorderProperties(const BorderProperties &border) {
@return le cartouche par defaut utilise lors de la creation d'un
nouveau schema dans ce projet.
*/
-InsetProperties QETProject::defaultInsetProperties() const {
- return(default_inset_properties_);
+TitleBlockProperties QETProject::defaultTitleBlockProperties() const {
+ return(default_titleblock_properties_);
}
/**
Permet de specifier le cartouche par defaut utilise lors de la creation
d'un nouveau schema dans ce projet.
- @param inset Cartouche d'un schema
+ @param titleblock Cartouche d'un schema
*/
-void QETProject::setDefaultInsetProperties(const InsetProperties &inset) {
- default_inset_properties_ = inset;
+void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titleblock) {
+ default_titleblock_properties_ = titleblock;
}
/**
@@ -373,14 +373,14 @@ QDomDocument QETProject::toXml() {
project_root.setAttribute("title", project_title_);
xml_doc.appendChild(project_root);
- // inset templates, if any
- if (inset_templates_xml_.count()) {
- qDebug() << qPrintable(QString("QETProject::toXml() : exporting %1 inset templates").arg(inset_templates_xml_.count()));
- QDomElement insettemplates_elmt = xml_doc.createElement("insettemplates");
- foreach (QDomElement e, inset_templates_xml_) {
- insettemplates_elmt.appendChild(e);
+ // titleblock templates, if any
+ if (titleblock_templates_xml_.count()) {
+ qDebug() << qPrintable(QString("QETProject::toXml() : exporting %1 titleblock templates").arg(titleblock_templates_xml_.count()));
+ QDomElement titleblocktemplates_elmt = xml_doc.createElement("titleblocktemplates");
+ foreach (QDomElement e, titleblock_templates_xml_) {
+ titleblocktemplates_elmt.appendChild(e);
}
- project_root.appendChild(insettemplates_elmt);
+ project_root.appendChild(titleblocktemplates_elmt);
}
// proprietes pour les nouveaux schemas
@@ -696,8 +696,8 @@ Diagram *QETProject::addNewDiagram() {
Diagram *diagram = new Diagram();
// lui transmet les parametres par defaut
- diagram -> border_and_inset.importBorder(defaultBorderProperties());
- diagram -> border_and_inset.importInset(defaultInsetProperties());
+ diagram -> border_and_titleblock.importBorder(defaultBorderProperties());
+ diagram -> border_and_titleblock.importTitleBlock(defaultTitleBlockProperties());
diagram -> defaultConductorProperties = defaultConductorProperties();
addDiagram(diagram);
@@ -790,7 +790,7 @@ void QETProject::readProjectXml() {
// charge les proprietes par defaut pour les nouveaux schemas
readDefaultPropertiesXml();
- // load the embedded inset templates
+ // load the embedded titleblock templates
readEmbeddedTemplatesXml();
// charge la collection embarquee
@@ -839,17 +839,17 @@ void QETProject::readDiagramsXml() {
Loads the embedded template from the XML description of the project
*/
void QETProject::readEmbeddedTemplatesXml() {
- foreach (QDomElement e, QET::findInDomElement(document_root_.documentElement(), "insettemplates", "insettemplate")) {
- // each inset template must have a name
+ foreach (QDomElement e, QET::findInDomElement(document_root_.documentElement(), "titleblocktemplates", "titleblocktemplate")) {
+ // each titleblock template must have a name
if (!e.hasAttribute("name")) continue;
- QString inset_template_name = e.attribute("name");
+ QString titleblock_template_name = e.attribute("name");
// if several templates have the same name, we keep the first one encountered
- if (inset_templates_xml_.contains(inset_template_name)) continue;
+ if (titleblock_templates_xml_.contains(titleblock_template_name)) continue;
- // we simply store the XML element describing the inset template,
+ // we simply store the XML element describing the titleblock template,
// without any further analysis for the moment
- inset_templates_xml_.insert(inset_template_name, e);
+ titleblock_templates_xml_.insert(titleblock_template_name, e);
}
}
@@ -893,11 +893,11 @@ void QETProject::readDefaultPropertiesXml() {
// par defaut, les valeurs sont celles de la configuration QElectroTech
default_border_properties_ = QETDiagramEditor::defaultBorderProperties();
- default_inset_properties_ = QETDiagramEditor::defaultInsetProperties();
+ default_titleblock_properties_ = QETDiagramEditor::defaultTitleBlockProperties();
default_conductor_properties_ = QETDiagramEditor::defaultConductorProperties();
// lecture des valeurs indiquees dans le projet
- QDomElement border_elmt, inset_elmt, conductors_elmt;
+ QDomElement border_elmt, titleblock_elmt, conductors_elmt;
// recherche des elements XML concernant les dimensions, le cartouche et les conducteurs
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling()) {
@@ -906,7 +906,7 @@ void QETProject::readDefaultPropertiesXml() {
if (child_elmt.tagName() == "border") {
border_elmt = child_elmt;
} else if (child_elmt.tagName() == "inset") {
- inset_elmt = child_elmt;
+ titleblock_elmt = child_elmt;
} else if (child_elmt.tagName() == "conductors") {
conductors_elmt = child_elmt;
}
@@ -914,7 +914,7 @@ void QETProject::readDefaultPropertiesXml() {
// dimensions, cartouche, et conducteurs
if (!border_elmt.isNull()) default_border_properties_.fromXml(border_elmt);
- if (!inset_elmt.isNull()) default_inset_properties_.fromXml(inset_elmt);
+ if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt);
if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt);
}
@@ -935,9 +935,9 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
xml_element.appendChild(border_elmt);
// exporte le contenu du cartouche
- QDomElement inset_elmt = xml_document.createElement("inset");
- default_inset_properties_.toXml(inset_elmt);
- xml_element.appendChild(inset_elmt);
+ QDomElement titleblock_elmt = xml_document.createElement("inset");
+ default_titleblock_properties_.toXml(titleblock_elmt);
+ xml_element.appendChild(titleblock_elmt);
// exporte le type de conducteur par defaut
QDomElement conductor_elmt = xml_document.createElement("conductors");
@@ -958,7 +958,7 @@ void QETProject::addDiagram(Diagram *diagram) {
// si le schema est ecrit, alors il faut reecrire le fichier projet
connect(diagram, SIGNAL(written()), this, SLOT(componentWritten()));
connect(
- &(diagram -> border_and_inset),
+ &(diagram -> border_and_titleblock),
SIGNAL(needFolioData()),
this,
SLOT(updateDiagramsFolioData())
@@ -1059,7 +1059,7 @@ bool QETProject::projectWasModified() {
void QETProject::updateDiagramsFolioData() {
int total_folio = diagrams_.count();
for (int i = 0 ; i < total_folio ; ++ i) {
- diagrams_[i] -> border_and_inset.setFolioData(i + 1, total_folio);
+ diagrams_[i] -> border_and_titleblock.setFolioData(i + 1, total_folio);
}
}
diff --git a/sources/qetproject.h b/sources/qetproject.h
index 26a9f3649..148bb9ecd 100644
--- a/sources/qetproject.h
+++ b/sources/qetproject.h
@@ -23,13 +23,13 @@
#include "elementslocation.h"
#include "borderproperties.h"
#include "conductorproperties.h"
-#include "insetproperties.h"
+#include "titleblockproperties.h"
class Diagram;
class ElementsCollection;
class ElementsCategory;
class ElementDefinition;
class ElementsLocation;
-class InsetTemplate;
+class TitleBlockTemplate;
class XmlElementsCollection;
class MoveElementsHandler;
/**
@@ -80,13 +80,13 @@ class QETProject : public QObject {
QString title() const;
qreal declaredQElectroTechVersion();
void setTitle(const QString &);
- QList embeddedInsetTemplates() const;
- const InsetTemplate *getTemplateByName(const QString &template_name);
+ QList embeddedTitleBlockTemplates() const;
+ const TitleBlockTemplate *getTemplateByName(const QString &template_name);
QDomElement getTemplateXmlDescriptionByName(const QString &);
BorderProperties defaultBorderProperties() const;
void setDefaultBorderProperties(const BorderProperties &);
- InsetProperties defaultInsetProperties() const;
- void setDefaultInsetProperties(const InsetProperties &);
+ TitleBlockProperties defaultTitleBlockProperties() const;
+ void setDefaultTitleBlockProperties(const TitleBlockProperties &);
ConductorProperties defaultConductorProperties() const;
void setDefaultConductorProperties(const ConductorProperties &);
QDomDocument toXml();
@@ -162,10 +162,10 @@ class QETProject : public QObject {
/// Proprietes par defaut des conducteurs pour les nouveaux schemas dans ce projet
ConductorProperties default_conductor_properties_;
/// Proprietes par defaut du cartouche pour les nouveaux schemas dans ce projet
- InsetProperties default_inset_properties_;
- /// XML descriptions of embedded inset templates
- QHash inset_templates_xml_;
- /// Already parsed embedded inset templates
- QHash inset_templates_;
+ TitleBlockProperties default_titleblock_properties_;
+ /// XML descriptions of embedded titleblock templates
+ QHash titleblock_templates_xml_;
+ /// Already parsed embedded titleblock templates
+ QHash titleblock_templates_;
};
#endif
diff --git a/sources/insetcell.h b/sources/titleblockcell.h
similarity index 80%
rename from sources/insetcell.h
rename to sources/titleblockcell.h
index 4027cfdec..ffd2fd18b 100644
--- a/sources/insetcell.h
+++ b/sources/titleblockcell.h
@@ -15,22 +15,22 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
-#ifndef INSET_CELL_H
-#define INSET_CELL_H
+#ifndef TITLEBLOCK_CELL_H
+#define TITLEBLOCK_CELL_H
/**
- This class is a container for the various parameters of an inset cell
- @see InsetColumnLength
+ This class is a container for the various parameters of an titleblock cell
+ @see TitleBlockColumnLength
*/
-class InsetCell {
+class TitleBlockCell {
public:
- InsetCell();
+ TitleBlockCell();
QString toString() const;
bool is_null;
int num_row;
int num_col;
int row_span;
int col_span;
- InsetCell *spanner_cell;
+ TitleBlockCell *spanner_cell;
QString value_name;
QString value;
QString label;
diff --git a/sources/insetproperties.cpp b/sources/titleblockproperties.cpp
similarity index 81%
rename from sources/insetproperties.cpp
rename to sources/titleblockproperties.cpp
index 18766387a..e219c5d97 100644
--- a/sources/insetproperties.cpp
+++ b/sources/titleblockproperties.cpp
@@ -15,13 +15,13 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
-#include "insetproperties.h"
+#include "titleblockproperties.h"
/**
- Constructeur. Initialise un objet InsetProperties avec tous les champs
+ Constructeur. Initialise un objet TitleBlockProperties avec tous les champs
vides (date vide + useDate a UseDateValue).
*/
-InsetProperties::InsetProperties() :
+TitleBlockProperties::TitleBlockProperties() :
date(),
useDate(UseDateValue)
{
@@ -30,14 +30,14 @@ InsetProperties::InsetProperties() :
/**
Destructeur
*/
-InsetProperties::~InsetProperties() {
+TitleBlockProperties::~TitleBlockProperties() {
}
/**
- @param ip autre conteneur InsetProperties
+ @param ip autre conteneur TitleBlockProperties
@return true si ip et ce conteneur sont identiques, false sinon
*/
-bool InsetProperties::operator==(const InsetProperties &ip) {
+bool TitleBlockProperties::operator==(const TitleBlockProperties &ip) {
return(
ip.title == title &&\
ip.author == author &&\
@@ -48,10 +48,10 @@ bool InsetProperties::operator==(const InsetProperties &ip) {
}
/**
- @param ip autre conteneur InsetProperties
+ @param ip autre conteneur TitleBlockProperties
@return false si ip et ce conteneur sont identiques, true sinon
*/
-bool InsetProperties::operator!=(const InsetProperties &ip) {
+bool TitleBlockProperties::operator!=(const TitleBlockProperties &ip) {
return(!(*this == ip));
}
@@ -60,7 +60,7 @@ bool InsetProperties::operator!=(const InsetProperties &ip) {
Exporte le cartouche sous formes d'attributs XML ajoutes a l'element e.
@param e Element XML auquel seront ajoutes des attributs
*/
-void InsetProperties::toXml(QDomElement &e) const {
+void TitleBlockProperties::toXml(QDomElement &e) const {
e.setAttribute("author", author);
e.setAttribute("title", title);
e.setAttribute("filename", filename);
@@ -72,7 +72,7 @@ void InsetProperties::toXml(QDomElement &e) const {
Importe le cartouche a partir des attributs XML de l'element e
@param e Element XML dont les attributs seront lus
*/
-void InsetProperties::fromXml(QDomElement &e) {
+void TitleBlockProperties::fromXml(QDomElement &e) {
if (e.hasAttribute("author")) author = e.attribute("author");
if (e.hasAttribute("title")) title = e.attribute("title");
if (e.hasAttribute("filename")) filename = e.attribute("filename");
@@ -85,7 +85,7 @@ void InsetProperties::fromXml(QDomElement &e) {
@param settings Parametres a ecrire
@param prefix prefixe a ajouter devant les noms des parametres
*/
-void InsetProperties::toSettings(QSettings &settings, const QString &prefix) const {
+void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix) const {
settings.setValue(prefix + "title", title);
settings.setValue(prefix + "author", author);
settings.setValue(prefix + "filename", filename);
@@ -98,7 +98,7 @@ void InsetProperties::toSettings(QSettings &settings, const QString &prefix) con
@param settings Parametres a lire
@param prefix prefixe a ajouter devant les noms des parametres
*/
-void InsetProperties::fromSettings(QSettings &settings, const QString &prefix) {
+void TitleBlockProperties::fromSettings(QSettings &settings, const QString &prefix) {
title = settings.value(prefix + "title").toString();
author = settings.value(prefix + "author").toString();
filename = settings.value(prefix + "filename").toString();
@@ -109,7 +109,7 @@ void InsetProperties::fromSettings(QSettings &settings, const QString &prefix) {
/**
@return La date a utiliser
*/
-QDate InsetProperties::finalDate() const {
+QDate TitleBlockProperties::finalDate() const {
if (useDate == UseDateValue) {
return(date);
} else {
@@ -124,7 +124,7 @@ QDate InsetProperties::finalDate() const {
* now pour afficher la date courante (a la creation du schema)
* une date au format yyyyMMdd pour utiliser une date fixe
*/
-QString InsetProperties::exportDate() const {
+QString TitleBlockProperties::exportDate() const {
QString date_setting_value;
if (useDate == UseDateValue) {
if (date.isNull()) date_setting_value = "null";
@@ -140,7 +140,7 @@ QString InsetProperties::exportDate() const {
@param date_string Chaine de caracteres a analyser
@see exportDate
*/
-void InsetProperties::setDateFromString(const QString &date_string) {
+void TitleBlockProperties::setDateFromString(const QString &date_string) {
if (date_string == "now") {
date = QDate::currentDate();
useDate = CurrentDate;
diff --git a/sources/insetproperties.h b/sources/titleblockproperties.h
similarity index 87%
rename from sources/insetproperties.h
rename to sources/titleblockproperties.h
index ff690ed38..4a8194189 100644
--- a/sources/insetproperties.h
+++ b/sources/titleblockproperties.h
@@ -15,26 +15,26 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
-#ifndef INSET_PROPERTIES_H
-#define INSET_PROPERTIES_H
+#ifndef TITLEBLOCK_PROPERTIES_H
+#define TITLEBLOCK_PROPERTIES_H
#include
#include
/**
Cette classe est un conteneur pour les proprietes d'un cartouche de schema
: titre, auteur, date, nom de fichier et folio
*/
-class InsetProperties {
+class TitleBlockProperties {
public:
- InsetProperties();
- virtual ~InsetProperties();
+ TitleBlockProperties();
+ virtual ~TitleBlockProperties();
/// Specifie comment gerer la date
enum DateManagement {
UseDateValue, ///< utilise l'attribut date
CurrentDate ///< utilise la date courante
};
- bool operator==(const InsetProperties &);
- bool operator!=(const InsetProperties &);
+ bool operator==(const TitleBlockProperties &);
+ bool operator!=(const TitleBlockProperties &);
void toXml(QDomElement &) const;
void fromXml(QDomElement &);
diff --git a/sources/titleblockpropertieswidget.cpp b/sources/titleblockpropertieswidget.cpp
new file mode 100644
index 000000000..b30133861
--- /dev/null
+++ b/sources/titleblockpropertieswidget.cpp
@@ -0,0 +1,177 @@
+/*
+ Copyright 2006-2010 Xavier Guerrin
+ 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 .
+*/
+#include "titleblockpropertieswidget.h"
+#include "qetapp.h"
+
+/**
+ Constructeur
+ @param titleblock TitleBlockProperties a afficher
+ @param current true pour afficher l'option "Date courante"
+ @param parent QWidget parent
+*/
+TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current, QWidget *parent) : QWidget(parent), display_current_date(false) {
+
+ QVBoxLayout *this_layout = new QVBoxLayout(this);
+ this_layout -> setContentsMargins(0, 0, 0, 0);
+ QGroupBox *titleblock_infos = new QGroupBox(tr("Informations du cartouche"), this);
+ titleblock_infos -> setMinimumSize(300, 330);
+ this_layout -> addWidget(titleblock_infos);
+
+ titleblock_title = new QLineEdit(this);
+ titleblock_author = new QLineEdit(this);
+
+ QButtonGroup *date_policy_group = new QButtonGroup(this);
+ titleblock_no_date = new QRadioButton(tr("Pas de date"), this);
+ titleblock_current_date = new QRadioButton(tr("Date courante"), this);
+ titleblock_fixed_date = new QRadioButton(tr("Date fixe : "), this);
+ date_policy_group -> addButton(titleblock_no_date);
+ date_policy_group -> addButton(titleblock_current_date);
+ date_policy_group -> addButton(titleblock_fixed_date);
+ titleblock_date = new QDateEdit(QDate::currentDate(), this);
+ titleblock_date -> setEnabled(titleblock_fixed_date -> isChecked());
+ titleblock_current_date -> setVisible(display_current_date);
+ connect(titleblock_fixed_date, SIGNAL(toggled(bool)), titleblock_date, SLOT(setEnabled(bool)));
+ titleblock_date -> setCalendarPopup(true);
+
+ QGridLayout *layout_date = new QGridLayout();
+ layout_date -> addWidget(titleblock_no_date, 0, 0);
+ layout_date -> addWidget(titleblock_current_date, 1, 0);
+ layout_date -> addWidget(titleblock_fixed_date, 2, 0);
+ layout_date -> addWidget(titleblock_date, 2, 1);
+ layout_date -> setColumnStretch(0, 1);
+ layout_date -> setColumnStretch(1, 500);
+
+ titleblock_filename = new QLineEdit(this);
+ titleblock_folio = new QLineEdit(this);
+ QLabel *folio_tip = new QLabel(
+ tr(
+ "Les variables suivantes sont utilisables dans le champ Folio :\n"
+ " - %id : num\351ro du sch\351ma courant dans le projet\n"
+ " - %total : nombre total de sch\351mas dans le projet"
+ )
+ );
+ folio_tip -> setWordWrap(true);
+
+ QGridLayout *layout_champs = new QGridLayout(titleblock_infos);
+
+ layout_champs -> addWidget(new QLabel(tr("Titre : ")), 0, 0);
+ layout_champs -> addWidget(titleblock_title, 0, 1);
+ layout_champs -> addWidget(new QLabel(tr("Auteur : ")), 1, 0);
+ layout_champs -> addWidget(titleblock_author, 1, 1);
+ layout_champs -> addWidget(new QLabel(tr("Date : ")), 2, 0, Qt::AlignTop);
+ layout_champs -> addLayout(layout_date, 2, 1);
+ layout_champs -> addWidget(new QLabel(tr("Fichier : ")), 3, 0);
+ layout_champs -> addWidget(titleblock_filename, 3, 1);
+ layout_champs -> addWidget(new QLabel(tr("Folio : ")), 4, 0);
+ layout_champs -> addWidget(titleblock_folio, 4, 1);
+ layout_champs -> addWidget(folio_tip, 5, 1, Qt::AlignTop);
+ layout_champs -> setRowStretch(5, 500);
+
+ titleblock_current_date -> setVisible(display_current_date = current);
+ setTitleBlockProperties(titleblock);
+ setLayout(this_layout);
+}
+
+/// Destructeur
+TitleBlockPropertiesWidget::~TitleBlockPropertiesWidget() {
+}
+
+/**
+ @return Les proprietes affichees par le widget
+*/
+TitleBlockProperties TitleBlockPropertiesWidget::titleBlockProperties() const {
+ TitleBlockProperties prop;
+ prop.title = titleblock_title -> text();
+ prop.author = titleblock_author -> text();
+ prop.filename = titleblock_filename -> text();
+ prop.folio = titleblock_folio -> text();
+ if (titleblock_no_date -> isChecked()) {
+ prop.useDate = TitleBlockProperties::UseDateValue;
+ prop.date = QDate();
+ } else if (titleblock_fixed_date -> isChecked()) {
+ prop.useDate = TitleBlockProperties::UseDateValue;
+ prop.date = titleblock_date -> date();
+ } else if (display_current_date && titleblock_current_date -> isChecked()) {
+ prop.useDate = TitleBlockProperties::CurrentDate;
+ prop.date = QDate::currentDate();
+ }
+ return(prop);
+}
+
+/**
+ Specifie les proprietes que le widget doit afficher
+ @param titleblock nouvelles proprietes affichees par le widget
+*/
+void TitleBlockPropertiesWidget::setTitleBlockProperties(const TitleBlockProperties &titleblock) {
+ titleblock_title -> setText(titleblock.title);
+ titleblock_author -> setText(titleblock.author);
+ titleblock_filename -> setText(titleblock.filename);
+ titleblock_folio -> setText(titleblock.folio);
+ if (display_current_date) {
+ if (titleblock.useDate == TitleBlockProperties::CurrentDate) {
+ titleblock_current_date -> setChecked(true);
+ } else {
+ if (titleblock.date.isNull()) {
+ titleblock_no_date -> setChecked(true);
+ } else {
+ titleblock_fixed_date -> setChecked(true);
+ titleblock_date -> setDate(titleblock.date);
+ }
+ }
+ } else {
+ if (titleblock.useDate == TitleBlockProperties::CurrentDate) {
+ titleblock_fixed_date -> setChecked(true);
+ titleblock_date -> setDate(QDate::currentDate());
+ } else {
+ if (titleblock.date.isNull()) {
+ titleblock_no_date -> setChecked(true);
+ } else {
+ titleblock_fixed_date -> setChecked(true);
+ titleblock_date -> setDate(titleblock.date);
+ }
+ }
+ }
+}
+
+/**
+ @return true si le widget affiche la proposition "Date courante", false sinon
+*/
+bool TitleBlockPropertiesWidget::displayCurrentDate() const {
+ return(display_current_date);
+}
+
+/**
+ @return true si ce widget est en lecture seule, false sinon
+*/
+bool TitleBlockPropertiesWidget::isReadOnly() const {
+ return(titleblock_title -> isReadOnly());
+}
+
+/**
+ @param ro true pour passer ce widget en lecture seule, false sinon
+*/
+void TitleBlockPropertiesWidget::setReadOnly(bool ro) {
+ titleblock_title -> setReadOnly(ro);
+ titleblock_author -> setReadOnly(ro);
+ titleblock_date -> setReadOnly(ro);
+ titleblock_filename -> setReadOnly(ro);
+ titleblock_folio -> setReadOnly(ro);
+ titleblock_no_date -> setDisabled(ro);
+ titleblock_current_date -> setDisabled(ro);
+ titleblock_fixed_date -> setDisabled(ro);
+}
diff --git a/sources/insetpropertieswidget.h b/sources/titleblockpropertieswidget.h
similarity index 53%
rename from sources/insetpropertieswidget.h
rename to sources/titleblockpropertieswidget.h
index e68aaaaec..4095a7a07 100644
--- a/sources/insetpropertieswidget.h
+++ b/sources/titleblockpropertieswidget.h
@@ -15,41 +15,41 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
-#ifndef INSET_PROPERTIES_WIDGET_H
-#define INSET_PROPERTIES_WIDGET_H
+#ifndef TITLEBLOCK_PROPERTIES_WIDGET_H
+#define TITLEBLOCK_PROPERTIES_WIDGET_H
#include
-#include "insetproperties.h"
+#include "titleblockproperties.h"
/**
- Ce widget permet d'editer un objet InsetProperties, c'est-a-dire les
+ Ce widget permet d'editer un objet TitleBlockProperties, c'est-a-dire les
valeurs affichees par le cartouche d'un schema.
*/
-class InsetPropertiesWidget : public QWidget {
+class TitleBlockPropertiesWidget : public QWidget {
Q_OBJECT
// constructeurs, destructeur
public:
- InsetPropertiesWidget(const InsetProperties &inset = InsetProperties(), bool = false, QWidget * = 0);
- virtual ~InsetPropertiesWidget();
+ TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock = TitleBlockProperties(), bool = false, QWidget * = 0);
+ virtual ~TitleBlockPropertiesWidget();
private:
- InsetPropertiesWidget(const InsetPropertiesWidget &);
+ TitleBlockPropertiesWidget(const TitleBlockPropertiesWidget &);
// methodes
public:
- InsetProperties insetProperties() const;
- void setInsetProperties(const InsetProperties &);
+ TitleBlockProperties titleBlockProperties() const;
+ void setTitleBlockProperties(const TitleBlockProperties &);
bool displayCurrentDate() const;
bool isReadOnly() const;
void setReadOnly(bool);
// attributs
private:
- QLineEdit *inset_title;
- QLineEdit *inset_author;
- QDateEdit *inset_date;
- QLineEdit *inset_filename;
- QLineEdit *inset_folio;
- QRadioButton *inset_no_date;
- QRadioButton *inset_current_date;
- QRadioButton *inset_fixed_date;
+ QLineEdit *titleblock_title;
+ QLineEdit *titleblock_author;
+ QDateEdit *titleblock_date;
+ QLineEdit *titleblock_filename;
+ QLineEdit *titleblock_folio;
+ QRadioButton *titleblock_no_date;
+ QRadioButton *titleblock_current_date;
+ QRadioButton *titleblock_fixed_date;
bool display_current_date;
};
#endif
diff --git a/sources/insettemplate.cpp b/sources/titleblocktemplate.cpp
similarity index 79%
rename from sources/insettemplate.cpp
rename to sources/titleblocktemplate.cpp
index 745370c87..74bdf1d4a 100644
--- a/sources/insettemplate.cpp
+++ b/sources/titleblocktemplate.cpp
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
-#include "insettemplate.h"
+#include "titleblocktemplate.h"
#include "qet.h"
#include "qetapp.h"
@@ -23,7 +23,7 @@
Constructor
@param parent parent QObject
*/
-InsetTemplate::InsetTemplate(QObject *parent) :
+TitleBlockTemplate::TitleBlockTemplate(QObject *parent) :
QObject(parent)
{
}
@@ -31,7 +31,7 @@ InsetTemplate::InsetTemplate(QObject *parent) :
/**
Destructor
*/
-InsetTemplate::~InsetTemplate() {
+TitleBlockTemplate::~TitleBlockTemplate() {
loadLogos(QDomElement(), true);
}
@@ -39,7 +39,7 @@ InsetTemplate::~InsetTemplate() {
@param filepath A file path to read the template from.
@return true if the reading succeeds, false otherwise.
*/
-bool InsetTemplate::loadFromXmlFile(const QString &filepath) {
+bool TitleBlockTemplate::loadFromXmlFile(const QString &filepath) {
// opens the file
QFile template_file(filepath);
if (!template_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
@@ -51,7 +51,7 @@ bool InsetTemplate::loadFromXmlFile(const QString &filepath) {
if (!xml_parsing) {
return(false);
}
-#ifdef INSET_TEMPLATE_DEBUG
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << filepath << "opened";
#endif
return(loadFromXmlElement(xml_description_.documentElement()));
@@ -61,9 +61,9 @@ bool InsetTemplate::loadFromXmlFile(const QString &filepath) {
@param xml_element An XML document to read the template from.
@return true if the reading succeeds, false otherwise.
*/
-bool InsetTemplate::loadFromXmlElement(const QDomElement &xml_element) {
- // we expect the XML element to be an
- if (xml_element.tagName() != "insettemplate") {
+bool TitleBlockTemplate::loadFromXmlElement(const QDomElement &xml_element) {
+ // we expect the XML element to be an
+ if (xml_element.tagName() != "titleblocktemplate") {
return(false);
}
@@ -73,13 +73,13 @@ bool InsetTemplate::loadFromXmlElement(const QDomElement &xml_element) {
}
/**
- Imports the logos from a given XML inset template.
- @param xml_element An XML element representing an inset template.
+ Imports the logos from a given XML titleblock template.
+ @param xml_element An XML element representing an titleblock template.
@param reset true to delete all previously known logos before, false
otherwise.
@return true if the reading succeeds, false otherwise.
*/
-bool InsetTemplate::loadLogos(const QDomElement &xml_element, bool reset) {
+bool TitleBlockTemplate::loadLogos(const QDomElement &xml_element, bool reset) {
if (reset) {
qDeleteAll(vector_logos_.begin(), vector_logos_.end());
vector_logos_.clear();
@@ -103,11 +103,11 @@ bool InsetTemplate::loadLogos(const QDomElement &xml_element, bool reset) {
/**
Imports the logo from a given XML logo description.
- @param xml_element An XML element representing a logo within an inset
+ @param xml_element An XML element representing a logo within an titleblock
template.
@return true if the reading succeeds, false otherwise.
*/
-bool InsetTemplate::loadLogo(const QDomElement &xml_element) {
+bool TitleBlockTemplate::loadLogo(const QDomElement &xml_element) {
// we require a name
if (!xml_element.hasAttribute("name")) {
return(false);
@@ -161,11 +161,11 @@ bool InsetTemplate::loadLogo(const QDomElement &xml_element) {
}
/**
- Imports the grid from a given XML inset template.
- @param xml_element An XML element representing an inset template.
+ Imports the grid from a given XML titleblock template.
+ @param xml_element An XML element representing an titleblock template.
@return true if the reading succeeds, false otherwise.
*/
-bool InsetTemplate::loadGrid(const QDomElement &xml_element) {
+bool TitleBlockTemplate::loadGrid(const QDomElement &xml_element) {
// we parse the first available "grid" XML element
QDomElement grid_element;
for (QDomNode n = xml_element.firstChild() ; !n.isNull() ; n = n.nextSibling()) {
@@ -187,9 +187,9 @@ bool InsetTemplate::loadGrid(const QDomElement &xml_element) {
/**
Parses the rows heights
- @param rows_string A string describing the rows heights of the inset
+ @param rows_string A string describing the rows heights of the titleblock
*/
-void InsetTemplate::parseRows(const QString &rows_string) {
+void TitleBlockTemplate::parseRows(const QString &rows_string) {
rows_heights_.clear();
// parse the rows attribute: we expect a serie of absolute heights
QRegExp row_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive);
@@ -202,16 +202,16 @@ void InsetTemplate::parseRows(const QString &rows_string) {
if (conv_ok) rows_heights_ << row_size;
}
}
-#ifdef INSET_TEMPLATE_DEBUG
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << "Rows heights:" << rows_heights_;
#endif
}
/**
Parses the columns widths
- @param cols_string A string describing the columns widths of the inset
+ @param cols_string A string describing the columns widths of the titleblock
*/
-void InsetTemplate::parseColumns(const QString &cols_string) {
+void TitleBlockTemplate::parseColumns(const QString &cols_string) {
columns_width_.clear();
// parse the cols attribute: we expect a serie of absolute or relative widths
QRegExp abs_col_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive);
@@ -222,16 +222,16 @@ void InsetTemplate::parseColumns(const QString &cols_string) {
foreach (QString cols_description, cols_descriptions) {
if (abs_col_size_format.exactMatch(cols_description)) {
int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok);
- if (conv_ok) columns_width_ << InsetColDimension(col_size, QET::Absolute);
+ if (conv_ok) columns_width_ << TitleBlockColDimension(col_size, QET::Absolute);
} else if (rel_col_size_format.exactMatch(cols_description)) {
int col_size = rel_col_size_format.capturedTexts().at(2).toInt(&conv_ok);
- QET::InsetColumnLength col_type = rel_col_size_format.capturedTexts().at(1) == "t" ? QET::RelativeToTotalLength : QET::RelativeToRemainingLength;
- if (conv_ok) columns_width_ << InsetColDimension(col_size, col_type );
+ QET::TitleBlockColumnLength col_type = rel_col_size_format.capturedTexts().at(1) == "t" ? QET::RelativeToTotalLength : QET::RelativeToRemainingLength;
+ if (conv_ok) columns_width_ << TitleBlockColDimension(col_size, col_type );
}
}
-#ifdef INSET_TEMPLATE_DEBUG
- foreach (InsetColDimension icd, columns_width_) {
- qDebug() << Q_FUNC_INFO << QString("%1 [%2]").arg(icd.value).arg(QET::insetColumnLengthToString(icd.type));
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
+ foreach (TitleBlockColDimension icd, columns_width_) {
+ qDebug() << Q_FUNC_INFO << QString("%1 [%2]").arg(icd.value).arg(QET::titleBlockColumnLengthToString(icd.type));
}
#endif
}
@@ -241,7 +241,7 @@ void InsetTemplate::parseColumns(const QString &cols_string) {
and stored in this object.
@param xml_element XML element to analyze
*/
-bool InsetTemplate::loadCells(const QDomElement &xml_element) {
+bool TitleBlockTemplate::loadCells(const QDomElement &xml_element) {
initCells();
// we are interested by the "logo" and "field" elements
QDomElement grid_element;
@@ -249,7 +249,7 @@ bool InsetTemplate::loadCells(const QDomElement &xml_element) {
if (!n.isElement()) continue;
QDomElement cell_element = n.toElement();
if (cell_element.tagName() == "field" || cell_element.tagName() == "logo") {
- InsetCell *loaded_cell;
+ TitleBlockCell *loaded_cell;
if (!checkCell(cell_element, &loaded_cell)) continue;
if (cell_element.tagName() == "logo") {
@@ -290,16 +290,16 @@ bool InsetTemplate::loadCells(const QDomElement &xml_element) {
}
/**
- @param xml_element XML element representing a cell, i.e. either an inset
- logo or an inset field.
- @param inset_cell_ptr Pointer to an InsetCell object pointer - if non-zero and if
- this method returns true, will be filled with the created InsetCell
+ @param xml_element XML element representing a cell, i.e. either an titleblock
+ logo or an titleblock field.
+ @param titleblock_cell_ptr Pointer to an TitleBlockCell object pointer - if non-zero and if
+ this method returns true, will be filled with the created TitleBlockCell
@return TRUE if the cell appears to be ok, FALSE otherwise
*/
-bool InsetTemplate::checkCell(const QDomElement &xml_element, InsetCell **inset_cell_ptr) {
+bool TitleBlockTemplate::checkCell(const QDomElement &xml_element, TitleBlockCell **titleblock_cell_ptr) {
int col_count = columns_width_.count(), row_count = rows_heights_.count();
-#ifdef INSET_TEMPLATE_DEBUG
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << "begin" << row_count << col_count;
#endif
@@ -318,10 +318,10 @@ bool InsetTemplate::checkCell(const QDomElement &xml_element, InsetCell **inset_
}
// check whether the target cell can be used or not
-#ifdef INSET_TEMPLATE_DEBUG
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << "cell access" << col_num << row_num;
#endif
- InsetCell *cell_ptr = &(cells_[col_num][row_num]);
+ TitleBlockCell *cell_ptr = &(cells_[col_num][row_num]);
if (!cell_ptr -> is_null || cell_ptr -> spanner_cell) {
return(false);
}
@@ -342,10 +342,10 @@ bool InsetTemplate::checkCell(const QDomElement &xml_element, InsetCell **inset_
for (int i = col_num ; i <= col_num + col_span ; ++ i) {
for (int j = row_num ; j <= row_num + row_span ; ++ j) {
if (i == col_num && j == row_num) continue;
-#ifdef INSET_TEMPLATE_DEBUG
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << "span check" << i << j;
#endif
- InsetCell *current_cell = &(cells_[i][j]);
+ TitleBlockCell *current_cell = &(cells_[i][j]);
if (!current_cell -> is_null || current_cell -> spanner_cell) {
return(false);
}
@@ -354,7 +354,7 @@ bool InsetTemplate::checkCell(const QDomElement &xml_element, InsetCell **inset_
}
// at this point, the cell is ok - we fill the adequate cells in the matrix
-#ifdef INSET_TEMPLATE_DEBUG
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << "cell writing";
#endif
cell_ptr -> num_row = row_num;
@@ -362,16 +362,16 @@ bool InsetTemplate::checkCell(const QDomElement &xml_element, InsetCell **inset_
if (has_row_span) cell_ptr -> row_span = row_span;
if (has_col_span) cell_ptr -> col_span = col_span;
cell_ptr -> is_null = false;
- if (inset_cell_ptr) *inset_cell_ptr = cell_ptr;
+ if (titleblock_cell_ptr) *titleblock_cell_ptr = cell_ptr;
if (has_row_span || has_col_span) {
for (int i = col_num ; i <= col_num + col_span ; ++ i) {
for (int j = row_num ; j <= row_num + row_span ; ++ j) {
if (i == col_num && j == row_num) continue;
-#ifdef INSET_TEMPLATE_DEBUG
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << "span cells writing" << i << j;
#endif
- InsetCell *current_cell = &(cells_[i][j]);
+ TitleBlockCell *current_cell = &(cells_[i][j]);
current_cell -> num_row = j;
current_cell -> num_col = i;
current_cell -> is_null = false;
@@ -388,7 +388,7 @@ bool InsetTemplate::checkCell(const QDomElement &xml_element, InsetCell **inset_
Note that this method does nothing if one of the internal lists
columns_width_ and rows_heights_ is empty.
*/
-void InsetTemplate::initCells() {
+void TitleBlockTemplate::initCells() {
if (columns_width_.count() < 1 || rows_heights_.count() < 1) return;
cells_.resize(columns_width_.count());
@@ -397,20 +397,20 @@ void InsetTemplate::initCells() {
cells_[i].resize(row_count);
// ensure every cell is a null cell
for (int j = 0 ; j < row_count ; ++ j) {
- cells_[i][j] = InsetCell();
+ cells_[i][j] = TitleBlockCell();
}
}
-#ifdef INSET_TEMPLATE_DEBUG
+#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << toString();
#endif
}
/**
- @return A string representing the inset template
- @see InsetCell::toString()
+ @return A string representing the titleblock template
+ @see TitleBlockCell::toString()
*/
-QString InsetTemplate::toString() const {
+QString TitleBlockTemplate::toString() const {
QString str = "\n";
for (int j = 0 ; j < rows_heights_.count() ; ++ j) {
for (int i = 0 ; i < columns_width_.count() ; ++ i) {
@@ -422,10 +422,10 @@ QString InsetTemplate::toString() const {
}
/**
- @param total_width The total width of the inset to render
+ @param total_width The total width of the titleblock to render
@return the list of the columns widths for this rendering
*/
-QList InsetTemplate::columnsWidth(int total_width) const {
+QList TitleBlockTemplate::columnsWidth(int total_width) const {
if (total_width < 0) return(QList());
// we first iter to determine the absolute and total-width-related widths
@@ -433,7 +433,7 @@ QList InsetTemplate::columnsWidth(int total_width) const {
int abs_widths_sum = 0;
for (int i = 0 ; i < columns_width_.count() ; ++ i) {
- InsetColDimension icd = columns_width_.at(i);
+ TitleBlockColDimension icd = columns_width_.at(i);
if (icd.type == QET::Absolute) {
abs_widths_sum += icd.value;
final_widths[i] = icd.value;
@@ -449,7 +449,7 @@ QList InsetTemplate::columnsWidth(int total_width) const {
// we do a second iteration to build the final widths list
for (int i = 0 ; i < columns_width_.count() ; ++ i) {
- InsetColDimension icd = columns_width_.at(i);
+ TitleBlockColDimension icd = columns_width_.at(i);
if (icd.type == QET::RelativeToRemainingLength) {
final_widths[i] = int(remaining_width * icd.value / 100);
}
@@ -457,7 +457,7 @@ QList InsetTemplate::columnsWidth(int total_width) const {
return(final_widths.toList());
}
-int InsetTemplate::height() const {
+int TitleBlockTemplate::height() const {
int height = 0;
foreach(int row_height, rows_heights_) {
height += row_height;
@@ -466,22 +466,22 @@ int InsetTemplate::height() const {
}
/**
- Render the inset.
- @param painter Painter to use to render the inset
- @param diagram_context Diagram context to use to generate the inset strings
- @param inset_width Width of the inset to render
+ Render the titleblock.
+ @param painter Painter to use to render the titleblock
+ @param diagram_context Diagram context to use to generate the titleblock strings
+ @param titleblock_width Width of the titleblock to render
*/
-void InsetTemplate::render(QPainter &painter, const DiagramContext &diagram_context, int inset_width) const {
- QList widths = columnsWidth(inset_width);
- int inset_height = height();
+void TitleBlockTemplate::render(QPainter &painter, const DiagramContext &diagram_context, int titleblock_width) const {
+ QList widths = columnsWidth(titleblock_width);
+ int titleblock_height = height();
// prepare the QPainter
painter.setPen(Qt::black);
painter.setBrush(Qt::white);
painter.setFont(QETApp::diagramTextsFont());
- // draw the inset border
- painter.drawRect(QRect(0, 0, inset_width, inset_height));
+ // draw the titleblock border
+ painter.drawRect(QRect(0, 0, titleblock_width, titleblock_height));
// run through each inidividual cell
for (int j = 0 ; j < rows_heights_.count() ; ++ j) {
@@ -524,7 +524,7 @@ void InsetTemplate::render(QPainter &painter, const DiagramContext &diagram_cont
@param diagram_context Diagram context to use to generate the final text for the given cell
@return the final text that has to be drawn in the given cell
*/
-QString InsetTemplate::finalTextForCell(const InsetCell &cell, const DiagramContext &diagram_context) const {
+QString TitleBlockTemplate::finalTextForCell(const TitleBlockCell &cell, const DiagramContext &diagram_context) const {
QString cell_text = cell.value;
foreach (QString key, diagram_context.keys()) {
@@ -532,7 +532,7 @@ QString InsetTemplate::finalTextForCell(const InsetCell &cell, const DiagramCont
cell_text.replace("%" + key, diagram_context[key].toString());
}
if (cell.display_label && !cell.label.isEmpty()) {
- cell_text = QString(tr(" %1 : %2", "inset content - please let the blank space at the beginning")).arg(cell.label).arg(cell_text);
+ cell_text = QString(tr(" %1 : %2", "titleblock content - please let the blank space at the beginning")).arg(cell.label).arg(cell_text);
} else {
cell_text = QString(tr(" %1")).arg(cell_text);
}
@@ -544,7 +544,7 @@ QString InsetTemplate::finalTextForCell(const InsetCell &cell, const DiagramCont
@param start start border number
@param end end border number
*/
-int InsetTemplate::lengthRange(int start, int end, const QList &lengths_list) const {
+int TitleBlockTemplate::lengthRange(int start, int end, const QList &lengths_list) const {
if (start > end || start >= lengths_list.count() || end > lengths_list.count()) {
qDebug() << Q_FUNC_INFO << "wont use" << start << "and" << end;
return(0);
@@ -562,7 +562,7 @@ int InsetTemplate::lengthRange(int start, int end, const QList &lengths_lis
/**
Constructor
*/
-InsetCell::InsetCell() {
+TitleBlockCell::TitleBlockCell() {
num_row = num_col = -1;
row_span = col_span = 0;
display_label = is_null = true;
@@ -570,11 +570,11 @@ InsetCell::InsetCell() {
}
/**
- @return A string representing the inset cell
+ @return A string representing the titleblock cell
*/
-QString InsetCell::toString() const {
- if (is_null) return("InsetCell{null}");
+QString TitleBlockCell::toString() const {
+ if (is_null) return("TitleBlockCell{null}");
QString span_desc = (row_span > 0 || col_span > 0) ? QString("+%3,%4").arg(row_span).arg(col_span) : QET::pointerString(spanner_cell);
- QString base_desc = QString("InsetCell{ [%1, %2] %3 }").arg(num_row).arg(num_col).arg(span_desc);
+ QString base_desc = QString("TitleBlockCell{ [%1, %2] %3 }").arg(num_row).arg(num_col).arg(span_desc);
return(base_desc);
}
diff --git a/sources/insettemplate.h b/sources/titleblocktemplate.h
similarity index 70%
rename from sources/insettemplate.h
rename to sources/titleblocktemplate.h
index 15c018dfb..8d6a4a9c3 100644
--- a/sources/insettemplate.h
+++ b/sources/titleblocktemplate.h
@@ -15,43 +15,43 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
-#ifndef INSET_TEMPLATE_H
-#define INSET_TEMPLATE_H
+#ifndef TITLEBLOCK_TEMPLATE_H
+#define TITLEBLOCK_TEMPLATE_H
#include
#include
#include "diagramcontext.h"
-#include "insetcell.h"
+#include "titleblockcell.h"
#include "qet.h"
/**
This struct is a simple container associating a length with its type.
- @see InsetColumnLength
+ @see TitleBlockColumnLength
*/
-struct InsetColDimension {
- InsetColDimension(int v, QET::InsetColumnLength t = QET::Absolute) {
+struct TitleBlockColDimension {
+ TitleBlockColDimension(int v, QET::TitleBlockColumnLength t = QET::Absolute) {
value = v;
type = t;
}
- QET::InsetColumnLength type;
+ QET::TitleBlockColumnLength type;
int value;
};
/**
- This class represents an inset templ)ate for an electric diagram.
+ This class represents an titleblock templ)ate for an electric diagram.
It can read from an XML document the layout of the table that graphically
- represents the inset, and can produce a graphical rendering of it from a
+ represents the titleblock, and can produce a graphical rendering of it from a
diagram context (object embedding the informations of the diagram we want to
- represent the inset.
+ represent the titleblock.
*/
-class InsetTemplate : public QObject {
+class TitleBlockTemplate : public QObject {
Q_OBJECT
// constructeurs, destructeur
public:
- InsetTemplate(QObject * = 0);
- virtual ~InsetTemplate();
+ TitleBlockTemplate(QObject * = 0);
+ virtual ~TitleBlockTemplate();
private:
- InsetTemplate(const InsetTemplate &);
+ TitleBlockTemplate(const TitleBlockTemplate &);
// methodes
public:
@@ -74,11 +74,11 @@ class InsetTemplate : public QObject {
private:
void parseRows(const QString &);
void parseColumns(const QString &);
- bool checkCell(const QDomElement &, InsetCell ** = 0);
+ bool checkCell(const QDomElement &, TitleBlockCell ** = 0);
void flushCells();
void initCells();
int lengthRange(int, int, const QList &) const;
- QString finalTextForCell(const InsetCell &, const DiagramContext &) const;
+ QString finalTextForCell(const TitleBlockCell &, const DiagramContext &) const;
// attributs
private:
@@ -86,7 +86,7 @@ class InsetTemplate : public QObject {
QHash vector_logos_;
QHash bitmap_logos_;
QList rows_heights_;
- QList columns_width_;
- QVector< QVector > cells_;
+ QList columns_width_;
+ QVector< QVector > cells_;
};
#endif
diff --git a/sources/titleblocktemplaterenderer.cpp b/sources/titleblocktemplaterenderer.cpp
new file mode 100644
index 000000000..6fb3c71be
--- /dev/null
+++ b/sources/titleblocktemplaterenderer.cpp
@@ -0,0 +1,96 @@
+#include "titleblocktemplaterenderer.h"
+#include "titleblocktemplate.h"
+
+/**
+ Constructor
+ @param parnet Parent QObject of this renderer
+*/
+TitleBlockTemplateRenderer::TitleBlockTemplateRenderer(QObject *parent) :
+ QObject(parent),
+ titleblock_template_(0),
+ last_known_titleblock_width_(-1)
+{
+}
+
+/**
+ Destructor
+*/
+TitleBlockTemplateRenderer::~TitleBlockTemplateRenderer() {
+}
+
+/**
+ @return the titleblock template used for the rendering
+*/
+const TitleBlockTemplate *TitleBlockTemplateRenderer::titleBlockTemplate() const {
+ return(titleblock_template_);
+}
+
+/**
+ @param titleblock_template TitleBlock template to render.
+*/
+void TitleBlockTemplateRenderer::setTitleBlockTemplate(const TitleBlockTemplate *titleblock_template) {
+ if (titleblock_template != titleblock_template_) {
+ titleblock_template_ = titleblock_template;
+ invalidateRenderedTemplate();
+ }
+}
+
+/**
+ @param context Diagram Context to use when rendering the titleblock
+*/
+void TitleBlockTemplateRenderer::setContext(const DiagramContext &context) {
+ context_ = context;
+ invalidateRenderedTemplate();
+}
+
+/**
+ @return the height of the rendered template, or -1 if no template has been
+ set for this renderer.
+ @see TitleBlockTemplate::height()
+*/
+int TitleBlockTemplateRenderer::height() const {
+ if (!titleblock_template_) return(-1);
+ return(titleblock_template_ -> height());
+}
+
+/**
+ Render the titleblock.
+ @param provided_painter QPainter to use to render the titleblock.
+ @param titleblock_width The total width of the titleblock to render
+*/
+void TitleBlockTemplateRenderer::render(QPainter *provided_painter, int titleblock_width) {
+ if (!titleblock_template_) return;
+
+ // Do we really need to calculate all this again?
+ if (titleblock_width != last_known_titleblock_width_ || rendered_template_.isNull()) {
+ renderToQPicture(titleblock_width);
+ }
+
+ provided_painter -> save();
+ rendered_template_.play(provided_painter);
+ provided_painter -> restore();
+}
+
+/**
+ Renders the titleblock to the internal QPicture
+ @param titleblock_width Width of the titleblock to render
+*/
+void TitleBlockTemplateRenderer::renderToQPicture(int titleblock_width) {
+ if (!titleblock_template_) return;
+
+ // we render the template on our internal QPicture
+ QPainter painter(&rendered_template_);
+
+ titleblock_template_ -> render(painter, context_, titleblock_width);
+
+ // memorize the last known width
+ last_known_titleblock_width_ = titleblock_width;
+}
+
+/**
+ Invalidates the previous rendering of the template by resetting the internal
+ QPicture.
+*/
+void TitleBlockTemplateRenderer::invalidateRenderedTemplate() {
+ rendered_template_ = QPicture();
+}
diff --git a/sources/insettemplaterenderer.h b/sources/titleblocktemplaterenderer.h
similarity index 70%
rename from sources/insettemplaterenderer.h
rename to sources/titleblocktemplaterenderer.h
index 9ac2e83ce..2f84c1180 100644
--- a/sources/insettemplaterenderer.h
+++ b/sources/titleblocktemplaterenderer.h
@@ -15,19 +15,19 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
-#ifndef INSET_TEMPLATE_RENDERER_H
-#define INSET_TEMPLATE_RENDERER_H
+#ifndef TITLEBLOCK_TEMPLATE_RENDERER_H
+#define TITLEBLOCK_TEMPLATE_RENDERER_H
#include
#include "diagramcontext.h"
-class InsetTemplate;
-class InsetTemplateRenderer : public QObject {
+class TitleBlockTemplate;
+class TitleBlockTemplateRenderer : public QObject {
Q_OBJECT
public:
- InsetTemplateRenderer(QObject * = 0);
- virtual ~InsetTemplateRenderer();
- const InsetTemplate *insetTemplate() const;
- void setInsetTemplate(const InsetTemplate *);
+ TitleBlockTemplateRenderer(QObject * = 0);
+ virtual ~TitleBlockTemplateRenderer();
+ const TitleBlockTemplate *titleBlockTemplate() const;
+ void setTitleBlockTemplate(const TitleBlockTemplate *);
void setContext(const DiagramContext &context);
int height() const;
void render(QPainter *, int);
@@ -37,9 +37,9 @@ class InsetTemplateRenderer : public QObject {
void invalidateRenderedTemplate();
private:
- const InsetTemplate *inset_template_;
+ const TitleBlockTemplate *titleblock_template_;
QPicture rendered_template_;
DiagramContext context_;
- int last_known_inset_width_;
+ int last_known_titleblock_width_;
};
#endif
diff --git a/insets/default.inset b/titleblocks/default.titleblock
similarity index 93%
rename from insets/default.inset
rename to titleblocks/default.titleblock
index 507988670..409fb0f84 100644
--- a/insets/default.inset
+++ b/titleblocks/default.titleblock
@@ -1,4 +1,4 @@
-
+
Author: The QElectroTech team
License: see http://qelectrotech.org/wiki/doc/elements_license
@@ -8,4 +8,4 @@ License: see http://qelectrotech.org/wiki/doc/elements_license
-
+