fixed some bugs with minimum size of resizable partition + some
* include/Dialog_Partition_Resize_Move.h, src/Dialog_Partition_Resize_Move.cc: fixed some bugs with minimum size of resizable partition + some codecleanups.
This commit is contained in:
parent
641c4504bf
commit
32cd2f2548
|
@ -1,3 +1,8 @@
|
|||
2004-10-21 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* include/Dialog_Partition_Resize_Move.h,
|
||||
src/Dialog_Partition_Resize_Move.cc: fixed some bugs with minimum size of resizable partition + some codecleanups.
|
||||
|
||||
2004-10-20 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* src/Dialog_Base_Partition.cc (Get_New_Partition): Tweaked resizingbehaviour a bit. This solved some minor annoyances.
|
||||
|
|
|
@ -33,6 +33,8 @@ private:
|
|||
void Resize_Move_Normal( const std::vector <Partition> & partitions ) ;
|
||||
void Resize_Move_Extended( const std::vector <Partition> & partitions ) ;
|
||||
|
||||
short BUF ; //added to the min. size a filesystem can be..( safety reasons )
|
||||
|
||||
};
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace GParted
|
|||
|
||||
Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( )
|
||||
{
|
||||
BUF = 5 ;
|
||||
}
|
||||
|
||||
void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partition, const std::vector <Partition> & partitions )
|
||||
|
@ -107,30 +108,36 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
|||
frame_resizer_base ->set_x_end( ( Round( (double) (selected_partition.sector_end - selected_partition.sector_start) / ( (double)total_length/500) )) + frame_resizer_base ->get_x_start() ) ;
|
||||
frame_resizer_base ->set_used( Round( (double) selected_partition.sectors_used / ( (double)total_length/500) ) ) ;
|
||||
|
||||
//set values of spinbutton_before
|
||||
if ( ! fixed_start )
|
||||
{
|
||||
spinbutton_before .set_range( 0, Sector_To_MB(total_length - selected_partition.sectors_used) -1 ) ;//mind the -1 !!
|
||||
spinbutton_before .set_value( Sector_To_MB( previous ) ) ;
|
||||
}
|
||||
|
||||
//set values of spinbutton_size
|
||||
//since some filesystems have upper and lower limits we need to check for this
|
||||
long LOWER, UPPER;
|
||||
if ( selected_partition.filesystem == "fat16" && selected_partition .Get_Used_MB() < 32 )
|
||||
LOWER = 32 +1 ;
|
||||
LOWER = 32 +BUF ;
|
||||
else if ( selected_partition.filesystem == "fat32" && selected_partition .Get_Used_MB() < 256 )
|
||||
LOWER = 256 +1; //when shrinking to 256 the filesystem converts to fat16, thats why i added the 1
|
||||
LOWER = 256 +BUF;
|
||||
else if ( selected_partition.filesystem == "reiserfs" && selected_partition .Get_Used_MB() < 40 )
|
||||
LOWER = 40 ;
|
||||
else
|
||||
LOWER = selected_partition .Get_Used_MB() +1;
|
||||
LOWER = selected_partition .Get_Used_MB() +BUF;
|
||||
|
||||
//in certain (rare) case LOWER is a bit too high...
|
||||
if ( LOWER > selected_partition .Get_Length_MB( ) )
|
||||
LOWER = selected_partition .Get_Length_MB( ) ;
|
||||
|
||||
if ( selected_partition.filesystem == "fat16" && Sector_To_MB( total_length ) > 1023 )
|
||||
UPPER = 1023 ;
|
||||
else
|
||||
UPPER = Sector_To_MB( total_length ) ;
|
||||
|
||||
|
||||
//set values of spinbutton_before
|
||||
if ( ! fixed_start )
|
||||
{
|
||||
spinbutton_before .set_range( 0, Sector_To_MB( total_length ) - LOWER ) ;
|
||||
spinbutton_before .set_value( Sector_To_MB( previous ) ) ;
|
||||
}
|
||||
|
||||
//set values of spinbutton_size
|
||||
spinbutton_size .set_range( LOWER, UPPER ) ;
|
||||
spinbutton_size .set_value( selected_partition .Get_Length_MB() ) ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue