00001 00012 #include "CanvasViewProxy.h" 00013 00014 #include "CanvasView.h" 00015 00016 #if _MSC_VER 00017 #include "PlotterEvent.h" 00018 #endif 00019 00020 #include "qapplication.h" 00021 00022 using namespace hippodraw; 00023 00024 CanvasViewProxy:: 00025 CanvasViewProxy ( CanvasView * view ) 00026 : m_canvas_view ( view ) 00027 { 00028 connect ( this, SIGNAL ( addDisplaySignal ( PlotterBase * ) ), 00029 m_canvas_view, SLOT ( addPlotDisplay ( PlotterBase * ) ) ); 00030 00031 connect ( this, SIGNAL ( saveAsImageSignal ( const PlotterBase *, 00032 const std::string & ) ), 00033 m_canvas_view, SLOT ( savePlotAsImage ( const PlotterBase *, 00034 const std::string & ) ) ); 00035 00036 connect ( this, SIGNAL ( swapOrientationSignal ( ) ), 00037 m_canvas_view, SLOT ( swapOrientation ( ) ) ); 00038 00039 connect ( this, SIGNAL ( clearSignal () ), 00040 m_canvas_view, SLOT ( clear () ) ); 00041 00042 } 00043 00044 CanvasViewProxy:: 00045 ~CanvasViewProxy () 00046 { 00047 } 00048 00049 void 00050 CanvasViewProxy:: 00051 lock () 00052 { 00053 if ( QApplication::closingDown () == false ) { 00054 qApp -> lock(); 00055 } 00056 } 00057 00058 void 00059 CanvasViewProxy:: 00060 unlock () 00061 { 00062 if ( QApplication::closingDown () == false ) { 00063 qApp -> unlock(); 00064 } 00065 } 00066 00067 void 00068 CanvasViewProxy:: 00069 addDisplay ( PlotterBase * plotter ) 00070 { 00071 #if QT_VERSION < 0x040000 00072 lock (); 00073 #endif 00074 emit addDisplaySignal ( plotter ); 00075 #if QT_VERSION < 0x040000 00076 unlock (); 00077 #endif 00078 } 00079 00080 void 00081 CanvasViewProxy:: 00082 clear () 00083 { 00084 #if QT_VERSION < 0x040000 00085 lock (); 00086 #endif 00087 emit clearSignal (); 00088 #if QT_VERSION < 0x040000 00089 unlock (); 00090 #endif 00091 } 00092 00093 void 00094 CanvasViewProxy:: 00095 saveAsImage ( const PlotterBase * plotter, const std::string & filename ) 00096 { 00097 #if QT_VERSION < 0x040000 00098 lock (); 00099 emit saveAsImageSignal ( plotter, filename ); 00100 unlock (); 00101 #else 00102 emit saveAsImageSignal ( plotter, filename ); 00103 #endif 00104 } 00105 00106 void 00107 CanvasViewProxy:: 00108 swapOrientation () 00109 { 00110 #if QT_VERSION < 0x040000 00111 lock (); 00112 emit swapOrientationSignal (); 00113 unlock (); 00114 #else 00115 emit swapOrientationSignal (); 00116 #endif 00117 }