wxSTD ostream& DiagramDocument::SaveObject(wxSTD ostream& stream)
{
wxDocument::SaveObject(stream);
-
+
char buf[400];
(void) wxGetTempFileName("diag", buf);
wxTransferFileToStream(buf, stream);
wxRemoveFile(buf);
-
+
return stream;
}
if (shape)
{
deleteShape = true;
-
+
shape->Select(false);
-
+
// Generate commands to explicitly remove each connected line.
RemoveLines(shape);
-
+
doc->GetDiagram()->RemoveShape(shape);
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
{
toShape = lineShape->GetTo();
}
shape->Unlink();
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
theShape->SetCentreResize(false);
theShape->SetPen(wxBLACK_PEN);
theShape->SetBrush(wxCYAN_BRUSH);
-
+
theShape->SetSize(60, 60);
}
doc->GetDiagram()->AddShape(theShape);
theShape->GetCanvas()->PrepareDC(dc);
theShape->Move(dc, x, y);
-
+
shape = theShape;
deleteShape = false;
lineShape->MakeLineControlPoints(2);
lineShape->AddArrow(ARROW_ARROW, ARROW_POSITION_END, 10.0, 0.0, _T("Normal arrowhead"));
}
-
+
doc->GetDiagram()->AddShape(theShape);
-
+
fromShape->AddLine((wxLineShape *)theShape, toShape);
-
+
theShape->Show(true);
wxClientDC dc(theShape->GetCanvas());
// connected images
fromShape->Move(dc, fromShape->GetX(), fromShape->GetY());
toShape->Move(dc, toShape->GetX(), toShape->GetY());
-
+
shape = theShape;
deleteShape = false;
shape->SetBrush(shapeBrush);
shapeBrush = oldBrush;
shape->Draw(dc);
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
shape->SetBrush(shapeBrush);
shapeBrush = oldBrush;
shape->Draw(dc);
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
{
wxLineShape *line = (wxLineShape *)node->GetData();
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
-
+
node = shape->GetLines().GetFirst();
}
}
/*
* MyEvtHandler: an event handler class for all shapes
*/
-
+
void MyEvtHandler::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int keys, int WXUNUSED(attachment))
{
wxClientDC dc(GetShape()->GetCanvas());
// Force attachment to be zero for now. Eventually we can deal with
// the actual attachment point, e.g. a rectangle side if attachment mode is on.
attachment = 0;
-
+
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
// 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)))
{
canvas->view->GetDocument()->GetCommandProcessor()->Submit(
*/
#if wxUSE_PROLOGIO
-
+
bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeSave(db, shape, expr);
expr.AssignAttributeValue(_T("label"), &label);
MyEvtHandler *handler = new MyEvtHandler(&shape, &shape, wxString(label));
shape.SetEventHandler(handler);
-
+
if (label)
delete[] label;
return true;
w = 60.0;
if (h == 0.0)
h = 60.0;
-
+
wxList *thePoints = new wxList;
wxRealPoint *point = new wxRealPoint(0.0, (-h/2.0));
thePoints->Append((wxObject*) point);
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
void csCanvas::DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2)
{
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
// m_xpos = xx; m_ypos = yy;
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
double left = (double)(m_xpos - w/2.0);
double right = (double)(m_xpos + w/2.0);
+#if 0
/* bool isEnd = */ (line && line->IsEnd(this));
+#endif
int physicalAttachment = LogicalToPhysicalAttachment(attachment);
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
pt->sm_controlPointDragStartWidth = bound_x;
pt->sm_controlPointDragStartHeight = bound_y;
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
if (ppt->m_originalDistance == 0.0) ppt->m_originalDistance = (double) 0.0001;
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
GetCanvas()->PrepareDC(dc);
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
m_canvas->CaptureMouse();
GetCanvas()->PrepareDC(dc);
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
wxDividedShape *dividedObject = (wxDividedShape *)m_shape;
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
{
int penWidth = (int)expr->Nth(1)->IntegerValue();
int penStyle = (int)expr->Nth(2)->IntegerValue();
- int penRed = (int)expr->Nth(3)->IntegerValue();
- int penGreen = (int)expr->Nth(4)->IntegerValue();
- int penBlue = (int)expr->Nth(5)->IntegerValue();
+ unsigned char penRed = (unsigned char)expr->Nth(3)->IntegerValue();
+ unsigned char penGreen = (unsigned char)expr->Nth(4)->IntegerValue();
+ unsigned char penBlue = (unsigned char)expr->Nth(5)->IntegerValue();
wxColour col(penRed, penGreen, penBlue);
wxPen *p = wxThePenList->FindOrCreatePen(col, penWidth, penStyle);
if (!p)
case gyTYPE_BRUSH:
{
int brushStyle = (int)expr->Nth(1)->IntegerValue();
- int brushRed = (int)expr->Nth(2)->IntegerValue();
- int brushGreen = (int)expr->Nth(3)->IntegerValue();
- int brushBlue = (int)expr->Nth(4)->IntegerValue();
+ unsigned char brushRed = (unsigned char)expr->Nth(2)->IntegerValue();
+ unsigned char brushGreen = (unsigned char)expr->Nth(3)->IntegerValue();
+ unsigned char brushBlue = (unsigned char)expr->Nth(4)->IntegerValue();
wxColour col(brushRed, brushGreen, brushBlue);
wxBrush *b = wxTheBrushList->FindOrCreateBrush(col, brushStyle);
if (!b)
wxPen *old_pen = m_pen;
wxBrush *old_brush = m_brush;
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
SetPen(& dottedPen);
SetBrush( wxTRANSPARENT_BRUSH );
wxExpr *spacingExpr = node->Nth(7);
if (type_expr)
- arrowType = (int)type_expr->IntegerValue();
+ arrowType = (WXTYPE)type_expr->IntegerValue();
if (end_expr)
arrowEnd = (int)end_expr->IntegerValue();
if (dist_expr)
dc.SetLogicalFunction(OGLRBLF);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
wxPen *old_pen = lineShape->GetPen();
wxBrush *old_brush = lineShape->GetBrush();
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
lineShape->SetPen(& dottedPen);
lineShape->SetBrush(wxTRANSPARENT_BRUSH);
wxPen *old_pen = lineShape->GetPen();
wxBrush *old_brush = lineShape->GetBrush();
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
lineShape->SetPen(& dottedPen);
lineShape->SetBrush(wxTRANSPARENT_BRUSH);
{
m_lineShape = parent;
m_shapeRegion = region;
- SetPen(wxThePenList->FindOrCreatePen(wxColour(0, 0, 0), 1, wxDOT));
+ SetPen(wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxDOT));
}
wxLabelShape::~wxLabelShape()
/* int lfEsc = */ getshort(handle); // 2 bytes
/* int lfOrient = */ getshort(handle); // 2 bytes
int lfWeight = getshort(handle); // 2 bytes
- char lfItalic = getc(handle); // 1 byte
- char lfUnderline = getc(handle); // 1 byte
+ char lfItalic = (char)getc(handle); // 1 byte
+ char lfUnderline = (char)getc(handle); // 1 byte
/* char lfStrikeout = */ getc(handle); // 1 byte
/* char lfCharSet = */ getc(handle); // 1 byte
/* char lfOutPrecision = */ getc(handle); // 1 byte
/* char lfClipPrecision = */ getc(handle); // 1 byte
/* char lfQuality = */ getc(handle); // 1 byte
- char lfPitchAndFamily = getc(handle); // 1 byte (18th)
+ char lfPitchAndFamily = (char)getc(handle); // 1 byte (18th)
char lfFacename[32];
// Read the rest of the record, which is total record size
// minus the number of bytes already read (18 record, 6 metarecord
void wxDiagram::DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2)
{
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
wxString oldBuffer(buffer);
wxString s = node->GetData();
- if (s.IsEmpty())
+ if (s.empty())
{
// FORCE NEW LINE
if (buffer.Length() > 0)
hex.Mid(0,2).ToLong(&r, 16);
hex.Mid(2,2).ToLong(&g, 16);
hex.Mid(4,2).ToLong(&b, 16);
- return wxColour(r, g, b);
+ return wxColour((unsigned char)r,
+ (unsigned char)g,
+ (unsigned char)b);
}
else
- return wxColour(0,0,0);
+ return *wxBLACK;
}
// RGB to 3-digit hex