2016-08-12 12:11:12 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vpatternpiecedata.cpp
|
|
|
|
** @author Bojan Kverh
|
|
|
|
** @date July 19, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2016-08-12 12:11:12 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina 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 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
2016-07-18 22:30:14 +02:00
|
|
|
#ifndef VTEXTMANAGER_H
|
|
|
|
#define VTEXTMANAGER_H
|
|
|
|
|
2016-07-21 21:46:49 +02:00
|
|
|
#include <QDate>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QFont>
|
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <Qt>
|
|
|
|
#include <QtGlobal>
|
2017-01-25 17:07:18 +01:00
|
|
|
#include <QCoreApplication>
|
2016-08-08 13:44:49 +02:00
|
|
|
|
2017-02-23 10:19:27 +01:00
|
|
|
class VPieceLabelData;
|
2017-02-18 10:22:59 +01:00
|
|
|
class VAbstractPattern;
|
2016-07-18 22:30:14 +02:00
|
|
|
|
2016-12-14 11:09:59 +01:00
|
|
|
#define MIN_FONT_SIZE 5
|
2016-07-30 12:48:18 +02:00
|
|
|
#define MAX_FONT_SIZE 128
|
2016-07-18 22:30:14 +02:00
|
|
|
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
|
|
|
* @brief The TextLine struct holds the information about one text line
|
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
struct TextLine
|
|
|
|
{
|
|
|
|
QString m_qsText;
|
|
|
|
int m_iFontSize; // 0 means default
|
2017-08-15 14:22:33 +02:00
|
|
|
bool bold;
|
|
|
|
bool italic;
|
2016-07-18 22:30:14 +02:00
|
|
|
Qt::Alignment m_eAlign;
|
|
|
|
|
|
|
|
TextLine();
|
|
|
|
};
|
|
|
|
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
|
|
|
* @brief The VTextManager class this class is used to determine whether a collection of
|
|
|
|
* text lines can fit into specified bounding box and with what font size
|
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
class VTextManager
|
|
|
|
{
|
2016-08-09 18:42:00 +02:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(VTextManager)
|
2016-07-18 22:30:14 +02:00
|
|
|
public:
|
|
|
|
VTextManager();
|
2017-08-15 14:22:33 +02:00
|
|
|
virtual ~VTextManager() = default;
|
2016-07-18 22:30:14 +02:00
|
|
|
|
2016-11-01 09:42:32 +01:00
|
|
|
VTextManager(const VTextManager &text);
|
|
|
|
VTextManager &operator=(const VTextManager &text);
|
|
|
|
|
|
|
|
virtual int GetSpacing() const;
|
|
|
|
|
|
|
|
void SetFont(const QFont& font);
|
|
|
|
const QFont& GetFont() const;
|
|
|
|
void SetFontSize(int iFS);
|
|
|
|
void FitFontSize(qreal fW, qreal fH);
|
|
|
|
|
|
|
|
QList<TextLine> GetAllSourceLines() const;
|
|
|
|
int GetSourceLinesCount() const;
|
2016-12-14 00:56:30 +01:00
|
|
|
const TextLine& GetSourceLine(int i) const;
|
2016-11-01 09:42:32 +01:00
|
|
|
|
2017-02-23 10:19:27 +01:00
|
|
|
void Update(const QString& qsName, const VPieceLabelData& data);
|
2017-08-19 18:52:33 +02:00
|
|
|
void Update(VAbstractPattern* pDoc);
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
private:
|
2016-11-01 09:42:32 +01:00
|
|
|
QFont m_font;
|
|
|
|
QList<TextLine> m_liLines;
|
2017-08-15 14:22:33 +02:00
|
|
|
|
|
|
|
static QList<TextLine> m_patternLabelLines;
|
2016-07-18 22:30:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VTEXTMANAGER_H
|