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10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.
  3 
  4 #ifndef tools_viewplot
  5 #define tools_viewplot
  6 
  7 #include "sg/plots_viewer"
  8 
  9 #include "sg/dummy_freetype"
 10 #include "sg/plotter_style"
 11 
 12 #include "wps"
 13 
 14 namespace tools {
 15 
 16 class viewplot : public sg::plots_viewer {
 17   typedef sg::plots_viewer parent;
 18 public:
 19   viewplot(std::ostream& a_out,
 20            unsigned int a_cols = 1,unsigned int a_rows = 1,
 21            unsigned int a_width = 500,unsigned int a_height = 500)
 22   :parent(a_out,m_ttf,a_cols,a_rows,a_width,a_height)
 23   ,m_wps(a_out)
 24   ,m_ttf()
 25   ,m_styles(a_out)
 26   {}
 27   viewplot(std::ostream& a_out,const sg::base_freetype& a_ttf,
 28            unsigned int a_cols = 1,unsigned int a_rows = 1,
 29            unsigned int a_width = 500,unsigned int a_height = 500)
 30   :parent(a_out,a_ttf,a_cols,a_rows,a_width,a_height)
 31   ,m_wps(a_out)
 32   ,m_ttf()
 33   ,m_styles(a_out)
 34   {}
 35   virtual ~viewplot() {}
 36 public:
 37   viewplot(const viewplot& a_from)
 38   :parent(a_from)
 39   ,m_wps(a_from.m_out)
 40   ,m_styles(a_from.m_styles)
 41   {}
 42   viewplot& operator=(const viewplot& a_from){
 43     parent::operator=(a_from);
 44     m_styles = a_from.m_styles;
 45     return *this;
 46   }
 47 public:
 48 #ifdef tools_viewplot
 49   //deprecated, use set_current_plotter_style().
 50   void style_from_res(const std::string& a_path,bool a_verbose = false) {
 51     style_from_res(a_path,m_plots.current_plotter(),a_verbose);
 52   }
 53 #endif
 54   void set_current_plotter_style(const std::string& a_path,bool a_verbose = false) {
 55     style_from_res(a_path,m_plots.current_plotter(),a_verbose);
 56   }
 57 
 58 public:
 59   void set_cols_rows(unsigned int a_cols,unsigned int a_rows) {
 60     m_plots.cols = a_cols;
 61     m_plots.rows = a_rows;
 62     m_plots.adjust_size(width(),height());
 63   }
 64 
 65 //#ifdef tools_viewplot
 66   bool write(const std::string& a_file,bool a_anonymous = false) {
 67     return parent::write_inzb_ps(a_file,a_anonymous);
 68   }
 69   bool open_file(const std::string& a_file,bool a_anonymous = false) {return open_inzb_ps_file(a_file,a_anonymous);}
 70   bool write_page() {return write_inzb_ps_page();}
 71   bool close_file() {return close_inzb_ps_file();}
 72 //#endif
 73 
 74 
 75   const xml::styles& styles() const {return m_styles;}
 76   xml::styles& styles() {return m_styles;}
 77 
 78 protected:
 79   void style_from_res(const std::string& a_path,sg::plotter& a_plotter,bool a_verbose) {
 80     sg::style_from_res(m_styles,a_path,a_plotter,a_verbose);
 81   }
 82 
 83 protected:
 84   sg::zb_manager m_mgr;
 85   wps m_wps;
 86   sg::dummy_freetype m_ttf;
 87   xml::styles m_styles;
 88 };
 89 
 90 }
 91 
 92 #endif
 93