2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2020-06-15 17:42:37 +02:00
|
|
|
Copyright 2006-2020 The QElectroTech Team
|
2007-12-01 10:47:15 +00:00
|
|
|
This file is part of QElectroTech.
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2007-12-01 10:47:15 +00:00
|
|
|
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.
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2007-12-01 10:47:15 +00:00
|
|
|
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.
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2007-12-01 10:47:15 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
#include "bordertitleblock.h"
|
2020-12-08 19:57:35 +01:00
|
|
|
|
2014-01-08 16:55:16 +00:00
|
|
|
#include "createdxf.h"
|
2015-03-16 13:29:27 +00:00
|
|
|
#include "diagram.h"
|
2020-12-08 19:57:35 +01:00
|
|
|
#include "diagramposition.h"
|
|
|
|
#include "math.h"
|
|
|
|
#include "qetapp.h"
|
|
|
|
#include "titleblocktemplate.h"
|
|
|
|
#include "titleblocktemplaterenderer.h"
|
|
|
|
|
|
|
|
#include <QLocale>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <utility>
|
2015-03-16 13:29:27 +00:00
|
|
|
|
|
|
|
#define MIN_COLUMN_COUNT 3
|
|
|
|
#define MIN_ROW_COUNT 3
|
|
|
|
#define MIN_COLUMN_WIDTH 5.0
|
|
|
|
#define MIN_ROW_HEIGHT 5.0
|
2007-01-28 00:53:17 +00:00
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::BorderTitleBlock
|
|
|
|
Simple constructor:
|
|
|
|
build a border by recovering the dimensions
|
|
|
|
in the application configuration.
|
|
|
|
|
|
|
|
\~French Constructeur simple :
|
|
|
|
construit une bordure en recuperant les dimensions
|
2008-08-10 15:07:59 +00:00
|
|
|
dans la configuration de l'application.
|
2020-07-16 21:02:34 +02:00
|
|
|
\~ @param parent :
|
|
|
|
\~French QObject parent de ce BorderTitleBlock
|
2007-01-28 00:53:17 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
BorderTitleBlock::BorderTitleBlock(QObject *parent) :
|
2010-12-19 18:12:56 +00:00
|
|
|
QObject(parent)
|
|
|
|
{
|
2010-12-20 02:45:36 +00:00
|
|
|
// at first, the internal titleblock template renderer uses the default titleblock template
|
2020-04-12 18:51:38 +02:00
|
|
|
m_titleblock_template_renderer = new TitleBlockTemplateRenderer(this);
|
|
|
|
m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2012-02-26 21:54:47 +00:00
|
|
|
// disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes
|
2020-09-18 23:04:17 +02:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0) // ### Qt 6: remove
|
|
|
|
#else
|
|
|
|
m_titleblock_template_renderer -> setUseCache(false);
|
|
|
|
#endif
|
|
|
|
|
2008-08-14 22:51:08 +00:00
|
|
|
// dimensions par defaut du schema
|
2009-04-03 19:30:25 +00:00
|
|
|
importBorder(BorderProperties());
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2008-08-15 12:46:22 +00:00
|
|
|
// contenu par defaut du cartouche
|
2010-12-20 02:45:36 +00:00
|
|
|
importTitleBlock(TitleBlockProperties());
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2015-03-16 13:29:27 +00:00
|
|
|
display_titleblock_ = true;
|
|
|
|
display_border_ = true;
|
2009-04-03 19:30:25 +00:00
|
|
|
setFolioData(1, 1);
|
2007-01-28 00:53:17 +00:00
|
|
|
updateRectangles();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::~BorderTitleBlock
|
|
|
|
\~French Destructeur - ne fait rien
|
2007-01-28 00:53:17 +00:00
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
BorderTitleBlock::~BorderTitleBlock()
|
|
|
|
{
|
2007-01-28 00:53:17 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 15:07:59 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::titleBlockRect
|
|
|
|
@return the rectangle of the titleblock in scene coordinate.
|
|
|
|
*/
|
2015-03-16 13:29:27 +00:00
|
|
|
QRectF BorderTitleBlock::titleBlockRect() const
|
|
|
|
{
|
|
|
|
if (m_edge == Qt::BottomEdge)
|
2020-07-16 21:02:34 +02:00
|
|
|
return QRectF(diagram_rect_.bottomLeft(),
|
|
|
|
QSize(diagram_rect_.width(),
|
|
|
|
m_titleblock_template_renderer -> height()
|
|
|
|
));
|
2015-03-16 13:29:27 +00:00
|
|
|
else
|
2020-07-16 21:02:34 +02:00
|
|
|
return QRectF(diagram_rect_.topRight(),
|
|
|
|
QSize(m_titleblock_template_renderer -> height(),
|
|
|
|
diagram_rect_.height()
|
|
|
|
));
|
2020-04-12 18:51:38 +02:00
|
|
|
}
|
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
/**
|
|
|
|
@brief BorderTitleBlock::titleblockInformation
|
|
|
|
@return
|
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
DiagramContext BorderTitleBlock::titleblockInformation() const
|
|
|
|
{
|
2020-04-12 18:51:38 +02:00
|
|
|
return m_titleblock_template_renderer->context();
|
2015-03-16 13:29:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::titleBlockRectForQPainter
|
|
|
|
@return The title block rect to use with the QPainter in the method draw.
|
|
|
|
The returned rect is alway horizontal
|
|
|
|
(like displayed at the bottom of rect) only the top left change of pos
|
|
|
|
according to the edge where the title block need to be displayed.
|
|
|
|
Rect according to edge:
|
|
|
|
Bottom : top left is at the bottom left edge of the diagram rect.
|
|
|
|
Right : top left is at the bottom right of diagram rect.
|
|
|
|
Befor use this rect you need to rotate the QPainter by -90°
|
|
|
|
for snap the rect at the right edge of diagram.
|
|
|
|
*/
|
2015-03-16 13:29:27 +00:00
|
|
|
QRectF BorderTitleBlock::titleBlockRectForQPainter() const
|
|
|
|
{
|
2020-07-16 21:02:34 +02:00
|
|
|
//Rect at bottom have same position and dimension of displayed rect
|
|
|
|
if (m_edge == Qt::BottomEdge)
|
2015-03-16 13:29:27 +00:00
|
|
|
return titleBlockRect();
|
|
|
|
else
|
2020-07-16 21:02:34 +02:00
|
|
|
return QRectF (diagram_rect_.bottomRight(),
|
|
|
|
QSize(diagram_rect_.height(),
|
|
|
|
m_titleblock_template_renderer -> height()
|
|
|
|
));
|
2015-03-16 13:29:27 +00:00
|
|
|
|
2008-08-10 15:07:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::borderAndTitleBlockRect
|
|
|
|
@return the bounding rectangle of diagram and titleblock.
|
|
|
|
It's like unite outsideBorderRect and titleBlockRect.
|
|
|
|
The rect is in scene coordinate
|
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
QRectF BorderTitleBlock::borderAndTitleBlockRect() const
|
|
|
|
{
|
2015-03-16 13:29:27 +00:00
|
|
|
return diagram_rect_ | titleBlockRect();
|
2008-08-10 15:07:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::columnsRect
|
|
|
|
@return The columns rect in scene coordinate.
|
|
|
|
If column is not displayed, return a null QRectF
|
|
|
|
*/
|
2015-03-18 18:07:18 +00:00
|
|
|
QRectF BorderTitleBlock::columnsRect() const
|
|
|
|
{
|
|
|
|
if (!display_columns_) return QRectF();
|
2020-07-16 21:02:34 +02:00
|
|
|
return QRectF (Diagram::margin,
|
|
|
|
Diagram::margin,
|
|
|
|
(columns_count_*columns_width_) + rows_header_width_,
|
|
|
|
columns_header_height_);
|
2015-03-18 18:07:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::rowsRect
|
|
|
|
@return The rows rect in scene coordinate.
|
|
|
|
If row is not displayed, return a null QRectF
|
|
|
|
*/
|
2015-03-18 18:07:18 +00:00
|
|
|
QRectF BorderTitleBlock::rowsRect() const
|
|
|
|
{
|
|
|
|
if (!display_rows_) return QRectF();
|
2020-07-16 21:02:34 +02:00
|
|
|
return QRectF (Diagram::margin,
|
|
|
|
Diagram::margin,
|
|
|
|
rows_header_width_,
|
|
|
|
(rows_count_*rows_height_) + columns_header_height_);
|
2015-03-18 18:07:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::outsideBorderRect
|
|
|
|
@return The rect of outside border (diagram with columns and rows)
|
|
|
|
The rect is in scene coordinate
|
|
|
|
*/
|
2015-03-18 18:07:18 +00:00
|
|
|
QRectF BorderTitleBlock::outsideBorderRect() const
|
|
|
|
{
|
2020-07-16 21:02:34 +02:00
|
|
|
return QRectF (Diagram::margin,
|
|
|
|
Diagram::margin,
|
|
|
|
(columns_width_*columns_count_) + rows_header_width_,
|
|
|
|
(rows_height_*rows_count_) + columns_header_height_);
|
2008-08-10 15:07:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::insideBorderRect
|
|
|
|
@return The rect of the inside border, in other word, the drawing area.
|
|
|
|
This method take care about if rows or columns are displayed or not.
|
|
|
|
The rect is in scene coordinate
|
|
|
|
*/
|
2015-03-18 18:07:18 +00:00
|
|
|
QRectF BorderTitleBlock::insideBorderRect() const
|
|
|
|
{
|
|
|
|
qreal left = Diagram::margin;
|
|
|
|
qreal top = Diagram::margin;
|
|
|
|
qreal width = columns_width_*columns_count_;
|
|
|
|
qreal height = rows_height_*rows_count_;
|
|
|
|
|
|
|
|
display_rows_ ? left += rows_header_width_ : width += rows_header_width_;
|
|
|
|
display_columns_ ? top += columns_header_height_ : height += columns_header_height_;
|
|
|
|
|
|
|
|
return QRectF (left, top, width, height);
|
2008-08-10 15:07:59 +00:00
|
|
|
}
|
|
|
|
|
2011-01-09 00:01:38 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::titleBlockToXml
|
2011-01-09 00:01:38 +00:00
|
|
|
Exports the title block current values to XML.
|
|
|
|
@param xml_elmt the XML element attributes will be added to
|
|
|
|
*/
|
|
|
|
void BorderTitleBlock::titleBlockToXml(QDomElement &xml_elmt) {
|
2011-01-09 15:16:51 +00:00
|
|
|
exportTitleBlock().toXml(xml_elmt);
|
2011-01-09 00:01:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::titleBlockFromXml
|
2011-01-09 00:01:38 +00:00
|
|
|
Reads the title block values from XML.
|
|
|
|
@param xml_elmt the XML element values will be read from
|
|
|
|
*/
|
|
|
|
void BorderTitleBlock::titleBlockFromXml(const QDomElement &xml_elmt) {
|
2011-01-09 15:16:51 +00:00
|
|
|
TitleBlockProperties tbp;
|
|
|
|
tbp.fromXml(xml_elmt);
|
|
|
|
importTitleBlock(tbp);
|
2011-01-09 00:01:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::borderToXml
|
2011-01-09 00:01:38 +00:00
|
|
|
Exports the border current settings to XML.
|
|
|
|
@param xml_elmt the XML element attributes will be added to
|
|
|
|
*/
|
|
|
|
void BorderTitleBlock::borderToXml(QDomElement &xml_elmt) {
|
2012-11-09 21:09:24 +00:00
|
|
|
xml_elmt.setAttribute("cols", columnsCount());
|
2011-01-09 00:01:38 +00:00
|
|
|
xml_elmt.setAttribute("colsize", QString("%1").arg(columnsWidth()));
|
|
|
|
xml_elmt.setAttribute("displaycols", columnsAreDisplayed() ? "true" : "false");
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
xml_elmt.setAttribute("rows", rowsCount());
|
2011-01-09 00:01:38 +00:00
|
|
|
xml_elmt.setAttribute("rowsize", QString("%1").arg(rowsHeight()));
|
|
|
|
xml_elmt.setAttribute("displayrows", rowsAreDisplayed() ? "true" : "false");
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2011-01-09 00:01:38 +00:00
|
|
|
// attribut datant de la version 0.1 - laisse pour retrocompatibilite
|
|
|
|
xml_elmt.setAttribute("height", QString("%1").arg(diagramHeight()));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::borderFromXml
|
2011-01-09 00:01:38 +00:00
|
|
|
Reads the border settings from XML.
|
|
|
|
@param xml_elmt the XML element values will be read from
|
|
|
|
*/
|
|
|
|
void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) {
|
|
|
|
bool ok;
|
|
|
|
// columns count
|
|
|
|
int cols_count = xml_elmt.attribute("cols").toInt(&ok);
|
2012-11-09 21:09:24 +00:00
|
|
|
if (ok) setColumnsCount(cols_count);
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2011-01-09 00:01:38 +00:00
|
|
|
// columns width
|
|
|
|
double cols_width = xml_elmt.attribute("colsize").toDouble(&ok);
|
|
|
|
if (ok) setColumnsWidth(cols_width);
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
// backward compatibility:
|
|
|
|
// diagrams saved with 0.1 version have a "height" attribute
|
2011-01-09 00:01:38 +00:00
|
|
|
if (xml_elmt.hasAttribute("rows") && xml_elmt.hasAttribute("rowsize")) {
|
|
|
|
// rows counts
|
|
|
|
int rows_count = xml_elmt.attribute("rows").toInt(&ok);
|
2012-11-09 21:09:24 +00:00
|
|
|
if (ok) setRowsCount(rows_count);
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2011-01-09 00:01:38 +00:00
|
|
|
// taille des lignes
|
|
|
|
double rows_size = xml_elmt.attribute("rowsize").toDouble(&ok);
|
|
|
|
if (ok) setRowsHeight(rows_size);
|
|
|
|
} else {
|
|
|
|
// hauteur du schema
|
|
|
|
double height = xml_elmt.attribute("height").toDouble(&ok);
|
|
|
|
if (ok) setDiagramHeight(height);
|
|
|
|
}
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2011-01-09 00:01:38 +00:00
|
|
|
// rows and columns display
|
|
|
|
displayColumns(xml_elmt.attribute("displaycols") != "false");
|
|
|
|
displayRows(xml_elmt.attribute("displayrows") != "false");
|
2015-03-16 13:29:27 +00:00
|
|
|
|
|
|
|
updateRectangles();
|
2011-01-09 00:01:38 +00:00
|
|
|
}
|
|
|
|
|
2008-08-14 22:51:08 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::exportTitleBlock
|
|
|
|
@return the properties of the titleblock
|
|
|
|
\~French les proprietes du cartouches
|
2008-08-14 22:51:08 +00:00
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
TitleBlockProperties BorderTitleBlock::exportTitleBlock()
|
|
|
|
{
|
2010-12-20 02:45:36 +00:00
|
|
|
TitleBlockProperties ip;
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2011-01-09 15:16:51 +00:00
|
|
|
ip.author = author();
|
|
|
|
ip.date = date();
|
|
|
|
ip.title = title();
|
|
|
|
ip.filename = fileName();
|
2018-12-04 22:33:11 +00:00
|
|
|
ip.plant = plant();
|
2018-12-01 12:55:05 +00:00
|
|
|
ip.locmach = locmach();
|
2016-08-11 18:32:08 +00:00
|
|
|
ip.indexrev = indexrev();
|
2016-08-10 12:25:47 +00:00
|
|
|
ip.version = version();
|
2011-01-09 15:16:51 +00:00
|
|
|
ip.folio = folio();
|
2010-12-24 23:35:40 +00:00
|
|
|
ip.template_name = titleBlockTemplateName();
|
2015-03-16 13:29:27 +00:00
|
|
|
ip.display_at = m_edge;
|
2016-08-10 12:25:47 +00:00
|
|
|
ip.auto_page_num = autoPageNum();
|
2011-01-09 15:16:51 +00:00
|
|
|
ip.context = additional_fields_;
|
2015-04-25 08:54:54 +00:00
|
|
|
ip.collection = QET::QetCollection::Embedded;
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2008-08-14 22:51:08 +00:00
|
|
|
return(ip);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::importTitleBlock
|
|
|
|
@param ip the new properties of titleblock
|
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
|
2011-01-09 15:16:51 +00:00
|
|
|
setAuthor(ip.author);
|
|
|
|
setDate(ip.date);
|
2009-04-03 19:30:25 +00:00
|
|
|
setTitle(ip.title);
|
2011-01-09 15:16:51 +00:00
|
|
|
setFileName(ip.filename);
|
2018-12-04 22:33:11 +00:00
|
|
|
setPlant(ip.plant);
|
2016-08-12 11:32:56 +00:00
|
|
|
setLocMach(ip.locmach);
|
2016-08-11 18:32:08 +00:00
|
|
|
setIndicerev(ip.indexrev);
|
2016-08-10 12:25:47 +00:00
|
|
|
setVersion(QET::displayedVersion);
|
2011-01-09 15:16:51 +00:00
|
|
|
setFolio(ip.folio);
|
2016-07-13 14:57:27 +00:00
|
|
|
setAutoPageNum(ip.auto_page_num);
|
2015-03-16 13:29:27 +00:00
|
|
|
if (m_edge != ip.display_at)
|
|
|
|
{
|
|
|
|
m_edge = ip.display_at;
|
|
|
|
emit(displayChanged());
|
|
|
|
}
|
2011-01-09 15:16:51 +00:00
|
|
|
additional_fields_ = ip.context;
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2012-07-01 21:54:07 +00:00
|
|
|
emit(needFolioData()); // Note: we expect additional data to be provided
|
2020-07-16 21:02:34 +02:00
|
|
|
// through setFolioData(),
|
|
|
|
// which in turn calls updateDiagramContextForTitleBlock().
|
2010-12-24 23:35:40 +00:00
|
|
|
emit(needTitleBlockTemplate(ip.template_name));
|
2008-08-14 22:51:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::exportBorder
|
|
|
|
@return border properties
|
|
|
|
\~French les proprietes de la bordure
|
2008-08-14 22:51:08 +00:00
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
BorderProperties BorderTitleBlock::exportBorder()
|
|
|
|
{
|
2008-08-14 22:51:08 +00:00
|
|
|
BorderProperties bp;
|
2012-11-09 21:09:24 +00:00
|
|
|
bp.columns_count = columnsCount();
|
2008-08-14 22:51:08 +00:00
|
|
|
bp.columns_width = columnsWidth();
|
|
|
|
bp.columns_header_height = columnsHeaderHeight();
|
|
|
|
bp.display_columns = columnsAreDisplayed();
|
2012-11-09 21:09:24 +00:00
|
|
|
bp.rows_count = rowsCount();
|
2008-08-14 22:51:08 +00:00
|
|
|
bp.rows_height = rowsHeight();
|
|
|
|
bp.rows_header_width = rowsHeaderWidth();
|
|
|
|
bp.display_rows = rowsAreDisplayed();
|
|
|
|
return(bp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::importBorder
|
|
|
|
@param bp : the new properties of the border
|
|
|
|
\~French les nouvelles proprietes de la bordure
|
2008-08-14 22:51:08 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::importBorder(const BorderProperties &bp) {
|
2008-08-14 22:51:08 +00:00
|
|
|
setColumnsHeaderHeight(bp.columns_header_height);
|
2012-11-09 21:09:24 +00:00
|
|
|
setColumnsCount(bp.columns_count);
|
2008-08-14 22:51:08 +00:00
|
|
|
setColumnsWidth(bp.columns_width);
|
|
|
|
displayColumns(bp.display_columns);
|
|
|
|
setRowsHeaderWidth(bp.rows_header_width);
|
2012-11-09 21:09:24 +00:00
|
|
|
setRowsCount(bp.rows_count);
|
2008-08-14 22:51:08 +00:00
|
|
|
setRowsHeight(bp.rows_height);
|
|
|
|
displayRows(bp.display_rows);
|
|
|
|
}
|
|
|
|
|
2010-12-19 18:12:56 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::titleBlockTemplate
|
2010-12-20 02:45:36 +00:00
|
|
|
@return the titleblock template used to render the titleblock
|
|
|
|
@see TitleBlockTemplateRenderer::titleBlockTemplate()
|
2010-12-19 18:12:56 +00:00
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate()
|
|
|
|
{
|
2020-04-12 18:51:38 +02:00
|
|
|
return(m_titleblock_template_renderer -> titleBlockTemplate());
|
2010-12-19 18:12:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setTitleBlockTemplate
|
|
|
|
@param titleblock_template:
|
|
|
|
The new titleblock template to use to render the titleblock
|
2010-12-20 02:45:36 +00:00
|
|
|
@see TitleBlockTemplateRenderer::setTitleBlockTemplate()
|
2010-12-19 18:12:56 +00:00
|
|
|
*/
|
2020-07-16 21:02:34 +02:00
|
|
|
void BorderTitleBlock::setTitleBlockTemplate(
|
|
|
|
const TitleBlockTemplate *titleblock_template) {
|
|
|
|
m_titleblock_template_renderer -> setTitleBlockTemplate(
|
|
|
|
titleblock_template);
|
2010-12-19 18:12:56 +00:00
|
|
|
}
|
|
|
|
|
2010-12-24 23:35:40 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::titleBlockTemplateName
|
2010-12-24 23:35:40 +00:00
|
|
|
@return The name of the template used to render the titleblock.
|
|
|
|
*/
|
2020-09-07 22:03:40 +02:00
|
|
|
QString BorderTitleBlock::titleBlockTemplateName() const
|
|
|
|
{
|
2020-04-12 18:51:38 +02:00
|
|
|
QString tbt_name = m_titleblock_template_renderer -> titleBlockTemplate() -> name();
|
2010-12-24 23:35:40 +00:00
|
|
|
return((tbt_name == "default") ? "" : tbt_name);
|
|
|
|
}
|
|
|
|
|
2010-12-24 21:00:11 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::titleBlockTemplateChanged
|
2010-12-24 21:00:11 +00:00
|
|
|
This slot may be used to inform this class that the given title block
|
2020-07-16 21:02:34 +02:00
|
|
|
template has changed.
|
|
|
|
The title block-dedicated rendering cache will thus be flushed.
|
|
|
|
@param template_name : Name of the title block template that has changed
|
2010-12-24 21:00:11 +00:00
|
|
|
*/
|
|
|
|
void BorderTitleBlock::titleBlockTemplateChanged(const QString &template_name) {
|
2010-12-24 23:35:40 +00:00
|
|
|
if (titleBlockTemplateName() != template_name) return;
|
2020-04-12 18:51:38 +02:00
|
|
|
m_titleblock_template_renderer -> invalidateRenderedTemplate();
|
2010-12-24 21:00:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::titleBlockTemplateRemoved
|
2010-12-24 21:00:11 +00:00
|
|
|
This slot has to be used to inform this class that the given title block
|
|
|
|
template is about to be removed and is no longer accessible. This class
|
|
|
|
will either use the provided optional TitleBlockTemplate or the default
|
|
|
|
title block provided by QETApp::defaultTitleBlockTemplate()
|
2020-07-16 21:02:34 +02:00
|
|
|
@param removed_template_name :
|
|
|
|
Name of the title block template that has changed
|
2010-12-24 21:00:11 +00:00
|
|
|
@param new_template (Optional) title block template to use instead
|
|
|
|
*/
|
2020-07-16 21:02:34 +02:00
|
|
|
void BorderTitleBlock::titleBlockTemplateRemoved(
|
|
|
|
const QString &removed_template_name,
|
|
|
|
const TitleBlockTemplate *new_template) {
|
2010-12-24 23:35:40 +00:00
|
|
|
if (titleBlockTemplateName() != removed_template_name) return;
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2010-12-24 21:00:11 +00:00
|
|
|
if (new_template) {
|
|
|
|
setTitleBlockTemplate(new_template);
|
|
|
|
} else {
|
|
|
|
setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-15 12:46:22 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::displayTitleBlock
|
|
|
|
@param di : true to display the title block, false otherwise
|
|
|
|
\~French true pour afficher le cartouche, false sinon
|
2008-08-15 12:46:22 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::displayTitleBlock(bool di) {
|
2012-11-09 21:09:24 +00:00
|
|
|
bool change = (di != display_titleblock_);
|
|
|
|
display_titleblock_ = di;
|
2008-08-15 12:46:22 +00:00
|
|
|
if (change) emit(displayChanged());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::displayColumns
|
|
|
|
@param dc : true to display the column headers, false otherwise
|
|
|
|
\~French true pour afficher les entetes des colonnes, false sinon
|
2008-08-15 12:46:22 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::displayColumns(bool dc) {
|
2012-11-09 21:09:24 +00:00
|
|
|
bool change = (dc != display_columns_);
|
|
|
|
display_columns_ = dc;
|
2008-08-15 12:46:22 +00:00
|
|
|
if (change) emit(displayChanged());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::displayRows
|
|
|
|
@param dr : true to display line headers, false otherwise
|
|
|
|
\~French true pour afficher les entetes des lignes, false sinon
|
2008-08-15 12:46:22 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::displayRows(bool dr) {
|
2012-11-09 21:09:24 +00:00
|
|
|
bool change = (dr != display_rows_);
|
|
|
|
display_rows_ = dr;
|
2008-08-15 12:46:22 +00:00
|
|
|
if (change) emit(displayChanged());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::displayBorder
|
|
|
|
@param db : true to display the border of the diagram, false otherwise
|
|
|
|
\~French true pour afficher la bordure du schema, false sinon
|
|
|
|
\~ @note : if the border display is deactivated,
|
|
|
|
the rows and columns will not be drawn.
|
|
|
|
\~French si l'affichage de la bordure est ainsi desactivee,
|
|
|
|
les lignes et colonnes ne seront pas dessinees.
|
2008-08-15 12:46:22 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::displayBorder(bool db) {
|
2012-11-09 21:09:24 +00:00
|
|
|
bool change = (db != display_border_);
|
|
|
|
display_border_ = db;
|
2008-08-15 12:46:22 +00:00
|
|
|
if (change) emit(displayChanged());
|
|
|
|
}
|
|
|
|
|
2016-07-13 14:57:27 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::slot_setAutoPageNum
|
|
|
|
@param pageAutoNum :
|
|
|
|
Set Page (Folio) Auto Num
|
|
|
|
*/
|
2016-07-13 14:57:27 +00:00
|
|
|
void BorderTitleBlock::slot_setAutoPageNum(QString pageAutoNum) {
|
2018-07-19 14:14:31 +00:00
|
|
|
btb_auto_page_num_=std::move(pageAutoNum);
|
2016-07-13 14:57:27 +00:00
|
|
|
}
|
|
|
|
|
2007-01-28 00:53:17 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::updateRectangles
|
|
|
|
This method update the diagram rect according
|
|
|
|
to the value of rows and columns (number and size)
|
|
|
|
*/
|
2015-03-16 13:29:27 +00:00
|
|
|
void BorderTitleBlock::updateRectangles()
|
|
|
|
{
|
2012-11-09 21:09:24 +00:00
|
|
|
QRectF previous_diagram = diagram_rect_;
|
2020-07-16 21:02:34 +02:00
|
|
|
diagram_rect_ = QRectF(Diagram::margin,
|
|
|
|
Diagram::margin,
|
|
|
|
diagramWidth(),
|
|
|
|
diagramHeight());
|
|
|
|
if (diagram_rect_ != previous_diagram)
|
|
|
|
emit(borderChanged(previous_diagram, diagram_rect_));
|
2007-01-28 00:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::draw
|
|
|
|
Draw the border and the titleblock.
|
2020-08-20 21:57:35 +02:00
|
|
|
@param painter : QPainter to use for draw this.
|
2020-07-16 21:02:34 +02:00
|
|
|
*/
|
2015-03-16 13:29:27 +00:00
|
|
|
void BorderTitleBlock::draw(QPainter *painter)
|
|
|
|
{
|
2020-07-16 21:02:34 +02:00
|
|
|
//Set the QPainter
|
2015-03-16 13:29:27 +00:00
|
|
|
painter -> save();
|
|
|
|
QPen pen(Qt::black);
|
|
|
|
pen.setCosmetic(true);
|
|
|
|
painter -> setPen(pen);
|
|
|
|
painter -> setBrush(Qt::NoBrush);
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2018-09-22 10:39:36 +00:00
|
|
|
QSettings settings;
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
//Draw the borer
|
2015-03-16 13:29:27 +00:00
|
|
|
if (display_border_) painter -> drawRect(diagram_rect_);
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2015-03-16 13:29:27 +00:00
|
|
|
painter -> setFont(QETApp::diagramTextsFont());
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
//Draw the empty case at the top left of diagram when there is header
|
2015-06-28 12:37:10 +00:00
|
|
|
if (display_border_ && (display_columns_ || display_rows_))
|
|
|
|
{
|
2008-08-10 15:07:59 +00:00
|
|
|
QRectF first_rectangle(
|
2012-11-09 21:09:24 +00:00
|
|
|
diagram_rect_.topLeft().x(),
|
|
|
|
diagram_rect_.topLeft().y(),
|
|
|
|
rows_header_width_,
|
|
|
|
columns_header_height_
|
2008-08-10 15:07:59 +00:00
|
|
|
);
|
2015-03-16 13:29:27 +00:00
|
|
|
painter -> drawRect(first_rectangle);
|
2008-08-10 15:07:59 +00:00
|
|
|
}
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2015-03-16 13:29:27 +00:00
|
|
|
//Draw the nums of columns
|
2012-11-09 21:09:24 +00:00
|
|
|
if (display_border_ && display_columns_) {
|
|
|
|
for (int i = 1 ; i <= columns_count_ ; ++ i) {
|
2007-02-01 01:07:26 +00:00
|
|
|
QRectF numbered_rectangle = QRectF(
|
2020-07-16 21:02:34 +02:00
|
|
|
diagram_rect_.topLeft().x()
|
|
|
|
+ (rows_header_width_
|
|
|
|
+ ((i - 1) * columns_width_)),
|
2012-11-09 21:09:24 +00:00
|
|
|
diagram_rect_.topLeft().y(),
|
|
|
|
columns_width_,
|
|
|
|
columns_header_height_
|
2007-02-01 01:07:26 +00:00
|
|
|
);
|
2015-03-16 13:29:27 +00:00
|
|
|
painter -> drawRect(numbered_rectangle);
|
2018-09-22 10:39:36 +00:00
|
|
|
if (settings.value("border-columns_0", true).toBool()){
|
2020-07-16 21:02:34 +02:00
|
|
|
painter -> drawText(numbered_rectangle,
|
|
|
|
Qt::AlignVCenter
|
|
|
|
| Qt::AlignCenter,
|
|
|
|
QString("%1").arg(i - 1));
|
2018-09-22 10:39:36 +00:00
|
|
|
}else{
|
2020-07-16 21:02:34 +02:00
|
|
|
painter -> drawText(numbered_rectangle,
|
|
|
|
Qt::AlignVCenter
|
|
|
|
| Qt::AlignCenter,
|
|
|
|
QString("%1").arg(i));
|
2018-09-22 10:39:36 +00:00
|
|
|
}
|
2007-02-01 01:07:26 +00:00
|
|
|
}
|
2007-01-28 00:53:17 +00:00
|
|
|
}
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2015-03-16 13:29:27 +00:00
|
|
|
//Draw the nums of rows
|
2012-11-09 21:09:24 +00:00
|
|
|
if (display_border_ && display_rows_) {
|
2008-08-10 15:07:59 +00:00
|
|
|
QString row_string("A");
|
2012-11-09 21:09:24 +00:00
|
|
|
for (int i = 1 ; i <= rows_count_ ; ++ i) {
|
2008-08-10 15:07:59 +00:00
|
|
|
QRectF lettered_rectangle = QRectF(
|
2012-11-09 21:09:24 +00:00
|
|
|
diagram_rect_.topLeft().x(),
|
2020-07-16 21:02:34 +02:00
|
|
|
diagram_rect_.topLeft().y()
|
|
|
|
+ (
|
|
|
|
columns_header_height_
|
|
|
|
+ ((i - 1)* rows_height_)
|
|
|
|
),
|
2012-11-09 21:09:24 +00:00
|
|
|
rows_header_width_,
|
|
|
|
rows_height_
|
2008-08-10 15:07:59 +00:00
|
|
|
);
|
2015-03-16 13:29:27 +00:00
|
|
|
painter -> drawRect(lettered_rectangle);
|
2020-07-16 21:02:34 +02:00
|
|
|
painter -> drawText(lettered_rectangle,
|
|
|
|
Qt::AlignVCenter
|
|
|
|
| Qt::AlignCenter,
|
|
|
|
row_string);
|
2008-08-10 15:07:59 +00:00
|
|
|
row_string = incrementLetters(row_string);
|
|
|
|
}
|
|
|
|
}
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2015-03-16 13:29:27 +00:00
|
|
|
// render the titleblock, using the TitleBlockTemplate object
|
2012-11-09 21:09:24 +00:00
|
|
|
if (display_titleblock_) {
|
2015-03-16 13:29:27 +00:00
|
|
|
QRectF tbt_rect = titleBlockRectForQPainter();
|
|
|
|
if (m_edge == Qt::BottomEdge)
|
|
|
|
{
|
|
|
|
painter -> translate(tbt_rect.topLeft());
|
2020-07-16 21:02:34 +02:00
|
|
|
m_titleblock_template_renderer -> render(
|
|
|
|
painter,
|
|
|
|
tbt_rect.width());
|
2015-03-16 13:29:27 +00:00
|
|
|
painter -> translate(-tbt_rect.topLeft());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
painter->translate(tbt_rect.topLeft());
|
|
|
|
painter->rotate(-90);
|
2020-07-16 21:02:34 +02:00
|
|
|
m_titleblock_template_renderer -> render(
|
|
|
|
painter,
|
|
|
|
tbt_rect.width());
|
2015-03-16 13:29:27 +00:00
|
|
|
painter->rotate(90);
|
|
|
|
painter -> translate(-tbt_rect.topLeft());
|
|
|
|
}
|
2007-02-01 01:07:26 +00:00
|
|
|
}
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2015-03-16 13:29:27 +00:00
|
|
|
painter -> restore();
|
2007-01-28 00:53:17 +00:00
|
|
|
}
|
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief BorderTitleBlock::drawDxf
|
|
|
|
@param file_path
|
|
|
|
@param color
|
|
|
|
*/
|
2020-07-16 21:02:34 +02:00
|
|
|
void BorderTitleBlock::drawDxf(
|
|
|
|
QString &file_path,
|
2020-09-04 23:00:32 +02:00
|
|
|
int color)
|
|
|
|
{
|
2014-01-08 16:55:16 +00:00
|
|
|
// Transform to DXF scale.
|
|
|
|
columns_header_height_ *= Createdxf::yScale;
|
|
|
|
rows_height_ *= Createdxf::yScale;
|
|
|
|
rows_header_width_ *= Createdxf::xScale;
|
|
|
|
columns_width_ *= Createdxf::xScale;
|
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
// draw the empty box that appears as soon as there is a header
|
2014-01-08 16:55:16 +00:00
|
|
|
// dessine la case vide qui apparait des qu'il y a un entete
|
|
|
|
if (display_border_ &&
|
|
|
|
(display_columns_ ||
|
|
|
|
display_rows_)
|
|
|
|
) {
|
|
|
|
Createdxf::drawRectangle(
|
|
|
|
file_path,
|
|
|
|
double(diagram_rect_.topLeft().x()) * Createdxf::xScale,
|
2020-07-16 21:02:34 +02:00
|
|
|
Createdxf::sheetHeight
|
|
|
|
- double(diagram_rect_.topLeft().y())
|
|
|
|
* Createdxf::yScale
|
|
|
|
- columns_header_height_,
|
2014-01-08 16:55:16 +00:00
|
|
|
rows_header_width_,
|
|
|
|
columns_header_height_,
|
|
|
|
color
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-09-22 10:39:36 +00:00
|
|
|
QSettings settings;
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
// draw the numbering of the columns
|
2014-01-08 16:55:16 +00:00
|
|
|
// dessine la numerotation des colonnes
|
|
|
|
if (display_border_ &&
|
|
|
|
display_columns_) {
|
2020-09-18 23:04:17 +02:00
|
|
|
int offset = settings.value("border-columns_0", true).toBool() ? -1 : 0;
|
2014-01-08 16:55:16 +00:00
|
|
|
for (int i = 1 ; i <= columns_count_ ; ++ i) {
|
2020-09-18 23:04:17 +02:00
|
|
|
double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale +
|
2014-01-08 16:55:16 +00:00
|
|
|
(rows_header_width_ + ((i - 1) *
|
|
|
|
columns_width_));
|
2020-07-16 21:02:34 +02:00
|
|
|
double yCoord = Createdxf::sheetHeight
|
2020-09-18 23:04:17 +02:00
|
|
|
- diagram_rect_.topLeft().y()*Createdxf::yScale
|
2020-07-16 21:02:34 +02:00
|
|
|
- columns_header_height_;
|
2014-01-08 16:55:16 +00:00
|
|
|
double recWidth = columns_width_;
|
|
|
|
double recHeight = columns_header_height_;
|
2020-07-16 21:02:34 +02:00
|
|
|
Createdxf::drawRectangle(file_path, xCoord, yCoord,
|
|
|
|
recWidth, recHeight, color);
|
2020-09-04 16:06:06 +10:00
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
Createdxf::drawTextAligned(file_path,
|
2020-09-18 23:04:17 +02:00
|
|
|
QString::number(i + offset),
|
|
|
|
xCoord+recWidth/4,
|
|
|
|
yCoord + recHeight*0.5,
|
2020-07-16 21:02:34 +02:00
|
|
|
recHeight*0.7,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
2,
|
2020-09-18 23:04:17 +02:00
|
|
|
xCoord+recWidth/2,
|
|
|
|
1,
|
2020-09-04 23:00:32 +02:00
|
|
|
color);
|
2020-09-18 23:04:17 +02:00
|
|
|
}
|
2014-01-08 16:55:16 +00:00
|
|
|
}
|
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
// draw line numbering
|
2014-01-08 16:55:16 +00:00
|
|
|
// dessine la numerotation des lignes
|
|
|
|
if (display_border_ && display_rows_) {
|
|
|
|
QString row_string("A");
|
|
|
|
for (int i = 1 ; i <= rows_count_ ; ++ i) {
|
2020-07-16 21:02:34 +02:00
|
|
|
double xCoord = diagram_rect_.topLeft().x()
|
|
|
|
* Createdxf::xScale;
|
2020-09-18 23:04:17 +02:00
|
|
|
double yCoord = Createdxf::sheetHeight
|
|
|
|
- diagram_rect_.topLeft().y()
|
2020-07-16 21:02:34 +02:00
|
|
|
*Createdxf::yScale
|
|
|
|
- (
|
|
|
|
columns_header_height_
|
|
|
|
+ ((i - 1)
|
|
|
|
* rows_height_) )
|
|
|
|
- rows_height_;
|
2014-01-08 16:55:16 +00:00
|
|
|
double recWidth = rows_header_width_;
|
|
|
|
double recHeight = rows_height_;
|
2020-07-16 21:02:34 +02:00
|
|
|
Createdxf::drawRectangle(file_path, xCoord, yCoord,
|
|
|
|
recWidth, recHeight, color);
|
|
|
|
Createdxf::drawTextAligned(file_path,
|
|
|
|
row_string,
|
2020-09-18 23:04:17 +02:00
|
|
|
xCoord+recWidth*0.1,
|
|
|
|
yCoord + recHeight*0.4,
|
2020-07-16 21:02:34 +02:00
|
|
|
recWidth*0.7,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
xCoord+recWidth/2,
|
2020-09-18 23:04:17 +02:00
|
|
|
1,
|
2020-09-04 23:00:32 +02:00
|
|
|
color);
|
2014-01-08 16:55:16 +00:00
|
|
|
row_string = incrementLetters(row_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// render the titleblock, using the TitleBlockTemplate object
|
|
|
|
if (display_titleblock_) {
|
|
|
|
//qp -> translate(titleblock_rect_.topLeft());
|
2015-03-16 13:29:27 +00:00
|
|
|
QRectF rect = titleBlockRect();
|
2020-07-16 21:02:34 +02:00
|
|
|
m_titleblock_template_renderer -> renderDxf(rect,
|
|
|
|
rect.width(),
|
|
|
|
file_path,
|
|
|
|
color);
|
2014-01-08 16:55:16 +00:00
|
|
|
//qp -> translate(-titleblock_rect_.topLeft());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Transform back to QET scale
|
|
|
|
columns_header_height_ /= Createdxf::yScale;
|
|
|
|
rows_height_ /= Createdxf::yScale;
|
|
|
|
rows_header_width_ /= Createdxf::xScale;
|
|
|
|
columns_width_ /= Createdxf::xScale;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-04-09 02:56:47 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setColumnsCount
|
|
|
|
Allows you to change the number of columns.
|
|
|
|
If this number of columns is less than the minimum required,
|
|
|
|
it is this minimum which is used.
|
|
|
|
|
|
|
|
\~French Permet de changer le nombre de colonnes.
|
|
|
|
Si ce nombre de colonnes est inferieur au minimum requis,
|
|
|
|
c'est ce minimum qui est utilise.
|
|
|
|
\~ @param nb_c : new number of columns
|
|
|
|
\~French nouveau nombre de colonnes
|
|
|
|
\~ @see minNbColumns()
|
2007-04-09 02:56:47 +00:00
|
|
|
*/
|
2012-11-09 21:09:24 +00:00
|
|
|
void BorderTitleBlock::setColumnsCount(int nb_c) {
|
|
|
|
if (nb_c == columnsCount()) return;
|
2015-03-16 13:29:27 +00:00
|
|
|
columns_count_ = qMax(MIN_COLUMN_COUNT , nb_c);
|
|
|
|
updateRectangles();
|
2007-02-28 20:48:11 +00:00
|
|
|
}
|
|
|
|
|
2007-01-28 00:53:17 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setColumnsWidth
|
|
|
|
Change the width of the columns.
|
|
|
|
If the width indicated is less than the minimum required,
|
|
|
|
it is this minimum which is used.
|
|
|
|
|
|
|
|
\~French Change la largeur des colonnes.
|
|
|
|
Si la largeur indiquee est inferieure au minimum requis,
|
|
|
|
c'est ce minimum qui est utilise.
|
|
|
|
\~ @param new_cw : new column width
|
|
|
|
\~French nouvelle largeur des colonnes
|
|
|
|
\~ @see minColumnsWidth()
|
2007-01-28 00:53:17 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::setColumnsWidth(const qreal &new_cw) {
|
2008-08-10 15:07:59 +00:00
|
|
|
if (new_cw == columnsWidth()) return;
|
2015-03-16 13:29:27 +00:00
|
|
|
columns_width_ = qMax(MIN_COLUMN_WIDTH , new_cw);
|
|
|
|
updateRectangles();
|
2007-01-28 00:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setColumnsHeaderHeight
|
|
|
|
Change the height of the headers containing the column numbers.
|
|
|
|
This must remain between 5 and 50 px.
|
|
|
|
|
|
|
|
\~French Change la hauteur des en-tetes contenant les numeros de colonnes.
|
|
|
|
Celle-ci doit rester comprise entre 5 et 50 px.
|
|
|
|
\~ @param new_chh : new height of column headers
|
|
|
|
\~French nouvelle hauteur des en-tetes de colonnes
|
2007-01-28 00:53:17 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::setColumnsHeaderHeight(const qreal &new_chh) {
|
2012-11-09 21:09:24 +00:00
|
|
|
columns_header_height_ = qBound(qreal(5.0), new_chh, qreal(50.0));
|
2007-01-28 00:53:17 +00:00
|
|
|
updateRectangles();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setRowsCount
|
|
|
|
Allows you to change the number of lines.
|
|
|
|
If this number of lines is lower than the minimum required,
|
|
|
|
this function does nothing
|
|
|
|
|
|
|
|
\~French Permet de changer le nombre de lignes.
|
|
|
|
Si ce nombre de lignes est inferieur au minimum requis,
|
|
|
|
cette fonction ne fait rien
|
|
|
|
\~ @param nb_r : new number of lines
|
|
|
|
\~French nouveau nombre de lignes
|
|
|
|
\~ @see minNbRows()
|
2007-01-28 00:53:17 +00:00
|
|
|
*/
|
2012-11-09 21:09:24 +00:00
|
|
|
void BorderTitleBlock::setRowsCount(int nb_r) {
|
|
|
|
if (nb_r == rowsCount()) return;
|
2015-03-16 13:29:27 +00:00
|
|
|
rows_count_ = qMax(MIN_ROW_COUNT, nb_r);
|
2007-01-28 00:53:17 +00:00
|
|
|
updateRectangles();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setRowsHeight
|
|
|
|
Change the height of the lines.
|
|
|
|
If the indicated height is lower than the minimum required,
|
|
|
|
it is this minimum which is used.
|
|
|
|
|
|
|
|
\~French Change la hauteur des lignes.
|
|
|
|
Si la hauteur indiquee est inferieure au minimum requis,
|
|
|
|
c'est ce minimum qui est utilise.
|
|
|
|
\~ @param new_rh : new row height
|
|
|
|
\~French nouvelle hauteur des lignes
|
|
|
|
\~ @see minRowsHeight()
|
2008-08-10 15:07:59 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::setRowsHeight(const qreal &new_rh) {
|
2008-08-10 15:07:59 +00:00
|
|
|
if (new_rh == rowsHeight()) return;
|
2015-03-16 13:29:27 +00:00
|
|
|
rows_height_ = qMax(MIN_ROW_HEIGHT, new_rh);
|
2008-08-10 15:07:59 +00:00
|
|
|
updateRectangles();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setRowsHeaderWidth
|
|
|
|
Change the width of the headers containing the line numbers.
|
|
|
|
This must remain between 5 and 50 px.
|
|
|
|
|
|
|
|
\~French Change la largeur des en-tetes contenant les numeros de lignes.
|
|
|
|
Celle-ci doit rester comprise entre 5 et 50 px.
|
|
|
|
\~ @param new_rhw : new width of line headers
|
|
|
|
\~French nouvelle largeur des en-tetes des lignes
|
2008-08-10 15:07:59 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::setRowsHeaderWidth(const qreal &new_rhw) {
|
2012-11-09 21:09:24 +00:00
|
|
|
rows_header_width_ = qBound(qreal(5.0), new_rhw, qreal(50.0));
|
2008-08-10 15:07:59 +00:00
|
|
|
updateRectangles();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setDiagramHeight
|
|
|
|
This method tries to get as close as possible to the given height
|
|
|
|
as a parameter by modifying the number of rows in progress.
|
|
|
|
|
|
|
|
\~French Cette methode essaye de se rapprocher le plus possible de la
|
|
|
|
hauteur donnee en parametre en modifiant le nombre de lignes en cours.
|
|
|
|
\~ @param height :
|
2008-08-10 15:07:59 +00:00
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
void BorderTitleBlock::setDiagramHeight(const qreal &height) {
|
2020-07-16 21:02:34 +02:00
|
|
|
// size of rows to use = rows_height
|
2008-08-10 15:07:59 +00:00
|
|
|
// taille des lignes a utiliser = rows_height
|
2012-11-09 21:09:24 +00:00
|
|
|
setRowsCount(qRound(ceil(height / rows_height_)));
|
2008-08-10 15:07:59 +00:00
|
|
|
}
|
|
|
|
|
2009-05-20 21:29:17 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::convertPosition
|
|
|
|
Convert a Point in cartesian coordinate (x : 12.5, 56.9)
|
|
|
|
to a point in grid coordinate (ex : B2)
|
|
|
|
@param pos : position to convert
|
|
|
|
@return the converted point in grid coordinate.
|
|
|
|
*/
|
2015-03-18 18:07:18 +00:00
|
|
|
DiagramPosition BorderTitleBlock::convertPosition(const QPointF &pos)
|
|
|
|
{
|
|
|
|
if(!insideBorderRect().contains(pos))
|
|
|
|
return (DiagramPosition("", 0));
|
|
|
|
|
|
|
|
QPointF relative_pos = pos - insideBorderRect().topLeft();
|
2018-07-30 15:24:29 +00:00
|
|
|
int row_number = int(ceil(relative_pos.x() / columnsWidth()));
|
|
|
|
int column_number = int(ceil(relative_pos.y() / rowsHeight()));
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2009-05-20 21:29:17 +00:00
|
|
|
QString letter = "A";
|
2015-03-18 18:07:18 +00:00
|
|
|
for (int i = 1 ; i < column_number ; ++ i)
|
2009-05-20 21:29:17 +00:00
|
|
|
letter = incrementLetters(letter);
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2009-05-20 21:29:17 +00:00
|
|
|
return(DiagramPosition(letter, row_number));
|
|
|
|
}
|
|
|
|
|
2018-12-28 18:39:54 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setAuthor
|
|
|
|
@param author the new value of the "Author" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setAuthor(const QString &author) {
|
|
|
|
btb_author_ = author;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setDate
|
|
|
|
@param date the new value of the "Date" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setDate(const QDate &date) {
|
|
|
|
btb_date_ = date;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setTitle
|
|
|
|
@param title the new value of the "Title" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setTitle(const QString &title)
|
|
|
|
{
|
|
|
|
if (btb_title_ != title)
|
|
|
|
{
|
|
|
|
btb_title_ = title;
|
|
|
|
emit(diagramTitleChanged(title));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setFolio
|
|
|
|
@param folio the new value of the "Folio" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setFolio(const QString &folio)
|
|
|
|
{
|
|
|
|
btb_folio_ = folio;
|
|
|
|
emit (titleBlockFolioChanged(folio));
|
|
|
|
}
|
|
|
|
|
2010-12-19 18:12:56 +00:00
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::updateDiagramContextForTitleBlock
|
|
|
|
Update the informations given to the titleblock template
|
|
|
|
by regenerating a DiagramContext object.
|
|
|
|
@param initial_context :
|
|
|
|
Base diagram context that will be overridden by diagram-wide values
|
2012-07-01 21:54:07 +00:00
|
|
|
*/
|
2020-07-16 21:02:34 +02:00
|
|
|
void BorderTitleBlock::updateDiagramContextForTitleBlock(
|
|
|
|
const DiagramContext &initial_context) {
|
2012-07-01 21:54:07 +00:00
|
|
|
// Our final DiagramContext is the initial one (which is supposed to bring
|
|
|
|
// project-wide properties), overridden by the "additional fields" one...
|
|
|
|
DiagramContext context = initial_context;
|
2017-02-05 16:18:50 +00:00
|
|
|
foreach (QString key, additional_fields_.keys()) {
|
2012-07-01 21:54:07 +00:00
|
|
|
context.addValue(key, additional_fields_[key]);
|
|
|
|
}
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2011-01-09 15:16:51 +00:00
|
|
|
// ... overridden by the historical and/or dynamically generated fields
|
2020-09-21 20:23:20 +02:00
|
|
|
QLocale var;
|
|
|
|
var.dateFormat(QLocale::ShortFormat);
|
2012-11-09 21:09:24 +00:00
|
|
|
context.addValue("author", btb_author_);
|
2020-09-21 20:23:20 +02:00
|
|
|
context.addValue(
|
|
|
|
"date",
|
|
|
|
QLocale::system().toString(btb_date_, QLocale::ShortFormat));
|
2012-11-09 21:09:24 +00:00
|
|
|
context.addValue("title", btb_title_);
|
|
|
|
context.addValue("filename", btb_filename_);
|
2018-12-04 22:33:11 +00:00
|
|
|
context.addValue("plant", btb_plant_);
|
2016-08-12 11:32:56 +00:00
|
|
|
context.addValue("locmach", btb_locmach_);
|
2016-08-11 18:32:08 +00:00
|
|
|
context.addValue("indexrev", btb_indexrev_);
|
2016-08-10 12:25:47 +00:00
|
|
|
context.addValue("version", btb_version_);
|
2012-11-09 21:09:24 +00:00
|
|
|
context.addValue("folio", btb_final_folio_);
|
2010-12-19 18:12:56 +00:00
|
|
|
context.addValue("folio-id", folio_index_);
|
|
|
|
context.addValue("folio-total", folio_total_);
|
2016-05-13 15:00:22 +00:00
|
|
|
context.addValue("auto_page_num", btb_auto_page_num_);
|
2018-12-28 18:39:54 +00:00
|
|
|
context.addValue("previous-folio-num", m_previous_folio_num);
|
|
|
|
context.addValue("next-folio-num", m_next_folio_num);
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2020-04-12 18:51:38 +02:00
|
|
|
m_titleblock_template_renderer -> setContext(context);
|
2010-12-19 18:12:56 +00:00
|
|
|
}
|
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
/**
|
|
|
|
@brief BorderTitleBlock::incrementLetters
|
|
|
|
increments string with Letters A to Z
|
|
|
|
@param string
|
|
|
|
@return string ++Letters
|
|
|
|
eg:
|
|
|
|
- A-> B
|
|
|
|
- Z -> AA
|
|
|
|
*/
|
2010-12-20 02:45:36 +00:00
|
|
|
QString BorderTitleBlock::incrementLetters(const QString &string) {
|
2008-08-10 15:07:59 +00:00
|
|
|
if (string.isEmpty()) {
|
|
|
|
return("A");
|
|
|
|
} else {
|
2020-07-16 21:02:34 +02:00
|
|
|
// separate previous digits from last digit
|
2008-08-10 15:07:59 +00:00
|
|
|
// separe les digits precedents du dernier digit
|
|
|
|
QString first_digits(string.left(string.count() - 1));
|
|
|
|
QChar last_digit(string.at(string.count() - 1));
|
|
|
|
if (last_digit != 'Z') {
|
2020-07-16 21:02:34 +02:00
|
|
|
// increments the last digit
|
2008-08-10 15:07:59 +00:00
|
|
|
// incremente le dernier digit
|
2020-12-10 16:01:10 +01:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
2015-03-02 20:14:56 +00:00
|
|
|
last_digit = last_digit.toLatin1() + 1;
|
2020-12-10 16:01:10 +01:00
|
|
|
#else
|
|
|
|
# if TODO_LIST
|
|
|
|
# pragma message("@TODO remove code for QT 6 or later")
|
|
|
|
# endif
|
|
|
|
qDebug() << "Help code for QT 6 or later";
|
|
|
|
#endif
|
2008-08-10 15:07:59 +00:00
|
|
|
return(first_digits + QString(last_digit));
|
|
|
|
} else {
|
|
|
|
return(incrementLetters(first_digits) + "A");
|
|
|
|
}
|
|
|
|
}
|
2007-10-12 12:54:25 +00:00
|
|
|
}
|
2009-04-03 19:30:25 +00:00
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setFolioData
|
|
|
|
|
|
|
|
\~ @param index : schema number (from 1 to total)
|
|
|
|
\~French numero du schema (de 1 a total)
|
|
|
|
|
|
|
|
\~ @param total : total number of diagrams in the project
|
|
|
|
\~French nombre total de schemas dans le projet
|
|
|
|
|
|
|
|
\~ @param autonum :
|
|
|
|
|
|
|
|
\~ @param project_properties : Project-wide properties,
|
|
|
|
to be merged with diagram-wide ones.
|
2009-04-03 19:30:25 +00:00
|
|
|
*/
|
2020-07-16 21:02:34 +02:00
|
|
|
void BorderTitleBlock::setFolioData(
|
|
|
|
int index,
|
|
|
|
int total,
|
|
|
|
const QString& autonum,
|
|
|
|
const DiagramContext &project_properties) {
|
2009-04-03 19:30:25 +00:00
|
|
|
if (index < 1 || total < 1 || index > total) return;
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
// memorize information
|
2009-04-03 19:30:25 +00:00
|
|
|
// memorise les informations
|
|
|
|
folio_index_ = index;
|
|
|
|
folio_total_ = total;
|
2020-09-18 23:04:17 +02:00
|
|
|
|
2020-07-16 21:02:34 +02:00
|
|
|
// regenerate the content of the folio field
|
2009-04-03 19:30:25 +00:00
|
|
|
// regenere le contenu du champ folio
|
2012-11-09 21:09:24 +00:00
|
|
|
btb_final_folio_ = btb_folio_;
|
2016-05-13 15:00:22 +00:00
|
|
|
|
|
|
|
if (btb_final_folio_.contains("%autonum")){
|
2020-07-16 21:02:34 +02:00
|
|
|
btb_final_folio_.replace("%autonum", autonum);
|
|
|
|
btb_folio_ = btb_final_folio_;
|
2016-05-13 15:00:22 +00:00
|
|
|
}
|
2012-11-09 21:09:24 +00:00
|
|
|
btb_final_folio_.replace("%id", QString::number(folio_index_));
|
|
|
|
btb_final_folio_.replace("%total", QString::number(folio_total_));
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2012-07-01 21:54:07 +00:00
|
|
|
updateDiagramContextForTitleBlock(project_properties);
|
2009-04-03 19:30:25 +00:00
|
|
|
}
|
2018-12-28 18:39:54 +00:00
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setPlant
|
|
|
|
@param plant the new value of the "plant" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setPlant(const QString &plant) {
|
|
|
|
btb_plant_ = plant;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setLocMach
|
|
|
|
@param locmach the new value of the "locmach" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setLocMach(const QString &locmach) {
|
|
|
|
btb_locmach_ = locmach;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setIndicerev
|
|
|
|
@param indexrev the new value of the "indexrev" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setIndicerev(const QString &indexrev) {
|
|
|
|
btb_indexrev_ = indexrev;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setFileName
|
|
|
|
@param filename the new value of the "filename" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setFileName(const QString &filename) {
|
|
|
|
btb_filename_ = filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setVersion
|
|
|
|
@param version the new value of the "version" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setVersion(const QString &version) {
|
|
|
|
btb_version_ = version;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setAutoPageNum
|
|
|
|
@param auto_page_num the new value of the "auto_page_num" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setAutoPageNum(const QString &auto_page_num) {
|
|
|
|
btb_auto_page_num_ = auto_page_num;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setPreviousFolioNum
|
|
|
|
@param previous the new value of the "previous-folio-num" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setPreviousFolioNum(const QString &previous)
|
|
|
|
{
|
|
|
|
m_previous_folio_num = previous;
|
2020-04-12 18:51:38 +02:00
|
|
|
DiagramContext context = m_titleblock_template_renderer->context();
|
2018-12-28 18:39:54 +00:00
|
|
|
context.addValue("previous-folio-num", m_previous_folio_num);
|
2020-04-12 18:51:38 +02:00
|
|
|
m_titleblock_template_renderer->setContext(context);
|
2018-12-28 18:39:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-07-16 21:02:34 +02:00
|
|
|
@brief BorderTitleBlock::setNextFolioNum
|
|
|
|
@param next the new value of the "next-folio-num" field
|
|
|
|
*/
|
2018-12-28 18:39:54 +00:00
|
|
|
void BorderTitleBlock::setNextFolioNum(const QString &next)
|
|
|
|
{
|
|
|
|
m_next_folio_num = next;
|
2020-04-12 18:51:38 +02:00
|
|
|
DiagramContext context = m_titleblock_template_renderer->context();
|
2018-12-28 18:39:54 +00:00
|
|
|
context.addValue("next-folio-num", m_next_folio_num);
|
2020-04-12 18:51:38 +02:00
|
|
|
m_titleblock_template_renderer->setContext(context);
|
2018-12-28 18:39:54 +00:00
|
|
|
}
|