Verified Commit 104e297a authored by ita1024's avatar ita1024

Enable simple sequence diagrams

parent 6777c36c
Semantik 1.0.1
--------------
* Add a diagram sequence element
* Fix improper pdf document dimensions
* Fix the configuration and build on FreeBSD
* Add installation notes for Fedora
......
......@@ -203,9 +203,10 @@ void data_box::dump_xml(QStringList & i_oS)
QString::number(m_iHH),
color.name(),
QString::number((int) m_iType),
QString(" v=\"%1\" e=\"%2\" version=\"1\"").arg(
QString(" v=\"%1\" e=\"%2\" seq=\"%3\" version=\"2\"").arg(
QString::number((int) m_bIsVertical),
QString::number((int) m_bIsEnd)
QString::number((int) m_bIsEnd),
QString::number((int) m_iBoxHeight)
)
);
......@@ -246,6 +247,11 @@ void data_box::read_data(const QString& i_sTag, const QXmlAttributes& i_oAttrs)
m_iType = (data_box::IType) i_oAttrs.value(notr("t")).toInt();
m_bIsVertical = i_oAttrs.value(notr("v")).toInt();
m_bIsEnd = i_oAttrs.value(notr("e")).toInt();
m_iBoxHeight = i_oAttrs.value(notr("seq")).toInt();
if (m_iBoxHeight < 5)
{
m_iBoxHeight = 20;
}
color = QColor(i_oAttrs.value(notr("color")));
int l_iVersion = i_oAttrs.value(notr("version")).toInt();
if (l_iVersion < 1 && m_iType == data_box::LABEL)
......
......@@ -136,7 +136,7 @@ class data_box : public diagram_item, public node
int m_iHH;
enum IType { ACTIVITY=1, ACTIVITY_START=2, ACTIVITY_PARALLEL=3, LABEL=4, COMPONENT=5, NODE=6, \
ACTOR=7, USECASE=8, DECISION=9, MATRIX=10, FRAME=11, CLASS=12, CAPTION=13, DATABASE=14,
RECTANGLE=15, PIPE=16};
RECTANGLE=15, PIPE=16, SEQUENCE=17};
data_box::IType m_iType;
node& make_node(const QString&, const QXmlAttributes&);
......@@ -153,6 +153,8 @@ class data_box : public diagram_item, public node
QList<int> m_oRowSizes;
QList<int> m_oColSizes;
int m_iBoxHeight;
// class
bool m_bStatic;
bool m_bAbstract;
......
......@@ -23,7 +23,7 @@ class mem_command {
bool was_dirty;
enum IType {DELETE, ADD, LINK, UNLINK, SELECT, MOVE, COLOR, FLAG, EDIT, DATATYPE, TEXT, VARS, PIC, TABLE, SORT,
ADD_BOX, DEL_BOX, EDIT_BOX, LINK_BOX, UNLINK_BOX, PROP_BOX, POS_BOX, CHANGE_LINK_BOX, SIZE_BOX,
EDIT_LINK, IMPORT_BOX, SIZE_MATRIX, CHANGE_CLASS_BOX, DIAGRAM_PROPERTIES};
EDIT_LINK, IMPORT_BOX, SIZE_MATRIX, CHANGE_CLASS_BOX, DIAGRAM_PROPERTIES, SIZE_SEQUENCE};
virtual IType type() = 0;
};
......
......@@ -1556,6 +1556,11 @@ void sem_mediator::notify_size_box(int id, const QList<data_box*>& items)
emit sig_size_box(id, items);
}
void sem_mediator::notify_sequence_box(int i_iId, int i_iBoxId)
{
emit sig_sequence_box(i_iId, i_iBoxId);
}
void sem_mediator::notify_change_properties(void* i_o)
{
emit sig_change_properties(i_o);
......
......@@ -81,6 +81,7 @@ class sem_mediator: public QObject
void sig_pos_box(int id, const QList<data_box*>&);
void sig_change_link_box(int id, data_link*);
void sig_size_box(int id, const QList<data_box*>&);
void sig_sequence_box(int id, int);
void sig_change_properties(void*);
void enable_undo(bool, bool);
......@@ -164,6 +165,7 @@ class sem_mediator: public QObject
void notify_pos_box(int id, const QList<data_box*>&);
void notify_change_link_box(int id, data_link*);
void notify_size_box(int id, const QList<data_box*>&);
void notify_sequence_box(int id, int);
void notify_change_properties(void*);
void notify_message(const QString& msg, int duration);
......
......@@ -140,6 +140,9 @@ void canvas_item::update_color()
void canvas_item::update_links()
{
#ifdef _DEBUG
return;
#endif
foreach (canvas_link* l_oLink, m_oLinks)
{
l_oLink->update_pos();
......
......@@ -55,6 +55,10 @@ void canvas_link::rm_link()
void canvas_link::update_pos()
{
#ifdef _DEBUG
return;
#endif
prepareGeometryChange();
if (m_oFrom->m_oGraph->m_oMediator->m_iConnType == 0)
{
update_triangle();
......@@ -63,6 +67,7 @@ void canvas_link::update_pos()
{
update_spline();
}
update();
}
void canvas_link::update_selected()
......@@ -105,6 +110,7 @@ void canvas_link::update_triangle()
QPainterPath l_oPath;
l_oPath.addPolygon(_polygon);
setPath(l_oPath);
return;
}
......@@ -127,6 +133,7 @@ void canvas_link::update_triangle()
QPainterPath l_oPath;
l_oPath.addPolygon(_polygon);
setPath(l_oPath);
}
......@@ -162,6 +169,7 @@ void canvas_link::update_spline()
QPainterPath l_oPath;
l_oPath.addPolygon(_polygon);
setPath(l_oPath);
return;
}
......
......@@ -11,6 +11,7 @@
#define MUL 64
#define GRADVAL 110
#define JUST 1
class box_link;
class connectable
{
public:
......@@ -20,7 +21,25 @@ class connectable
virtual QRectF rectPos() const { return QRectF(); }
virtual void update_data() {};
virtual void update_size() {};
virtual int choose_position(const QPointF&p, int id=-1) { Q_ASSERT(false); return 0; };
virtual int choose_position(const QPointF&, box_link*) { Q_ASSERT(false); return 0; };
virtual int optimize_position(const QPointF& i_o)
{
QRectF r = rectPos();
QPointF l_o1 = r.topLeft() - i_o + QPointF(r.width()/2, r.height()/2);
double c_x = l_o1.x() * r.height();
double c_y = l_o1.y() * r.width();
int cand = 0;
if (qAbs(c_x) > qAbs(c_y))
{
cand = (c_x > 0) ? data_link::WEST : data_link::EAST;
}
else
{
cand = (c_y > 0) ? data_link::NORTH : data_link::SOUTH;
}
return cand + 500 * MUL;
};
virtual QPoint get_point(int position) { return QPoint(0, 0); };
data_box *m_oBox;
box_chain *m_oChain;
......
......@@ -94,26 +94,13 @@ QVariant box_control_point::itemChange(GraphicsItemChange i_oChange, const QVari
{
// TODO make sure items do not mess each other positions (crashes...)
QPointF l_o = i_oValue.toPointF();
QPoint np = QPoint(l_o.x(), l_o.y());
if (m_oView->m_oCurrent && this == m_oLink->m_oEndPoint)
{
connectable *start = m_oView->m_oItems.value(m_oView->m_oCurrent->m_oInnerLink.m_iParent);
QRectF r = start->rectPos();
QPointF l_o1 = r.topLeft() - l_o + QPointF(r.width()/2, r.height()/2);
double c_x = l_o1.x() * r.height();
double c_y = l_o1.y() * r.width();
int cand = 0;
if (qAbs(c_x) > qAbs(c_y))
{
cand = (c_x > 0) ? data_link::WEST : data_link::EAST;
}
else
{
cand = (c_y > 0) ? data_link::NORTH : data_link::SOUTH;
}
m_oView->m_oCurrent->m_oInnerLink.m_iParentPos = cand + MUL * 500;
m_oView->m_oCurrent->m_oInnerLink.m_iParentPos = start->optimize_position(m_oView->m_oCurrent->m_oInnerLink.m_oEndPoint);
}
if (m_bIsSegment)
......@@ -158,7 +145,7 @@ QVariant box_control_point::itemChange(GraphicsItemChange i_oChange, const QVari
if (l_oUnder)
{
int l_iPosition = (int) l_oUnder->choose_position(l_o);
int l_iPosition = (int) l_oUnder->choose_position(l_o, m_oLink);
if (l_oUnder)
{
if (m_oLink->m_oStartPoint == this)
......@@ -219,6 +206,12 @@ QVariant box_control_point::itemChange(GraphicsItemChange i_oChange, const QVari
}
else if (i_oChange == ItemPositionHasChanged)
{
if (m_oView->m_oCurrent && this == m_oLink->m_oEndPoint)
{
connectable *start = m_oView->m_oItems.value(m_oView->m_oCurrent->m_oInnerLink.m_iParent);
m_oView->m_oCurrent->m_oInnerLink.m_iParentPos = start->optimize_position(m_oView->m_oCurrent->m_oInnerLink.m_oEndPoint);
}
if (m_bIsSegment && m_bChanged && m_oLink->m_oLst.size() > m_iOffset)
{
m_oLink->update_offset(pos(), m_iOffset);
......
......@@ -134,7 +134,7 @@ void box_dot::update_links()
}
}
int box_dot::choose_position(const QPointF& i_oP, int id)
int box_dot::choose_position(const QPointF& i_oP, box_link*)
{
QRectF r = rectPos();
QPointF l_o = pos() - i_oP + QPointF(r.width()/2, r.height()/2);
......
......@@ -41,7 +41,7 @@ class box_dot : public QGraphicsRectItem, public connectable
void update_size();
QVariant itemChange(GraphicsItemChange i_oChange, const QVariant &i_oValue);
int choose_position(const QPointF&p, int id=-1);
int choose_position(const QPointF&p, box_link*);
QPoint get_point(int position);
};
......
......@@ -201,7 +201,7 @@ void box_fork::update_links()
static int RATIO[] = {250, 333, 500, 667, 750, 0};
int box_fork::choose_position(const QPointF& i_oP, int id)
int box_fork::choose_position(const QPointF& i_oP, box_link*)
{
QRectF r = rectPos();
QPointF l_o = pos() - i_oP + QPointF(r.width()/2, r.height()/2);
......
......@@ -42,7 +42,7 @@ class box_fork : public QGraphicsRectItem, public connectable, public resizable
box_resize_point *m_oRight;
QVariant itemChange(GraphicsItemChange i_oChange, const QVariant &i_oValue);
int choose_position(const QPointF&p, int id=-1);
int choose_position(const QPointF&p, box_link*);
QPoint get_point(int position);
void update_sizers();
......
......@@ -186,7 +186,7 @@ void box_item::update_links()
static int RATIO[] = {333, 500, 667, 0};
int box_item::choose_position(const QPointF& i_oP, int id)
int box_item::choose_position(const QPointF& i_oP, box_link*)
{
QRectF r = rectPos();
QPointF l_o = pos() - i_oP + QPointF(r.width()/2, r.height()/2);
......
......@@ -47,7 +47,7 @@ class box_item : public QGraphicsRectItem, public connectable, public editable,
QVariant itemChange(GraphicsItemChange i_oChange, const QVariant &i_oValue);
int choose_position(const QPointF&p, int id=-1);
int choose_position(const QPointF&p, box_link*);
QPoint get_point(int position);
QPointF m_oLastPressPoint;
......
// Thomas Nagy 2007-2017 GPLV3
#include <QApplication>
#include <QAbstractTextDocumentLayout>
#include <QTextDocument>
#include <QTextDocumentFragment>
#include <QTextList>
#include <QClipboard>
#include <QPainter>
#include <QGraphicsSceneMouseEvent>
#include <QtDebug>
#include <QAction>
#include <QTextDocument>
#include "box_sequence.h"
#include "data_item.h"
#include "res:zable.h"
#include "box_view.h"
#include "box_link.h"
#include"box_control_point.h"
#include "sem_mediator.h"
#include "mem_box.h"
#include <QFont>
box_sequence::box_sequence(box_view* view, int id) : box_item(view, id)
{
setZValue(80);
m_oResize->setRect(-CTRLSIZE, 1-CTRLSIZE, CTRLSIZE, CTRLSIZE);
m_oResizeStick = new box_resize_point(m_oView, this);
m_oResizeStick->setCursor(Qt::SizeVerCursor);
m_oResizeStick->setRect(-CTRLSIZE/2., -CTRLSIZE, CTRLSIZE, CTRLSIZE);
m_oResizeStick->hide();
m_oResizeStick->setParentItem(this);
update_size();
}
void box_sequence::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QPen l_oPen = QPen(Qt::SolidLine);
l_oPen.setColor(Qt::black);
l_oPen.setWidth(1);
l_oPen.setCosmetic(false);
if (isSelected()) l_oPen.setStyle(Qt::DotLine);
painter->setPen(l_oPen);
qreal pad = l_oPen.width() / 2.;
QRectF l_oRect = rect().adjusted(pad, pad, -pad, -pad);
QPointF l_oMidBottom = (l_oRect.bottomLeft() + l_oRect.bottomRight()) / 2.;
l_oRect.setBottomLeft(l_oRect.topLeft() + QPointF(0, m_iBoxHeight));
QColor bc(m_oBox->color);
if (m_oView->m_bDisableGradient)
{
painter->setBrush(bc);
}
else
{
QLinearGradient linearGradient(0, 0, l_oRect.width(), 0);
linearGradient.setColorAt(0.0, bc);
linearGradient.setColorAt(1.0, bc.darker(GRADVAL));
painter->setBrush(linearGradient);
}
painter->drawRect(l_oRect);
QPointF l_oBottom = (l_oRect.bottomLeft() + l_oRect.bottomRight()) / 2.;
painter->drawLine(l_oBottom, l_oMidBottom);
QAbstractTextDocumentLayout::PaintContext ctx;
ctx.palette = QApplication::palette("QTextControl");
ctx.palette.setColor(QPalette::Text, Qt::black); // white on black kde themes
QAbstractTextDocumentLayout * lay = doc.documentLayout();
qreal yoff = lay->documentSize().height();
painter->translate(OFF, OFF + (l_oRect.height() - 2 * OFF - yoff) / 2.);
lay->draw(painter, ctx);
}
void box_sequence::update_size()
{
m_iWW = m_oBox->m_iWW;
m_iHH = m_oBox->m_iHH;
m_iBoxHeight = m_oBox->m_iBoxHeight;
doc.setHtml(QString("<div align='center'>%1</div>").arg(m_oBox->m_sText));
doc.setTextWidth(m_iWW - 2 * OFF);
prepareGeometryChange();
setRect(0, 0, m_iWW, m_iHH);
m_oChain->setPos(boundingRect().right() + 3, 0);
update_links();
update_sizers();
// change the shape
QRectF l_oRect = rect();
QPointF l_oMidBottom = (l_oRect.bottomLeft() + l_oRect.bottomRight()) / 2.;
l_oRect.setBottomLeft(l_oRect.topLeft() + QPointF(0, m_iBoxHeight));
QPointF l_oMidUp = (l_oRect.bottomLeft() + l_oRect.bottomRight()) / 2.;
QRectF l_o = QRectF(l_oMidBottom, l_oMidUp);
QPainterPath p;
p.addRect(l_oRect);
l_o.adjust(-10, 0, 10, 0);
p.addRect(l_o);
inner_shape = p;
update();
}
QPointF box_sequence::validate_point(box_resize_point *p, const QPointF & orig)
{
if (p == m_oResize)
{
QSize s = best_size(orig);
m_iLastStretchX = s.width();
m_iBoxHeight = s.height();
m_iLastStretchY = m_iBoxHeight + (m_oBox->m_iHH - m_oBox->m_iBoxHeight);
m_oChain->setPos(m_iLastStretchX + 3, 0);
prepareGeometryChange();
setRect(0, 0, m_iLastStretchX, m_iLastStretchY);
m_iWW = m_iLastStretchX;
m_iHH = m_iLastStretchY;
update();
update_links();
m_oResizeStick->setPos(m_iLastStretchX/2., m_iLastStretchY);
m_oView->message(m_oView->trUtf8("%1 x %2 (%3+%4)").arg(
QString::number(m_iLastStretchX),
QString::number(m_iLastStretchY),
QString::number(m_iBoxHeight),
QString::number(m_iLastStretchY - m_iBoxHeight)), 1000);
return QPointF(m_iLastStretchX, m_iBoxHeight);
}
else if (p == m_oResizeStick)
{
int l_iMinOff = 2 * GRID;
foreach (box_link* l_oLink, m_oView->m_oLinks)
{
if (l_oLink->m_oInnerLink.m_iParent == m_iId)
{
int l_iTmp = l_oLink->m_oInnerLink.m_iParentPos / MUL;
if (l_iTmp > l_iMinOff - GRID) {
l_iMinOff = l_iTmp + GRID;
}
}
else if (l_oLink->m_oInnerLink.m_iChild == m_iId)
{
int l_iTmp = l_oLink->m_oInnerLink.m_iChildPos / MUL;
if (l_iTmp > l_iMinOff - GRID) {
l_iMinOff = l_iTmp + GRID;
}
}
}
m_iHH = m_iLastStretchY = int_val(orig.y());
if (m_iLastStretchY < m_iBoxHeight + l_iMinOff) m_iLastStretchY = m_iBoxHeight + l_iMinOff;
prepareGeometryChange();
setRect(0, 0, m_oBox->m_iWW, m_iLastStretchY);
update();
update_links();
m_oView->message(m_oView->trUtf8("%1 x %2 (%3+%4)").arg(
QString::number(m_oBox->m_iWW),
QString::number(m_iLastStretchY),
QString::number(m_iBoxHeight),
QString::number(m_iLastStretchY - m_iBoxHeight)), 1000);
return QPointF(m_oBox->m_iWW/2., m_iLastStretchY);
}
return orig;
}
QPainterPath box_sequence::shape() const
{
return inner_shape;
}
void box_sequence::commit_size(box_resize_point *p)
{
mem_size_sequence *mem = new mem_size_sequence(m_oView->m_oMediator, m_oView->m_iId, m_oBox);
mem->m_oNextBox.m_iWW = m_iWW;
mem->m_oNextBox.m_iHH = m_iHH;
mem->m_oNextBox.m_iBoxHeight = m_iBoxHeight;
mem->apply();
}
void box_sequence::freeze(bool b)
{
if (b)
{
setFlags(ItemIsSelectable);
m_iLastStretchX = 0;
m_iLastStretchY = 0;
}
else
{
setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges);
}
}
void box_sequence::update_data()
{
m_iBoxHeight = m_oBox->m_iBoxHeight;
box_item::update_data();
update_size();
}
void box_sequence::update_sizers()
{
m_oResize->setPos(m_iWW, m_iBoxHeight);
m_oResizeStick->setPos(m_iWW / 2., m_iHH);
}
void box_sequence::update_selection()
{
m_oResize->setVisible(isSelected());
m_oResizeStick->setVisible(isSelected());
m_oChain->setVisible(isSelected());
}
QPoint box_sequence::get_point(int i_oP)
{
switch (i_oP & data_link::COORD) {
case data_link::NORTH:
return box_item::get_point(i_oP);
case data_link::SOUTH:
case data_link::WEST:
case data_link::EAST:
{
QRectF l_oR = rectPos();
QPointF l_oTopLeft = l_oR.topLeft();
return QPoint(l_oTopLeft.x() + l_oR.width()/2., l_oTopLeft.y() + m_iBoxHeight + i_oP / MUL);
}
}
Q_ASSERT(false);
return QPoint(0, 0);
}
int box_sequence::choose_position(const QPointF& i_oP, box_link* i_oLink)
{
QRectF l_oR = rectPos();
if (i_oP.y() < l_oR.top() + m_iBoxHeight)
{
return box_item::choose_position(QPointF(i_oP.x(), l_oR.top()), i_oLink);
}
else
{
QPointF l_oMid = (i_oLink->m_oStartPoint->pos() + i_oLink->m_oEndPoint->pos()) / 2.;
int l_iRet = 0;
if (l_oMid.x() > l_oR.x() + l_oR.width() / 2.)
{
l_iRet = data_link::EAST;
}
else
{
l_iRet = data_link::WEST;
}
int l_iDiff = int_val(i_oP.y() - l_oR.top() - m_iBoxHeight);
if (l_iDiff < GRID)
{
l_iDiff = GRID;
}
return l_iRet + l_iDiff * MUL;
}
}
int box_sequence::optimize_position(const QPointF& i_oP)
{
QRectF l_oR = rectPos();
int l_iDiff = int_val(i_oP.y() - l_oR.top() - m_iBoxHeight);
if (l_iDiff < GRID)
{
l_iDiff = GRID;
}
else if (l_iDiff >= l_oR.height() - m_iBoxHeight - GRID)
{
l_iDiff = int_val(l_oR.height() - m_iBoxHeight - GRID);
}
if (i_oP.x() > l_oR.x() + l_oR.width() / 2.)
{
return l_iDiff * MUL + data_link::EAST;
}
else
{
return l_iDiff * MUL + data_link::WEST;
}
}
// Thomas Nagy 2017-2017 GPLV3
#ifndef BOX_SEQUENCE_H
#define BOX_SEQUENCE_H
#include <QGraphicsRectItem>
#include <QBrush>
#include "res:zable.h"
#include "ed:table.h"
#include <QPainterPath>
#include "box_item.h"
#include <box_resize_point.h>
#include "CON.h"
#include "con.h"
class box_sequence : public box_item
{
public:
void paint(QPainter *, const QStyleOptionGraphicsItem*, QWidget*);
box_sequence(box_view*, int);
void update_size();
box_resize_point *m_oResizeStick;
QPainterPath shape() const;
QPainterPath inner_shape;
int choose_position(const QPointF&, box_link*);
QPoint get_point(int);
void update_data();
void update_selection();
void fix_sizers_visibility();
void allocate_connectors();
void update_sizers();
QPointF validate_point(box_resize_point *, const QPointF &);
void freeze(bool);
void commit_size(box_resize_point *);
int optimize_position(const QPointF& i_o);
int m_iBoxHeight;
};
#endif // BOX_SEQUENCE_H
......@@ -61,6 +61,7 @@
#include "data_item.h"
#include "box_usecase.h"
#include "box_view.h"
#include"box_sequence.h"
#include "sembind.h"
#include "mem_box.h"
#include "export_fig_dialog.h"
......@@ -104,6 +105,9 @@ box_reader::box_reader(box_view *i_oControl)
bool box_reader::startElement(const QString&, const QString&, const QString& i_sName, const QXmlAttributes& i_oAttrs)
{
#ifdef _DEBUG
return true;
#endif
if (i_sName == QObject::trUtf8("box_item"))
{
int id = i_oAttrs.value(QObject::trUtf8("id")).toInt();
......@@ -232,6 +236,8 @@ box_view::box_view(QWidget *i_oWidget, sem_mediator *i_oControl) : QGraphicsView
connect(m_oAddDatabase, SIGNAL(triggered()), this, SLOT(slot_add_element()));
m_oAddPipe = new QAction(QObject::trUtf8("Pipe"), this);
connect(m_oAddPipe, SIGNAL(triggered()), this, SLOT(slot_add_element()));
m_oAddSequence = new QAction(QObject::trUtf8("Sequence"), this);
connect(m_oAddSequence, SIGNAL(triggered()), this, SLOT(slot_add_element()));
m_oAddDotStart = new QAction(QObject::trUtf8("Activity start"), this);
connect(m_oAddDotStart, SIGNAL(triggered()), this, SLOT(slot_add_element()));
m_oAddDotEnd = new QAction(QObject::trUtf8("Activity end"), this);
......@@ -304,6 +310,7 @@ void box_view::init_menu()
m_oAddBoxMenu->addAction(m_oAddClass);
m_oAddBoxMenu->addAction(m_oAddPipe);
m_oAddBoxMenu->addAction(m_oAddDatabase);
m_oAddBoxMenu->addAction(m_oAddSequence);
//m_oMenu->addAction(m_oEditAction);
m_oMenu->addAction(m_oDeleteAction);
......@@ -485,6 +492,10 @@ void box_view::sync_view()
{
l_o = new box_matrix(this, box->m_iId);
}
else if (box->m_iType == data_box::SEQUENCE)
{
l_o = new box_matrix(this, box->m_iId);
}
else if (box->m_iType == data_box::FRAME)
{
l_o = new box_frame(this, box->m_iId);
......@@ -890,6 +901,13 @@ void box_view::slot_add_element()
add->box->m_oColSizes.push_back(170);
add->box->m_oColSizes.push_back(170);
}
else if (sender == m_oAddSequence)
{
add->box->m_iType = data_box::SEQUENCE;
add->box->m_iWW = 80;
add->box->m_iHH = 280;
add->box->m_iBoxHeight = 40;
}
else if (sender == m_oAddFrame)
{
add->box->m_iType = data_box::FRAME;
......@@ -1198,6 +1216,10 @@ void box_view::notify_add_box(int id, int box)
{
l_o = new box_matrix(this, box);
}
else if (db->m_iType == data_box::SEQUENCE)
{
l_o = new box_sequence(this, box);
}
else if (db->m_iType == data_box::FRAME)
{
l_o = new box_frame(this, box);
......@@ -1542,7 +1564,7 @@ void box_view::mousePressEvent(QMouseEvent *i_oEv)
m_oCurrent = new box_link(this);
m_oCurrent->m_oInnerLink.m_iParent = l_oParent->m_iId;
m_oCurrent->m_oInnerLink.m_iParentPos = data_link::EAST + MUL * 500;
m_oCurrent->m_oInnerLink.m_iParentPos = l_oParent->optimize_position(p);
m_oCurrent->m_oInnerLink.m_iChild = NO_ITEM;
m_oCurrent->m_oInnerLink.m_iChildPos = data_link::NORTH;
m_oCurrent->m_oInnerLink.m_oStartPoint = m_oCurrent->m_oInnerLink.m_oEndPoint = p;
......@@ -1553,6 +1575,11 @@ void box_view::mousePressEvent(QMouseEvent *i_oEv)
m_oCurrent->m_oInnerLink.m_iRightArrow = data_link::NONE;
}
if (dynamic_cast<box_sequence*>(l_oParent))
{
m_oCurrent->m_oInnerLink.m_iLineType = data_link::LINE;
}
if (dynamic_cast<box_node*>(l_oParent) || dynamic_cast<box_component*>(l_oParent))
{
m_oCurrent->m_oInnerLink.m_iLeftArrow = data_link::NONE;
......@@ -1712,6 +1739,12 @@ void box_view::notify_size_box(int id, const QList<data_box*>& items)
}
}
void box_view::notify_sequence_box(int i_iId, int i_iBoxId)