Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/plots is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_sg_plots
0005 #define tools_sg_plots
0006 
0007 #include "_switch"
0008 //#include "head_light"
0009 #include "matrix"
0010 
0011 #include "plotter"
0012 
0013 namespace tools {
0014 namespace sg {
0015 
0016 class plots : public node {
0017   TOOLS_NODE(plots,tools::sg::plots,node)
0018 public:
0019   sf<float> width;
0020   sf<float> height;
0021   sf<unsigned int> cols; //must never be 0.
0022   sf<unsigned int> rows; //must never be 0.
0023   sf<bool> view_border; //current plotter border
0024   sf<float> plotter_scale; //scale factor applied to each plotter.
0025 
0026   sf<bool> border_visible;
0027   sf<float> border_width;
0028   sf<float> border_height;
0029   sf<float> border_z;
0030   sf<float> border_scale;
0031   sf_vec<colorf,float> border_color;
0032 
0033   // for gopaw :
0034   sf<float> left_margin;
0035   sf<float> right_margin;
0036   sf<float> top_margin;
0037   sf<float> bottom_margin;
0038   sf<float> horizontal_spacing;
0039   sf<float> vertical_spacing;
0040 public:
0041   virtual const desc_fields& node_desc_fields() const {
0042     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::plots)
0043     static const desc_fields s_v(parent::node_desc_fields(),18, //WARNING : take care of count.
0044       TOOLS_ARG_FIELD_DESC(width),  //1
0045       TOOLS_ARG_FIELD_DESC(height),
0046       TOOLS_ARG_FIELD_DESC(cols),
0047       TOOLS_ARG_FIELD_DESC(rows),
0048       TOOLS_ARG_FIELD_DESC(view_border),
0049       TOOLS_ARG_FIELD_DESC(plotter_scale),
0050       TOOLS_ARG_FIELD_DESC(border_visible),
0051       TOOLS_ARG_FIELD_DESC(border_width),
0052       TOOLS_ARG_FIELD_DESC(border_height),
0053       TOOLS_ARG_FIELD_DESC(border_z),  //10
0054       TOOLS_ARG_FIELD_DESC(border_scale),
0055       TOOLS_ARG_FIELD_DESC(border_color),
0056       TOOLS_ARG_FIELD_DESC(left_margin),
0057       TOOLS_ARG_FIELD_DESC(right_margin),
0058       TOOLS_ARG_FIELD_DESC(top_margin),
0059       TOOLS_ARG_FIELD_DESC(bottom_margin),
0060       TOOLS_ARG_FIELD_DESC(horizontal_spacing),
0061       TOOLS_ARG_FIELD_DESC(vertical_spacing)
0062     );
0063     return s_v;
0064   }
0065   virtual bool touched() {
0066     if(parent::touched()) return true;
0067 
0068      if(m_sep.empty()) return true;
0069      if(m_extras.size()!=m_extras_sep.size()) return true;
0070 
0071   //{size_t _number = m_sep.size();
0072   // for(size_t index=0;index<_number;index++) {
0073   //   separator* sep = (separator*)m_sep[index];
0074   //   plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0075   //   if(_plotter->shape.touched()) return true;
0076   // }}
0077 
0078      return false;
0079    }
0080 private:
0081   void add_fields(){
0082     add_field(&width);
0083     add_field(&height);
0084     add_field(&cols);
0085     add_field(&rows);
0086     add_field(&view_border);
0087     add_field(&plotter_scale);
0088     add_field(&border_visible);
0089     add_field(&border_width);
0090     add_field(&border_height);
0091     add_field(&border_z);
0092     add_field(&border_scale);
0093     add_field(&border_color);
0094     add_field(&left_margin);
0095     add_field(&right_margin);
0096     add_field(&top_margin);
0097     add_field(&bottom_margin);
0098     add_field(&horizontal_spacing);
0099     add_field(&vertical_spacing);
0100   }
0101 private:
0102   static unsigned int MATRIX()  {return 0;}
0103   static unsigned int BORDER()  {return 1;}
0104   static unsigned int PLOTTER() {return 2;}
0105   //static unsigned int TSF()     {return xxx;}
0106   //static unsigned int LIGHT()   {return xxx;}
0107 
0108   typedef std::vector<plottable*> ptbs_t;
0109   typedef std::vector<node*> todels_t;
0110   typedef std::vector<plotprim*> prims_t;
0111 public:
0112 /*
0113   class updater {
0114   public:
0115     virtual void update(plots&,size_t) = 0;
0116     virtual updater* copy() const = 0;
0117   public:
0118     virtual ~updater(){}
0119   };
0120 */
0121 public:
0122   virtual void render(render_action& a_action) {
0123     update_if_touched();
0124     m_group.render(a_action);
0125   }
0126   virtual void pick(pick_action& a_action) {
0127     update_if_touched();
0128     nodekit_pick(a_action,m_group,this);
0129     //m_group.pick(a_action);
0130   }
0131   virtual void search(search_action& a_action) {
0132     update_if_touched();
0133     parent::search(a_action);
0134     if(a_action.done()) return;
0135     if(a_action.do_path()) a_action.path_push(this);
0136     m_group.search(a_action);
0137     if(a_action.done()) return;
0138     if(a_action.do_path()) a_action.path_pop();
0139   }
0140   virtual void bbox(bbox_action& a_action) {
0141     update_if_touched();
0142     m_group.bbox(a_action);
0143   }
0144 
0145   virtual void event(event_action& a_action) {
0146     update_if_touched();
0147     m_group.event(a_action);
0148     if(a_action.done()) return;
0149   }
0150   virtual bool write(write_action& a_action) {
0151     update_if_touched();
0152     return m_group.write(a_action);
0153   }
0154 public:
0155   plots(const base_freetype& a_ttf)
0156   :parent()
0157   ,width(1)
0158   ,height(1)
0159   ,cols(1)
0160   ,rows(1)
0161   ,view_border(true)
0162   ,plotter_scale(1)
0163   ,border_visible(false)
0164   ,border_width(0)
0165   ,border_height(0)
0166   ,border_z(0)
0167   ,border_scale(1)
0168   ,border_color(colorf_grey())
0169   ,left_margin(0)
0170   ,right_margin(0)
0171   ,top_margin(0)
0172   ,bottom_margin(0)
0173   ,horizontal_spacing(0)
0174   ,vertical_spacing(0)
0175 
0176   ,m_ttf(a_ttf)
0177   ,m_current(0)
0178   ,m_extras()
0179   //,m_updater(0)
0180   ,m_old_cols(0)
0181   ,m_old_rows(0)
0182   {
0183     add_fields();
0184     init_sg();
0185   }
0186   virtual ~plots() {
0187     //delete m_updater;
0188   }
0189 public:
0190   plots(const plots& a_from)
0191   :parent(a_from)
0192   ,width(a_from.width)
0193   ,height(a_from.height)
0194   ,cols(a_from.cols)
0195   ,rows(a_from.rows)
0196   ,view_border(a_from.view_border)
0197   ,plotter_scale(a_from.plotter_scale)
0198   ,border_visible(a_from.border_visible)
0199   ,border_width(a_from.border_width)
0200   ,border_height(a_from.border_height)
0201   ,border_z(a_from.border_z)
0202   ,border_scale(a_from.border_scale)
0203   ,border_color(a_from.border_color)
0204   ,left_margin(a_from.left_margin)
0205   ,right_margin(a_from.right_margin)
0206   ,top_margin(a_from.top_margin)
0207   ,bottom_margin(a_from.bottom_margin)
0208   ,horizontal_spacing(a_from.horizontal_spacing)
0209   ,vertical_spacing(a_from.vertical_spacing)
0210 
0211   ,m_ttf(a_from.m_ttf)
0212   ,m_current(a_from.m_current)
0213   ,m_extras(a_from.m_extras)
0214   //,m_updater(0)
0215   ,m_old_cols(0)
0216   ,m_old_rows(0)
0217   ,m_origins(a_from.m_origins)
0218   ,m_sizes(a_from.m_sizes)
0219   ,m_extras_origins(a_from.m_extras_origins)
0220   ,m_extras_sizes(a_from.m_extras_sizes)
0221   {
0222     add_fields();
0223     init_sg();
0224     //m_updater = a_from.m_updater?a_from.m_updater->copy():0;
0225     if(!copy_plotters(a_from)) {}
0226   }
0227   plots& operator=(const plots& a_from){
0228     parent::operator=(a_from);
0229     if(&a_from==this) return *this;
0230 
0231     width = a_from.width;
0232     height = a_from.height;
0233 
0234     cols = a_from.cols;
0235     rows = a_from.rows;
0236     view_border = a_from.view_border;
0237     plotter_scale = a_from.plotter_scale;
0238 
0239     border_visible = a_from.border_visible;
0240     border_width = a_from.border_width;
0241     border_height = a_from.border_height;
0242     border_z = a_from.border_z;
0243     border_scale = a_from.border_scale;
0244     border_color = a_from.border_color;
0245 
0246     left_margin = a_from.left_margin;
0247     right_margin = a_from.right_margin;
0248     top_margin = a_from.top_margin;
0249     bottom_margin = a_from.bottom_margin;
0250     horizontal_spacing = a_from.horizontal_spacing;
0251     vertical_spacing = a_from.vertical_spacing;
0252 
0253     m_old_cols = 0;
0254     m_old_rows = 0;
0255     m_origins = a_from.m_origins;
0256     m_sizes = a_from.m_sizes;
0257     m_extras_origins = a_from.m_extras_origins;
0258     m_extras_sizes = a_from.m_extras_sizes;
0259 
0260     m_current = a_from.m_current;
0261     m_extras = a_from.m_extras;
0262 
0263     if(!copy_plotters(a_from)) {}
0264 
0265     return *this;
0266   }
0267 public:
0268   unsigned int number() const {return cols*rows;}
0269   unsigned int current_index() const {return m_current;}
0270 
0271   void adjust_size(unsigned int a_ww,unsigned int a_wh) {
0272     if(!a_ww||!a_wh) return;
0273     float aspect = float(a_ww)/float(a_wh);
0274     width = height * aspect;
0275   }
0276 
0277   //void enforce_update() { //used in geant4 plotting.
0278   //  update_sg();
0279   //  reset_touched();
0280   //}
0281 
0282   const base_freetype& ttf() const {return m_ttf;}
0283 public:
0284 /*
0285   void set_updater(updater* a_updater) {
0286     //WARNING : we take ownership of a_updater
0287     delete m_updater;
0288     m_updater = a_updater;
0289   }
0290 */
0291   void clear() {
0292     update_if_touched();
0293    {size_t _number = m_sep.size();
0294     for(size_t index=0;index<_number;index++) {
0295       separator* sep = (separator*)m_sep[index];
0296       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0297       _plotter->clear();
0298     }}
0299     tools_vforit(extra,m_extras,it) {
0300       separator* sep = (*it).m_sep;
0301       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0302       _plotter->clear();
0303     }
0304   }
0305 
0306   bool has_data() {
0307     update_if_touched();
0308    {size_t _number = m_sep.size();
0309     for(size_t index=0;index<_number;index++) {
0310       separator* sep = (separator*)m_sep[index];
0311       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0312       if(_plotter->plottables().size()) return true;
0313     }}
0314     tools_vforit(extra,m_extras,it) {
0315       separator* sep = (*it).m_sep;
0316       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0317       if(_plotter->plottables().size()) return true;
0318     }
0319     return false;
0320   }
0321 
0322   void touch_plotters() { //used in exlib/geant4/session.
0323     update_if_touched();
0324    {size_t _number = m_sep.size();
0325     for(size_t index=0;index<_number;index++) {
0326       separator* sep = (separator*)m_sep[index];
0327       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0328       _plotter->touch();
0329     }}
0330     tools_vforit(extra,m_extras,it) {
0331       separator* sep = (*it).m_sep;
0332       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0333       _plotter->touch();
0334     }
0335   }
0336 
0337   void next() {
0338     update_if_touched();
0339     size_t _number = m_sep.size();
0340     if(m_current>=(uint32(_number)-1)) {
0341       m_current = 0;
0342     } else {
0343       m_current++;
0344     }
0345     update_current_border();
0346   }
0347 
0348   bool set_current_plotter(unsigned int a_index) {
0349     update_if_touched();
0350     if(a_index>=m_sep.size()) return false;
0351     m_current = a_index;
0352     update_current_border();
0353     return true;
0354   }
0355 
0356   bool set_current(plotter* a_plotter) { //for popup.
0357     update_if_touched();
0358     size_t _number = m_sep.size();
0359     for(size_t index=0;index<_number;index++) {
0360       separator* sep = (separator*)m_sep[index];
0361       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0362       if(_plotter==a_plotter) {
0363         m_current = uint32(index);
0364         update_current_border();
0365         return true;
0366       }
0367     }
0368     return false;
0369   }
0370 
0371 //  torche* current_torche() {
0372 //    update_if_touched();
0373 //    separator* sep = (separator*)m_sep[m_current];
0374 //    return safe_cast<node,torche>(*((*sep)[LIGHT()]));
0375 //  }
0376 
0377 /*
0378   matrix* current_tsf() {
0379     plotter& _plotter = current_plotter();
0380     if(_plotter.shape.value()==plotter::xyz) {
0381       return &(_plotter.tsf());
0382     } else {
0383       update_if_touched();
0384       separator* sep = (separator*)m_sep[m_current];
0385       return safe_cast<node,matrix>(*((*sep)[TSF()]));
0386     }
0387   }
0388 */
0389 
0390   plotter& current_plotter() {
0391     update_if_touched();
0392     separator* sep = (separator*)m_sep[m_current];
0393     return *((plotter*)(*sep)[PLOTTER()]);
0394   }
0395   plotter* find_plotter(unsigned int a_index) {
0396     update_if_touched();
0397     if(a_index>=m_sep.size()) return 0;
0398     separator* sep = (separator*)m_sep[a_index];
0399     return (plotter*)(*sep)[PLOTTER()];
0400   }
0401 
0402 /*
0403   bool find_plotter(unsigned int a_ww,unsigned int a_wh,
0404                     float a_x,float a_y,
0405                     unsigned int& a_index) {
0406     update_if_touched();
0407 
0408     a_index = 0;
0409 
0410     if(!a_ww) return false;
0411     if(!a_wh) return false;
0412 
0413     float aspect = float(a_ww)/float(a_wh);
0414 
0415     // one plotter in pixels :
0416     unsigned int rw = (unsigned int)(float(a_ww)/float(cols.value()));
0417     unsigned int rh = (unsigned int)(float(a_wh)/float(rows.value()));
0418     float ra = float(rw)/float(rh);
0419 
0420     // all window wc :
0421     float wh_wc = 1;
0422     float ww_wc = wh_wc * aspect;
0423 
0424     // plotter size in window wc :
0425     float rh_wc = wh_wc/rows;
0426     float rw_wc = rh_wc*ra;
0427 
0428     unsigned int _number = m_sep.size();
0429     for(unsigned int index=0;index<_number;index++) {
0430       unsigned int row = index/cols;
0431       unsigned int col = index-cols*row;
0432 
0433       float x = -ww_wc*0.5f + col * rw_wc + rw_wc * 0.5f;
0434       float y =  wh_wc*0.5f - row * rh_wc - rh_wc * 0.5f;
0435 
0436       if( ((x-rw_wc*0.5f)<a_x)&&(a_x<(x+rw_wc*0.5f)) &&
0437           ((y-rh_wc*0.5f)<a_y)&&(a_y<(y+rh_wc*0.5f)) ){
0438         a_index = index;
0439         return true;
0440       }
0441     }
0442 
0443     return false;
0444   }
0445 */
0446 
0447   void set_regions(unsigned int a_cols = 1,unsigned int a_rows = 1,bool a_transfer = false) {
0448     unsigned int oldn = cols*rows;
0449 
0450     std::vector<ptbs_t> ptbss;
0451     std::vector<prims_t> primss;
0452     std::vector<todels_t> tdlss;
0453     std::vector<plotter> pls;
0454 
0455     if(a_transfer) {
0456       ptbss.resize(oldn);
0457       primss.resize(oldn);
0458       tdlss.resize(oldn);
0459       pls.resize(oldn,plotter(m_ttf));
0460       for(unsigned int index=0;index<oldn;index++) {
0461         plotter* p = find_plotter(index);
0462         p->transfer_plottables(ptbss[index]);
0463         p->transfer_primitives(primss[index]);
0464         p->transfer_todels(tdlss[index]);
0465         pls[index] = *p; //to copy styles.
0466       }
0467     }
0468 
0469     cols = a_cols?a_cols:1;
0470     rows = a_rows?a_rows:1;
0471     if(view_border.value()) {view_border = (number()==1?false:true);}
0472     update_sg();
0473     set_current_plotter(0);
0474     clear();
0475     if(a_transfer) {
0476       //fill new plotters with old data :
0477       unsigned int num = min_of(oldn,cols*rows);
0478       for(unsigned int index=0;index<num;index++) {
0479         plotter* p = find_plotter(index);
0480         p->copy_style(pls[index]);  //it must not touch p width, height, depth.
0481 
0482        {const ptbs_t& ptbs = ptbss[index];
0483         tools_vforcit(plottable*,ptbs,it) p->add_plottable(*it);}
0484        {const prims_t& prims = primss[index];
0485         tools_vforcit(plotprim*,prims,it) p->add_primitive(*it);}
0486        {const todels_t& todels = tdlss[index];
0487         tools_vforcit(node*,todels,it) p->add_node_todel(*it);}
0488       }
0489     }
0490     reset_touched();
0491   }
0492 
0493   void current_to_one() {
0494     ptbs_t ptbs;current_plotter().transfer_plottables(ptbs);
0495     prims_t prims;current_plotter().transfer_primitives(prims);
0496     todels_t tdls;current_plotter().transfer_todels(tdls);
0497     plotter pl = current_plotter(); //to copy styles.
0498 
0499     set_regions(1,1,false);
0500 
0501     plotter& p = current_plotter();
0502     p.copy_style(pl); //copy styles.
0503 
0504    {tools_vforcit(plottable*,ptbs,it) p.add_plottable(*it);}
0505    {tools_vforcit(plotprim*,prims,it) p.add_primitive(*it);}
0506    {tools_vforcit(node*,tdls,it) p.add_node_todel(*it);}
0507 
0508   }
0509 
0510   void plotters(std::vector<plotter*>& a_vec) { //a_vec do NOT get ownership of sg::plotter objects. Use in G4Analysis.
0511     a_vec.clear();
0512     update_if_touched();
0513     size_t _number = m_sep.size();
0514     for(size_t index=0;index<_number;index++) {
0515       separator* sep = (separator*)m_sep[index];
0516       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0517       a_vec.push_back(_plotter);
0518     }
0519   }
0520 
0521   //////////////////////////////////////////////////////////////////////
0522   //// styling methods : ///////////////////////////////////////////////
0523   //////////////////////////////////////////////////////////////////////
0524   void set_line_width(float a_line_width) {
0525     update_if_touched();
0526     size_t _number = m_sep.size();
0527     for(size_t index=0;index<_number;index++) {
0528       separator* sep = (separator*)m_sep[index];
0529       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0530 
0531       _plotter->bins_style(0).line_width = a_line_width;
0532       _plotter->inner_frame_style().line_width = a_line_width;
0533       _plotter->grid_style().line_width = a_line_width;
0534       _plotter->x_axis().line_style().width = a_line_width;
0535       _plotter->x_axis().ticks_style().width = a_line_width;
0536       _plotter->y_axis().line_style().width = a_line_width;
0537       _plotter->y_axis().ticks_style().width = a_line_width;
0538       _plotter->z_axis().line_style().width = a_line_width;
0539       _plotter->z_axis().ticks_style().width = a_line_width;
0540       _plotter->colormap_axis().line_style().width = a_line_width;
0541       _plotter->colormap_axis().ticks_style().width = a_line_width;
0542 
0543       // needed if font is hershey :
0544       _plotter->title_style().line_width = a_line_width;
0545       _plotter->infos_style().line_width = a_line_width;
0546       _plotter->title_box_style().line_width = a_line_width;
0547 
0548       _plotter->x_axis().labels_style().line_width = a_line_width;
0549       _plotter->x_axis().mag_style().line_width = a_line_width;
0550       _plotter->x_axis().title_style().line_width = a_line_width;
0551 
0552       _plotter->y_axis().labels_style().line_width = a_line_width;
0553       _plotter->y_axis().mag_style().line_width = a_line_width;
0554       _plotter->y_axis().title_style().line_width = a_line_width;
0555 
0556       _plotter->z_axis().labels_style().line_width = a_line_width;
0557       _plotter->z_axis().mag_style().line_width = a_line_width;
0558       _plotter->z_axis().title_style().line_width = a_line_width;
0559 
0560       _plotter->colormap_axis().labels_style().line_width = a_line_width;
0561       _plotter->colormap_axis().mag_style().line_width = a_line_width;
0562       _plotter->colormap_axis().title_style().line_width = a_line_width;
0563     }
0564   }
0565 
0566 /*
0567   void set_border_style() {
0568     update_if_touched();
0569     size_t _number = m_sep.size();
0570     for(size_t index=0;index<_number;index++) {
0571       separator* sep = (separator*)m_sep[index];
0572       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0573       _plotter->background_style().visible = true;
0574       _plotter->background_style().color = colorf_black();
0575       _plotter->background_style().line_width = 0.003;
0576     }
0577     border_visible = true;
0578   }
0579 */
0580 
0581   void set_grids_visibility(bool a_visible = false) {
0582     update_if_touched();
0583     size_t _number = m_sep.size();
0584     for(size_t index=0;index<_number;index++) {
0585       separator* sep = (separator*)m_sep[index];
0586       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0587       _plotter->grid_style().visible = a_visible;
0588     }
0589     border_visible = true;
0590   }
0591 
0592   void adjust_scales(float a_plotter_scale = 1) {
0593     // Rescale some plotter parameters (for example margins) according to the number of plots.
0594     // We assume that these parameters had been set previously according to one plot per page.
0595     // Then this function must be applied after all the styles had been applied (because
0596     // a plotting style may set these parameters).
0597 
0598     float ww_wc = width.value();
0599     float wh_wc = height.value();
0600     float rw_wc = ww_wc/cols.value();
0601     float rh_wc = wh_wc/rows.value();
0602 
0603     float cooking = 1.2f; //if increased the data area is diminished.
0604 
0605     float wfac = (rw_wc/ww_wc)*cooking;
0606     float hfac = (rh_wc/wh_wc)*cooking;
0607 
0608     float label_cooking = 1.6f; //if increased the labels are bigger.
0609 
0610     if((cols.value()>=4)&&(cols.value()>rows.value())) label_cooking = 0.9f;
0611 
0612     float title_cooking = 1.1f; //extra title cooking.
0613 
0614     plotter_scale = a_plotter_scale;
0615 
0616     update_if_touched();
0617    {size_t _number = m_sep.size();
0618     for(size_t index=0;index<_number;index++) {
0619       separator* sep = (separator*)m_sep[index];
0620       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0621 
0622       _plotter->left_margin = _plotter->left_margin * wfac;
0623       _plotter->right_margin = _plotter->right_margin * wfac;
0624       _plotter->bottom_margin = _plotter->bottom_margin * hfac;
0625       _plotter->top_margin = _plotter->top_margin * hfac;
0626 
0627       _plotter->x_axis().tick_length = _plotter->x_axis().tick_length * wfac;
0628       _plotter->y_axis().tick_length = _plotter->y_axis().tick_length * hfac;
0629 
0630       _plotter->title_to_axis = _plotter->title_to_axis * hfac;
0631       _plotter->title_height = _plotter->title_height * hfac * title_cooking;
0632 
0633       _plotter->x_axis().label_height = _plotter->x_axis().label_height * hfac * label_cooking;
0634       _plotter->y_axis().label_height = _plotter->y_axis().label_height * hfac * label_cooking;
0635     }}
0636   }
0637 
0638   //gopaw:
0639   void configure_grid_PAW(unsigned int a_ww,unsigned int a_wh) {
0640 
0641     m_origins.clear();
0642     m_sizes.clear();
0643 
0644     float wvp = float(a_ww); //pixels.
0645     float hvp = float(a_wh); //pixels.
0646     if( (wvp<=0)||(hvp<=0)||(width.value()<=0)||(height.value()<=0) ) return;
0647 
0648     unsigned int _cols = cols.value();
0649     unsigned int _rows = rows.value();
0650     if((!_cols)||(!_rows)) return;
0651 
0652     float wdata = (width.value()-left_margin.value()-right_margin.value()-(_cols-1)*horizontal_spacing.value())/_cols;
0653     float hdata = (height.value()-bottom_margin.value()-top_margin.value()-(_rows-1)*vertical_spacing.value())/_rows;
0654 
0655     if((wdata<=0)||(hdata<=0)) return;
0656 
0657 /*
0658     //    wpix = w * wvp pixels
0659     //    hpix = h * hvp pixels
0660     //  wpix/hpix = cst = (w * wvp) / (h * hvp) = width / height
0661     float h,w,xo,yo;
0662     h = w = xo = yo = 0;
0663     float waspect = wvp/hvp;
0664     float paspect = width.value()/height.value();
0665     if(waspect>=paspect) {
0666       h = 1;
0667       w = paspect * h * (hvp/wvp);
0668       xo = (1-w)/2;
0669       yo = 0;
0670     } else {
0671       w = 1;
0672       h = w * (wvp/hvp)/paspect;
0673       xo = 0;
0674       yo = (1-h)/2;
0675     }
0676     float xfac = w / width.value();
0677     float yfac = h / height.value();
0678 */
0679 
0680     unsigned int _num = number();
0681     for(unsigned int iregion=0;iregion<_num;iregion++) {
0682       //iregion = col + row * cols
0683       unsigned int row = iregion/_cols;
0684       unsigned int col = iregion - row * _cols;
0685 
0686       float wr,hr,x,y,lm,rm,bm,tm;
0687       wr = hr = x = y = 0;
0688       lm = rm = bm = tm = 0;
0689 
0690       if(_cols==1) {
0691         wr = width.value();
0692         x = 0;
0693         lm = left_margin.value();
0694         rm = right_margin.value();
0695       } else {
0696         float wrl = left_margin.value()+wdata+horizontal_spacing.value()/2;
0697         float wrr = right_margin.value()+wdata+horizontal_spacing.value()/2;
0698         float wri = wdata+horizontal_spacing.value();
0699         if(col==0) {
0700           wr = wrl;
0701           x = 0;
0702           lm = left_margin.value();
0703           rm = horizontal_spacing.value()/2;
0704         } else if(col==(_cols-1)) {
0705           wr = wrr;
0706           x = width.value() - wrr;
0707           lm = horizontal_spacing.value()/2;
0708           rm = right_margin.value();
0709         } else {
0710           wr = wri;
0711           x = wrl + (col-1) * wri;
0712           lm = horizontal_spacing.value()/2;
0713           rm = horizontal_spacing.value()/2;
0714         }
0715       }
0716 
0717       if(_rows==1) {
0718         hr = height.value();
0719         y = 0;
0720         tm = top_margin.value();
0721         bm = bottom_margin.value();
0722       } else {
0723         float hrt = top_margin.value()+hdata+vertical_spacing.value()/2; //top
0724         float hrb = bottom_margin.value()+hdata+vertical_spacing.value()/2;     //bottom
0725         float hri = hdata+vertical_spacing.value();
0726         if(row==0) { //top row.
0727           hr = hrt;
0728           y = height.value()-hrt;
0729           tm = top_margin.value();
0730           bm = vertical_spacing.value()/2;
0731         } else if(row==(_rows-1)) {
0732           hr = hrb;
0733           y = 0;
0734           tm = vertical_spacing.value()/2;
0735           bm = bottom_margin.value();
0736         } else {
0737           hr = hri;
0738           y = height.value()- (hrt + row * hri);
0739           tm = vertical_spacing.value()/2;
0740           bm = vertical_spacing.value()/2;
0741         }
0742       }
0743 
0744       //m_origins.push_back(vec2f(xo/xfac+x,yo/yfac+y));
0745       m_origins.push_back(vec2f(x,y));
0746       m_sizes.push_back(vec2f(wr,hr));
0747 
0748       separator* sep = (separator*)m_sep[iregion];
0749       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0750 
0751       //_plotter->width = wr;
0752       _plotter->left_margin = lm;
0753       _plotter->right_margin = rm;
0754 
0755       //_plotter->height = hr;
0756       _plotter->top_margin = tm;
0757       _plotter->bottom_margin = bm;
0758 
0759       // ignore margins and spacings :
0760       //float wr = w/_cols;
0761       //float hr = h/_rows;
0762       //float x = xo + col * wr;
0763       //float y = yo + (rows-1-row) * hr;
0764       //viewportRegion->setPositionPercent(x,y);
0765       //viewportRegion->setSizePercent(wr,hr);
0766 
0767     }
0768   }
0769 
0770   void configure_extras_PAW(unsigned int a_ww,unsigned int a_wh) {
0771 
0772     m_extras_origins.clear();
0773     m_extras_sizes.clear();
0774 
0775     float wvp = float(a_ww); //pixels.
0776     float hvp = float(a_wh); //pixels.
0777     if( (wvp<=0)||(hvp<=0)||(width.value()<=0)||(height.value()<=0) ) return;
0778 
0779     tools_vforcit(extra,m_extras,it) {
0780       const extra& _extra = *it;
0781 
0782       unsigned int _cols = _extra.m_cols;
0783       unsigned int _rows = _extra.m_rows;
0784       if((!_cols)||(!_rows)) continue;
0785 
0786       float wdata = (width.value()-left_margin.value()-right_margin.value()-(_cols-1)*horizontal_spacing.value())/_cols;
0787       float hdata = (height.value()-bottom_margin.value()-top_margin.value()-(_rows-1)*vertical_spacing.value())/_rows;
0788 
0789       if((wdata<=0)||(hdata<=0)) continue;
0790 
0791       unsigned int iregion = _extra.m_index;
0792       unsigned int row = iregion/_cols;
0793       unsigned int col = iregion - row * _cols;
0794 
0795       float wr,hr,x,y,lm,rm,bm,tm;
0796       wr = hr = x = y = 0;
0797       lm = rm = bm = tm = 0;
0798 
0799       if(_cols==1) {
0800         wr = width.value();
0801         x = 0;
0802         lm = left_margin.value();
0803         rm = right_margin.value();
0804       } else {
0805         float wrl = left_margin.value()+wdata+horizontal_spacing.value()/2;
0806         float wrr = right_margin.value()+wdata+horizontal_spacing.value()/2;
0807         float wri = wdata+horizontal_spacing.value();
0808         if(col==0) {
0809           wr = wrl;
0810           x = 0;
0811           lm = left_margin.value();
0812           rm = horizontal_spacing.value()/2;
0813         } else if(col==(_cols-1)) {
0814           wr = wrr;
0815           x = width.value() - wrr;
0816           lm = horizontal_spacing.value()/2;
0817           rm = right_margin.value();
0818         } else {
0819           wr = wri;
0820           x = wrl + (col-1) * wri;
0821           lm = horizontal_spacing.value()/2;
0822           rm = horizontal_spacing.value()/2;
0823         }
0824       }
0825 
0826       if(_rows==1) {
0827         hr = height.value();
0828         y = 0;
0829         tm = top_margin.value();
0830         bm = bottom_margin.value();
0831       } else {
0832         float hrt = top_margin.value()+hdata+vertical_spacing.value()/2; //top
0833         float hrb = bottom_margin.value()+hdata+vertical_spacing.value()/2;     //bottom
0834         float hri = hdata+vertical_spacing.value();
0835         if(row==0) { //top row.
0836           hr = hrt;
0837           y = height.value()-hrt;
0838           tm = top_margin.value();
0839           bm = vertical_spacing.value()/2;
0840         } else if(row==(_rows-1)) {
0841           hr = hrb;
0842           y = 0;
0843           tm = vertical_spacing.value()/2;
0844           bm = bottom_margin.value();
0845         } else {
0846           hr = hri;
0847           y = height.value()- (hrt + row * hri);
0848           tm = vertical_spacing.value()/2;
0849           bm = vertical_spacing.value()/2;
0850         }
0851       }
0852 
0853       //m_extras_origins.push_back(vec2f(xo/xfac+x,yo/yfac+y));
0854       m_extras_origins.push_back(vec2f(x,y));
0855       m_extras_sizes.push_back(vec2f(wr,hr));
0856 
0857       separator* sep = _extra.m_sep;
0858       plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
0859 
0860       //_plotter->width = wr;
0861       _plotter->left_margin = lm;
0862       _plotter->right_margin = rm;
0863 
0864       //_plotter->height = hr;
0865       _plotter->top_margin = tm;
0866       _plotter->bottom_margin = bm;
0867 
0868       // ignore margins and spacings :
0869       //float wr = w/_cols;
0870       //float hr = h/_rows;
0871       //float x = xo + col * wr;
0872       //float y = yo + (rows-1-row) * hr;
0873       //viewportRegion->setPositionPercent(x,y);
0874       //viewportRegion->setSizePercent(wr,hr);
0875 
0876     } //tools_vforcit
0877   }
0878   void configure_PAW(unsigned int a_ww,unsigned int a_wh) {
0879     configure_grid_PAW(a_ww,a_wh);
0880     configure_extras_PAW(a_ww,a_wh);
0881     touch();
0882     update_if_touched();
0883   }
0884   //////////////////////////////////////////////////////////////////////
0885   //////////////////////////////////////////////////////////////////////
0886   //////////////////////////////////////////////////////////////////////
0887 
0888   //gopaw:
0889   void delete_extras() {
0890     m_extras_sep.clear();
0891     m_extras.clear();
0892   }
0893 
0894   plotter* create_extra_plotter(unsigned int a_cols,unsigned int a_rows,unsigned int a_index) {
0895     // Create a plotter with size and position as if in a grid of a_colsxa_rows and at position a_index.
0896     // The index numbering being for example for a grid of 3x2 :
0897     //  0 1 2
0898     //  3 4 5
0899     m_extras.push_back(extra(a_cols,a_rows,a_index));
0900     update_if_touched();
0901     separator* sep = m_extras.back().m_sep;
0902     return (plotter*)(*sep)[PLOTTER()];
0903   }
0904   plotter* last_extra_plotter() const {
0905     if(m_extras.empty()) return 0;
0906     separator* sep = m_extras.back().m_sep;
0907     return (plotter*)(*sep)[PLOTTER()];
0908   }
0909 public:
0910   void init_sg() {  // used also in gopaw::base_viewer::clean_gstos().
0911     m_group.clear();
0912     m_sep.clear();
0913     m_border_sep.clear();
0914     m_extras_sep.clear();
0915     m_group.add(new noderef(m_sep));
0916     m_group.add(new noderef(m_border_sep));
0917     m_group.add(new noderef(m_extras_sep));
0918   }
0919   void clear_sg() { //used in GL_plots_viewer.
0920     m_group.clear();
0921     m_sep.clear();
0922     m_border_sep.clear();
0923     m_extras_sep.clear();
0924   }
0925 protected:
0926   void update_if_touched() {
0927     if(touched()) {
0928       update_sg();
0929       reset_touched();
0930     }
0931   }
0932   void update_sg(){
0933 
0934     if(m_sep.empty()||(cols.value()!=m_old_cols)||(rows.value()!=m_old_rows)){
0935 
0936       m_old_cols = cols;
0937       m_old_rows = rows;
0938 
0939       m_sep.clear();
0940 
0941       for(unsigned int irow=0;irow<rows;irow++) {
0942         for(unsigned int icol=0;icol<cols;icol++) {
0943           separator* sep = new separator;
0944           m_sep.add(sep);
0945 
0946           sep->add(new sg::matrix); //MATRIX()
0947 
0948           //head_light* light = new head_light;
0949           //light->direction = vec3f(1,-1,-10);
0950           //light->on = false;
0951           //sep->add(light); //LIGHT()
0952 
0953           _switch* border = new _switch;
0954           sep->add(border); //BORDER()
0955 
0956           //matrix* tsf = new matrix;
0957           //sep->add(tsf); //TSF()
0958 
0959           sep->add(new plotter(m_ttf)); //PLOTTER()
0960         }
0961       }
0962 
0963       if(m_current>=m_sep.size()) m_current = 0;
0964     }
0965 
0966     update_current_border();
0967     update_border();
0968 
0969     if((width.value()>0)&&(height.value()>0)) {
0970       size_t _number = m_sep.size();
0971 
0972       bool configure = (m_origins.size()==_number)&&(m_sizes.size()==_number)?true:false;
0973 
0974       // all window wc :
0975       float ww_wc = width;
0976       float wh_wc = height;
0977 
0978       // plotter size in window wc :
0979       //float rw_wc = ww_wc/cols;
0980       //float rh_wc = wh_wc/rows;
0981 
0982       for(size_t index=0;index<_number;index++) {
0983         separator* sep = (separator*)m_sep[index];
0984         set_plotter_layout(*sep,index,configure,cols.value(),rows.value(),
0985                            ww_wc,wh_wc,m_origins,m_sizes,plotter_scale.value());
0986       }
0987     }
0988 
0989     update_extras();
0990   }
0991 
0992   bool copy_plotters(const plots& a_from) {
0993     update_if_touched();
0994     if(m_sep.size()==a_from.m_sep.size()) {
0995       size_t _number = m_sep.size();
0996       for(size_t index=0;index<_number;index++) {
0997         separator* _from_sep = (separator*)a_from.m_sep[index];
0998         matrix* _from_matrix = (matrix*)(*_from_sep)[MATRIX()];
0999         //_switch* _border = (_switch*)(*_sep)[BORDER()];
1000         plotter* _from_plotter = (plotter*)(*_from_sep)[PLOTTER()];
1001 
1002         separator* _sep = (separator*)m_sep[index];
1003         matrix* _matrix = (matrix*)(*_sep)[MATRIX()];
1004         plotter* _plotter = (plotter*)(*_sep)[PLOTTER()];
1005 
1006         _matrix->operator=(*_from_matrix);
1007         _plotter->operator=(*_from_plotter);
1008       }
1009     }
1010     if(m_extras_sep.size()==a_from.m_extras_sep.size()) {
1011       size_t _number = m_extras_sep.size();
1012       for(size_t index=0;index<_number;index++) {
1013         separator* _from_sep = (separator*)a_from.m_extras_sep[index];
1014         matrix* _from_matrix = (matrix*)(*_from_sep)[MATRIX()];
1015         plotter* _from_plotter = (plotter*)(*_from_sep)[PLOTTER()];
1016 
1017         separator* _sep = (separator*)m_extras_sep[index];
1018         matrix* _matrix = (matrix*)(*_sep)[MATRIX()];
1019         plotter* _plotter = (plotter*)(*_sep)[PLOTTER()];
1020 
1021         _matrix->operator=(*_from_matrix);
1022         _plotter->operator=(*_from_plotter);
1023       }
1024     }
1025     return true;
1026   }
1027 
1028   static void create_plotter_border(_switch& a_parent,float a_w,float a_h) {
1029     a_parent.clear();
1030 
1031     group* sep = new group;
1032     a_parent.add(sep);
1033 
1034     a_parent.add(new group()); //empty
1035 
1036     rgba* mat = new rgba();
1037     mat->color = colorf_red();
1038     sep->add(mat);
1039 
1040     draw_style* ds = new draw_style;
1041     ds->style = draw_lines;
1042     ds->line_width = 4;
1043     sep->add(ds);
1044 
1045     vertices* vtxs = new vertices;
1046     vtxs->mode = gl::line_strip();
1047     sep->add(vtxs);
1048 
1049     float dw = a_w*0.5f;
1050     float dh = a_h*0.5f;
1051     vtxs->add(-dw,-dh,0);
1052     vtxs->add( dw,-dh,0);
1053     vtxs->add( dw, dh,0);
1054     vtxs->add(-dw, dh,0);
1055     vtxs->add(-dw,-dh,0);
1056   }
1057 
1058   void update_current_border() {
1059     size_t _number = m_sep.size();
1060     for(size_t index=0;index<_number;index++) {
1061       separator* sep = (separator*)m_sep[index];
1062       _switch* _border = (_switch*)(*sep)[BORDER()];
1063       if(index==m_current) {
1064         _border->which = view_border.value()?0:1;
1065         //if(m_updater) m_updater->update(*this,index);
1066       } else {
1067         _border->which = 1;
1068       }
1069     }
1070   }
1071 
1072   void update_border() {
1073     m_border_sep.clear();
1074 
1075     if(!border_visible.value()) return;
1076 
1077     if(width.value()<=0) return;
1078     if(height.value()<=0) return;
1079     if(border_width.value()<=0) return;
1080     if(border_height.value()<=0) return;
1081 
1082     // border_scale could be used as an offscreen (inzb_[ps,png,jpeg], gl2s_pdf)
1083     // cooking to avoid seeing a one pixel line at some side (in general left)
1084     // coming from the border.
1085     if(border_scale.value()!=1) {
1086       matrix* _m = new matrix;
1087       _m->set_scale(border_scale.value(),border_scale.value(),1);
1088       m_border_sep.add(_m);
1089     }
1090 
1091     float bw = border_width;
1092     float bh = border_height;
1093 
1094     // do it with four externals back_area.
1095 
1096     float zz = border_z.value();
1097 
1098     // top :
1099    {separator* sep = new separator;
1100     m_border_sep.add(sep);
1101 
1102     float wba = width+2*bw;
1103     float hba = bh;
1104     float x = 0;
1105     float y = height*0.5f+bh*0.5f;
1106 
1107     matrix* _m = new matrix;
1108     _m->set_translate(x,y,zz);
1109     sep->add(_m);
1110 
1111     back_area* b = new back_area;
1112     b->border_visible = false;
1113     b->color = border_color;
1114     b->width = wba;
1115     b->height = hba;
1116     sep->add(b);}
1117 
1118     // bottom :
1119    {separator* sep = new separator;
1120     m_border_sep.add(sep);
1121 
1122     float wba = width+2*bw;
1123     float hba = bh;
1124     float x = 0;
1125     float y = -height*0.5f-bh*0.5f;
1126 
1127     matrix* _m = new matrix;
1128     _m->set_translate(x,y,zz);
1129     sep->add(_m);
1130 
1131     back_area* b = new back_area;
1132     b->border_visible = false;
1133     b->color = border_color;
1134     b->width = wba;
1135     b->height = hba;
1136     sep->add(b);}
1137 
1138     // left :
1139    {separator* sep = new separator;
1140     m_border_sep.add(sep);
1141 
1142     float wba = bw;
1143     float hba = height+2*bh;
1144     float x = -width*0.5f-bw*0.5f;
1145     float y = 0;
1146 
1147     matrix* _m = new matrix;
1148     _m->set_translate(x,y,zz);
1149     sep->add(_m);
1150 
1151     back_area* b = new back_area;
1152     b->border_visible = false;
1153     b->color = border_color;
1154     b->width = wba;
1155     b->height = hba;
1156     sep->add(b);}
1157 
1158     // right :
1159    {separator* sep = new separator;
1160     m_border_sep.add(sep);
1161 
1162     float wba = bw;
1163     float hba = height+2*bh;
1164     float x = width*0.5f+bw*0.5f;
1165     float y = 0;
1166 
1167     matrix* _m = new matrix;
1168     _m->set_translate(x,y,zz);
1169     sep->add(_m);
1170 
1171     back_area* b = new back_area;
1172     b->border_visible = false;
1173     b->color = border_color;
1174     b->width = wba;
1175     b->height = hba;
1176     sep->add(b);}
1177 
1178   }
1179 protected:
1180   class extra {
1181   public:
1182     extra(unsigned int a_cols,unsigned int a_rows,unsigned int a_index)
1183     :m_cols(a_cols),m_rows(a_rows),m_index(a_index),m_sep(0){}
1184     virtual ~extra(){}
1185   public:
1186     extra(const extra& a_from):m_cols(a_from.m_cols),m_rows(a_from.m_rows),m_index(a_from.m_index),m_sep(0){}
1187     extra& operator=(const extra& a_from) {
1188       m_cols = a_from.m_cols;
1189       m_rows = a_from.m_rows;
1190       m_index = a_from.m_index;
1191       m_sep = a_from.m_sep;
1192       return *this;
1193     }
1194   public:
1195     unsigned int m_cols;
1196     unsigned int m_rows;
1197     unsigned int m_index;
1198     separator* m_sep;
1199   };
1200 
1201   void update_extras() {
1202     if(m_extras.size()!=m_extras_sep.size()) {
1203       m_extras_sep.clear();
1204       tools_vforit(extra,m_extras,it) { // same sg layout than grid plotters.
1205         separator* sep = new separator;
1206         m_extras_sep.add(sep);
1207         (*it).m_sep = sep; //*it does not get ownership.
1208 
1209         sep->add(new sg::matrix); //MATRIX()
1210 
1211         //head_light* light = new head_light;
1212         //light->direction = vec3f(1,-1,-10);
1213         //light->on = false;
1214         //sep->add(light); //LIGHT()
1215 
1216         _switch* border = new _switch;
1217         sep->add(border); //BORDER()
1218 
1219         //matrix* tsf = new matrix;
1220         //sep->add(tsf); //TSF()
1221 
1222         sep->add(new plotter(m_ttf)); //PLOTTER()
1223       }
1224     }
1225 
1226     if(width.value()<=0) return;
1227     if(height.value()<=0) return;
1228 
1229     // all window wc :
1230     float ww_wc = width;
1231     float wh_wc = height;
1232 
1233     size_t _number = m_extras.size();
1234 
1235     bool configure = (m_extras_origins.size()==_number)&&(m_extras_sizes.size()==_number)?true:false;
1236 
1237     tools_vforcit(extra,m_extras,it) {
1238       const extra& _extra = *it;
1239       unsigned int index = _extra.m_index;
1240       if(index>=(m_extras_sep.size())) index = 0;
1241 
1242       separator* sep = _extra.m_sep;
1243       set_plotter_layout(*sep,index,configure,_extra.m_cols,_extra.m_rows,
1244                          ww_wc,wh_wc,m_extras_origins,m_extras_sizes,plotter_scale.value());
1245     }
1246 
1247   }
1248 protected:
1249   static void set_plotter_layout(separator& a_sep,size_t a_index,bool a_configure,
1250                           unsigned int a_cols,unsigned int a_rows,
1251                           float a_ww_wc,float a_wh_wc,
1252                           const std::vector<vec2f>& a_origins,const std::vector<vec2f>& a_sizes,float a_scale) {
1253     size_t row = a_index/a_cols;
1254     size_t col = a_index-a_cols*row;
1255 
1256     float rw_wc = a_ww_wc/a_cols;
1257     float rh_wc = a_wh_wc/a_rows;
1258 
1259     matrix* _matrix = (matrix*)(a_sep)[MATRIX()];
1260     plotter* _plotter = (plotter*)(a_sep)[PLOTTER()];
1261 
1262     if(a_configure) {
1263       _plotter->width = a_sizes[a_index].x();
1264       _plotter->height = a_sizes[a_index].y();
1265       float x = -a_ww_wc*0.5f + a_origins[a_index].x() + _plotter->width*0.5f;
1266       float y = -a_wh_wc*0.5f + a_origins[a_index].y() + _plotter->height*0.5f;
1267       _matrix->set_translate(x,y,0);
1268     } else {
1269       float x = -a_ww_wc*0.5f + col * rw_wc + rw_wc * 0.5f;
1270       float y =  a_wh_wc*0.5f - row * rh_wc - rh_wc * 0.5f;
1271       _matrix->set_translate(x,y,0);
1272     }
1273     _matrix->mul_scale(a_scale,a_scale,1); //applied first.
1274 
1275    {_switch* _border = (_switch*)(a_sep)[BORDER()];
1276     create_plotter_border(*_border,rw_wc,rh_wc);
1277     //_border->which = view_border.value()?(a_index==m_current?0:1):1;
1278     _border->which = 1;
1279     }
1280 
1281     if(_plotter->shape.value()==plotter::xy) {
1282       _plotter->depth = min_of(rw_wc,rh_wc);
1283     } else {
1284       //if((rw_wc/rh_wc)>=1.0f) {
1285       //  _plotter->depth = rh_wc;
1286       //} else {
1287       //  _plotter->depth = rh_wc;
1288       //}
1289       _plotter->depth = rh_wc;
1290     }
1291 
1292     if(a_configure) {
1293     } else {
1294       if(_plotter->shape.value()==plotter::xy) {
1295         _plotter->width = rw_wc;
1296         _plotter->height = rh_wc;
1297       } else {
1298         if((rw_wc/rh_wc)>=1.0f) {
1299           _plotter->width = rh_wc;
1300           _plotter->height = rh_wc;
1301         } else {
1302           _plotter->width = rw_wc;
1303           _plotter->height = rw_wc;
1304         }
1305       }
1306     }
1307   }
1308 protected:
1309   const base_freetype& m_ttf;
1310 
1311   group m_group;
1312   separator m_sep;
1313   separator m_border_sep;
1314   separator m_extras_sep;
1315   unsigned int m_current;
1316 
1317   std::vector<extra> m_extras;
1318 
1319   //updater* m_updater;
1320   unsigned int m_old_cols;
1321   unsigned int m_old_rows;
1322 
1323   std::vector<vec2f> m_origins;
1324   std::vector<vec2f> m_sizes;
1325   std::vector<vec2f> m_extras_origins;
1326   std::vector<vec2f> m_extras_sizes;
1327 
1328 };
1329 
1330 }}
1331 
1332 #endif