Velocizzato update di una singola riga dello sheet
Migliorato calcolo occupazione in memoria di una colonna dello sheet Rimosse zone commentate secoli fa' git-svn-id: svn://10.65.10.50/trunk@1327 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									c1c44caf43
								
							
						
					
					
						commit
						784310b32a
					
				@ -144,7 +144,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    TString80 testa(h);
 | 
					    TString80 testa(h);
 | 
				
			||||||
    const int at = testa.find('@');
 | 
					    const int at = testa.find('@');
 | 
				
			||||||
    int m, v;
 | 
					    int m, v;                                         // Memory and video width
 | 
				
			||||||
    if (at >= 0)
 | 
					    if (at >= 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      const TString& wi = testa.mid(at+1);
 | 
					      const TString& wi = testa.mid(at+1);
 | 
				
			||||||
@ -163,14 +163,11 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
 | 
				
			|||||||
      v = m+(f->has_query() ? 1 : 0);
 | 
					      v = m+(f->has_query() ? 1 : 0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
#ifdef DBG
 | 
					 | 
				
			||||||
    if (f->is_edit() && m < f->size())
 | 
					    if (f->is_edit() && m < f->size())
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      yesnofatal_box("Il campo %d della maschera e' piu' largo della colonna %s", 
 | 
					 | 
				
			||||||
                     cid, (const char*)testa);
 | 
					 | 
				
			||||||
      m = f->size();
 | 
					      m = f->size();
 | 
				
			||||||
    }
 | 
					    if (v > 69)
 | 
				
			||||||
#endif    
 | 
					      v = 69;  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_width[i] = m+1;                                 // m = number of allowed chars
 | 
					    m_width[i] = m+1;                                 // m = number of allowed chars
 | 
				
			||||||
    v_width[i] = v+1;                                 // v = width of column
 | 
					    v_width[i] = v+1;                                 // v = width of column
 | 
				
			||||||
    if (v >= max_width) max_width = v+1;
 | 
					    if (v >= max_width) max_width = v+1;
 | 
				
			||||||
@ -232,8 +229,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
 | 
				
			|||||||
  if (attr & XI_ATR_SELECTABLE)
 | 
					  if (attr & XI_ATR_SELECTABLE)
 | 
				
			||||||
  { 
 | 
					  { 
 | 
				
			||||||
    coldef->v.column->icon_rid = ICO_SEARCH;
 | 
					    coldef->v.column->icon_rid = ICO_SEARCH;
 | 
				
			||||||
    coldef->v.column->icon_x = 2; // (v_width[i]*CHARX-16) >> 1;
 | 
					    coldef->v.column->icon_x = 2; 
 | 
				
			||||||
    //    coldef->v.column->icon_y = (CHARY-16) >> 1; 
 | 
					 | 
				
			||||||
    listdef->v.list->min_heading_height = 16;
 | 
					    listdef->v.list->min_heading_height = 16;
 | 
				
			||||||
  }  
 | 
					  }  
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
@ -264,19 +260,6 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
 | 
				
			|||||||
                               (char*)(const char*)testo);
 | 
					                               (char*)(const char*)testo);
 | 
				
			||||||
    coldef->v.column->heading_platform = TRUE;
 | 
					    coldef->v.column->heading_platform = TRUE;
 | 
				
			||||||
    coldef->v.column->center_heading = TRUE;
 | 
					    coldef->v.column->center_heading = TRUE;
 | 
				
			||||||
    //    if (acqua == CLASS_BUTTON_FIELD)
 | 
					 | 
				
			||||||
    //    {
 | 
					 | 
				
			||||||
    //      const TFixed_string testa(header.get(i));
 | 
					 | 
				
			||||||
    //      const int diesis = testa.find('#');
 | 
					 | 
				
			||||||
    //      if (diesis > 0) 
 | 
					 | 
				
			||||||
    //      {
 | 
					 | 
				
			||||||
    //        _button = testa.mid(diesis+1);
 | 
					 | 
				
			||||||
    //        coldef->v.column->icon_x = (v_width[i]*CHARX-16) >> 1;
 | 
					 | 
				
			||||||
    //        coldef->v.column->icon_y = (CHARY-16) >> 1;  
 | 
					 | 
				
			||||||
    //        coldef->v.column->column_platform = TRUE;
 | 
					 | 
				
			||||||
    //      }  
 | 
					 | 
				
			||||||
    //      else _button = testo;
 | 
					 | 
				
			||||||
    //    }  
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  RCT itfrct;
 | 
					  RCT itfrct;
 | 
				
			||||||
@ -379,7 +362,15 @@ void TSpreadsheet::update_rec(int rec)
 | 
				
			|||||||
    XI_MAKE_ROW(&row, _list, riga);
 | 
					    XI_MAKE_ROW(&row, _list, riga);
 | 
				
			||||||
    xi_cell_request(&row);              // Update internal values
 | 
					    xi_cell_request(&row);              // Update internal values
 | 
				
			||||||
    if (_update)
 | 
					    if (_update)
 | 
				
			||||||
      xi_set_row_height(&row, CHARY+1); // Force row updating
 | 
					    {
 | 
				
			||||||
 | 
					      //      xi_set_row_height(&row, CHARY+1); // Force row updating
 | 
				
			||||||
 | 
					      XI_OBJ cell;     
 | 
				
			||||||
 | 
					      for (int c = 1; c < _columns; c++)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        XI_MAKE_CELL(&cell, _list, riga, c);
 | 
				
			||||||
 | 
					        xi_set_text(&cell, xi_get_text(&cell, NULL, -1));
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }  
 | 
				
			||||||
  }  
 | 
					  }  
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -414,7 +405,7 @@ void TSpreadsheet::set_focus_cell(int riga, int colonna)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int TSpreadsheet::insert(int rec)
 | 
					int TSpreadsheet::insert(int rec)
 | 
				
			||||||
{               
 | 
					{               
 | 
				
			||||||
  if (items() >= 999)
 | 
					  if (items() >= 999 || !_active)
 | 
				
			||||||
    return -1;
 | 
					    return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const int r = _str.insert(new TToken_string(80), rec);
 | 
					  const int r = _str.insert(new TToken_string(80), rec);
 | 
				
			||||||
@ -426,7 +417,7 @@ int TSpreadsheet::insert(int rec)
 | 
				
			|||||||
    return -1;
 | 
					    return -1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _disabled.insert(NULL, rec);
 | 
					  _disabled.insert(NULL, r);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  xi_insert_row(_list, INT_MAX);
 | 
					  xi_insert_row(_list, INT_MAX);
 | 
				
			||||||
  xi_cell_request(_list);
 | 
					  xi_cell_request(_list);
 | 
				
			||||||
@ -488,8 +479,9 @@ bool TSpreadsheet::test_focus_change()
 | 
				
			|||||||
  bool ok = dirty() != 3;
 | 
					  bool ok = dirty() != 3;
 | 
				
			||||||
  if (ok && _row_dirty)   
 | 
					  if (ok && _row_dirty)   
 | 
				
			||||||
  {               
 | 
					  {               
 | 
				
			||||||
    str2mask(selected());
 | 
					    //    str2mask(selected());
 | 
				
			||||||
    ok = sheet_mask().check_fields();                           
 | 
					    //    ok = sheet_mask().check_fields();                           
 | 
				
			||||||
 | 
					    ok = xi_move_focus(_itf) ? TRUE : FALSE;
 | 
				
			||||||
  }  
 | 
					  }  
 | 
				
			||||||
  return ok;
 | 
					  return ok;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user