Lite parsing. Parse only current pattern piece.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-29 18:23:18 +03:00
parent c0debc16e0
commit 14edede972
5 changed files with 52 additions and 4 deletions

View File

@ -340,11 +340,17 @@ const QStringList VAbstractTool::Styles()
*/ */
void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *doc) void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *doc)
{ {
quint32 cursor = doc->getCursor();
QVector<VToolRecord> *history = doc->getHistory(); QVector<VToolRecord> *history = doc->getHistory();
VToolRecord record = VToolRecord(id, toolType, doc->GetNameActivPP());
if (history->contains(record))
{
return;
}
quint32 cursor = doc->getCursor();
if (cursor <= 0) if (cursor <= 0)
{ {
history->append(VToolRecord(id, toolType, doc->GetNameActivPP())); history->append(record);
} }
else else
{ {
@ -358,6 +364,6 @@ void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *
break; break;
} }
} }
history->insert(index+1, VToolRecord(id, toolType, doc->GetNameActivPP())); history->insert(index+1, record);
} }
} }

View File

@ -675,7 +675,8 @@ void VPattern::LiteParseTree()
try try
{ {
emit SetEnabledGUI(true); emit SetEnabledGUI(true);
Parse(Document::LiteParse); ParceCurrentPP();
//Parse(Document::LiteParse);
} }
catch (const VExceptionUndo &e) catch (const VExceptionUndo &e)
{ {
@ -1475,6 +1476,17 @@ void VPattern::SplinesCommonAttributes(const QDomElement &domElement, quint32 &i
idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParceCurrentPP()
{
QDomElement domElement;
if (GetActivDrawElement(domElement))
{
ParseDrawElement(domElement, Document::LiteParse);
}
emit CheckLayout();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief ParseSplineElement parse spline tag. * @brief ParseSplineElement parse spline tag.
@ -2015,6 +2027,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
return rec; return rec;
} }
//---------------------------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const
{ {

View File

@ -214,6 +214,7 @@ private:
quint32 &idTool); quint32 &idTool);
template <typename T> template <typename T>
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const; QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const;
void ParceCurrentPP();
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -46,3 +46,28 @@ VToolRecord::VToolRecord()
VToolRecord::VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw) VToolRecord::VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw)
:id(id), typeTool(typeTool), nameDraw(nameDraw) :id(id), typeTool(typeTool), nameDraw(nameDraw)
{} {}
//---------------------------------------------------------------------------------------------------------------------
bool VToolRecord::VToolRecord::operator==(const VToolRecord &record) const
{
bool isEqual = false;
if (id == record.getId() && typeTool == record.getTypeTool() && nameDraw == record.getNameDraw())
{
isEqual = true;
}
return isEqual;
}
//---------------------------------------------------------------------------------------------------------------------
VToolRecord &VToolRecord::operator=(const VToolRecord &record)
{
this->id = record.getId();
this->typeTool = record.getTypeTool();
this->nameDraw = record.getNameDraw();
return *this;
}
//---------------------------------------------------------------------------------------------------------------------
VToolRecord::VToolRecord(const VToolRecord &record)
:id(record.getId()), typeTool(record.getTypeTool()), nameDraw(record.getNameDraw())
{}

View File

@ -41,6 +41,9 @@ class VToolRecord
public: public:
VToolRecord(); VToolRecord();
VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw); VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw);
bool operator==(const VToolRecord &record) const;
VToolRecord &operator=(const VToolRecord &record);
VToolRecord(const VToolRecord &record);
quint32 getId() const; quint32 getId() const;
void setId(const quint32 &value); void setId(const quint32 &value);
Tool getTypeTool() const; Tool getTypeTool() const;