]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mathplot.cxx
Comment out some unused variables
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / mathplot.cxx
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        mathplot.cpp
3 // Purpose:     Framework for mathematical graph plotting in wxWindows
4 // Author:      David Schalig
5 // Modified by:
6 // Created:     21/07/2003
7 // Copyright:   (c) David Schalig
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 /*EED
12 #ifdef __GNUG__
13 #pragma implementation "plot.h"
14 #endif
15 */
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 /*EED
23 #ifndef WX_PRECOMP
24 #include "wx/object.h"
25 #include "wx/font.h"
26 #include "wx/colour.h"
27 #include "wx/settings.h"
28 #include "wx/sizer.h"
29 #include "wx/log.h"
30 #include "wx/intl.h"
31 #include "wx/dcclient.h"
32 #endif
33
34 // EED
35 #ifndef WX_PRECOMP
36 #include <wx/wx.h>
37 #endif
38 */
39
40
41 #include "mathplot.h"
42 //#include "wx/bmpbuttn.h"
43 //#include "wx/module.h"
44
45 //#include <math.h>
46
47 //-----------------------------------------------------------------------------
48 // mpLayer
49 //-----------------------------------------------------------------------------
50
51 IMPLEMENT_ABSTRACT_CLASS(mpLayer, wxObject)
52
53 mpLayer::mpLayer()
54 {
55 // EED wx 2.8.5
56 //      SetPen( *wxBLACK_PEN);
57 //      SetFont(*wxNORMAL_FONT);
58
59         wxFont ff( *wxNORMAL_FONT);
60         wxPen pp( *wxBLACK_PEN);
61         SetPen( pp );
62         SetFont( ff );
63
64 }
65
66 //-----------------------------------------------------------------------------
67 // mpLayer implementations - functions
68 //-----------------------------------------------------------------------------
69
70 IMPLEMENT_ABSTRACT_CLASS(mpFX, mpLayer)
71
72 mpFX::mpFX(wxString name, int flags)
73
74         SetName(name);
75         m_flags = flags; 
76 }
77
78 void mpFX::Plot(wxDC & dc, mpWindow & w)
79 {
80         dc.SetPen( m_pen);
81
82         if (m_pen.GetWidth() <= 1) 
83         {
84                 for (wxCoord i = -(w.GetScrX()>>1); i < (w.GetScrX()>>1); ++i)
85                 {
86                         dc.DrawPoint(i, (wxCoord) ((w.GetPosY() - GetY( (double)i / w.GetScaleX() + w.GetPosX()) ) * w.GetScaleY()));
87                 }
88         }
89         else
90         {
91                 for (wxCoord i = -(w.GetScrX()>>1); i < (w.GetScrX()>>1); ++i)
92                 {
93                         wxCoord c = (wxCoord) ((w.GetPosY() - GetY( (double)i / w.GetScaleX() + w.GetPosX()) ) * w.GetScaleY());
94                         dc.DrawLine( i, c, i, c);
95                 }
96         }
97
98         if (!m_name.IsEmpty())
99         {
100                 dc.SetFont(m_font);
101
102                 wxCoord tx, ty;
103                 dc.GetTextExtent(m_name, &tx, &ty);
104
105                 if ((m_flags & mpALIGNMASK) == mpALIGN_RIGHT)
106                         tx = (w.GetScrX()>>1) - tx - 8;
107                 else if ((m_flags & mpALIGNMASK) == mpALIGN_CENTER)
108                         tx = -tx/2;
109                 else
110                         tx = -(w.GetScrX()>>1) + 8;
111
112                 dc.DrawText( m_name, tx, (wxCoord) ((w.GetPosY() - GetY( (double)tx / w.GetScaleX() + w.GetPosX())) * w.GetScaleY()) );
113         }
114 }
115
116 IMPLEMENT_ABSTRACT_CLASS(mpFY, mpLayer)
117
118 mpFY::mpFY(wxString name, int flags)
119
120         SetName(name);
121         m_flags = flags;
122 }
123
124 void mpFY::Plot(wxDC & dc, mpWindow & w)
125 {
126         dc.SetPen( m_pen);
127
128         wxCoord i;
129
130         if (m_pen.GetWidth() <= 1) 
131         {
132                 for (i = -(w.GetScrY()>>1); i < (w.GetScrY()>>1); ++i)
133                 {
134                         dc.DrawPoint((wxCoord) ((GetX( (double)i / w.GetScaleY() + w.GetPosY()) - w.GetPosX()) * w.GetScaleX()), -i);
135                 }
136         }
137         else
138         {
139                 for (i = -(w.GetScrY()>>1); i < (w.GetScrY()>>1); ++i)
140                 {
141                         wxCoord c =  (wxCoord) ((GetX( (double)i / w.GetScaleY() + w.GetPosY()) - w.GetPosX()) * w.GetScaleX());
142                         dc.DrawLine(c, -i, c, -i);
143                 }
144         }
145
146         if (!m_name.IsEmpty())
147         {
148                 dc.SetFont(m_font);
149
150                 wxCoord tx, ty;
151                 dc.GetTextExtent(m_name, &tx, &ty);
152
153                 if ((m_flags & mpALIGNMASK) == mpALIGN_TOP)
154                         ty = (w.GetScrY()>>1) - 8;
155                 else if ((m_flags & mpALIGNMASK) == mpALIGN_CENTER)
156                         ty = 16 - ty/2;
157                 else
158                         ty = -(w.GetScrY()>>1) + 8;
159
160                 dc.DrawText( m_name, (wxCoord) ((GetX( (double)i / w.GetScaleY() + w.GetPosY()) - w.GetPosX()) * w.GetScaleX()), -ty);
161         }
162 }
163
164 IMPLEMENT_ABSTRACT_CLASS(mpFXY, mpLayer)
165
166 mpFXY::mpFXY(wxString name, int flags)
167
168         SetName(name);
169         m_flags = flags; 
170 }
171
172 void mpFXY::Plot(wxDC & dc, mpWindow & w)
173 {
174         dc.SetPen( m_pen);
175
176         double x, y;
177         Rewind();
178
179         // for some reason DrawPoint does not use the current pen,
180         // so we use DrawLine for fat pens
181
182         if (m_pen.GetWidth() <= 1) 
183         {
184                 while (GetNextXY(x, y))
185                 {
186                         dc.DrawPoint( (wxCoord) ((x - w.GetPosX()) * w.GetScaleX()) ,
187                                 (wxCoord) ((w.GetPosY() - y) * w.GetScaleY()) );
188                 }
189         }
190         else
191         {
192                 while (GetNextXY(x, y))
193                 {
194                         wxCoord cx = (wxCoord) ((x - w.GetPosX()) * w.GetScaleX());
195                         wxCoord cy = (wxCoord) ((w.GetPosY() - y) * w.GetScaleY());
196                         dc.DrawLine(cx, cy, cx, cy);
197                 }
198         }
199
200         if (!m_name.IsEmpty())
201         {
202                 dc.SetFont(m_font);
203
204                 wxCoord tx, ty;
205                 dc.GetTextExtent(m_name, &tx, &ty);
206
207                 // xxx implement else ... if (!HasBBox())
208                 {
209                         const int sx = w.GetScrX()>>1;
210                         const int sy = w.GetScrY()>>1;
211
212                         if ((m_flags & mpALIGNMASK) == mpALIGN_NE)
213                         {
214                                 tx = sx - tx - 8;
215                                 ty = -sy + 8;
216                         }
217                         else if ((m_flags & mpALIGNMASK) == mpALIGN_NW)
218                         {
219                                 tx = -sx + 8;
220                                 ty = -sy + 8;
221                         }
222                         else if ((m_flags & mpALIGNMASK) == mpALIGN_SW)
223                         {
224                                 tx = -sx + 8;
225                                 ty = sy - 8 - ty;
226                         }
227                         else
228                         {
229                                 tx = sx - tx - 8;
230                                 ty = sy - 8 - ty;
231                         }
232                 }
233                 //else
234                 //{
235                 //}
236
237                 dc.DrawText( m_name, tx, ty);
238         }
239 }
240
241 //-----------------------------------------------------------------------------
242 // mpLayer implementations - furniture (scales, ...)
243 //-----------------------------------------------------------------------------
244
245 #define mpLN10 2.3025850929940456840179914546844
246
247 IMPLEMENT_CLASS(mpScaleX, mpLayer)
248
249 mpScaleX::mpScaleX(wxString name)
250
251         SetName(name);/*
252         SetFont(*wxSMALL_FONT);
253         SetPen(*wxGREY_PEN);*/
254
255         wxFont ff( *wxSMALL_FONT);
256         wxPen pp( *wxGREY_PEN);
257         SetPen( pp );
258         SetFont( ff );
259 }
260
261 void mpScaleX::Plot(wxDC & dc, mpWindow & w)
262 {
263         dc.SetPen( m_pen);
264         dc.SetFont( m_font);
265
266         const int orgy   = (int)(w.GetPosY() * w.GetScaleY());
267         const int extend = w.GetScrX()/2;
268
269         dc.DrawLine( -extend, orgy, extend, orgy);
270
271         const double dig  = floor( log( 128.0 / w.GetScaleX() ) / mpLN10 );
272         const double step = exp( mpLN10 * dig);
273         const double end  = w.GetPosX() + (double)extend / w.GetScaleX();
274
275         wxCoord tx, ty;
276         wxString s;
277         wxString fmt;
278         int tmp = (int)dig;
279         if (tmp>=1)
280         {
281                 fmt = wxT("%.f");
282         }
283         else
284         {
285                 tmp=8-tmp;
286                 fmt.Printf(wxT("%%.%df"), tmp >= -1 ? 2 : -tmp);
287         }
288
289         double n = floor( (w.GetPosX() - (double)extend / w.GetScaleX()) / step ) * step ;
290
291         tmp=-65535;
292         for (;n < end; n += step)
293         {
294                 const int p = (int)((n - w.GetPosX()) * w.GetScaleX());
295                 dc.DrawLine( p, orgy, p, orgy+4);
296
297                 s.Printf(fmt, n);
298                 dc.GetTextExtent(s, &tx, &ty);
299                 if ((p-tx/2-tmp) > 64)
300                 {
301                         dc.DrawText( s, p-tx/2, orgy+4);
302                         tmp=p+tx/2;
303                 }
304         }
305
306         dc.GetTextExtent(m_name, &tx, &ty);
307         dc.DrawText( m_name, extend - tx - 4, orgy + 4 + ty);
308 }
309
310 IMPLEMENT_CLASS(mpScaleY, mpLayer)
311
312 mpScaleY::mpScaleY(wxString name)
313
314         SetName(name);/*
315         SetFont(*wxSMALL_FONT);
316         SetPen(*wxGREY_PEN);*/
317         wxFont ff( *wxSMALL_FONT);
318         wxPen pp( *wxGREY_PEN);
319         SetPen( pp );
320         SetFont( ff );
321 }
322
323 void mpScaleY::Plot(wxDC & dc, mpWindow & w)
324 {
325         dc.SetPen( m_pen);
326         dc.SetFont( m_font);
327
328         const int orgx   = -(int)(w.GetPosX() * w.GetScaleX());
329         const int extend = w.GetScrY()/2;
330
331         dc.DrawLine( orgx, -extend, orgx, extend);
332
333         const double dig  = floor( log( 128.0 / w.GetScaleY() ) / mpLN10 );
334         const double step = exp( mpLN10 * dig);
335         const double end  = w.GetPosY() + (double)extend / w.GetScaleY();
336
337         wxCoord tx, ty;
338         wxString s;
339         wxString fmt;
340         int tmp = (int)dig;
341         if (tmp>=1)
342         {
343                 fmt = wxT("%.f");
344         }
345         else
346         {
347                 tmp=8-tmp;
348                 fmt.Printf(wxT("%%.%df"), tmp >= -1 ? 2 : -tmp);
349         }
350
351         double n = floor( (w.GetPosY() - (double)extend / w.GetScaleY()) / step ) * step ;
352
353         tmp=65536;
354         for (;n < end; n += step)
355         {
356                 const int p = (int)((w.GetPosY() - n) * w.GetScaleY());
357                 dc.DrawLine( orgx, p, orgx+4, p);
358
359                 s.Printf(fmt, n);
360                 dc.GetTextExtent(s, &tx, &ty);
361                 if ((tmp-p+ty/2) > 32)
362                 {
363                         dc.DrawText( s, orgx+4, p-ty/2);
364                         tmp=p-ty/2;
365                 }
366         }
367
368         dc.GetTextExtent(m_name, &tx, &ty);
369         dc.DrawText( m_name, orgx-tx-4, -extend + ty + 4);
370 }
371
372 //-----------------------------------------------------------------------------
373 // mpWindow
374 //-----------------------------------------------------------------------------
375
376 IMPLEMENT_DYNAMIC_CLASS(mpWindow, wxScrolledWindow)
377
378 BEGIN_EVENT_TABLE(mpWindow, wxScrolledWindow)
379 EVT_PAINT    ( mpWindow::OnPaint)
380 EVT_SIZE     ( mpWindow::OnSize)
381 EVT_SCROLLWIN( mpWindow::OnScroll2)
382
383 EVT_MIDDLE_UP( mpWindow::OnShowPopupMenu)
384 EVT_RIGHT_UP ( mpWindow::OnShowPopupMenu)
385 EVT_MENU( mpID_CENTER,    mpWindow::OnCenter)
386 EVT_MENU( mpID_FIT,       mpWindow::OnFit)
387 EVT_MENU( mpID_ZOOM_IN,   mpWindow::OnZoomIn)
388 EVT_MENU( mpID_ZOOM_OUT,  mpWindow::OnZoomOut)
389 //EVT_MENU( mpID_LINE_GUIDES, mpWindow::OnGuideLines)
390 // New method that belongs to the mpWindow
391 EVT_MENU( mpID_LOCKASPECT,mpWindow::OnLockAspect)
392 END_EVENT_TABLE()
393
394 mpWindow::mpWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag )
395 : wxScrolledWindow( parent, id, pos, size, flag, wxT("wxPlotter") )
396 {
397         m_scaleX = m_scaleY = 1.0;
398         m_posX   = m_posY   = 0;
399         m_scrX   = m_scrY   = 64;
400         m_minX   = m_minY   = 0;
401         m_maxX   = m_maxY   = 0;
402         maxScrX = maxScrY   = 200;
403         minScrX = minScrY   = 0;
404         m_clickedX =  0;
405         m_clickedY = 5000;
406         m_lockaspect = FALSE;
407         offsetX = offsetY = 0;
408         offsetPixelX = offsetPixelY= 0;
409
410         real_guideLine_X = -1;
411         real_guideLine_Y = -1;
412         drawGuides = true;
413         type=1;
414
415         m_popmenu.Append( mpID_CENTER,     _("Center"),      _("Center plot view to this position"));
416         m_popmenu.Append( mpID_FIT,        _("Fit"),         _("Set plot view to show all items"));
417         m_popmenu.Append( mpID_ZOOM_IN,    _("Zoom in"),     _("Zoom in plot view."));
418         m_popmenu.Append( mpID_ZOOM_OUT,   _("Zoom out"),    _("Zoom out plot view."));
419         m_popmenu.AppendCheckItem( mpID_LOCKASPECT, _("Lock aspect"), _("Lock horizontal and vertical zoom aspect."));
420
421         m_popmenu.AppendCheckItem( mpID_LINE_GUIDES, _("Turn off guide lines"), _("Enables/Disables the guide lines"));
422
423         m_layers.DeleteContents(TRUE);
424         SetBackgroundColour( *wxWHITE );
425         EnableScrolling(FALSE, FALSE);
426         SetSizeHints(128, 128);
427         
428         //_bitmap_functions= new wxBitmap(700,800);
429
430         UpdateAll();
431 }
432
433 mpWindow::~mpWindow()
434 {
435 }
436
437 void mpWindow::Fit()
438 {
439         if (UpdateBBox())
440         {
441                 int cx, cy;
442                 GetClientSize( &cx, &cy);
443
444                 double d;
445                 d = m_maxX - m_minX;
446                 if (d!=0)
447                 {
448                         m_scaleX = cx/d;
449                         m_posX = m_minX + d/2;
450                 }
451                 d = m_maxY - m_minY;
452                 if (d!=0)
453                 {
454                         m_scaleY = cy/d;
455                         m_posY = m_minY + d/2;
456                 }
457
458                 if (m_lockaspect)
459                 {
460                         double s = (m_scaleX + m_scaleY)/2;
461                         m_scaleX = s;
462                         m_scaleY = s;
463                 }
464
465                 UpdateAll();
466         }
467 }
468
469 void mpWindow::ZoomIn()
470 {
471         m_scaleX = m_scaleX * 2;
472         m_scaleY = m_scaleY * 2;
473         UpdateAll();
474 }
475
476 void mpWindow::ZoomOut()
477 {
478         m_scaleX = m_scaleX / 2;
479         m_scaleY = m_scaleY / 2;
480         UpdateAll();
481 }
482
483 void mpWindow::LockAspect(bool enable)
484 {
485         m_lockaspect = enable;
486
487         m_popmenu.Check(mpID_LOCKASPECT, enable);
488
489         if (m_lockaspect)
490         {
491                 double s = (m_scaleX + m_scaleY)/2;
492                 m_scaleX = s;
493                 m_scaleY = s;
494         }
495
496         UpdateAll();
497 }
498
499 void mpWindow::OnShowPopupMenu(wxMouseEvent &event)
500 {
501         m_clickedX = event.GetX();
502         m_clickedY = event.GetY();
503         PopupMenu( &m_popmenu, event.GetX(), event.GetY());
504 }
505
506 void mpWindow::OnLockAspect(wxCommandEvent &event)
507 {
508         LockAspect( !m_popmenu.IsChecked(mpID_LOCKASPECT) );
509 }
510
511 void mpWindow::OnFit(wxCommandEvent &event)
512 {
513         Fit();
514 }
515
516 void mpWindow::OnCenter(wxCommandEvent &event)
517 {
518         int cx, cy;
519         GetClientSize(&cx, &cy);
520         SetPos( (double)(m_clickedX-cx/2) / m_scaleX + m_posX, (double)(cy/2-m_clickedY) / m_scaleY + m_posY);
521 }
522
523 void mpWindow::OnZoomIn(wxCommandEvent &event)
524 {
525         int cx, cy;
526         GetClientSize(&cx, &cy);
527         m_posX = (double)(m_clickedX-cx/2) / m_scaleX + m_posX;
528         m_posY = (double)(cy/2-m_clickedY) / m_scaleY + m_posY;
529         ZoomIn();
530 }
531
532 void mpWindow::OnZoomOut(wxCommandEvent &event)
533 {
534         ZoomOut();
535 }
536
537 void mpWindow::OnSize( wxSizeEvent &event )
538 {
539         UpdateAll();
540 }
541
542 bool mpWindow::AddLayer( mpLayer* layer)
543 {
544         bool ret = m_layers.Append( layer) != NULL;
545         UpdateAll();
546         return ret;
547 }
548
549 void mpWindow::DelLayer( mpLayer* layer)
550 {
551         m_layers.DeleteObject( layer);
552         UpdateAll();
553 }
554
555 void mpWindow::Refresh(bool eraseBackground, const wxRect* rect)
556 {
557         wxScrolledWindow::Refresh(false);
558 }
559
560
561 void mpWindow::OnPaint( wxPaintEvent &event )
562 {
563         wxPaintDC dc(this);
564         dc.GetSize(&m_scrX, &m_scrY);
565
566         //m_scrX=200;
567         //m_scrY=200;
568
569         wxMemoryDC temp_dc;
570         //_bitmap_functions->SetWidth(m_scrX);
571         //_bitmap_functions->SetHeight(m_scrY);
572         _bitmap_functions=new wxBitmap(m_scrX,m_scrY);
573         temp_dc.SelectObject(*_bitmap_functions);
574
575         // Background
576         //      wxColour colourParent =  wxColour(255,0,0);
577         temp_dc.SetBrush(wxBrush( *wxWHITE_BRUSH  ) );
578         temp_dc.SetPen(wxPen( *wxBLACK_PEN  ));
579         temp_dc.DrawRectangle(0,0,m_scrX,m_scrY);
580         
581
582         wxNode *node = m_layers.GetFirst();
583         while (node)
584         {
585                 ((mpLayer*)node->GetData())->Plot( temp_dc, *this);
586                 node = node->GetNext();
587         }
588         
589         //dc.SetDeviceOrigin(70,40);
590         //dc.SetAxisOrientation(false,true);
591         temp_dc.SetAxisOrientation(true,false);
592         dc.Blit(0,0, m_scrX, m_scrY, &temp_dc,-70,-m_scrY+40);
593         delete _bitmap_functions; 
594         //_bitmap_functions
595         //dc.SetAxisOrientation(false,true);
596
597
598 }
599
600 /*
601 void mpWindow::OnPaint( wxPaintEvent &event )
602 {
603         wxPaintDC dc(this);
604         
605         //dc.BeginDrawing();
606         
607         dc.GetSize(&m_scrX, &m_scrY);
608         
609         //const int orgy   = m_scrY-40;
610         //dc.SetDeviceOrigin(70,orgy);
611         //dc.SetAxisOrientation(true,true);
612
613 //      wxMemoryDC temp_dc;
614 //      
615 //      //_bitmap_functions=new wxBitmap(m_scrX,m_scrY);
616 //      
617 //      _bitmap_functions->SetWidth(100);//m_scrX);
618 //      _bitmap_functions->SetHeight(200);//m_scrY);
619 //      
620 //      temp_dc.SelectObject(*_bitmap_functions);
621 //      
622 //      // Background
623 //      wxColour colourParent =  wxColour(255,0,0);
624 //      temp_dc.SetBrush(wxBrush( colourParent ,wxSOLID  ));
625 //      temp_dc.SetPen(wxPen( colourParent ,1,wxSOLID  ));
626 //      temp_dc.DrawRectangle(0,0,100,200);
627 //      dc.Blit(0,0, 100, 200, &temp_dc,0,0);
628 //      //dc.SetDeviceOrigin( m_scrX>>1, m_scrY>>1);
629
630         wxNode *node = m_layers.GetFirst();
631         while (node)
632         {
633                 ((mpLayer*)node->GetData())->Plot( dc, *this);
634                 node = node->GetNext();
635         }
636         //temp_dc.SetAxisOrientation(true,false);
637         //dc.EndDrawing();
638         // dc.SetAxisOrientation(true,true);
639          //dc.Blit(70,(int)(-m_scrY+40),m_scrX-100,m_scrY-50,&temp_dc,0,0);
640 }
641 */
642
643 void mpWindow::OnScroll2(wxScrollWinEvent &event)
644 {
645         int width, height;
646         GetClientSize( &width, &height);
647         int px, py;
648         GetViewStart( &px, &py);
649
650         if (event.GetOrientation() == wxHORIZONTAL)
651         {
652                 SetPosX( (double)px / GetScaleX() + m_minX + (double)(width>>1)/GetScaleX());
653         }
654         else
655         {
656                 SetPosY( m_maxY - (double)py / GetScaleY() - (double)(height>>1)/GetScaleY());
657         }
658         event.Skip();
659 }
660
661 bool mpWindow::UpdateBBox()
662 {
663         bool first = TRUE;
664
665         wxNode *node = m_layers.GetFirst();
666
667         while(node)
668         {
669                 mpLayer* f = (mpLayer*)node->GetData();
670
671                 if (f->HasBBox())
672                 {
673                         if (first)
674                         {
675                                 first = FALSE;
676                                 m_minX = f->GetMinX(); m_maxX=f->GetMaxX();
677                                 m_minY = f->GetMinY(); m_maxY=f->GetMaxY();
678                         }
679                         else
680                         {
681                                 if (f->GetMinX()<m_minX) m_minX=f->GetMinX(); if (f->GetMaxX()>m_maxX) m_maxX=f->GetMaxX();
682                                 if (f->GetMinY()<m_minY) m_minY=f->GetMinY(); if (f->GetMaxY()>m_maxY) m_maxY=f->GetMaxY();
683                         }
684                 }
685                 node = node->GetNext();
686         }
687
688         return first == FALSE;
689 }
690
691 void mpWindow :: UpdateAll()
692 {
693         if (UpdateBBox())
694         {
695                 int cx, cy;
696                 GetClientSize( &cx, &cy);
697
698                 //const int sx = (int)((m_maxX - m_minX) * GetScaleX()); // JPRx
699                 //const int sy = (int)((m_maxY - m_minY) * GetScaleY()); // JPRx
700                 //const int px = (int)((GetPosX() - m_minX) * GetScaleX() - (cx>>1)); // JPRx
701                 //const int py = (int)((GetPosY() - m_minY) * GetScaleY() - (cy>>1)); // JPRx
702                 //SetScrollbars( 1, 1, sx, sy, px, py);
703         }
704
705         FitInside();
706         Refresh( false );
707 }
708
709 /*
710 * Guide lines menu handler method that reacts to the mpID_LINE_GUIDES cimmand event
711 * event The corresponding event to handle
712 */
713 /*
714 void mpWindow :: OnGuideLines (wxCommandEvent   &event)
715 {
716         wxString nextAction_text;
717         if( drawGuides )
718         {
719                 setLineGuidesCondition(false);
720                 nextAction_text << "Turn on guide lines";
721                 UpdateAll();
722         }
723         else
724         {
725                 setLineGuidesCondition(true);
726                 nextAction_text << "Turn off guide lines";
727                 UpdateAll();
728         }
729         m_popmenu.SetLabel ( mpID_LINE_GUIDES, nextAction_text ); 
730 }
731 */
732
733
734
735 bool mpWindow::drawGuideLines()
736         {
737                 return drawGuides;
738         }       
739