Fixed bug in copy functionality (due to unset ORIG_START startsector

* include/Dialog_Base_Partition.h,
  src/Dialog_Base_Partition.cc,
  src/Dialog_Partition_Copy.cc,
  src/Dialog_Partition_Resize_Move.cc: Fixed bug in copy functionality (due to unset ORIG_START startsector wasn't set correctly). Also have ORIG*
  initialized in ctor of dialogbase to prevent such errors from ever happening again (this one only showed up with gcc-3.3.5) .
This commit is contained in:
Bart Hakvoort 2005-01-22 17:23:52 +00:00
parent 56c3a42c01
commit f25b28be07
5 changed files with 46 additions and 44 deletions

View File

@ -1,3 +1,11 @@
2005-01-22 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Dialog_Base_Partition.h,
src/Dialog_Base_Partition.cc,
src/Dialog_Partition_Copy.cc,
src/Dialog_Partition_Resize_Move.cc: Fixed bug in copy functionality (due to unset ORIG_START startsector wasn't set correctly). Also have ORIG*
initialized in ctor of dialogbase to prevent such errors from ever happening again (this one only showed up with gcc-3.3.5) .
2005-01-19 Bart Hakvoort <hakvoort@cvs.gnome.org> 2005-01-19 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: removed sleep( 1 ). This isn't needed anymore now the layout is scanned before the re-readtest. (saves seconds at scantime :) ) * src/GParted_Core.cc: removed sleep( 1 ). This isn't needed anymore now the layout is scanned before the re-readtest. (saves seconds at scantime :) )

View File

@ -28,6 +28,7 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
GRIP = false ; GRIP = false ;
this ->fixed_start = false ; this ->fixed_start = false ;
this ->set_resizable( false ); this ->set_resizable( false );
ORIG_BEFORE = ORIG_SIZE = ORIG_AFTER = -1 ;
//pack resizer hbox //pack resizer hbox
this ->get_vbox( ) ->pack_start( hbox_resizer, Gtk::PACK_SHRINK ); this ->get_vbox( ) ->pack_start( hbox_resizer, Gtk::PACK_SHRINK );
@ -92,9 +93,7 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
void Dialog_Base_Partition::Set_Resizer( bool extended ) void Dialog_Base_Partition::Set_Resizer( bool extended )
{ {
if ( extended ) if ( extended )
{
frame_resizer_base = new Frame_Resizer_Extended( ) ; frame_resizer_base = new Frame_Resizer_Extended( ) ;
}
else else
{ {
frame_resizer_base = new Frame_Resizer_Base( ) ; frame_resizer_base = new Frame_Resizer_Base( ) ;
@ -115,10 +114,10 @@ void Dialog_Base_Partition::Set_Resizer( bool extended )
Partition Dialog_Base_Partition::Get_New_Partition( ) Partition Dialog_Base_Partition::Get_New_Partition( )
{ {
if ( ORIG_BEFORE != spinbutton_before .get_value_as_int( ) ) if ( ORIG_BEFORE != spinbutton_before .get_value_as_int( ) )
selected_partition .sector_start = START + (Sector) spinbutton_before .get_value() * MEGABYTE ; selected_partition .sector_start = START + spinbutton_before .get_value_as_int( ) * MEGABYTE ;
if ( ORIG_AFTER != spinbutton_after .get_value_as_int( ) ) if ( ORIG_AFTER != spinbutton_after .get_value_as_int( ) )
selected_partition .sector_end = selected_partition .sector_start + (Sector) spinbutton_size .get_value( ) * MEGABYTE ; selected_partition .sector_end = selected_partition .sector_start + spinbutton_size .get_value_as_int( ) * MEGABYTE ;
//due to loss of precision during calcs from Sector -> MB and back, it is possible the new partition thinks it's bigger then it can be. Here we solve this. //due to loss of precision during calcs from Sector -> MB and back, it is possible the new partition thinks it's bigger then it can be. Here we solve this.
if ( selected_partition .sector_start < START ) if ( selected_partition .sector_start < START )
@ -145,11 +144,9 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
{ {
case NEW : this ->add_button( Gtk::Stock::ADD, Gtk::RESPONSE_OK ); case NEW : this ->add_button( Gtk::Stock::ADD, Gtk::RESPONSE_OK );
break ; break ;
case RESIZE_MOVE: str_temp = fixed_start ? _("Resize") : _("Resize/Move") ; case RESIZE_MOVE: image_temp = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) );
image_temp = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) );
hbox_resize_move .pack_start( *image_temp, Gtk::PACK_EXPAND_PADDING ) ; hbox_resize_move .pack_start( *image_temp, Gtk::PACK_EXPAND_PADDING ) ;
hbox_resize_move .pack_start( * mk_label( str_temp ), Gtk::PACK_EXPAND_PADDING ) ; hbox_resize_move .pack_start( * mk_label( fixed_start ? _("Resize") : _("Resize/Move") ), Gtk::PACK_EXPAND_PADDING ) ;
button_resize_move .add( hbox_resize_move ) ; button_resize_move .add( hbox_resize_move ) ;
this ->add_action_widget ( button_resize_move, Gtk::RESPONSE_OK ) ; this ->add_action_widget ( button_resize_move, Gtk::RESPONSE_OK ) ;
@ -172,10 +169,7 @@ void Dialog_Base_Partition::on_signal_move( int x_start, int x_end )
{ {
GRIP = true ; GRIP = true ;
if ( x_start == 0 ) spinbutton_before .set_value( x_start == 0 ? 0 : x_start * MB_PER_PIXEL ) ;
spinbutton_before .set_value( 0 ) ;
else
spinbutton_before .set_value( x_start * MB_PER_PIXEL ) ;
if ( x_end == 500 ) if ( x_end == 500 )
{ {

View File

@ -72,7 +72,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ; spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
GRIP = false ; GRIP = false ;
frame_resizer_base ->set_size_limits( static_cast<int> (fs .MIN / MB_PER_PIXEL), static_cast<int> (fs .MAX / MB_PER_PIXEL) +1 ) ; frame_resizer_base ->set_size_limits( Round(fs .MIN / MB_PER_PIXEL), Round(fs .MAX / MB_PER_PIXEL) +1 ) ;
//set contents of label_minmax //set contents of label_minmax
Set_MinMax_Text( fs .MIN, fs .MAX ) ; Set_MinMax_Text( fs .MIN, fs .MAX ) ;
@ -80,7 +80,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition ) //set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
this ->selected_partition = copied_partition ; this ->selected_partition = copied_partition ;
this ->selected_partition .inside_extended = selected_partition .inside_extended ; this ->selected_partition .inside_extended = selected_partition .inside_extended ;
selected_partition .inside_extended ? this ->selected_partition .type = GParted::LOGICAL : this ->selected_partition .type = GParted::PRIMARY ; this ->selected_partition .type = selected_partition .inside_extended ? GParted::LOGICAL : GParted::PRIMARY ;
} }
Partition Dialog_Partition_Copy::Get_New_Partition( ) Partition Dialog_Partition_Copy::Get_New_Partition( )

View File

@ -141,7 +141,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
spinbutton_after .set_range( 0, TOTAL_MB - fs .MIN ) ; spinbutton_after .set_range( 0, TOTAL_MB - fs .MIN ) ;
spinbutton_after .set_value( Sector_To_MB( next ) ) ; spinbutton_after .set_value( Sector_To_MB( next ) ) ;
frame_resizer_base ->set_size_limits( static_cast<int> (fs .MIN / MB_PER_PIXEL), static_cast<int> (fs .MAX / MB_PER_PIXEL) +1 ) ; frame_resizer_base ->set_size_limits( Round( fs .MIN / MB_PER_PIXEL ), Round( fs .MAX / MB_PER_PIXEL ) +1 ) ;
//set contents of label_minmax //set contents of label_minmax
Set_MinMax_Text( fs .MIN, fs .MAX ) ; Set_MinMax_Text( fs .MIN, fs .MAX ) ;