More Clear -> ClearBackground
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -70,67 +70,67 @@ bool DiagramView::OnCreate(wxDocument *doc, long flags)
|
||||
|
||||
|
||||
// Sneakily gets used for default print/preview
|
||||
// as well as drawing on the screen.
|
||||
void DiagramView::OnDraw(wxDC *dc)
|
||||
{
|
||||
// as well as drawing on the screen.
|
||||
void DiagramView::OnDraw(wxDC *dc)
|
||||
{
|
||||
|
||||
/* You might use THIS code if you were scaling
|
||||
* graphics of known size to fit on the page.
|
||||
*/
|
||||
int w, h;
|
||||
/* You might use THIS code if you were scaling
|
||||
* graphics of known size to fit on the page.
|
||||
*/
|
||||
int w, h;
|
||||
|
||||
// We need to adjust for the graphic size, a formula will be added
|
||||
float maxX = 900;
|
||||
float maxY = 700;
|
||||
// A better way of find the maxium values would be to search through
|
||||
// the linked list
|
||||
// We need to adjust for the graphic size, a formula will be added
|
||||
float maxX = 900;
|
||||
float maxY = 700;
|
||||
// A better way of find the maxium values would be to search through
|
||||
// the linked list
|
||||
|
||||
// Let's have at least 10 device units margin
|
||||
float marginX = 10;
|
||||
float marginY = 10;
|
||||
// Let's have at least 10 device units margin
|
||||
float marginX = 10;
|
||||
float marginY = 10;
|
||||
|
||||
// Add the margin to the graphic size
|
||||
maxX += (2 * marginX);
|
||||
maxY += (2 * marginY);
|
||||
// Add the margin to the graphic size
|
||||
maxX += (2 * marginX);
|
||||
maxY += (2 * marginY);
|
||||
|
||||
// Get the size of the DC in pixels
|
||||
dc->GetSize (&w, &h);
|
||||
// Get the size of the DC in pixels
|
||||
dc->GetSize (&w, &h);
|
||||
|
||||
// Calculate a suitable scaling factor
|
||||
float scaleX = (float) (w / maxX);
|
||||
float scaleY = (float) (h / maxY);
|
||||
// Calculate a suitable scaling factor
|
||||
float scaleX = (float) (w / maxX);
|
||||
float scaleY = (float) (h / maxY);
|
||||
|
||||
// Use x or y scaling factor, whichever fits on the DC
|
||||
float actualScale = wxMin (scaleX, scaleY);
|
||||
// Use x or y scaling factor, whichever fits on the DC
|
||||
float actualScale = wxMin (scaleX, scaleY);
|
||||
|
||||
float posX, posY;
|
||||
// Calculate the position on the DC for centring the graphic
|
||||
if (CENTER == TRUE) // center the drawing
|
||||
{
|
||||
posX = (float) ((w - (200 * actualScale)) / 2.0);
|
||||
posY = (float) ((h - (200 * actualScale)) / 2.0);
|
||||
}
|
||||
else // Use defined presets
|
||||
{
|
||||
posX = 10;
|
||||
posY = 35;
|
||||
}
|
||||
|
||||
float posX, posY;
|
||||
// Calculate the position on the DC for centring the graphic
|
||||
if (CENTER == TRUE) // center the drawing
|
||||
{
|
||||
posX = (float) ((w - (200 * actualScale)) / 2.0);
|
||||
posY = (float) ((h - (200 * actualScale)) / 2.0);
|
||||
}
|
||||
else // Use defined presets
|
||||
{
|
||||
posX = 10;
|
||||
posY = 35;
|
||||
}
|
||||
|
||||
// Set the scale and origin
|
||||
dc->SetUserScale (actualScale, actualScale);
|
||||
dc->SetDeviceOrigin ((long) posX, (long) posY);
|
||||
|
||||
// This part was added to preform the print preview and printing functions
|
||||
// Set the scale and origin
|
||||
dc->SetUserScale (actualScale, actualScale);
|
||||
dc->SetDeviceOrigin ((long) posX, (long) posY);
|
||||
|
||||
dc->BeginDrawing(); // Allows optimization of drawing code under MS Windows.
|
||||
// This part was added to preform the print preview and printing functions
|
||||
|
||||
dc->BeginDrawing(); // Allows optimization of drawing code under MS Windows.
|
||||
wxDiagram *diagram_p=((DiagramDocument*)GetDocument())->GetDiagram(); // Get the current diagram
|
||||
if (diagram_p->GetShapeList())
|
||||
{
|
||||
wxCursor *old_cursor = NULL;
|
||||
if (diagram_p->GetShapeList())
|
||||
{
|
||||
wxCursor *old_cursor = NULL;
|
||||
wxNode *current = diagram_p->GetShapeList()->First();
|
||||
|
||||
while (current) // Loop through the entire list of shapes
|
||||
while (current) // Loop through the entire list of shapes
|
||||
{
|
||||
wxShape *object = (wxShape *)current->Data();
|
||||
if (!object->GetParent())
|
||||
@@ -140,7 +140,7 @@ void DiagramView::OnDraw(wxDC *dc)
|
||||
current = current->Next(); // Procede to the next shape in the list
|
||||
}
|
||||
}
|
||||
dc->EndDrawing(); // Allows optimization of drawing code under MS Windows.
|
||||
dc->EndDrawing(); // Allows optimization of drawing code under MS Windows.
|
||||
}
|
||||
|
||||
void DiagramView::OnUpdate(wxView *sender, wxObject *hint)
|
||||
@@ -158,7 +158,7 @@ bool DiagramView::OnClose(bool deleteWindow)
|
||||
DiagramDocument *diagramDoc = (DiagramDocument *)GetDocument();
|
||||
diagramDoc->GetDiagram()->SetCanvas(NULL);
|
||||
|
||||
canvas->Clear();
|
||||
canvas->ClearBackground();
|
||||
canvas->SetDiagram(NULL);
|
||||
canvas->view = NULL;
|
||||
canvas = NULL;
|
||||
@@ -170,7 +170,7 @@ bool DiagramView::OnClose(bool deleteWindow)
|
||||
SetFrame(NULL);
|
||||
|
||||
Activate(FALSE);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -160,7 +160,7 @@ bool csDiagramView::OnClose(bool deleteWindow)
|
||||
csDiagramDocument *diagramDoc = (csDiagramDocument *)GetDocument();
|
||||
diagramDoc->GetDiagram()->SetCanvas(NULL);
|
||||
|
||||
canvas->Clear();
|
||||
canvas->ClearBackground();
|
||||
canvas->SetDiagram(NULL);
|
||||
canvas->SetView(NULL);
|
||||
canvas = NULL;
|
||||
@@ -177,7 +177,7 @@ bool csDiagramView::OnClose(bool deleteWindow)
|
||||
{
|
||||
frame->Destroy();
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user