maskfld.cpp Corretta picture_data per non trimmare sempre
msksheet.cpp Aggiunta funzione set_column_justify msksheet.h Dichiarazione della funzione precedente git-svn-id: svn://10.65.10.50/trunk@2116 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									4dfa755e87
								
							
						
					
					
						commit
						f69408386c
					
				| @ -2179,7 +2179,8 @@ const char* TEdit_field::format(const char* d) const | |||||||
| const char* TEdit_field::picture_data(const char* data, bool video) const | const char* TEdit_field::picture_data(const char* data, bool video) const | ||||||
| { | { | ||||||
|   fpark = video ? data : format(data); |   fpark = video ? data : format(data); | ||||||
|   return fpark.trim(); |   if (_flags.trim) fpark.trim(); | ||||||
|  |   return fpark; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -126,6 +126,9 @@ protected: | |||||||
|   // @cmember Permette di fare tutti gli aggiornamenti necessari (indicati in
 |   // @cmember Permette di fare tutti gli aggiornamenti necessari (indicati in
 | ||||||
|   //          <p _needs_update>)
 |   //          <p _needs_update>)
 | ||||||
|   void on_idle(); |   void on_idle(); | ||||||
|  |                        | ||||||
|  |   // @cmember Cerca la colonna col                    
 | ||||||
|  |   XI_OBJ* TSpreadsheet::find_column(int col) const; | ||||||
| 
 | 
 | ||||||
|   // @access Public Member
 |   // @access Public Member
 | ||||||
| public: | public: | ||||||
| @ -170,7 +173,8 @@ public: | |||||||
|   void set_column_width(const int col, const int width) const; |   void set_column_width(const int col, const int width) const; | ||||||
|   // @cmember Setta il titolo della colonna
 |   // @cmember Setta il titolo della colonna
 | ||||||
|   void set_column_header(const int col, const TString& header) const; |   void set_column_header(const int col, const TString& header) const; | ||||||
| 
 |   // @cmember Setta l'allinemento di una colonna
 | ||||||
|  |   void set_column_justify(int col, bool right); | ||||||
|   // @cmember Permette di abilitare/disabilitare una singola cella
 |   // @cmember Permette di abilitare/disabilitare una singola cella
 | ||||||
|   void enable_cell(int row, int column, bool on = TRUE); |   void enable_cell(int row, int column, bool on = TRUE); | ||||||
|   // @cmember Controlla se una cella e' disabilitata
 |   // @cmember Controlla se una cella e' disabilitata
 | ||||||
| @ -1200,6 +1204,7 @@ public: | |||||||
|   void move_column( const int fromindex, const int toindex ) const; |   void move_column( const int fromindex, const int toindex ) const; | ||||||
|   void set_column_width( const int col, const int width ) const; |   void set_column_width( const int col, const int width ) const; | ||||||
|   void set_column_header( const int col, const TString& header ) const; |   void set_column_header( const int col, const TString& header ) const; | ||||||
|  |   void set_column_justify(int col, bool right); | ||||||
|    |    | ||||||
|   void enable_cell(int row, int column, bool on = TRUE); |   void enable_cell(int row, int column, bool on = TRUE); | ||||||
|   bool cell_disabled(int row, int column) const; |   bool cell_disabled(int row, int column) const; | ||||||
| @ -1400,11 +1405,13 @@ void TSpreadsheet::enable_column( | |||||||
|         if (on) attr |= XI_ATR_ENABLED; |         if (on) attr |= XI_ATR_ENABLED; | ||||||
|         else    attr &= ~XI_ATR_ENABLED; |         else    attr &= ~XI_ATR_ENABLED; | ||||||
| 
 | 
 | ||||||
|         xi_move_focus(_itf);                  // Set focus to interface
 | //        xi_move_focus(_itf);                  // Set focus to interface
 | ||||||
|         xi_set_attrib(column, attr);          // Set new attributes
 |         xi_set_attrib(column, attr);          // Set new attributes
 | ||||||
|  | /*        
 | ||||||
|         RCT r; xi_get_rect(column, &r);  |         RCT r; xi_get_rect(column, &r);  | ||||||
|         xi_set_column_width(column, (r.right-r.left+1) / CHARX);   // Force redraw
 |         xi_set_column_width(column, (r.right-r.left+1) / CHARX);   // Force redraw
 | ||||||
|          | */     | ||||||
|  |         update(-1); | ||||||
|         break; |         break; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
| @ -1412,16 +1419,34 @@ void TSpreadsheet::enable_column( | |||||||
| #endif  | #endif  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Matteo
 | // @mfunc Cerca la colonna col
 | ||||||
| 
 | XI_OBJ* TSpreadsheet::find_column( | ||||||
|  |   int col) const    // @param  Indice o identificatore colonna
 | ||||||
|  | {      | ||||||
|  |   CHECKD(col >= 0, "Bad column ", col); | ||||||
|  |   if (col < columns())         // Se e' un indice trasformalo in identificatore
 | ||||||
|  |     col += FIRST_FIELD; | ||||||
|  |   int num; | ||||||
|  |   XI_OBJ** columns = xi_get_member_list(_list, &num); | ||||||
|  |   for (int c = 1; c < num; c++) | ||||||
|  |   {           | ||||||
|  |     if (columns[c]->cid == col) | ||||||
|  |       break; | ||||||
|  |   }   | ||||||
|  |    | ||||||
|  |   if (c == num) | ||||||
|  |   { | ||||||
|  |     yesnofatal_box("Can't find column with id=%d", col); | ||||||
|  |     c = 0; | ||||||
|  |   }   | ||||||
|  |    | ||||||
|  |   return columns[c]; | ||||||
|  | } | ||||||
|  |           | ||||||
| void TSpreadsheet::delete_column( const int col ) const | void TSpreadsheet::delete_column( const int col ) const | ||||||
| {    | {    | ||||||
| #if XVT_OS == XVT_OS_WIN | #if XVT_OS == XVT_OS_WIN | ||||||
|   int num; |   XI_OBJ* column = find_column(col); | ||||||
|   XI_OBJ** columns = xi_get_member_list(_list, &num); |  | ||||||
|   CHECKD( col+1 < num, "Can't delete column ", col ); |  | ||||||
|   XI_OBJ* column = columns[ col+1]; |  | ||||||
|    |  | ||||||
|   xi_delete( column ); |   xi_delete( column ); | ||||||
| #endif    | #endif    | ||||||
| } | } | ||||||
| @ -1430,7 +1455,6 @@ void TSpreadsheet::delete_column( const int col ) const | |||||||
| void TSpreadsheet::move_column( const int fromindex, const int toindex) const | void TSpreadsheet::move_column( const int fromindex, const int toindex) const | ||||||
| { | { | ||||||
| #if XVT_OS == XVT_OS_WIN | #if XVT_OS == XVT_OS_WIN | ||||||
|    |  | ||||||
|   int num; |   int num; | ||||||
|   XI_OBJ** columns = xi_get_member_list(_list, &num); |   XI_OBJ** columns = xi_get_member_list(_list, &num); | ||||||
|   CHECKD(fromindex+1 < num, "Can't move column ", fromindex); |   CHECKD(fromindex+1 < num, "Can't move column ", fromindex); | ||||||
| @ -1481,11 +1505,7 @@ void TSpreadsheet::swap_rows( const int fromindex, const int toindex) | |||||||
| void TSpreadsheet::set_column_width(const int col, const int width) const | void TSpreadsheet::set_column_width(const int col, const int width) const | ||||||
| { | { | ||||||
| #if XVT_OS == XVT_OS_WIN       | #if XVT_OS == XVT_OS_WIN       | ||||||
|   int num; |   XI_OBJ* column = find_column(col); | ||||||
|   XI_OBJ** columns = xi_get_member_list(_list, &num); |  | ||||||
|   CHECKD(col+1 < num, "Can't set column width ", col); |  | ||||||
|   XI_OBJ* column = columns[col+1]; |  | ||||||
|    |  | ||||||
|   xi_set_column_width(column, width);   // Force redraw
 |   xi_set_column_width(column, width);   // Force redraw
 | ||||||
| #endif    | #endif    | ||||||
| } | } | ||||||
| @ -1493,18 +1513,26 @@ void TSpreadsheet::set_column_width(const int col, const int width) const | |||||||
| void TSpreadsheet::set_column_header(const int col, const TString&  header) const | void TSpreadsheet::set_column_header(const int col, const TString&  header) const | ||||||
| { | { | ||||||
| #if XVT_OS == XVT_OS_WIN | #if XVT_OS == XVT_OS_WIN | ||||||
|   int num; |   XI_OBJ* column = find_column(col); | ||||||
|   XI_OBJ** columns = xi_get_member_list(_list, &num); |  | ||||||
|   CHECKD(col+1 < num, "Can't set column width ", col); |  | ||||||
|   XI_OBJ* column = columns[col+1]; |  | ||||||
|    |  | ||||||
|   xi_set_text(column, (char *)(const char *)header ); |   xi_set_text(column, (char *)(const char *)header ); | ||||||
|   RCT r; xi_get_rect(column, &r);  |   RCT r; xi_get_rect(column, &r);  | ||||||
|   xi_set_column_width(column, (r.right-r.left+1) / CHARX);   // Force redraw
 |   xi_set_column_width(column, (r.right-r.left+1) / CHARX);   // Force redraw
 | ||||||
| #endif    | #endif    | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | void TSpreadsheet::set_column_justify(int col, bool right) | ||||||
|  | { | ||||||
|  | #if XVT_OS == XVT_OS_WIN | ||||||
|  |   XI_OBJ* column = find_column(col); | ||||||
|  |   dword attr = xi_get_attrib(column); | ||||||
|  |   if (right) | ||||||
|  |     attr |= XI_ATR_RJUST; | ||||||
|  |   else | ||||||
|  |     attr &= ~XI_ATR_RJUST;   | ||||||
|  |   xi_set_attrib(column, attr);          // Set new attribute
 | ||||||
|  |   update(-1); | ||||||
|  | #endif | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| // Certified 99%
 | // Certified 99%
 | ||||||
| // @mfunc Controlla se una cella o un'intera riga e' disabilitata
 | // @mfunc Controlla se una cella o un'intera riga e' disabilitata
 | ||||||
| @ -1890,6 +1918,14 @@ void TSheet_field::set_column_header( const int col, const TString& header ) con | |||||||
|   _sheet->set_column_header(col, header); |   _sheet->set_column_header(col, header); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void TSheet_field::set_column_justify(int col, bool right) | ||||||
|  | {                  | ||||||
|  |   if (col < FIRST_FIELD) | ||||||
|  |     col += FIRST_FIELD; | ||||||
|  |   sheet_mask().field(col).set_justify(right); | ||||||
|  |   _sheet->set_column_justify(col, right); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| TMask& TSheet_field::sheet_mask() const | TMask& TSheet_field::sheet_mask() const | ||||||
| { | { | ||||||
|   return _sheet->sheet_mask(); |   return _sheet->sheet_mask(); | ||||||
|  | |||||||
| @ -123,6 +123,9 @@ public: | |||||||
|   void set_column_width( const int col, const int width ) const; |   void set_column_width( const int col, const int width ) const; | ||||||
|   // @cmember Setta il titolo della colonna
 |   // @cmember Setta il titolo della colonna
 | ||||||
|   void set_column_header( const int col, const TString& header ) const; |   void set_column_header( const int col, const TString& header ) const; | ||||||
|  |   // @cmember Setta l'allineamento della colonna
 | ||||||
|  |   void set_column_justify(int col, bool right); | ||||||
|  | 
 | ||||||
|   // @cmember Setta il member <p _append> con il valore di <p on>
 |   // @cmember Setta il member <p _append> con il valore di <p on>
 | ||||||
|   void set_append(bool on = TRUE) |   void set_append(bool on = TRUE) | ||||||
|   { _append =  on;} |   { _append =  on;} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user