fixed small error with incorrect display of used space and did some

* src/Dialog_Partition_Copy: fixed small error with incorrect display of used space and did some cleanups.
This commit is contained in:
Bart Hakvoort 2004-12-15 11:02:54 +00:00
parent d100935b55
commit 2860691ebf
2 changed files with 15 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2004-12-15 Bart Hakvoort <gparted@users.sf.net>
* src/Dialog_Partition_Copy: fixed small error with incorrect display of used space and did some cleanups.
2004-12-15 Bart Hakvoort <gparted@users.sf.net>
* Refined checks for functionality a bit. e.g. even if a filesystem can't be read, it's still possible to grow it

View File

@ -42,33 +42,35 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
//set some widely used values...
START = selected_partition .sector_start ;
total_length = selected_partition .sector_end - selected_partition .sector_start ;
TOTAL_MB = selected_partition .Get_Length_MB() ;
TOTAL_MB = selected_partition .Get_Length_MB( ) ;
MB_PER_PIXEL = (double) TOTAL_MB / 500 ;
//now calculate proportional length of partition
frame_resizer_base ->set_x_start( 0 ) ;
frame_resizer_base ->set_x_end( ( Round( (double) (copied_partition .sector_end - copied_partition .sector_start) / ( (double)total_length/500) )) ) ;
frame_resizer_base ->set_used( frame_resizer_base ->get_x_end( ) ) ;
frame_resizer_base ->set_used( Round( (double) copied_partition .sectors_used / ( (double)total_length/500) ) ) ;
if ( ! fs .MAX )
fs .MAX = TOTAL_MB ;
fs .MIN = copied_partition .Get_Length_MB( ) +1 ;
//set values of spinbutton_before
spinbutton_before .set_range( 0, TOTAL_MB - copied_partition .Get_Length_MB( ) -1 ) ;//mind the -1 !!
spinbutton_before .set_range( 0, TOTAL_MB - fs .MIN ) ;
spinbutton_before .set_value( 0 ) ;
//set values of spinbutton_size
spinbutton_size .set_range( copied_partition .Get_Length_MB( ) +1, fs .MAX ) ;
spinbutton_size .set_value( copied_partition .Get_Length_MB( ) ) ;
spinbutton_size .set_range( fs .MIN, fs .MAX ) ;
spinbutton_size .set_value( fs .MIN ) ;
//set values of spinbutton_after
spinbutton_after .set_range( 0, TOTAL_MB - copied_partition .Get_Length_MB( ) -1 ) ;
spinbutton_after .set_value( TOTAL_MB - copied_partition .Get_Length_MB( ) ) ;
spinbutton_after .set_range( 0, TOTAL_MB - fs .MIN ) ;
spinbutton_after .set_value( TOTAL_MB - fs .MIN ) ;
frame_resizer_base ->set_size_limits( (int) (fs .MIN / MB_PER_PIXEL), (int) (fs .MAX / MB_PER_PIXEL) +1 ) ;
frame_resizer_base ->set_size_limits( (int) ( fs .MIN / MB_PER_PIXEL), (int) (fs .MAX / MB_PER_PIXEL) +1 ) ;
//set contents of label_minmax
Set_MinMax_Text( copied_partition .Get_Length_MB( ) +1, fs .MAX ) ;
Set_MinMax_Text( fs .MIN, fs .MAX ) ;
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
this ->selected_partition = copied_partition ;