mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Title block : add two news variables, previous-folio-num and next-folio-num
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5664 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
34f59f4920
commit
2274382219
@ -696,6 +696,45 @@ DiagramPosition BorderTitleBlock::convertPosition(const QPointF &pos)
|
|||||||
return(DiagramPosition(letter, row_number));
|
return(DiagramPosition(letter, row_number));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setAuthor
|
||||||
|
* @param author the new value of the "Author" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setAuthor(const QString &author) {
|
||||||
|
btb_author_ = author;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setDate
|
||||||
|
* @param date the new value of the "Date" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setDate(const QDate &date) {
|
||||||
|
btb_date_ = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setTitle
|
||||||
|
* @param title the new value of the "Title" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setTitle(const QString &title)
|
||||||
|
{
|
||||||
|
if (btb_title_ != title)
|
||||||
|
{
|
||||||
|
btb_title_ = title;
|
||||||
|
emit(diagramTitleChanged(title));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setFolio
|
||||||
|
* @param folio the new value of the "Folio" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setFolio(const QString &folio)
|
||||||
|
{
|
||||||
|
btb_folio_ = folio;
|
||||||
|
emit (titleBlockFolioChanged(folio));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update the informations given to the titleblock template by regenerating a
|
Update the informations given to the titleblock template by regenerating a
|
||||||
DiagramContext object.
|
DiagramContext object.
|
||||||
@ -723,6 +762,8 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(const DiagramContext &i
|
|||||||
context.addValue("folio-id", folio_index_);
|
context.addValue("folio-id", folio_index_);
|
||||||
context.addValue("folio-total", folio_total_);
|
context.addValue("folio-total", folio_total_);
|
||||||
context.addValue("auto_page_num", btb_auto_page_num_);
|
context.addValue("auto_page_num", btb_auto_page_num_);
|
||||||
|
context.addValue("previous-folio-num", m_previous_folio_num);
|
||||||
|
context.addValue("next-folio-num", m_next_folio_num);
|
||||||
|
|
||||||
titleblock_template_renderer_ -> setContext(context);
|
titleblock_template_renderer_ -> setContext(context);
|
||||||
}
|
}
|
||||||
@ -769,3 +810,75 @@ void BorderTitleBlock::setFolioData(int index, int total, const QString& autonum
|
|||||||
|
|
||||||
updateDiagramContextForTitleBlock(project_properties);
|
updateDiagramContextForTitleBlock(project_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setPlant
|
||||||
|
* @param plant the new value of the "plant" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setPlant(const QString &plant) {
|
||||||
|
btb_plant_ = plant;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setLocMach
|
||||||
|
* @param locmach the new value of the "locmach" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setLocMach(const QString &locmach) {
|
||||||
|
btb_locmach_ = locmach;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setIndicerev
|
||||||
|
* @param indexrev the new value of the "indexrev" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setIndicerev(const QString &indexrev) {
|
||||||
|
btb_indexrev_ = indexrev;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setFileName
|
||||||
|
* @param filename the new value of the "filename" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setFileName(const QString &filename) {
|
||||||
|
btb_filename_ = filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setVersion
|
||||||
|
* @param version the new value of the "version" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setVersion(const QString &version) {
|
||||||
|
btb_version_ = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setAutoPageNum
|
||||||
|
* @param auto_page_num the new value of the "auto_page_num" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setAutoPageNum(const QString &auto_page_num) {
|
||||||
|
btb_auto_page_num_ = auto_page_num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setPreviousFolioNum
|
||||||
|
* @param previous the new value of the "previous-folio-num" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setPreviousFolioNum(const QString &previous)
|
||||||
|
{
|
||||||
|
m_previous_folio_num = previous;
|
||||||
|
DiagramContext context = titleblock_template_renderer_->context();
|
||||||
|
context.addValue("previous-folio-num", m_previous_folio_num);
|
||||||
|
titleblock_template_renderer_->setContext(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BorderTitleBlock::setNextFolioNum
|
||||||
|
* @param next the new value of the "next-folio-num" field
|
||||||
|
*/
|
||||||
|
void BorderTitleBlock::setNextFolioNum(const QString &next)
|
||||||
|
{
|
||||||
|
m_next_folio_num = next;
|
||||||
|
DiagramContext context = titleblock_template_renderer_->context();
|
||||||
|
context.addValue("next-folio-num", m_next_folio_num);
|
||||||
|
titleblock_template_renderer_->setContext(context);
|
||||||
|
}
|
||||||
|
@ -86,149 +86,131 @@ class BorderTitleBlock : public QObject
|
|||||||
QRectF outsideBorderRect() const;
|
QRectF outsideBorderRect() const;
|
||||||
QRectF insideBorderRect() const;
|
QRectF insideBorderRect() const;
|
||||||
|
|
||||||
// methods to get title block basic data
|
// methods to get title block basic data
|
||||||
/// @return the value of the title block "Author" field
|
/// @return the value of the title block "Author" field
|
||||||
QString author() const { return(btb_author_); }
|
QString author() const { return(btb_author_); }
|
||||||
/// @return the value of the title block "Date" field
|
/// @return the value of the title block "Date" field
|
||||||
QDate date() const { return(btb_date_); }
|
QDate date() const { return(btb_date_); }
|
||||||
/// @return the value of the title block "Title" field
|
/// @return the value of the title block "Title" field
|
||||||
QString title() const { return(btb_title_); }
|
QString title() const { return(btb_title_); }
|
||||||
/// @return the value of the title block "Folio" field
|
/// @return the value of the title block "Folio" field
|
||||||
QString folio() const { return(btb_folio_); }
|
QString folio() const { return(btb_folio_); }
|
||||||
/// @return the value of the title block "Folio" field as displayed
|
/// @return the value of the title block "Folio" field as displayed
|
||||||
QString finalfolio() const { return(btb_final_folio_); }
|
QString finalfolio() const { return(btb_final_folio_); }
|
||||||
/// @return the value of the title block "Plant" field
|
/// @return the value of the title block "Plant" field
|
||||||
QString plant() const { return(btb_plant_); }
|
QString plant() const { return(btb_plant_); }
|
||||||
/// @return the value of the title block "Locmach" field
|
/// @return the value of the title block "Locmach" field
|
||||||
QString locmach() const { return(btb_locmach_); }
|
QString locmach() const { return(btb_locmach_); }
|
||||||
/// @return the value of the revision index block "Folio" field
|
/// @return the value of the revision index block "Folio" field
|
||||||
QString indexrev() const { return(btb_indexrev_); }
|
QString indexrev() const { return(btb_indexrev_); }
|
||||||
|
/// @return the value of the title block "File" field
|
||||||
/// @return the value of the title block "File" field
|
QString fileName() const { return(btb_filename_); }
|
||||||
QString fileName() const { return(btb_filename_); }
|
/// @return the value of the title block Additional Fields
|
||||||
/// @return the value of the title block Additional Fields
|
QString version() const { return(btb_version_); }
|
||||||
QString version() const { return(btb_version_); }
|
/// @return the value of the title block Additional Fields
|
||||||
/// @return the value of the title block Additional Fields
|
DiagramContext additionalFields() const { return (additional_fields_); }
|
||||||
DiagramContext additionalFields() const { return (additional_fields_); }
|
/// @return the value of the title block
|
||||||
/// @return the value of the title block
|
QString autoPageNum() const { return(btb_auto_page_num_); }
|
||||||
QString autoPageNum() const { return(btb_auto_page_num_); }
|
/// @return the value of the total number of folios
|
||||||
/// @return the value of the total number of folios
|
int folioTotal() const { return(folio_total_);}
|
||||||
int folioTotal() const { return(folio_total_);}
|
|
||||||
|
|
||||||
// methods to get display options
|
|
||||||
/// @return true si le cartouche est affiche, false sinon
|
|
||||||
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
|
|
||||||
bool rowsAreDisplayed() const { return(display_rows_); }
|
|
||||||
/// @return true si la bordure est affichee, false sinon
|
|
||||||
bool borderIsDisplayed() const { return(display_border_); }
|
|
||||||
|
|
||||||
// methods to set dimensions
|
|
||||||
void setColumnsCount(int);
|
|
||||||
void setRowsCount(int);
|
|
||||||
void setColumnsWidth(const qreal &);
|
|
||||||
void setRowsHeight(const qreal &);
|
|
||||||
void setColumnsHeaderHeight(const qreal &);
|
|
||||||
void setRowsHeaderWidth(const qreal &);
|
|
||||||
void setDiagramHeight(const qreal &);
|
|
||||||
|
|
||||||
DiagramPosition convertPosition(const QPointF &);
|
|
||||||
|
|
||||||
// methods to set title block basic data
|
|
||||||
/// @param author the new value of the "Author" field
|
|
||||||
void setAuthor(const QString &author) { btb_author_ = author; }
|
|
||||||
/// @param author the new value of the "Date" field
|
|
||||||
void setDate(const QDate &date) { btb_date_ = date; }
|
|
||||||
/// @param author the new value of the "Title" field
|
|
||||||
void setTitle(const QString &title) {
|
|
||||||
if (btb_title_ != title) {
|
|
||||||
btb_title_ = title;
|
|
||||||
emit(diagramTitleChanged(title));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// @param author the new value of the "Folio" field
|
|
||||||
void setFolio(const QString &folio) {
|
|
||||||
btb_folio_ = folio;
|
|
||||||
emit (titleBlockFolioChanged(folio));
|
|
||||||
}
|
|
||||||
void setFolioData(int, int, const QString& = nullptr, const DiagramContext & = DiagramContext());
|
|
||||||
/// @param author the new value of the "File" field
|
|
||||||
void setPlant(const QString &plant) { btb_plant_ = plant; }
|
|
||||||
void setLocMach(const QString &locmach) { btb_locmach_ = locmach; }
|
|
||||||
void setIndicerev(const QString &indexrev){ btb_indexrev_ = indexrev; }
|
|
||||||
void setFileName(const QString &filename) { btb_filename_ = filename; }
|
|
||||||
/// @param author the new value of the "Version" field
|
|
||||||
void setVersion(const QString &version) { btb_version_ = version; }
|
|
||||||
/// @param author the new value of the "Auto Page Num" field
|
|
||||||
void setAutoPageNum(const QString &auto_page_num) { btb_auto_page_num_ = auto_page_num;}
|
|
||||||
|
|
||||||
void titleBlockToXml(QDomElement &);
|
|
||||||
void titleBlockFromXml(const QDomElement &);
|
|
||||||
void borderToXml(QDomElement &);
|
|
||||||
void borderFromXml(const QDomElement &);
|
|
||||||
|
|
||||||
TitleBlockProperties exportTitleBlock();
|
|
||||||
void importTitleBlock(const TitleBlockProperties &);
|
|
||||||
BorderProperties exportBorder();
|
|
||||||
void importBorder(const BorderProperties &);
|
|
||||||
|
|
||||||
const TitleBlockTemplate *titleBlockTemplate();
|
|
||||||
void setTitleBlockTemplate(const TitleBlockTemplate *);
|
|
||||||
QString titleBlockTemplateName() const;
|
|
||||||
|
|
||||||
|
// methods to get display options
|
||||||
|
/// @return true si le cartouche est affiche, false sinon
|
||||||
|
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
|
||||||
|
bool rowsAreDisplayed() const { return(display_rows_); }
|
||||||
|
/// @return true si la bordure est affichee, false sinon
|
||||||
|
bool borderIsDisplayed() const { return(display_border_); }
|
||||||
|
|
||||||
|
// methods to set dimensions
|
||||||
|
void setColumnsCount(int);
|
||||||
|
void setRowsCount(int);
|
||||||
|
void setColumnsWidth(const qreal &);
|
||||||
|
void setRowsHeight(const qreal &);
|
||||||
|
void setColumnsHeaderHeight(const qreal &);
|
||||||
|
void setRowsHeaderWidth(const qreal &);
|
||||||
|
void setDiagramHeight(const qreal &);
|
||||||
|
|
||||||
|
DiagramPosition convertPosition(const QPointF &);
|
||||||
|
|
||||||
|
// methods to set title block basic data
|
||||||
|
void setAuthor(const QString &author);
|
||||||
|
void setDate(const QDate &date);
|
||||||
|
void setTitle(const QString &title);
|
||||||
|
void setFolio(const QString &folio);
|
||||||
|
void setFolioData(int, int, const QString& = nullptr, const DiagramContext & = DiagramContext());
|
||||||
|
void setPlant(const QString &plant);
|
||||||
|
void setLocMach(const QString &locmach);
|
||||||
|
void setIndicerev(const QString &indexrev);
|
||||||
|
void setFileName(const QString &filename);
|
||||||
|
void setVersion(const QString &version);
|
||||||
|
void setAutoPageNum(const QString &auto_page_num);
|
||||||
|
void setPreviousFolioNum(const QString &previous);
|
||||||
|
void setNextFolioNum(const QString &next);
|
||||||
|
|
||||||
|
void titleBlockToXml(QDomElement &);
|
||||||
|
void titleBlockFromXml(const QDomElement &);
|
||||||
|
void borderToXml(QDomElement &);
|
||||||
|
void borderFromXml(const QDomElement &);
|
||||||
|
|
||||||
|
TitleBlockProperties exportTitleBlock();
|
||||||
|
void importTitleBlock(const TitleBlockProperties &);
|
||||||
|
BorderProperties exportBorder();
|
||||||
|
void importBorder(const BorderProperties &);
|
||||||
|
|
||||||
|
const TitleBlockTemplate *titleBlockTemplate();
|
||||||
|
void setTitleBlockTemplate(const TitleBlockTemplate *);
|
||||||
|
QString titleBlockTemplateName() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void titleBlockTemplateChanged(const QString &);
|
void titleBlockTemplateChanged(const QString &);
|
||||||
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate * = nullptr);
|
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate * = nullptr);
|
||||||
|
|
||||||
// methods to set display options
|
// methods to set display options
|
||||||
void displayTitleBlock(bool);
|
void displayTitleBlock(bool);
|
||||||
void displayColumns(bool);
|
void displayColumns(bool);
|
||||||
void displayRows(bool);
|
void displayRows(bool);
|
||||||
void displayBorder(bool);
|
void displayBorder(bool);
|
||||||
void slot_setAutoPageNum (QString);
|
void slot_setAutoPageNum (QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateRectangles();
|
void updateRectangles();
|
||||||
void updateDiagramContextForTitleBlock(const DiagramContext & = DiagramContext());
|
void updateDiagramContextForTitleBlock(const DiagramContext & = DiagramContext());
|
||||||
QString incrementLetters(const QString &);
|
QString incrementLetters(const QString &);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
Signal emitted after the border has changed
|
Signal emitted after the border has changed
|
||||||
@param old_border Former border
|
@param old_border Former border
|
||||||
@param new_border New border
|
@param new_border New border
|
||||||
*/
|
*/
|
||||||
void borderChanged(QRectF old_border, QRectF new_border);
|
void borderChanged(QRectF old_border, QRectF new_border);
|
||||||
/**
|
/**
|
||||||
Signal emitted after display options have changed
|
Signal emitted after display options have changed
|
||||||
*/
|
*/
|
||||||
void displayChanged();
|
void displayChanged();
|
||||||
|
/**
|
||||||
/**
|
Signal emitted after the title has changed
|
||||||
Signal emitted after the title has changed
|
*/
|
||||||
*/
|
void diagramTitleChanged(const QString &);
|
||||||
void diagramTitleChanged(const QString &);
|
/**
|
||||||
|
@brief titleBlockFolioChanged
|
||||||
/**
|
Signal emitted after Folio has changed
|
||||||
@brief titleBlockFolioChanged
|
*/
|
||||||
Signal emitted after Folio has changed
|
void titleBlockFolioChanged(const QString &);
|
||||||
*/
|
/**
|
||||||
void titleBlockFolioChanged(const QString &);
|
Signal emitted when the title block requires its data to be updated in order
|
||||||
|
to generate the folio field.
|
||||||
/**
|
*/
|
||||||
Signal emitted when the title block requires its data to be updated in order
|
void needFolioData();
|
||||||
to generate the folio field.
|
/**
|
||||||
*/
|
Signal emitted when this object needs to set a specific title block
|
||||||
void needFolioData();
|
template. This object cannot handle the job since it does not know of
|
||||||
|
its parent project.
|
||||||
/**
|
*/
|
||||||
Signal emitted when this object needs to set a specific title block
|
void needTitleBlockTemplate(const QString &);
|
||||||
template. This object cannot handle the job since it does not know of
|
|
||||||
its parent project.
|
|
||||||
*/
|
|
||||||
void needTitleBlockTemplate(const QString &);
|
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
private:
|
private:
|
||||||
@ -248,25 +230,27 @@ class BorderTitleBlock : public QObject
|
|||||||
QString btb_version_;
|
QString btb_version_;
|
||||||
DiagramContext additional_fields_;
|
DiagramContext additional_fields_;
|
||||||
Qt::Edge m_edge;
|
Qt::Edge m_edge;
|
||||||
|
QString m_next_folio_num,
|
||||||
|
m_previous_folio_num;
|
||||||
|
|
||||||
// border dimensions (rows and columns)
|
// border dimensions (rows and columns)
|
||||||
// columns: number and dimensions
|
// columns: number and dimensions
|
||||||
int columns_count_;
|
int columns_count_;
|
||||||
qreal columns_width_;
|
qreal columns_width_;
|
||||||
qreal columns_header_height_;
|
qreal columns_header_height_;
|
||||||
|
|
||||||
// rows: number and dimensions
|
// rows: number and dimensions
|
||||||
int rows_count_;
|
int rows_count_;
|
||||||
qreal rows_height_;
|
qreal rows_height_;
|
||||||
qreal rows_header_width_;
|
qreal rows_header_width_;
|
||||||
|
|
||||||
// title block dimensions
|
// title block dimensions
|
||||||
qreal titleblock_height_;
|
qreal titleblock_height_;
|
||||||
|
|
||||||
// rectangles used for drawing operations
|
// rectangles used for drawing operations
|
||||||
QRectF diagram_rect_;
|
QRectF diagram_rect_;
|
||||||
|
|
||||||
// display options
|
// display options
|
||||||
bool display_titleblock_;
|
bool display_titleblock_;
|
||||||
bool display_columns_;
|
bool display_columns_;
|
||||||
bool display_rows_;
|
bool display_rows_;
|
||||||
|
@ -1744,7 +1744,8 @@ bool QETProject::projectWasModified() {
|
|||||||
Indique a chaque schema du projet quel est son numero de folio et combien de
|
Indique a chaque schema du projet quel est son numero de folio et combien de
|
||||||
folio le projet contient.
|
folio le projet contient.
|
||||||
*/
|
*/
|
||||||
void QETProject::updateDiagramsFolioData() {
|
void QETProject::updateDiagramsFolioData()
|
||||||
|
{
|
||||||
int total_folio = m_diagrams_list.count();
|
int total_folio = m_diagrams_list.count();
|
||||||
|
|
||||||
DiagramContext project_wide_properties = project_properties_;
|
DiagramContext project_wide_properties = project_properties_;
|
||||||
@ -1752,19 +1753,38 @@ void QETProject::updateDiagramsFolioData() {
|
|||||||
project_wide_properties.addValue("projectpath", filePath());
|
project_wide_properties.addValue("projectpath", filePath());
|
||||||
project_wide_properties.addValue("projectfilename", QFileInfo(filePath()).baseName());
|
project_wide_properties.addValue("projectfilename", QFileInfo(filePath()).baseName());
|
||||||
|
|
||||||
for (int i = 0 ; i < total_folio ; ++ i) {
|
for (int i = 0 ; i < total_folio ; ++ i)
|
||||||
QString title = m_diagrams_list[i] -> title();
|
{
|
||||||
QString autopagenum = m_diagrams_list[i]->border_and_titleblock.autoPageNum();
|
QString autopagenum = m_diagrams_list[i]->border_and_titleblock.autoPageNum();
|
||||||
NumerotationContext nC = folioAutoNum(autopagenum);
|
NumerotationContext nC = folioAutoNum(autopagenum);
|
||||||
NumerotationContextCommands nCC = NumerotationContextCommands(nC);
|
NumerotationContextCommands nCC = NumerotationContextCommands(nC);
|
||||||
if((m_diagrams_list[i]->border_and_titleblock.folio().contains("%autonum"))&&(!autopagenum.isNull())){
|
|
||||||
|
if ((m_diagrams_list[i]->border_and_titleblock.folio().contains("%autonum")) &&
|
||||||
|
(!autopagenum.isNull()))
|
||||||
|
{
|
||||||
m_diagrams_list[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties);
|
m_diagrams_list[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nCC.toRepresentedString(), project_wide_properties);
|
||||||
m_diagrams_list[i]->project()->addFolioAutoNum(autopagenum,nCC.next());
|
m_diagrams_list[i]->project()->addFolioAutoNum(autopagenum,nCC.next());
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
m_diagrams_list[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nullptr, project_wide_properties);
|
m_diagrams_list[i] -> border_and_titleblock.setFolioData(i + 1, total_folio, nullptr, project_wide_properties);
|
||||||
}
|
}
|
||||||
m_diagrams_list[i] -> update();
|
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
m_diagrams_list.at(i)->border_and_titleblock.setPreviousFolioNum(m_diagrams_list.at(i-1)->border_and_titleblock.finalfolio());
|
||||||
|
m_diagrams_list.at(i-1)->border_and_titleblock.setNextFolioNum(m_diagrams_list.at(i)->border_and_titleblock.finalfolio());
|
||||||
|
|
||||||
|
if (i == total_folio-1) {
|
||||||
|
m_diagrams_list.at(i)->border_and_titleblock.setNextFolioNum(QString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_diagrams_list.at(i)->border_and_titleblock.setPreviousFolioNum(QString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Diagram *d : m_diagrams_list) {
|
||||||
|
d->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,6 +444,8 @@ QString TitleBlockTemplateCellWidget::defaultVariablesString() const {
|
|||||||
"<li>%{folio} : numéro du folio</li>"
|
"<li>%{folio} : numéro du folio</li>"
|
||||||
"<li>%{folio-id} : position du folio dans le projet</li>"
|
"<li>%{folio-id} : position du folio dans le projet</li>"
|
||||||
"<li>%{folio-total} : nombre total de folios dans le projet</li>"
|
"<li>%{folio-total} : nombre total de folios dans le projet</li>"
|
||||||
|
"<li>%{previous-folio-num} : numéro du folio précédent</li>"
|
||||||
|
"<li>%{next-folio-num} : numéro du folio suivant</li>"
|
||||||
"<li>%{projecttitle} : titre du projet</li>"
|
"<li>%{projecttitle} : titre du projet</li>"
|
||||||
"<li>%{projectpath} : chemin du projet</li>"
|
"<li>%{projectpath} : chemin du projet</li>"
|
||||||
"<li>%{projectfilename} : nom du fichier</li>"
|
"<li>%{projectfilename} : nom du fichier</li>"
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
*/
|
*/
|
||||||
TitleBlockTemplateRenderer::TitleBlockTemplateRenderer(QObject *parent) :
|
TitleBlockTemplateRenderer::TitleBlockTemplateRenderer(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
titleblock_template_(nullptr),
|
m_titleblock_template(nullptr),
|
||||||
use_cache_(true),
|
m_use_cache(true),
|
||||||
last_known_titleblock_width_(-1)
|
m_last_known_titleblock_width(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,35 +23,44 @@ TitleBlockTemplateRenderer::~TitleBlockTemplateRenderer() {
|
|||||||
@return the titleblock template used for the rendering
|
@return the titleblock template used for the rendering
|
||||||
*/
|
*/
|
||||||
const TitleBlockTemplate *TitleBlockTemplateRenderer::titleBlockTemplate() const {
|
const TitleBlockTemplate *TitleBlockTemplateRenderer::titleBlockTemplate() const {
|
||||||
return(titleblock_template_);
|
return(m_titleblock_template);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param titleblock_template TitleBlock template to render.
|
@param titleblock_template TitleBlock template to render.
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplateRenderer::setTitleBlockTemplate(const TitleBlockTemplate *titleblock_template) {
|
void TitleBlockTemplateRenderer::setTitleBlockTemplate(const TitleBlockTemplate *titleblock_template) {
|
||||||
if (titleblock_template != titleblock_template_) {
|
if (titleblock_template != m_titleblock_template) {
|
||||||
titleblock_template_ = titleblock_template;
|
m_titleblock_template = titleblock_template;
|
||||||
invalidateRenderedTemplate();
|
invalidateRenderedTemplate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param context Diagram Context to use when rendering the titleblock
|
* @brief TitleBlockTemplateRenderer::setContext
|
||||||
*/
|
* @param context : Context to use when rendering the titleblock
|
||||||
|
*/
|
||||||
void TitleBlockTemplateRenderer::setContext(const DiagramContext &context) {
|
void TitleBlockTemplateRenderer::setContext(const DiagramContext &context) {
|
||||||
context_ = context;
|
m_context = context;
|
||||||
invalidateRenderedTemplate();
|
invalidateRenderedTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TitleBlockTemplateRenderer::context
|
||||||
|
* @return the current diagram context use when render the titleblock
|
||||||
|
*/
|
||||||
|
DiagramContext TitleBlockTemplateRenderer::context() const {
|
||||||
|
return m_context;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return the height of the rendered template, or -1 if no template has been
|
@return the height of the rendered template, or -1 if no template has been
|
||||||
set for this renderer.
|
set for this renderer.
|
||||||
@see TitleBlockTemplate::height()
|
@see TitleBlockTemplate::height()
|
||||||
*/
|
*/
|
||||||
int TitleBlockTemplateRenderer::height() const {
|
int TitleBlockTemplateRenderer::height() const {
|
||||||
if (!titleblock_template_) return(-1);
|
if (!m_titleblock_template) return(-1);
|
||||||
return(titleblock_template_ -> height());
|
return(m_titleblock_template -> height());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,26 +69,26 @@ int TitleBlockTemplateRenderer::height() const {
|
|||||||
@param titleblock_width The total width of the titleblock to render
|
@param titleblock_width The total width of the titleblock to render
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplateRenderer::render(QPainter *provided_painter, int titleblock_width) {
|
void TitleBlockTemplateRenderer::render(QPainter *provided_painter, int titleblock_width) {
|
||||||
if (!titleblock_template_) return;
|
if (!m_titleblock_template) return;
|
||||||
|
|
||||||
if (use_cache_) {
|
if (m_use_cache) {
|
||||||
// Do we really need to calculate all this again?
|
// Do we really need to calculate all this again?
|
||||||
if (titleblock_width != last_known_titleblock_width_ || rendered_template_.isNull()) {
|
if (titleblock_width != m_last_known_titleblock_width || m_rendered_template.isNull()) {
|
||||||
renderToQPicture(titleblock_width);
|
renderToQPicture(titleblock_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
provided_painter -> save();
|
provided_painter -> save();
|
||||||
rendered_template_.play(provided_painter);
|
m_rendered_template.play(provided_painter);
|
||||||
provided_painter -> restore();
|
provided_painter -> restore();
|
||||||
} else {
|
} else {
|
||||||
titleblock_template_ -> render(*provided_painter, context_, titleblock_width);
|
m_titleblock_template -> render(*provided_painter, m_context, titleblock_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TitleBlockTemplateRenderer::renderDxf(QRectF &title_block_rect, int titleblock_width, QString &file_path, int color) {
|
void TitleBlockTemplateRenderer::renderDxf(QRectF &title_block_rect, int titleblock_width, QString &file_path, int color) {
|
||||||
if (!titleblock_template_) return;
|
if (!m_titleblock_template) return;
|
||||||
titleblock_template_ -> renderDxf(title_block_rect, context_, titleblock_width, file_path, color);
|
m_titleblock_template -> renderDxf(title_block_rect, m_context, titleblock_width, file_path, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,15 +96,15 @@ void TitleBlockTemplateRenderer::renderDxf(QRectF &title_block_rect, int titlebl
|
|||||||
@param titleblock_width Width of the titleblock to render
|
@param titleblock_width Width of the titleblock to render
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplateRenderer::renderToQPicture(int titleblock_width) {
|
void TitleBlockTemplateRenderer::renderToQPicture(int titleblock_width) {
|
||||||
if (!titleblock_template_) return;
|
if (!m_titleblock_template) return;
|
||||||
|
|
||||||
// we render the template on our internal QPicture
|
// we render the template on our internal QPicture
|
||||||
QPainter painter(&rendered_template_);
|
QPainter painter(&m_rendered_template);
|
||||||
|
|
||||||
titleblock_template_ -> render(painter, context_, titleblock_width);
|
m_titleblock_template -> render(painter, m_context, titleblock_width);
|
||||||
|
|
||||||
// memorize the last known width
|
// memorize the last known width
|
||||||
last_known_titleblock_width_ = titleblock_width;
|
m_last_known_titleblock_width = titleblock_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,7 +112,7 @@ void TitleBlockTemplateRenderer::renderToQPicture(int titleblock_width) {
|
|||||||
QPicture.
|
QPicture.
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplateRenderer::invalidateRenderedTemplate() {
|
void TitleBlockTemplateRenderer::invalidateRenderedTemplate() {
|
||||||
rendered_template_ = QPicture();
|
m_rendered_template = QPicture();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,7 +120,7 @@ void TitleBlockTemplateRenderer::invalidateRenderedTemplate() {
|
|||||||
false otherwise.
|
false otherwise.
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplateRenderer::setUseCache(bool use_cache) {
|
void TitleBlockTemplateRenderer::setUseCache(bool use_cache) {
|
||||||
use_cache_ = use_cache;
|
m_use_cache = use_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,6 +128,6 @@ void TitleBlockTemplateRenderer::setUseCache(bool use_cache) {
|
|||||||
otherwise.
|
otherwise.
|
||||||
*/
|
*/
|
||||||
bool TitleBlockTemplateRenderer::useCache() const {
|
bool TitleBlockTemplateRenderer::useCache() const {
|
||||||
return(use_cache_);
|
return(m_use_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,31 +19,38 @@
|
|||||||
#define TITLEBLOCK_TEMPLATE_RENDERER_H
|
#define TITLEBLOCK_TEMPLATE_RENDERER_H
|
||||||
#include <QPicture>
|
#include <QPicture>
|
||||||
#include "diagramcontext.h"
|
#include "diagramcontext.h"
|
||||||
|
|
||||||
class TitleBlockTemplate;
|
class TitleBlockTemplate;
|
||||||
class TitleBlockTemplateRenderer : public QObject {
|
|
||||||
|
class TitleBlockTemplateRenderer : public QObject
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TitleBlockTemplateRenderer(QObject * = nullptr);
|
TitleBlockTemplateRenderer(QObject * = nullptr);
|
||||||
~TitleBlockTemplateRenderer() override;
|
~TitleBlockTemplateRenderer() override;
|
||||||
const TitleBlockTemplate *titleBlockTemplate() const;
|
|
||||||
void setTitleBlockTemplate(const TitleBlockTemplate *);
|
const TitleBlockTemplate *titleBlockTemplate() const;
|
||||||
void setContext(const DiagramContext &context);
|
void setTitleBlockTemplate(const TitleBlockTemplate *);
|
||||||
int height() const;
|
|
||||||
void render(QPainter *, int);
|
void setContext(const DiagramContext &context);
|
||||||
void renderDxf(QRectF &, int, QString &, int);
|
DiagramContext context()const;
|
||||||
void invalidateRenderedTemplate();
|
|
||||||
void setUseCache(bool);
|
int height() const;
|
||||||
bool useCache() const;
|
void render(QPainter *, int);
|
||||||
|
void renderDxf(QRectF &, int, QString &, int);
|
||||||
|
void invalidateRenderedTemplate();
|
||||||
|
void setUseCache(bool);
|
||||||
|
bool useCache() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void renderToQPicture(int);
|
void renderToQPicture(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const TitleBlockTemplate *titleblock_template_;
|
const TitleBlockTemplate *m_titleblock_template;
|
||||||
bool use_cache_;
|
bool m_use_cache;
|
||||||
QPicture rendered_template_;
|
QPicture m_rendered_template;
|
||||||
DiagramContext context_;
|
DiagramContext m_context;
|
||||||
int last_known_titleblock_width_;
|
int m_last_known_titleblock_width;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user