From 2860691ebf91ec87a60110158560ddf1b6d15367 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Wed, 15 Dec 2004 11:02:54 +0000 Subject: [PATCH] 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. --- ChangeLog | 4 ++++ src/Dialog_Partition_Copy.cc | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6cabd56b..1f7a48ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-12-15 Bart Hakvoort + + * src/Dialog_Partition_Copy: fixed small error with incorrect display of used space and did some cleanups. + 2004-12-15 Bart Hakvoort * Refined checks for functionality a bit. e.g. even if a filesystem can't be read, it's still possible to grow it diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc index 1ecd610d..dcf0cd9f 100644 --- a/src/Dialog_Partition_Copy.cc +++ b/src/Dialog_Partition_Copy.cc @@ -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 ;