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

View File

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

View File

@ -564,7 +564,7 @@ void DialogPatternXmlEdit::ButtonApplyChangesClicked()
QMessageBox::warning(this, "Error in changes", message); QMessageBox::warning(this, "Error in changes", message);
return; 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); VToolDetail::Create(dialogTool, sceneDetails, doc, pattern);
} }
ArrowTool(); ArrowTool();
doc->LiteParseTree(); doc->LiteParseTree(Document::LiteParse);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -622,7 +622,7 @@ void MainWindow::ToolUnionDetails(bool checked)
void MainWindow::ClosedDialogUnionDetails(int result) void MainWindow::ClosedDialogUnionDetails(int result)
{ {
ClosedDialog<VToolUnionDetails>(result); ClosedDialog<VToolUnionDetails>(result);
doc->LiteParseTree(); doc->LiteParseTree(Document::LiteParse);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1483,7 +1483,7 @@ void MainWindow::ChangedSize(const QString & text)
{ {
qint32 size = text.toInt(); qint32 size = text.toInt();
pattern->SetSize(size); pattern->SetSize(size);
doc->LiteParseTree(); doc->LiteParseTree(Document::LiteParse);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1495,7 +1495,7 @@ void MainWindow::ChangedHeight(const QString &text)
{ {
qint32 growth = text.toInt(); qint32 growth = text.toInt();
pattern->SetHeight(growth); pattern->SetHeight(growth);
doc->LiteParseTree(); doc->LiteParseTree(Document::LiteParse);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

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

View File

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

View File

@ -67,7 +67,7 @@ void MoveDetail::undo()
{ {
SaveCoordinates(domElement, oldX, oldY); SaveCoordinates(domElement, oldX, oldY);
emit NeedLiteParsing(); emit NeedLiteParsing(Document::LiteParse);
QList<QGraphicsView*> list = scene->views(); QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]); VAbstractTool::NewSceneRect(scene, list[0]);
@ -89,7 +89,7 @@ void MoveDetail::redo()
if (redoFlag) if (redoFlag)
{ {
emit NeedLiteParsing(); emit NeedLiteParsing(Document::LiteParse);
} }
redoFlag = true; 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::AttrKAsm2, QString().setNum(spl.GetKasm2()));
doc->SetAttribute(domElement, VAbstractTool::AttrKCurve, QString().setNum(spl.GetKcurve())); doc->SetAttribute(domElement, VAbstractTool::AttrKCurve, QString().setNum(spl.GetKcurve()));
emit NeedLiteParsing(); emit NeedLiteParsing(Document::LiteParse);
QList<QGraphicsView*> list = scene->views(); QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]); 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())); doc->SetAttribute(domElement, VToolSplinePath::AttrKCurve, QString().setNum(splPath.getKCurve()));
VToolSplinePath::UpdatePathPoint(doc, domElement, splPath); VToolSplinePath::UpdatePathPoint(doc, domElement, splPath);
emit NeedLiteParsing(); emit NeedLiteParsing(Document::LiteParse);
QList<QGraphicsView*> list = scene->views(); QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]); 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::AttrX, QString().setNum(qApp->fromPixel(x)));
doc->SetAttribute(domElement, VAbstractTool::AttrY, QString().setNum(qApp->fromPixel(y))); doc->SetAttribute(domElement, VAbstractTool::AttrY, QString().setNum(qApp->fromPixel(y)));
emit NeedLiteParsing(); emit NeedLiteParsing(Document::LitePPParse);
QList<QGraphicsView*> list = scene->views(); QList<QGraphicsView*> list = scene->views();
VAbstractTool::NewSceneRect(scene, list[0]); VAbstractTool::NewSceneRect(scene, list[0]);

View File

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

View File

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

View File

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

View File

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

View File

@ -667,7 +667,7 @@ bool VPattern::SaveDocument(const QString &fileName)
/** /**
* @brief LiteParseTree lite parse file. * @brief LiteParseTree lite parse file.
*/ */
void VPattern::LiteParseTree() void VPattern::LiteParseTree(const Document &parse)
{ {
// Save name current pattern piece // Save name current pattern piece
QString namePP = nameActivPP; QString namePP = nameActivPP;
@ -675,8 +675,20 @@ void VPattern::LiteParseTree()
try try
{ {
emit SetEnabledGUI(true); emit SetEnabledGUI(true);
switch(parse)
{
case Document::LitePPParse:
ParseCurrentPP(); ParseCurrentPP();
//Parse(Document::LiteParse); 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) catch (const VExceptionUndo &e)
{ {

View File

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