Usage of common default colours in OGL + minor warning fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-03-03 19:37:15 +00:00
parent 1e24d8f783
commit 55c91e8a3f
12 changed files with 63 additions and 59 deletions

View File

@@ -56,7 +56,7 @@ bool DiagramDocument::OnCloseDocument(void)
wxSTD ostream& DiagramDocument::SaveObject(wxSTD ostream& stream)
{
wxDocument::SaveObject(stream);
char buf[400];
(void) wxGetTempFileName("diag", buf);
@@ -64,7 +64,7 @@ wxSTD ostream& DiagramDocument::SaveObject(wxSTD ostream& stream)
wxTransferFileToStream(buf, stream);
wxRemoveFile(buf);
return stream;
}
@@ -199,12 +199,12 @@ bool DiagramCommand::Do(void)
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)))
{
@@ -213,7 +213,7 @@ bool DiagramCommand::Do(void)
toShape = lineShape->GetTo();
}
shape->Unlink();
doc->Modify(true);
doc->UpdateAllViews();
}
@@ -233,7 +233,7 @@ bool DiagramCommand::Do(void)
theShape->SetCentreResize(false);
theShape->SetPen(wxBLACK_PEN);
theShape->SetBrush(wxCYAN_BRUSH);
theShape->SetSize(60, 60);
}
doc->GetDiagram()->AddShape(theShape);
@@ -243,7 +243,7 @@ bool DiagramCommand::Do(void)
theShape->GetCanvas()->PrepareDC(dc);
theShape->Move(dc, x, y);
shape = theShape;
deleteShape = false;
@@ -271,11 +271,11 @@ bool DiagramCommand::Do(void)
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());
@@ -285,7 +285,7 @@ bool DiagramCommand::Do(void)
// connected images
fromShape->Move(dc, fromShape->GetX(), fromShape->GetY());
toShape->Move(dc, toShape->GetX(), toShape->GetY());
shape = theShape;
deleteShape = false;
@@ -304,7 +304,7 @@ bool DiagramCommand::Do(void)
shape->SetBrush(shapeBrush);
shapeBrush = oldBrush;
shape->Draw(dc);
doc->Modify(true);
doc->UpdateAllViews();
}
@@ -325,7 +325,7 @@ bool DiagramCommand::Do(void)
shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
doc->Modify(true);
doc->UpdateAllViews();
}
@@ -390,7 +390,7 @@ bool DiagramCommand::Undo(void)
shape->SetBrush(shapeBrush);
shapeBrush = oldBrush;
shape->Draw(dc);
doc->Modify(true);
doc->UpdateAllViews();
}
@@ -410,7 +410,7 @@ bool DiagramCommand::Undo(void)
shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
doc->Modify(true);
doc->UpdateAllViews();
}
@@ -429,7 +429,7 @@ void DiagramCommand::RemoveLines(wxShape *shape)
{
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();
}
}
@@ -437,7 +437,7 @@ void DiagramCommand::RemoveLines(wxShape *shape)
/*
* 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());
@@ -495,11 +495,11 @@ void MyEvtHandler::OnBeginDragRight(double x, double y, int WXUNUSED(keys), int
// 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;
@@ -516,7 +516,7 @@ void MyEvtHandler::OnDragRight(bool WXUNUSED(draw), double x, double y, int WXUN
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;
@@ -532,7 +532,7 @@ void MyEvtHandler::OnEndDragRight(double x, double y, int WXUNUSED(keys), int WX
// 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(
@@ -554,7 +554,7 @@ void MyEvtHandler::OnEndSize(double WXUNUSED(x), double WXUNUSED(y))
*/
#if wxUSE_PROLOGIO
bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeSave(db, shape, expr);
@@ -570,7 +570,7 @@ bool MyDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
expr.AssignAttributeValue(_T("label"), &label);
MyEvtHandler *handler = new MyEvtHandler(&shape, &shape, wxString(label));
shape.SetEventHandler(handler);
if (label)
delete[] label;
return true;
@@ -602,7 +602,7 @@ wxDiamondShape::wxDiamondShape(double w, double h):
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);

View File

@@ -196,7 +196,7 @@ void csEvtHandler::OnBeginDragRight(double x, double y, int WXUNUSED(keys), int
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;
@@ -210,7 +210,7 @@ void csEvtHandler::OnDragRight(bool WXUNUSED(draw), double x, double y, int WXUN
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;
@@ -282,7 +282,7 @@ void csEvtHandler::OnDragLeft(bool draw, double x, double y, int keys, int attac
dc.SetLogicalFunction(OGLRBLF);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
@@ -351,7 +351,7 @@ void csEvtHandler::OnBeginDragLeft(double x, double y, int keys, int attachment)
dc.SetLogicalFunction(OGLRBLF);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));

View File

@@ -853,7 +853,7 @@ csCanvas::~csCanvas(void)
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);

View File

@@ -1312,7 +1312,7 @@ void wxShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment
dc.SetLogicalFunction(OGLRBLF);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush(* wxTRANSPARENT_BRUSH);
@@ -1357,7 +1357,7 @@ void wxShape::OnBeginDragLeft(double x, double y, int keys, int attachment)
// 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));
@@ -2711,7 +2711,9 @@ bool wxShape::GetAttachmentPosition(int attachment, double *x, double *y,
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);

View File

@@ -1298,7 +1298,7 @@ void wxShape::OnSizingDragLeft(wxControlPoint* pt, bool WXUNUSED(draw), double x
dc.SetLogicalFunction(OGLRBLF);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
@@ -1433,7 +1433,7 @@ void wxShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int
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));
@@ -1633,7 +1633,7 @@ void wxPolygonShape::OnSizingDragLeft(wxControlPoint* pt, bool WXUNUSED(draw), d
dc.SetLogicalFunction(OGLRBLF);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
@@ -1685,7 +1685,7 @@ void wxPolygonShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double
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));

View File

@@ -166,7 +166,7 @@ void wxCompositeShape::OnDragLeft(bool WXUNUSED(draw), double x, double y, int W
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));
@@ -186,7 +186,7 @@ void wxCompositeShape::OnBeginDragLeft(double x, double y, int WXUNUSED(keys), i
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();

View File

@@ -585,7 +585,7 @@ void wxDividedShapeControlPoint::OnDragLeft(bool WXUNUSED(draw), double WXUNUSED
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));
@@ -604,7 +604,7 @@ void wxDividedShapeControlPoint::OnBeginDragLeft(double WXUNUSED(x), double y, i
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));

View File

@@ -1613,9 +1613,9 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle)
{
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)
@@ -1626,9 +1626,9 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle)
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)

View File

@@ -965,7 +965,7 @@ void wxLineShape::OnDrawOutline(wxDC& dc, double WXUNUSED(x), double WXUNUSED(y)
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 );
@@ -1549,7 +1549,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause)
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)
@@ -1733,7 +1733,7 @@ void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool WXUNUSED(draw), doub
dc.SetLogicalFunction(OGLRBLF);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
@@ -1749,7 +1749,7 @@ void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool WXUNUSED(draw), doub
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);
@@ -1797,7 +1797,7 @@ void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y,
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);
@@ -2407,7 +2407,7 @@ wxLabelShape::wxLabelShape(wxLineShape *parent, wxShapeRegion *region, double w,
{
m_lineShape = parent;
m_shapeRegion = region;
SetPen(wxThePenList->FindOrCreatePen(wxColour(0, 0, 0), 1, wxDOT));
SetPen(wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxDOT));
}
wxLabelShape::~wxLabelShape()

View File

@@ -560,14 +560,14 @@ bool wxXMetaFile::ReadFile(const wxChar *file)
/* 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

View File

@@ -175,7 +175,7 @@ void wxDiagram::ShowAll(bool show)
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));

View File

@@ -452,7 +452,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
wxString oldBuffer(buffer);
wxString s = node->GetData();
if (s.IsEmpty())
if (s.empty())
{
// FORCE NEW LINE
if (buffer.Length() > 0)
@@ -871,10 +871,12 @@ wxColour oglHexToColour(const wxString& hex)
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