]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/plot.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPlotWindow
4 // Author: Robert Roebling
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "plot.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
24 #include "wx/object.h"
26 #include "wx/colour.h"
27 #include "wx/settings.h"
31 #include "wx/dcclient.h"
34 #include "wx/generic/plot.h"
35 #include "wx/bmpbuttn.h"
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 #if !defined(__WXMSW__) && !defined(__WXPM__)
44 #include "wx/generic/plot_enl.xpm"
45 #include "wx/generic/plot_shr.xpm"
46 #include "wx/generic/plot_zin.xpm"
47 #include "wx/generic/plot_zot.xpm"
48 #include "wx/generic/plot_up.xpm"
49 #include "wx/generic/plot_dwn.xpm"
52 // ----------------------------------------------------------------------------
53 // accessor functions for the bitmaps (may return NULL, check for it!)
54 // ----------------------------------------------------------------------------
56 static wxBitmap
*GetEnlargeBitmap();
57 static wxBitmap
*GetShrinkBitmap();
58 static wxBitmap
*GetZoomInBitmap();
59 static wxBitmap
*GetZoomOutBitmap();
60 static wxBitmap
*GetUpBitmap();
61 static wxBitmap
*GetDownBitmap();
63 //-----------------------------------------------------------------------------
65 //-----------------------------------------------------------------------------
67 wxPlotEvent::wxPlotEvent( wxEventType commandType
, int id
)
68 : wxNotifyEvent( commandType
, id
)
70 m_curve
= (wxPlotCurve
*) NULL
;
75 //-----------------------------------------------------------------------------
77 //-----------------------------------------------------------------------------
79 IMPLEMENT_ABSTRACT_CLASS(wxPlotCurve
, wxObject
)
81 wxPlotCurve::wxPlotCurve( int offsetY
, double startY
, double endY
)
88 //-----------------------------------------------------------------------------
90 //-----------------------------------------------------------------------------
92 IMPLEMENT_DYNAMIC_CLASS(wxPlotArea
, wxWindow
)
94 BEGIN_EVENT_TABLE(wxPlotArea
, wxWindow
)
95 EVT_PAINT( wxPlotArea::OnPaint
)
96 EVT_LEFT_DOWN( wxPlotArea::OnMouse
)
97 EVT_LEFT_DCLICK( wxPlotArea::OnMouse
)
100 wxPlotArea::wxPlotArea( wxPlotWindow
*parent
)
101 : wxWindow( parent
, -1, wxDefaultPosition
, wxDefaultSize
, wxSIMPLE_BORDER
, "plotarea" )
107 SetBackgroundColour( *wxWHITE
);
110 void wxPlotArea::OnMouse( wxMouseEvent
&event
)
114 GetClientSize( &client_width
, &client_height
);
117 m_owner
->GetViewStart( &view_x
, &view_y
);
121 int x
= event
.GetX();
122 int y
= event
.GetY();
126 wxNode
*node
= m_owner
->m_curves
.First();
129 wxPlotCurve
*curve
= (wxPlotCurve
*)node
->Data();
131 double double_client_height
= (double)client_height
;
132 double range
= curve
->GetEndY() - curve
->GetStartY();
133 double end
= curve
->GetEndY();
134 wxCoord offset_y
= curve
->GetOffsetY();
136 double dy
= (end
- curve
->GetY( x
/m_owner
->GetZoom() )) / range
;
137 wxCoord curve_y
= (wxCoord
)(dy
* double_client_height
) - offset_y
- 1;
139 if ((y
-curve_y
< 4) && (y
-curve_y
> -4))
141 wxPlotEvent
event1( event
.ButtonDClick() ? wxEVT_PLOT_DOUBLECLICKED
: wxEVT_PLOT_CLICKED
, m_owner
->GetId() );
142 event1
.SetEventObject( m_owner
);
143 event1
.SetZoom( m_owner
->GetZoom() );
144 event1
.SetCurve( curve
);
145 event1
.SetPosition( (int)floor(x
/m_owner
->GetZoom()) );
146 m_owner
->GetEventHandler()->ProcessEvent( event1
);
148 if (curve
!= m_owner
->GetCurrent());
150 wxPlotEvent
event2( wxEVT_PLOT_SEL_CHANGING
, m_owner
->GetId() );
151 event2
.SetEventObject( m_owner
);
152 event2
.SetZoom( m_owner
->GetZoom() );
153 event2
.SetCurve( curve
);
154 if (!m_owner
->GetEventHandler()->ProcessEvent( event2
) || event2
.IsAllowed())
156 m_owner
->SetCurrent( curve
);
166 void wxPlotArea::DeleteCurve( wxPlotCurve
*curve
, int from
, int to
)
169 m_owner
->PrepareDC( dc
);
170 dc
.SetPen( *wxWHITE_PEN
);
171 DrawCurve( &dc
, curve
, from
, to
);
174 void wxPlotArea::DrawCurve( wxDC
*dc
, wxPlotCurve
*curve
, int from
, int to
)
178 m_owner
->GetViewStart( &view_x
, &view_y
);
186 GetClientSize( &client_width
, &client_height
);
189 to
= view_x
+ client_width
;
191 double zoom
= m_owner
->GetZoom();
193 int start_x
= wxMax( from
, (int)floor(curve
->GetStartX()*zoom
) );
194 int end_x
= wxMin( to
, (int)floor(curve
->GetEndX()*zoom
) );
196 start_x
= wxMax( view_x
, start_x
);
197 end_x
= wxMin( view_x
+ client_width
, end_x
);
199 double double_client_height
= (double)client_height
;
200 double range
= curve
->GetEndY() - curve
->GetStartY();
201 double end
= curve
->GetEndY();
202 wxCoord offset_y
= curve
->GetOffsetY();
204 wxCoord y
=0,last_y
=0;
205 for (int x
= start_x
; x
< end_x
; x
++)
207 double dy
= (end
- curve
->GetY( x
/zoom
)) / range
;
208 y
= (wxCoord
)(dy
* double_client_height
) - offset_y
- 1;
211 dc
->DrawLine( x
-1, last_y
, x
, y
);
217 void wxPlotArea::OnPaint( wxPaintEvent
&WXUNUSED(event
) )
221 m_owner
->GetViewStart( &view_x
, &view_y
);
225 wxPaintDC
dc( this );
226 m_owner
->PrepareDC( dc
);
228 wxRegionIterator
upd( GetUpdateRegion() );
232 int update_x
= upd
.GetX();
233 int update_y
= upd
.GetY();
234 int update_width
= upd
.GetWidth();
240 if (m_owner->m_current)
242 dc.SetPen( *wxLIGHT_GREY_PEN );
243 int base_line = client_height - m_owner->m_current->GetOffsetY();
244 dc.DrawLine( update_x-1, base_line-1, update_x+update_width+2, base_line-1 );
248 wxNode
*node
= m_owner
->m_curves
.First();
251 wxPlotCurve
*curve
= (wxPlotCurve
*)node
->Data();
253 if (curve
== m_owner
->GetCurrent())
254 dc
.SetPen( *wxBLACK_PEN
);
256 dc
.SetPen( *wxGREY_PEN
);
258 DrawCurve( &dc
, curve
, update_x
-1, update_x
+update_width
+2 );
266 void wxPlotArea::ScrollWindow( int dx
, int dy
, const wxRect
*rect
)
268 wxWindow::ScrollWindow( dx
, dy
, rect
);
269 // m_owner->m_xaxis->ScrollWindow( dx, 0 );
272 //-----------------------------------------------------------------------------
274 //-----------------------------------------------------------------------------
276 IMPLEMENT_DYNAMIC_CLASS(wxPlotXAxisArea
, wxWindow
)
278 BEGIN_EVENT_TABLE(wxPlotXAxisArea
, wxWindow
)
279 EVT_PAINT( wxPlotXAxisArea::OnPaint
)
280 EVT_LEFT_DOWN( wxPlotXAxisArea::OnMouse
)
283 wxPlotXAxisArea::wxPlotXAxisArea( wxPlotWindow
*parent
)
284 : wxWindow( parent
, -1, wxDefaultPosition
, wxSize(-1,40), 0, "plotxaxisarea" )
288 SetBackgroundColour( *wxWHITE
);
291 void wxPlotXAxisArea::OnMouse( wxMouseEvent
&event
)
295 GetClientSize( &client_width
, &client_height
);
298 m_owner
->GetViewStart( &view_x
, &view_y
);
302 int x
= event
.GetX();
303 int y
= event
.GetY();
307 /* do something here */
310 void wxPlotXAxisArea::OnPaint( wxPaintEvent
&WXUNUSED(event
) )
314 m_owner
->GetViewStart( &view_x
, &view_y
);
318 wxPaintDC
dc( this );
322 GetClientSize( &client_width
, &client_height
);
324 double zoom
= m_owner
->GetZoom();
326 double ups
= m_owner
->GetUnitsPerValue() / zoom
;
328 double start
= view_x
* ups
;
329 double end
= (view_x
+ client_width
) * ups
;
330 double range
= end
- start
;
332 int int_log_range
= (int)floor( log10( range
) );
334 if (int_log_range
> 0)
336 for (int i
= 0; i
< int_log_range
; i
++)
339 if (int_log_range
< 0)
341 for (int i
= 0; i
< -int_log_range
; i
++)
344 double lower
= ceil(start
/ step
) * step
;
345 double upper
= floor(end
/ step
) * step
;
347 // if too few values, shrink size
348 if ((range
/step
) < 4)
351 if (lower
-step
> start
) lower
-= step
;
352 if (upper
+step
< end
) upper
+= step
;
355 // if still too few, again
356 if ((range
/step
) < 4)
359 if (lower
-step
> start
) lower
-= step
;
360 if (upper
+step
< end
) upper
+= step
;
363 dc
.SetBrush( *wxWHITE_BRUSH
);
364 dc
.SetPen( *wxTRANSPARENT_PEN
);
365 dc
.DrawRectangle( 4, 5, client_width
-14, 10 );
366 dc
.DrawRectangle( 0, 20, client_width
, 20 );
367 dc
.SetPen( *wxBLACK_PEN
);
369 double current
= lower
;
370 while (current
< upper
+(step
/2))
372 int x
= (int)ceil((current
-start
) / range
* (double)client_width
) - 1;
373 if ((x
> 4) && (x
< client_width
-25))
375 dc
.DrawLine( x
, 5, x
, 15 );
378 label
.Printf( wxT("%.1f"), current
);
380 label
.Printf( wxT("%d"), (int)floor(current
) );
381 dc
.DrawText( label
, x
-4, 20 );
387 dc
.DrawLine( 0, 15, client_width
-8, 15 );
388 dc
.DrawLine( client_width
-4, 15, client_width
-10, 10 );
389 dc
.DrawLine( client_width
-4, 15, client_width
-10, 20 );
392 //-----------------------------------------------------------------------------
394 //-----------------------------------------------------------------------------
396 IMPLEMENT_DYNAMIC_CLASS(wxPlotYAxisArea
, wxWindow
)
398 BEGIN_EVENT_TABLE(wxPlotYAxisArea
, wxWindow
)
399 EVT_PAINT( wxPlotYAxisArea::OnPaint
)
400 EVT_LEFT_DOWN( wxPlotYAxisArea::OnMouse
)
403 wxPlotYAxisArea::wxPlotYAxisArea( wxPlotWindow
*parent
)
404 : wxWindow( parent
, -1, wxDefaultPosition
, wxSize(60,-1), 0, "plotyaxisarea" )
408 SetBackgroundColour( *wxWHITE
);
411 void wxPlotYAxisArea::OnMouse( wxMouseEvent
&WXUNUSED(event
) )
413 /* do something here */
416 void wxPlotYAxisArea::OnPaint( wxPaintEvent
&WXUNUSED(event
) )
418 wxPaintDC
dc( this );
420 wxPlotCurve
*curve
= m_owner
->GetCurrent();
426 GetClientSize( &client_width
, &client_height
);
429 double range
= curve
->GetEndY() - curve
->GetStartY();
430 double offset
= ((double) curve
->GetOffsetY() / (double)client_height
) * range
;
431 double start
= curve
->GetStartY() - offset
;
432 double end
= curve
->GetEndY() - offset
;
434 int int_log_range
= (int)floor( log10( range
) );
436 if (int_log_range
> 0)
438 for (int i
= 0; i
< int_log_range
; i
++)
441 if (int_log_range
< 0)
443 for (int i
= 0; i
< -int_log_range
; i
++)
446 double lower
= ceil(start
/ step
) * step
;
447 double upper
= floor(end
/ step
) * step
;
449 // if too few values, shrink size
450 if ((range
/step
) < 4)
453 if (lower
-step
> start
) lower
-= step
;
454 if (upper
+step
< end
) upper
+= step
;
457 // if still too few, again
458 if ((range
/step
) < 4)
461 if (lower
-step
> start
) lower
-= step
;
462 if (upper
+step
< end
) upper
+= step
;
465 dc
.SetPen( *wxBLACK_PEN
);
467 double current
= lower
;
468 while (current
< upper
+(step
/2))
470 int y
= (int)((curve
->GetEndY()-current
) / range
* (double)client_height
) - 1;
471 y
-= curve
->GetOffsetY();
472 if ((y
> 10) && (y
< client_height
-7))
474 dc
.DrawLine( client_width
-15, y
, client_width
-7, y
);
476 label
.Printf( wxT("%.1f"), current
);
477 dc
.DrawText( label
, 5, y
-7 );
483 dc
.DrawLine( client_width
-15, 6, client_width
-15, client_height
);
484 dc
.DrawLine( client_width
-15, 2, client_width
-20, 8 );
485 dc
.DrawLine( client_width
-15, 2, client_width
-10, 8 );
488 //-----------------------------------------------------------------------------
490 //-----------------------------------------------------------------------------
492 #define ID_ENLARGE 1000
493 #define ID_SHRINK 1002
495 #define ID_MOVE_UP 1006
496 #define ID_MOVE_DOWN 1007
498 #define ID_ZOOM_IN 1010
499 #define ID_ZOOM_OUT 1011
502 IMPLEMENT_DYNAMIC_CLASS(wxPlotWindow
, wxScrolledWindow
)
504 BEGIN_EVENT_TABLE(wxPlotWindow
, wxScrolledWindow
)
505 EVT_BUTTON( ID_MOVE_UP
, wxPlotWindow::OnMoveUp
)
506 EVT_BUTTON( ID_MOVE_DOWN
, wxPlotWindow::OnMoveDown
)
508 EVT_BUTTON( ID_ENLARGE
, wxPlotWindow::OnEnlarge
)
509 EVT_BUTTON( ID_SHRINK
, wxPlotWindow::OnShrink
)
511 EVT_BUTTON( ID_ZOOM_IN
, wxPlotWindow::OnZoomIn
)
512 EVT_BUTTON( ID_ZOOM_OUT
, wxPlotWindow::OnZoomOut
)
514 EVT_SCROLLWIN( wxPlotWindow::OnScroll2
)
517 wxPlotWindow::wxPlotWindow( wxWindow
*parent
, wxWindowID id
, const wxPoint
&pos
, const wxSize
&size
, int flag
)
518 : wxScrolledWindow( parent
, id
, pos
, size
, flag
, "plotcanvas" )
520 m_xUnitsPerValue
= 1.0;
523 m_area
= new wxPlotArea( this );
524 wxBoxSizer
*mainsizer
= new wxBoxSizer( wxHORIZONTAL
);
526 if ((GetWindowStyleFlag() & wxPLOT_BUTTON_ALL
) != 0)
528 wxBoxSizer
*buttonlist
= new wxBoxSizer( wxVERTICAL
);
529 if ((GetWindowStyleFlag() & wxPLOT_BUTTON_ENLARGE
) != 0)
531 buttonlist
->Add( new wxBitmapButton( this, ID_ENLARGE
, *GetEnlargeBitmap() ), 0, wxEXPAND
|wxALL
, 2 );
532 buttonlist
->Add( new wxBitmapButton( this, ID_SHRINK
, *GetShrinkBitmap() ), 0, wxEXPAND
|wxALL
, 2 );
533 buttonlist
->Add( 20,10, 0 );
535 if ((GetWindowStyleFlag() & wxPLOT_BUTTON_MOVE
) != 0)
537 buttonlist
->Add( new wxBitmapButton( this, ID_MOVE_UP
, *GetUpBitmap() ), 0, wxEXPAND
|wxALL
, 2 );
538 buttonlist
->Add( new wxBitmapButton( this, ID_MOVE_DOWN
, *GetDownBitmap() ), 0, wxEXPAND
|wxALL
, 2 );
539 buttonlist
->Add( 20,10, 0 );
541 if ((GetWindowStyleFlag() & wxPLOT_BUTTON_ZOOM
) != 0)
543 buttonlist
->Add( new wxBitmapButton( this, ID_ZOOM_IN
, *GetZoomInBitmap() ), 0, wxEXPAND
|wxALL
, 2 );
544 buttonlist
->Add( new wxBitmapButton( this, ID_ZOOM_OUT
, *GetZoomOutBitmap() ), 0, wxEXPAND
|wxALL
, 2 );
546 mainsizer
->Add( buttonlist
, 0, wxEXPAND
|wxALL
, 4 );
549 wxBoxSizer
*plotsizer
= new wxBoxSizer( wxHORIZONTAL
);
551 if ((GetWindowStyleFlag() & wxPLOT_Y_AXIS
) != 0)
553 m_yaxis
= new wxPlotYAxisArea( this );
555 wxBoxSizer
*vert1
= new wxBoxSizer( wxVERTICAL
);
556 plotsizer
->Add( vert1
, 0, wxEXPAND
);
557 vert1
->Add( m_yaxis
, 1 );
558 if ((GetWindowStyleFlag() & wxPLOT_X_AXIS
) != 0)
559 vert1
->Add( 60, 40 );
563 m_yaxis
= (wxPlotYAxisArea
*) NULL
;
566 if ((GetWindowStyleFlag() & wxPLOT_X_AXIS
) != 0)
568 m_xaxis
= new wxPlotXAxisArea( this );
570 wxBoxSizer
*vert2
= new wxBoxSizer( wxVERTICAL
);
571 plotsizer
->Add( vert2
, 1, wxEXPAND
);
572 vert2
->Add( m_area
, 1, wxEXPAND
);
573 vert2
->Add( m_xaxis
, 0, wxEXPAND
);
577 plotsizer
->Add( m_area
, 1, wxEXPAND
);
578 m_xaxis
= (wxPlotXAxisArea
*) NULL
;
581 mainsizer
->Add( plotsizer
, 1, wxEXPAND
);
583 SetAutoLayout( TRUE
);
584 SetSizer( mainsizer
);
586 SetTargetWindow( m_area
);
588 SetBackgroundColour( *wxWHITE
);
590 m_current
= (wxPlotCurve
*) NULL
;
593 wxPlotWindow::~wxPlotWindow()
597 void wxPlotWindow::Add( wxPlotCurve
*curve
)
599 m_curves
.Append( curve
);
600 if (!m_current
) m_current
= curve
;
605 size_t wxPlotWindow::GetCount()
607 return m_curves
.GetCount();
610 wxPlotCurve
*wxPlotWindow::GetAt( size_t n
)
612 wxNode
*node
= m_curves
.Nth( n
);
614 return (wxPlotCurve
*) NULL
;
616 return (wxPlotCurve
*) node
->Data();
619 void wxPlotWindow::SetCurrent( wxPlotCurve
* current
)
622 m_area
->Refresh( FALSE
);
626 wxPlotEvent
event( wxEVT_PLOT_SEL_CHANGED
, GetId() );
627 event
.SetEventObject( this );
628 event
.SetZoom( GetZoom() );
629 event
.SetCurve( m_current
);
630 GetEventHandler()->ProcessEvent( event
);
633 void wxPlotWindow::Delete( wxPlotCurve
* curve
)
635 wxNode
*node
= m_curves
.Find( curve
);
638 m_curves
.DeleteObject( curve
);
640 m_area
->DeleteCurve( curve
);
641 m_area
->Refresh( FALSE
);
644 wxPlotCurve
*wxPlotWindow::GetCurrent()
649 void wxPlotWindow::Move( wxPlotCurve
* curve
, int pixels_up
)
651 m_area
->DeleteCurve( curve
);
653 curve
->SetOffsetY( curve
->GetOffsetY() + pixels_up
);
655 m_area
->Refresh( FALSE
);
660 void wxPlotWindow::OnMoveUp( wxCommandEvent
& WXUNUSED(event
) )
662 if (!m_current
) return;
664 Move( m_current
, 25 );
667 void wxPlotWindow::OnMoveDown( wxCommandEvent
& WXUNUSED(event
) )
669 if (!m_current
) return;
671 Move( m_current
, -25 );
674 void wxPlotWindow::Enlarge( wxPlotCurve
*curve
, double factor
)
676 m_area
->DeleteCurve( curve
);
678 double range
= curve
->GetEndY() - curve
->GetStartY();
679 double new_range
= range
/ factor
;
680 double middle
= curve
->GetEndY() - range
/2;
681 curve
->SetStartY( middle
- new_range
/ 2 );
682 curve
->SetEndY( middle
+ new_range
/ 2 );
684 m_area
->Refresh( FALSE
);
688 void wxPlotWindow::SetUnitsPerValue( double upv
)
690 m_xUnitsPerValue
= upv
;
695 void wxPlotWindow::SetZoom( double zoom
)
697 double old_zoom
= m_xZoom
;
702 GetViewStart( &view_x
, &view_y
);
705 wxNode
*node
= m_curves
.First();
708 wxPlotCurve
*curve
= (wxPlotCurve
*) node
->Data();
709 if (curve
->GetEndX() > max
)
710 max
= curve
->GetEndX();
713 SetScrollbars( 10, 10, (int)((max
*m_xZoom
)/10)+1, 0, (int)view_x
*zoom
/old_zoom
, 0 );
716 m_area
->Refresh( TRUE
);
719 void wxPlotWindow::ResetScrollbar()
722 wxNode
*node
= m_curves
.First();
725 wxPlotCurve
*curve
= (wxPlotCurve
*) node
->Data();
726 if (curve
->GetEndX() > max
)
727 max
= curve
->GetEndX();
731 SetScrollbars( 10, 10, ((max
*m_xZoom
)/10)+1, 0 );
734 void wxPlotWindow::RedrawXAxis()
737 m_xaxis
->Refresh( FALSE
);
740 void wxPlotWindow::RedrawYAxis()
743 m_yaxis
->Refresh( TRUE
);
746 void wxPlotWindow::RedrawEverything()
749 m_xaxis
->Refresh( TRUE
);
751 m_yaxis
->Refresh( TRUE
);
752 m_area
->Refresh( TRUE
);
755 void wxPlotWindow::OnZoomIn( wxCommandEvent
& WXUNUSED(event
) )
757 SetZoom( m_xZoom
* 1.5 );
760 void wxPlotWindow::OnZoomOut( wxCommandEvent
& WXUNUSED(event
) )
762 SetZoom( m_xZoom
* 0.6666 );
765 void wxPlotWindow::OnEnlarge( wxCommandEvent
& WXUNUSED(event
) )
767 if (!m_current
) return;
769 Enlarge( m_current
, 1.5 );
772 void wxPlotWindow::OnShrink( wxCommandEvent
& WXUNUSED(event
) )
774 if (!m_current
) return;
776 Enlarge( m_current
, 0.6666666 );
779 void wxPlotWindow::OnScroll2( wxScrollWinEvent
& event
)
781 wxScrolledWindow::OnScroll( event
);
786 // ----------------------------------------------------------------------------
788 // ----------------------------------------------------------------------------
791 static wxBitmap
*GetEnlargeBitmap()
793 static wxBitmap
* s_bitmap
= (wxBitmap
*) NULL
;
794 static bool s_loaded
= FALSE
;
798 s_loaded
= TRUE
; // set it to TRUE anyhow, we won't try again
800 #if defined(__WXMSW__) || defined(__WXPM__)
801 s_bitmap
= new wxBitmap("plot_enl.bmp", wxBITMAP_TYPE_RESOURCE
);
803 s_bitmap
= new wxBitmap( plot_enl_xpm
);
810 static wxBitmap
*GetShrinkBitmap()
812 static wxBitmap
* s_bitmap
= (wxBitmap
*) NULL
;
813 static bool s_loaded
= FALSE
;
817 s_loaded
= TRUE
; // set it to TRUE anyhow, we won't try again
819 #if defined(__WXMSW__) || defined(__WXPM__)
820 s_bitmap
= new wxBitmap("plot_shr.bmp", wxBITMAP_TYPE_RESOURCE
);
822 s_bitmap
= new wxBitmap( plot_shr_xpm
);
829 static wxBitmap
*GetZoomInBitmap()
831 static wxBitmap
* s_bitmap
= (wxBitmap
*) NULL
;
832 static bool s_loaded
= FALSE
;
836 s_loaded
= TRUE
; // set it to TRUE anyhow, we won't try again
838 #if defined(__WXMSW__) || defined(__WXPM__)
839 s_bitmap
= new wxBitmap("plot_zin.bmp", wxBITMAP_TYPE_RESOURCE
);
841 s_bitmap
= new wxBitmap( plot_zin_xpm
);
848 static wxBitmap
*GetZoomOutBitmap()
850 static wxBitmap
* s_bitmap
= (wxBitmap
*) NULL
;
851 static bool s_loaded
= FALSE
;
855 s_loaded
= TRUE
; // set it to TRUE anyhow, we won't try again
857 #if defined(__WXMSW__) || defined(__WXPM__)
858 s_bitmap
= new wxBitmap("plot_zot.bmp", wxBITMAP_TYPE_RESOURCE
);
860 s_bitmap
= new wxBitmap( plot_zot_xpm
);
867 static wxBitmap
*GetUpBitmap()
869 static wxBitmap
* s_bitmap
= (wxBitmap
*) NULL
;
870 static bool s_loaded
= FALSE
;
874 s_loaded
= TRUE
; // set it to TRUE anyhow, we won't try again
876 #if defined(__WXMSW__) || defined(__WXPM__)
877 s_bitmap
= new wxBitmap("plot_up.bmp", wxBITMAP_TYPE_RESOURCE
);
879 s_bitmap
= new wxBitmap( plot_up_xpm
);
886 static wxBitmap
*GetDownBitmap()
888 static wxBitmap
* s_bitmap
= (wxBitmap
*) NULL
;
889 static bool s_loaded
= FALSE
;
893 s_loaded
= TRUE
; // set it to TRUE anyhow, we won't try again
895 #if defined(__WXMSW__) || defined(__WXPM__)
896 s_bitmap
= new wxBitmap("plot_dwn.bmp", wxBITMAP_TYPE_RESOURCE
);
898 s_bitmap
= new wxBitmap( plot_dwn_xpm
);