void csEvtHandler::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int keys, int WXUNUSED(attachment))
{
wxClientDC dc(GetShape()->GetCanvas());
void csEvtHandler::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int keys, int WXUNUSED(attachment))
{
wxClientDC dc(GetShape()->GetCanvas());
// If the shape was selected, deselect it and vice versa.
bool selected = GetShape()->Selected();
// If the shape was selected, deselect it and vice versa.
bool selected = GetShape()->Selected();
- GetShape()->Select(FALSE, &dc);
- view->SelectShape(GetShape(), FALSE);
+ GetShape()->Select(false, &dc);
+ view->SelectShape(GetShape(), false);
- GetShape()->Select(TRUE, &dc);
- view->SelectShape(GetShape(), TRUE);
+ GetShape()->Select(true, &dc);
+ view->SelectShape(GetShape(), true);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
GetShape()->GetAttachmentPositionEdge(attachment, &xp, &yp);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
GetShape()->GetAttachmentPositionEdge(attachment, &xp, &yp);
- dc.DrawLine(xp, yp, x, y);
+ dc.DrawLine((wxCoord)xp, (wxCoord)yp, (wxCoord)x, (wxCoord)y);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
GetShape()->GetAttachmentPositionEdge(attachment, &xp, &yp);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
GetShape()->GetAttachmentPositionEdge(attachment, &xp, &yp);
- dc.DrawLine(xp, yp, x, y);
+ dc.DrawLine((wxCoord)xp, (wxCoord)yp, (wxCoord)x, (wxCoord)y);
}
void csEvtHandler::OnEndDragRight(double x, double y, int WXUNUSED(keys), int attachment)
}
void csEvtHandler::OnEndDragRight(double x, double y, int WXUNUSED(keys), int attachment)
// Check if we're on an object
int new_attachment;
wxShape *otherShape = canvas->FindFirstSensitiveShape(x, y, &new_attachment, OP_DRAG_RIGHT);
// Check if we're on an object
int new_attachment;
wxShape *otherShape = canvas->FindFirstSensitiveShape(x, y, &new_attachment, OP_DRAG_RIGHT);
if (otherShape && !otherShape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxLineShape* theShape = new csLineShape;
if (otherShape && !otherShape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxLineShape* theShape = new csLineShape;
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
GetShape()->GetEventHandler()->OnDrawOutline(dc, xx, yy, w, h);
// Draw bounding box for other selected shapes
GetShape()->GetEventHandler()->OnDrawOutline(dc, xx, yy, w, h);
// Draw bounding box for other selected shapes
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
shape->GetBoundingBoxMax(&w, &h);
shape->OnDrawOutline(dc, shape->GetX() + offsetX, shape->GetY() + offsetY, w, h);
}
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
shape->GetBoundingBoxMax(&w, &h);
shape->OnDrawOutline(dc, shape->GetX() + offsetX, shape->GetY() + offsetY, w, h);
}
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
GetShape()->GetEventHandler()->OnDrawOutline(dc, xx, yy, w, h);
// Draw bounding box for other selected shapes
GetShape()->GetEventHandler()->OnDrawOutline(dc, xx, yy, w, h);
// Draw bounding box for other selected shapes
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
shape->GetBoundingBoxMax(&w, &h);
shape->OnDrawOutline(dc, shape->GetX() + offsetX, shape->GetY() + offsetY, w, h);
}
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
shape->GetBoundingBoxMax(&w, &h);
shape->OnDrawOutline(dc, shape->GetX() + offsetX, shape->GetY() + offsetY, w, h);
}
// Only move the line point(s) if both ends move too
if (shape->IsKindOf(CLASSINFO(wxLineShape)) &&
((wxLineShape*)shape)->GetTo()->Selected() && ((wxLineShape*)shape)->GetFrom()->Selected())
{
wxLineShape* lineShape = (wxLineShape*) shape;
// Only move the line point(s) if both ends move too
if (shape->IsKindOf(CLASSINFO(wxLineShape)) &&
((wxLineShape*)shape)->GetTo()->Selected() && ((wxLineShape*)shape)->GetFrom()->Selected())
{
wxLineShape* lineShape = (wxLineShape*) shape;
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
wxShape* newShape2 = shape->CreateNewCopy();
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
wxShape* newShape2 = shape->CreateNewCopy();
newShape2->SetY(shape->GetY() + offsetY);
cmd->AddState(new csCommandState(ID_CS_MOVE, newShape2, shape));
}
newShape2->SetY(shape->GetY() + offsetY);
cmd->AddState(new csCommandState(ID_CS_MOVE, newShape2, shape));
}
// For now, no line property editing
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
// For now, no line property editing
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
}
csShapePropertiesDialog* dialog = new csShapePropertiesDialog(shape->GetCanvas()->GetParent(), title, attributeDialog, attributeDialogName);
}
csShapePropertiesDialog* dialog = new csShapePropertiesDialog(shape->GetCanvas()->GetParent(), title, attributeDialog, attributeDialogName);
view->GetDocument()->GetCommandProcessor()->Submit(new csDiagramCommand(_T("Edit properties"), (csDiagramDocument*) view->GetDocument(),
new csCommandState(ID_CS_EDIT_PROPERTIES, newShape, shape)));
view->GetDocument()->GetCommandProcessor()->Submit(new csDiagramCommand(_T("Edit properties"), (csDiagramDocument*) view->GetDocument(),
new csCommandState(ID_CS_EDIT_PROPERTIES, newShape, shape)));
bool csDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeSave(db, shape, expr);
csEvtHandler *handler = (csEvtHandler *)shape.GetEventHandler();
expr.AddAttributeValueString(_T("label"), handler->m_label);
bool csDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeSave(db, shape, expr);
csEvtHandler *handler = (csEvtHandler *)shape.GetEventHandler();
expr.AddAttributeValueString(_T("label"), handler->m_label);
expr.GetAttributeValue(_T("label"), label);
csEvtHandler *handler = new csEvtHandler(&shape, &shape, label);
shape.SetEventHandler(handler);
expr.GetAttributeValue(_T("label"), label);
csEvtHandler *handler = new csEvtHandler(&shape, &shape, label);
shape.SetEventHandler(handler);
- DrawRectangle(wxRect(- w/2, - h/2, w, h));
+ DrawRectangle(wxRect((int)(- w/2), (int)(- h/2), (int)(w), (int)(h)));
CalculateSize();
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
CalculateSize();
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
- DrawRoundedRectangle(wxRect(- w/2, - h/2, w, h), -0.3);
+ DrawRoundedRectangle(wxRect((int)(- w/2), (int)(- h/2), (int)(w), (int)(h)), -0.3);
CalculateSize();
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
CalculateSize();
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
- points[0] = wxPoint( 0 , - h / 2 );
- points[1] = wxPoint( w / 2 , h / 2 );
- points[2] = wxPoint( -w / 2, h / 2 );
+ points[0] = wxPoint( 0 , (int)(- h / 2) );
+ points[1] = wxPoint( (int)(w / 2) , (int)(h / 2) );
+ points[2] = wxPoint( (int)(-w / 2), (int)(h / 2) );
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
// bounding box, since we can't calculate the bounding box for
// an arbitrary arc (not implemented)
// bounding box, since we can't calculate the bounding box for
// an arbitrary arc (not implemented)
- DrawRectangle(wxRect(-w/2.0, -h/2.0, w, h));
+ DrawRectangle(wxRect((int)(-w/2.0), (int)(-h/2.0), (int)(w), (int)(h)));
SetDrawnPen(wxBLACK_PEN);
wxBrush* brush = wxTheBrushList->FindOrCreateBrush(wxColour(220, 220, 220), wxSOLID);
SetDrawnBrush(brush);
SetDrawnPen(wxBLACK_PEN);
wxBrush* brush = wxTheBrushList->FindOrCreateBrush(wxColour(220, 220, 220), wxSOLID);
SetDrawnBrush(brush);
- DrawEllipticArc(wxRect(-w/2, -h/2, w, 2*h), 0.0, 180.0);
- DrawLine(wxPoint(-w/2, h/2), wxPoint(w/2, h/2));
+ DrawEllipticArc(wxRect((int)(-w/2), (int)(-h/2), (int)(w), (int)(2*h)), 0.0, 180.0);
+ DrawLine(wxPoint((int)(-w/2), (int)(h/2)), wxPoint((int)(w/2), (int)(h/2)));
- DrawRectangle(wxRect(-w/2, -h/2, w, h));
+ DrawRectangle(wxRect((int)(-w/2), (int)(-h/2), (int)(w), (int)(h)));
- DrawEllipticArc(wxRect(-w/2 - w, -h/2, 2*w, h), 270.0, 90.0);
- DrawLine(wxPoint(-w/2, -h/2), wxPoint(-w/2, h/2));
+ DrawEllipticArc(wxRect((int)(-w/2 - w), (int)(-h/2), (int)(2*w), (int)(h)), 270.0, 90.0);
+ DrawLine(wxPoint((int)(-w/2), (int)(-h/2)), wxPoint((int)(-w/2), (int)(h/2)));
- DrawRectangle(wxRect(-w/2, -h/2, w, h));
+ DrawRectangle(wxRect((int)(-w/2), (int)(-h/2), (int)(w), (int)(h)));
- DrawEllipticArc(wxRect(-w/2, -h/2 - h, w, 2*h), 180.0, 0.0);
- DrawLine(wxPoint(-w/2, -h/2), wxPoint(w/2, -h/2));
+ DrawEllipticArc(wxRect((int)(-w/2), (int)(-h/2 - h), (int)(w), (int)(2*h)), 180.0, 0.0);
+ DrawLine(wxPoint((int)(-w/2), (int)(-h/2)), wxPoint((int)(w/2), (int)(-h/2)));
- DrawRectangle(wxRect(-w/2, -h/2, w, h));
+ DrawRectangle(wxRect((int)(-w/2), (int)(-h/2), (int)(w), (int)(h)));
- DrawEllipticArc(wxRect(-w/2, -h/2, 2*w, h), 90.0, 270.0);
- DrawLine(wxPoint(w/2, -h/2), wxPoint(w/2, h/2));
+ DrawEllipticArc(wxRect((int)(-w/2), (int)(-h/2), (int)(2*w), (int)(h)), 90.0, 270.0);
+ DrawLine(wxPoint((int)(w/2),(int)(-h/2)), wxPoint((int)(w/2), (int)(h/2)));
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetBrush(wxTRANSPARENT_BRUSH);
SetSize(csSTANDARD_SHAPE_WIDTH, csSTANDARD_SHAPE_WIDTH);
SetBrush(wxTRANSPARENT_BRUSH);
SetSize(csSTANDARD_SHAPE_WIDTH, csSTANDARD_SHAPE_WIDTH);
SetAttachmentMode(ATTACHMENT_MODE_NONE);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
SetAttachmentMode(ATTACHMENT_MODE_NONE);
SetBranchStyle(BRANCHING_ATTACHMENT_NORMAL|BRANCHING_ATTACHMENT_BLOB);
view->GetDocument()->GetCommandProcessor()->Submit(new csDiagramCommand(_T("Move line point"), (csDiagramDocument*) view->GetDocument(),
new csCommandState(ID_CS_MOVE_LINE_POINT, newShape, this)));
view->GetDocument()->GetCommandProcessor()->Submit(new csDiagramCommand(_T("Move line point"), (csDiagramDocument*) view->GetDocument(),
new csCommandState(ID_CS_MOVE_LINE_POINT, newShape, this)));
}
wxLabelShape* csLineShape::OnCreateLabelShape(wxLineShape *parent, wxShapeRegion *region, double w, double h)
}
wxLabelShape* csLineShape::OnCreateLabelShape(wxLineShape *parent, wxShapeRegion *region, double w, double h)
view->GetDocument()->GetCommandProcessor()->Submit(new csDiagramCommand("Move label", (csDiagramDocument*) view->GetDocument(),
new csCommandState(ID_CS_MOVE_LABEL, newShape, this)));
view->GetDocument()->GetCommandProcessor()->Submit(new csDiagramCommand("Move label", (csDiagramDocument*) view->GetDocument(),
new csCommandState(ID_CS_MOVE_LABEL, newShape, this)));