Improve handling gradation change.

Use parsed object to recalculate values instead opening file and parsing it every time.
This commit is contained in:
Roman Telezhynskyi 2022-03-24 13:02:17 +02:00
parent 1e88d2f8c8
commit 67161bcfcb
3 changed files with 17 additions and 3 deletions

View File

@ -8,6 +8,7 @@
- Remove support for russian language.
- Improve CLI. Better handle printer margins.
- Improve file format conversion.
- Improve handling gradation change.
# Valentina 0.7.50 February 14, 2022
- Fix regression. Minimal seam allowance width is less than the point accuracy values.

View File

@ -588,7 +588,13 @@ bool MainWindow::LoadMeasurements(const QString &path)
//---------------------------------------------------------------------------------------------------------------------
bool MainWindow::UpdateMeasurements(const QString &path, qreal baseA, qreal baseB, qreal baseC)
{
m = OpenMeasurementFile(path);
return UpdateMeasurements(OpenMeasurementFile(path), baseA, baseB, baseC);
}
//---------------------------------------------------------------------------------------------------------------------
bool MainWindow::UpdateMeasurements(const QSharedPointer<VMeasurements> &mFile, qreal baseA, qreal baseB, qreal baseC)
{
m = mFile;
if (m->isNull())
{
@ -4305,8 +4311,13 @@ void MainWindow::DimensionCBaseChanged()
void MainWindow::GradationChanged()
{
m_gradation->stop();
if (UpdateMeasurements(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()),
m_currentDimensionA, m_currentDimensionB, m_currentDimensionC))
if (m->isNull())
{
m = OpenMeasurementFile(AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), doc->MPath()));
}
if (UpdateMeasurements(m, m_currentDimensionA, m_currentDimensionB, m_currentDimensionC))
{
doc->LiteParseTree(Document::FullLiteParse);
StoreDimensions();

View File

@ -404,6 +404,8 @@ private:
bool LoadMeasurements(const QString &path);
bool UpdateMeasurements(const QString &path, qreal baseA, qreal baseB, qreal baseC);
bool UpdateMeasurements(const QSharedPointer<VMeasurements> &mFile, qreal baseA, qreal baseB,
qreal baseC);
void ReopenFilesAfterCrash(QStringList &args);
bool DoExport(const VCommandLinePtr& expParams);