-// 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;
-
- // 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;
-
- // 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);
-
- // 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);
-
- 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
-
- dc->BeginDrawing(); // Allows optimization of drawing code under MS Windows.
+// 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;
+
+ // 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;
+
+ // 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);
+
+ // 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);
+
+ float posX, posY;
+ // Calculate the position on the DC for centring the graphic
+ #if 0
+ // 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;
+ #endif
+
+
+ // 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
+
+ dc->BeginDrawing(); // Allows optimization of drawing code under MS Windows.