Parse current pattern piece only for changing position pattern piece.

--HG--
branch : develop
This commit is contained in:
dismine 2014-08-04 16:37:36 +03:00
parent 924240d8f0
commit 7c52bf240f
16 changed files with 45 additions and 35 deletions

View File

@ -31,7 +31,6 @@
#include "../../widgets/doubledelegate.h"
#include "../../widgets/textdelegate.h"
#include "../../xml/vstandardmeasurements.h"
#include "../../xml/vpattern.h"
#include "../../xml/vindividualmeasurements.h"
#include <QFileDialog>
@ -471,7 +470,7 @@ void DialogIncrements::OpenTable()
m = m1;
data->ClearVariables(VarType::Measurement);
m->Measurements();
emit FullUpdateTree();
emit FullUpdateTree(Document::LiteParse);
doc->SetPath(filePath);
emit haveLiteChange();
@ -504,7 +503,7 @@ void DialogIncrements::OpenTable()
data->ClearVariables(VarType::Measurement);
m1->Measurements();
delete m1;
emit FullUpdateTree();
emit FullUpdateTree(Document::LiteParse);
doc->SetPath(filePath);
emit haveLiteChange();
@ -673,22 +672,22 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
doc->SetAttribute(domElement, VPattern::IncrementName, item->text());
data->ClearVariables(VarType::Increment);
this->column = 2;
emit FullUpdateTree();
emit FullUpdateTree(Document::LiteParse);
break;
case 2: // VPattern::IncrementBase
doc->SetAttribute(domElement, VPattern::IncrementBase, item->text());
this->column = 3;
emit FullUpdateTree();
emit FullUpdateTree(Document::LiteParse);
break;
case 3: // VPattern::IncrementKsize
doc->SetAttribute(domElement, VPattern::IncrementKsize, item->text());
this->column = 4;
emit FullUpdateTree();
emit FullUpdateTree(Document::LiteParse);
break;
case 4: // VPattern::IncrementKgrowth
doc->SetAttribute(domElement, VPattern::IncrementKgrowth, item->text());
this->column = 5;
emit FullUpdateTree();
emit FullUpdateTree(Document::LiteParse);
break;
case 5: // VPattern::IncrementDescription
{
@ -752,7 +751,7 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
data->ClearVariables();
m->Measurements();
emit FullUpdateTree();
emit FullUpdateTree(Document::LiteParse);
break;
}
default:

View File

@ -30,8 +30,8 @@
#define DIALOGINCREMENTS_H
#include "../tools/dialogtool.h"
#include "../../xml/vpattern.h"
class VPattern;
class VIndividualMeasurements;
class QTableWidget;
@ -65,7 +65,7 @@ signals:
/**
* @brief FullUpdateTree signal update data for dom document
*/
void FullUpdateTree();
void FullUpdateTree(const Document &parse);
/**
* @brief haveLiteChange signal show sign of change
*/

View File

@ -564,7 +564,7 @@ void DialogPatternXmlEdit::ButtonApplyChangesClicked()
QMessageBox::warning(this, "Error in changes", message);
return;
}
this->doc->LiteParseTree();
this->doc->LiteParseTree(Document::LiteParse);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -564,7 +564,7 @@ void MainWindow::ClosedDialogDetail(int result)
VToolDetail::Create(dialogTool, sceneDetails, doc, pattern);
}
ArrowTool();
doc->LiteParseTree();
doc->LiteParseTree(Document::LiteParse);
}
//---------------------------------------------------------------------------------------------------------------------
@ -622,7 +622,7 @@ void MainWindow::ToolUnionDetails(bool checked)
void MainWindow::ClosedDialogUnionDetails(int result)
{
ClosedDialog<VToolUnionDetails>(result);
doc->LiteParseTree();
doc->LiteParseTree(Document::LiteParse);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1483,7 +1483,7 @@ void MainWindow::ChangedSize(const QString & text)
{
qint32 size = text.toInt();
pattern->SetSize(size);
doc->LiteParseTree();
doc->LiteParseTree(Document::LiteParse);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1495,7 +1495,7 @@ void MainWindow::ChangedHeight(const QString &text)
{
qint32 growth = text.toInt();
pattern->SetHeight(growth);
doc->LiteParseTree();
doc->LiteParseTree(Document::LiteParse);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -27,7 +27,6 @@
*************************************************************************/
#include "vabstracttool.h"
#include "../xml/vpattern.h"
#include <QGraphicsView>
#include <QMessageBox>
#include "../undocommands/deltool.h"

View File

@ -30,8 +30,8 @@
#define VABSTRACTTOOL_H
#include "vdatatool.h"
#include "../xml/vpattern.h"
class VPattern;
class QDomElement;
class QLineF;
class QPointF;
@ -119,7 +119,7 @@ signals:
/**
* @brief FullUpdateTree emit if need reparse pattern file.
*/
void LiteUpdateTree();
void LiteUpdateTree(const Document &parse);
protected:
/** @brief doc dom document container */
VPattern *doc;

View File

@ -67,7 +67,7 @@ void MoveDetail::undo()
{
SaveCoordinates(domElement, oldX, oldY);
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LiteParse);
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
@ -89,7 +89,7 @@ void MoveDetail::redo()
if (redoFlag)
{
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LiteParse);
}
redoFlag = true;

View File

@ -93,7 +93,7 @@ void MoveSpline::Do(const VSpline &spl)
doc->SetAttribute(domElement, VAbstractTool::AttrKAsm2, QString().setNum(spl.GetKasm2()));
doc->SetAttribute(domElement, VAbstractTool::AttrKCurve, QString().setNum(spl.GetKcurve()));
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LiteParse);
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);

View File

@ -88,7 +88,7 @@ void MoveSplinePath::Do(const VSplinePath &splPath)
doc->SetAttribute(domElement, VToolSplinePath::AttrKCurve, QString().setNum(splPath.getKCurve()));
VToolSplinePath::UpdatePathPoint(doc, domElement, splPath);
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LiteParse);
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);

View File

@ -103,7 +103,7 @@ void MoveSPoint::Do(double x, double y)
doc->SetAttribute(domElement, VAbstractTool::AttrX, QString().setNum(qApp->fromPixel(x)));
doc->SetAttribute(domElement, VAbstractTool::AttrY, QString().setNum(qApp->fromPixel(y)));
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LitePPParse);
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);

View File

@ -65,7 +65,7 @@ void SaveDetailOptions::undo()
doc->IncrementReferens(nodes.at(i).getId());
}
}
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LiteParse);
QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]);
@ -100,7 +100,7 @@ void SaveDetailOptions::redo()
doc->DecrementReferens(list.at(i));
}
}
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LiteParse);
QList<QGraphicsView*> listV = scene->views();
VAbstractTool::NewSceneRect(scene, listV[0]);

View File

@ -51,7 +51,7 @@ void SaveToolOptions::undo()
{
domElement.parentNode().replaceChild(oldXml, domElement);
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LiteParse);
}
else
{
@ -68,7 +68,7 @@ void SaveToolOptions::redo()
{
domElement.parentNode().replaceChild(newXml, domElement);
emit NeedLiteParsing();
emit NeedLiteParsing(Document::LiteParse);
}
else
{

View File

@ -44,8 +44,6 @@ public:
virtual int id() const;
QDomElement getNewXml() const;
quint32 getToolId() const;
signals:
void NeedLiteParsing();
private:
Q_DISABLE_COPY(SaveToolOptions)
const QDomElement oldXml;

View File

@ -32,6 +32,8 @@
#include <QUndoCommand>
#include <QDomElement>
#include "../xml/vpattern.h"
enum class UndoCommand: char { AddPatternPiece,
AddToCalc,
MoveSpline,
@ -56,7 +58,7 @@ public:
signals:
void ClearScene();
void NeedFullParsing();
void NeedLiteParsing();
void NeedLiteParsing(const Document &parse);
protected:
QDomElement xml;
VPattern *doc;

View File

@ -667,7 +667,7 @@ bool VPattern::SaveDocument(const QString &fileName)
/**
* @brief LiteParseTree lite parse file.
*/
void VPattern::LiteParseTree()
void VPattern::LiteParseTree(const Document &parse)
{
// Save name current pattern piece
QString namePP = nameActivPP;
@ -675,8 +675,20 @@ void VPattern::LiteParseTree()
try
{
emit SetEnabledGUI(true);
ParseCurrentPP();
//Parse(Document::LiteParse);
switch(parse)
{
case Document::LitePPParse:
ParseCurrentPP();
break;
case Document::LiteParse:
Parse(parse);
break;
case Document::FullParse:
qWarning()<<"Lite parsing doesn't support full parsing";
break;
default:
break;
}
}
catch (const VExceptionUndo &e)
{

View File

@ -35,7 +35,7 @@
class VDataTool;
class VMainGraphicsScene;
enum class Document : char { LiteParse, FullParse};
enum class Document : char { LiteParse, LitePPParse, FullParse};
/*
VAL_VERSION is (major << 16) + (minor << 8) + patch.
@ -152,7 +152,7 @@ signals:
void SetEnabledGUI(bool enabled);
void CheckLayout();
public slots:
void LiteParseTree();
void LiteParseTree(const Document &parse);
void haveLiteChange();
void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable);
void NeedFullParsing();